summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-04-08 14:14:34 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-04-08 14:24:59 -0400
commitf47919f1fe367b612fa9c96d34c59f01a541e882 (patch)
tree5b6aa2fc36747d868897e68ccbec0c6db0aee81c /bpmn
parent54452b80a1cf4d22ef750bc1377f8c1b05431d57 (diff)
Replaced all tabs with spaces in java and pom.xml
Added in maven plugins to enforce coding style rules Added in eclipse java formatting xml Change-Id: I3727bbf4ce8dc66abfd8ad21b6cfd0890c5d3ff0 Issue-ID: SO-1765 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java119
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigModifyAction.java53
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigScaleOutPayload.java83
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java53
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java53
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java66
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/HealthCheckAction.java53
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/QuiesceTrafficAction.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigModify.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigScaleOut.java82
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java52
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ResumeTrafficAction.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/SnapshotAction.java53
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/StartStopAction.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/UpgradeAction.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java18
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGenerator.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectExecution.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java53
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java73
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MalformedBuildingBlockInputException.java35
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MissingBuildingBlockInputException.java35
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/RequiredExecutionVariableExeception.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnIntegerParam.java35
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnParam.java55
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java58
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java86
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java42
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java82
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java66
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/ICryptoHandler.java8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java48
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidator.java30
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java219
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunner.java41
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowCallbackResponse.java54
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContext.java133
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java194
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowResponse.java101
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java19
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java33
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java143
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AllottedResource.java184
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CloudRegion.java171
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Collection.java125
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java403
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java52
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Customer.java132
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Entitlement.java71
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Evc.java247
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ForwarderEvc.java136
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java909
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/HostRoute.java97
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/InstanceGroup.java184
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv4AddressList.java145
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv6AddressList.java176
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java487
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java302
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java170
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java57
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Metadatum.java73
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/NetworkPolicy.java114
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/OwningEntity.java69
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java83
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java157
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Platform.java57
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java129
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Project.java56
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTableReference.java89
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTarget.java38
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SegmentationAssignment.java49
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java353
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceProxy.java107
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java79
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SriovVf.java241
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java267
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java96
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java221
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java244
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java260
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java180
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBinding.java32
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java167
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java98
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java81
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java188
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/GeneralBuildingBlock.java109
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java12
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java168
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputException.java9
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java44
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java21
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java208
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java193
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java105
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java25
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java50
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java121
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoAllottedResource.java266
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java160
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java118
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java264
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoInstanceGroup.java123
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoMetadata.java120
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoNetwork.java316
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java116
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVfModule.java240
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java34
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java3452
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java864
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java769
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java140
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java289
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java206
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundException.java44
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundException.java44
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java298
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerCallback.java26
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java316
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClientV2.java195
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java82
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestrator.java41
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestratorException.java21
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java341
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBean.java18
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AsyncRequestStatus.java182
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/InstanceReferences.java16
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/RequestStatus.java96
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java71
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java114
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java187
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java11
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java67
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java70
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java155
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java110
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java69
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java69
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DefaultDmaapPropertiesImpl.java19
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java157
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesMap.java15
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java44
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BBObjectNotFoundException.java23
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java9
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java189
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/MapperException.java9
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/OrchestrationStatusValidationException.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java59
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/PolicyRestPropertiesImpl.java66
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/UrnPropertiesReaderWrapper.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllBaseTaskTestSuite.java8
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllGroovyTestSuites.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllTestSuites.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java168
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseUnitTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java960
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java28
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/NonSpringSuite.java1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/SerializableChecker.java66
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java18
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplicationConfig.java114
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java100
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/BeansTest.java60
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGeneratorTest.java52
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/DelegateExecutionImplTest.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java73
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java20
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java45
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java522
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java65
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java62
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java13
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java52
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/BpmnParamTest.java49
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/BpmnRestClientTest.java23
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceInputTest.java94
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequestTest.java76
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java610
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/util/CryptoHandlerTest.java55
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunnerTest.java84
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyDisabledValidator.java19
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorFour.java17
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorOne.java19
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorThree.java17
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorTwo.java18
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/ValidationConfig.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorOne.java19
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorTwo.java18
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunnerTest.java82
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/FileUtil.java85
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java2047
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAPPC.java49
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseDatabase.java145
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseNetworkAdapter.java137
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseOof.java20
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponsePolicy.java141
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java133
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSNIRO.java46
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java244
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBDecompPojoTest.java32
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBPojoTest.java51
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java379
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/SerializationTest.java86
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputExceptionTest.java79
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java1296
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java5280
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java1480
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java207
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java407
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundExceptionTest.java77
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundExceptionTest.java77
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/ResponseExceptionMapperImplTest.java100
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java858
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerClientV2Test.java160
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerSupportTest.java78
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBeansTest.java37
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java15
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnfTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnfTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnfTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnfTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnfTest.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnfTest.java1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnfTest.java1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnfTest.java1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java102
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java35
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java87
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/AAIPropertiesImplTest.java38
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/PolicyRestPropertiesImplTest.java44
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java122
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/test/categories/SpringAware.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BadInjectedFieldException.java47
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java183
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/MissingInjectedFieldException.java20
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java506
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/RollbackData.java6
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java34
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java115
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java221
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CompareModelsResult.java56
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ConfigResource.java23
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Configuration.java124
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Customer.java43
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java246
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/InventoryType.java21
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java177
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/License.java149
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ModelInfo.java155
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ModuleResource.java151
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java120
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/OwningEntity.java40
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Project.java23
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Request.java137
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Resource.java224
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceDecomposition.java117
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceInstance.java54
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceModelInfo.java71
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceType.java4
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/RollbackData.java26
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java1034
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java210
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Subscriber.java58
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Vnf.java235
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java319
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/internal/VariableNameExtractor.java16
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/DecomposeJsonUtil.java97
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java1955
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/xml/XmlTool.java359
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BadInjectedFiledExceptionTest.java61
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java440
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BeansTest.java67
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/MissingInjectedFiledExceptionTest.java47
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/ResponseBuilderTest.java173
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/RollbackDataTest.java13
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/UrnPropertiesReaderTest.java13
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/WorkflowExceptionTest.java60
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/AllottedResourceTest.java97
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/CompareModelsResultTest.java127
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ConfigResourceTest.java47
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ConfigurationTest.java62
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/CustomerTest.java44
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/DomainPojoTest.java38
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/HomingSolutionTest.java84
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/LicenseTest.java71
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ModelInfoTest.java62
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ModuleResourceTest.java64
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/NetworkResourceTest.java73
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/OwningEntityTest.java44
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ProjectTest.java40
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/RequestTest.java56
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ResourceDecompositionTest.java68
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ResourceTest.java102
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java208
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceInstanceTest.java101
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/SubscriberTest.java50
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java159
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/internal/VariableNameExtractorTest.java4
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/DecomposeJsonUtilTest.java295
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonDecomposingExceptionTest.java45
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtils2Test.java220
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtilsTest.java429
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/utils/CamundaDBSetup.java66
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/xml/XmlToolTest.java118
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/CallbackHeader.java56
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactory.java24
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/RequestHeader.java87
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java68
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java35
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java6
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java19
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/package-info.java3
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/CreateVnfNotification.java232
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java117
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoExceptionCategory.java12
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoRequest.java37
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/ObjectFactory.java26
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/QueryVnfNotification.java243
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/RollbackVnfNotification.java86
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/UpdateVnfNotification.java151
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify.java117
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java34
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java96
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfStatus.java12
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java719
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java62
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java74
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java313
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java6
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java206
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java113
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java104
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java1060
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java510
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java208
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java71
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java77
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java31
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java62
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java52
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java48
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java27
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/InfraEmbeddedMariaDbConfig.java24
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/IntegrationTestSuite.java4
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java604
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java282
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java158
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java104
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java432
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java178
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java76
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java453
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java343
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java71
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java110
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java20
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java45
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java522
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java16
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java640
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java625
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java334
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java68
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ReceiveWorkflowMessageTest.java183
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterCallbackRule.java81
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java145
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java65
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java1008
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java257
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java197
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java600
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowAsyncResourceTest.java98
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java63
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java4245
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java13
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java1
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerServiceTest.java1
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java61
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/FlakyTests.java2
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java47
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java1
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/AbstractTestBase.java56
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java596
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java394
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java465
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java589
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java473
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java591
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java238
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java228
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java127
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/AllTestSuites.java6
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BaseTest.java184
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BaseUnitTest.java2
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java881
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java28
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/MockLoggerDelegate.java16
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/SerializableChecker.java66
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/TestApplication.java18
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java344
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAICheckVnfInMaintBBTest.java47
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAISetVnfInMaintBBTest.java45
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAIUnsetVnfInMaintBBTest.java49
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/SDNOHealthCheckBBTest.java49
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecsTest.java55
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java210
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.java26
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkCollectionBBTest.java27
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateServiceInstanceBBTest.java23
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java73
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVnfBBTest.java23
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVolumeGroupBBTest.java39
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetworkBBTest.java41
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignServiceInstanceBBTest.java27
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVfModuleBBTest.java48
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVnfBBTest.java49
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVolumeGroupBBTest.java39
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/BuildingBlockValidatorRunnerTest.java8
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelServiceInstanceBBTest.java49
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVfModuleBBTest.java45
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVnfBBTest.java45
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java42
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateCustomerBBTest.java39
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java32
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkCollectionBBTest.java31
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java169
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java72
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateNetworkBBTest.java43
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.java22
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVfModuleBBTest.java50
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVnfBBTest.java65
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVolumeGroupBBTest.java37
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteInstanceGroupBBTest.java41
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteNetworkBBTest.java31
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteNetworkCollectionBBTest.java32
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java74
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java42
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficActivityTest.java47
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java48
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ExecuteBuildingBlockTest.java179
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java46
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java45
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/HomingBBTest.java60
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java121
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/SDNCHandlerTest.java60
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java34
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignServiceInstanceBBTest.java26
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVfModuleBBTest.java69
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVnfBBTest.java91
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVolumeGroupBBTest.java39
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java45
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java50
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java46
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java47
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java47
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java47
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java47
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java49
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetClosedLoopDisabledFlagActivityTest.java47
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetInMaintFlagActivityTest.java46
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSnapShotActivityTest.java47
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java47
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java47
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java47
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java48
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetInMaintFlagActivityTest.java46
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java50
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java47
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java47
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java47
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java19
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java112
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java34
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java22
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstance.java263
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java166
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java36
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java155
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGenerator.java21
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java49
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareCdsCallDelegate.java26
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegate.java26
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegate.java41
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java19
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java16
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsOperationKey.java3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/VimLocation.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java1386
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java94
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java27
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java21
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java38
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java9
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java400
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java35
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilder.java28
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputParametersEntity.java5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllBPMNTestSuites.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTasksTestsTestSuite.java8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java17
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/BeansTest.java51
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java31
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java301
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstanceTest.java87
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstanceTest.java170
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGeneratorTest.java43
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegateTest.java11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegateTest.java51
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegateTest.java32
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegateTest.java47
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java13
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java74
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/vfcmodel/VfcModelPojoTest.java19
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java130
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java222
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilderTest.java67
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilderTest.java67
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ClientEntityPojoTest.java68
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/AllBPMNTestSuites.java27
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/BaseBPMNTest.java25
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java27
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java95
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java14
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java146
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java221
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java1030
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasks.java40
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java988
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java295
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java148
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java399
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java1026
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java196
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java135
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java46
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java222
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java69
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java119
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java86
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java236
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java42
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/EtsiVnfDeleteTask.java68
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java109
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java105
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmJobTask.java101
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java70
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java192
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java48
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmBasicHttpConfigProvider.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImpl.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java263
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java67
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java34
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java45
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java124
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java62
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtils.java85
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java202
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java229
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java60
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java191
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java181
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java89
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SourceSystem.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java156
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java47
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java364
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java43
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java36
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/exceptions/SDNCErrorResponseException.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java153
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java191
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java158
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java205
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java146
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java174
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java167
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java58
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java59
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java274
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java141
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java2401
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java217
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java744
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java41
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java52
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java68
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java537
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClient.java29
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientException.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java237
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterRestProperties.java42
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java675
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClient.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientException.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java183
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterRestProperties.java42
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClient.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java137
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestProperties.java50
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java257
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperUtils.java33
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java1505
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java93
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java189
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java57
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java35
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java48
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java96
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java87
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java305
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java207
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java120
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java211
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java99
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java110
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java48
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java155
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java145
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java104
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java145
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java76
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java98
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNOHealthCheckResources.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java35
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java33
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java116
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java76
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCProperties.java51
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java130
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java63
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java38
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java37
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java59
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java344
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java112
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java85
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java265
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java170
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java144
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java197
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java54
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java51
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java85
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java51
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java76
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java61
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java130
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Resource.java37
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java76
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java43
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java116
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java53
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/ticket/ExternalTicket.java165
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/AllIntegrationTestSuites.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/BaseIntegrationTest.java94
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java28
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/FileUtil.java85
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/IntegrationTestSuite.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/UnitTestSuite.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java128
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java321
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java997
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java1192
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java365
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java1285
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java76
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java112
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java70
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java137
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java84
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java348
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java174
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java412
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/EtsiVnfDeleteTaskTest.java124
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTaskTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTaskTest.java251
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTaskTest.java239
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeJobTest.java122
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/StubbedBuildingBlockExecution.java96
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfigurationTest.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskTest.java169
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java466
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProviderTest.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImplTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameterTest.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksIT.java120
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java86
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java67
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModuleTest.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtilsTest.java61
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java70
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java191
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtilsTest.java111
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnfTest.java130
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java284
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java152
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.java90
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java262
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtilsTest.java160
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java941
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java140
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java80
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java146
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java87
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasksTest.java63
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java169
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java191
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java122
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java201
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java187
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java241
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java203
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidatorTest.java156
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasksTest.java57
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java812
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorUnitTest.java45
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java201
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java623
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksUpdateReqDbTest.java97
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java2786
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java110
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java121
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java1119
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java381
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java633
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java348
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java333
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestPropertiesTest.java36
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java604
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java1637
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java155
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientResponseValidatorTest.java134
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientTest.java146
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestObjectBuilderTest.java142
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java132
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java82
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java135
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java147
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java671
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java63
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java211
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java328
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java143
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java142
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NamingServiceResourcesTest.java109
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NetworkAdapterResourcesTest.java327
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java70
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java239
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java192
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java155
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java244
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNOHealthCheckResourcesTest.java52
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResourcesTest.java189
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java142
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/policy/CommonObjectMapperProviderTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java54
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java28
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java742
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java339
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java89
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java547
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java190
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java98
822 files changed, 67026 insertions, 66542 deletions
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
index 45bc27d840..3b768cbc3b 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -34,67 +33,69 @@ 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<String> upgradeFormat(Optional<String> 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<String> 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<String> quiesceTrafficFormat(Optional<String> 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<String> startStopFormat(String aicIdentity) throws JsonProcessingException{
- StartStopAction payloadResult = new StartStopAction();
- payloadResult.setAicIdentity(aicIdentity);
- return Optional.of(mapper.writeValueAsString(payloadResult));
- }
-
- public static Optional<String> healthCheckFormat(String vnfName, String vnfHostIpAddress) throws JsonProcessingException{
- HealthCheckAction payloadResult = new HealthCheckAction();
- RequestParametersHealthCheck requestParams = new RequestParametersHealthCheck();
- requestParams.setHostIpAddress(vnfHostIpAddress);
- payloadResult.setRequestParameters(requestParams);
- return Optional.of((mapper.writeValueAsString(payloadResult)));
- }
-
- public static Optional<String> snapshotFormat(String vmId, String identityUrl)throws JsonProcessingException{
- SnapshotAction payloadResult = new SnapshotAction();
- payloadResult.setVmId(vmId);
- payloadResult.setIdentityUrl(identityUrl);
- return Optional.of(mapper.writeValueAsString(payloadResult));
- }
-
+ protected static ObjectMapper mapper = new ObjectMapper();
+
+ private PayloadClient() {}
+
+ public static Optional<String> upgradeFormat(Optional<String> 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<String> 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<String> quiesceTrafficFormat(Optional<String> 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<String> startStopFormat(String aicIdentity) throws JsonProcessingException {
+ StartStopAction payloadResult = new StartStopAction();
+ payloadResult.setAicIdentity(aicIdentity);
+ return Optional.of(mapper.writeValueAsString(payloadResult));
+ }
+
+ public static Optional<String> healthCheckFormat(String vnfName, String vnfHostIpAddress)
+ throws JsonProcessingException {
+ HealthCheckAction payloadResult = new HealthCheckAction();
+ RequestParametersHealthCheck requestParams = new RequestParametersHealthCheck();
+ requestParams.setHostIpAddress(vnfHostIpAddress);
+ payloadResult.setRequestParameters(requestParams);
+ return Optional.of((mapper.writeValueAsString(payloadResult)));
+ }
+
+ public static Optional<String> 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
index 3c39a8d66c..4ca99c3b34 100644
--- 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
@@ -25,35 +25,32 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"request-parameters",
-"configuration-parameters"
-})
+@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;
-}
+ @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/ConfigScaleOutPayload.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigScaleOutPayload.java
index 9035f4d506..aa50a90265 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigScaleOutPayload.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigScaleOutPayload.java
@@ -1,19 +1,15 @@
-/* ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/*
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
* ============LICENSE_END=========================================================
*/
@@ -21,38 +17,37 @@ package org.onap.so.bpmn.appc.payload.beans;
import java.util.HashMap;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class ConfigScaleOutPayload {
- @JsonProperty("request-parameters")
- private RequestParametersConfigScaleOut requestParameters;
- @JsonProperty("configuration-parameters")
- private Map<String, String> configurationParameters = new HashMap<>();
-
- public RequestParametersConfigScaleOut getRequestParameters() {
- return requestParameters;
- }
-
- public void setRequestParameters(RequestParametersConfigScaleOut requestParameters) {
- this.requestParameters = requestParameters;
- }
-
- public Map<String, String> getConfigurationParameters() {
- return configurationParameters;
- }
-
- public void setConfigurationParameters(Map<String, String> configurationParameters) {
- this.configurationParameters = configurationParameters;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder("ConfigScaleOutPayload{");
- sb.append("requestParameters=").append(requestParameters);
- sb.append(", configurationParameters='").append(configurationParameters);
- sb.append('}');
- return sb.toString();
- }
+ @JsonProperty("request-parameters")
+ private RequestParametersConfigScaleOut requestParameters;
+ @JsonProperty("configuration-parameters")
+ private Map<String, String> configurationParameters = new HashMap<>();
+
+ public RequestParametersConfigScaleOut getRequestParameters() {
+ return requestParameters;
+ }
+
+ public void setRequestParameters(RequestParametersConfigScaleOut requestParameters) {
+ this.requestParameters = requestParameters;
+ }
+
+ public Map<String, String> getConfigurationParameters() {
+ return configurationParameters;
+ }
+
+ public void setConfigurationParameters(Map<String, String> configurationParameters) {
+ this.configurationParameters = configurationParameters;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("ConfigScaleOutPayload{");
+ sb.append("requestParameters=").append(requestParameters);
+ sb.append(", configurationParameters='").append(configurationParameters);
+ sb.append('}');
+ return sb.toString();
+ }
}
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
index c88169bb80..422a49c5ed 100644
--- 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
@@ -25,34 +25,31 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"node0_hostname",
-"node0_backup_router_address"
-})
+@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;
-}
+ @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
index a8964f3bc5..8c9e636d9e 100644
--- 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
@@ -25,21 +25,19 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"vnf_name"
-})
+@JsonPropertyOrder({"vnf_name"})
public class ConfigurationParametersHealthCheck {
-@JsonProperty("vnf_name")
-private String vnfName;
+ @JsonProperty("vnf_name")
+ private String vnfName;
-@JsonProperty("vnf_name")
-public String getVnfName() {
-return vnfName;
-}
+ @JsonProperty("vnf_name")
+ public String getVnfName() {
+ return vnfName;
+ }
-@JsonProperty("vnf_name")
-public void setVnfName(String vnfName) {
-this.vnfName = 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
index 878a136962..2a6ff4874a 100644
--- 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
@@ -25,35 +25,32 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"vnf_name",
-"operations_timeout"
-})
+@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;
-}
+ @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
index 6b5e59f2e0..3875450c7d 100644
--- 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
@@ -25,21 +25,19 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"vnf_name"
-})
+@JsonPropertyOrder({"vnf_name"})
public class ConfigurationParametersResumeTraffic {
-@JsonProperty("vnf_name")
-private String vnfName;
+ @JsonProperty("vnf_name")
+ private String vnfName;
-@JsonProperty("vnf_name")
-public String getVnfName() {
-return vnfName;
-}
+ @JsonProperty("vnf_name")
+ public String getVnfName() {
+ return vnfName;
+ }
-@JsonProperty("vnf_name")
-public void setVnfName(String vnfName) {
-this.vnfName = 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
index 6bd397a63a..1f1bdf91d5 100644
--- 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
@@ -25,47 +25,43 @@ 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"
-})
+@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")
+ 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 String getVnfName() {
+ return vnfName;
+ }
-@JsonProperty("vnf_name")
-public void setVnfName(String vnfName) {
-this.vnfName = 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 String getExistingSoftwareVersion() {
+ return existingSoftwareVersion;
+ }
-@JsonProperty("existing_software_version")
-public void setExistingSoftwareVersion(String existingSoftwareVersion) {
-this.existingSoftwareVersion = 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 String getNewSoftwareVersion() {
+ return newSoftwareVersion;
+ }
-@JsonProperty("new_software_version")
-public void setNewSoftwareVersion(String newSoftwareVersion) {
-this.newSoftwareVersion = 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
index 4d194650c4..0964a09cb9 100644
--- 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
@@ -25,34 +25,31 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"request-parameters",
-"configuration-parameters"
-})
+@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;
-}
+ @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
index 0b16c6ca90..7125ad77b8 100644
--- 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
@@ -25,21 +25,19 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"configuration-parameters"
-})
+@JsonPropertyOrder({"configuration-parameters"})
public class QuiesceTrafficAction {
-@JsonProperty("configuration-parameters")
-private ConfigurationParametersQuiesce configurationParameters;
+ @JsonProperty("configuration-parameters")
+ private ConfigurationParametersQuiesce configurationParameters;
-@JsonProperty("configuration-parameters")
-public ConfigurationParametersQuiesce getConfigurationParameters() {
-return configurationParameters;
-}
+ @JsonProperty("configuration-parameters")
+ public ConfigurationParametersQuiesce getConfigurationParameters() {
+ return configurationParameters;
+ }
-@JsonProperty("configuration-parameters")
-public void setConfigurationParameters(ConfigurationParametersQuiesce configurationParameters) {
-this.configurationParameters = 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
index 58c9234d60..2b314cb580 100644
--- 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
@@ -25,22 +25,20 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"vnf-host-ip-address"
-})
+@JsonPropertyOrder({"vnf-host-ip-address"})
public class RequestParametersConfigModify {
-@JsonProperty("vnf-host-ip-address")
-private String vnfHostIpAddress;
+ @JsonProperty("vnf-host-ip-address")
+ private String vnfHostIpAddress;
-@JsonProperty("vnf-host-ip-address")
-public String getVnfHostIpAddress() {
-return vnfHostIpAddress;
-}
+ @JsonProperty("vnf-host-ip-address")
+ public String getVnfHostIpAddress() {
+ return vnfHostIpAddress;
+ }
-@JsonProperty("vnf-host-ip-address")
-public void setVnfHostIpAddress(String vnfHostIpAddress) {
-this.vnfHostIpAddress = 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/RequestParametersConfigScaleOut.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigScaleOut.java
index 0333fd7a78..1a9e04b9e2 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigScaleOut.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigScaleOut.java
@@ -1,19 +1,15 @@
-/* ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/*
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
* ============LICENSE_END=========================================================
*/
@@ -23,33 +19,33 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public class RequestParametersConfigScaleOut {
- @JsonProperty("vnf-host-ip-address")
- private String vnfHostIpAddress;
- @JsonProperty("vf-module-id")
- private String vfModuleId;
-
- public String getVnfHostIpAddress() {
- return vnfHostIpAddress;
- }
-
- public void setVnfHostIpAddress(String vnfHostIpAddress) {
- this.vnfHostIpAddress = vnfHostIpAddress;
- }
-
- public String getVfModuleId() {
- return vfModuleId;
- }
-
- public void setVfModuleId(String vfModuleId) {
- this.vfModuleId = vfModuleId;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder("RequestParametersConfigScaleOut{");
- sb.append("vnf-host-ip-address=").append(vnfHostIpAddress);
- sb.append(", vf-module-id='").append(vfModuleId);
- sb.append('}');
- return sb.toString();
- }
+ @JsonProperty("vnf-host-ip-address")
+ private String vnfHostIpAddress;
+ @JsonProperty("vf-module-id")
+ private String vfModuleId;
+
+ public String getVnfHostIpAddress() {
+ return vnfHostIpAddress;
+ }
+
+ public void setVnfHostIpAddress(String vnfHostIpAddress) {
+ this.vnfHostIpAddress = vnfHostIpAddress;
+ }
+
+ public String getVfModuleId() {
+ return vfModuleId;
+ }
+
+ public void setVfModuleId(String vfModuleId) {
+ this.vfModuleId = vfModuleId;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("RequestParametersConfigScaleOut{");
+ sb.append("vnf-host-ip-address=").append(vnfHostIpAddress);
+ sb.append(", vf-module-id='").append(vfModuleId);
+ sb.append('}');
+ return sb.toString();
+ }
}
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
index 60030ee3dd..2fe8e744f9 100644
--- 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
@@ -25,34 +25,32 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"vnf-name"
-})
+@JsonPropertyOrder({"vnf-name"})
public class RequestParametersHealthCheck {
-@JsonProperty("vnf-name")
-private String vnfName;
-@JsonProperty("host-ip-address")
-private String hostIpAddress;
-
-@JsonProperty("vnf-name")
-public String getVnfName() {
- return vnfName;
-}
-
-@JsonProperty("vnf-name")
-public void setVnfName(String vnfName) {
- this.vnfName = vnfName;
-}
-
-@JsonProperty("host-ip-address")
-public void setHostIpAddress(String hostIpAddress) {
- this.hostIpAddress = hostIpAddress;
-}
-
-@JsonProperty("host-ip-address")
-public String getHostIpAddress() {
- return hostIpAddress;
-}
+ @JsonProperty("vnf-name")
+ private String vnfName;
+ @JsonProperty("host-ip-address")
+ private String hostIpAddress;
+
+ @JsonProperty("vnf-name")
+ public String getVnfName() {
+ return vnfName;
+ }
+
+ @JsonProperty("vnf-name")
+ public void setVnfName(String vnfName) {
+ this.vnfName = vnfName;
+ }
+
+ @JsonProperty("host-ip-address")
+ public void setHostIpAddress(String hostIpAddress) {
+ this.hostIpAddress = hostIpAddress;
+ }
+
+ @JsonProperty("host-ip-address")
+ public String getHostIpAddress() {
+ return hostIpAddress;
+ }
}
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
index b642a376fe..5afdc4198a 100644
--- 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
@@ -25,21 +25,19 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"configuration-parameters"
-})
+@JsonPropertyOrder({"configuration-parameters"})
public class ResumeTrafficAction {
-@JsonProperty("configuration-parameters")
-private ConfigurationParametersResumeTraffic configurationParameters;
+ @JsonProperty("configuration-parameters")
+ private ConfigurationParametersResumeTraffic configurationParameters;
-@JsonProperty("configuration-parameters")
-public ConfigurationParametersResumeTraffic getConfigurationParameters() {
-return configurationParameters;
-}
+ @JsonProperty("configuration-parameters")
+ public ConfigurationParametersResumeTraffic getConfigurationParameters() {
+ return configurationParameters;
+ }
-@JsonProperty("configuration-parameters")
-public void setConfigurationParameters(ConfigurationParametersResumeTraffic configurationParameters) {
-this.configurationParameters = 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
index 0499e5d6c0..431c97814e 100644
--- 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
@@ -25,35 +25,32 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"vm-id",
-"identity-url"
-})
+@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;
-}
+ @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
index f2b5b905a5..58231c0602 100644
--- 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
@@ -25,21 +25,19 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- " AICIdentity "
-})
+@JsonPropertyOrder({" AICIdentity "})
public class StartStopAction {
- @JsonProperty(" AICIdentity ")
- private String aicIdentity;
+ @JsonProperty(" AICIdentity ")
+ private String aicIdentity;
- @JsonProperty(" AICIdentity ")
- public String getAicIdentity() {
- return aicIdentity;
- }
+ @JsonProperty(" AICIdentity ")
+ public String getAicIdentity() {
+ return aicIdentity;
+ }
- @JsonProperty(" AICIdentity ")
- public void setAicIdentity(String aicIdentity) {
- this.aicIdentity = 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
index 3e07f328ce..e6a60a52f5 100644
--- 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
@@ -25,21 +25,19 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"configuration-parameters"
-})
+@JsonPropertyOrder({"configuration-parameters"})
public class UpgradeAction {
-@JsonProperty("configuration-parameters")
-private ConfigurationParametersUpgrade configurationParameters;
+ @JsonProperty("configuration-parameters")
+ private ConfigurationParametersUpgrade configurationParameters;
-@JsonProperty("configuration-parameters")
-public ConfigurationParametersUpgrade getConfigurationParameters() {
-return configurationParameters;
-}
+ @JsonProperty("configuration-parameters")
+ public ConfigurationParametersUpgrade getConfigurationParameters() {
+ return configurationParameters;
+ }
-@JsonProperty("configuration-parameters")
-public void setConfigurationParameters(ConfigurationParametersUpgrade configurationParameters) {
-this.configurationParameters = 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/BuildingBlockExecution.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java
index 1ffd9dd167..c087d586e7 100644
--- 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
@@ -22,17 +22,21 @@ 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> T getVariable(String key);
- public <T> T getRequiredVariable(String key) throws RequiredExecutionVariableExeception;
- public void setVariable(String key, Serializable value);
- public Map<ResourceKey, String> getLookupMap();
- public String getFlowToBeCalled();
+ public GeneralBuildingBlock getGeneralBuildingBlock();
+
+ public <T> T getVariable(String key);
+
+ public <T> T getRequiredVariable(String key) throws RequiredExecutionVariableExeception;
+
+ public void setVariable(String key, Serializable value);
+
+ public Map<ResourceKey, String> getLookupMap();
+
+ public String getFlowToBeCalled();
}
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
index 5a126ffe7d..f09aae67d1 100644
--- 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
@@ -25,9 +25,9 @@ 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());
- }
+
+ @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
index 39a209efa8..31fef7c6f7 100644
--- 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
@@ -23,14 +23,12 @@ 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;
-
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
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
index 56b059ec16..036c054ed9 100644
--- 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
@@ -26,9 +26,9 @@ import org.springframework.stereotype.Component;
@Component
public class InjectExecution {
- public DelegateExecutionImpl execute (DelegateExecution execution, DelegateExecutionImpl impl) {
-
- impl.setDelegateExecution(execution);
- return impl;
- }
+ 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
index adf1dc01c0..3791c5d461 100644
--- 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
@@ -32,45 +32,42 @@ 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.
+ * 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
+ * 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 AAIResourcesClient getAaiClient() {
+ return new AAIResourcesClient();
+ }
- public AAIQueryClient getAaiQueryClient() {
- return new AAIQueryClient();
- }
+ public AAIQueryClient getAaiQueryClient() {
+ return new AAIQueryClient();
+ }
- public SDNOValidator getSdnoValidator() {
- return new SDNOValidatorImpl();
- }
+ public SDNOValidator getSdnoValidator() {
+ return new SDNOValidatorImpl();
+ }
- public AAICommonObjectMapperProvider getAaiCommonObjectMapperProvider() {
- return new AAICommonObjectMapperProvider();
- }
+ public AAICommonObjectMapperProvider getAaiCommonObjectMapperProvider() {
+ return new AAICommonObjectMapperProvider();
+ }
- public AAIResultWrapper getAaiResultWrapper(String json) {
- return new AAIResultWrapper(json);
- }
+ public AAIResultWrapper getAaiResultWrapper(String json) {
+ return new AAIResultWrapper(json);
+ }
- public PolicyClientImpl getPolicyClient() {
- return new PolicyClientImpl();
- }
+ public PolicyClientImpl getPolicyClient() {
+ return new PolicyClientImpl();
+ }
- public CDSProcessingClient getCdsClient(CDSProcessingListener listener) {
- return new CDSProcessingClient(listener);
- }
+ public CDSProcessingClient getCdsClient(CDSProcessingListener listener) {
+ return new CDSProcessingClient(listener);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java
index af93c1bfc0..73047cf961 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.common.baseclient;
import java.util.ArrayList;
import java.util.List;
-
import org.onap.so.logging.jaxrs.filter.SpringClientFilter;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
@@ -35,18 +34,18 @@ import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
-//TODO move to common location
-public class BaseClient<I,O> {
+// TODO move to common location
+public class BaseClient<I, O> {
+
+ private HttpHeaders httpHeader;
+ private String targetUrl;
- private HttpHeaders httpHeader;
- private String targetUrl;
+ public HttpHeaders getHttpHeader() {
+ return httpHeader;
+ }
- public HttpHeaders getHttpHeader() {
- return httpHeader;
- }
-
public HttpHeaders setDefaultHttpHeaders(String auth) {
- httpHeader = new HttpHeaders();
+ httpHeader = new HttpHeaders();
httpHeader.set("Authorization", auth);
httpHeader.setContentType(MediaType.APPLICATION_JSON);
List<MediaType> acceptMediaTypes = new ArrayList<MediaType>();
@@ -56,34 +55,36 @@ public class BaseClient<I,O> {
return httpHeader;
}
- public void setHttpHeader(HttpHeaders httpHeader) {
- this.httpHeader = httpHeader;
- }
+ public void setHttpHeader(HttpHeaders httpHeader) {
+ this.httpHeader = httpHeader;
+ }
- public String getTargetUrl() {
- return targetUrl;
- }
+ public String getTargetUrl() {
+ return targetUrl;
+ }
- public void setTargetUrl(String targetUrl) {
- this.targetUrl = targetUrl;
- }
+ public void setTargetUrl(String targetUrl) {
+ this.targetUrl = targetUrl;
+ }
- public O get(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException {
- return run(data, HttpMethod.GET, typeRef, uriVariables);
- }
+ public O get(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException {
+ return run(data, HttpMethod.GET, typeRef, uriVariables);
+ }
- public O post(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException {
- return run(data, HttpMethod.POST, typeRef, uriVariables);
- }
-
- public O run(I data, HttpMethod method, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException {
- HttpEntity<I> requestEntity = new HttpEntity<I>(data, getHttpHeader());
- RestTemplate restTemplate = new RestTemplate();
- restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()));
- restTemplate.getInterceptors().add(new SpringClientFilter());
- ResponseEntity<O> responseEntity = restTemplate.exchange(getTargetUrl(), method, requestEntity, typeRef,
- uriVariables);
- return responseEntity.getBody();
- }
+ public O post(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException {
+ return run(data, HttpMethod.POST, typeRef, uriVariables);
+ }
+
+ public O run(I data, HttpMethod method, ParameterizedTypeReference<O> typeRef, Object... uriVariables)
+ throws RestClientException {
+ HttpEntity<I> requestEntity = new HttpEntity<I>(data, getHttpHeader());
+ RestTemplate restTemplate = new RestTemplate();
+ restTemplate
+ .setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()));
+ restTemplate.getInterceptors().add(new SpringClientFilter());
+ ResponseEntity<O> responseEntity =
+ restTemplate.exchange(getTargetUrl(), method, requestEntity, typeRef, uriVariables);
+ return responseEntity.getBody();
+ }
-} \ No newline at end of file
+}
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
index 1da989bfb7..cedb8ecc33 100644
--- 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
@@ -21,27 +21,26 @@
package org.onap.so.bpmn.common.exceptions;
public class MalformedBuildingBlockInputException extends RuntimeException {
- private static final long serialVersionUID = -9168146273898271648L;
+ private static final long serialVersionUID = -9168146273898271648L;
- public MalformedBuildingBlockInputException() {
- super();
- }
+ public MalformedBuildingBlockInputException() {
+ super();
+ }
- public MalformedBuildingBlockInputException(String message) {
- super(message);
- }
+ public MalformedBuildingBlockInputException(String message) {
+ super(message);
+ }
- public MalformedBuildingBlockInputException(String message, Throwable cause) {
- super(message, cause);
- }
+ public MalformedBuildingBlockInputException(String message, Throwable cause) {
+ super(message, cause);
+ }
- public MalformedBuildingBlockInputException(Throwable cause) {
- super(cause);
- }
+ public MalformedBuildingBlockInputException(Throwable cause) {
+ super(cause);
+ }
- protected MalformedBuildingBlockInputException(String message, Throwable cause,
- boolean enableSuppression,
- boolean writableStackTrace) {
- super(message, cause, enableSuppression, writableStackTrace);
- }
+ 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
index 5ad28a5ba0..fdae8f64f8 100644
--- 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
@@ -21,27 +21,26 @@
package org.onap.so.bpmn.common.exceptions;
public class MissingBuildingBlockInputException extends RuntimeException {
- private static final long serialVersionUID = 7098084383189271401L;
+ private static final long serialVersionUID = 7098084383189271401L;
- public MissingBuildingBlockInputException() {
- super();
- }
+ public MissingBuildingBlockInputException() {
+ super();
+ }
- public MissingBuildingBlockInputException(String message) {
- super(message);
- }
+ public MissingBuildingBlockInputException(String message) {
+ super(message);
+ }
- public MissingBuildingBlockInputException(String message, Throwable cause) {
- super(message, cause);
- }
+ public MissingBuildingBlockInputException(String message, Throwable cause) {
+ super(message, cause);
+ }
- public MissingBuildingBlockInputException(Throwable cause) {
- super(cause);
- }
+ public MissingBuildingBlockInputException(Throwable cause) {
+ super(cause);
+ }
- protected MissingBuildingBlockInputException(String message, Throwable cause,
- boolean enableSuppression,
- boolean writableStackTrace) {
- super(message, cause, enableSuppression, writableStackTrace);
- }
+ 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
index 8c77bb445e..558ab27764 100644
--- 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
@@ -22,17 +22,17 @@ package org.onap.so.bpmn.common.exceptions;
public class RequiredExecutionVariableExeception extends Exception {
- private static final long serialVersionUID = 5135274986874563746L;
+ 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);
- }
+ 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
index 80479e19c0..8281fd9974 100644
--- 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
@@ -23,26 +23,25 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public class BpmnIntegerParam {
- @JsonProperty("value")
- private int value;
- @JsonProperty("type")
- private final String type = "Integer";
+ @JsonProperty("value")
+ private int value;
+ @JsonProperty("type")
+ private final String type = "Integer";
- public BpmnIntegerParam() {
- }
+ public BpmnIntegerParam() {}
- @JsonProperty("value")
- public int getValue() {
- return value;
- }
+ @JsonProperty("value")
+ public int getValue() {
+ return value;
+ }
- @JsonProperty("type")
- public void setValue(int value) {
- this.value = value;
- }
+ @JsonProperty("type")
+ public void setValue(int value) {
+ this.value = value;
+ }
- @Override
- public String toString() {
- return "CamundaInput [value=" + Integer.toString(value) + ", type=" + type + "]";
- }
+ @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
index 01285cd5ec..79b0f415ff 100644
--- 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
@@ -19,36 +19,37 @@
*/
package org.onap.so.bpmn.common.recipe;
+
import com.fasterxml.jackson.annotation.JsonProperty;
/**
- * The bpmn workflow input param object
+ * 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 + "]";
- }
-
+
+ @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
index 526f5d5288..b9200e0640 100644
--- 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
@@ -24,9 +24,7 @@ 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;
@@ -44,9 +42,7 @@ 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.
- * <br>
+ * Support to call resource recipes from the BPMN workflow. Such as call resource recipe in service workflow. <br>
* <p>
* </p>
*
@@ -66,13 +62,13 @@ public class BpmnRestClient {
public static final String CAMUNDA_AUTH = "mso.camundaAuth";
- private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+ private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
@Autowired
private UrnPropertiesReader urnPropertiesReader;
private static boolean noProperties = true;
- //because for NS it will take a long time the time out of the resouce will be 2 hours.
+ // 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() {
@@ -80,8 +76,7 @@ public class BpmnRestClient {
}
/**
- * post the recipe Uri
- * <br>
+ * post the recipe Uri <br>
*
* @param recipeUri The request recipe uri
* @param requestId the request id
@@ -96,36 +91,39 @@ public class BpmnRestClient {
* @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 {
+ 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();
+ RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(recipeTimeout)
+ .setConnectTimeout(recipeTimeout).setConnectionRequestTimeout(recipeTimeout).build();
post.setConfig(requestConfig);
logger.debug("call the bpmn, url: {}", recipeUri);
- String jsonReq = wrapResourceRequest(requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, requestDetails, recipeParamXsd);
+ 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_PROP);
- if(userCredentials != null) {
- post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()));
+ if (encryptedCredentials != null) {
+ String userCredentials =
+ getEncryptedPropValue(encryptedCredentials, DEFAULT_BPEL_AUTH, ENCRYPTION_KEY_PROP);
+ if (userCredentials != null) {
+ post.addHeader("Authorization",
+ "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()));
}
}
-
+
post.setEntity(input);
return client.execute(post);
}
/**
- * prepare the resource recipe bpmn request.
- * <br>
+ * prepare the resource recipe bpmn request. <br>
*
* @param requestId
* @param recipeTimeout
@@ -137,20 +135,20 @@ public class BpmnRestClient {
* @return
* @since ONAP Beijing Release
*/
- private String wrapResourceRequest(String requestId, int recipeTimeout, String requestAction, String serviceInstanceId, String serviceType,
- String requestDetails, String recipeParams) {
+ private String wrapResourceRequest(String requestId, int recipeTimeout, String requestAction,
+ String serviceInstanceId, String serviceType, String requestDetails, String recipeParams) {
String jsonReq = null;
- if(requestId == null) {
+ if (requestId == null) {
requestId = "";
}
- if(requestAction == null) {
+ if (requestAction == null) {
requestAction = "";
}
- if(serviceInstanceId == null) {
+ if (serviceInstanceId == null) {
serviceInstanceId = "";
}
- if(requestDetails == null) {
+ if (requestDetails == null) {
requestDetails = "";
}
@@ -182,9 +180,9 @@ public class BpmnRestClient {
recipeRequest.setRecipeTimeout(recipeTimeoutInput);
jsonReq = recipeRequest.toString();
logger.trace("request body is {}", jsonReq);
- } catch(Exception e) {
+ } catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest",
- ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
}
return jsonReq;
}
@@ -201,7 +199,7 @@ public class BpmnRestClient {
protected String getEncryptedPropValue(String prop, String defaultValue, String encryptionKey) {
try {
return CryptoUtils.decrypt(prop, urnPropertiesReader.getVariable(encryptionKey));
- } catch(GeneralSecurityException e) {
+ } catch (GeneralSecurityException e) {
logger.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
index 2119b2dfa8..2bb024897c 100644
--- 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
@@ -22,7 +22,6 @@
package org.onap.so.bpmn.common.recipe;
import org.onap.so.bpmn.core.domain.ModelInfo;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
@@ -33,57 +32,58 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * the inputs for the resource recipe
- * <br>
+ * the inputs for the resource recipe <br>
* <p>
* </p>
*
* @author
- * @version ONAP Beijing Release 2018-03-08
+ * @version ONAP Beijing Release 2018-03-08
*/
-@JsonPropertyOrder({"resourceInstanceName", "resourceInstanceDes", "globalSubscriberId", "serviceType", "serviceId", "operationId", "serviceModelInfo","resourceModelInfo", "resourceInstancenUuid","resourceParameters","operationType"})
+@JsonPropertyOrder({"resourceInstanceName", "resourceInstanceDes", "globalSubscriberId", "serviceType", "serviceId",
+ "operationId", "serviceModelInfo", "resourceModelInfo", "resourceInstancenUuid", "resourceParameters",
+ "operationType"})
@JsonRootName("variables")
public class ResourceInput {
- private static Logger logger = LoggerFactory.getLogger(ResourceInput.class);
-
+ private static Logger logger = LoggerFactory.getLogger(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
+
+ // for delete resource
@JsonProperty("resourceInstancenUuid")
private String resourceInstancenUuid;
-
+
@JsonProperty("resourceParameters")
private String resourceParameters;
-
+
@JsonProperty("requestsInputs")
private String requestsInputs;
-
+
@JsonProperty("operationType")
private String operationType;
-
+
/**
* @return Returns the requestsInputs.
*/
@@ -92,7 +92,7 @@ public class ResourceInput {
return requestsInputs;
}
-
+
/**
* @param requestsInputs The requestsInputs to set.
*/
@@ -101,7 +101,7 @@ public class ResourceInput {
this.requestsInputs = requestsInputs;
}
-
+
/**
* @return Returns the resourceInstanceName.
*/
@@ -110,7 +110,7 @@ public class ResourceInput {
return resourceInstanceName;
}
-
+
/**
* @param resourceInstanceName The resourceInstanceName to set.
*/
@@ -119,7 +119,7 @@ public class ResourceInput {
this.resourceInstanceName = resourceInstanceName;
}
-
+
/**
* @return Returns the resourceInstanceDes.
*/
@@ -128,7 +128,7 @@ public class ResourceInput {
return resourceInstanceDes;
}
-
+
/**
* @param resourceInstanceDes The resourceInstanceDes to set.
*/
@@ -137,7 +137,7 @@ public class ResourceInput {
this.resourceInstanceDes = resourceInstanceDes;
}
-
+
/**
* @return Returns the globalSubscriberId.
*/
@@ -146,7 +146,7 @@ public class ResourceInput {
return globalSubscriberId;
}
-
+
/**
* @param globalSubscriberId The globalSubscriberId to set.
*/
@@ -155,7 +155,7 @@ public class ResourceInput {
this.globalSubscriberId = globalSubscriberId;
}
-
+
/**
* @return Returns the serviceType.
*/
@@ -164,7 +164,7 @@ public class ResourceInput {
return serviceType;
}
-
+
/**
* @param serviceType The serviceType to set.
*/
@@ -173,7 +173,7 @@ public class ResourceInput {
this.serviceType = serviceType;
}
-
+
/**
* @return Returns the serviceId.
*/
@@ -182,7 +182,7 @@ public class ResourceInput {
return serviceInstanceId;
}
-
+
/**
* @param serviceId The serviceId to set.
*/
@@ -191,7 +191,7 @@ public class ResourceInput {
this.serviceInstanceId = serviceId;
}
-
+
/**
* @return Returns the operationId.
*/
@@ -200,7 +200,7 @@ public class ResourceInput {
return operationId;
}
-
+
/**
* @param operationId The operationId to set.
*/
@@ -208,7 +208,7 @@ public class ResourceInput {
public void setOperationId(String operationId) {
this.operationId = operationId;
}
-
+
/**
* @return Returns the serviceModelInfo.
*/
@@ -218,7 +218,7 @@ public class ResourceInput {
}
-
+
/**
* @param serviceModelInfo The serviceModelInfo to set.
*/
@@ -228,7 +228,7 @@ public class ResourceInput {
}
-
+
/**
* @return Returns the resourceModelInfo.
*/
@@ -238,7 +238,7 @@ public class ResourceInput {
}
-
+
/**
* @param resourceModelInfo The resourceModelInfo to set.
*/
@@ -256,7 +256,7 @@ public class ResourceInput {
return resourceParameters;
}
-
+
/**
* @param resourceParameters The resourceParameters to set.
*/
@@ -265,7 +265,7 @@ public class ResourceInput {
this.resourceParameters = resourceParameters;
}
-
+
/**
* @return Returns the operationType.
*/
@@ -274,7 +274,7 @@ public class ResourceInput {
return operationType;
}
-
+
/**
* @param operationType The operationType to set.
*/
@@ -284,7 +284,7 @@ public class ResourceInput {
}
-
+
/**
* @return Returns the resourceInstancenUuid.
*/
@@ -294,7 +294,7 @@ public class ResourceInput {
}
-
+
/**
* @param resourceInstancenUuid The resourceInstancenUuid to set.
*/
@@ -302,7 +302,7 @@ public class ResourceInput {
public void setResourceInstancenUuid(String resourceInstancenUuid) {
this.resourceInstancenUuid = resourceInstancenUuid;
}
-
+
@Override
public String toString() {
ObjectMapper mapper = new ObjectMapper();
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
index d1e26582a3..729793893b 100644
--- 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
@@ -32,15 +32,15 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * java object of the resource recipe , it
- * will be passed to the Camunda process
+ * java object of the resource recipe , it will be passed to the Camunda process
*/
-@JsonPropertyOrder({"resourceInput", "host", "requestId", "requestAction", "serviceInstanceId", "serviceType", "recipeParams"})
+@JsonPropertyOrder({"resourceInput", "host", "requestId", "requestAction", "serviceInstanceId", "serviceType",
+ "recipeParams"})
@JsonRootName("variables")
public class ResourceRecipeRequest {
- private static Logger logger = LoggerFactory.getLogger(ResourceRecipeRequest.class);
-
+ private static Logger logger = LoggerFactory.getLogger(ResourceRecipeRequest.class);
+
@JsonProperty("resourceInput")
private BpmnParam resourceInput;
@@ -64,7 +64,7 @@ public class ResourceRecipeRequest {
@JsonProperty("mso-service-request-timeout")
private BpmnIntegerParam recipeTimeout;
-
+
@JsonProperty("resourceInput")
public BpmnParam getResourceInput() {
return resourceInput;
@@ -137,24 +137,24 @@ public class ResourceRecipeRequest {
@JsonProperty("mso-service-request-timeout")
public BpmnIntegerParam getRecipeTimeout() {
- return recipeTimeout;
- }
-
+ return recipeTimeout;
+ }
+
@JsonProperty("mso-service-request-timeout")
- public void setRecipeTimeout(BpmnIntegerParam recipeTimeout) {
- this.recipeTimeout = recipeTimeout;
- }
+ public void setRecipeTimeout(BpmnIntegerParam recipeTimeout) {
+ this.recipeTimeout = recipeTimeout;
+ }
- @Override
+ @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) {
- logger.error("JsonProcessingException", e);
- }
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
+ String jsonStr = "ResourceRecipeRequest";
+ try {
+ jsonStr = mapper.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+ logger.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
index 03f56b31f6..e7ab6e4606 100644
--- 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
@@ -29,17 +29,14 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
-
import org.camunda.bpm.engine.runtime.Execution;
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.client.HttpClientFactory;
import org.onap.so.utils.TargetEntity;
-
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
@@ -58,7 +55,7 @@ public class ResourceRequestBuilder {
static JsonUtils jsonUtil = new JsonUtils();
- public static List<String> getResourceSequence(String serviceUuid) {
+ public static List<String> getResourceSequence(String serviceUuid) {
List<String> resourceSequence = new ArrayList();
try {
@@ -69,7 +66,7 @@ public class ResourceRequestBuilder {
if (serviceResources.containsKey("resourceOrder")) {
String resourceOrder = (String) serviceResources.get("resourceOrder");
- if (resourceOrder!= null) {
+ if (resourceOrder != null) {
resourceSequence.addAll(Arrays.asList(resourceOrder.split(",")));
}
}
@@ -78,32 +75,35 @@ public class ResourceRequestBuilder {
logger.error("not able to retrieve service order.");
}
return resourceSequence;
- }
-
- /* build the resource Parameters detail.
- * It's a json string for resource instantiant
- * {
- * "locationConstraints":[...]
- * "requestInputs":{K,V}
- * }
- * <br>
+ }
+
+ /*
+ * build the resource Parameters detail. It's a json string for resource instantiant { "locationConstraints":[...]
+ * "requestInputs":{K,V} } <br>
*
* @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<String> resourceList = jsonUtil.StringArrayToList(execution, (String)JsonUtils.getJsonValue(serviceParameters, "resources"));
- //Get the right location str for resource. default is an empty array.
- String locationConstraints ="[]";
+ public static String buildResourceRequestParameters(Execution execution, String serviceUuid,
+ String resourceCustomizationUuid, String serviceParameters) {
+ List<String> 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)){
+ 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");
@@ -111,7 +111,8 @@ public class ResourceRequestBuilder {
}
Map<String, Object> serviceInput = null;
if (JsonUtils.getJsonValue(serviceParameters, "requestInputs") != null) {
- serviceInput = getJsonObject((String)JsonUtils.getJsonValue(serviceParameters, "requestInputs"), Map.class);
+ serviceInput =
+ getJsonObject((String) JsonUtils.getJsonValue(serviceParameters, "requestInputs"), Map.class);
}
Map<String, Object> resourceInputsFromUuiMap = getJsonObject(resourceInputsFromUui, Map.class);
@@ -124,42 +125,45 @@ public class ResourceRequestBuilder {
resourceInputsFromUuiMap = new HashMap();
}
- Map<String, Object> resourceInputsFromServiceDeclaredLevel = buildResouceRequest(serviceUuid, resourceCustomizationUuid, serviceInput);
+ Map<String, Object> resourceInputsFromServiceDeclaredLevel =
+ buildResouceRequest(serviceUuid, resourceCustomizationUuid, serviceInput);
resourceInputsFromUuiMap.putAll(resourceInputsFromServiceDeclaredLevel);
String resourceInputsStr = getJsonString(resourceInputsFromUuiMap);
- String result = "{\n"
- + "\"locationConstraints\":" + locationConstraints +",\n"
- + "\"requestInputs\":" + resourceInputsStr +"\n"
- +"}";
+ String result = "{\n" + "\"locationConstraints\":" + locationConstraints + ",\n" + "\"requestInputs\":"
+ + resourceInputsStr + "\n" + "}";
return result;
}
@SuppressWarnings("unchecked")
- public static Map<String, Object> buildResouceRequest(String serviceUuid, String resourceCustomizationUuid, Map<String, Object> serviceInputs) {
+ public static Map<String, Object> buildResouceRequest(String serviceUuid, String resourceCustomizationUuid,
+ Map<String, Object> serviceInputs) {
try {
Map<String, Object> serviceInstnace = getServiceInstnace(serviceUuid);
// find match of customization uuid in vnf
- Map<String, Map<String, Object>> serviceResources = (Map<String, Map<String, Object>>) serviceInstnace.get("serviceResources");
+ Map<String, Map<String, Object>> serviceResources =
+ (Map<String, Map<String, Object>>) serviceInstnace.get("serviceResources");
List<Map<String, Object>> serviceVnfCust = (List<Map<String, Object>>) serviceResources.get("serviceVnfs");
String resourceInputStr = getResourceInputStr(serviceVnfCust, resourceCustomizationUuid);
// find match in network resource
if (resourceInputStr == null) {
- List<Map<String, Object>> serviceNetworkCust = (List<Map<String, Object>>) serviceResources.get("serviceNetworks");
+ List<Map<String, Object>> serviceNetworkCust =
+ (List<Map<String, Object>>) serviceResources.get("serviceNetworks");
resourceInputStr = getResourceInputStr(serviceNetworkCust, resourceCustomizationUuid);
// find match in AR resource
if (resourceInputStr == null) {
- List<Map<String, Object>> serviceArCust = (List<Map<String, Object>>) serviceResources.get("serviceAllottedResources");
+ List<Map<String, Object>> serviceArCust =
+ (List<Map<String, Object>>) serviceResources.get("serviceAllottedResources");
resourceInputStr = getResourceInputStr(serviceArCust, resourceCustomizationUuid);
}
}
- if (resourceInputStr != null && !resourceInputStr.isEmpty()) {
+ if (resourceInputStr != null && !resourceInputStr.isEmpty()) {
return getResourceInput(resourceInputStr, serviceInputs);
- }
+ }
} catch (Exception e) {
logger.error("not able to retrieve service instance");
@@ -182,11 +186,11 @@ public class ResourceRequestBuilder {
// this method combines resource input with service input
private static Map<String, Object> getResourceInput(String resourceInputStr, Map<String, Object> serviceInputs) {
Gson gson = new Gson();
- Type type = new TypeToken<Map<String, String>>(){}.getType();
+ Type type = new TypeToken<Map<String, String>>() {}.getType();
Map<String, Object> resourceInput = gson.fromJson(resourceInputStr, type);
// replace value if key is available in service input
- for (String key: resourceInput.keySet()) {
+ for (String key : resourceInput.keySet()) {
String value = (String) resourceInput.get(key);
if (value.contains("|")) {
@@ -199,7 +203,7 @@ public class ResourceRequestBuilder {
value = split[1];
}
}
- resourceInput.put(key,value);
+ resourceInput.put(key, value);
}
return resourceInput;
}
@@ -207,8 +211,8 @@ public class ResourceRequestBuilder {
public static Map<String, Object> getServiceInstnace(String uuid) throws Exception {
String catalogEndPoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint");
- HttpClient client = new HttpClientFactory().newJsonClient(
- UriBuilder.fromUri(catalogEndPoint).path(SERVICE_URL_SERVICE_INSTANCE).queryParam("serviceModelUuid", uuid).build().toURL(),
+ HttpClient client = new HttpClientFactory().newJsonClient(UriBuilder.fromUri(catalogEndPoint)
+ .path(SERVICE_URL_SERVICE_INSTANCE).queryParam("serviceModelUuid", uuid).build().toURL(),
TargetEntity.CATALOG_DB);
client.addAdditionalHeader("Accept", "application/json");
@@ -234,7 +238,7 @@ public class ResourceRequestBuilder {
return null;
}
- public static String getJsonString(Object srcObj) {
+ public static String getJsonString(Object srcObj) {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
String jsonStr = null;
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
index 0fd0d9297d..dc2b3be073 100644
--- 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
@@ -22,50 +22,50 @@
*/
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.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CryptoHandler implements ICryptoHandler {
- private static final Logger logger = LoggerFactory.getLogger(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";
+ private static final Logger logger = LoggerFactory.getLogger(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;
- }
- }
+ 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 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;
- }
- }
+ @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
index 6314a849d2..479d2e82bd 100644
--- 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
@@ -21,7 +21,9 @@
package org.onap.so.bpmn.common.util;
public interface ICryptoHandler {
- public String getMsoAaiPassword();
- public String encryptMsoPassword(String plainPwd);
- public String decryptMsoPassword(String encryptedPwd);
+ 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/util/OofInfraUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java
index 6b178bd215..f25d4b440a 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java
@@ -28,7 +28,6 @@ import org.onap.so.db.catalog.beans.HomingInstance;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import java.util.Optional;
public class OofInfraUtils {
@@ -50,13 +49,13 @@ public class OofInfraUtils {
CatalogDbClient client = new CatalogDbClient(endpoint, auth);
- getCloudsite = Optional.ofNullable(client.getCloudSite(cloudSite.getId(), endpoint + "/cloudSite/")).orElse(new CloudSite());
+ getCloudsite = Optional.ofNullable(client.getCloudSite(cloudSite.getId(), endpoint + "/cloudSite/"))
+ .orElse(new CloudSite());
if (!cloudSite.getId().equals(getCloudsite.getId())) {
client.postCloudSite(cloudSite);
logger.debug("Did not findd cloudsite : {}", cloudSite.getId());
logger.debug("Will create cloudSite: {}", cloudSite.toString());
- }
- else {
+ } else {
logger.debug("Found cloudsite : {}", cloudSite.getId());
logger.debug("Will not create cloudSite: {}", cloudSite.toString());
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java
index a5d871eeef..a8e43c51e5 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java
@@ -27,10 +27,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
-
import javax.annotation.PostConstruct;
import javax.annotation.Priority;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.javatuples.Pair;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -46,29 +44,31 @@ import org.springframework.stereotype.Component;
/**
* Controls running all pre and post validation for building blocks.
*
- * To define a validation you must make it a spring bean and implement either {@link org.onap.so.bpmn.common.validation.PreBuildingBlockValidator} or
- * {@link org.onap.so.bpmn.common.validation.PostBuildingBlockValidator} your validation will automatically be
- * run by this class.
+ * To define a validation you must make it a spring bean and implement either
+ * {@link org.onap.so.bpmn.common.validation.PreBuildingBlockValidator} or
+ * {@link org.onap.so.bpmn.common.validation.PostBuildingBlockValidator} your validation will automatically be run by
+ * this class.
*
*/
@Component
-public class BuildingBlockValidatorRunner extends FlowValidatorRunner<PreBuildingBlockValidator, PostBuildingBlockValidator> {
-
- @PostConstruct
- protected void init() {
-
- preFlowValidators = new ArrayList<>(
- Optional.ofNullable(context.getBeansOfType(PreBuildingBlockValidator.class)).orElse(new HashMap<>()).values());
- postFlowValidators = new ArrayList<>(
- Optional.ofNullable(context.getBeansOfType(PostBuildingBlockValidator.class)).orElse(new HashMap<>()).values());
- }
-
- protected List<PreBuildingBlockValidator> getPreFlowValidators() {
- return this.preFlowValidators;
- }
-
- protected List<PostBuildingBlockValidator> getPostFlowValidators() {
- return this.postFlowValidators;
- }
-
+public class BuildingBlockValidatorRunner
+ extends FlowValidatorRunner<PreBuildingBlockValidator, PostBuildingBlockValidator> {
+
+ @PostConstruct
+ protected void init() {
+
+ preFlowValidators = new ArrayList<>(Optional.ofNullable(context.getBeansOfType(PreBuildingBlockValidator.class))
+ .orElse(new HashMap<>()).values());
+ postFlowValidators = new ArrayList<>(Optional
+ .ofNullable(context.getBeansOfType(PostBuildingBlockValidator.class)).orElse(new HashMap<>()).values());
+ }
+
+ protected List<PreBuildingBlockValidator> getPreFlowValidators() {
+ return this.preFlowValidators;
+ }
+
+ protected List<PostBuildingBlockValidator> getPostFlowValidators() {
+ return this.postFlowValidators;
+ }
+
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidator.java
index c457a349c2..66a8de9f8b 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidator.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidator.java
@@ -22,24 +22,24 @@ package org.onap.so.bpmn.common.validation;
import java.util.Optional;
import java.util.Set;
-
import org.onap.so.bpmn.common.BuildingBlockExecution;
public interface FlowValidator {
- /**
- * Should this validator run for given bb
- * @return
- */
- public boolean shouldRunFor(String bbName);
-
- /**
- * Determines whether or not the workflow should be executed
+ /**
+ * Should this validator run for given bb
+ *
+ * @return
+ */
+ public boolean shouldRunFor(String bbName);
+
+ /**
+ * Determines whether or not the workflow should be executed
+ *
+ *
+ * @param execution
+ * @return
+ */
+ public Optional<String> validate(BuildingBlockExecution execution);
- *
- * @param execution
- * @return
- */
- public Optional<String> validate(BuildingBlockExecution execution);
-
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java
index 2cc6415a50..0bdf4e35a2 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java
@@ -26,9 +26,7 @@ import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
-
import javax.annotation.Priority;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.javatuples.Pair;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -45,116 +43,119 @@ import org.springframework.stereotype.Component;
/**
* Controls running all pre and post validation for flows.
*
- * To define a validation you must make it a spring bean and implement either {@link org.onap.so.bpmn.common.validation.PreFlowValidator} or
- * {@link org.onap.so.bpmn.common.validation.PostFlowValidator} your validation will automatically be
- * run by this class.
+ * To define a validation you must make it a spring bean and implement either
+ * {@link org.onap.so.bpmn.common.validation.PreFlowValidator} or
+ * {@link org.onap.so.bpmn.common.validation.PostFlowValidator} your validation will automatically be run by this class.
*
*/
@Component
public abstract class FlowValidatorRunner<S extends FlowValidator, E extends FlowValidator> {
- private static Logger logger = LoggerFactory.getLogger(FlowValidatorRunner.class);
- @Autowired
- protected ApplicationContext context;
-
- @Autowired
- protected ExceptionBuilder exceptionBuilder;
-
- protected List<S> preFlowValidators;
- protected List<E> postFlowValidators;
-
-
-
- /**
- * Changed to object because JUEL does not support overloaded methods
- *
- * @param bbName
- * @param execution
- * @return
- */
- public boolean preValidate(String bbName, Object execution) {
- return validateHelper(bbName, preFlowValidators, execution);
- }
-
- /**
- * Changed to object because JUEL does not support overloaded methods
- *
- * @param bbName
- * @param execution
- * @return
- */
- public boolean postValidate(String bbName, Object execution) {
- return validateHelper(bbName, postFlowValidators, execution);
- }
-
- protected boolean validateHelper(String bbName, List<? extends FlowValidator> validators, Object obj) {
-
- if (obj instanceof DelegateExecution) {
- return validate(validators, bbName, new DelegateExecutionImpl((DelegateExecution)obj));
- } else if (obj instanceof BuildingBlockExecution) {
- return validate(validators, bbName, (BuildingBlockExecution)obj);
- } else {
- return false;
- }
- }
-
- protected boolean validate(List<? extends FlowValidator> validators, String bbName, BuildingBlockExecution execution) {
- List<Pair<String, Optional<String>>> results = runValidations(validators, bbName, execution);
-
- if (!results.isEmpty()) {
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Failed Validations:\n" + results.stream().map(item -> String.format("%s: %s", item.getValue0(), item.getValue1().get())).collect(Collectors.joining("\n")));
- }
-
- return true;
-
- }
- protected List<Pair<String, Optional<String>>> runValidations(List<? extends FlowValidator> validators, String bbName, BuildingBlockExecution execution) {
-
- List<FlowValidator> filtered = filterValidators(validators, bbName);
-
- List<Pair<String,Optional<String>>> results = new ArrayList<>();
- filtered.forEach(item -> results.add(new Pair<>(item.getClass().getName(), item.validate(execution))));
-
- return results.stream().filter(item -> item.getValue1().isPresent()).collect(Collectors.toList());
- }
-
- protected List<FlowValidator> filterValidators(List<? extends FlowValidator> validators, String bbName) {
- return validators.stream()
- .filter(item -> {
- return !item.getClass().isAnnotationPresent(Skip.class) && item.shouldRunFor(bbName);
- })
- .sorted(Comparator.comparing(item -> {
- Priority p = Optional.ofNullable(item.getClass().getAnnotation(Priority.class)).orElse(new Priority() {
- public int value() {
- return 1000;
- }
-
- @Override
- public Class<? extends Annotation> annotationType() {
- return Priority.class;
- }
- });
- return p.value();
- })).collect(Collectors.toList());
- }
-
- protected <T> List<T> buildalidatorList(Reflections reflections, Class<T> clazz) {
- List<T> result = new ArrayList<>();
- try {
- for (Class<? extends T> klass : reflections.getSubTypesOf(clazz)) {
- result.add(klass.newInstance());
- }
- } catch (InstantiationException | IllegalAccessException e) {
- logger.error("failed to build validator list for {}", clazz.getName(), e);
- throw new RuntimeException(e);
- }
-
- return result;
- }
-
- protected abstract List<S> getPreFlowValidators();
-
- protected abstract List<E> getPostFlowValidators();
-
+ private static Logger logger = LoggerFactory.getLogger(FlowValidatorRunner.class);
+ @Autowired
+ protected ApplicationContext context;
+
+ @Autowired
+ protected ExceptionBuilder exceptionBuilder;
+
+ protected List<S> preFlowValidators;
+ protected List<E> postFlowValidators;
+
+
+
+ /**
+ * Changed to object because JUEL does not support overloaded methods
+ *
+ * @param bbName
+ * @param execution
+ * @return
+ */
+ public boolean preValidate(String bbName, Object execution) {
+ return validateHelper(bbName, preFlowValidators, execution);
+ }
+
+ /**
+ * Changed to object because JUEL does not support overloaded methods
+ *
+ * @param bbName
+ * @param execution
+ * @return
+ */
+ public boolean postValidate(String bbName, Object execution) {
+ return validateHelper(bbName, postFlowValidators, execution);
+ }
+
+ protected boolean validateHelper(String bbName, List<? extends FlowValidator> validators, Object obj) {
+
+ if (obj instanceof DelegateExecution) {
+ return validate(validators, bbName, new DelegateExecutionImpl((DelegateExecution) obj));
+ } else if (obj instanceof BuildingBlockExecution) {
+ return validate(validators, bbName, (BuildingBlockExecution) obj);
+ } else {
+ return false;
+ }
+ }
+
+ protected boolean validate(List<? extends FlowValidator> validators, String bbName,
+ BuildingBlockExecution execution) {
+ List<Pair<String, Optional<String>>> results = runValidations(validators, bbName, execution);
+
+ if (!results.isEmpty()) {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
+ "Failed Validations:\n" + results.stream()
+ .map(item -> String.format("%s: %s", item.getValue0(), item.getValue1().get()))
+ .collect(Collectors.joining("\n")));
+ }
+
+ return true;
+
+ }
+
+ protected List<Pair<String, Optional<String>>> runValidations(List<? extends FlowValidator> validators,
+ String bbName, BuildingBlockExecution execution) {
+
+ List<FlowValidator> filtered = filterValidators(validators, bbName);
+
+ List<Pair<String, Optional<String>>> results = new ArrayList<>();
+ filtered.forEach(item -> results.add(new Pair<>(item.getClass().getName(), item.validate(execution))));
+
+ return results.stream().filter(item -> item.getValue1().isPresent()).collect(Collectors.toList());
+ }
+
+ protected List<FlowValidator> filterValidators(List<? extends FlowValidator> validators, String bbName) {
+ return validators.stream().filter(item -> {
+ return !item.getClass().isAnnotationPresent(Skip.class) && item.shouldRunFor(bbName);
+ }).sorted(Comparator.comparing(item -> {
+ Priority p = Optional.ofNullable(item.getClass().getAnnotation(Priority.class)).orElse(new Priority() {
+ public int value() {
+ return 1000;
+ }
+
+ @Override
+ public Class<? extends Annotation> annotationType() {
+ return Priority.class;
+ }
+ });
+ return p.value();
+ })).collect(Collectors.toList());
+ }
+
+ protected <T> List<T> buildalidatorList(Reflections reflections, Class<T> clazz) {
+ List<T> result = new ArrayList<>();
+ try {
+ for (Class<? extends T> klass : reflections.getSubTypesOf(clazz)) {
+ result.add(klass.newInstance());
+ }
+ } catch (InstantiationException | IllegalAccessException e) {
+ logger.error("failed to build validator list for {}", clazz.getName(), e);
+ throw new RuntimeException(e);
+ }
+
+ return result;
+ }
+
+ protected abstract List<S> getPreFlowValidators();
+
+ protected abstract List<E> getPostFlowValidators();
+
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunner.java
index d8c8601865..6950618953 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunner.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunner.java
@@ -27,10 +27,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
-
import javax.annotation.PostConstruct;
import javax.annotation.Priority;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.javatuples.Pair;
import org.onap.so.client.exception.ExceptionBuilder;
@@ -45,29 +43,30 @@ import org.springframework.stereotype.Component;
/**
* Controls running all pre and post validation for workflows.
*
- * To define a validation you must make it a spring bean and implement either {@link org.onap.so.bpmn.common.validation.PreWorkflowValidator} or
- * {@link org.onap.so.bpmn.common.validation.PostWorkflowValidator} your validation will automatically be
- * run by this class.
+ * To define a validation you must make it a spring bean and implement either
+ * {@link org.onap.so.bpmn.common.validation.PreWorkflowValidator} or
+ * {@link org.onap.so.bpmn.common.validation.PostWorkflowValidator} your validation will automatically be run by this
+ * class.
*
*/
@Component
public class WorkflowValidatorRunner extends FlowValidatorRunner<PreWorkflowValidator, PostWorkflowValidator> {
- @PostConstruct
- protected void init() {
-
- preFlowValidators = new ArrayList<>(
- Optional.ofNullable(context.getBeansOfType(PreWorkflowValidator.class)).orElse(new HashMap<>()).values());
- postFlowValidators = new ArrayList<>(
- Optional.ofNullable(context.getBeansOfType(PostWorkflowValidator.class)).orElse(new HashMap<>()).values());
- }
+ @PostConstruct
+ protected void init() {
+
+ preFlowValidators = new ArrayList<>(Optional.ofNullable(context.getBeansOfType(PreWorkflowValidator.class))
+ .orElse(new HashMap<>()).values());
+ postFlowValidators = new ArrayList<>(Optional.ofNullable(context.getBeansOfType(PostWorkflowValidator.class))
+ .orElse(new HashMap<>()).values());
+ }
+
+ protected List<PreWorkflowValidator> getPreFlowValidators() {
+ return this.preFlowValidators;
+ }
+
+ protected List<PostWorkflowValidator> getPostFlowValidators() {
+ return this.postFlowValidators;
+ }
- protected List<PreWorkflowValidator> getPreFlowValidators() {
- return this.preFlowValidators;
- }
-
- protected List<PostWorkflowValidator> getPostFlowValidators() {
- return this.postFlowValidators;
- }
-
}
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
index 13d2126805..2a64b1ad2f 100644
--- 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
@@ -21,32 +21,36 @@ package org.onap.so.bpmn.common.workflow.context;
/**
- * @version 1.0
- * Workflow Response bean to generate workflow response in JSON format
+ * @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;
- }
+
+ 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
index 3ec7773791..2a10271e67 100644
--- 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
@@ -26,73 +26,72 @@ 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
+ * @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;
- }
- }
+ 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
index 0de3414381..33fb78b306 100644
--- 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
@@ -25,7 +25,6 @@ package org.onap.so.bpmn.common.workflow.context;
import java.util.concurrent.DelayQueue;
import java.util.concurrent.TimeUnit;
-
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -34,6 +33,7 @@ import org.springframework.stereotype.Component;
/**
* Workflow Context Holder instance which can be accessed elsewhere either in groovy scripts or Java
+ *
* @version 1.0
*
*/
@@ -41,100 +41,100 @@ import org.springframework.stereotype.Component;
@Component
public class WorkflowContextHolder {
- private static Logger logger = LoggerFactory.getLogger(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<WorkflowContext> 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) {
- logger.debug("{} Adding context to the queue: {}", logMarker, context.getRequestId());
- responseQueue.put(context);
- }
-
- public void remove(WorkflowContext context) {
- logger.debug("{} Removing context from the queue: {}", logMarker, context.getRequestId());
- responseQueue.remove(context);
- }
-
- public WorkflowContext getWorkflowContext(String requestId) {
- // Note: DelayQueue interator is threadsafe
- for (WorkflowContext context : responseQueue) {
- if (requestId.equals(context.getRequestId())) {
- return context;
- }
- }
- 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();
- logger.debug("Time remaining for request id: {}:{}", requestObject.getRequestId(), requestObject
- .getDelay
- (TimeUnit.MILLISECONDS));
- logger.debug("Preparing timeout response for {}:{}", requestObject.getProcessKey(), requestObject
- .getRequestId());
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- } catch (Exception e) {
- logger.debug("WorkflowContextHolder timeout thread caught exception: ", e);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
- ErrorCode.UnknownError.getValue(), "Error in WorkflowContextHolder timeout thread");
- }
- }
- logger.debug("WorkflowContextHolder timeout thread interrupted, quitting");
- }
- }
+ private static Logger logger = LoggerFactory.getLogger(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<WorkflowContext> 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) {
+ logger.debug("{} Adding context to the queue: {}", logMarker, context.getRequestId());
+ responseQueue.put(context);
+ }
+
+ public void remove(WorkflowContext context) {
+ logger.debug("{} Removing context from the queue: {}", logMarker, context.getRequestId());
+ responseQueue.remove(context);
+ }
+
+ public WorkflowContext getWorkflowContext(String requestId) {
+ // Note: DelayQueue interator is threadsafe
+ for (WorkflowContext context : responseQueue) {
+ if (requestId.equals(context.getRequestId())) {
+ return context;
+ }
+ }
+ 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();
+ logger.debug("Time remaining for request id: {}:{}", requestObject.getRequestId(),
+ requestObject.getDelay(TimeUnit.MILLISECONDS));
+ logger.debug("Preparing timeout response for {}:{}", requestObject.getProcessKey(),
+ requestObject.getRequestId());
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ } catch (Exception e) {
+ logger.debug("WorkflowContextHolder timeout thread caught exception: ", e);
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
+ ErrorCode.UnknownError.getValue(), "Error in WorkflowContextHolder timeout thread");
+ }
+ }
+ logger.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
index f5aa0b33c6..22595a8b04 100644
--- 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
@@ -23,56 +23,63 @@ package org.onap.so.bpmn.common.workflow.context;
import java.util.Map;
/**
- * @version 1.0
- * Synchronous workflow response bean
+ * @version 1.0 Synchronous workflow response bean
*
*/
public class WorkflowResponse {
- private String response;
- private String message;
- private String processInstanceID;
- private Map<String,String> 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<String, String> getVariables() {
- return variables;
- }
- public void setVariables(Map<String, String> 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 + "]";
- }
-
-
+ private String response;
+ private String message;
+ private String processInstanceID;
+ private Map<String, String> 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<String, String> getVariables() {
+ return variables;
+ }
+
+ public void setVariables(Map<String, String> 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
index 1f83c3135e..f56fad3bcf 100644
--- 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
@@ -23,18 +23,17 @@ 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> metadatum = new ArrayList<Metadatum>();
+public class Metadata implements Serializable {
+
+ private static final long serialVersionUID = 4981393122007858950L;
+
+ @JsonProperty("metadatum")
+ private List<Metadatum> metadatum = new ArrayList<Metadatum>();
- public List<Metadatum> getMetadatum() {
- return metadatum;
- }
+ public List<Metadatum> 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
index 1263e7ba7c..3fc0808741 100644
--- 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
@@ -21,28 +21,27 @@
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<T> {
- 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);
- }
+ 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/AggregateRoute.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java
index cb9c681fd5..a5eb9d86a7 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java
@@ -21,87 +21,84 @@
package org.onap.so.bpmn.servicedecomposition.bbobjects;
import java.io.Serializable;
-
import javax.persistence.Id;
-
import org.onap.so.bpmn.servicedecomposition.ShallowCopy;
-
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("aggregate-route")
-public class AggregateRoute implements Serializable, ShallowCopy<AggregateRoute>{
-
- private static final long serialVersionUID = -1059128545462701696L;
-
- @Id
- @JsonProperty("route-id")
- private String routeId;
- @JsonProperty("route-name")
- private String routeName;
- @JsonProperty("network-start-address")
- private String networkStartAddress;
- @JsonProperty("cidr-mask")
- private String cidrMask;
- @JsonProperty("ip-version")
- private String ipVersion;
-
-
- public String getRouteId(){
- return routeId;
- }
-
- public void setRouteId(String routeId){
- this.routeId = routeId;
- }
-
- public String getRouteName(){
- return routeName;
- }
-
- public void setRouteName(String routeName){
- this.routeName = routeName;
- }
-
- 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;
- }
-
- @Override
- public boolean equals(final Object other){
- if(!(other instanceof AggregateRoute)){
- return false;
- }
- AggregateRoute castOther = (AggregateRoute) other;
- return new EqualsBuilder().append(routeId, castOther.routeId).isEquals();
- }
-
- @Override
- public int hashCode(){
- return new HashCodeBuilder().append(routeId).toHashCode();
- }
+public class AggregateRoute implements Serializable, ShallowCopy<AggregateRoute> {
+
+ private static final long serialVersionUID = -1059128545462701696L;
+
+ @Id
+ @JsonProperty("route-id")
+ private String routeId;
+ @JsonProperty("route-name")
+ private String routeName;
+ @JsonProperty("network-start-address")
+ private String networkStartAddress;
+ @JsonProperty("cidr-mask")
+ private String cidrMask;
+ @JsonProperty("ip-version")
+ private String ipVersion;
+
+
+ public String getRouteId() {
+ return routeId;
+ }
+
+ public void setRouteId(String routeId) {
+ this.routeId = routeId;
+ }
+
+ public String getRouteName() {
+ return routeName;
+ }
+
+ public void setRouteName(String routeName) {
+ this.routeName = routeName;
+ }
+
+ 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;
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof AggregateRoute)) {
+ return false;
+ }
+ AggregateRoute castOther = (AggregateRoute) other;
+ return new EqualsBuilder().append(routeId, castOther.routeId).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(routeId).toHashCode();
+ }
}
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
index 775d80db75..00f41ef1e3 100644
--- 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
@@ -21,14 +21,11 @@
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;
@@ -37,93 +34,112 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
@JsonRootName("allotted-resource")
public class AllottedResource extends SolutionCandidates implements Serializable, ShallowCopy<AllottedResource> {
- 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 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")
+ @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();
- }
+ 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
index df1eeae1b6..6439b5a65f 100644
--- 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
@@ -21,9 +21,7 @@
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;
@@ -31,82 +29,95 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy;
public class CloudRegion implements Serializable, ShallowCopy<CloudRegion> {
- 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;
- @JsonProperty("orchestration-disabled")
- private Boolean orchestrationDisabled;
-
- 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;
- }
- public Boolean getOrchestrationDisabled() {
- return orchestrationDisabled;
- }
- public void setOrchestrationDisabled(Boolean orchestrationDisabled) {
- this.orchestrationDisabled = orchestrationDisabled;
- }
- @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();
- }
+ 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;
+ @JsonProperty("orchestration-disabled")
+ private Boolean orchestrationDisabled;
+
+ 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;
+ }
+
+ public Boolean getOrchestrationDisabled() {
+ return orchestrationDisabled;
+ }
+
+ public void setOrchestrationDisabled(Boolean orchestrationDisabled) {
+ this.orchestrationDisabled = orchestrationDisabled;
+ }
+
+ @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
index 6bbdb1ed67..1d6f9272de 100644
--- 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
@@ -22,12 +22,10 @@ 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;
@@ -35,63 +33,74 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy;
@JsonRootName("collection")
public class Collection implements Serializable, ShallowCopy<Collection> {
-
- 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 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();
- }
+ @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
index 748d37d6e4..dff5a57040 100644
--- 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
@@ -27,7 +27,6 @@ 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;
@@ -36,205 +35,205 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy;
@JsonRootName("configuration")
public class Configuration implements Serializable, ShallowCopy<Configuration> {
- 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<ForwarderEvc> forwarderEvcs = new ArrayList<>();
- @JsonProperty("evcs")
- private List<Evc> evcs = new ArrayList<>();
- @JsonProperty("vnfc")
- private Vnfc vnfc = new Vnfc();
- @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<ForwarderEvc> getForwarderEvcs() {
- return forwarderEvcs;
- }
-
- public Vnfc getVnfc() {
- return vnfc;
- }
-
- public void setVnfc(Vnfc vnfc) {
- this.vnfc = vnfc;
- }
-
- public List<Evc> 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<ForwarderEvc> forwarderEvcs) {
- this.forwarderEvcs = forwarderEvcs;
- }
-
- public void setEvcs(List<Evc> 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();
- }
-
+ 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<ForwarderEvc> forwarderEvcs = new ArrayList<>();
+ @JsonProperty("evcs")
+ private List<Evc> evcs = new ArrayList<>();
+ @JsonProperty("vnfc")
+ private Vnfc vnfc = new Vnfc();
+ @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<ForwarderEvc> getForwarderEvcs() {
+ return forwarderEvcs;
+ }
+
+ public Vnfc getVnfc() {
+ return vnfc;
+ }
+
+ public void setVnfc(Vnfc vnfc) {
+ this.vnfc = vnfc;
+ }
+
+ public List<Evc> 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<ForwarderEvc> forwarderEvcs) {
+ this.forwarderEvcs = forwarderEvcs;
+ }
+
+ public void setEvcs(List<Evc> 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
index 978f1e9324..8194485d2b 100644
--- 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
@@ -21,45 +21,43 @@
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<CtagAssignment> {
-
- private static final long serialVersionUID = 2314290576523243571L;
- @Id
- @JsonProperty("vlan-id-inner")
- private Long vlanIdInner;
-
- public Long getVlanIdInner() {
- return vlanIdInner;
- }
+ 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;
+ }
- 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 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();
+ }
- @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
index 985f51035c..30492ddf61 100644
--- 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
@@ -23,9 +23,7 @@ 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;
@@ -35,65 +33,77 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy;
@JsonRootName("customer")
public class Customer implements Serializable, ShallowCopy<Customer> {
- 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 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<VpnBinding> 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<VpnBinding> 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();
- }
+ private List<VpnBinding> 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<VpnBinding> 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
index fdcb59d3c3..dd97aa55ad 100644
--- 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
@@ -21,50 +21,53 @@
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<Entitlement>{
-
- private static final long serialVersionUID = 5186878328988717088L;
+public class Entitlement implements Serializable, ShallowCopy<Entitlement> {
- @Id
- @JsonProperty("group-uuid")
+ private static final long serialVersionUID = 5186878328988717088L;
+
+ @Id
+ @JsonProperty("group-uuid")
private String groupUuid;
- @Id
- @JsonProperty("resource-uuid")
+ @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();
- }
+ 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
index 3ef0f71386..c7e6ebc9a7 100644
--- 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
@@ -21,40 +21,38 @@
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<Evc> {
- private static final long serialVersionUID = -3556506672371317659L;
+ private static final long serialVersionUID = -3556506672371317659L;
- @Id
- @JsonProperty("evc-id")
+ @Id
+ @JsonProperty("evc-id")
private String evcId;
- @JsonProperty("forwarding-path-topology")
+ @JsonProperty("forwarding-path-topology")
private String forwardingPathTopology;
- @JsonProperty("cir-value")
+ @JsonProperty("cir-value")
private String cirValue;
- @JsonProperty("cir-units")
+ @JsonProperty("cir-units")
private String cirUnits;
- @JsonProperty("connection-diversity-group-id")
+ @JsonProperty("connection-diversity-group-id")
private String connectionDiversityGroupId;
- @JsonProperty("service-hours")
+ @JsonProperty("service-hours")
private String serviceHours;
- @JsonProperty("esp-evc-circuit-id")
+ @JsonProperty("esp-evc-circuit-id")
private String espEvcCircuitId;
- @JsonProperty("esp-evc-cir-value")
+ @JsonProperty("esp-evc-cir-value")
private String espEvcCirValue;
- @JsonProperty("esp-evc-cir-units")
+ @JsonProperty("esp-evc-cir-units")
private String espEvcCirUnits;
- @JsonProperty("esp-itu-code")
+ @JsonProperty("esp-itu-code")
private String espItuCode;
@JsonProperty("collector-pop-clli")
private String collectorPopClli;
@@ -65,100 +63,129 @@ public class Evc implements Serializable, ShallowCopy<Evc> {
@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();
- }
+ 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
index 70f7d5af42..716dd1a57b 100644
--- 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
@@ -21,83 +21,81 @@
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<ForwarderEvc> {
- 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();
- }
+ 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
index c6e7668f22..841546b3b1 100644
--- 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
@@ -25,9 +25,7 @@ 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;
@@ -35,516 +33,515 @@ 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<GenericVnf> {
- 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<VfModule> vfModules = new ArrayList<>();
- @JsonProperty("volume-groups")
- private List<VolumeGroup> 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<String, String> 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<LInterface> lInterfaces = new ArrayList<>();
- @JsonProperty("lag-interfaces")
- private List<LagInterface> lagInterfaces = new ArrayList<>();
- @JsonProperty("license")
- private License license;
- @JsonProperty("entitlements") //TODO remove, duplicated
- private List<Entitlement> entitlements = new ArrayList<>();
- @JsonProperty("model-info-generic-vnf")
- private ModelInfoGenericVnf modelInfoGenericVnf;
- @JsonProperty("instance-groups")
+ 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<VfModule> vfModules = new ArrayList<>();
+ @JsonProperty("volume-groups")
+ private List<VolumeGroup> 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<String, String> 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<LInterface> lInterfaces = new ArrayList<>();
+ @JsonProperty("lag-interfaces")
+ private List<LagInterface> lagInterfaces = new ArrayList<>();
+ @JsonProperty("license")
+ private License license;
+ @JsonProperty("entitlements") // TODO remove, duplicated
+ private List<Entitlement> entitlements = new ArrayList<>();
+ @JsonProperty("model-info-generic-vnf")
+ private ModelInfoGenericVnf modelInfoGenericVnf;
+ @JsonProperty("instance-groups")
private List<InstanceGroup> instanceGroups = new ArrayList<InstanceGroup>();
- @JsonProperty("call-homing")
- private Boolean callHoming;
- @JsonProperty("nf-function")
- private String nfFunction;
- @JsonProperty("nf-role")
- private String nfRole;
- @JsonProperty("CDS_BLUEPRINT_NAME")
- private String blueprintName;
- @JsonProperty("CDS_BLUEPRINT_VERSION")
- private String blueprintVersion;
-
-
- public String getBlueprintName() {
- return blueprintName;
- }
-
- public void setBlueprintName(String blueprintName) {
- this.blueprintName = blueprintName;
- }
-
- public String getBlueprintVersion() {
- return blueprintVersion;
- }
-
- public void setBlueprintVersion(String blueprintVersion) {
- this.blueprintVersion = blueprintVersion;
- }
-
- public String getNfFunction() {
- return nfFunction;
- }
-
- public void setNfFunction(String nfFunction) {
- this.nfFunction = nfFunction;
- }
-
- public String getNfRole() {
- return nfRole;
- }
-
- public void setNfRole(String nfRole) {
- this.nfRole = nfRole;
- }
-
- public List<InstanceGroup> getInstanceGroups() {
- return instanceGroups;
- }
-
- public List<VolumeGroup> 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;
- }
+ @JsonProperty("call-homing")
+ private Boolean callHoming;
+ @JsonProperty("nf-function")
+ private String nfFunction;
+ @JsonProperty("nf-role")
+ private String nfRole;
+ @JsonProperty("CDS_BLUEPRINT_NAME")
+ private String blueprintName;
+ @JsonProperty("CDS_BLUEPRINT_VERSION")
+ private String blueprintVersion;
+
+
+ public String getBlueprintName() {
+ return blueprintName;
+ }
+
+ public void setBlueprintName(String blueprintName) {
+ this.blueprintName = blueprintName;
+ }
+
+ public String getBlueprintVersion() {
+ return blueprintVersion;
+ }
+
+ public void setBlueprintVersion(String blueprintVersion) {
+ this.blueprintVersion = blueprintVersion;
+ }
+
+ public String getNfFunction() {
+ return nfFunction;
+ }
+
+ public void setNfFunction(String nfFunction) {
+ this.nfFunction = nfFunction;
+ }
+
+ public String getNfRole() {
+ return nfRole;
+ }
+
+ public void setNfRole(String nfRole) {
+ this.nfRole = nfRole;
+ }
+
+ public List<InstanceGroup> getInstanceGroups() {
+ return instanceGroups;
+ }
+
+ public List<VolumeGroup> 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 void setEquipmentRole(String equipmentRole) {
+ this.equipmentRole = equipmentRole;
+ }
- public String getManagementOption() {
- return managementOption;
- }
+ public String getManagementOption() {
+ return managementOption;
+ }
- public void setManagementOption(String managementOption) {
- this.managementOption = managementOption;
- }
+ public void setManagementOption(String managementOption) {
+ this.managementOption = managementOption;
+ }
- public String getIpv4OamAddress() {
- return ipv4OamAddress;
- }
+ public String getIpv4OamAddress() {
+ return ipv4OamAddress;
+ }
- public void setIpv4OamAddress(String ipv4OamAddress) {
- this.ipv4OamAddress = ipv4OamAddress;
- }
+ public void setIpv4OamAddress(String ipv4OamAddress) {
+ this.ipv4OamAddress = ipv4OamAddress;
+ }
- public String getIpv4Loopback0Address() {
- return ipv4Loopback0Address;
- }
+ public String getIpv4Loopback0Address() {
+ return ipv4Loopback0Address;
+ }
- public void setIpv4Loopback0Address(String ipv4Loopback0Address) {
- this.ipv4Loopback0Address = ipv4Loopback0Address;
- }
+ public void setIpv4Loopback0Address(String ipv4Loopback0Address) {
+ this.ipv4Loopback0Address = ipv4Loopback0Address;
+ }
- public String getNmLanV6Address() {
- return nmLanV6Address;
- }
+ public String getNmLanV6Address() {
+ return nmLanV6Address;
+ }
- public void setNmLanV6Address(String nmLanV6Address) {
- this.nmLanV6Address = nmLanV6Address;
- }
+ public void setNmLanV6Address(String nmLanV6Address) {
+ this.nmLanV6Address = nmLanV6Address;
+ }
- public String getManagementV6Address() {
- return managementV6Address;
- }
+ public String getManagementV6Address() {
+ return managementV6Address;
+ }
- public void setManagementV6Address(String managementV6Address) {
- this.managementV6Address = managementV6Address;
- }
+ public void setManagementV6Address(String managementV6Address) {
+ this.managementV6Address = managementV6Address;
+ }
- public Long getVcpu() {
- return vcpu;
- }
+ public Long getVcpu() {
+ return vcpu;
+ }
- public void setVcpu(Long vcpu) {
- this.vcpu = vcpu;
- }
+ public void setVcpu(Long vcpu) {
+ this.vcpu = vcpu;
+ }
- public String getVcpuUnits() {
- return vcpuUnits;
- }
+ public String getVcpuUnits() {
+ return vcpuUnits;
+ }
- public void setVcpuUnits(String vcpuUnits) {
- this.vcpuUnits = vcpuUnits;
- }
+ public void setVcpuUnits(String vcpuUnits) {
+ this.vcpuUnits = vcpuUnits;
+ }
- public List<LInterface> getlInterfaces() {
- return lInterfaces;
- }
+ public List<LInterface> getlInterfaces() {
+ return lInterfaces;
+ }
- public List<LagInterface> getLagInterfaces() {
- return lagInterfaces;
- }
+ public List<LagInterface> getLagInterfaces() {
+ return lagInterfaces;
+ }
- public List<Entitlement> getEntitlements() {
- return entitlements;
- }
+ public List<Entitlement> getEntitlements() {
+ return entitlements;
+ }
- public List<VfModule> getVfModules() {
- return vfModules;
- }
+ public List<VfModule> getVfModules() {
+ return vfModules;
+ }
- public Long getVmemory() {
- return vmemory;
- }
+ public Long getVmemory() {
+ return vmemory;
+ }
- public void setVmemory(Long vmemory) {
- this.vmemory = vmemory;
- }
+ public void setVmemory(Long vmemory) {
+ this.vmemory = vmemory;
+ }
- public String getVmemoryUnits() {
- return vmemoryUnits;
- }
+ public String getVmemoryUnits() {
+ return vmemoryUnits;
+ }
- public void setVmemoryUnits(String vmemoryUnits) {
- this.vmemoryUnits = vmemoryUnits;
- }
+ public void setVmemoryUnits(String vmemoryUnits) {
+ this.vmemoryUnits = vmemoryUnits;
+ }
- public Long getVdisk() {
- return vdisk;
- }
+ public Long getVdisk() {
+ return vdisk;
+ }
- public void setVdisk(Long vdisk) {
- this.vdisk = vdisk;
- }
+ public void setVdisk(Long vdisk) {
+ this.vdisk = vdisk;
+ }
- public String getVdiskUnits() {
- return vdiskUnits;
- }
+ public String getVdiskUnits() {
+ return vdiskUnits;
+ }
- public void setVdiskUnits(String vdiskUnits) {
- this.vdiskUnits = vdiskUnits;
- }
+ public void setVdiskUnits(String vdiskUnits) {
+ this.vdiskUnits = vdiskUnits;
+ }
- public Boolean isInMaint() {
- return inMaint;
- }
+ public Boolean isInMaint() {
+ return inMaint;
+ }
- public void setInMaint(Boolean inMaint) {
- this.inMaint = inMaint;
- }
+ public void setInMaint(Boolean inMaint) {
+ this.inMaint = inMaint;
+ }
- public Boolean isIsClosedLoopDisabled() {
- return isClosedLoopDisabled;
- }
+ public Boolean isIsClosedLoopDisabled() {
+ return isClosedLoopDisabled;
+ }
- public void setClosedLoopDisabled(Boolean isClosedLoopDisabled) {
- this.isClosedLoopDisabled = isClosedLoopDisabled;
- }
+ public void setClosedLoopDisabled(Boolean isClosedLoopDisabled) {
+ this.isClosedLoopDisabled = isClosedLoopDisabled;
+ }
- public String getSummaryStatus() {
- return summaryStatus;
- }
+ public String getSummaryStatus() {
+ return summaryStatus;
+ }
- public void setSummaryStatus(String summaryStatus) {
- this.summaryStatus = summaryStatus;
- }
+ public void setSummaryStatus(String summaryStatus) {
+ this.summaryStatus = summaryStatus;
+ }
- public Boolean getEncryptedAccessFlag() {
- return encryptedAccessFlag;
- }
+ public Boolean getEncryptedAccessFlag() {
+ return encryptedAccessFlag;
+ }
- public void setEncryptedAccessFlag(Boolean encryptedAccessFlag) {
- this.encryptedAccessFlag = encryptedAccessFlag;
- }
+ public void setEncryptedAccessFlag(Boolean encryptedAccessFlag) {
+ this.encryptedAccessFlag = encryptedAccessFlag;
+ }
- public String getAsNumber() {
- return asNumber;
- }
+ public String getAsNumber() {
+ return asNumber;
+ }
- public void setAsNumber(String asNumber) {
- this.asNumber = asNumber;
- }
+ public void setAsNumber(String asNumber) {
+ this.asNumber = asNumber;
+ }
- public String getRegionalResourceSubzone() {
- return regionalResourceSubzone;
- }
+ public String getRegionalResourceSubzone() {
+ return regionalResourceSubzone;
+ }
- public void setRegionalResourceSubzone(String regionalResourceSubzone) {
- this.regionalResourceSubzone = regionalResourceSubzone;
- }
+ public void setRegionalResourceSubzone(String regionalResourceSubzone) {
+ this.regionalResourceSubzone = regionalResourceSubzone;
+ }
- public License getLicense() {
- return license;
- }
+ public License getLicense() {
+ return license;
+ }
- public void setLicense(License license) {
- this.license = license;
- }
+ public void setLicense(License license) {
+ this.license = license;
+ }
- public String getSelflink() {
- return selflink;
- }
+ public String getSelflink() {
+ return selflink;
+ }
- public void setSelflink(String selflink) {
- this.selflink = selflink;
- }
+ public void setSelflink(String selflink) {
+ this.selflink = selflink;
+ }
- public String getIpv4OamGatewayAddress() {
- return ipv4OamGatewayAddress;
- }
+ public String getIpv4OamGatewayAddress() {
+ return ipv4OamGatewayAddress;
+ }
- public void setIpv4OamGatewayAddress(String ipv4OamGatewayAddress) {
- this.ipv4OamGatewayAddress = ipv4OamGatewayAddress;
- }
+ public void setIpv4OamGatewayAddress(String ipv4OamGatewayAddress) {
+ this.ipv4OamGatewayAddress = ipv4OamGatewayAddress;
+ }
- public Integer getIpv4OamGatewayAddressPrefixLength() {
- return ipv4OamGatewayAddressPrefixLength;
- }
+ public Integer getIpv4OamGatewayAddressPrefixLength() {
+ return ipv4OamGatewayAddressPrefixLength;
+ }
- public void setIpv4OamGatewayAddressPrefixLength(Integer ipv4OamGatewayAddressPrefixLength) {
- this.ipv4OamGatewayAddressPrefixLength = ipv4OamGatewayAddressPrefixLength;
- }
+ public void setIpv4OamGatewayAddressPrefixLength(Integer ipv4OamGatewayAddressPrefixLength) {
+ this.ipv4OamGatewayAddressPrefixLength = ipv4OamGatewayAddressPrefixLength;
+ }
- public Long getVlanIdOuter() {
- return vlanIdOuter;
- }
+ public Long getVlanIdOuter() {
+ return vlanIdOuter;
+ }
- public void setVlanIdOuter(Long vlanIdOuter) {
- this.vlanIdOuter = 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<String, String> getCloudParams() {
- return cloudParams;
- }
-
- public void setCloudParams(Map<String, String> 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();
- }
+ 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<String, String> getCloudParams() {
+ return cloudParams;
+ }
+
+ public void setCloudParams(Map<String, String> 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
index 75356ac9db..f8cc594d11 100644
--- 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
@@ -21,64 +21,71 @@
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<HostRoute>{
+public class HostRoute implements Serializable, ShallowCopy<HostRoute> {
- private static final long serialVersionUID = -2468793257174064133L;
+ private static final long serialVersionUID = -2468793257174064133L;
- @Id
- @JsonProperty("host-route-id")
+ @Id
+ @JsonProperty("host-route-id")
private String hostRouteId;
- @JsonProperty("route-prefix")
+ @JsonProperty("route-prefix")
private String routePrefix;
- @JsonProperty("next-hop")
+ @JsonProperty("next-hop")
private String nextHop;
- @JsonProperty("next-hop-type")
+ @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();
- }
+ 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
index 7a58f6db6b..4edaecdbca 100644
--- 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
@@ -23,99 +23,113 @@ 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 org.onap.so.db.catalog.beans.OrchestrationStatus;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("instance-group")
-public class InstanceGroup implements Serializable, ShallowCopy<InstanceGroup> {
-
- 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("orchestration-status")
- private OrchestrationStatus orchestrationStatus = OrchestrationStatus.PRECREATED;
- @JsonProperty("model-info-instance-group")
- private ModelInfoInstanceGroup modelInfoInstanceGroup;
- @JsonProperty("instance-group-function")
- private String instanceGroupFunction;
- @JsonProperty("vnfs")
- private List<GenericVnf> vnfs = new ArrayList<>();
-
- 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 OrchestrationStatus getOrchestrationStatus() {
- return orchestrationStatus;
- }
- public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) {
- this.orchestrationStatus = orchestrationStatus;
- }
- 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;
- }
- public List<GenericVnf> getVnfs() {
- return vnfs;
- }
- public void setVnfs(List<GenericVnf> vnfs) {
- this.vnfs = vnfs;
- }
- @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();
- }
+public class InstanceGroup implements Serializable, ShallowCopy<InstanceGroup> {
+
+ 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("orchestration-status")
+ private OrchestrationStatus orchestrationStatus = OrchestrationStatus.PRECREATED;
+ @JsonProperty("model-info-instance-group")
+ private ModelInfoInstanceGroup modelInfoInstanceGroup;
+ @JsonProperty("instance-group-function")
+ private String instanceGroupFunction;
+ @JsonProperty("vnfs")
+ private List<GenericVnf> vnfs = new ArrayList<>();
+
+ 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 OrchestrationStatus getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+
+ public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+
+ 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;
+ }
+
+ public List<GenericVnf> getVnfs() {
+ return vnfs;
+ }
+
+ public void setVnfs(List<GenericVnf> vnfs) {
+ this.vnfs = vnfs;
+ }
+
+ @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
index 55b8a752b6..b064d53945 100644
--- 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
@@ -21,88 +21,101 @@
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<L3InterfaceIpv4AddressList>{
+public class L3InterfaceIpv4AddressList implements Serializable, ShallowCopy<L3InterfaceIpv4AddressList> {
- private static final long serialVersionUID = -1566884527411610879L;
+ private static final long serialVersionUID = -1566884527411610879L;
- @Id
- @JsonProperty("l3-interface-ipv4-address")
+ @Id
+ @JsonProperty("l3-interface-ipv4-address")
private String l3InterfaceIpv4Address;
- @JsonProperty("l3-interface-ipv4-prefix-length")
+ @JsonProperty("l3-interface-ipv4-prefix-length")
private Long l3InterfaceIpv4PrefixLength;
- @JsonProperty("vlan-id-inner")
+ @JsonProperty("vlan-id-inner")
private Long vlanIdInner;
- @JsonProperty("vlan-id-outer")
+ @JsonProperty("vlan-id-outer")
private Long vlanIdOuter;
- @JsonProperty("is-floating")
+ @JsonProperty("is-floating")
private Boolean isFloating;
- @JsonProperty("neutron-network-id")
+ @JsonProperty("neutron-network-id")
private String neutronNetworkId;
- @JsonProperty("neutron-subnet-id")
+ @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();
- }
+ 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
index 209c64762f..ffdcad5a13 100644
--- 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
@@ -21,103 +21,101 @@
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<L3InterfaceIpv6AddressList> {
- 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();
- }
+ 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
index 781eba3332..6b3ad1d528 100644
--- 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
@@ -25,258 +25,305 @@ 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<L3Network> {
- private static final long serialVersionUID = 4434492567957111317L;
+ private static final long serialVersionUID = 4434492567957111317L;
- @Id
- @JsonProperty("network-id")
- private String networkId;
- @JsonProperty("cascaded")
- private Boolean cascaded;
- @JsonProperty("cloud-params")
- private Map<String, String> cloudParams = new HashMap<>();
- @JsonProperty("network-name")
+ @Id
+ @JsonProperty("network-id")
+ private String networkId;
+ @JsonProperty("cascaded")
+ private Boolean cascaded;
+ @JsonProperty("cloud-params")
+ private Map<String, String> 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")
+ @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")
+ @JsonProperty("service-id")
private String serviceId;
- @JsonProperty("network-role-instance")
+ @JsonProperty("network-role-instance")
private Long networkRoleInstance;
- @JsonProperty("orchestration-status")
+ @JsonProperty("orchestration-status")
private OrchestrationStatus orchestrationStatus;
- @JsonProperty("heat-stack-id")
+ @JsonProperty("heat-stack-id")
private String heatStackId;
- @JsonProperty("contrail-network-fqdn")
+ @JsonProperty("contrail-network-fqdn")
private String contrailNetworkFqdn;
- @JsonProperty("network-policies")
- private List<NetworkPolicy> networkPolicies = new ArrayList<>();
- @JsonProperty("contrail-network-route-table-references")
- private List<RouteTableReference> contrailNetworkRouteTableReferences = new ArrayList<>();
- @JsonProperty("widget-model-id")
+ @JsonProperty("network-policies")
+ private List<NetworkPolicy> networkPolicies = new ArrayList<>();
+ @JsonProperty("contrail-network-route-table-references")
+ private List<RouteTableReference> contrailNetworkRouteTableReferences = new ArrayList<>();
+ @JsonProperty("widget-model-id")
private String widgetModelId;
- @JsonProperty("widget-model-version")
+ @JsonProperty("widget-model-version")
private String widgetModelVersion;
- @JsonProperty("physical-network-name")
+ @JsonProperty("physical-network-name")
private String physicalNetworkName;
- @JsonProperty("is-provider-network")
+ @JsonProperty("is-provider-network")
private Boolean isProviderNetwork;
- @JsonProperty("is-shared-network")
+ @JsonProperty("is-shared-network")
private Boolean isSharedNetwork;
- @JsonProperty("is-external-network")
+ @JsonProperty("is-external-network")
private Boolean isExternalNetwork;
- @JsonProperty("self-link")
+ @JsonProperty("self-link")
private String selflink;
- @JsonProperty("operational-status")
+ @JsonProperty("operational-status")
private String operationalStatus;
- @JsonProperty("subnets")
+ @JsonProperty("subnets")
private List<Subnet> subnets = new ArrayList<>();
- @JsonProperty("ctag-assignments")
+ @JsonProperty("ctag-assignments")
private List<CtagAssignment> ctagAssignments = new ArrayList<>();
- @JsonProperty("segmentation-assignments")
+ @JsonProperty("segmentation-assignments")
private List<SegmentationAssignment> segmentationAssignments = new ArrayList<>();
- @JsonProperty("model-info-network")
- private ModelInfoNetwork modelInfoNetwork;
- @JsonProperty("aggregate-routes")
+ @JsonProperty("model-info-network")
+ private ModelInfoNetwork modelInfoNetwork;
+ @JsonProperty("aggregate-routes")
private List<AggregateRoute> aggregateRoutes = new ArrayList<>();
- @JsonProperty("vpn-binding")
+ @JsonProperty("vpn-binding")
private List<VpnBinding> vpnBindings = new ArrayList<>();
- 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 isIsBoundToVpn() {
- 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<NetworkPolicy> getNetworkPolicies() {
- return networkPolicies;
- }
- public List<RouteTableReference> 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 isIsProviderNetwork() {
- return isProviderNetwork;
- }
- public void setIsProviderNetwork(Boolean isProviderNetwork) {
- this.isProviderNetwork = isProviderNetwork;
- }
- public Boolean isIsSharedNetwork() {
- return isSharedNetwork;
- }
- public void setIsSharedNetwork(Boolean isSharedNetwork) {
- this.isSharedNetwork = isSharedNetwork;
- }
- public Boolean isIsExternalNetwork() {
- 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<Subnet> getSubnets() {
- return subnets;
- }
- public List<CtagAssignment> getCtagAssignments() {
- return ctagAssignments;
- }
- public List<SegmentationAssignment> getSegmentationAssignments() {
- return segmentationAssignments;
- }
- public Boolean isCascaded() {
- return cascaded;
- }
- public void setIsCascaded(Boolean cascaded) {
- this.cascaded = cascaded;
- }
- public Map<String, String> getCloudParams() {
- return cloudParams;
- }
- public void setCloudParams(Map<String, String> cloudParams) {
- this.cloudParams = cloudParams;
- }
-
- public List<AggregateRoute> getAggregateRoutes(){
- return aggregateRoutes;
- }
-
- public List<VpnBinding> getVpnBindings(){
- return vpnBindings;
- }
-
- @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();
- }
+ 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 isIsBoundToVpn() {
+ 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<NetworkPolicy> getNetworkPolicies() {
+ return networkPolicies;
+ }
+
+ public List<RouteTableReference> 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 isIsProviderNetwork() {
+ return isProviderNetwork;
+ }
+
+ public void setIsProviderNetwork(Boolean isProviderNetwork) {
+ this.isProviderNetwork = isProviderNetwork;
+ }
+
+ public Boolean isIsSharedNetwork() {
+ return isSharedNetwork;
+ }
+
+ public void setIsSharedNetwork(Boolean isSharedNetwork) {
+ this.isSharedNetwork = isSharedNetwork;
+ }
+
+ public Boolean isIsExternalNetwork() {
+ 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<Subnet> getSubnets() {
+ return subnets;
+ }
+
+ public List<CtagAssignment> getCtagAssignments() {
+ return ctagAssignments;
+ }
+
+ public List<SegmentationAssignment> getSegmentationAssignments() {
+ return segmentationAssignments;
+ }
+
+ public Boolean isCascaded() {
+ return cascaded;
+ }
+
+ public void setIsCascaded(Boolean cascaded) {
+ this.cascaded = cascaded;
+ }
+
+ public Map<String, String> getCloudParams() {
+ return cloudParams;
+ }
+
+ public void setCloudParams(Map<String, String> cloudParams) {
+ this.cloudParams = cloudParams;
+ }
+
+ public List<AggregateRoute> getAggregateRoutes() {
+ return aggregateRoutes;
+ }
+
+ public List<VpnBinding> getVpnBindings() {
+ return vpnBindings;
+ }
+
+ @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
index f102c15062..387d191409 100644
--- 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
@@ -23,169 +23,201 @@ 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<LInterface>{
+public class LInterface implements Serializable, ShallowCopy<LInterface> {
- private static final long serialVersionUID = 5629921809747079453L;
+ private static final long serialVersionUID = 5629921809747079453L;
- @Id
- @JsonProperty("interface-name")
+ @Id
+ @JsonProperty("interface-name")
private String interfaceName;
- @JsonProperty("interface-role")
+ @JsonProperty("interface-role")
private String interfaceRole;
- @JsonProperty("v6-wan-link-ip")
+ @JsonProperty("v6-wan-link-ip")
private String v6WanLinkIp;
- @JsonProperty("self-link")
+ @JsonProperty("self-link")
private String selflink;
- @JsonProperty("interface-id")
+ @JsonProperty("interface-id")
private String interfaceId;
- @JsonProperty("macaddr")
+ @JsonProperty("macaddr")
private String macaddr;
- @JsonProperty("network-name")
+ @JsonProperty("network-name")
private String networkName;
- @JsonProperty("management-option")
+ @JsonProperty("management-option")
private String managementOption;
- @JsonProperty("interface-description")
+ @JsonProperty("interface-description")
private String interfaceDescription;
- @JsonProperty("is-port-mirrored")
+ @JsonProperty("is-port-mirrored")
private Boolean isPortMirrored;
- @JsonProperty("in-maint")
+ @JsonProperty("in-maint")
private Boolean inMaint;
- @JsonProperty("prov-status")
+ @JsonProperty("prov-status")
private String provStatus;
- @JsonProperty("is-ip-unnumbered")
+ @JsonProperty("is-ip-unnumbered")
private Boolean isIpUnnumbered;
- @JsonProperty("allowed-address-pairs")
+ @JsonProperty("allowed-address-pairs")
private String allowedAddressPairs;
- @JsonProperty("vlans")
+ @JsonProperty("vlans")
private List<Vlan> vlans = new ArrayList<Vlan>();
- @JsonProperty("sriov-vfs")
+ @JsonProperty("sriov-vfs")
private List<SriovVf> sriovVfs = new ArrayList<SriovVf>();
- @JsonProperty("l-interfaces")
+ @JsonProperty("l-interfaces")
private List<LInterface> lInterfaces = new ArrayList<LInterface>();
- @JsonProperty("l3-interface-ipv4-address-list")
+ @JsonProperty("l3-interface-ipv4-address-list")
private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<L3InterfaceIpv4AddressList>();
- @JsonProperty("l3-interface-ipv6-address-list")
+ @JsonProperty("l3-interface-ipv6-address-list")
private List<L3InterfaceIpv6AddressList> l3InterfaceIpv6AddressList = new ArrayList<L3InterfaceIpv6AddressList>();
- 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 isIsPortMirrored() {
- 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 isIsIpUnnumbered() {
- 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<Vlan> getVlans() {
- return vlans;
- }
- public List<SriovVf> getSriovVfs() {
- return sriovVfs;
- }
- public List<LInterface> getlInterfaces() {
- return lInterfaces;
- }
- public List<L3InterfaceIpv4AddressList> getL3InterfaceIpv4AddressList() {
- return l3InterfaceIpv4AddressList;
- }
- public List<L3InterfaceIpv6AddressList> 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();
- }
+ 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 isIsPortMirrored() {
+ 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 isIsIpUnnumbered() {
+ 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<Vlan> getVlans() {
+ return vlans;
+ }
+
+ public List<SriovVf> getSriovVfs() {
+ return sriovVfs;
+ }
+
+ public List<LInterface> getlInterfaces() {
+ return lInterfaces;
+ }
+
+ public List<L3InterfaceIpv4AddressList> getL3InterfaceIpv4AddressList() {
+ return l3InterfaceIpv4AddressList;
+ }
+
+ public List<L3InterfaceIpv6AddressList> 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
index f69f4628fa..8fbee5f399 100644
--- 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
@@ -23,101 +23,117 @@ 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<LagInterface>{
+public class LagInterface implements Serializable, ShallowCopy<LagInterface> {
- private static final long serialVersionUID = -7493461787172382640L;
+ private static final long serialVersionUID = -7493461787172382640L;
- @Id
- @JsonProperty("interface-name")
+ @Id
+ @JsonProperty("interface-name")
private String interfaceName;
- @JsonProperty("interface-description")
+ @JsonProperty("interface-description")
private String interfaceDescription;
- @JsonProperty("speed-value")
+ @JsonProperty("speed-value")
private String speedValue;
- @JsonProperty("speed-units")
+ @JsonProperty("speed-units")
private String speedUnits;
- @JsonProperty("interface-id")
+ @JsonProperty("interface-id")
private String interfaceId;
- @JsonProperty("interface-role")
+ @JsonProperty("interface-role")
private String interfaceRole;
- @JsonProperty("prov-status")
+ @JsonProperty("prov-status")
private String provStatus;
- @JsonProperty("in-maint")
+ @JsonProperty("in-maint")
private Boolean inMaint;
- @JsonProperty("l-interfaces")
+ @JsonProperty("l-interfaces")
private List<LInterface> 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<LInterface> 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();
- }
+ 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<LInterface> 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
index d2651e6055..1105572e3a 100644
--- 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
@@ -22,51 +22,48 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects;
import java.io.Serializable;
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("line-of-business")
public class LineOfBusiness implements Serializable, ShallowCopy<LineOfBusiness> {
- private static final long serialVersionUID = -7697815326894443926L;
+ private static final long serialVersionUID = -7697815326894443926L;
+
+ @Id
+ @JsonProperty("line-of-business-name")
+ private String lineOfBusinessName;
- @Id
- @JsonProperty("line-of-business-name")
- private String lineOfBusinessName;
+ public LineOfBusiness() {}
- public LineOfBusiness() {
- }
-
- public LineOfBusiness(String lineOfBusinessName) {
- this.lineOfBusinessName = lineOfBusinessName;
- }
+ public LineOfBusiness(String lineOfBusinessName) {
+ this.lineOfBusinessName = lineOfBusinessName;
+ }
- public String getLineOfBusinessName() {
- return lineOfBusinessName;
- }
+ public String getLineOfBusinessName() {
+ return lineOfBusinessName;
+ }
- public void setLineOfBusinessName(String lineOfBusinessName) {
- this.lineOfBusinessName = 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 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();
- }
+ @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
index 2e7d278901..46bc9eef8a 100644
--- 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
@@ -21,46 +21,49 @@
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<Metadatum>{
-
- private static final long serialVersionUID = -2259570072414712965L;
+public class Metadatum implements Serializable, ShallowCopy<Metadatum> {
+
+ 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();
+ }
- @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();
- }
+ @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
index a920a585cb..7b29e58393 100644
--- 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
@@ -21,71 +21,69 @@
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<NetworkPolicy>{
+public class NetworkPolicy implements Serializable, ShallowCopy<NetworkPolicy> {
+
+ 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;
+ }
- 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;
- }
+ 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 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();
- }
+ @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
index e28e41ed46..efba0d4959 100644
--- 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
@@ -21,9 +21,7 @@
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;
@@ -33,36 +31,41 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy;
@JsonRootName("owning-entity")
public class OwningEntity implements Serializable, ShallowCopy<OwningEntity> {
- private static final long serialVersionUID = -6565917570694869603L;
-
- @Id
- @JsonProperty("owning-entity-id")
- private String owningEntityId;
- @JsonProperty("owning-entity-name")
- private String owningEntityName;
+ 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();
+ }
- 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();
- }
+ @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
index 498d096e65..d0bf1f588b 100644
--- 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
@@ -24,60 +24,59 @@ 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<PServer> {
- private static final long serialVersionUID = 1378547515775540874L;
+ private static final long serialVersionUID = 1378547515775540874L;
- @Id
+ @Id
@JsonProperty("pserver-id")
- private String pserverId;
+ private String pserverId;
@JsonProperty("hostname")
- private String hostname;
+ private String hostname;
@JsonProperty("physical-links")
- private List<PhysicalLink> physicalLinks = new ArrayList<PhysicalLink>(); //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<PhysicalLink> 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();
- }
+ private List<PhysicalLink> physicalLinks = new ArrayList<PhysicalLink>(); // 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<PhysicalLink> 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
index 742a541352..c669ce497a 100644
--- 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
@@ -21,129 +21,126 @@
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<PhysicalLink> {
- private static final long serialVersionUID = -6378347998443741227L;
+ private static final long serialVersionUID = -6378347998443741227L;
- @Id
+ @Id
@JsonProperty("link-name")
- private String linkName;
+ private String linkName;
@JsonProperty("interface-name")
- private String interfaceName;
+ private String interfaceName;
@JsonProperty("service-provider-name")
- private String serviceProviderName;
+ private String serviceProviderName;
@JsonProperty("circuit-id")
- private String circuitId;
+ private String circuitId;
@JsonProperty("management-option")
- private String managementOption;
+ private String managementOption;
@JsonProperty("bandwidth-up")
- private Integer bandwidthUp;
+ private Integer bandwidthUp;
@JsonProperty("bandwidth-down")
- private Integer bandwidthDown;
+ private Integer bandwidthDown;
@JsonProperty("bandwidth-units")
- private String bandwidthUnits;
+ private String bandwidthUnits;
@JsonProperty("wan-port")
- private String wanPort;
+ private String wanPort;
- public String getLinkName(){
- return linkName;
- }
+ public String getLinkName() {
+ return linkName;
+ }
- public void setLinkName(String linkName){
- this.linkName = linkName;
- }
+ public void setLinkName(String linkName) {
+ this.linkName = linkName;
+ }
- public String getInterfaceName(){
- return interfaceName;
- }
+ public String getInterfaceName() {
+ return interfaceName;
+ }
- public void setInterfaceName(String interfaceName){
- this.interfaceName = interfaceName;
- }
+ public void setInterfaceName(String interfaceName) {
+ this.interfaceName = interfaceName;
+ }
- public String getServiceProviderName(){
- return serviceProviderName;
- }
+ public String getServiceProviderName() {
+ return serviceProviderName;
+ }
- public void setServiceProviderName(String serviceProviderName){
- this.serviceProviderName = serviceProviderName;
- }
+ public void setServiceProviderName(String serviceProviderName) {
+ this.serviceProviderName = serviceProviderName;
+ }
- public String getCircuitId(){
- return circuitId;
- }
+ public String getCircuitId() {
+ return circuitId;
+ }
- public void setCircuitId(String circuitId){
- this.circuitId = circuitId;
- }
+ public void setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ }
- public String getManagementOption(){
- return managementOption;
- }
+ public String getManagementOption() {
+ return managementOption;
+ }
- public void setManagementOption(String managementOption){
- this.managementOption = managementOption;
- }
+ public void setManagementOption(String managementOption) {
+ this.managementOption = managementOption;
+ }
- public Integer getBandwidthUp(){
- return bandwidthUp;
- }
+ public Integer getBandwidthUp() {
+ return bandwidthUp;
+ }
- public void setBandwidthUp(Integer bandwidthUp){
- this.bandwidthUp = bandwidthUp;
- }
+ public void setBandwidthUp(Integer bandwidthUp) {
+ this.bandwidthUp = bandwidthUp;
+ }
- public Integer getBandwidthDown(){
- return bandwidthDown;
- }
+ public Integer getBandwidthDown() {
+ return bandwidthDown;
+ }
- public void setBandwidthDown(Integer bandwidthDown){
- this.bandwidthDown = bandwidthDown;
- }
+ public void setBandwidthDown(Integer bandwidthDown) {
+ this.bandwidthDown = bandwidthDown;
+ }
- public String getBandwidthUnits(){
- return bandwidthUnits;
- }
+ public String getBandwidthUnits() {
+ return bandwidthUnits;
+ }
- public void setBandwidthUnits(String bandwidthUnits){
- this.bandwidthUnits = bandwidthUnits;
- }
+ public void setBandwidthUnits(String bandwidthUnits) {
+ this.bandwidthUnits = bandwidthUnits;
+ }
- public String getWanPort(){
- return wanPort;
- }
+ public String getWanPort() {
+ return wanPort;
+ }
- public void setWanPort(String wanPort){
- this.wanPort = 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 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();
- }
+ @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
index d13707deb4..08cf97bcf9 100644
--- 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
@@ -21,51 +21,48 @@
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<Platform> {
- private static final long serialVersionUID = -9127507763010448699L;
+ private static final long serialVersionUID = -9127507763010448699L;
+
+ @Id
+ @JsonProperty("platform-name")
+ private String platformName;
- @Id
- @JsonProperty("platform-name")
- private String platformName;
-
- public Platform() {
- }
+ public Platform() {}
- public Platform(String platformName) {
- this.platformName = platformName;
- }
+ public Platform(String platformName) {
+ this.platformName = platformName;
+ }
- public String getPlatformName() {
- return platformName;
- }
+ public String getPlatformName() {
+ return platformName;
+ }
- public void setPlatformName(String platformName) {
- this.platformName = 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 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();
- }
+ @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
index 2ec4108343..772c61e48b 100644
--- 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
@@ -21,13 +21,10 @@
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;
@@ -35,9 +32,9 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy;
@JsonRootName("pnf")
public class Pnf implements Serializable, ShallowCopy<Pnf> {
- private static final long serialVersionUID = -2544848120774529501L;
+ private static final long serialVersionUID = -2544848120774529501L;
- @Id
+ @Id
@JsonProperty("pnf-id")
private String pnfId;
@@ -47,70 +44,70 @@ public class Pnf implements Serializable, ShallowCopy<Pnf> {
@JsonProperty("role")
private String role;
- @JsonProperty("orchestration-status")
- private OrchestrationStatus orchestrationStatus;
+ @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();
- }
+ 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
index a815f6af1a..52636a678f 100644
--- 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
@@ -21,9 +21,7 @@
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;
@@ -33,31 +31,31 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy;
@JsonRootName("project")
public class Project implements Serializable, ShallowCopy<Project> {
- 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();
- }
+ 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
index 0d8c3201bc..a2f96e18ad 100644
--- 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
@@ -21,9 +21,7 @@
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;
@@ -31,44 +29,51 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy;
public class RouteTableReference implements Serializable, ShallowCopy<RouteTableReference> {
- 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();
- }
+ 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
index fc97306cfe..d58825c77f 100644
--- 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
@@ -21,9 +21,7 @@
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;
@@ -32,12 +30,12 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy;
@JsonRootName("route-target")
public class RouteTarget implements Serializable, ShallowCopy<RouteTarget> {
- private static final long serialVersionUID = -4635525992843470461L;
-
- @Id
- @JsonProperty("global-route-target")
+ private static final long serialVersionUID = -4635525992843470461L;
+
+ @Id
+ @JsonProperty("global-route-target")
protected String globalRouteTarget;
- @Id
+ @Id
@JsonProperty("route-target-role")
protected String routeTargetRole;
@JsonProperty("resource-version")
@@ -67,18 +65,18 @@ public class RouteTarget implements Serializable, ShallowCopy<RouteTarget> {
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 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();
- }
+ @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
index a299f1ef42..c8136b2ac9 100644
--- 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
@@ -21,40 +21,41 @@
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<SegmentationAssignment>{
+public class SegmentationAssignment implements Serializable, ShallowCopy<SegmentationAssignment> {
- private static final long serialVersionUID = 5751570091375657521L;
+ private static final long serialVersionUID = 5751570091375657521L;
- @Id
- @JsonProperty("segmentation-id")
+ @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();
- }
+ 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
index e2a8688395..6c3a0c43ed 100644
--- 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
@@ -23,15 +23,12 @@ 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;
@@ -40,175 +37,191 @@ import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionInfo;
@JsonRootName("service-instance")
public class ServiceInstance implements Serializable, ShallowCopy<ServiceInstance> {
- 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<GenericVnf> vnfs = new ArrayList<>();
- @JsonProperty("pnfs")
- private List<Pnf> pnfs = new ArrayList<>();
- @JsonProperty("allotted-resources")
- private List<AllottedResource> allottedResources = new ArrayList<>();
- @JsonProperty("networks")
- private List<L3Network> networks = new ArrayList<>();
- @JsonProperty("vpn-bonding-links")
- private List<VpnBondingLink> vpnBondingLinks = new ArrayList<>();
- @JsonProperty("vhn-portal-url")
+ 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<GenericVnf> vnfs = new ArrayList<>();
+ @JsonProperty("pnfs")
+ private List<Pnf> pnfs = new ArrayList<>();
+ @JsonProperty("allotted-resources")
+ private List<AllottedResource> allottedResources = new ArrayList<>();
+ @JsonProperty("networks")
+ private List<L3Network> networks = new ArrayList<>();
+ @JsonProperty("vpn-bonding-links")
+ private List<VpnBondingLink> vpnBondingLinks = new ArrayList<>();
+ @JsonProperty("vhn-portal-url")
private String vhnPortalUrl;
- @JsonProperty("service-instance-location-id")
+ @JsonProperty("service-instance-location-id")
private String serviceInstanceLocationId;
- @JsonProperty("selflink")
+ @JsonProperty("selflink")
private String selflink;
- @JsonProperty("metadata")
+ @JsonProperty("metadata")
private Metadata metadata;
- @JsonProperty("configurations")
- private List<Configuration> configurations = new ArrayList<>();
- @JsonProperty("solution-info")
- private SolutionInfo solutionInfo;
- @JsonProperty("model-info-service-instance")
- private ModelInfoServiceInstance modelInfoServiceInstance;
- @JsonProperty("instance-groups")
- private List<InstanceGroup> instanceGroups = new ArrayList<>();
-
- public List<GenericVnf> getVnfs() {
- return vnfs;
- }
- public List<AllottedResource> getAllottedResources() {
- return allottedResources;
- }
- public List<L3Network> getNetworks() {
- return networks;
- }
- public ModelInfoServiceInstance getModelInfoServiceInstance() {
- return modelInfoServiceInstance;
- }
- public void setModelInfoServiceInstance(ModelInfoServiceInstance modelInfoServiceInstance) {
- this.modelInfoServiceInstance = modelInfoServiceInstance;
- }
- public List<Configuration> getConfigurations() {
- return configurations;
- }
- public void setConfigurations(List<Configuration> 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<VpnBondingLink> getVpnBondingLinks() {
- return vpnBondingLinks;
- }
- public List<Pnf> getPnfs() {
- return pnfs;
- }
- public SolutionInfo getSolutionInfo() {
- return solutionInfo;
- }
- public void setSolutionInfo(SolutionInfo solutionInfo) {
- this.solutionInfo = solutionInfo;
- }
- public List<InstanceGroup> getInstanceGroups() {
- return instanceGroups;
- }
- public void setInstanceGroups(List<InstanceGroup> instanceGroups) {
- this.instanceGroups = instanceGroups;
- }
- @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();
- }
+ @JsonProperty("configurations")
+ private List<Configuration> configurations = new ArrayList<>();
+ @JsonProperty("solution-info")
+ private SolutionInfo solutionInfo;
+ @JsonProperty("model-info-service-instance")
+ private ModelInfoServiceInstance modelInfoServiceInstance;
+ @JsonProperty("instance-groups")
+ private List<InstanceGroup> instanceGroups = new ArrayList<>();
+
+ public List<GenericVnf> getVnfs() {
+ return vnfs;
+ }
+
+ public List<AllottedResource> getAllottedResources() {
+ return allottedResources;
+ }
+
+ public List<L3Network> getNetworks() {
+ return networks;
+ }
+
+ public ModelInfoServiceInstance getModelInfoServiceInstance() {
+ return modelInfoServiceInstance;
+ }
+
+ public void setModelInfoServiceInstance(ModelInfoServiceInstance modelInfoServiceInstance) {
+ this.modelInfoServiceInstance = modelInfoServiceInstance;
+ }
+
+ public List<Configuration> getConfigurations() {
+ return configurations;
+ }
+
+ public void setConfigurations(List<Configuration> 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<VpnBondingLink> getVpnBondingLinks() {
+ return vpnBondingLinks;
+ }
+
+ public List<Pnf> getPnfs() {
+ return pnfs;
+ }
+
+ public SolutionInfo getSolutionInfo() {
+ return solutionInfo;
+ }
+
+ public void setSolutionInfo(SolutionInfo solutionInfo) {
+ this.solutionInfo = solutionInfo;
+ }
+
+ public List<InstanceGroup> getInstanceGroups() {
+ return instanceGroups;
+ }
+
+ public void setInstanceGroups(List<InstanceGroup> instanceGroups) {
+ this.instanceGroups = instanceGroups;
+ }
+
+ @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
index fa076770d7..6d6444f69c 100644
--- 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
@@ -22,14 +22,11 @@ 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;
@@ -51,58 +48,56 @@ public class ServiceProxy extends SolutionCandidates implements Serializable, Sh
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();
- }
+ 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
index 56f95516b1..05199b7f37 100644
--- 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
@@ -23,54 +23,57 @@ 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<ServiceSubscription>{
+public class ServiceSubscription implements Serializable, ShallowCopy<ServiceSubscription> {
+
+ 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<ServiceInstance> serviceInstances = new ArrayList<ServiceInstance>();
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public String getTempUbSubAccountId() {
+ return tempUbSubAccountId;
+ }
- private static final long serialVersionUID = 9064449329296611436L;
+ public void setTempUbSubAccountId(String tempUbSubAccountId) {
+ this.tempUbSubAccountId = tempUbSubAccountId;
+ }
- @Id
- @JsonProperty("service-type")
- private String serviceType;
- @JsonProperty("temp-ub-sub-account-id")
- private String tempUbSubAccountId;
- @JsonProperty("service-instances")
- private List<ServiceInstance> serviceInstances = new ArrayList<ServiceInstance>();
+ public List<ServiceInstance> getServiceInstances() {
+ return serviceInstances;
+ }
- 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<ServiceInstance> 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 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();
- }
+ @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
index fcea22819e..71d55311f3 100644
--- 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
@@ -21,136 +21,161 @@
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<SriovVf>{
+public class SriovVf implements Serializable, ShallowCopy<SriovVf> {
- private static final long serialVersionUID = -7790331637399859914L;
+ private static final long serialVersionUID = -7790331637399859914L;
- @Id
- @JsonProperty("pci-id")
+ @Id
+ @JsonProperty("pci-id")
private String pciId;
- @JsonProperty("vf-vlan-filter")
+ @JsonProperty("vf-vlan-filter")
private String vfVlanFilter;
- @JsonProperty("vf-mac-filter")
+ @JsonProperty("vf-mac-filter")
private String vfMacFilter;
- @JsonProperty("vf-vlan-strip")
+ @JsonProperty("vf-vlan-strip")
private Boolean vfVlanStrip;
- @JsonProperty("vf-vlan-anti-spoof-check")
+ @JsonProperty("vf-vlan-anti-spoof-check")
private Boolean vfVlanAntiSpoofCheck;
- @JsonProperty("vf-mac-anti-spoof-check")
+ @JsonProperty("vf-mac-anti-spoof-check")
private Boolean vfMacAntiSpoofCheck;
- @JsonProperty("vf-mirrors")
+ @JsonProperty("vf-mirrors")
private String vfMirrors;
- @JsonProperty("vf-broadcast-allow")
+ @JsonProperty("vf-broadcast-allow")
private Boolean vfBroadcastAllow;
- @JsonProperty("vf-unknown-multicast-allow")
+ @JsonProperty("vf-unknown-multicast-allow")
private Boolean vfUnknownMulticastAllow;
- @JsonProperty("vf-unknown-unicast-allow")
+ @JsonProperty("vf-unknown-unicast-allow")
private Boolean vfUnknownUnicastAllow;
- @JsonProperty("vf-insert-stag")
+ @JsonProperty("vf-insert-stag")
private Boolean vfInsertStag;
- @JsonProperty("vf-link-status")
+ @JsonProperty("vf-link-status")
private String vfLinkStatus;
- @JsonProperty("neutron-network-id")
+ @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();
- }
+ 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
index 7277438102..8b01246067 100644
--- 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
@@ -23,151 +23,178 @@ 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<Subnet>{
+public class Subnet implements Serializable, ShallowCopy<Subnet> {
- private static final long serialVersionUID = -6789344717555598319L;
+ private static final long serialVersionUID = -6789344717555598319L;
- @Id
- @JsonProperty("subnet-id")
+ @Id
+ @JsonProperty("subnet-id")
private String subnetId;
- @JsonProperty("subnet-name")
+ @JsonProperty("subnet-name")
private String subnetName;
- @JsonProperty("neutron-subnet-id")
+ @JsonProperty("neutron-subnet-id")
private String neutronSubnetId;
- @JsonProperty("gateway-address")
+ @JsonProperty("gateway-address")
private String gatewayAddress;
- @JsonProperty("network-start-address")
+ @JsonProperty("network-start-address")
private String networkStartAddress;
- @JsonProperty("cidr-mask")
+ @JsonProperty("cidr-mask")
private String cidrMask;
- @JsonProperty("ip-version")
+ @JsonProperty("ip-version")
private String ipVersion;
- @JsonProperty("orchestration-status")
+ @JsonProperty("orchestration-status")
private OrchestrationStatus orchestrationStatus;
- @JsonProperty("dhcp-enabled")
+ @JsonProperty("dhcp-enabled")
private Boolean dhcpEnabled;
- @JsonProperty("dhcp-start")
+ @JsonProperty("dhcp-start")
private String dhcpStart;
- @JsonProperty("dhcp-end")
+ @JsonProperty("dhcp-end")
private String dhcpEnd;
- @JsonProperty("subnet-role")
+ @JsonProperty("subnet-role")
private String subnetRole;
- @JsonProperty("ip-assignment-direction")
+ @JsonProperty("ip-assignment-direction")
private String ipAssignmentDirection;
- @JsonProperty("subnet-sequence")
+ @JsonProperty("subnet-sequence")
private Integer subnetSequence;
- @JsonProperty("host-routes")
+ @JsonProperty("host-routes")
private List<HostRoute> 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<HostRoute> 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();
- }
+ 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<HostRoute> 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/Tenant.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java
index d3f3dcd359..c5cc1b7dbd 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java
@@ -21,58 +21,62 @@
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 com.fasterxml.jackson.annotation.JsonProperty;
public class Tenant implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = -8704478668505531590L;
- @Id
- @JsonProperty("tenant-id")
- private String tenantId;
- @JsonProperty("tenant-name")
- private String tenantName;
- @JsonProperty("tenant-context")
- private String tenantContext;
-
- @Override
- public boolean equals(final Object other) {
- if (!(other instanceof Tenant)) {
- return false;
- }
- Tenant castOther = (Tenant) other;
- return new EqualsBuilder().append(tenantId, castOther.tenantId).isEquals();
- }
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(tenantId).toHashCode();
- }
- public String getTenantId() {
- return tenantId;
- }
- public void setTenantId(String tenantId) {
- this.tenantId = tenantId;
- }
- public String getTenantName() {
- return tenantName;
- }
- public void setTenantName(String tenantName) {
- this.tenantName = tenantName;
- }
- public String getTenantContext() {
- return tenantContext;
- }
- public void setTenantContext(String tenantContext) {
- this.tenantContext = tenantContext;
- }
+ /**
+ *
+ */
+ private static final long serialVersionUID = -8704478668505531590L;
+ @Id
+ @JsonProperty("tenant-id")
+ private String tenantId;
+ @JsonProperty("tenant-name")
+ private String tenantName;
+ @JsonProperty("tenant-context")
+ private String tenantContext;
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof Tenant)) {
+ return false;
+ }
+ Tenant castOther = (Tenant) other;
+ return new EqualsBuilder().append(tenantId, castOther.tenantId).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(tenantId).toHashCode();
+ }
+
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ public void setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ }
+
+ public String getTenantName() {
+ return tenantName;
+ }
+
+ public void setTenantName(String tenantName) {
+ this.tenantName = tenantName;
+ }
+
+ public String getTenantContext() {
+ return tenantContext;
+ }
+
+ public void setTenantContext(String tenantContext) {
+ this.tenantContext = tenantContext;
+ }
+
-
}
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
index ceca929806..ec6253be70 100644
--- 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
@@ -25,120 +25,139 @@ 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.ModelInfoVfModule;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("vf-module")
public class VfModule implements Serializable, ShallowCopy<VfModule> {
-
- 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<String, String> cloudParams = new HashMap<>();
- @JsonProperty("cascaded")
- private Boolean cascaded;
- @JsonProperty("heat-stack-id")
+
+ 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<String, String> cloudParams = new HashMap<>();
+ @JsonProperty("cascaded")
+ private Boolean cascaded;
+ @JsonProperty("heat-stack-id")
private String heatStackId;
- @JsonProperty("contrail-service-instance-fqdn")
+ @JsonProperty("contrail-service-instance-fqdn")
private String contrailServiceInstanceFqdn;
- @JsonProperty("module-index")
+ @JsonProperty("module-index")
private Integer moduleIndex;
- @JsonProperty("selflink")
+ @JsonProperty("selflink")
private String selflink;
- @JsonProperty("vnfcs")
- private List<Vnfc> vnfcs = new ArrayList<>();
- @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<String, String> getCloudParams() {
- return cloudParams;
- }
- public void setCloudParams(Map<String, String> cloudParams) {
- this.cloudParams = cloudParams;
- }
- public Boolean isCascaded() {
- return cascaded;
- }
- public void setCascaded(boolean cascaded) {
- this.cascaded = cascaded;
- }
- public List<Vnfc> getVnfcs() {
- return vnfcs;
- }
- @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();
- }
+ @JsonProperty("vnfcs")
+ private List<Vnfc> vnfcs = new ArrayList<>();
+ @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<String, String> getCloudParams() {
+ return cloudParams;
+ }
+
+ public void setCloudParams(Map<String, String> cloudParams) {
+ this.cloudParams = cloudParams;
+ }
+
+ public Boolean isCascaded() {
+ return cascaded;
+ }
+
+ public void setCascaded(boolean cascaded) {
+ this.cascaded = cascaded;
+ }
+
+ public List<Vnfc> getVnfcs() {
+ return vnfcs;
+ }
+
+ @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
index a0788d4b0d..6951a23630 100644
--- 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
@@ -23,140 +23,164 @@ 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<Vlan>{
+public class Vlan implements Serializable, ShallowCopy<Vlan> {
- private static final long serialVersionUID = 1260512753640402946L;
+ private static final long serialVersionUID = 1260512753640402946L;
- @Id
- @JsonProperty("vlan-interface")
+ @Id
+ @JsonProperty("vlan-interface")
private String vlanInterface;
- @JsonProperty("vlan-id-inner")
+ @JsonProperty("vlan-id-inner")
private Long vlanIdInner;
- @JsonProperty("vlan-id-outer")
+ @JsonProperty("vlan-id-outer")
private Long vlanIdOuter;
- @JsonProperty("speed-value")
+ @JsonProperty("speed-value")
private String speedValue;
- @JsonProperty("speed-units")
+ @JsonProperty("speed-units")
private String speedUnits;
- @JsonProperty("vlan-description")
+ @JsonProperty("vlan-description")
private String vlanDescription;
- @JsonProperty("backdoor-connection")
+ @JsonProperty("backdoor-connection")
private String backdoorConnection;
- @JsonProperty("vpn-key")
+ @JsonProperty("vpn-key")
private String vpnKey;
- @JsonProperty("orchestration-status")
+ @JsonProperty("orchestration-status")
private OrchestrationStatus orchestrationStatus;
- @JsonProperty("in-maint")
+ @JsonProperty("in-maint")
private Boolean inMaint;
- @JsonProperty("prov-status")
+ @JsonProperty("prov-status")
private String provStatus;
- @JsonProperty("is-ip-unnumbered")
+ @JsonProperty("is-ip-unnumbered")
private Boolean isIpUnnumbered;
- @JsonProperty("l3-interface-ipv4-address-list")
+ @JsonProperty("l3-interface-ipv4-address-list")
private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<L3InterfaceIpv4AddressList>();
- @JsonProperty("l3-interface-ipv6-address-list")
+ @JsonProperty("l3-interface-ipv6-address-list")
private List<L3InterfaceIpv6AddressList> l3InterfaceIpv6AddressList = new ArrayList<L3InterfaceIpv6AddressList>();
- 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 isIsIpUnnumbered() {
- return isIpUnnumbered;
- }
- public void setIpUnnumbered(Boolean isIpUnnumbered) {
- this.isIpUnnumbered = isIpUnnumbered;
- }
- public List<L3InterfaceIpv4AddressList> getL3InterfaceIpv4AddressList() {
- return l3InterfaceIpv4AddressList;
- }
- public List<L3InterfaceIpv6AddressList> 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();
- }
+ 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 isIsIpUnnumbered() {
+ return isIpUnnumbered;
+ }
+
+ public void setIpUnnumbered(Boolean isIpUnnumbered) {
+ this.isIpUnnumbered = isIpUnnumbered;
+ }
+
+ public List<L3InterfaceIpv4AddressList> getL3InterfaceIpv4AddressList() {
+ return l3InterfaceIpv4AddressList;
+ }
+
+ public List<L3InterfaceIpv6AddressList> 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/Vnfc.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java
index b432fe10b7..087edff7c0 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java
@@ -1,131 +1,153 @@
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 com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("vnfc")
public class Vnfc implements Serializable {
-
-
- /**
- *
- */
- private static final long serialVersionUID = -9170269565756850796L;
- @Id
- @JsonProperty("vnfc-name")
- private String vnfcName;
- @JsonProperty("nfc-naming-code")
- private String nfcNamingCode;
- @JsonProperty("nfc-function")
- private String nfcFunction;
- @JsonProperty("prov-status")
- private String provStatus;
- @JsonProperty("orchestration-status")
- private String orchestrationStatus;
- @JsonProperty("ipaddress-v4-oam-vip")
- private String ipaddressV4OamVip;
- @JsonProperty("in-maint")
- private String inMaint;
- @JsonProperty("is-closed-loop-disabled")
- private String isClosedLoopDisabled;
- @JsonProperty("group-notation")
- private String groupNotation;
- @JsonProperty("model-invariant-id")
- private String modelInvariantId;
- @JsonProperty("model-version-id")
- private String modelVersionId;
- @JsonProperty("model-customization-id")
- private String modelCustomizationId;
-
- @Override
- public boolean equals(final Object other) {
- if (!(other instanceof Vnfc)) {
- return false;
- }
- Vnfc castOther = (Vnfc) other;
- return new EqualsBuilder().append(vnfcName, castOther.vnfcName).isEquals();
- }
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(vnfcName).toHashCode();
- }
- public String getVnfcName() {
- return vnfcName;
- }
- public void setVnfcName(String vnfcName) {
- this.vnfcName = vnfcName;
- }
- public String getNfcNamingCode() {
- return nfcNamingCode;
- }
- public void setNfcNamingCode(String nfcNamingCode) {
- this.nfcNamingCode = nfcNamingCode;
- }
- public String getNfcFunction() {
- return nfcFunction;
- }
- public void setNfcFunction(String nfcFunction) {
- this.nfcFunction = nfcFunction;
- }
- public String getProvStatus() {
- return provStatus;
- }
- public void setProvStatus(String provStatus) {
- this.provStatus = provStatus;
- }
- public String getOrchestrationStatus() {
- return orchestrationStatus;
- }
- public void setOrchestrationStatus(String orchestrationStatus) {
- this.orchestrationStatus = orchestrationStatus;
- }
- public String getIpaddressV4OamVip() {
- return ipaddressV4OamVip;
- }
- public void setIpaddressV4OamVip(String ipaddressV4OamVip) {
- this.ipaddressV4OamVip = ipaddressV4OamVip;
- }
- public String getInMaint() {
- return inMaint;
- }
- public void setInMaint(String inMaint) {
- this.inMaint = inMaint;
- }
- public String getIsClosedLoopDisabled() {
- return isClosedLoopDisabled;
- }
- public void setIsClosedLoopDisabled(String isClosedLoopDisabled) {
- this.isClosedLoopDisabled = isClosedLoopDisabled;
- }
- public String getGroupNotation() {
- return groupNotation;
- }
- public void setGroupNotation(String groupNotation) {
- this.groupNotation = groupNotation;
- }
- 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;
- }
+
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -9170269565756850796L;
+ @Id
+ @JsonProperty("vnfc-name")
+ private String vnfcName;
+ @JsonProperty("nfc-naming-code")
+ private String nfcNamingCode;
+ @JsonProperty("nfc-function")
+ private String nfcFunction;
+ @JsonProperty("prov-status")
+ private String provStatus;
+ @JsonProperty("orchestration-status")
+ private String orchestrationStatus;
+ @JsonProperty("ipaddress-v4-oam-vip")
+ private String ipaddressV4OamVip;
+ @JsonProperty("in-maint")
+ private String inMaint;
+ @JsonProperty("is-closed-loop-disabled")
+ private String isClosedLoopDisabled;
+ @JsonProperty("group-notation")
+ private String groupNotation;
+ @JsonProperty("model-invariant-id")
+ private String modelInvariantId;
+ @JsonProperty("model-version-id")
+ private String modelVersionId;
+ @JsonProperty("model-customization-id")
+ private String modelCustomizationId;
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof Vnfc)) {
+ return false;
+ }
+ Vnfc castOther = (Vnfc) other;
+ return new EqualsBuilder().append(vnfcName, castOther.vnfcName).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(vnfcName).toHashCode();
+ }
+
+ public String getVnfcName() {
+ return vnfcName;
+ }
+
+ public void setVnfcName(String vnfcName) {
+ this.vnfcName = vnfcName;
+ }
+
+ public String getNfcNamingCode() {
+ return nfcNamingCode;
+ }
+
+ public void setNfcNamingCode(String nfcNamingCode) {
+ this.nfcNamingCode = nfcNamingCode;
+ }
+
+ public String getNfcFunction() {
+ return nfcFunction;
+ }
+
+ public void setNfcFunction(String nfcFunction) {
+ this.nfcFunction = nfcFunction;
+ }
+
+ public String getProvStatus() {
+ return provStatus;
+ }
+
+ public void setProvStatus(String provStatus) {
+ this.provStatus = provStatus;
+ }
+
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+
+ public String getIpaddressV4OamVip() {
+ return ipaddressV4OamVip;
+ }
+
+ public void setIpaddressV4OamVip(String ipaddressV4OamVip) {
+ this.ipaddressV4OamVip = ipaddressV4OamVip;
+ }
+
+ public String getInMaint() {
+ return inMaint;
+ }
+
+ public void setInMaint(String inMaint) {
+ this.inMaint = inMaint;
+ }
+
+ public String getIsClosedLoopDisabled() {
+ return isClosedLoopDisabled;
+ }
+
+ public void setIsClosedLoopDisabled(String isClosedLoopDisabled) {
+ this.isClosedLoopDisabled = isClosedLoopDisabled;
+ }
+
+ public String getGroupNotation() {
+ return groupNotation;
+ }
+
+ public void setGroupNotation(String groupNotation) {
+ this.groupNotation = groupNotation;
+ }
+
+ 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/bbobjects/VolumeGroup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java
index 99a643a129..82afe5fcfe 100644
--- 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
@@ -23,14 +23,11 @@ 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;
@@ -38,84 +35,101 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy;
@JsonRootName("volume-group")
public class VolumeGroup implements Serializable, ShallowCopy<VolumeGroup> {
- 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<String, String> 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<String, String> getCloudParams() {
- return cloudParams;
- }
- public void setCloudParams(Map<String, String> 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();
- }
+ 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<String, String> 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<String, String> getCloudParams() {
+ return cloudParams;
+ }
+
+ public void setCloudParams(Map<String, String> 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
index 36e1af443c..6ae44dc676 100644
--- 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
@@ -23,9 +23,7 @@ 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;
@@ -35,10 +33,10 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy;
@JsonRootName("vpn-binding")
public class VpnBinding implements Serializable, ShallowCopy<VpnBinding> {
- private static final long serialVersionUID = 3283413795353486924L;
+ private static final long serialVersionUID = 3283413795353486924L;
- @Id
- @JsonProperty("vpn-id")
+ @Id
+ @JsonProperty("vpn-id")
private String vpnId;
@JsonProperty("vpn-name")
private String vpnName;
@@ -125,17 +123,17 @@ public class VpnBinding implements Serializable, ShallowCopy<VpnBinding> {
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 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();
- }
+ @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
index dec3d48203..4ee8213e59 100644
--- 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
@@ -22,15 +22,11 @@ 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;
@@ -58,109 +54,110 @@ public class VpnBondingLink implements Serializable, ShallowCopy<VpnBondingLink>
this.vpnBondingLinkId = vpnBondingLinkId;
}
- public List<Configuration> getConfigurations() {
- return configurations;
- }
-
- public List<ServiceProxy> 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 List<Configuration> getConfigurations() {
+ return configurations;
+ }
+
+ public List<ServiceProxy> 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;
- }
- }
+ 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
+ // TODO temp solution until references are updatedd
public void setVnrConfiguration(Configuration vnrConfiguration) {
- if(vnrConfiguration.getConfigurationType() == null){
- vnrConfiguration.setConfigurationType("vlan");
- }
- configurations.add(vnrConfiguration);
+ if (vnrConfiguration.getConfigurationType() == null) {
+ vnrConfiguration.setConfigurationType("vlan");
+ }
+ configurations.add(vnrConfiguration);
}
- //TODO temp solution until references are updated to use getConfigurationByType
+ // 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
+ 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);
+ if (vrfConfiguration.getConfigurationType() == null) {
+ vrfConfiguration.setConfigurationType("vrf");
+ }
+ configurations.add(vrfConfiguration);
}
- //TODO temp solution until references are updated to use getServiceProxyByType
+ // 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;
- }
- }
+ ServiceProxy serviceProxy = null;
+ for (ServiceProxy sp : serviceProxies) {
+ if (sp.getType().equals("infrastructure")) {
+ serviceProxy = sp;
+ }
+ }
return serviceProxy;
}
- //TODO temp solution until references are updated
+ // TODO temp solution until references are updated
public void setInfrastructureServiceProxy(ServiceProxy infrastructureServiceProxy) {
- infrastructureServiceProxy.setType("infrastructure");
- serviceProxies.add(infrastructureServiceProxy);
+ infrastructureServiceProxy.setType("infrastructure");
+ serviceProxies.add(infrastructureServiceProxy);
}
- //TODO temp solution until references are updated to use getServiceProxyByType
+ // 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;
+ 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
+ // TODO temp solution until references are updated
public void setTransportServiceProxy(ServiceProxy transportServiceProxy) {
- transportServiceProxy.setType("transport");
- serviceProxies.add(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 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();
- }
+ @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
index 7b11e9f68e..1f689e97e3 100644
--- 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
@@ -21,54 +21,62 @@
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;
- @JsonProperty("virtual-link-key")
- private String virtualLinkKey;
+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;
+ @JsonProperty("virtual-link-key")
+ private String virtualLinkKey;
+
+ 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;
+ }
+
+ public String getVirtualLinkKey() {
+ return virtualLinkKey;
+ }
- 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;
- }
- public String getVirtualLinkKey() {
- return virtualLinkKey;
- }
- public void setVirtualLinkKey(String virtualLinkKey) {
- this.virtualLinkKey = virtualLinkKey;
- }
+ public void setVirtualLinkKey(String virtualLinkKey) {
+ this.virtualLinkKey = virtualLinkKey;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java
index 00903ab782..40e0dd9654 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java
@@ -22,41 +22,48 @@ package org.onap.so.bpmn.servicedecomposition.entities;
import java.io.Serializable;
-public class ConfigurationResourceKeys implements Serializable{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private String vfModuleCustomizationUUID;
- private String vnfResourceCustomizationUUID;
- private String cvnfcCustomizationUUID;
- private String vnfcName;
-
- public String getVfModuleCustomizationUUID() {
- return vfModuleCustomizationUUID;
- }
- public void setVfModuleCustomizationUUID(String vfModuleCustomizationUUID) {
- this.vfModuleCustomizationUUID = vfModuleCustomizationUUID;
- }
- public String getVnfResourceCustomizationUUID() {
- return vnfResourceCustomizationUUID;
- }
- public void setVnfResourceCustomizationUUID(String vnfResourceCustomizationUUID) {
- this.vnfResourceCustomizationUUID = vnfResourceCustomizationUUID;
- }
- public String getCvnfcCustomizationUUID() {
- return cvnfcCustomizationUUID;
- }
- public void setCvnfcCustomizationUUID(String cvnfcCustomizationUUID) {
- this.cvnfcCustomizationUUID = cvnfcCustomizationUUID;
- }
- public String getVnfcName() {
- return vnfcName;
- }
- public void setVnfcName(String vnfcName) {
- this.vnfcName = vnfcName;
- }
-
-
+public class ConfigurationResourceKeys implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private String vfModuleCustomizationUUID;
+ private String vnfResourceCustomizationUUID;
+ private String cvnfcCustomizationUUID;
+ private String vnfcName;
+
+ public String getVfModuleCustomizationUUID() {
+ return vfModuleCustomizationUUID;
+ }
+
+ public void setVfModuleCustomizationUUID(String vfModuleCustomizationUUID) {
+ this.vfModuleCustomizationUUID = vfModuleCustomizationUUID;
+ }
+
+ public String getVnfResourceCustomizationUUID() {
+ return vnfResourceCustomizationUUID;
+ }
+
+ public void setVnfResourceCustomizationUUID(String vnfResourceCustomizationUUID) {
+ this.vnfResourceCustomizationUUID = vnfResourceCustomizationUUID;
+ }
+
+ public String getCvnfcCustomizationUUID() {
+ return cvnfcCustomizationUUID;
+ }
+
+ public void setCvnfcCustomizationUUID(String cvnfcCustomizationUUID) {
+ this.cvnfcCustomizationUUID = cvnfcCustomizationUUID;
+ }
+
+ public String getVnfcName() {
+ return vnfcName;
+ }
+
+ public void setVnfcName(String vnfcName) {
+ this.vnfcName = vnfcName;
+ }
+
+
}
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
index be73b37f85..af9eb525aa 100644
--- 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
@@ -21,90 +21,110 @@
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;
- private ConfigurationResourceKeys configurationResourceKeys;
-
- 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;
- }
- public ConfigurationResourceKeys getConfigurationResourceKeys() {
- return configurationResourceKeys;
- }
- public void setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) {
- this.configurationResourceKeys = configurationResourceKeys;
- }
+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;
+ private ConfigurationResourceKeys configurationResourceKeys;
+
+ 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;
+ }
+
+ public ConfigurationResourceKeys getConfigurationResourceKeys() {
+ return configurationResourceKeys;
+ }
+
+ public void setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) {
+ this.configurationResourceKeys = configurationResourceKeys;
+ }
}
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
index 6d3be0f822..870c740c1f 100644
--- 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
@@ -22,7 +22,6 @@ 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;
@@ -31,74 +30,76 @@ 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 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 static final long serialVersionUID = -429247436428110843L;
+ private RequestContext requestContext;
+ private OrchestrationContext orchContext;
+ private Map<String, String> userInput;
+ private CloudRegion cloudRegion;
+ private Tenant tenant;
- private RequestContext requestContext;
- private OrchestrationContext orchContext;
- private Map<String, String> userInput;
- private CloudRegion cloudRegion;
- private Tenant tenant;
+ private Customer customer;
+ private ServiceInstance serviceInstance;
- private Customer customer;
- private ServiceInstance serviceInstance;
-
- public Tenant getTenant() {
- return tenant;
- }
+ public Tenant getTenant() {
+ return tenant;
+ }
- public void setTenant(Tenant tenant) {
- this.tenant = tenant;
- }
+ public void setTenant(Tenant tenant) {
+ this.tenant = tenant;
+ }
- public CloudRegion getCloudRegion() {
- return cloudRegion;
- }
+ public CloudRegion getCloudRegion() {
+ return cloudRegion;
+ }
- public void setCloudRegion(CloudRegion cloudRegion) {
- this.cloudRegion = cloudRegion;
- }
+ public void setCloudRegion(CloudRegion cloudRegion) {
+ this.cloudRegion = cloudRegion;
+ }
- public RequestContext getRequestContext() {
- return requestContext;
- }
+ public RequestContext getRequestContext() {
+ return requestContext;
+ }
- public void setRequestContext(RequestContext requestContext) {
- this.requestContext = requestContext;
- }
+ public void setRequestContext(RequestContext requestContext) {
+ this.requestContext = requestContext;
+ }
- public OrchestrationContext getOrchContext() {
- return orchContext;
- }
+ public OrchestrationContext getOrchContext() {
+ return orchContext;
+ }
- public void setOrchContext(OrchestrationContext orchContext) {
- this.orchContext = orchContext;
- }
+ public void setOrchContext(OrchestrationContext orchContext) {
+ this.orchContext = orchContext;
+ }
- public Map<String, String> getUserInput() {
- return userInput;
- }
+ public Map<String, String> getUserInput() {
+ return userInput;
+ }
- public void setUserInput(Map<String, String> userInput) {
- this.userInput = userInput;
- }
+ public void setUserInput(Map<String, String> userInput) {
+ this.userInput = userInput;
+ }
- public Customer getCustomer() {
- return customer;
- }
+ public Customer getCustomer() {
+ return customer;
+ }
- public void setCustomer(Customer customer) {
- this.customer = customer;
- }
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
- public ServiceInstance getServiceInstance() {
- return serviceInstance;
- }
+ public ServiceInstance getServiceInstance() {
+ return serviceInstance;
+ }
- public void setServiceInstance(ServiceInstance serviceInstance) {
- this.serviceInstance = 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
index 9709ccece0..9e95e79b70 100644
--- 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
@@ -21,15 +21,5 @@
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,
- INSTANCE_GROUP_ID;
+ 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, INSTANCE_GROUP_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
index 15dfe85c1a..dc07d13acb 100644
--- 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
@@ -25,88 +25,88 @@ 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;
- private String instanceGroupId;
-
- @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;
- }
-
- public String getInstanceGroupId() {
- return instanceGroupId;
- }
-
- public void setInstanceGroupId(String instanceGroupId) {
- this.instanceGroupId = instanceGroupId;
- }
+ /**
+ *
+ */
+ 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;
+ private String instanceGroupId;
+
+ @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;
+ }
+
+ public String getInstanceGroupId() {
+ return instanceGroupId;
+ }
+
+ public void setInstanceGroupId(String instanceGroupId) {
+ this.instanceGroupId = instanceGroupId;
+ }
}
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
index 21828871db..50e43d247c 100644
--- 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
@@ -21,8 +21,8 @@
package org.onap.so.bpmn.servicedecomposition.entities.exceptions;
public class InvalidBuildingBlockInputException extends Exception {
- private static final long serialVersionUID = 221404474263656742L;
-
+ private static final long serialVersionUID = 221404474263656742L;
+
public InvalidBuildingBlockInputException() {
super();
}
@@ -39,9 +39,8 @@ public class InvalidBuildingBlockInputException extends Exception {
super(cause);
}
- protected InvalidBuildingBlockInputException(String message, Throwable cause,
- boolean enableSuppression,
- boolean writableStackTrace) {
+ 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
index e1a12bbad9..c9f7e5e948 100644
--- 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
@@ -23,7 +23,6 @@ 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;
@@ -32,25 +31,28 @@ 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<String> entitlementPoolUuids = new ArrayList<String>();
- @JsonProperty("license-key-group-uuids")
- private List<String> licenseKeyGroupUuids = new ArrayList<String>();
-
-
- public List<String> getEntitlementPoolUuids() {
- return entitlementPoolUuids;
- }
- public void setEntitlementPoolUuids(List<String> entitlementPoolUuids) {
- this.entitlementPoolUuids = entitlementPoolUuids;
- }
- public List<String> getLicenseKeyGroupUuids() {
- return licenseKeyGroupUuids;
- }
- public void setLicenseKeyGroupUuids(List<String> licenseKeyGroupUuids) {
- this.licenseKeyGroupUuids = licenseKeyGroupUuids;
- }
+ private static final long serialVersionUID = 2345786874755685318L;
+
+ @JsonProperty("entitlement-pool-uuids")
+ private List<String> entitlementPoolUuids = new ArrayList<String>();
+ @JsonProperty("license-key-group-uuids")
+ private List<String> licenseKeyGroupUuids = new ArrayList<String>();
+
+
+ public List<String> getEntitlementPoolUuids() {
+ return entitlementPoolUuids;
+ }
+
+ public void setEntitlementPoolUuids(List<String> entitlementPoolUuids) {
+ this.entitlementPoolUuids = entitlementPoolUuids;
+ }
+
+ public List<String> getLicenseKeyGroupUuids() {
+ return licenseKeyGroupUuids;
+ }
+
+ public void setLicenseKeyGroupUuids(List<String> 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
index 8f1262f70e..a98cdc712d 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -29,16 +28,16 @@ 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;
+ private static final long serialVersionUID = 6843015923244810369L;
+
+ @JsonProperty("is-rollback-enabled")
+ private Boolean isRollbackEnabled;
- public Boolean getIsRollbackEnabled() {
- return this.isRollbackEnabled;
- }
+ public Boolean getIsRollbackEnabled() {
+ return this.isRollbackEnabled;
+ }
- public void setIsRollbackEnabled(Boolean isRollbackEnabled) {
- this.isRollbackEnabled = 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
index cd66e512a5..632e61b85c 100644
--- 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
@@ -25,102 +25,122 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
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 Map<String, Object> userParams = new HashMap<>();
- @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;
- @JsonProperty("configurationParameters")
- private List<Map<String, String>> configurationParameters = new ArrayList<>();
-
- 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 Map<String, Object> getUserParams() {
- return userParams;
- }
- public void setUserParams(Map<String, Object> 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;
- }
- public List<Map<String, String>> getConfigurationParameters() {
- return configurationParameters;
- }
- public void setConfigurationParameters(List<Map<String, String>> configurationParameters) {
- this.configurationParameters = configurationParameters;
- }
+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 Map<String, Object> userParams = new HashMap<>();
+ @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;
+ @JsonProperty("configurationParameters")
+ private List<Map<String, String>> configurationParameters = new ArrayList<>();
+
+ 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 Map<String, Object> getUserParams() {
+ return userParams;
+ }
+
+ public void setUserParams(Map<String, Object> 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;
+ }
+
+ public List<Map<String, String>> getConfigurationParameters() {
+ return configurationParameters;
+ }
+
+ public void setConfigurationParameters(List<Map<String, String>> configurationParameters) {
+ this.configurationParameters = configurationParameters;
+ }
}
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
index 3761d26d0b..ca3f73a176 100644
--- 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
@@ -26,7 +26,6 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -40,99 +39,101 @@ import org.slf4j.LoggerFactory;
@JsonInclude(Include.NON_DEFAULT)
public class RequestParameters implements Serializable {
- private static final Logger logger = LoggerFactory.getLogger(RequestParameters.class);
-
- private static final long serialVersionUID = -5979049912538894930L;
- @JsonProperty("subscriptionServiceType")
- private String subscriptionServiceType;
- @JsonProperty("userParams")
- private List<Map<String, Object>> userParams = new ArrayList<>();
- @JsonProperty("aLaCarte")
- private Boolean aLaCarte;
- @JsonProperty("payload")
- private String payload;
- @JsonProperty("usePreload")
- private Boolean usePreload;
-
- 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 String getPayload(){
- return payload;
- }
- public void setPayload(String value){
- this.payload = value;
- }
-
- public List<Map<String, Object>> getUserParams() {
- return userParams;
- }
-
- public void setUserParams(List<Map<String, Object>> userParams) {
- this.userParams = userParams;
- }
-
- public Object getUserParamValue(String name) {
- if (userParams != null) {
- for (Map<String, Object> param : userParams) {
- if (param.get(name) != null) {
- return param.get(name);
- }
- }
- }
- return null;
- }
-
- public Boolean isUsePreload() {
- return usePreload;
- }
-
- @JsonProperty("usePreload")
- public Boolean getUsePreload() {
- return usePreload;
- }
-
- @JsonProperty("usePreload")
- public void setUsePreload(Boolean usePreload) {
- this.usePreload = usePreload;
- }
-
-
- @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){
- logger.error("Unable to convert Sniro Manager Request to string", e);
- }
- return json;
- }
-
- @Override
- public String toString() {
- return "RequestParameters [subscriptionServiceType="
- + subscriptionServiceType + ", userParams=" + userParams
- + ", aLaCarte=" + aLaCarte + "]";
- }
+ private static final Logger logger = LoggerFactory.getLogger(RequestParameters.class);
+
+ private static final long serialVersionUID = -5979049912538894930L;
+ @JsonProperty("subscriptionServiceType")
+ private String subscriptionServiceType;
+ @JsonProperty("userParams")
+ private List<Map<String, Object>> userParams = new ArrayList<>();
+ @JsonProperty("aLaCarte")
+ private Boolean aLaCarte;
+ @JsonProperty("payload")
+ private String payload;
+ @JsonProperty("usePreload")
+ private Boolean usePreload;
+
+ 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 String getPayload() {
+ return payload;
+ }
+
+ public void setPayload(String value) {
+ this.payload = value;
+ }
+
+ public List<Map<String, Object>> getUserParams() {
+ return userParams;
+ }
+
+ public void setUserParams(List<Map<String, Object>> userParams) {
+ this.userParams = userParams;
+ }
+
+ public Object getUserParamValue(String name) {
+ if (userParams != null) {
+ for (Map<String, Object> param : userParams) {
+ if (param.get(name) != null) {
+ return param.get(name);
+ }
+ }
+ }
+ return null;
+ }
+
+ public Boolean isUsePreload() {
+ return usePreload;
+ }
+
+ @JsonProperty("usePreload")
+ public Boolean getUsePreload() {
+ return usePreload;
+ }
+
+ @JsonProperty("usePreload")
+ public void setUsePreload(Boolean usePreload) {
+ this.usePreload = usePreload;
+ }
+
+
+ @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) {
+ logger.error("Unable to convert Sniro Manager Request to string", e);
+ }
+ return json;
+ }
+
+ @Override
+ public String toString() {
+ return "RequestParameters [subscriptionServiceType=" + subscriptionServiceType + ", userParams=" + userParams
+ + ", aLaCarte=" + aLaCarte + "]";
+ }
}
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
index a727162415..ed94c5380e 100644
--- 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
@@ -22,67 +22,62 @@ 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("identifierType")
- private CandidateType identifierType;
- @JsonProperty("identifiers")
- private List<String> identifiers;
- @JsonProperty("cloudOwner")
- private String cloudOwner;
-
- /**
- * list of candidates
- * i.e. actual serviceInstanceId, actual vnfName, actual cloudRegionId, etc.
- */
- public List<String> getIdentifiers() {
- return identifiers;
- }
-
- /**
- * list of candidates
- * i.e. actual serviceInstanceId, actual vnfName, actual cloudRegionId, etc.
- */
- public void setIdentifiers(List<String> identifiers) {
- this.identifiers = identifiers;
- }
-
- /**
- * Way to identify the type of candidate
- * i.e. "serviceInstanceId", "vnfName", "cloudRegionId", etc.
- */
- public CandidateType getIdentifierType(){
- return identifierType;
- }
-
- /**
- * Way to identify the type of candidate
- * i.e. "serviceInstanceId", "vnfName", "cloudRegionId", etc.
- */
- public void setIdentifierType(CandidateType identifierType){
- this.identifierType = identifierType;
- }
-
- /**
- * The name of the cloud owner. Required if candidateType is cloudRegionId
- */
- public String getCloudOwner(){
- return cloudOwner;
- }
-
- /**
- * The name of the cloud owner. Required if candidateType is cloudRegionId
- */
- public void setCloudOwner(String cloudOwner){
- this.cloudOwner = cloudOwner;
- }
+ private static final long serialVersionUID = -3959572501582849328L;
+
+ @JsonProperty("identifierType")
+ private CandidateType identifierType;
+ @JsonProperty("identifiers")
+ private List<String> identifiers;
+ @JsonProperty("cloudOwner")
+ private String cloudOwner;
+
+ /**
+ * list of candidates i.e. actual serviceInstanceId, actual vnfName, actual cloudRegionId, etc.
+ */
+ public List<String> getIdentifiers() {
+ return identifiers;
+ }
+
+ /**
+ * list of candidates i.e. actual serviceInstanceId, actual vnfName, actual cloudRegionId, etc.
+ */
+ public void setIdentifiers(List<String> identifiers) {
+ this.identifiers = identifiers;
+ }
+
+ /**
+ * Way to identify the type of candidate i.e. "serviceInstanceId", "vnfName", "cloudRegionId", etc.
+ */
+ public CandidateType getIdentifierType() {
+ return identifierType;
+ }
+
+ /**
+ * Way to identify the type of candidate i.e. "serviceInstanceId", "vnfName", "cloudRegionId", etc.
+ */
+ public void setIdentifierType(CandidateType identifierType) {
+ this.identifierType = identifierType;
+ }
+
+ /**
+ * The name of the cloud owner. Required if candidateType is cloudRegionId
+ */
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ /**
+ * The name of the cloud owner. Required if candidateType is cloudRegionId
+ */
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
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
index 6a4fa50020..ee97c054dd 100644
--- 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
@@ -22,23 +22,20 @@ package org.onap.so.bpmn.servicedecomposition.homingobjects;
import com.fasterxml.jackson.annotation.JsonValue;
-public enum CandidateType{
+public enum CandidateType {
- SERVICE_INSTANCE_ID("serviceInstanceId"),
- CLOUD_REGION_ID("cloudRegionId"),
- VNF_ID("vnfId"),
- VNF_NAME("vnfName");
+ SERVICE_INSTANCE_ID("serviceInstanceId"), CLOUD_REGION_ID("cloudRegionId"), VNF_ID("vnfId"), VNF_NAME("vnfName");
- private final String name;
+ private final String name;
- private CandidateType(String name) {
- this.name = name;
- }
+ private CandidateType(String name) {
+ this.name = name;
+ }
- @Override
- @JsonValue
- public String toString() {
- return name;
- }
+ @Override
+ @JsonValue
+ public String toString() {
+ 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
index 0cbd88b665..db5c11a954 100644
--- 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
@@ -23,43 +23,41 @@ 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{
+public class SolutionCandidates implements Serializable {
- private static final long serialVersionUID = 2188754118148819627L;
+ private static final long serialVersionUID = 2188754118148819627L;
- @JsonProperty("requiredCandidates")
- private List<Candidate> requiredCandidates = new ArrayList<Candidate>();
- @JsonProperty("excludedCandidates")
- private List<Candidate> excludedCandidates = new ArrayList<Candidate>();
- //TODO figure out best way to do this
- @JsonProperty("existingCandidates")
- private List<Candidate> existingCandidates = new ArrayList<Candidate>();
+ @JsonProperty("requiredCandidates")
+ private List<Candidate> requiredCandidates = new ArrayList<Candidate>();
+ @JsonProperty("excludedCandidates")
+ private List<Candidate> excludedCandidates = new ArrayList<Candidate>();
+ // TODO figure out best way to do this
+ @JsonProperty("existingCandidates")
+ private List<Candidate> existingCandidates = new ArrayList<Candidate>();
- public List<Candidate> getRequiredCandidates() {
- return requiredCandidates;
- }
- public void addRequiredCandidates(Candidate requiredCandidate) {
- this.requiredCandidates.add(requiredCandidate);
- }
- public List<Candidate> getExcludedCandidates() {
- return excludedCandidates;
- }
- public void addExcludedCandidates(Candidate excludedCandidate) {
- this.excludedCandidates.add(excludedCandidate);
- }
+ public List<Candidate> getRequiredCandidates() {
+ return requiredCandidates;
+ }
- public List<Candidate> getExistingCandidates(){
- return existingCandidates;
- }
+ public void addRequiredCandidates(Candidate requiredCandidate) {
+ this.requiredCandidates.add(requiredCandidate);
+ }
+ public List<Candidate> getExcludedCandidates() {
+ return excludedCandidates;
+ }
+ public void addExcludedCandidates(Candidate excludedCandidate) {
+ this.excludedCandidates.add(excludedCandidate);
+ }
+ public List<Candidate> 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
index 3c8f0e933f..643113573e 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -30,69 +29,63 @@ 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 Integer 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 Integer 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(Integer 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;
- }
+ private static final long serialVersionUID = 6903399488466840832L;
+
+ @JsonProperty("solution-id") // identifies which solution
+ private Integer 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 Integer 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(Integer 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
index b4f2e85e55..a0a8408cfc 100644
--- 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
@@ -21,126 +21,152 @@
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;
- }
+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
index cb6fabde30..d31d84807d 100644
--- 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
@@ -21,79 +21,93 @@
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-customization-uuid")
- private String modelCustomizationUUID;
- @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 Integer quantity;
-
- public String getModelCustomizationUUID() {
- return modelCustomizationUUID;
- }
- public void setModelCustomizationUUID(String modelCustomizationUUID) {
- this.modelCustomizationUUID = modelCustomizationUUID;
- }
- 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 Integer getQuantity() {
- return quantity;
- }
- public void setQuantity(Integer quantity) {
- this.quantity = quantity;
- }
-
-
-
+public class ModelInfoCollection implements Serializable {
+
+ private static final long serialVersionUID = 8380534468706675508L;
+
+ @JsonProperty("model-customization-uuid")
+ private String modelCustomizationUUID;
+ @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 Integer quantity;
+
+ public String getModelCustomizationUUID() {
+ return modelCustomizationUUID;
+ }
+
+ public void setModelCustomizationUUID(String modelCustomizationUUID) {
+ this.modelCustomizationUUID = modelCustomizationUUID;
+ }
+
+ 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 Integer getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(Integer 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
index 462664c612..21b8c74967 100644
--- 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
@@ -21,60 +21,70 @@
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;
- @JsonProperty("configuration-type")
- private String configurationType;
- @JsonProperty("configuration-role")
- private String configurationRole;
- @JsonProperty("policy-name")
- private String policyName;
-
- public String getConfigurationRole() {
- return configurationRole;
- }
- public void setConfigurationRole(String configurationRole) {
- this.configurationRole = configurationRole;
- }
- public String getConfigurationType() {
- return configurationType;
- }
- public void setConfigurationType(String configurationType) {
- this.configurationType = configurationType;
- }
- 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 getPolicyName() {
- return policyName;
- }
- public void setPolicyName(String policyName) {
- this.policyName = policyName;
- }
+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;
+ @JsonProperty("configuration-type")
+ private String configurationType;
+ @JsonProperty("configuration-role")
+ private String configurationRole;
+ @JsonProperty("policy-name")
+ private String policyName;
+
+ public String getConfigurationRole() {
+ return configurationRole;
+ }
+
+ public void setConfigurationRole(String configurationRole) {
+ this.configurationRole = configurationRole;
+ }
+
+ public String getConfigurationType() {
+ return configurationType;
+ }
+
+ public void setConfigurationType(String configurationType) {
+ this.configurationType = configurationType;
+ }
+
+ 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 getPolicyName() {
+ return policyName;
+ }
+
+ public void setPolicyName(String policyName) {
+ this.policyName = policyName;
+ }
}
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
index 6b53272a75..14327a3583 100644
--- 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
@@ -21,125 +21,151 @@
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;
- }
+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
index e03ee358f3..7b30858b25 100644
--- 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
@@ -23,60 +23,71 @@ 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_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;
- }
+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_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
index c873912922..7fc29a8fc1 100644
--- 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
@@ -21,63 +21,73 @@
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;
- }
+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
index 22233e94a5..955ad86561 100644
--- 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
@@ -22,148 +22,180 @@ 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;
- }
+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
index ac206d3dd0..05cad456d0 100644
--- 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
@@ -21,61 +21,71 @@
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;
- }
+ 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/ModelInfoVfModule.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVfModule.java
index 593f8c2532..e1b7a543d8 100644
--- 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
@@ -21,116 +21,140 @@
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;
- }
+ 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
index d3bf99ccb8..bb493f5aa9 100644
--- 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
@@ -21,10 +21,9 @@
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;
+ 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
index ac96aceec3..7ca6076b21 100644
--- 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
@@ -22,23 +22,19 @@ 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;
- }
+ 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
index f5b77781a4..de77ca66e7 100644
--- 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
@@ -28,7 +28,6 @@ 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;
@@ -96,1715 +95,1760 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 Logger logger = LoggerFactory.getLogger(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 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";
- private static final String PREPROV = "PREPROV";
-
- @Autowired
- private BBInputSetupUtils bbInputSetupUtils;
-
- @Autowired
- private BBInputSetupMapperLayer mapperLayer;
-
- @Autowired
- private CloudInfoFromAAI cloudInfoFromAAI;
-
- @Autowired
- private ExceptionBuilder exceptionUtil;
-
- private ObjectMapper mapper = new ObjectMapper();
-
- public BBInputSetupUtils getBbInputSetupUtils() {
- return bbInputSetupUtils;
- }
-
- public void setCloudInfoFromAAI(CloudInfoFromAAI cloudInfoFromAAI) {
- this.cloudInfoFromAAI = cloudInfoFromAAI;
- }
-
- 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 = Boolean.TRUE.equals(executeBB.isaLaCarte());
- boolean homing = Boolean.TRUE.equals(executeBB.isHoming());
- Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
- outputBB = this.getGBB(executeBB, lookupKeyMap, requestAction, aLaCarte, resourceId, vnfType);
- ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationFeature.INDENT_OUTPUT);
- logger.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) {
- logger.error("Exception occurred", e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e.getMessage());
- }
- }
-
- protected void setHomingFlag(GeneralBuildingBlock outputBB, boolean homing, Map<ResourceKey, String> 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<ResourceKey, String> 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);
- }
- if (requestDetails.getModelInfo() == null) {
- return this.getGBBCM(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId);
- }
- else {
- 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<ResourceKey, String> 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());
- lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, workflowResourceIds.getInstanceGroupId());
- }
-
- protected GeneralBuildingBlock getGBBALaCarteNonService(ExecuteBuildingBlock executeBB,
- RequestDetails requestDetails, Map<ResourceKey, String> 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, executeBB.getBuildingBlock().getKey(), executeBB.getConfigurationResourceKeys());
- return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null);
- } else {
- logger.debug("Related Service Instance from AAI: {}", aaiServiceInstance);
- logger.debug("Related Service Instance Model Info from AAI: {}", service);
- throw new Exception("Could not find relevant information for related Service Instance");
- }
- }
-
- protected GeneralBuildingBlock getGBBCM(ExecuteBuildingBlock executeBB,
- RequestDetails requestDetails, Map<ResourceKey, String> lookupKeyMap, String requestAction,
- String resourceId) throws Exception {
- ServiceInstance serviceInstance = new ServiceInstance();
- String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID);
- serviceInstance.setServiceInstanceId(serviceInstanceId);
- Customer customer = new Customer();
- List<GenericVnf> genericVnfs = serviceInstance.getVnfs();
-
- String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID);
- if(vnfId != null) {
- org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId);
- GenericVnf genericVnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnf);
- genericVnfs.add(genericVnf);
- }
-
- String instanceGroupId = lookupKeyMap.get(ResourceKey.INSTANCE_GROUP_ID);
- if(instanceGroupId != null) {
- org.onap.aai.domain.yang.InstanceGroup aaiInstancegroup = bbInputSetupUtils.getAAIInstanceGroup(instanceGroupId);
- InstanceGroup instanceGroup = this.mapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstancegroup);
- instanceGroup.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
-
- if(serviceInstanceId == null) {
- Optional<org.onap.aai.domain.yang.ServiceInstance> aaiServiceInstanceOpt = bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup(instanceGroupId);
- if(aaiServiceInstanceOpt.isPresent()) {
- org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = aaiServiceInstanceOpt.get();
- serviceInstance = this.mapperLayer.mapAAIServiceInstanceIntoServiceInstance(aaiServiceInstance);
- WorkflowResourceIds workflowResourceIds = executeBB.getWorkflowResourceIds();
- workflowResourceIds.setServiceInstanceId(serviceInstance.getServiceInstanceId());
- lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, workflowResourceIds.getServiceInstanceId());
- } else {
- throw new NoServiceInstanceFoundException("Related ServiceInstance not found in A&AI.");
- }
- }
- RelatedInstanceList[] relatedInstanceList = requestDetails.getRelatedInstanceList();
- if (relatedInstanceList != null) {
- for (RelatedInstanceList relatedInstList : relatedInstanceList) {
- RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
- if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) {
- org.onap.aai.domain.yang.GenericVnf aaiVnf = bbInputSetupUtils.getAAIGenericVnf(relatedInstance.getInstanceId());
- GenericVnf vnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiVnf);
- instanceGroup.getVnfs().add(vnf);
- }
- }
- }
-
- serviceInstance.getInstanceGroups().add(instanceGroup);
- customer.setServiceSubscription(new ServiceSubscription());
- }
- return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, customer);
- }
-
- protected void populateObjectsOnAssignAndCreateFlows(RequestDetails requestDetails, Service service, String bbName,
- ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String vnfType,
- String configurationKey, ConfigurationResourceKeys configurationResourceKeys)
- throws Exception {
- ModelInfo modelInfo = requestDetails.getModelInfo();
- String instanceName = requestDetails.getRequestInfo().getInstanceName();
- String productFamilyId = requestDetails.getRequestInfo().getProductFamilyId();
- 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)) {
- lookupKeyMap.put(ResourceKey.NETWORK_ID, resourceId);
- this.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, null);
- } else if (modelType.equals(ModelType.vnf)) {
- lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, resourceId);
- this.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance,
- lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, productFamilyId);
- } else if (modelType.equals(ModelType.volumeGroup)) {
- lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, resourceId);
- this.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- relatedInstanceList, instanceName, vnfType, null);
- } else if (modelType.equals(ModelType.vfModule)) {
- if(bbName.contains("Configuration")) {
- String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID);
- ModelInfo configurationModelInfo = new ModelInfo();
- configurationModelInfo.setModelCustomizationUuid(configurationKey);
- populateConfiguration(configurationModelInfo, service, bbName, serviceInstance,
- lookupKeyMap, configurationId, instanceName, configurationResourceKeys);
- } else {
- lookupKeyMap.put(ResourceKey.VF_MODULE_ID, resourceId);
- this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- relatedInstanceList, instanceName, null, requestDetails.getCloudConfiguration());
- }
- } else if (modelType.equals(ModelType.instanceGroup)) {
- lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, resourceId);
- this.populateInstanceGroup(modelInfo, service, serviceInstance, resourceId, instanceName);
- } else {
- return;
- }
- }
-
- protected void populateInstanceGroup(ModelInfo modelInfo, Service service, ServiceInstance serviceInstance, String instanceGroupId, String instanceName) {
- InstanceGroup instanceGroup = new InstanceGroup();
- instanceGroup.setId(instanceGroupId);
- instanceGroup.setInstanceGroupName(instanceName);
- mapCatalogInstanceGroup(instanceGroup, modelInfo, service);
- serviceInstance.getInstanceGroups().add(instanceGroup);
- }
-
- protected void mapCatalogInstanceGroup(InstanceGroup instanceGroup, ModelInfo modelInfo, Service service) {
- // @TODO: this will populate the instanceGroup model info.
- // Dependent on MSO-5821 653458 US - MSO - Enhance Catalog DB Schema & Adapter to support VNF Groups
- }
-
- protected void populateConfiguration(ModelInfo modelInfo, Service service, String bbName,
- ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String instanceName, ConfigurationResourceKeys configurationResourceKeys) {
- Configuration configuration = null;
- for (Configuration configurationTemp : serviceInstance.getConfigurations()) {
- if (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null
- && configurationTemp.getConfigurationId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) {
- configuration = configurationTemp;
- org.onap.aai.domain.yang.Configuration aaiConfiguration = bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId());
- if(aaiConfiguration!=null){
- modelInfo.setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId());
- }
- }
- }
- if (configuration == null && bbName.equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())) {
- configuration = this.createConfiguration(lookupKeyMap, instanceName, resourceId);
- serviceInstance.getConfigurations().add(configuration);
- }
- if(configuration != null) {
- Vnfc vnfc = getVnfcToConfiguration(configurationResourceKeys.getVnfcName());
- configuration.setVnfc(vnfc);
- this.mapCatalogConfiguration(configuration, modelInfo, service, configurationResourceKeys);
- }
- }
-
- protected Vnfc getVnfcToConfiguration(String vnfcName) {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName);
- Optional<org.onap.aai.domain.yang.Vnfc> vnfcOp = bbInputSetupUtils.getAAIResourceDepthOne(uri).asBean(org.onap.aai.domain.yang.Vnfc.class);
- if(vnfcOp.isPresent()) {
- org.onap.aai.domain.yang.Vnfc vnfcAAI = vnfcOp.get();
- return this.mapperLayer.mapAAIVnfc(vnfcAAI);
- } else {
- return null;
- }
- }
-
- protected Configuration createConfiguration(Map<ResourceKey, String> 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, ConfigurationResourceKeys configurationResourceKeys) {
- ConfigurationResourceCustomization configurationResourceCustomization = findConfigurationResourceCustomization(modelInfo, service);
- CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization =
- findVnfVfmoduleCvnfcConfigurationCustomization(service.getModelUUID(),configurationResourceKeys.getVfModuleCustomizationUUID(),
- configurationResourceKeys.getVnfResourceCustomizationUUID(), configurationResourceKeys.getCvnfcCustomizationUUID(), configurationResourceCustomization);
- if (configurationResourceCustomization != null && vnfVfmoduleCvnfcConfigurationCustomization != null) {
- configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization
- , vnfVfmoduleCvnfcConfigurationCustomization));
- } else {
- logger.debug("for Fabric configuration mapping by VF MODULE CUST UUID: " + configurationResourceKeys.getVfModuleCustomizationUUID());
- vnfVfmoduleCvnfcConfigurationCustomization = findVnfVfmoduleCvnfcConfigurationCustomization(service.getModelUUID(),configurationResourceKeys.getVnfResourceCustomizationUUID(),
- configurationResourceKeys.getVfModuleCustomizationUUID(), configurationResourceKeys.getCvnfcCustomizationUUID());
- if (vnfVfmoduleCvnfcConfigurationCustomization != null){
- configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(vnfVfmoduleCvnfcConfigurationCustomization));
- }
- }
- }
-
- protected CvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String serviceModelUUID, String vfModuleCustomizationUUID,
- String vnfResourceCustomizationUUID, String cvnfcCustomizationUUID, ConfigurationResourceCustomization configurationResourceCustomization) {
- return bbInputSetupUtils.getCvnfcConfigurationCustomization(serviceModelUUID, vnfResourceCustomizationUUID, vfModuleCustomizationUUID, cvnfcCustomizationUUID);
- }
-
- protected ConfigurationResourceCustomization findConfigurationResourceCustomization(ModelInfo modelInfo, Service service) {
- for (ConfigurationResourceCustomization resourceCust : service.getConfigurationCustomizations()) {
- if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) {
- return resourceCust;
- }
- }
- return null;
- }
-
- protected CvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String serviceModelUUID, String vnfResourceCustomizationUUID,
- String vfModuleCustomizationUUID, String cvnfcCustomizationUUID) {
- return bbInputSetupUtils.getCvnfcConfigurationCustomization(serviceModelUUID, vnfResourceCustomizationUUID, vfModuleCustomizationUUID, cvnfcCustomizationUUID);
- }
-
- protected void populateVfModule(ModelInfo modelInfo, Service service, String bbName,
- ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId,
- RelatedInstanceList[] relatedInstanceList, String instanceName, List<Map<String, String>> instanceParams, CloudConfiguration cloudConfiguration) throws Exception {
- 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);
- Optional<String> volumeGroupIdOp = getVolumeGroupIdRelatedToVfModule(tempVnf, modelInfo, cloudConfiguration.getCloudOwner(),
- cloudConfiguration.getLcpCloudRegionId(), lookupKeyMap);
- if(volumeGroupIdOp.isPresent()) {
- lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupIdOp.get());
- }
- break;
- }
- }
- if (vnf != null) {
- VfModule vfModule = null;
- for (VfModule vfModuleTemp : vnf.getVfModules()) {
- if (lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null
- && vfModuleTemp.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) {
- vfModule = vfModuleTemp;
- }
- String vfModuleCustId = bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModuleTemp.getVfModuleId()).getModelCustomizationId();
- ModelInfo modelInfoVfModule = new ModelInfo();
- modelInfoVfModule.setModelCustomizationId(vfModuleCustId);
- mapCatalogVfModule(vfModuleTemp, modelInfoVfModule, service, vnfModelCustomizationUUID);
- }
- if (vfModule == null && bbName.equalsIgnoreCase(AssignFlows.VF_MODULE.toString())) {
- vfModule = createVfModule(lookupKeyMap,
- resourceId, instanceName, instanceParams);
- vnf.getVfModules().add(vfModule);
- mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID);
- }
- } else {
- logger.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 Optional<String> getVolumeGroupIdRelatedToVfModule(GenericVnf vnf, ModelInfo modelInfo,
- String cloudOwner, String cloudRegionId, Map<ResourceKey, String> lookupKeyMap) {
- if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) == null) {
- for(VolumeGroup volumeGroup : vnf.getVolumeGroups()) {
- String volumeGroupCustId =
- bbInputSetupUtils.getAAIVolumeGroup(cloudOwner,
- cloudRegionId, volumeGroup.getVolumeGroupId()).getModelCustomizationId();
- if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) {
- return Optional.of(volumeGroup.getVolumeGroupId());
- }
- }
- }
- return Optional.empty();
- }
-
- 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<ResourceKey, String> lookupKeyMap, String vfModuleId, String instanceName, List<Map<String, String>> 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<String, String> params : instanceParams) {
- vfModule.getCloudParams().putAll(params);
- }
- }
- return vfModule;
- }
-
- protected void populateVolumeGroup(ModelInfo modelInfo, Service service, String bbName,
- ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId,
- RelatedInstanceList[] relatedInstanceList, String instanceName, String vnfType, List<Map<String, String>> instanceParams) throws Exception {
- VolumeGroup volumeGroup = null;
- GenericVnf vnf = null;
- String vnfModelCustomizationUUID = null;
- String generatedVnfType = vnfType;
- if (generatedVnfType == null || generatedVnfType.isEmpty()) {
- generatedVnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName();
- }
- if (relatedInstanceList != null) {
- for (RelatedInstanceList relatedInstList : relatedInstanceList) {
- RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
- if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) {
- vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationUuid();
- break;
- }
- }
- }
- for (GenericVnf tempVnf : serviceInstance.getVnfs()) {
- if (tempVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) {
- vnf = tempVnf;
- vnfModelCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId())
- .getModelCustomizationId();
- ModelInfo vnfModelInfo = new ModelInfo();
- vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
- mapCatalogVnf(tempVnf, vnfModelInfo, service);
- break;
- }
- }
- if (vnf != null && vnfModelCustomizationUUID != null) {
- for (VolumeGroup volumeGroupTemp : vnf.getVolumeGroups()) {
- if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) != null && volumeGroupTemp.getVolumeGroupId()
- .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID))) {
- volumeGroup = volumeGroupTemp;
- break;
- }
- }
- if (volumeGroup == null && bbName.equalsIgnoreCase(AssignFlows.VOLUME_GROUP.toString())) {
- volumeGroup = createVolumeGroup(lookupKeyMap, resourceId, instanceName, generatedVnfType, instanceParams);
- vnf.getVolumeGroups().add(volumeGroup);
- }
- if(volumeGroup != null) {
- mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID);
- }
- } else {
- logger.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<ResourceKey, String> lookupKeyMap, String volumeGroupId, String instanceName, String vnfType, List<Map<String, String>> 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<String, String> 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<ResourceKey, String> lookupKeyMap,
- RelatedInstanceList[] relatedInstanceList, String resourceId, String vnfType, List<Map<String, String>> instanceParams,
- String productFamilyId) {
- GenericVnf vnf = null;
- ModelInfo instanceGroupModelInfo = null;
- String instanceGroupId = null;
- String generatedVnfType = vnfType;
- if (generatedVnfType == null || generatedVnfType.isEmpty()) {
- generatedVnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName();
- }
- if (relatedInstanceList != null) {
- for (RelatedInstanceList relatedInstList : relatedInstanceList) {
- RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
- if (relatedInstance.getModelInfo().getModelType().equals(ModelType.networkInstanceGroup)) {
- instanceGroupModelInfo = relatedInstance.getModelInfo();
- instanceGroupId = relatedInstance.getInstanceId();
- }
- }
- }
- for (GenericVnf vnfTemp : serviceInstance.getVnfs()) {
- if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null
- && vnfTemp.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) {
- String vnfModelCustId = bbInputSetupUtils.getAAIGenericVnf(vnfTemp.getVnfId()).getModelCustomizationId();
- modelInfo.setModelCustomizationUuid(vnfModelCustId);
- vnf = vnfTemp;
- break;
- }
- }
- if (vnf == null && bbName.equalsIgnoreCase(AssignFlows.VNF.toString())) {
- vnf = createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness,
- resourceId, generatedVnfType, instanceParams, productFamilyId);
- serviceInstance.getVnfs().add(vnf);
- mapVnfcCollectionInstanceGroup(vnf, modelInfo, service);
- }
- if(vnf != null) {
- mapCatalogVnf(vnf, modelInfo, service);
- if (instanceGroupId != null && instanceGroupModelInfo != null
- && instanceGroupModelInfo.getModelType().equals(ModelType.networkInstanceGroup)
- && !instanceGroupInList(vnf, instanceGroupId)) {
- mapNetworkCollectionInstanceGroup(vnf, instanceGroupId);
- }
- }
- }
-
- protected boolean instanceGroupInList(GenericVnf vnf, String instanceGroupId) {
- for(InstanceGroup instanceGroup : vnf.getInstanceGroups()) {
- if(instanceGroup.getId() != null && instanceGroup.getId().equalsIgnoreCase(instanceGroupId)) {
- return true;
- }
- }
- return false;
- }
-
- protected void mapVnfcCollectionInstanceGroup(GenericVnf genericVnf, ModelInfo modelInfo, Service service) {
- VnfResourceCustomization vnfResourceCustomization = getVnfResourceCustomizationFromService(modelInfo, service);
- if(vnfResourceCustomization != null) {
- List<VnfcInstanceGroupCustomization> vnfcInstanceGroups = vnfResourceCustomization
- .getVnfcInstanceGroupCustomizations();
- for (VnfcInstanceGroupCustomization vnfcInstanceGroupCust : vnfcInstanceGroups) {
- InstanceGroup instanceGroup = this.createInstanceGroup();
- org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = bbInputSetupUtils.getCatalogInstanceGroup(vnfcInstanceGroupCust.getInstanceGroup().getModelUUID());
- instanceGroup.setModelInfoInstanceGroup(this.mapperLayer
- .mapCatalogInstanceGroupToInstanceGroup(null, catalogInstanceGroup));
- 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 = 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<ResourceKey, String> lookupKeyMap, String instanceName,
- org.onap.so.serviceinstancebeans.Platform platform,
- org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness, String vnfId, String vnfType, List<Map<String, String>> instanceParams,
- String productFamilyId) {
- lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfId);
- GenericVnf genericVnf = new GenericVnf();
- genericVnf.setVnfId(vnfId);
- genericVnf.setVnfName(instanceName);
- genericVnf.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
- genericVnf.setVnfType(vnfType);
- genericVnf.setProvStatus(PREPROV);
- genericVnf.setServiceId(productFamilyId);
- if (platform != null) {
- genericVnf.setPlatform(this.mapperLayer.mapRequestPlatform(platform));
- }
- if (lineOfBusiness != null) {
- genericVnf.setLineOfBusiness(this.mapperLayer.mapRequestLineOfBusiness(lineOfBusiness));
- }
- if(instanceParams != null) {
- for(Map<String, String> 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<ResourceKey, String> lookupKeyMap, String resourceId, List<Map<String, String>> instanceParams) {
- L3Network network = null;
- for (L3Network networkTemp : serviceInstance.getNetworks()) {
- if (lookupKeyMap.get(ResourceKey.NETWORK_ID) != null
- && networkTemp.getNetworkId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.NETWORK_ID))) {
- network = networkTemp;
- break;
- }
- }
- if (network == null
- && (bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString())
- || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) {
- network = createNetwork(lookupKeyMap, instanceName, resourceId, instanceParams);
- serviceInstance.getNetworks().add(network);
- }
- if(network != null) {
- mapCatalogNetwork(network, modelInfo, service);
- }
- }
-
- protected L3Network createNetwork(Map<ResourceKey, String> lookupKeyMap, String instanceName,
- String networkId, List<Map<String, String>> 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<String, String> 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<ResourceKey, String> 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, Boolean.TRUE.equals(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<String, String> 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<String, String> 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) throws Exception {
- 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());
- CloudRegion cloudRegion = mapperLayer.mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion);
- Tenant tenant = getTenant(requestDetails.getCloudConfiguration(), aaiCloudRegion);
- outputBB.setOrchContext(orchContext);
- outputBB.setRequestContext(requestContext);
- outputBB.setCloudRegion(cloudRegion);
- outputBB.setTenant(tenant);
- if(customer == null){
- Map<String, String> 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);
- if (customer.getServiceSubscription() != null) {
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- }
- outputBB.setCustomer(customer);
- return outputBB;
- }
-
- protected Tenant getTenant(CloudConfiguration cloudConfiguration, org.onap.aai.domain.yang.CloudRegion aaiCloudRegion) throws Exception {
- Tenant tenant = new Tenant();
- if(cloudConfiguration != null && cloudConfiguration.getTenantId() != null
- && aaiCloudRegion != null && aaiCloudRegion.getTenants() != null) {
- for(org.onap.aai.domain.yang.Tenant aaiTenant : aaiCloudRegion.getTenants().getTenant()) {
- if(aaiTenant.getTenantId().equalsIgnoreCase(cloudConfiguration.getTenantId())) {
- tenant = mapperLayer.mapTenant(aaiTenant);
- }
- }
- if(tenant.getTenantId() == null || tenant.getTenantName() == null) {
- throw new Exception("Invalid tenant information retrieved: tenantId = " + tenant.getTenantId()
- + " tenantName = " + tenant.getTenantName());
- }
- }
- return tenant;
- }
-
- 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<ResourceKey, String> 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 = null;
- if(customer != null && customer.getServiceSubscription() != null) {
- serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(customer.getGlobalCustomerId(),
- customer.getServiceSubscription().getServiceType(), serviceInstanceId);
- } else {
- serviceInstanceAAI = 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<ResourceKey, String> lookupKeyMap, String requestAction, String resourceId, String vnfType)
- throws Exception {
- String bbName = executeBB.getBuildingBlock().getBpmnFlowName();
- String key = executeBB.getBuildingBlock().getKey();
-
- if (requestAction.equalsIgnoreCase("deleteInstance")
- || requestAction.equalsIgnoreCase("unassignInstance")
- || requestAction.equalsIgnoreCase("activateInstance")
- || requestAction.equalsIgnoreCase("activateFabricConfiguration")
- || requestAction.equalsIgnoreCase("recreateInstance")
- || requestAction.equalsIgnoreCase("replaceInstance")) {
- return getGBBMacroExistingService(executeBB, lookupKeyMap, bbName, requestAction,
- requestDetails.getCloudConfiguration());
- }
-
- String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID);
- GeneralBuildingBlock gBB = this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction,
- serviceInstanceId);
- 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<String, Object> 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 {
- throw new IllegalArgumentException(
- "No user params on requestAction: assignInstance. Please specify user params.");
- }
- }
-
- protected GeneralBuildingBlock getGBBMacroNoUserParamsCreate(ExecuteBuildingBlock executeBB,
- Map<ResourceKey, String> 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((!Boolean.TRUE.equals(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 {
- logger.debug("Could not find a network customization with key: {}", key);
- }
- } else {
- logger.debug("Orchestrating on Collection Network Resource Customization");
- CollectionNetworkResourceCustomization collectionNetworkResourceCust = bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key);
- L3Network l3Network = getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId, collectionNetworkResourceCust, serviceInstance);
- NetworkResourceCustomization networkResourceCustomization =
- mapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust);
- if(l3Network != null) {
- l3Network.setModelInfoNetwork(mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization));
- }
- }
- } else if(bbName.contains("Configuration")) {
- String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID);
- ModelInfo configurationModelInfo = new ModelInfo();
- configurationModelInfo.setModelCustomizationUuid(key);
- this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null, executeBB.getConfigurationResourceKeys());
- }
- if (executeBB.getWorkflowResourceIds() != null) {
- this.populateNetworkCollectionAndInstanceGroupAssign(service, bbName, serviceInstance,
- executeBB.getWorkflowResourceIds().getNetworkCollectionId(), key);
- }
- return gBB;
- }
-
- protected L3Network getVirtualLinkL3Network(Map<ResourceKey, String> lookupKeyMap, String bbName, String key,
- String networkId, CollectionNetworkResourceCustomization collectionNetworkResourceCust, ServiceInstance serviceInstance) {
- if(collectionNetworkResourceCust != null) {
- if((bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString())
- || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) {
- L3Network network = createNetwork(lookupKeyMap, null, networkId, null);
- serviceInstance.getNetworks().add(network);
- return network;
- } else {
- for (L3Network network : serviceInstance.getNetworks()) {
- if (network.getNetworkId().equalsIgnoreCase(networkId)) {
- return network;
- }
- }
- }
- }
- 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<ResourceKey, String> lookupKeyMap, String bbName, String requestAction, CloudConfiguration cloudConfiguration) throws Exception {
- org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null;
- String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID);
- RequestDetails requestDetails = executeBB.getRequestDetails();
- GeneralBuildingBlock gBB = 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));
- gBB = populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null);
- } else {
- logger.debug("Related Service Instance from AAI: {}", aaiServiceInstance);
- logger.debug("Related Service Instance Model Info from AAI: {}", service);
- throw new Exception("Could not find relevant information for related Service Instance");
- }
- ServiceInstance serviceInstance = gBB.getServiceInstance();
- CloudRegion cloudRegion = null;
- if(cloudConfiguration == null) {
- Optional<CloudRegion> cloudRegionOp = cloudInfoFromAAI.getCloudInfoFromAAI(serviceInstance);
- if(cloudRegionOp.isPresent()) {
- cloudRegion = cloudRegionOp.get();
- }
- }
- if (cloudConfiguration != null) {
- org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration);
- cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion);
- }
- 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);
- if(cloudRegion != null) {
- Optional<String> volumeGroupIdOp = getVolumeGroupIdRelatedToVfModule(vnf, vfModuleModelInfo, cloudRegion.getCloudOwner(),
- cloudRegion.getLcpCloudRegionId(), lookupKeyMap);
- if(volumeGroupIdOp.isPresent()) {
- lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupIdOp.get());
- }
- }
- 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 (cloudRegion != null) {
- String volumeGroupCustomizationUUID = this.bbInputSetupUtils.getAAIVolumeGroup(cloudRegion.getCloudOwner(),
- cloudRegion.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, executeBB.getConfigurationResourceKeys());
- 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<ResourceKey, String> 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);
- }
- String productFamilyId = requestDetails.getRequestInfo().getProductFamilyId();
- this.populateGenericVnf(vnfs.getModelInfo(), vnfs.getInstanceName(), vnfs.getPlatform(),
- vnfs.getLineOfBusiness(), service, bbName, serviceInstance, lookupKeyMap, null, vnfId, vnfType, vnfs.getInstanceParams(),
- productFamilyId);
- } else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP)) {
- Pair<Vnfs, VfModules> 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());
- cloudConfig.setCloudOwner(cloudRegion.getCloudOwner());
- 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, executeBB.getConfigurationResourceKeys());
- } else {
- logger.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<Vnfs, VfModules> 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>(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);
- return mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion);
- } else {
- logger.debug("Could not find any cloud configuration for this request.");
- return null;
- }
- }
-
- protected String getVnfId(ExecuteBuildingBlock executeBB, Map<ResourceKey, String> 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<ResourceKey, String> 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) {
- if(customer != null && customer.getServiceSubscription() != null) {
- serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(customer.getGlobalCustomerId(),
- customer.getServiceSubscription().getServiceType(), serviceInstanceId);
- } else {
- 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<ResourceKey, String> 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<Relationships> 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<AAIResourceUri> relatedAAIUris, List<Configuration> configurations) {
- for (AAIResourceUri aaiResourceUri : relatedAAIUris) {
- configurations.add(mapConfiguration(aaiResourceUri));
- }
- }
-
- protected Configuration mapConfiguration(AAIResourceUri aaiResourceUri) {
- AAIResultWrapper aaiConfigurationWrapper = this.bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri);
- Optional<org.onap.aai.domain.yang.Configuration> 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<AAIResourceUri> list, List<GenericVnf> genericVnfs) {
- for (AAIResourceUri aaiResourceUri : list) {
- genericVnfs.add(this.mapGenericVnf(aaiResourceUri));
- }
- }
-
- protected GenericVnf mapGenericVnf(AAIResourceUri aaiResourceUri) {
- AAIResultWrapper aaiGenericVnfWrapper = this.bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri);
- Optional<org.onap.aai.domain.yang.GenericVnf> aaiGenericVnfOp = aaiGenericVnfWrapper
- .asBean(org.onap.aai.domain.yang.GenericVnf.class);
- if (!aaiGenericVnfOp.isPresent()) {
- return null;
- }
-
- GenericVnf genericVnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnfOp.get());
-
- Optional<Relationships> 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<InstanceGroup> mapInstanceGroups(List<AAIResultWrapper> instanceGroups) {
- List<InstanceGroup> instanceGroupsList = new ArrayList<>();
- for (AAIResultWrapper volumeGroupWrapper : instanceGroups) {
- instanceGroupsList.add(this.mapInstanceGroup(volumeGroupWrapper));
- }
- return instanceGroupsList;
- }
-
- protected InstanceGroup mapInstanceGroup(AAIResultWrapper instanceGroupWrapper) {
- Optional<org.onap.aai.domain.yang.InstanceGroup> 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<VolumeGroup> mapVolumeGroups(List<AAIResultWrapper> volumeGroups) {
- List<VolumeGroup> volumeGroupsList = new ArrayList<>();
- for (AAIResultWrapper volumeGroupWrapper : volumeGroups) {
- volumeGroupsList.add(this.mapVolumeGroup(volumeGroupWrapper));
- }
- return volumeGroupsList;
- }
-
- protected VolumeGroup mapVolumeGroup(AAIResultWrapper volumeGroupWrapper) {
- Optional<org.onap.aai.domain.yang.VolumeGroup> 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<AAIResultWrapper> lineOfBusinesses, GenericVnf genericVnf) {
- if (!lineOfBusinesses.isEmpty()) {
- AAIResultWrapper lineOfBusinessWrapper = lineOfBusinesses.get(0);
- Optional<org.onap.aai.domain.yang.LineOfBusiness> 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<AAIResultWrapper> platforms, GenericVnf genericVnf) {
- if (!platforms.isEmpty()) {
- AAIResultWrapper platformWrapper = platforms.get(0);
- Optional<org.onap.aai.domain.yang.Platform> 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<AAIResultWrapper> collections, ServiceInstance serviceInstance) {
- if (!collections.isEmpty()) {
- AAIResultWrapper collectionWrapper = collections.get(0);
- Optional<org.onap.aai.domain.yang.Collection> 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);
- NetworkCollectionResourceCustomization collectionResourceCust =
- bbInputSetupUtils.getCatalogNetworkCollectionResourceCustByID(aaiCollection.getCollectionCustomizationId());
- collection.setModelInfoCollection(mapperLayer.mapCatalogCollectionToCollection(collectionResourceCust, collectionResourceCust.getCollectionResource()));
- Optional<Relationships> relationshipsOp = collectionWrapper.getRelationships();
- Relationships relationships = null;
- if (relationshipsOp.isPresent()) {
- relationships = relationshipsOp.get();
- } else {
- serviceInstance.setCollection(collection);
- return;
- }
- List<InstanceGroup> instanceGroupsList = mapInstanceGroups(relationships.getByType(AAIObjectType.INSTANCE_GROUP));
- if(!instanceGroupsList.isEmpty()) {
- collection.setInstanceGroup(instanceGroupsList.get(0));
- }
- serviceInstance.setCollection(collection);
- }
- }
-
- protected void mapL3Networks(List<AAIResourceUri> list, List<L3Network> l3Networks) {
- for (AAIResourceUri aaiResourceUri : list) {
- l3Networks.add(this.mapL3Network(aaiResourceUri));
- }
- }
-
- protected L3Network mapL3Network(AAIResourceUri aaiResourceUri) {
- AAIResultWrapper aaiNetworkWrapper = this.bbInputSetupUtils.getAAIResourceDepthTwo(aaiResourceUri);
- Optional<org.onap.aai.domain.yang.L3Network> 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<Relationships> relationshipsOp = aaiNetworkWrapper.getRelationships();
- if (relationshipsOp.isPresent()) {
- Relationships relationships = relationshipsOp.get();
- this.mapNetworkPolicies(relationships.getByType(AAIObjectType.NETWORK_POLICY),
- network.getNetworkPolicies());
- mapRouteTableReferences(relationships.getByType(AAIObjectType.ROUTE_TABLE_REFERENCE),
- network.getContrailNetworkRouteTableReferences());
- }
-
- return network;
- }
-
- protected void mapNetworkPolicies(List<AAIResultWrapper> aaiNetworkPolicies, List<NetworkPolicy> networkPolicies) {
- for (AAIResultWrapper networkPolicyWrapper : aaiNetworkPolicies) {
- networkPolicies.add(this.mapNetworkPolicy(networkPolicyWrapper));
- }
- }
-
- protected NetworkPolicy mapNetworkPolicy(AAIResultWrapper networkPolicyWrapper) {
- Optional<org.onap.aai.domain.yang.NetworkPolicy> 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<AAIResultWrapper> routeTableReferences,
- List<RouteTableReference> contrailNetworkRouteTableReferences) {
- for (AAIResultWrapper routeTableReferenceWrapper : routeTableReferences) {
- contrailNetworkRouteTableReferences.add(this.mapRouteTableReference(routeTableReferenceWrapper));
- }
- }
-
- protected RouteTableReference mapRouteTableReference(AAIResultWrapper routeTableReferenceWrapper) {
- Optional<org.onap.aai.domain.yang.RouteTableReference> 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<AAIResultWrapper> owningEntities, ServiceInstance serviceInstance) {
- if (!owningEntities.isEmpty()) {
- AAIResultWrapper owningEntityWrapper = owningEntities.get(0);
- Optional<org.onap.aai.domain.yang.OwningEntity> 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<AAIResultWrapper> projects, ServiceInstance serviceInstance) {
- if (!projects.isEmpty()) {
- AAIResultWrapper projectWrapper = projects.get(0);
- Optional<org.onap.aai.domain.yang.Project> 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;
- }
+ private static final Logger logger = LoggerFactory.getLogger(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 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";
+ private static final String PREPROV = "PREPROV";
+
+ @Autowired
+ private BBInputSetupUtils bbInputSetupUtils;
+
+ @Autowired
+ private BBInputSetupMapperLayer mapperLayer;
+
+ @Autowired
+ private CloudInfoFromAAI cloudInfoFromAAI;
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ private ObjectMapper mapper = new ObjectMapper();
+
+ public BBInputSetupUtils getBbInputSetupUtils() {
+ return bbInputSetupUtils;
+ }
+
+ public void setCloudInfoFromAAI(CloudInfoFromAAI cloudInfoFromAAI) {
+ this.cloudInfoFromAAI = cloudInfoFromAAI;
+ }
+
+ 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 = Boolean.TRUE.equals(executeBB.isaLaCarte());
+ boolean homing = Boolean.TRUE.equals(executeBB.isHoming());
+ Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ outputBB = this.getGBB(executeBB, lookupKeyMap, requestAction, aLaCarte, resourceId, vnfType);
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.enable(SerializationFeature.INDENT_OUTPUT);
+ logger.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) {
+ logger.error("Exception occurred", e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e.getMessage());
+ }
+ }
+
+ protected void setHomingFlag(GeneralBuildingBlock outputBB, boolean homing, Map<ResourceKey, String> 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<ResourceKey, String> 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);
+ }
+ if (requestDetails.getModelInfo() == null) {
+ return this.getGBBCM(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId);
+ } else {
+ 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<ResourceKey, String> 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());
+ lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, workflowResourceIds.getInstanceGroupId());
+ }
+
+ protected GeneralBuildingBlock getGBBALaCarteNonService(ExecuteBuildingBlock executeBB,
+ RequestDetails requestDetails, Map<ResourceKey, String> 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, executeBB.getBuildingBlock().getKey(),
+ executeBB.getConfigurationResourceKeys());
+ return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction,
+ null);
+ } else {
+ logger.debug("Related Service Instance from AAI: {}", aaiServiceInstance);
+ logger.debug("Related Service Instance Model Info from AAI: {}", service);
+ throw new Exception("Could not find relevant information for related Service Instance");
+ }
+ }
+
+ protected GeneralBuildingBlock getGBBCM(ExecuteBuildingBlock executeBB, RequestDetails requestDetails,
+ Map<ResourceKey, String> lookupKeyMap, String requestAction, String resourceId) throws Exception {
+ ServiceInstance serviceInstance = new ServiceInstance();
+ String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID);
+ serviceInstance.setServiceInstanceId(serviceInstanceId);
+ Customer customer = new Customer();
+ List<GenericVnf> genericVnfs = serviceInstance.getVnfs();
+
+ String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID);
+ if (vnfId != null) {
+ org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId);
+ GenericVnf genericVnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnf);
+ genericVnfs.add(genericVnf);
+ }
+
+ String instanceGroupId = lookupKeyMap.get(ResourceKey.INSTANCE_GROUP_ID);
+ if (instanceGroupId != null) {
+ org.onap.aai.domain.yang.InstanceGroup aaiInstancegroup =
+ bbInputSetupUtils.getAAIInstanceGroup(instanceGroupId);
+ InstanceGroup instanceGroup = this.mapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstancegroup);
+ instanceGroup.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+
+ if (serviceInstanceId == null) {
+ Optional<org.onap.aai.domain.yang.ServiceInstance> aaiServiceInstanceOpt =
+ bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup(instanceGroupId);
+ if (aaiServiceInstanceOpt.isPresent()) {
+ org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = aaiServiceInstanceOpt.get();
+ serviceInstance = this.mapperLayer.mapAAIServiceInstanceIntoServiceInstance(aaiServiceInstance);
+ WorkflowResourceIds workflowResourceIds = executeBB.getWorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, workflowResourceIds.getServiceInstanceId());
+ } else {
+ throw new NoServiceInstanceFoundException("Related ServiceInstance not found in A&AI.");
+ }
+ }
+ RelatedInstanceList[] relatedInstanceList = requestDetails.getRelatedInstanceList();
+ if (relatedInstanceList != null) {
+ for (RelatedInstanceList relatedInstList : relatedInstanceList) {
+ RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
+ if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) {
+ org.onap.aai.domain.yang.GenericVnf aaiVnf =
+ bbInputSetupUtils.getAAIGenericVnf(relatedInstance.getInstanceId());
+ GenericVnf vnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiVnf);
+ instanceGroup.getVnfs().add(vnf);
+ }
+ }
+ }
+
+ serviceInstance.getInstanceGroups().add(instanceGroup);
+ customer.setServiceSubscription(new ServiceSubscription());
+ }
+ return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction,
+ customer);
+ }
+
+ protected void populateObjectsOnAssignAndCreateFlows(RequestDetails requestDetails, Service service, String bbName,
+ ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String vnfType,
+ String configurationKey, ConfigurationResourceKeys configurationResourceKeys) throws Exception {
+ ModelInfo modelInfo = requestDetails.getModelInfo();
+ String instanceName = requestDetails.getRequestInfo().getInstanceName();
+ String productFamilyId = requestDetails.getRequestInfo().getProductFamilyId();
+ 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)) {
+ lookupKeyMap.put(ResourceKey.NETWORK_ID, resourceId);
+ this.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ null);
+ } else if (modelType.equals(ModelType.vnf)) {
+ lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, resourceId);
+ this.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance,
+ lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, productFamilyId);
+ } else if (modelType.equals(ModelType.volumeGroup)) {
+ lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, resourceId);
+ this.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ relatedInstanceList, instanceName, vnfType, null);
+ } else if (modelType.equals(ModelType.vfModule)) {
+ if (bbName.contains("Configuration")) {
+ String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID);
+ ModelInfo configurationModelInfo = new ModelInfo();
+ configurationModelInfo.setModelCustomizationUuid(configurationKey);
+ populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap,
+ configurationId, instanceName, configurationResourceKeys);
+ } else {
+ lookupKeyMap.put(ResourceKey.VF_MODULE_ID, resourceId);
+ this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ relatedInstanceList, instanceName, null, requestDetails.getCloudConfiguration());
+ }
+ } else if (modelType.equals(ModelType.instanceGroup)) {
+ lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, resourceId);
+ this.populateInstanceGroup(modelInfo, service, serviceInstance, resourceId, instanceName);
+ } else {
+ return;
+ }
+ }
+
+ protected void populateInstanceGroup(ModelInfo modelInfo, Service service, ServiceInstance serviceInstance,
+ String instanceGroupId, String instanceName) {
+ InstanceGroup instanceGroup = new InstanceGroup();
+ instanceGroup.setId(instanceGroupId);
+ instanceGroup.setInstanceGroupName(instanceName);
+ mapCatalogInstanceGroup(instanceGroup, modelInfo, service);
+ serviceInstance.getInstanceGroups().add(instanceGroup);
+ }
+
+ protected void mapCatalogInstanceGroup(InstanceGroup instanceGroup, ModelInfo modelInfo, Service service) {
+ // @TODO: this will populate the instanceGroup model info.
+ // Dependent on MSO-5821 653458 US - MSO - Enhance Catalog DB Schema & Adapter to support VNF Groups
+ }
+
+ protected void populateConfiguration(ModelInfo modelInfo, Service service, String bbName,
+ ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId,
+ String instanceName, ConfigurationResourceKeys configurationResourceKeys) {
+ Configuration configuration = null;
+ for (Configuration configurationTemp : serviceInstance.getConfigurations()) {
+ if (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null && configurationTemp.getConfigurationId()
+ .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) {
+ configuration = configurationTemp;
+ org.onap.aai.domain.yang.Configuration aaiConfiguration =
+ bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId());
+ if (aaiConfiguration != null) {
+ modelInfo.setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId());
+ }
+ }
+ }
+ if (configuration == null && bbName.equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())) {
+ configuration = this.createConfiguration(lookupKeyMap, instanceName, resourceId);
+ serviceInstance.getConfigurations().add(configuration);
+ }
+ if (configuration != null) {
+ Vnfc vnfc = getVnfcToConfiguration(configurationResourceKeys.getVnfcName());
+ configuration.setVnfc(vnfc);
+ this.mapCatalogConfiguration(configuration, modelInfo, service, configurationResourceKeys);
+ }
+ }
+
+ protected Vnfc getVnfcToConfiguration(String vnfcName) {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName);
+ Optional<org.onap.aai.domain.yang.Vnfc> vnfcOp =
+ bbInputSetupUtils.getAAIResourceDepthOne(uri).asBean(org.onap.aai.domain.yang.Vnfc.class);
+ if (vnfcOp.isPresent()) {
+ org.onap.aai.domain.yang.Vnfc vnfcAAI = vnfcOp.get();
+ return this.mapperLayer.mapAAIVnfc(vnfcAAI);
+ } else {
+ return null;
+ }
+ }
+
+ protected Configuration createConfiguration(Map<ResourceKey, String> 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,
+ ConfigurationResourceKeys configurationResourceKeys) {
+ ConfigurationResourceCustomization configurationResourceCustomization =
+ findConfigurationResourceCustomization(modelInfo, service);
+ CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization =
+ findVnfVfmoduleCvnfcConfigurationCustomization(service.getModelUUID(),
+ configurationResourceKeys.getVfModuleCustomizationUUID(),
+ configurationResourceKeys.getVnfResourceCustomizationUUID(),
+ configurationResourceKeys.getCvnfcCustomizationUUID(), configurationResourceCustomization);
+ if (configurationResourceCustomization != null && vnfVfmoduleCvnfcConfigurationCustomization != null) {
+ configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(
+ configurationResourceCustomization, vnfVfmoduleCvnfcConfigurationCustomization));
+ } else {
+ logger.debug("for Fabric configuration mapping by VF MODULE CUST UUID: "
+ + configurationResourceKeys.getVfModuleCustomizationUUID());
+ vnfVfmoduleCvnfcConfigurationCustomization = findVnfVfmoduleCvnfcConfigurationCustomization(
+ service.getModelUUID(), configurationResourceKeys.getVnfResourceCustomizationUUID(),
+ configurationResourceKeys.getVfModuleCustomizationUUID(),
+ configurationResourceKeys.getCvnfcCustomizationUUID());
+ if (vnfVfmoduleCvnfcConfigurationCustomization != null) {
+ configuration.setModelInfoConfiguration(this.mapperLayer
+ .mapCatalogConfigurationToConfiguration(vnfVfmoduleCvnfcConfigurationCustomization));
+ }
+ }
+ }
+
+ protected CvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String serviceModelUUID,
+ String vfModuleCustomizationUUID, String vnfResourceCustomizationUUID, String cvnfcCustomizationUUID,
+ ConfigurationResourceCustomization configurationResourceCustomization) {
+ return bbInputSetupUtils.getCvnfcConfigurationCustomization(serviceModelUUID, vnfResourceCustomizationUUID,
+ vfModuleCustomizationUUID, cvnfcCustomizationUUID);
+ }
+
+ protected ConfigurationResourceCustomization findConfigurationResourceCustomization(ModelInfo modelInfo,
+ Service service) {
+ for (ConfigurationResourceCustomization resourceCust : service.getConfigurationCustomizations()) {
+ if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) {
+ return resourceCust;
+ }
+ }
+ return null;
+ }
+
+ protected CvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String serviceModelUUID,
+ String vnfResourceCustomizationUUID, String vfModuleCustomizationUUID, String cvnfcCustomizationUUID) {
+ return bbInputSetupUtils.getCvnfcConfigurationCustomization(serviceModelUUID, vnfResourceCustomizationUUID,
+ vfModuleCustomizationUUID, cvnfcCustomizationUUID);
+ }
+
+ protected void populateVfModule(ModelInfo modelInfo, Service service, String bbName,
+ ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId,
+ RelatedInstanceList[] relatedInstanceList, String instanceName, List<Map<String, String>> instanceParams,
+ CloudConfiguration cloudConfiguration) throws Exception {
+ 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);
+ Optional<String> volumeGroupIdOp = getVolumeGroupIdRelatedToVfModule(tempVnf, modelInfo,
+ cloudConfiguration.getCloudOwner(), cloudConfiguration.getLcpCloudRegionId(), lookupKeyMap);
+ if (volumeGroupIdOp.isPresent()) {
+ lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupIdOp.get());
+ }
+ break;
+ }
+ }
+ if (vnf != null) {
+ VfModule vfModule = null;
+ for (VfModule vfModuleTemp : vnf.getVfModules()) {
+ if (lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null
+ && vfModuleTemp.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) {
+ vfModule = vfModuleTemp;
+ }
+ String vfModuleCustId = bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModuleTemp.getVfModuleId())
+ .getModelCustomizationId();
+ ModelInfo modelInfoVfModule = new ModelInfo();
+ modelInfoVfModule.setModelCustomizationId(vfModuleCustId);
+ mapCatalogVfModule(vfModuleTemp, modelInfoVfModule, service, vnfModelCustomizationUUID);
+ }
+ if (vfModule == null && bbName.equalsIgnoreCase(AssignFlows.VF_MODULE.toString())) {
+ vfModule = createVfModule(lookupKeyMap, resourceId, instanceName, instanceParams);
+ vnf.getVfModules().add(vfModule);
+ mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID);
+ }
+ } else {
+ logger.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 Optional<String> getVolumeGroupIdRelatedToVfModule(GenericVnf vnf, ModelInfo modelInfo, String cloudOwner,
+ String cloudRegionId, Map<ResourceKey, String> lookupKeyMap) {
+ if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) == null) {
+ for (VolumeGroup volumeGroup : vnf.getVolumeGroups()) {
+ String volumeGroupCustId =
+ bbInputSetupUtils.getAAIVolumeGroup(cloudOwner, cloudRegionId, volumeGroup.getVolumeGroupId())
+ .getModelCustomizationId();
+ if (modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) {
+ return Optional.of(volumeGroup.getVolumeGroupId());
+ }
+ }
+ }
+ return Optional.empty();
+ }
+
+ 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<ResourceKey, String> lookupKeyMap, String vfModuleId, String instanceName,
+ List<Map<String, String>> 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<String, String> params : instanceParams) {
+ vfModule.getCloudParams().putAll(params);
+ }
+ }
+ return vfModule;
+ }
+
+ protected void populateVolumeGroup(ModelInfo modelInfo, Service service, String bbName,
+ ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId,
+ RelatedInstanceList[] relatedInstanceList, String instanceName, String vnfType,
+ List<Map<String, String>> instanceParams) throws Exception {
+ VolumeGroup volumeGroup = null;
+ GenericVnf vnf = null;
+ String vnfModelCustomizationUUID = null;
+ String generatedVnfType = vnfType;
+ if (generatedVnfType == null || generatedVnfType.isEmpty()) {
+ generatedVnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName();
+ }
+ if (relatedInstanceList != null) {
+ for (RelatedInstanceList relatedInstList : relatedInstanceList) {
+ RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
+ if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) {
+ vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationUuid();
+ break;
+ }
+ }
+ }
+ for (GenericVnf tempVnf : serviceInstance.getVnfs()) {
+ if (tempVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) {
+ vnf = tempVnf;
+ vnfModelCustomizationUUID =
+ bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId();
+ ModelInfo vnfModelInfo = new ModelInfo();
+ vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
+ mapCatalogVnf(tempVnf, vnfModelInfo, service);
+ break;
+ }
+ }
+ if (vnf != null && vnfModelCustomizationUUID != null) {
+ for (VolumeGroup volumeGroupTemp : vnf.getVolumeGroups()) {
+ if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) != null && volumeGroupTemp.getVolumeGroupId()
+ .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID))) {
+ volumeGroup = volumeGroupTemp;
+ break;
+ }
+ }
+ if (volumeGroup == null && bbName.equalsIgnoreCase(AssignFlows.VOLUME_GROUP.toString())) {
+ volumeGroup =
+ createVolumeGroup(lookupKeyMap, resourceId, instanceName, generatedVnfType, instanceParams);
+ vnf.getVolumeGroups().add(volumeGroup);
+ }
+ if (volumeGroup != null) {
+ mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID);
+ }
+ } else {
+ logger.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<ResourceKey, String> lookupKeyMap, String volumeGroupId,
+ String instanceName, String vnfType, List<Map<String, String>> 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<String, String> 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<ResourceKey, String> lookupKeyMap,
+ RelatedInstanceList[] relatedInstanceList, String resourceId, String vnfType,
+ List<Map<String, String>> instanceParams, String productFamilyId) {
+ GenericVnf vnf = null;
+ ModelInfo instanceGroupModelInfo = null;
+ String instanceGroupId = null;
+ String generatedVnfType = vnfType;
+ if (generatedVnfType == null || generatedVnfType.isEmpty()) {
+ generatedVnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName();
+ }
+ if (relatedInstanceList != null) {
+ for (RelatedInstanceList relatedInstList : relatedInstanceList) {
+ RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
+ if (relatedInstance.getModelInfo().getModelType().equals(ModelType.networkInstanceGroup)) {
+ instanceGroupModelInfo = relatedInstance.getModelInfo();
+ instanceGroupId = relatedInstance.getInstanceId();
+ }
+ }
+ }
+ for (GenericVnf vnfTemp : serviceInstance.getVnfs()) {
+ if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null
+ && vnfTemp.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) {
+ String vnfModelCustId =
+ bbInputSetupUtils.getAAIGenericVnf(vnfTemp.getVnfId()).getModelCustomizationId();
+ modelInfo.setModelCustomizationUuid(vnfModelCustId);
+ vnf = vnfTemp;
+ break;
+ }
+ }
+ if (vnf == null && bbName.equalsIgnoreCase(AssignFlows.VNF.toString())) {
+ vnf = createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, resourceId, generatedVnfType,
+ instanceParams, productFamilyId);
+ serviceInstance.getVnfs().add(vnf);
+ mapVnfcCollectionInstanceGroup(vnf, modelInfo, service);
+ }
+ if (vnf != null) {
+ mapCatalogVnf(vnf, modelInfo, service);
+ if (instanceGroupId != null && instanceGroupModelInfo != null
+ && instanceGroupModelInfo.getModelType().equals(ModelType.networkInstanceGroup)
+ && !instanceGroupInList(vnf, instanceGroupId)) {
+ mapNetworkCollectionInstanceGroup(vnf, instanceGroupId);
+ }
+ }
+ }
+
+ protected boolean instanceGroupInList(GenericVnf vnf, String instanceGroupId) {
+ for (InstanceGroup instanceGroup : vnf.getInstanceGroups()) {
+ if (instanceGroup.getId() != null && instanceGroup.getId().equalsIgnoreCase(instanceGroupId)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected void mapVnfcCollectionInstanceGroup(GenericVnf genericVnf, ModelInfo modelInfo, Service service) {
+ VnfResourceCustomization vnfResourceCustomization = getVnfResourceCustomizationFromService(modelInfo, service);
+ if (vnfResourceCustomization != null) {
+ List<VnfcInstanceGroupCustomization> vnfcInstanceGroups =
+ vnfResourceCustomization.getVnfcInstanceGroupCustomizations();
+ for (VnfcInstanceGroupCustomization vnfcInstanceGroupCust : vnfcInstanceGroups) {
+ InstanceGroup instanceGroup = this.createInstanceGroup();
+ org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = bbInputSetupUtils
+ .getCatalogInstanceGroup(vnfcInstanceGroupCust.getInstanceGroup().getModelUUID());
+ instanceGroup.setModelInfoInstanceGroup(
+ this.mapperLayer.mapCatalogInstanceGroupToInstanceGroup(null, catalogInstanceGroup));
+ 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 =
+ 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<ResourceKey, String> lookupKeyMap, String instanceName,
+ org.onap.so.serviceinstancebeans.Platform platform,
+ org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness, String vnfId, String vnfType,
+ List<Map<String, String>> instanceParams, String productFamilyId) {
+ lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfId);
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId(vnfId);
+ genericVnf.setVnfName(instanceName);
+ genericVnf.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ genericVnf.setVnfType(vnfType);
+ genericVnf.setProvStatus(PREPROV);
+ genericVnf.setServiceId(productFamilyId);
+ if (platform != null) {
+ genericVnf.setPlatform(this.mapperLayer.mapRequestPlatform(platform));
+ }
+ if (lineOfBusiness != null) {
+ genericVnf.setLineOfBusiness(this.mapperLayer.mapRequestLineOfBusiness(lineOfBusiness));
+ }
+ if (instanceParams != null) {
+ for (Map<String, String> 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<ResourceKey, String> lookupKeyMap, String resourceId,
+ List<Map<String, String>> instanceParams) {
+ L3Network network = null;
+ for (L3Network networkTemp : serviceInstance.getNetworks()) {
+ if (lookupKeyMap.get(ResourceKey.NETWORK_ID) != null
+ && networkTemp.getNetworkId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.NETWORK_ID))) {
+ network = networkTemp;
+ break;
+ }
+ }
+ if (network == null && (bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString())
+ || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) {
+ network = createNetwork(lookupKeyMap, instanceName, resourceId, instanceParams);
+ serviceInstance.getNetworks().add(network);
+ }
+ if (network != null) {
+ mapCatalogNetwork(network, modelInfo, service);
+ }
+ }
+
+ protected L3Network createNetwork(Map<ResourceKey, String> lookupKeyMap, String instanceName, String networkId,
+ List<Map<String, String>> 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<String, String> 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<ResourceKey, String> 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, Boolean.TRUE.equals(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<String, String> 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<String, String> 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)
+ throws Exception {
+ 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());
+ CloudRegion cloudRegion = mapperLayer.mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion);
+ Tenant tenant = getTenant(requestDetails.getCloudConfiguration(), aaiCloudRegion);
+ outputBB.setOrchContext(orchContext);
+ outputBB.setRequestContext(requestContext);
+ outputBB.setCloudRegion(cloudRegion);
+ outputBB.setTenant(tenant);
+ if (customer == null) {
+ Map<String, String> 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);
+ if (customer.getServiceSubscription() != null) {
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ }
+ outputBB.setCustomer(customer);
+ return outputBB;
+ }
+
+ protected Tenant getTenant(CloudConfiguration cloudConfiguration,
+ org.onap.aai.domain.yang.CloudRegion aaiCloudRegion) throws Exception {
+ Tenant tenant = new Tenant();
+ if (cloudConfiguration != null && cloudConfiguration.getTenantId() != null && aaiCloudRegion != null
+ && aaiCloudRegion.getTenants() != null) {
+ for (org.onap.aai.domain.yang.Tenant aaiTenant : aaiCloudRegion.getTenants().getTenant()) {
+ if (aaiTenant.getTenantId().equalsIgnoreCase(cloudConfiguration.getTenantId())) {
+ tenant = mapperLayer.mapTenant(aaiTenant);
+ }
+ }
+ if (tenant.getTenantId() == null || tenant.getTenantName() == null) {
+ throw new Exception("Invalid tenant information retrieved: tenantId = " + tenant.getTenantId()
+ + " tenantName = " + tenant.getTenantName());
+ }
+ }
+ return tenant;
+ }
+
+ 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<ResourceKey, String> 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 = null;
+ if (customer != null && customer.getServiceSubscription() != null) {
+ serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(customer.getGlobalCustomerId(),
+ customer.getServiceSubscription().getServiceType(), serviceInstanceId);
+ } else {
+ serviceInstanceAAI = 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<ResourceKey, String> lookupKeyMap, String requestAction, String resourceId, String vnfType)
+ throws Exception {
+ String bbName = executeBB.getBuildingBlock().getBpmnFlowName();
+ String key = executeBB.getBuildingBlock().getKey();
+
+ if (requestAction.equalsIgnoreCase("deleteInstance") || requestAction.equalsIgnoreCase("unassignInstance")
+ || requestAction.equalsIgnoreCase("activateInstance")
+ || requestAction.equalsIgnoreCase("activateFabricConfiguration")
+ || requestAction.equalsIgnoreCase("recreateInstance")
+ || requestAction.equalsIgnoreCase("replaceInstance")) {
+ return getGBBMacroExistingService(executeBB, lookupKeyMap, bbName, requestAction,
+ requestDetails.getCloudConfiguration());
+ }
+
+ String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID);
+ GeneralBuildingBlock gBB =
+ this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, serviceInstanceId);
+ 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<String, Object> 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 {
+ throw new IllegalArgumentException(
+ "No user params on requestAction: assignInstance. Please specify user params.");
+ }
+ }
+
+ protected GeneralBuildingBlock getGBBMacroNoUserParamsCreate(ExecuteBuildingBlock executeBB,
+ Map<ResourceKey, String> 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 ((!Boolean.TRUE.equals(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 {
+ logger.debug("Could not find a network customization with key: {}", key);
+ }
+ } else {
+ logger.debug("Orchestrating on Collection Network Resource Customization");
+ CollectionNetworkResourceCustomization collectionNetworkResourceCust =
+ bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key);
+ L3Network l3Network = getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId,
+ collectionNetworkResourceCust, serviceInstance);
+ NetworkResourceCustomization networkResourceCustomization = mapperLayer
+ .mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust);
+ if (l3Network != null) {
+ l3Network.setModelInfoNetwork(mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization));
+ }
+ }
+ } else if (bbName.contains("Configuration")) {
+ String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID);
+ ModelInfo configurationModelInfo = new ModelInfo();
+ configurationModelInfo.setModelCustomizationUuid(key);
+ this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap,
+ configurationId, null, executeBB.getConfigurationResourceKeys());
+ }
+ if (executeBB.getWorkflowResourceIds() != null) {
+ this.populateNetworkCollectionAndInstanceGroupAssign(service, bbName, serviceInstance,
+ executeBB.getWorkflowResourceIds().getNetworkCollectionId(), key);
+ }
+ return gBB;
+ }
+
+ protected L3Network getVirtualLinkL3Network(Map<ResourceKey, String> lookupKeyMap, String bbName, String key,
+ String networkId, CollectionNetworkResourceCustomization collectionNetworkResourceCust,
+ ServiceInstance serviceInstance) {
+ if (collectionNetworkResourceCust != null) {
+ if ((bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString())
+ || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) {
+ L3Network network = createNetwork(lookupKeyMap, null, networkId, null);
+ serviceInstance.getNetworks().add(network);
+ return network;
+ } else {
+ for (L3Network network : serviceInstance.getNetworks()) {
+ if (network.getNetworkId().equalsIgnoreCase(networkId)) {
+ return network;
+ }
+ }
+ }
+ }
+ 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<ResourceKey, String> lookupKeyMap, String bbName, String requestAction,
+ CloudConfiguration cloudConfiguration) throws Exception {
+ org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null;
+ String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID);
+ RequestDetails requestDetails = executeBB.getRequestDetails();
+ GeneralBuildingBlock gBB = 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));
+ gBB = populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null);
+ } else {
+ logger.debug("Related Service Instance from AAI: {}", aaiServiceInstance);
+ logger.debug("Related Service Instance Model Info from AAI: {}", service);
+ throw new Exception("Could not find relevant information for related Service Instance");
+ }
+ ServiceInstance serviceInstance = gBB.getServiceInstance();
+ CloudRegion cloudRegion = null;
+ if (cloudConfiguration == null) {
+ Optional<CloudRegion> cloudRegionOp = cloudInfoFromAAI.getCloudInfoFromAAI(serviceInstance);
+ if (cloudRegionOp.isPresent()) {
+ cloudRegion = cloudRegionOp.get();
+ }
+ }
+ if (cloudConfiguration != null) {
+ org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration);
+ cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion);
+ }
+ 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);
+ if (cloudRegion != null) {
+ Optional<String> volumeGroupIdOp = getVolumeGroupIdRelatedToVfModule(vnf, vfModuleModelInfo,
+ cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), lookupKeyMap);
+ if (volumeGroupIdOp.isPresent()) {
+ lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupIdOp.get());
+ }
+ }
+ 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 (cloudRegion != null) {
+ String volumeGroupCustomizationUUID =
+ this.bbInputSetupUtils
+ .getAAIVolumeGroup(cloudRegion.getCloudOwner(),
+ cloudRegion.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,
+ executeBB.getConfigurationResourceKeys());
+ 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<ResourceKey, String> 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);
+ }
+ String productFamilyId = requestDetails.getRequestInfo().getProductFamilyId();
+ this.populateGenericVnf(vnfs.getModelInfo(), vnfs.getInstanceName(), vnfs.getPlatform(),
+ vnfs.getLineOfBusiness(), service, bbName, serviceInstance, lookupKeyMap, null, vnfId, vnfType,
+ vnfs.getInstanceParams(), productFamilyId);
+ } else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP)) {
+ Pair<Vnfs, VfModules> 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());
+ cloudConfig.setCloudOwner(cloudRegion.getCloudOwner());
+ 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, executeBB.getConfigurationResourceKeys());
+ } else {
+ logger.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<Vnfs, VfModules> 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>(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);
+ return mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion);
+ } else {
+ logger.debug("Could not find any cloud configuration for this request.");
+ return null;
+ }
+ }
+
+ protected String getVnfId(ExecuteBuildingBlock executeBB, Map<ResourceKey, String> 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<ResourceKey, String> 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) {
+ if (customer != null && customer.getServiceSubscription() != null) {
+ serviceInstanceAAI =
+ bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(customer.getGlobalCustomerId(),
+ customer.getServiceSubscription().getServiceType(), serviceInstanceId);
+ } else {
+ 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<ResourceKey, String> 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<Relationships> 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<AAIResourceUri> relatedAAIUris, List<Configuration> configurations) {
+ for (AAIResourceUri aaiResourceUri : relatedAAIUris) {
+ configurations.add(mapConfiguration(aaiResourceUri));
+ }
+ }
+
+ protected Configuration mapConfiguration(AAIResourceUri aaiResourceUri) {
+ AAIResultWrapper aaiConfigurationWrapper = this.bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri);
+ Optional<org.onap.aai.domain.yang.Configuration> 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<AAIResourceUri> list, List<GenericVnf> genericVnfs) {
+ for (AAIResourceUri aaiResourceUri : list) {
+ genericVnfs.add(this.mapGenericVnf(aaiResourceUri));
+ }
+ }
+
+ protected GenericVnf mapGenericVnf(AAIResourceUri aaiResourceUri) {
+ AAIResultWrapper aaiGenericVnfWrapper = this.bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri);
+ Optional<org.onap.aai.domain.yang.GenericVnf> aaiGenericVnfOp =
+ aaiGenericVnfWrapper.asBean(org.onap.aai.domain.yang.GenericVnf.class);
+ if (!aaiGenericVnfOp.isPresent()) {
+ return null;
+ }
+
+ GenericVnf genericVnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnfOp.get());
+
+ Optional<Relationships> 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<InstanceGroup> mapInstanceGroups(List<AAIResultWrapper> instanceGroups) {
+ List<InstanceGroup> instanceGroupsList = new ArrayList<>();
+ for (AAIResultWrapper volumeGroupWrapper : instanceGroups) {
+ instanceGroupsList.add(this.mapInstanceGroup(volumeGroupWrapper));
+ }
+ return instanceGroupsList;
+ }
+
+ protected InstanceGroup mapInstanceGroup(AAIResultWrapper instanceGroupWrapper) {
+ Optional<org.onap.aai.domain.yang.InstanceGroup> 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<VolumeGroup> mapVolumeGroups(List<AAIResultWrapper> volumeGroups) {
+ List<VolumeGroup> volumeGroupsList = new ArrayList<>();
+ for (AAIResultWrapper volumeGroupWrapper : volumeGroups) {
+ volumeGroupsList.add(this.mapVolumeGroup(volumeGroupWrapper));
+ }
+ return volumeGroupsList;
+ }
+
+ protected VolumeGroup mapVolumeGroup(AAIResultWrapper volumeGroupWrapper) {
+ Optional<org.onap.aai.domain.yang.VolumeGroup> 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<AAIResultWrapper> lineOfBusinesses, GenericVnf genericVnf) {
+ if (!lineOfBusinesses.isEmpty()) {
+ AAIResultWrapper lineOfBusinessWrapper = lineOfBusinesses.get(0);
+ Optional<org.onap.aai.domain.yang.LineOfBusiness> 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<AAIResultWrapper> platforms, GenericVnf genericVnf) {
+ if (!platforms.isEmpty()) {
+ AAIResultWrapper platformWrapper = platforms.get(0);
+ Optional<org.onap.aai.domain.yang.Platform> 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<AAIResultWrapper> collections, ServiceInstance serviceInstance) {
+ if (!collections.isEmpty()) {
+ AAIResultWrapper collectionWrapper = collections.get(0);
+ Optional<org.onap.aai.domain.yang.Collection> 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);
+ NetworkCollectionResourceCustomization collectionResourceCust = bbInputSetupUtils
+ .getCatalogNetworkCollectionResourceCustByID(aaiCollection.getCollectionCustomizationId());
+ collection.setModelInfoCollection(mapperLayer.mapCatalogCollectionToCollection(collectionResourceCust,
+ collectionResourceCust.getCollectionResource()));
+ Optional<Relationships> relationshipsOp = collectionWrapper.getRelationships();
+ Relationships relationships = null;
+ if (relationshipsOp.isPresent()) {
+ relationships = relationshipsOp.get();
+ } else {
+ serviceInstance.setCollection(collection);
+ return;
+ }
+ List<InstanceGroup> instanceGroupsList =
+ mapInstanceGroups(relationships.getByType(AAIObjectType.INSTANCE_GROUP));
+ if (!instanceGroupsList.isEmpty()) {
+ collection.setInstanceGroup(instanceGroupsList.get(0));
+ }
+ serviceInstance.setCollection(collection);
+ }
+ }
+
+ protected void mapL3Networks(List<AAIResourceUri> list, List<L3Network> l3Networks) {
+ for (AAIResourceUri aaiResourceUri : list) {
+ l3Networks.add(this.mapL3Network(aaiResourceUri));
+ }
+ }
+
+ protected L3Network mapL3Network(AAIResourceUri aaiResourceUri) {
+ AAIResultWrapper aaiNetworkWrapper = this.bbInputSetupUtils.getAAIResourceDepthTwo(aaiResourceUri);
+ Optional<org.onap.aai.domain.yang.L3Network> 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<Relationships> relationshipsOp = aaiNetworkWrapper.getRelationships();
+ if (relationshipsOp.isPresent()) {
+ Relationships relationships = relationshipsOp.get();
+ this.mapNetworkPolicies(relationships.getByType(AAIObjectType.NETWORK_POLICY),
+ network.getNetworkPolicies());
+ mapRouteTableReferences(relationships.getByType(AAIObjectType.ROUTE_TABLE_REFERENCE),
+ network.getContrailNetworkRouteTableReferences());
+ }
+
+ return network;
+ }
+
+ protected void mapNetworkPolicies(List<AAIResultWrapper> aaiNetworkPolicies, List<NetworkPolicy> networkPolicies) {
+ for (AAIResultWrapper networkPolicyWrapper : aaiNetworkPolicies) {
+ networkPolicies.add(this.mapNetworkPolicy(networkPolicyWrapper));
+ }
+ }
+
+ protected NetworkPolicy mapNetworkPolicy(AAIResultWrapper networkPolicyWrapper) {
+ Optional<org.onap.aai.domain.yang.NetworkPolicy> 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<AAIResultWrapper> routeTableReferences,
+ List<RouteTableReference> contrailNetworkRouteTableReferences) {
+ for (AAIResultWrapper routeTableReferenceWrapper : routeTableReferences) {
+ contrailNetworkRouteTableReferences.add(this.mapRouteTableReference(routeTableReferenceWrapper));
+ }
+ }
+
+ protected RouteTableReference mapRouteTableReference(AAIResultWrapper routeTableReferenceWrapper) {
+ Optional<org.onap.aai.domain.yang.RouteTableReference> 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<AAIResultWrapper> owningEntities, ServiceInstance serviceInstance) {
+ if (!owningEntities.isEmpty()) {
+ AAIResultWrapper owningEntityWrapper = owningEntities.get(0);
+ Optional<org.onap.aai.domain.yang.OwningEntity> 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<AAIResultWrapper> projects, ServiceInstance serviceInstance) {
+ if (!projects.isEmpty()) {
+ AAIResultWrapper projectWrapper = projects.get(0);
+ Optional<org.onap.aai.domain.yang.Project> 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
index d8c80ced75..177c918305 100644
--- 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
@@ -28,7 +28,6 @@ import java.util.HashMap;
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;
@@ -90,432 +89,443 @@ import org.springframework.stereotype.Component;
@Component("BBInputSetupMapperLayer")
public class BBInputSetupMapperLayer {
- private static final String USER_PARAM_NAME_KEY = "name";
+ private static final String USER_PARAM_NAME_KEY = "name";
private static final String USER_PARAM_VALUE_KEY = "value";
- private static final Logger logger = LoggerFactory.getLogger(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()));
-
- ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
- modelInfoVfModule.setIsBaseBoolean(aaiVfModule.isIsBaseVfModule());
- vfModule.setModelInfoVfModule(modelInfoVfModule);
- 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<ResourceKey, String> 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() != null && instanceGroup.getType().equals(InstanceGroupType.L3_NETWORK))
- modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_L3_NETWORK);
- else
- modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_VNFC);
- if(collectionCust != null) {
- List<CollectionResourceInstanceGroupCustomization> 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());
- modelInfoCollection.setModelCustomizationUUID(collectionCust.getModelCustomizationUUID());
- 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<OrchestrationStatus> 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()));
- context.setUserParams(this.mapNameValueUserParams(requestDetails.getRequestParameters()));
- }
- if (requestDetails.getConfigurationParameters() != null) {
- context.setConfigurationParameters(requestDetails.getConfigurationParameters());
- }
- return context;
- }
-
- protected RequestParameters mapRequestParameters(org.onap.so.serviceinstancebeans.RequestParameters requestParameters) {
- RequestParameters requestParams = new RequestParameters();
- requestParams.setaLaCarte(requestParameters.getALaCarte());
- requestParams.setUsePreload(requestParameters.getUsePreload());
- requestParams.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType());
- requestParams.setUserParams(requestParameters.getUserParams());
- requestParams.setPayload(requestParameters.getPayload());
- return requestParams;
- }
-
- protected Map<String,Object> mapNameValueUserParams(org.onap.so.serviceinstancebeans.RequestParameters requestParameters) {
- Map<String,Object> userParamsResult = new HashMap<String,Object>();
- if (requestParameters.getUserParams() != null) {
- List<Map<String, Object>> userParams = requestParameters.getUserParams();
- for (Map<String, Object> userParamsMap : userParams) {
- if ( userParamsMap.containsKey(USER_PARAM_NAME_KEY) && (userParamsMap.get(USER_PARAM_NAME_KEY) instanceof String)
- && userParamsMap.containsKey(USER_PARAM_VALUE_KEY)) {
- userParamsResult.put((String) userParamsMap.get(USER_PARAM_NAME_KEY), userParamsMap.get(USER_PARAM_VALUE_KEY));
- }
- }
- }
- return userParamsResult;
- }
-
- 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) {
- CloudRegion cloudRegion = new CloudRegion();
- if(cloudConfiguration != null)
- cloudRegion = modelMapper.map(cloudConfiguration, CloudRegion.class);
- if(aaiCloudRegion != null)
- modelMapper.map(aaiCloudRegion, cloudRegion);
- return cloudRegion;
- }
-
- protected Tenant mapTenant(org.onap.aai.domain.yang.Tenant aaiTenant) {
- Tenant tenant = new Tenant();
- if(aaiTenant != null) {
- modelMapper.map(aaiTenant, tenant);
- }
- return tenant;
- }
-
- 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<Evc> mapAllEvcs(org.onap.aai.domain.yang.Configuration configurationAAI) {
- List<Evc> 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<ForwarderEvc> mapAllForwarderEvcs(org.onap.aai.domain.yang.Configuration configurationAAI) {
- List<ForwarderEvc> 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,
- CvnfcConfigurationCustomization cvnfcConfigurationCustomization) {
- ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
- modelInfoConfiguration.setModelVersionId(configurationResourceCustomization.getConfigurationResource().getModelUUID());
- modelInfoConfiguration.setModelCustomizationId(configurationResourceCustomization.getModelCustomizationUUID());
- modelInfoConfiguration.setModelInvariantId(configurationResourceCustomization.getConfigurationResource().getModelInvariantUUID());
- modelInfoConfiguration.setPolicyName(cvnfcConfigurationCustomization.getPolicyName());
- return modelInfoConfiguration;
- }
-
- protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration(
- CvnfcConfigurationCustomization cvnfcConfigurationCustomization) {
- ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
- modelInfoConfiguration.setModelVersionId(cvnfcConfigurationCustomization.getConfigurationResource().getModelUUID());
- modelInfoConfiguration.setModelCustomizationId(cvnfcConfigurationCustomization.getModelCustomizationUUID());
- modelInfoConfiguration.setModelInvariantId(cvnfcConfigurationCustomization.getConfigurationResource().getModelInvariantUUID());
- modelInfoConfiguration.setPolicyName(cvnfcConfigurationCustomization.getPolicyName());
- modelInfoConfiguration.setConfigurationType(cvnfcConfigurationCustomization.getConfigurationType());
- modelInfoConfiguration.setConfigurationRole(cvnfcConfigurationCustomization.getConfigurationRole());
- return modelInfoConfiguration;
- }
-
- public NetworkResourceCustomization mapCollectionNetworkResourceCustToNetworkResourceCust(
- CollectionNetworkResourceCustomization collectionNetworkResourceCust) {
- return modelMapper.map(collectionNetworkResourceCust, NetworkResourceCustomization.class);
- }
-
- public Vnfc mapAAIVnfc(org.onap.aai.domain.yang.Vnfc vnfcAAI) {
- return modelMapper.map(vnfcAAI, Vnfc.class);
- }
+ private static final Logger logger = LoggerFactory.getLogger(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()));
+
+ ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
+ modelInfoVfModule.setIsBaseBoolean(aaiVfModule.isIsBaseVfModule());
+ vfModule.setModelInfoVfModule(modelInfoVfModule);
+ 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<ResourceKey, String> 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() != null && instanceGroup.getType().equals(InstanceGroupType.L3_NETWORK))
+ modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_L3_NETWORK);
+ else
+ modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_VNFC);
+ if (collectionCust != null) {
+ List<CollectionResourceInstanceGroupCustomization> 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());
+ modelInfoCollection.setModelCustomizationUUID(collectionCust.getModelCustomizationUUID());
+ 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<OrchestrationStatus> 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()));
+ context.setUserParams(this.mapNameValueUserParams(requestDetails.getRequestParameters()));
+ }
+ if (requestDetails.getConfigurationParameters() != null) {
+ context.setConfigurationParameters(requestDetails.getConfigurationParameters());
+ }
+ return context;
+ }
+
+ protected RequestParameters mapRequestParameters(
+ org.onap.so.serviceinstancebeans.RequestParameters requestParameters) {
+ RequestParameters requestParams = new RequestParameters();
+ requestParams.setaLaCarte(requestParameters.getALaCarte());
+ requestParams.setUsePreload(requestParameters.getUsePreload());
+ requestParams.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType());
+ requestParams.setUserParams(requestParameters.getUserParams());
+ requestParams.setPayload(requestParameters.getPayload());
+ return requestParams;
+ }
+
+ protected Map<String, Object> mapNameValueUserParams(
+ org.onap.so.serviceinstancebeans.RequestParameters requestParameters) {
+ Map<String, Object> userParamsResult = new HashMap<String, Object>();
+ if (requestParameters.getUserParams() != null) {
+ List<Map<String, Object>> userParams = requestParameters.getUserParams();
+ for (Map<String, Object> userParamsMap : userParams) {
+ if (userParamsMap.containsKey(USER_PARAM_NAME_KEY)
+ && (userParamsMap.get(USER_PARAM_NAME_KEY) instanceof String)
+ && userParamsMap.containsKey(USER_PARAM_VALUE_KEY)) {
+ userParamsResult.put((String) userParamsMap.get(USER_PARAM_NAME_KEY),
+ userParamsMap.get(USER_PARAM_VALUE_KEY));
+ }
+ }
+ }
+ return userParamsResult;
+ }
+
+ 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) {
+ CloudRegion cloudRegion = new CloudRegion();
+ if (cloudConfiguration != null)
+ cloudRegion = modelMapper.map(cloudConfiguration, CloudRegion.class);
+ if (aaiCloudRegion != null)
+ modelMapper.map(aaiCloudRegion, cloudRegion);
+ return cloudRegion;
+ }
+
+ protected Tenant mapTenant(org.onap.aai.domain.yang.Tenant aaiTenant) {
+ Tenant tenant = new Tenant();
+ if (aaiTenant != null) {
+ modelMapper.map(aaiTenant, tenant);
+ }
+ return tenant;
+ }
+
+ 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<Evc> mapAllEvcs(org.onap.aai.domain.yang.Configuration configurationAAI) {
+ List<Evc> 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<ForwarderEvc> mapAllForwarderEvcs(org.onap.aai.domain.yang.Configuration configurationAAI) {
+ List<ForwarderEvc> 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,
+ CvnfcConfigurationCustomization cvnfcConfigurationCustomization) {
+ ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
+ modelInfoConfiguration
+ .setModelVersionId(configurationResourceCustomization.getConfigurationResource().getModelUUID());
+ modelInfoConfiguration.setModelCustomizationId(configurationResourceCustomization.getModelCustomizationUUID());
+ modelInfoConfiguration.setModelInvariantId(
+ configurationResourceCustomization.getConfigurationResource().getModelInvariantUUID());
+ modelInfoConfiguration.setPolicyName(cvnfcConfigurationCustomization.getPolicyName());
+ return modelInfoConfiguration;
+ }
+
+ protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration(
+ CvnfcConfigurationCustomization cvnfcConfigurationCustomization) {
+ ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
+ modelInfoConfiguration
+ .setModelVersionId(cvnfcConfigurationCustomization.getConfigurationResource().getModelUUID());
+ modelInfoConfiguration.setModelCustomizationId(cvnfcConfigurationCustomization.getModelCustomizationUUID());
+ modelInfoConfiguration.setModelInvariantId(
+ cvnfcConfigurationCustomization.getConfigurationResource().getModelInvariantUUID());
+ modelInfoConfiguration.setPolicyName(cvnfcConfigurationCustomization.getPolicyName());
+ modelInfoConfiguration.setConfigurationType(cvnfcConfigurationCustomization.getConfigurationType());
+ modelInfoConfiguration.setConfigurationRole(cvnfcConfigurationCustomization.getConfigurationRole());
+ return modelInfoConfiguration;
+ }
+
+ public NetworkResourceCustomization mapCollectionNetworkResourceCustToNetworkResourceCust(
+ CollectionNetworkResourceCustomization collectionNetworkResourceCust) {
+ return modelMapper.map(collectionNetworkResourceCust, NetworkResourceCustomization.class);
+ }
+
+ public Vnfc mapAAIVnfc(org.onap.aai.domain.yang.Vnfc vnfcAAI) {
+ return modelMapper.map(vnfcAAI, Vnfc.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
index 9a08d1872d..5cf2bd7b39 100644
--- 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
@@ -26,7 +26,6 @@ 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;
@@ -49,7 +48,6 @@ 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.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
@@ -67,7 +65,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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;
@@ -75,379 +72,395 @@ import com.fasterxml.jackson.databind.SerializationFeature;
@Component("BBInputSetupUtils")
public class BBInputSetupUtils {
- private static final Logger logger = LoggerFactory.getLogger(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 {
- logger.debug(REQUEST_ERROR);
- }
- }
-
- public void updateInfraActiveRequestVfModuleId(InfraActiveRequests request, String vfModuleId) {
- if(request != null) {
- request.setVfModuleId(vfModuleId);
- this.requestsDbClient.updateInfraActiveRequests(request);
- } else {
- logger.debug(REQUEST_ERROR);
- }
- }
-
- public void updateInfraActiveRequestVolumeGroupId(InfraActiveRequests request, String volumeGroupId) {
- if(request != null) {
- request.setVolumeGroupId(volumeGroupId);
- this.requestsDbClient.updateInfraActiveRequests(request);
- } else {
- logger.debug(REQUEST_ERROR);
- }
- }
-
- public void updateInfraActiveRequestNetworkId(InfraActiveRequests request, String networkId) {
- if(request != null) {
- request.setNetworkId(networkId);
- this.requestsDbClient.updateInfraActiveRequests(request);
- } else {
- logger.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 NetworkCollectionResourceCustomization getCatalogNetworkCollectionResourceCustByID(
- String collectionCustomizationId) {
- return catalogDbClient.getNetworkCollectionResourceCustomizationByID(collectionCustomizationId);
- }
-
- public VfModuleCustomization getVfModuleCustomizationByModelCuztomizationUUID(String modelCustomizationUUID) {
- return catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(modelCustomizationUUID);
- }
-
- public CvnfcConfigurationCustomization getCvnfcConfigurationCustomization(String serviceModelUUID, String vnfCustomizationUuid,
- String vfModuleCustomizationUuid, String cvnfcCustomizationUuid){
- return catalogDbClient.getCvnfcCustomization(serviceModelUUID, vnfCustomizationUuid,vfModuleCustomizationUuid, cvnfcCustomizationUuid);
- }
-
- public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroups(String modelCustomizationUUID) {
- return catalogDbClient.getVnfcInstanceGroupsByVnfResourceCust(modelCustomizationUUID);
- }
-
- public Map<String, String> 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) {
- if (cloudConfiguration != null) {
- String cloudRegionId = cloudConfiguration.getLcpCloudRegionId();
- String cloudOwner = cloudConfiguration.getCloudOwner();
- if (cloudRegionId != null && cloudOwner != null && !cloudRegionId.isEmpty() && !cloudOwner.isEmpty()) {
- return injectionHelper.getAaiClient().get(CloudRegion.class,
- AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner,
- cloudRegionId).depth(Depth.TWO)).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(() -> {
- logger.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(() -> {
- logger.debug("No Service Instance matched by name");
- return null;
- });
- }
-
- public Optional<ServiceInstance> 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<CollectionResourceInstanceGroupCustomization> 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(() -> {
- logger.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(() -> {
- logger.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(() -> {
- logger.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(() -> {
- logger.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(() -> {
- logger.debug("No Generic Vnf matched by id");
- return null;
- });
-
- }
-
- public Optional<ServiceInstance> getRelatedServiceInstanceFromInstanceGroup(String instanceGroupId) throws Exception {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId);
- uri.relatedTo(AAIObjectPlurals.SERVICE_INSTANCE);
- Optional<ServiceInstances> serviceInstances = injectionHelper.getAaiClient().get(ServiceInstances.class, uri);
- ServiceInstance serviceInstance = null;
- if (!serviceInstances.isPresent()) {
- logger.debug("No ServiceInstances were found");
- return Optional.empty();
- } else {
- if (serviceInstances.get().getServiceInstance().isEmpty()) {
- throw new NoServiceInstanceFoundException("No ServiceInstances Returned");
- } else if (serviceInstances.get().getServiceInstance().size() > 1) {
- throw new MultipleObjectsFoundException("Multiple ServiceInstances Returned");
- } else {
- serviceInstance = serviceInstances.get().getServiceInstance().get(0);
- }
- return Optional.of(serviceInstance);
- }
- }
-
- public Optional<L3Network> 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<L3Networks> networks = injectionHelper.getAaiClient().get(L3Networks.class, uri);
- L3Network network = null;
- if (!networks.isPresent()) {
- logger.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<GenericVnf> 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<GenericVnfs> vnfs = injectionHelper.getAaiClient().get(GenericVnfs.class, uri);
- GenericVnf vnf = null;
- if (!vnfs.isPresent()) {
- logger.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<VolumeGroup> 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> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri);
- VolumeGroup volumeGroup = null;
- if (!volumeGroups.isPresent()) {
- logger.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<VolumeGroup> getRelatedVolumeGroupByNameFromVfModule(String vnfId, String vfModuleId, String volumeGroupName) throws Exception {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
- uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName);
- Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri);
- VolumeGroup volumeGroup = null;
- if (!volumeGroups.isPresent()) {
- logger.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);
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(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 {
+ logger.debug(REQUEST_ERROR);
+ }
+ }
+
+ public void updateInfraActiveRequestVfModuleId(InfraActiveRequests request, String vfModuleId) {
+ if (request != null) {
+ request.setVfModuleId(vfModuleId);
+ this.requestsDbClient.updateInfraActiveRequests(request);
+ } else {
+ logger.debug(REQUEST_ERROR);
+ }
+ }
+
+ public void updateInfraActiveRequestVolumeGroupId(InfraActiveRequests request, String volumeGroupId) {
+ if (request != null) {
+ request.setVolumeGroupId(volumeGroupId);
+ this.requestsDbClient.updateInfraActiveRequests(request);
+ } else {
+ logger.debug(REQUEST_ERROR);
+ }
+ }
+
+ public void updateInfraActiveRequestNetworkId(InfraActiveRequests request, String networkId) {
+ if (request != null) {
+ request.setNetworkId(networkId);
+ this.requestsDbClient.updateInfraActiveRequests(request);
+ } else {
+ logger.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 NetworkCollectionResourceCustomization getCatalogNetworkCollectionResourceCustByID(
+ String collectionCustomizationId) {
+ return catalogDbClient.getNetworkCollectionResourceCustomizationByID(collectionCustomizationId);
+ }
+
+ public VfModuleCustomization getVfModuleCustomizationByModelCuztomizationUUID(String modelCustomizationUUID) {
+ return catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(modelCustomizationUUID);
+ }
+
+ public CvnfcConfigurationCustomization getCvnfcConfigurationCustomization(String serviceModelUUID,
+ String vnfCustomizationUuid, String vfModuleCustomizationUuid, String cvnfcCustomizationUuid) {
+ return catalogDbClient.getCvnfcCustomization(serviceModelUUID, vnfCustomizationUuid, vfModuleCustomizationUuid,
+ cvnfcCustomizationUuid);
+ }
+
+ public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroups(String modelCustomizationUUID) {
+ return catalogDbClient.getVnfcInstanceGroupsByVnfResourceCust(modelCustomizationUUID);
+ }
+
+ public Map<String, String> 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) {
+ if (cloudConfiguration != null) {
+ String cloudRegionId = cloudConfiguration.getLcpCloudRegionId();
+ String cloudOwner = cloudConfiguration.getCloudOwner();
+ if (cloudRegionId != null && cloudOwner != null && !cloudRegionId.isEmpty() && !cloudOwner.isEmpty()) {
+ return injectionHelper.getAaiClient().get(CloudRegion.class, AAIUriFactory
+ .createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner, cloudRegionId).depth(Depth.TWO))
+ .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(() -> {
+ logger.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(() -> {
+ logger.debug("No Service Instance matched by name");
+ return null;
+ });
+ }
+
+ public Optional<ServiceInstance> 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<CollectionResourceInstanceGroupCustomization> 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(() -> {
+ logger.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(() -> {
+ logger.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(() -> {
+ logger.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(() -> {
+ logger.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(() -> {
+ logger.debug("No Generic Vnf matched by id");
+ return null;
+ });
+
+ }
+
+ public Optional<ServiceInstance> getRelatedServiceInstanceFromInstanceGroup(String instanceGroupId)
+ throws Exception {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId);
+ uri.relatedTo(AAIObjectPlurals.SERVICE_INSTANCE);
+ Optional<ServiceInstances> serviceInstances = injectionHelper.getAaiClient().get(ServiceInstances.class, uri);
+ ServiceInstance serviceInstance = null;
+ if (!serviceInstances.isPresent()) {
+ logger.debug("No ServiceInstances were found");
+ return Optional.empty();
+ } else {
+ if (serviceInstances.get().getServiceInstance().isEmpty()) {
+ throw new NoServiceInstanceFoundException("No ServiceInstances Returned");
+ } else if (serviceInstances.get().getServiceInstance().size() > 1) {
+ throw new MultipleObjectsFoundException("Multiple ServiceInstances Returned");
+ } else {
+ serviceInstance = serviceInstances.get().getServiceInstance().get(0);
+ }
+ return Optional.of(serviceInstance);
+ }
+ }
+
+ public Optional<L3Network> 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<L3Networks> networks = injectionHelper.getAaiClient().get(L3Networks.class, uri);
+ L3Network network = null;
+ if (!networks.isPresent()) {
+ logger.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<GenericVnf> 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<GenericVnfs> vnfs = injectionHelper.getAaiClient().get(GenericVnfs.class, uri);
+ GenericVnf vnf = null;
+ if (!vnfs.isPresent()) {
+ logger.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<VolumeGroup> 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> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri);
+ VolumeGroup volumeGroup = null;
+ if (!volumeGroups.isPresent()) {
+ logger.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<VolumeGroup> getRelatedVolumeGroupByNameFromVfModule(String vnfId, String vfModuleId,
+ String volumeGroupName) throws Exception {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
+ uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName);
+ Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri);
+ VolumeGroup volumeGroup = null;
+ if (!volumeGroups.isPresent()) {
+ logger.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/CloudInfoFromAAI.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java
index 7fcc613913..e4012e1290 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java
@@ -24,7 +24,6 @@ package org.onap.so.bpmn.servicedecomposition.tasks;
import java.util.List;
import java.util.Optional;
-
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
@@ -37,80 +36,81 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-
import com.fasterxml.jackson.core.JsonProcessingException;
@Component
public class CloudInfoFromAAI {
- private static final Logger logger = LoggerFactory.getLogger(CloudInfoFromAAI.class);
- @Autowired
- private BBInputSetupUtils bbInputSetupUtils;
-
- public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) {
- this.bbInputSetupUtils = bbInputSetupUtils;
- }
-
- protected Optional<CloudRegion> getCloudInfoFromAAI(ServiceInstance serviceInstance) throws JsonProcessingException {
- Optional<Relationships> relationshipsOp = Optional.empty();
- if(!serviceInstance.getVnfs().isEmpty()) {
- GenericVnf vnf = serviceInstance.getVnfs().get(0);
- org.onap.aai.domain.yang.GenericVnf aaiVnf = bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId());
- AAIResultWrapper vnfWrapper = new AAIResultWrapper(
- new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiVnf));
- relationshipsOp = getRelationshipsFromWrapper(vnfWrapper);
- } else if(!serviceInstance.getNetworks().isEmpty()) {
- L3Network network = serviceInstance.getNetworks().get(0);
- org.onap.aai.domain.yang.L3Network aaiL3Network = bbInputSetupUtils.getAAIL3Network(network.getNetworkId());
- AAIResultWrapper networkWrapper = new AAIResultWrapper(
- new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiL3Network));
- relationshipsOp = getRelationshipsFromWrapper(networkWrapper);
- } else {
- logger.debug("BBInputSetup could not find a cloud region or tenant, since there are no resources under the SI.");
- return Optional.empty();
- }
- if (relationshipsOp.isPresent()) {
- return getRelatedCloudRegionAndTenant(relationshipsOp.get());
- } else {
- logger.debug("BBInputSetup could not find a cloud region or tenant");
- return Optional.empty();
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(CloudInfoFromAAI.class);
+ @Autowired
+ private BBInputSetupUtils bbInputSetupUtils;
+
+ public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) {
+ this.bbInputSetupUtils = bbInputSetupUtils;
+ }
+
+ protected Optional<CloudRegion> getCloudInfoFromAAI(ServiceInstance serviceInstance)
+ throws JsonProcessingException {
+ Optional<Relationships> relationshipsOp = Optional.empty();
+ if (!serviceInstance.getVnfs().isEmpty()) {
+ GenericVnf vnf = serviceInstance.getVnfs().get(0);
+ org.onap.aai.domain.yang.GenericVnf aaiVnf = bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId());
+ AAIResultWrapper vnfWrapper =
+ new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiVnf));
+ relationshipsOp = getRelationshipsFromWrapper(vnfWrapper);
+ } else if (!serviceInstance.getNetworks().isEmpty()) {
+ L3Network network = serviceInstance.getNetworks().get(0);
+ org.onap.aai.domain.yang.L3Network aaiL3Network = bbInputSetupUtils.getAAIL3Network(network.getNetworkId());
+ AAIResultWrapper networkWrapper = new AAIResultWrapper(
+ new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiL3Network));
+ relationshipsOp = getRelationshipsFromWrapper(networkWrapper);
+ } else {
+ logger.debug(
+ "BBInputSetup could not find a cloud region or tenant, since there are no resources under the SI.");
+ return Optional.empty();
+ }
+ if (relationshipsOp.isPresent()) {
+ return getRelatedCloudRegionAndTenant(relationshipsOp.get());
+ } else {
+ logger.debug("BBInputSetup could not find a cloud region or tenant");
+ return Optional.empty();
+ }
+ }
- protected Optional<Relationships> getRelationshipsFromWrapper(AAIResultWrapper wrapper) {
- Optional<Relationships> relationshipsOp;
- relationshipsOp = wrapper.getRelationships();
- if(relationshipsOp.isPresent()) {
- return relationshipsOp;
- }
- return Optional.empty();
- }
+ protected Optional<Relationships> getRelationshipsFromWrapper(AAIResultWrapper wrapper) {
+ Optional<Relationships> relationshipsOp;
+ relationshipsOp = wrapper.getRelationships();
+ if (relationshipsOp.isPresent()) {
+ return relationshipsOp;
+ }
+ return Optional.empty();
+ }
- protected Optional<CloudRegion> getRelatedCloudRegionAndTenant(Relationships relationships) {
- CloudRegion cloudRegion = new CloudRegion();
- List<AAIResultWrapper> cloudRegions = relationships.getByType(AAIObjectType.CLOUD_REGION);
- List<AAIResultWrapper> tenants = relationships.getByType(AAIObjectType.TENANT);
- if(!cloudRegions.isEmpty()) {
- AAIResultWrapper cloudRegionWrapper = cloudRegions.get(0);
- Optional<org.onap.aai.domain.yang.CloudRegion> aaiCloudRegionOp = cloudRegionWrapper
- .asBean(org.onap.aai.domain.yang.CloudRegion.class);
- if(aaiCloudRegionOp.isPresent()) {
- org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = aaiCloudRegionOp.get();
- cloudRegion.setCloudOwner(aaiCloudRegion.getCloudOwner());
- cloudRegion.setCloudRegionVersion(aaiCloudRegion.getCloudRegionVersion());
- cloudRegion.setLcpCloudRegionId(aaiCloudRegion.getCloudRegionId());
- cloudRegion.setComplex(aaiCloudRegion.getComplexName());
- }
- }
- if(!tenants.isEmpty()) {
- AAIResultWrapper tenantWrapper = tenants.get(0);
- Optional<org.onap.aai.domain.yang.Tenant> aaiTenantOp = tenantWrapper
- .asBean(org.onap.aai.domain.yang.Tenant.class);
- if(aaiTenantOp.isPresent()) {
- org.onap.aai.domain.yang.Tenant aaiTenant = aaiTenantOp.get();
- cloudRegion.setTenantId(aaiTenant.getTenantId());
- }
- }
- return Optional.of(cloudRegion);
- }
+ protected Optional<CloudRegion> getRelatedCloudRegionAndTenant(Relationships relationships) {
+ CloudRegion cloudRegion = new CloudRegion();
+ List<AAIResultWrapper> cloudRegions = relationships.getByType(AAIObjectType.CLOUD_REGION);
+ List<AAIResultWrapper> tenants = relationships.getByType(AAIObjectType.TENANT);
+ if (!cloudRegions.isEmpty()) {
+ AAIResultWrapper cloudRegionWrapper = cloudRegions.get(0);
+ Optional<org.onap.aai.domain.yang.CloudRegion> aaiCloudRegionOp =
+ cloudRegionWrapper.asBean(org.onap.aai.domain.yang.CloudRegion.class);
+ if (aaiCloudRegionOp.isPresent()) {
+ org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = aaiCloudRegionOp.get();
+ cloudRegion.setCloudOwner(aaiCloudRegion.getCloudOwner());
+ cloudRegion.setCloudRegionVersion(aaiCloudRegion.getCloudRegionVersion());
+ cloudRegion.setLcpCloudRegionId(aaiCloudRegion.getCloudRegionId());
+ cloudRegion.setComplex(aaiCloudRegion.getComplexName());
+ }
+ }
+ if (!tenants.isEmpty()) {
+ AAIResultWrapper tenantWrapper = tenants.get(0);
+ Optional<org.onap.aai.domain.yang.Tenant> aaiTenantOp =
+ tenantWrapper.asBean(org.onap.aai.domain.yang.Tenant.class);
+ if (aaiTenantOp.isPresent()) {
+ org.onap.aai.domain.yang.Tenant aaiTenant = aaiTenantOp.get();
+ cloudRegion.setTenantId(aaiTenant.getTenantId());
+ }
+ }
+ return Optional.of(cloudRegion);
+ }
}
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
index aa992d6153..c8e296d5ac 100644
--- 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
@@ -23,7 +23,6 @@
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;
@@ -44,154 +43,154 @@ import org.springframework.stereotype.Component;
@Component
public class ExecuteBuildingBlockRainyDay {
- private static final Logger logger = LoggerFactory.getLogger(ExecuteBuildingBlockRainyDay.class);
- public static final String HANDLING_CODE = "handlingCode";
+ private static final Logger logger = LoggerFactory.getLogger(ExecuteBuildingBlockRainyDay.class);
+ public static final String HANDLING_CODE = "handlingCode";
+
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+ @Autowired
+ private RequestsDbClient requestDbclient;
+ private static final String ASTERISK = "*";
+
+ @Autowired
+ private Environment environment;
+ protected String retryDurationPath = "mso.rainyDay.retryDurationMultiplier";
+ protected String defaultCode = "mso.rainyDay.defaultCode";
+ protected String maxRetries = "mso.rainyDay.maxRetries";
+
+ public void setRetryTimer(DelegateExecution execution) {
+ try {
+ int retryDurationMult = Integer.parseInt(this.environment.getProperty(retryDurationPath));
+ int retryCount = (int) execution.getVariable("retryCount");
+ int retryTimeToWait = (int) Math.pow(retryDurationMult, retryCount) * 10;
+ String RetryDuration = "PT" + retryTimeToWait + "S";
+ execution.setVariable("RetryDuration", RetryDuration);
+ } catch (Exception e) {
+ logger.error("Exception occurred", e);
+ throw new BpmnError("Unknown error incrementing retry counter");
+ }
+ }
+
+ public void queryRainyDayTable(DelegateExecution execution, boolean primaryPolicy) {
+ try {
+ ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock");
+ String bbName = ebb.getBuildingBlock().getBpmnFlowName();
+ GeneralBuildingBlock gBBInput = (GeneralBuildingBlock) execution.getVariable("gBBInput");
+ String requestId = (String) execution.getVariable("mso-request-id");
+ Map<ResourceKey, String> lookupKeyMap = (Map<ResourceKey, String>) execution.getVariable("lookupKeyMap");
+ String serviceType = ASTERISK;
+ boolean aLaCarte = (boolean) execution.getVariable("aLaCarte");
+ boolean suppressRollback = (boolean) execution.getVariable("suppressRollback");
+ String handlingCode = "";
+
+ WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
+ try {
+ // Extract error data to be returned to WorkflowAction
+ execution.setVariable("WorkflowExceptionErrorMessage", workflowException.getErrorMessage());
+ } catch (Exception e) {
+ logger.error("No WorkflowException Found", e);
+ }
- @Autowired
- private CatalogDbClient catalogDbClient;
- @Autowired
- private RequestsDbClient requestDbclient;
- private static final String ASTERISK = "*";
+ if (suppressRollback) {
+ handlingCode = "Abort";
+ } else {
+ 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
+ }
- @Autowired
- private Environment environment;
- protected String retryDurationPath = "mso.rainyDay.retryDurationMultiplier";
- protected String defaultCode = "mso.rainyDay.defaultCode";
- protected String maxRetries = "mso.rainyDay.maxRetries";
+ String errorCode = ASTERISK;
+ try {
+ errorCode = "" + workflowException.getErrorCode();
+ } catch (Exception ex) {
+ // keep default errorCode value
+ }
+ try {
+ errorCode = "" + (String) execution.getVariable("WorkflowExceptionCode");
+ } catch (Exception ex) {
+ // keep default errorCode value
+ }
- public void setRetryTimer(DelegateExecution execution) {
- try {
- int retryDurationMult = Integer.parseInt(this.environment.getProperty(retryDurationPath));
- int retryCount = (int) execution.getVariable("retryCount");
- int retryTimeToWait = (int) Math.pow(retryDurationMult, retryCount) * 10;
- String RetryDuration = "PT" + retryTimeToWait + "S";
- execution.setVariable("RetryDuration", RetryDuration);
- } catch (Exception e) {
- logger.error("Exception occurred", e);
- throw new BpmnError("Unknown error incrementing retry counter");
- }
- }
+ String workStep = ASTERISK;
+ try {
+ workStep = workflowException.getWorkStep();
+ } catch (Exception ex) {
+ // keep default workStep value
+ }
- public void queryRainyDayTable(DelegateExecution execution, boolean primaryPolicy) {
- try {
- ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock");
- String bbName = ebb.getBuildingBlock().getBpmnFlowName();
- GeneralBuildingBlock gBBInput = (GeneralBuildingBlock) execution.getVariable("gBBInput");
- String requestId = (String) execution.getVariable("mso-request-id");
- Map<ResourceKey, String> lookupKeyMap = (Map<ResourceKey, String>) execution.getVariable("lookupKeyMap");
- String serviceType = ASTERISK;
- boolean aLaCarte = (boolean) execution.getVariable("aLaCarte");
- boolean suppressRollback = (boolean) execution.getVariable("suppressRollback");
- String handlingCode = "";
-
- WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
- try {
- // Extract error data to be returned to WorkflowAction
- execution.setVariable("WorkflowExceptionErrorMessage", workflowException.getErrorMessage());
- } catch (Exception e) {
- logger.error("No WorkflowException Found",e);
- }
-
- if (suppressRollback) {
- handlingCode = "Abort";
- } else {
- 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
- }
-
- String errorCode = ASTERISK;
- try {
- errorCode = "" + workflowException.getErrorCode();
- } catch (Exception ex) {
- // keep default errorCode value
- }
- try {
- errorCode = "" + (String) execution.getVariable("WorkflowExceptionCode");
- } catch (Exception ex) {
- // keep default errorCode value
- }
+ RainyDayHandlerStatus rainyDayHandlerStatus;
+ rainyDayHandlerStatus = catalogDbClient
+ .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,
+ serviceType, vnfType, errorCode, workStep);
+ if (rainyDayHandlerStatus == null) {
+ rainyDayHandlerStatus = catalogDbClient
+ .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,
+ ASTERISK, ASTERISK, errorCode, ASTERISK);
+ }
- String workStep = ASTERISK;
- try {
- workStep = workflowException.getWorkStep();
- } catch (Exception ex) {
- // keep default workStep value
- }
-
- RainyDayHandlerStatus rainyDayHandlerStatus;
- rainyDayHandlerStatus = catalogDbClient
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,
- serviceType, vnfType, errorCode, workStep);
- if (rainyDayHandlerStatus == null) {
- rainyDayHandlerStatus = catalogDbClient
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,
- ASTERISK, ASTERISK, errorCode, ASTERISK);
- }
-
- if (rainyDayHandlerStatus == null) {
- rainyDayHandlerStatus = catalogDbClient
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,
- ASTERISK, ASTERISK, ASTERISK, ASTERISK);
- if (rainyDayHandlerStatus == null) {
- handlingCode = "Abort";
- } else {
- if (primaryPolicy) {
- handlingCode = rainyDayHandlerStatus.getPolicy();
- } else {
- handlingCode = rainyDayHandlerStatus.getSecondaryPolicy();
- }
- }
- } else {
- if (primaryPolicy) {
- handlingCode = rainyDayHandlerStatus.getPolicy();
- } else {
- handlingCode = rainyDayHandlerStatus.getSecondaryPolicy();
- }
- }
- if (!primaryPolicy) {
- try {
- InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
- request.setRetryStatusMessage("Retries have been exhausted.");
- requestDbclient.updateInfraActiveRequests(request);
- } catch (Exception ex) {
- logger.error("Failed to update Request Db Infra Active Requests with Retry Status",ex);
- }
- }
- if (handlingCode.equals("RollbackToAssigned") && !aLaCarte) {
- handlingCode = "Rollback";
- }
- }
- logger.debug("RainyDayHandler Status Code is: {}", handlingCode);
- execution.setVariable(HANDLING_CODE, handlingCode);
- } catch (Exception e) {
- String code = this.environment.getProperty(defaultCode);
- logger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = {}", code, e);
- execution.setVariable(HANDLING_CODE, code);
- }
- try{
- int envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries));
- execution.setVariable("maxRetries", envMaxRetries);
- } catch (Exception ex) {
- logger.error("Could not read maxRetries from config file. Setting max to 5 retries");
- execution.setVariable("maxRetries", 5);
- }
- }
+ if (rainyDayHandlerStatus == null) {
+ rainyDayHandlerStatus = catalogDbClient
+ .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,
+ ASTERISK, ASTERISK, ASTERISK, ASTERISK);
+ if (rainyDayHandlerStatus == null) {
+ handlingCode = "Abort";
+ } else {
+ if (primaryPolicy) {
+ handlingCode = rainyDayHandlerStatus.getPolicy();
+ } else {
+ handlingCode = rainyDayHandlerStatus.getSecondaryPolicy();
+ }
+ }
+ } else {
+ if (primaryPolicy) {
+ handlingCode = rainyDayHandlerStatus.getPolicy();
+ } else {
+ handlingCode = rainyDayHandlerStatus.getSecondaryPolicy();
+ }
+ }
+ if (!primaryPolicy) {
+ try {
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ request.setRetryStatusMessage("Retries have been exhausted.");
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception ex) {
+ logger.error("Failed to update Request Db Infra Active Requests with Retry Status", ex);
+ }
+ }
+ if (handlingCode.equals("RollbackToAssigned") && !aLaCarte) {
+ handlingCode = "Rollback";
+ }
+ }
+ logger.debug("RainyDayHandler Status Code is: {}", handlingCode);
+ execution.setVariable(HANDLING_CODE, handlingCode);
+ } catch (Exception e) {
+ String code = this.environment.getProperty(defaultCode);
+ logger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = {}", code, e);
+ execution.setVariable(HANDLING_CODE, code);
+ }
+ try {
+ int envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries));
+ execution.setVariable("maxRetries", envMaxRetries);
+ } catch (Exception ex) {
+ logger.error("Could not read maxRetries from config file. Setting max to 5 retries");
+ execution.setVariable("maxRetries", 5);
+ }
+ }
- public void setHandlingStatusSuccess(DelegateExecution execution) {
- execution.setVariable(HANDLING_CODE, "Success");
- }
+ public void setHandlingStatusSuccess(DelegateExecution execution) {
+ execution.setVariable(HANDLING_CODE, "Success");
+ }
}
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
index 8af6e809f4..4332a6cf4e 100644
--- 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
@@ -26,9 +26,7 @@ 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;
@@ -38,111 +36,115 @@ import org.onap.so.client.exception.BBObjectNotFoundException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
-
import com.google.common.base.CaseFormat;
@Component
public class ExtractPojosForBB {
- private static final Logger logger = LoggerFactory.getLogger(ExtractPojosForBB.class);
-
- public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key) throws BBObjectNotFoundException {
- return extractByKey(execution, key, execution.getLookupMap().get(key));
- }
- public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value)
- throws BBObjectNotFoundException {
+ private static final Logger logger = LoggerFactory.getLogger(ExtractPojosForBB.class);
+
+ public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key) throws BBObjectNotFoundException {
+ return extractByKey(execution, key, execution.getLookupMap().get(key));
+ }
+
+ public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value)
+ throws BBObjectNotFoundException {
+
+ Optional<T> 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);
+ result = lookupObjectInList(serviceInstance.getVnfs(), value);
+ break;
+ case NETWORK_ID:
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ result = lookupObjectInList(serviceInstance.getNetworks(), value);
+ break;
+ case VOLUME_GROUP_ID:
+ vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ result = lookupObjectInList(vnf.getVolumeGroups(), value);
+ break;
+ case VF_MODULE_ID:
+ vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ result = lookupObjectInList(vnf.getVfModules(), value);
+ break;
+ case ALLOTTED_RESOURCE_ID:
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ result = lookupObjectInList(serviceInstance.getAllottedResources(), value);
+ break;
+ case CONFIGURATION_ID:
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ result = lookupObjectInList(serviceInstance.getConfigurations(), value);
+ break;
+ case VPN_ID:
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ result = lookupObjectInList(gBBInput.getCustomer().getVpnBindings(), value);
+ break;
+ case VPN_BONDING_LINK_ID:
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ result = lookupObjectInList(serviceInstance.getVpnBondingLinks(), value);
+ break;
+ case INSTANCE_GROUP_ID:
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ result = lookupObjectInList(serviceInstance.getInstanceGroups(), 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
+ logger.warn("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 <T> Optional<T> lookupObject(Object obj, String value) throws IllegalAccessException,
+ IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
+ return findValue(obj, value);
+ }
+
+ protected <T> Optional<T> lookupObjectInList(List<?> list, String value) throws IllegalAccessException,
+ IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
+ Optional<T> result = Optional.empty();
+ for (Object obj : list) {
+ result = findValue(obj, value);
+ if (result.isPresent()) {
+ break;
+ }
+ }
+ return result;
+
+ }
- Optional<T> 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);
- result = lookupObjectInList(serviceInstance.getVnfs(), value);
- break;
- case NETWORK_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- result = lookupObjectInList(serviceInstance.getNetworks(), value);
- break;
- case VOLUME_GROUP_ID:
- vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- result = lookupObjectInList(vnf.getVolumeGroups(), value);
- break;
- case VF_MODULE_ID:
- vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- result = lookupObjectInList(vnf.getVfModules(), value);
- break;
- case ALLOTTED_RESOURCE_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- result = lookupObjectInList(serviceInstance.getAllottedResources(), value);
- break;
- case CONFIGURATION_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- result = lookupObjectInList(serviceInstance.getConfigurations(), value);
- break;
- case VPN_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- result = lookupObjectInList(gBBInput.getCustomer().getVpnBindings(), value);
- break;
- case VPN_BONDING_LINK_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- result = lookupObjectInList(serviceInstance.getVpnBondingLinks(),value);
- break;
- case INSTANCE_GROUP_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- result = lookupObjectInList(serviceInstance.getInstanceGroups(), 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
- logger.warn("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 <T> Optional<T> lookupObject(Object obj, String value) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
- return findValue(obj, value);
- }
+ protected <T> Optional<T> 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);
+ }
+ }
+ }
- protected <T> Optional<T> lookupObjectInList(List<?> list, String value) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
- Optional<T> result = Optional.empty();
- for (Object obj : list) {
- result = findValue(obj, value);
- if (result.isPresent()) {
- break;
- }
- }
- return result;
-
- }
-
- protected <T> Optional<T> 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();
- }
+ return Optional.empty();
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundException.java
index d63f98b6ce..ab24cf155c 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundException.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundException.java
@@ -22,26 +22,26 @@ package org.onap.so.bpmn.servicedecomposition.tasks.exceptions;
public class MultipleObjectsFoundException extends Exception {
- private static final long serialVersionUID = -5045275644426587447L;
-
- public MultipleObjectsFoundException() {
- super();
- }
-
- public MultipleObjectsFoundException(String message) {
- super(message);
- }
-
- public MultipleObjectsFoundException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public MultipleObjectsFoundException(Throwable cause) {
- super(cause);
- }
-
- public MultipleObjectsFoundException(String message, Throwable cause, boolean enableSuppression,
- boolean writableStackTrace) {
- super(message, cause, enableSuppression, writableStackTrace);
- }
+ private static final long serialVersionUID = -5045275644426587447L;
+
+ public MultipleObjectsFoundException() {
+ super();
+ }
+
+ public MultipleObjectsFoundException(String message) {
+ super(message);
+ }
+
+ public MultipleObjectsFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public MultipleObjectsFoundException(Throwable cause) {
+ super(cause);
+ }
+
+ public MultipleObjectsFoundException(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/tasks/exceptions/NoServiceInstanceFoundException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundException.java
index 2ef1a80cce..acf222566a 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundException.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundException.java
@@ -22,26 +22,26 @@ package org.onap.so.bpmn.servicedecomposition.tasks.exceptions;
public class NoServiceInstanceFoundException extends Exception {
- private static final long serialVersionUID = 3270499954054029908L;
-
- public NoServiceInstanceFoundException() {
- super();
- }
-
- public NoServiceInstanceFoundException(String message) {
- super(message);
- }
-
- public NoServiceInstanceFoundException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public NoServiceInstanceFoundException(Throwable cause) {
- super(cause);
- }
-
- public NoServiceInstanceFoundException(String message, Throwable cause, boolean enableSuppression,
- boolean writableStackTrace) {
- super(message, cause, enableSuppression, writableStackTrace);
- }
+ private static final long serialVersionUID = 3270499954054029908L;
+
+ public NoServiceInstanceFoundException() {
+ super();
+ }
+
+ public NoServiceInstanceFoundException(String message) {
+ super(message);
+ }
+
+ public NoServiceInstanceFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public NoServiceInstanceFoundException(Throwable cause) {
+ super(cause);
+ }
+
+ public NoServiceInstanceFoundException(String message, Throwable cause, boolean enableSuppression,
+ boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
}
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
index a15e044818..eccd81217f 100644
--- 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
@@ -23,7 +23,6 @@ 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;
@@ -32,154 +31,163 @@ import org.onap.so.client.appc.ApplicationControllerSupport.StatusCategory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
-
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
@Component
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<String> payload, HashMap<String, String> 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<String> vmIdJsonList = mapper.readValue(vmIds, new TypeReference<List<String>>(){});
- List<String> vserverIdJsonList = mapper.readValue(vserverIds, new TypeReference<List<String>>(){});
- int i = 0;
- while(i < vmIdJsonList.size()){
- vmId = vmIdJsonList.get(i);
- vserverId = vserverIdJsonList.get(i);
- Optional<String> vserverIdString = Optional.of(vserverId);
- appCStatus = snapshotAction(msoRequestId, vnfId, vmId, vserverIdString, identityUrl, controllerType);
- i++;
- }
- break;
- case ConfigModify:
- case ConfigScaleOut:
- case DistributeTraffic:
- case DistributeTrafficCheck:
- 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> vserverId, String identityUrl, String controllerType) throws JsonProcessingException, ApplicationControllerOrchestratorException{
- Optional<String> 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;
- }
+ 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<String> payload,
+ HashMap<String, String> 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<String> vmIdJsonList = mapper.readValue(vmIds, new TypeReference<List<String>>() {});
+ List<String> vserverIdJsonList = mapper.readValue(vserverIds, new TypeReference<List<String>>() {});
+ int i = 0;
+ while (i < vmIdJsonList.size()) {
+ vmId = vmIdJsonList.get(i);
+ vserverId = vserverIdJsonList.get(i);
+ Optional<String> vserverIdString = Optional.of(vserverId);
+ appCStatus =
+ snapshotAction(msoRequestId, vnfId, vmId, vserverIdString, identityUrl, controllerType);
+ i++;
+ }
+ break;
+ case ConfigModify:
+ case ConfigScaleOut:
+ case DistributeTraffic:
+ case DistributeTrafficCheck:
+ 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> vserverId,
+ String identityUrl, String controllerType)
+ throws JsonProcessingException, ApplicationControllerOrchestratorException {
+ Optional<String> 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
index cb3f144cd1..0f21c6c286 100644
--- 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
@@ -23,18 +23,18 @@ 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<T> implements ResponseHandler<T> {
-
- @Override
- public void onResponse(T response) {
-
-
- }
-
- @Override
- public void onException(AppcClientException exception) {
-
-
- }
+public class ApplicationControllerCallback<T> implements ResponseHandler<T> {
+
+ @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
index 89eff5f65a..e810fc0259 100644
--- 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
@@ -26,7 +26,6 @@ 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;
@@ -47,160 +46,163 @@ 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<String, LifeCycleManagerStateful> 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(UUID.randomUUID().toString());
- 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;
- }
+ 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<String, LifeCycleManagerStateful> 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(UUID.randomUUID().toString());
+ 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
index d4599a5248..dc5b6308bb 100644
--- 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
@@ -32,7 +32,6 @@ 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;
@@ -44,111 +43,111 @@ import java.util.UUID;
@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);
+ 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
- ApplicationControllerConfiguration applicationControllerConfiguration;
+ // @Autowired
+ private ApplicationControllerSupport appCSupport;
- //@Autowired
- private ApplicationControllerSupport appCSupport;
+ private static LifeCycleManagerStateful client;
- private static LifeCycleManagerStateful client;
+ // @PostConstruct
+ public void buildClient() {
+ client = this.getAppCClient("");
+ }
- //@PostConstruct
- public void buildClient() {
- client = this.getAppCClient("");
- }
-
- //@PostConstruct
- public void buildClient(String controllerType) {
- client = this.getAppCClient(controllerType);
- }
+ // @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 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;
- }
+ 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;
- }
+ 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;
- }
+ 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;
- }
+ 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;
- }
+ 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
index 430767f24a..165d9577af 100644
--- 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
@@ -26,60 +26,60 @@ import org.springframework.stereotype.Service;
@Configuration
public class ApplicationControllerConfiguration {
- @Value("${appc.client.topic.read.name}")
- private String readTopic;
+ @Value("${appc.client.topic.read.name}")
+ private String readTopic;
- @Value("${appc.client.topic.read.timeout}")
- private String readTimeout;
+ @Value("${appc.client.topic.read.timeout}")
+ private String readTimeout;
- @Value("${appc.client.response.timeout}")
- private String responseTimeout;
+ @Value("${appc.client.response.timeout}")
+ private String responseTimeout;
- @Value("${appc.client.topic.write}")
- private String write;
+ @Value("${appc.client.topic.write}")
+ private String write;
- @Value("${appc.client.poolMembers}")
- private String poolMembers;
+ @Value("${appc.client.poolMembers}")
+ private String poolMembers;
- @Value("${appc.client.key}")
- private String clientKey;
+ @Value("${appc.client.key}")
+ private String clientKey;
- @Value("${appc.client.secret}")
- private String clientSecret;
+ @Value("${appc.client.secret}")
+ private String clientSecret;
- @Value("${appc.client.service}")
- private String service;
+ @Value("${appc.client.service}")
+ private String service;
- public String getClientKey() {
- return clientKey;
- }
+ public String getClientKey() {
+ return clientKey;
+ }
- public String getClientSecret() {
- return clientSecret;
- }
+ public String getClientSecret() {
+ return clientSecret;
+ }
- public String getPoolMembers() {
- return poolMembers;
- }
-
- public String getReadTimeout() {
- return readTimeout;
- }
+ public String getPoolMembers() {
+ return poolMembers;
+ }
- public String getResponseTimeout() {
- return responseTimeout;
- }
+ public String getReadTimeout() {
+ return readTimeout;
+ }
- public String getReadTopic() {
- return readTopic;
- }
+ public String getResponseTimeout() {
+ return responseTimeout;
+ }
- public String getService() {
- return service;
- }
+ public String getReadTopic() {
+ return readTopic;
+ }
- public String getWrite() {
- return write;
- }
+ 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
index 84e0f93294..fd5f07b708 100644
--- 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
@@ -21,9 +21,7 @@
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;
@@ -31,23 +29,24 @@ import org.onap.appc.client.lcm.model.Status;
public class ApplicationControllerOrchestrator {
- public Status vnfCommand(Action action, String requestId, String vnfId, Optional<String> vserverId, Optional<String> 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;
- }
- }
+ public Status vnfCommand(Action action, String requestId, String vnfId, Optional<String> vserverId,
+ Optional<String> 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
index 2532e485ed..58e566e096 100644
--- 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
@@ -22,15 +22,14 @@ 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;
- }
+ 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
index ef8749ece9..10d3d85ffc 100644
--- 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
@@ -26,15 +26,12 @@ 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;
@@ -43,173 +40,173 @@ 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);
- }
- }
+ 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
index fff818f09b..f839079338 100644
--- 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
@@ -25,16 +25,16 @@ import com.fasterxml.jackson.annotation.JsonProperty;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AVPNDmaapBean {
-
- @JsonProperty("asyncRequestStatus")
- private AsyncRequestStatus asyncRequestStatus;
- public AsyncRequestStatus getAsyncRequestStatus() {
- return asyncRequestStatus;
- }
+ @JsonProperty("asyncRequestStatus")
+ private AsyncRequestStatus asyncRequestStatus;
- public void setAsyncRequestStatus(AsyncRequestStatus asyncRequestStatus) {
- this.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
index 13206e8c92..14e0cd0411 100644
--- 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
@@ -25,95 +25,95 @@ 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;
- }
+
+ @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
index 322f41bf75..31189517aa 100644
--- 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
@@ -26,14 +26,14 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName(value = "instanceReferences")
public class InstanceReferences {
- @JsonProperty("serviceInstanceId")
- private String serviceInstanceId;
+ @JsonProperty("serviceInstanceId")
+ private String serviceInstanceId;
- public String getServiceInstanceId() {
- return serviceInstanceId;
- }
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
- public void setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = 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
index edc8be7bfe..34f17c404f 100644
--- 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
@@ -26,54 +26,54 @@ 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;
- }
+ @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 Boolean isWasRolledBack() {
- return wasRolledBack;
- }
+ public String getTimestamp() {
+ return timestamp;
+ }
- public void setWasRolledBack(Boolean wasRolledBack) {
- this.wasRolledBack = wasRolledBack;
- }
+ 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/cds/AbstractCDSProcessingBBUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java
index 083a6b6e1f..6bfa67502d 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java
@@ -25,7 +25,6 @@ package org.onap.so.client.cds;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader;
@@ -40,12 +39,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.Struct;
import com.google.protobuf.Struct.Builder;
import com.google.protobuf.util.JsonFormat;
-
import io.grpc.Status;
/**
@@ -67,28 +64,26 @@ public class AbstractCDSProcessingBBUtils implements CDSProcessingListener {
private ExceptionBuilder exceptionUtil;
/**
- * Extracting data from execution object and building the ExecutionServiceInput
- * Object
+ * Extracting data from execution object and building the ExecutionServiceInput Object
*
- * @param execution
- * DelegateExecution object
+ * @param execution DelegateExecution object
*/
public void constructExecutionServiceInputObject(DelegateExecution execution) {
logger.trace("Start AbstractCDSProcessingBBUtils.preProcessRequest ");
try {
- AbstractCDSPropertiesBean executionObject = (AbstractCDSPropertiesBean) execution
- .getVariable("executionObject");
+ AbstractCDSPropertiesBean executionObject =
+ (AbstractCDSPropertiesBean) execution.getVariable("executionObject");
String payload = executionObject.getRequestObject();
CommonHeader commonHeader = CommonHeader.newBuilder().setOriginatorId(executionObject.getOriginatorId())
.setRequestId(executionObject.getRequestId()).setSubRequestId(executionObject.getSubRequestId())
.build();
- ActionIdentifiers actionIdentifiers = ActionIdentifiers.newBuilder()
- .setBlueprintName(executionObject.getBlueprintName())
- .setBlueprintVersion(executionObject.getBlueprintVersion())
- .setActionName(executionObject.getActionName()).setMode(executionObject.getMode()).build();
+ ActionIdentifiers actionIdentifiers =
+ ActionIdentifiers.newBuilder().setBlueprintName(executionObject.getBlueprintName())
+ .setBlueprintVersion(executionObject.getBlueprintVersion())
+ .setActionName(executionObject.getActionName()).setMode(executionObject.getMode()).build();
Builder struct = Struct.newBuilder();
try {
@@ -99,9 +94,9 @@ public class AbstractCDSProcessingBBUtils implements CDSProcessingListener {
executionObject.getActionName(), e);
}
- ExecutionServiceInput executionServiceInput = ExecutionServiceInput.newBuilder()
- .setCommonHeader(commonHeader).setActionIdentifiers(actionIdentifiers).setPayload(struct.build())
- .build();
+ ExecutionServiceInput executionServiceInput =
+ ExecutionServiceInput.newBuilder().setCommonHeader(commonHeader)
+ .setActionIdentifiers(actionIdentifiers).setPayload(struct.build()).build();
execution.setVariable("executionServiceInput", executionServiceInput);
@@ -111,11 +106,9 @@ public class AbstractCDSProcessingBBUtils implements CDSProcessingListener {
}
/**
- * get the executionServiceInput object from execution and send a request to CDS
- * Client and wait for TIMEOUT period
+ * get the executionServiceInput object from execution and send a request to CDS Client and wait for TIMEOUT period
*
- * @param execution
- * DelegateExecution object
+ * @param execution DelegateExecution object
*/
public void sendRequestToCDSClient(DelegateExecution execution) {
@@ -127,13 +120,13 @@ public class AbstractCDSProcessingBBUtils implements CDSProcessingListener {
"No RestProperty.CDSProperties implementation found on classpath, can't create client.");
}
- ExecutionServiceInput executionServiceInput = (ExecutionServiceInput) execution
- .getVariable("executionServiceInput");
+ ExecutionServiceInput executionServiceInput =
+ (ExecutionServiceInput) execution.getVariable("executionServiceInput");
- try(CDSProcessingClient cdsClient = new CDSProcessingClient(this)) {
+ try (CDSProcessingClient cdsClient = new CDSProcessingClient(this)) {
CountDownLatch countDownLatch = cdsClient.sendRequest(executionServiceInput);
countDownLatch.await(props.getTimeout(), TimeUnit.SECONDS);
- } catch (InterruptedException ex){
+ } catch (InterruptedException ex) {
logger.error("Caught exception in sendRequestToCDSClient in AbstractCDSProcessingBBUtils : ", ex);
Thread.currentThread().interrupt();
}
@@ -158,21 +151,21 @@ public class AbstractCDSProcessingBBUtils implements CDSProcessingListener {
switch (eventType) {
- case EVENT_COMPONENT_FAILURE:
- // failed processing with failure
- cdsResponse.set(FAILED);
- break;
- case EVENT_COMPONENT_PROCESSING:
- // still processing
- cdsResponse.set(PROCESSING);
- break;
- case EVENT_COMPONENT_EXECUTED:
- // done with async processing
- cdsResponse.set(SUCCESS);
- break;
- default:
- cdsResponse.set(FAILED);
- break;
+ case EVENT_COMPONENT_FAILURE:
+ // failed processing with failure
+ cdsResponse.set(FAILED);
+ break;
+ case EVENT_COMPONENT_PROCESSING:
+ // still processing
+ cdsResponse.set(PROCESSING);
+ break;
+ case EVENT_COMPONENT_EXECUTED:
+ // done with async processing
+ cdsResponse.set(SUCCESS);
+ break;
+ default:
+ cdsResponse.set(FAILED);
+ break;
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java
index 4b645984cf..2e84f384dc 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java
@@ -4,86 +4,86 @@ import java.io.Serializable;
public class AbstractCDSPropertiesBean implements Serializable {
- private static final long serialVersionUID = -4800522372460352963L;
+ private static final long serialVersionUID = -4800522372460352963L;
- private String blueprintName;
+ private String blueprintName;
- private String blueprintVersion;
+ private String blueprintVersion;
- private String requestObject;
+ private String requestObject;
- private String originatorId;
+ private String originatorId;
- private String requestId;
+ private String requestId;
- private String subRequestId;
+ private String subRequestId;
- private String actionName;
+ private String actionName;
- private String mode;
+ private String mode;
- public String getBlueprintName() {
- return blueprintName;
- }
+ public String getBlueprintName() {
+ return blueprintName;
+ }
- public void setBlueprintName(String blueprintName) {
- this.blueprintName = blueprintName;
- }
+ public void setBlueprintName(String blueprintName) {
+ this.blueprintName = blueprintName;
+ }
- public String getBlueprintVersion() {
- return blueprintVersion;
- }
+ public String getBlueprintVersion() {
+ return blueprintVersion;
+ }
- public void setBlueprintVersion(String blueprintVersion) {
- this.blueprintVersion = blueprintVersion;
- }
+ public void setBlueprintVersion(String blueprintVersion) {
+ this.blueprintVersion = blueprintVersion;
+ }
- public String getRequestObject() {
- return requestObject;
- }
+ public String getRequestObject() {
+ return requestObject;
+ }
- public void setRequestObject(String requestObject) {
- this.requestObject = requestObject;
- }
+ public void setRequestObject(String requestObject) {
+ this.requestObject = requestObject;
+ }
- public String getOriginatorId() {
- return originatorId;
- }
+ public String getOriginatorId() {
+ return originatorId;
+ }
- public void setOriginatorId(String originatorId) {
- this.originatorId = originatorId;
- }
+ public void setOriginatorId(String originatorId) {
+ this.originatorId = originatorId;
+ }
- public String getRequestId() {
- return requestId;
- }
+ public String getRequestId() {
+ return requestId;
+ }
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
- public String getSubRequestId() {
- return subRequestId;
- }
+ public String getSubRequestId() {
+ return subRequestId;
+ }
- public void setSubRequestId(String subRequestId) {
- this.subRequestId = subRequestId;
- }
+ public void setSubRequestId(String subRequestId) {
+ this.subRequestId = subRequestId;
+ }
- public String getActionName() {
- return actionName;
- }
+ public String getActionName() {
+ return actionName;
+ }
- public void setActionName(String actionName) {
- this.actionName = actionName;
- }
+ public void setActionName(String actionName) {
+ this.actionName = actionName;
+ }
- public String getMode() {
- return mode;
- }
+ public String getMode() {
+ return mode;
+ }
- public void setMode(String mode) {
- this.mode = mode;
- }
+ public void setMode(String mode) {
+ this.mode = mode;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java
index bdb9161735..cb0b5663e6 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java
@@ -2,111 +2,104 @@ package org.onap.so.client.cds.beans;
import java.util.HashMap;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"service-instance-id",
-"pnf-id",
-"pnf-name",
-"service-model-uuid",
-"pnf-customization-uuid"
-})
+@JsonPropertyOrder({"service-instance-id", "pnf-id", "pnf-name", "service-model-uuid", "pnf-customization-uuid"})
public class ConfigAssignPropertiesForPnf {
- @JsonProperty("service-instance-id")
- private String serviceInstanceId;
-
- @JsonProperty("pnf-id")
- private String pnfId;
-
- @JsonProperty("pnf-name")
- private String pnfName;
-
- @JsonProperty("service-model-uuid")
- private String serviceModelUuid;
-
- @JsonProperty("pnf-customization-uuid")
- private String pnfCustomizationUuid;
-
- @JsonIgnore
- private Map<String, Object> userParam = new HashMap<String, Object>();
-
- public String getServiceInstanceId() {
- return serviceInstanceId;
- }
-
- public void setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
-
- 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;
- }
-
- public String getServiceModelUuid() {
- return serviceModelUuid;
- }
-
- public void setServiceModelUuid(String serviceModelUuid) {
- this.serviceModelUuid = serviceModelUuid;
- }
-
- public String getPnfCustomizationUuid() {
- return pnfCustomizationUuid;
- }
-
- public void setPnfCustomizationUuid(String pnfCustomizationUuid) {
- this.pnfCustomizationUuid = pnfCustomizationUuid;
- }
-
- public Map<String, Object> getUserParam() {
- return this.userParam;
- }
-
- public void setUserParam(String name, Object value) {
- this.userParam.put(name, value);
- }
-
- @Override
- public String toString() {
-
- final StringBuilder sb = new StringBuilder("{");
- sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
- sb.append(", \"pnf-id\":").append("\"").append(pnfId).append("\"");
- sb.append(", \"pnf-name\":").append("\"").append(pnfName).append("\"");
- sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
- sb.append(", \"pnf-customization-uuid\":").append("\"").append(pnfCustomizationUuid).append("\"");
- for (Map.Entry<String, Object> entry : userParam.entrySet()) {
- sb.append(",");
- sb.append("\"");
- sb.append(entry.getKey());
- sb.append("\"");
- sb.append(":");
- sb.append("\"");
- sb.append(entry.getValue());
- sb.append("\"");
- }
- sb.append('}');
-
- return sb.toString();
- }
+ @JsonProperty("service-instance-id")
+ private String serviceInstanceId;
+
+ @JsonProperty("pnf-id")
+ private String pnfId;
+
+ @JsonProperty("pnf-name")
+ private String pnfName;
+
+ @JsonProperty("service-model-uuid")
+ private String serviceModelUuid;
+
+ @JsonProperty("pnf-customization-uuid")
+ private String pnfCustomizationUuid;
+
+ @JsonIgnore
+ private Map<String, Object> userParam = new HashMap<String, Object>();
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ 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;
+ }
+
+ public String getServiceModelUuid() {
+ return serviceModelUuid;
+ }
+
+ public void setServiceModelUuid(String serviceModelUuid) {
+ this.serviceModelUuid = serviceModelUuid;
+ }
+
+ public String getPnfCustomizationUuid() {
+ return pnfCustomizationUuid;
+ }
+
+ public void setPnfCustomizationUuid(String pnfCustomizationUuid) {
+ this.pnfCustomizationUuid = pnfCustomizationUuid;
+ }
+
+ public Map<String, Object> getUserParam() {
+ return this.userParam;
+ }
+
+ public void setUserParam(String name, Object value) {
+ this.userParam.put(name, value);
+ }
+
+ @Override
+ public String toString() {
+
+ final StringBuilder sb = new StringBuilder("{");
+ sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
+ sb.append(", \"pnf-id\":").append("\"").append(pnfId).append("\"");
+ sb.append(", \"pnf-name\":").append("\"").append(pnfName).append("\"");
+ sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
+ sb.append(", \"pnf-customization-uuid\":").append("\"").append(pnfCustomizationUuid).append("\"");
+ for (Map.Entry<String, Object> entry : userParam.entrySet()) {
+ sb.append(",");
+ sb.append("\"");
+ sb.append(entry.getKey());
+ sb.append("\"");
+ sb.append(":");
+ sb.append("\"");
+ sb.append(entry.getValue());
+ sb.append("\"");
+ }
+ sb.append('}');
+
+ return sb.toString();
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java
index 1ce26d8585..bd894e3e7f 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java
@@ -2,23 +2,16 @@ package org.onap.so.client.cds.beans;
import java.util.HashMap;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"service-instance-id",
-"vnf-id",
-"vnf-name",
-"service-model-uuid",
-"vnf-customization-uuid"
-})
+@JsonPropertyOrder({"service-instance-id", "vnf-id", "vnf-name", "service-model-uuid", "vnf-customization-uuid"})
public class ConfigAssignPropertiesForVnf {
-
+
@JsonProperty("service-instance-id")
private String serviceInstanceId;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java
index b96847f422..33b7187ac8 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java
@@ -5,42 +5,39 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"config-assign-properties",
-"resolution-key"
-})
+@JsonPropertyOrder({"config-assign-properties", "resolution-key"})
public class ConfigAssignRequestPnf {
- @JsonProperty("resolution-key")
- private String resolutionKey;
- @JsonProperty("config-assign-properties")
- private ConfigAssignPropertiesForPnf configAssignPropertiesForPnf;
-
- public String getResolutionKey() {
- return resolutionKey;
- }
-
- public void setResolutionKey(String resolutionKey) {
- this.resolutionKey = resolutionKey;
- }
-
- public ConfigAssignPropertiesForPnf getConfigAssignPropertiesForPnf() {
- return configAssignPropertiesForPnf;
- }
-
- public void setConfigAssignPropertiesForPnf(ConfigAssignPropertiesForPnf configAssignPropertiesForPnf) {
- this.configAssignPropertiesForPnf = configAssignPropertiesForPnf;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder("{\"config-assign-request\":{");
- sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
- sb.append(", \"config-assign-properties\":").append(configAssignPropertiesForPnf.toString());
- sb.append('}');
- sb.append('}');
-
- return sb.toString();
- }
+ @JsonProperty("resolution-key")
+ private String resolutionKey;
+ @JsonProperty("config-assign-properties")
+ private ConfigAssignPropertiesForPnf configAssignPropertiesForPnf;
+
+ public String getResolutionKey() {
+ return resolutionKey;
+ }
+
+ public void setResolutionKey(String resolutionKey) {
+ this.resolutionKey = resolutionKey;
+ }
+
+ public ConfigAssignPropertiesForPnf getConfigAssignPropertiesForPnf() {
+ return configAssignPropertiesForPnf;
+ }
+
+ public void setConfigAssignPropertiesForPnf(ConfigAssignPropertiesForPnf configAssignPropertiesForPnf) {
+ this.configAssignPropertiesForPnf = configAssignPropertiesForPnf;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("{\"config-assign-request\":{");
+ sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
+ sb.append(", \"config-assign-properties\":").append(configAssignPropertiesForPnf.toString());
+ sb.append('}');
+ sb.append('}');
+
+ return sb.toString();
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java
index b3a9601e2e..8512c4017f 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java
@@ -1,45 +1,43 @@
package org.onap.so.client.cds.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({
-"config-assign-properties",
-"resolution-key"
-})
+@JsonPropertyOrder({"config-assign-properties", "resolution-key"})
public class ConfigAssignRequestVnf {
- @JsonProperty("resolution-key")
- private String resolutionKey;
- @JsonProperty("config-assign-properties")
- private ConfigAssignPropertiesForVnf configAssignPropertiesForVnf;
-
- public String getResolutionKey() {
- return resolutionKey;
- }
-
- public void setResolutionKey(String resolutionKey) {
- this.resolutionKey = resolutionKey;
- }
-
- public ConfigAssignPropertiesForVnf getConfigAssignPropertiesForVnf() {
- return configAssignPropertiesForVnf;
- }
-
- public void setConfigAssignPropertiesForVnf(ConfigAssignPropertiesForVnf configAssignPropertiesForVnf) {
- this.configAssignPropertiesForVnf = configAssignPropertiesForVnf;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder("{\"config-assign-request\":{");
- sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
- sb.append(", \"config-assign-properties\":").append(configAssignPropertiesForVnf.toString());
- sb.append('}');
- sb.append('}');
-
- return sb.toString();
- }
-
+ @JsonProperty("resolution-key")
+ private String resolutionKey;
+ @JsonProperty("config-assign-properties")
+ private ConfigAssignPropertiesForVnf configAssignPropertiesForVnf;
+
+ public String getResolutionKey() {
+ return resolutionKey;
+ }
+
+ public void setResolutionKey(String resolutionKey) {
+ this.resolutionKey = resolutionKey;
+ }
+
+ public ConfigAssignPropertiesForVnf getConfigAssignPropertiesForVnf() {
+ return configAssignPropertiesForVnf;
+ }
+
+ public void setConfigAssignPropertiesForVnf(ConfigAssignPropertiesForVnf configAssignPropertiesForVnf) {
+ this.configAssignPropertiesForVnf = configAssignPropertiesForVnf;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("{\"config-assign-request\":{");
+ sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
+ sb.append(", \"config-assign-properties\":").append(configAssignPropertiesForVnf.toString());
+ sb.append('}');
+ sb.append('}');
+
+ return sb.toString();
+ }
+
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java
index 6fadc7b55c..a9a3b0db15 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java
@@ -5,114 +5,107 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"service-instance-id",
-"pnf-id",
-"pnf-name",
-"pnf-ipv4-address",
-"pnf-ipv6-address",
-"service-model-uuid",
-"pnf-customization-uuid"
-})
+@JsonPropertyOrder({"service-instance-id", "pnf-id", "pnf-name", "pnf-ipv4-address", "pnf-ipv6-address",
+ "service-model-uuid", "pnf-customization-uuid"})
public class ConfigDeployPropertiesForPnf {
- @JsonProperty("service-instance-id")
- private String serviceInstanceId;
+ @JsonProperty("service-instance-id")
+ private String serviceInstanceId;
- @JsonProperty("pnf-id")
- private String pnfId;
+ @JsonProperty("pnf-id")
+ private String pnfId;
- @JsonProperty("pnf-name")
- private String pnfName;
+ @JsonProperty("pnf-name")
+ private String pnfName;
- /**
- * Config Deploy require IP address of PNF.
- */
- @JsonProperty("pnf-ipv4-address")
- private String pnfIpV4Address;
+ /**
+ * Config Deploy require IP address of PNF.
+ */
+ @JsonProperty("pnf-ipv4-address")
+ private String pnfIpV4Address;
- @JsonProperty("pnf-ipv6-address")
- private String pnfIpV6Address;
+ @JsonProperty("pnf-ipv6-address")
+ private String pnfIpV6Address;
- @JsonProperty("service-model-uuid")
- private String serviceModelUuid;
+ @JsonProperty("service-model-uuid")
+ private String serviceModelUuid;
- @JsonProperty("pnf-customization-uuid")
- private String pnfCustomizationUuid;
+ @JsonProperty("pnf-customization-uuid")
+ private String pnfCustomizationUuid;
- public String getServiceInstanceId() {
- return serviceInstanceId;
- }
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
- public void setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
- public String getPnfId() {
- return pnfId;
- }
+ public String getPnfId() {
+ return pnfId;
+ }
- public void setPnfId(String pnfId) {
- this.pnfId = pnfId;
- }
+ public void setPnfId(String pnfId) {
+ this.pnfId = pnfId;
+ }
- public String getPnfName() {
- return pnfName;
- }
+ public String getPnfName() {
+ return pnfName;
+ }
- public void setPnfName(String pnfName) {
- this.pnfName = pnfName;
- }
+ public void setPnfName(String pnfName) {
+ this.pnfName = pnfName;
+ }
- public String getServiceModelUuid() {
- return serviceModelUuid;
- }
+ public String getServiceModelUuid() {
+ return serviceModelUuid;
+ }
- public void setServiceModelUuid(String serviceModelUuid) {
- this.serviceModelUuid = serviceModelUuid;
- }
+ public void setServiceModelUuid(String serviceModelUuid) {
+ this.serviceModelUuid = serviceModelUuid;
+ }
- public String getPnfCustomizationUuid() {
- return pnfCustomizationUuid;
- }
+ public String getPnfCustomizationUuid() {
+ return pnfCustomizationUuid;
+ }
- public void setPnfCustomizationUuid(String pnfCustomizationUuid) {
- this.pnfCustomizationUuid = pnfCustomizationUuid;
- }
+ public void setPnfCustomizationUuid(String pnfCustomizationUuid) {
+ this.pnfCustomizationUuid = pnfCustomizationUuid;
+ }
- public String getPnfIpV4Address() {
- return pnfIpV4Address;
- }
+ public String getPnfIpV4Address() {
+ return pnfIpV4Address;
+ }
- public void setPnfIpV4Address(String pnfIpV4Address) {
- this.pnfIpV4Address = pnfIpV4Address;
- }
+ public void setPnfIpV4Address(String pnfIpV4Address) {
+ this.pnfIpV4Address = pnfIpV4Address;
+ }
- public String getPnfIpV6Address() {
- return pnfIpV6Address;
- }
+ public String getPnfIpV6Address() {
+ return pnfIpV6Address;
+ }
- public void setPnfIpV6Address(String pnfIpV6Address) {
- this.pnfIpV6Address = pnfIpV6Address;
- }
+ public void setPnfIpV6Address(String pnfIpV6Address) {
+ this.pnfIpV6Address = pnfIpV6Address;
+ }
- @Override
- public String toString() {
+ @Override
+ public String toString() {
- final StringBuilder sb = new StringBuilder("{");
- sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
- sb.append(", \"pnf-id\":").append("\"").append(pnfId).append("\"");
- sb.append(", \"pnf-name\":").append("\"").append(pnfName).append("\"");
- sb.append(", \"pnf-ipv4-address\":").append("\"").append(pnfIpV4Address).append("\"");
- sb.append(", \"pnf-ipv6-address\":").append("\"").append(pnfIpV6Address).append("\"");
- sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
- sb.append(", \"pnf-customization-uuid\":").append("\"").append(pnfCustomizationUuid).append("\"");
+ final StringBuilder sb = new StringBuilder("{");
+ sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
+ sb.append(", \"pnf-id\":").append("\"").append(pnfId).append("\"");
+ sb.append(", \"pnf-name\":").append("\"").append(pnfName).append("\"");
+ sb.append(", \"pnf-ipv4-address\":").append("\"").append(pnfIpV4Address).append("\"");
+ sb.append(", \"pnf-ipv6-address\":").append("\"").append(pnfIpV6Address).append("\"");
+ sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
+ sb.append(", \"pnf-customization-uuid\":").append("\"").append(pnfCustomizationUuid).append("\"");
- sb.append('}');
+ sb.append('}');
- return sb.toString();
- }
+ return sb.toString();
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java
index ca2530b541..a3ac91ab9d 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java
@@ -5,83 +5,77 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"service-instance-id",
-"vnf-id",
-"vnf-name",
-"service-model-uuid",
-"vnf-customization-uuid"
-})
+@JsonPropertyOrder({"service-instance-id", "vnf-id", "vnf-name", "service-model-uuid", "vnf-customization-uuid"})
public class ConfigDeployPropertiesForVnf {
- @JsonProperty("service-instance-id")
- private String serviceInstanceId;
+ @JsonProperty("service-instance-id")
+ private String serviceInstanceId;
- @JsonProperty("vnf-id")
- private String vnfId;
+ @JsonProperty("vnf-id")
+ private String vnfId;
- @JsonProperty("vnf-name")
- private String vnfName;
+ @JsonProperty("vnf-name")
+ private String vnfName;
- @JsonProperty("service-model-uuid")
- private String serviceModelUuid;
+ @JsonProperty("service-model-uuid")
+ private String serviceModelUuid;
- @JsonProperty("vnf-customization-uuid")
- private String vnfCustomizationUuid;
+ @JsonProperty("vnf-customization-uuid")
+ private String vnfCustomizationUuid;
- public String getServiceInstanceId() {
- return serviceInstanceId;
- }
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
- public void setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
- public String getVnfId() {
- return vnfId;
- }
+ public String getVnfId() {
+ return vnfId;
+ }
- public void setVnfId(String vnfId) {
- this.vnfId = vnfId;
- }
+ public void setVnfId(String vnfId) {
+ this.vnfId = vnfId;
+ }
- public String getVnfName() {
- return vnfName;
- }
+ public String getVnfName() {
+ return vnfName;
+ }
- public void setVnfName(String vnfName) {
- this.vnfName = vnfName;
- }
+ public void setVnfName(String vnfName) {
+ this.vnfName = vnfName;
+ }
- public String getServiceModelUuid() {
- return serviceModelUuid;
- }
+ public String getServiceModelUuid() {
+ return serviceModelUuid;
+ }
- public void setServiceModelUuid(String serviceModelUuid) {
- this.serviceModelUuid = serviceModelUuid;
- }
+ public void setServiceModelUuid(String serviceModelUuid) {
+ this.serviceModelUuid = serviceModelUuid;
+ }
- public String getVnfCustomizationUuid() {
- return vnfCustomizationUuid;
- }
+ public String getVnfCustomizationUuid() {
+ return vnfCustomizationUuid;
+ }
- public void setVnfCustomizationUuid(String vnfCustomizationUuid) {
- this.vnfCustomizationUuid = vnfCustomizationUuid;
- }
+ public void setVnfCustomizationUuid(String vnfCustomizationUuid) {
+ this.vnfCustomizationUuid = vnfCustomizationUuid;
+ }
- @Override
- public String toString() {
+ @Override
+ public String toString() {
- final StringBuilder sb = new StringBuilder("{");
- sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
- sb.append(", \"vnf-id\":").append("\"").append(vnfId).append("\"");
- sb.append(", \"vnf-name\":").append("\"").append(vnfName).append("\"");
- sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
- sb.append(", \"vnf-customization-uuid\":").append("\"").append(vnfCustomizationUuid).append("\"");
+ final StringBuilder sb = new StringBuilder("{");
+ sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
+ sb.append(", \"vnf-id\":").append("\"").append(vnfId).append("\"");
+ sb.append(", \"vnf-name\":").append("\"").append(vnfName).append("\"");
+ sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
+ sb.append(", \"vnf-customization-uuid\":").append("\"").append(vnfCustomizationUuid).append("\"");
- sb.append('}');
+ sb.append('}');
- return sb.toString();
- }
+ return sb.toString();
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java
index 4635008d3f..817729ba4f 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java
@@ -5,42 +5,39 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"config-deploy-properties",
-"resolution-key"
-})
+@JsonPropertyOrder({"config-deploy-properties", "resolution-key"})
public class ConfigDeployRequestPnf {
- @JsonProperty("resolution-key")
- private String resolutionKey;
-
- @JsonProperty("config-deploy-properties")
- private ConfigDeployPropertiesForPnf configDeployPropertiesForPnf;
-
- public String getResolutionKey() {
- return resolutionKey;
- }
-
- public void setResolutionKey(String resolutionKey) {
- this.resolutionKey = resolutionKey;
- }
-
- public ConfigDeployPropertiesForPnf getConfigDeployPropertiesForPnf() {
- return configDeployPropertiesForPnf;
- }
-
- public void setConfigDeployPropertiesForPnf(ConfigDeployPropertiesForPnf configDeployPropertiesForPnf) {
- this.configDeployPropertiesForPnf = configDeployPropertiesForPnf;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder("{\"config-deploy-request\":{");
- sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
- sb.append(", \"config-deploy-properties\":").append(configDeployPropertiesForPnf.toString());
- sb.append('}');
- sb.append('}');
-
- return sb.toString();
- }
+ @JsonProperty("resolution-key")
+ private String resolutionKey;
+
+ @JsonProperty("config-deploy-properties")
+ private ConfigDeployPropertiesForPnf configDeployPropertiesForPnf;
+
+ public String getResolutionKey() {
+ return resolutionKey;
+ }
+
+ public void setResolutionKey(String resolutionKey) {
+ this.resolutionKey = resolutionKey;
+ }
+
+ public ConfigDeployPropertiesForPnf getConfigDeployPropertiesForPnf() {
+ return configDeployPropertiesForPnf;
+ }
+
+ public void setConfigDeployPropertiesForPnf(ConfigDeployPropertiesForPnf configDeployPropertiesForPnf) {
+ this.configDeployPropertiesForPnf = configDeployPropertiesForPnf;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("{\"config-deploy-request\":{");
+ sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
+ sb.append(", \"config-deploy-properties\":").append(configDeployPropertiesForPnf.toString());
+ sb.append('}');
+ sb.append('}');
+
+ return sb.toString();
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java
index 53b956d3c4..c5fc0307b2 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java
@@ -5,42 +5,39 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"config-deploy-properties",
-"resolution-key"
-})
+@JsonPropertyOrder({"config-deploy-properties", "resolution-key"})
public class ConfigDeployRequestVnf {
- @JsonProperty("resolution-key")
- private String resolutionKey;
-
- @JsonProperty("config-deploy-properties")
- private ConfigDeployPropertiesForVnf configDeployPropertiesForVnf;
-
- public String getResolutionKey() {
- return resolutionKey;
- }
-
- public void setResolutionKey(String resolutionKey) {
- this.resolutionKey = resolutionKey;
- }
-
- public ConfigDeployPropertiesForVnf getConfigDeployPropertiesForVnf() {
- return configDeployPropertiesForVnf;
- }
-
- public void setConfigDeployPropertiesForVnf(ConfigDeployPropertiesForVnf configDeployPropertiesForVnf) {
- this.configDeployPropertiesForVnf = configDeployPropertiesForVnf;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder("{\"config-deploy-request\":{");
- sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
- sb.append(", \"config-deploy-properties\":").append(configDeployPropertiesForVnf.toString());
- sb.append('}');
- sb.append('}');
-
- return sb.toString();
- }
+ @JsonProperty("resolution-key")
+ private String resolutionKey;
+
+ @JsonProperty("config-deploy-properties")
+ private ConfigDeployPropertiesForVnf configDeployPropertiesForVnf;
+
+ public String getResolutionKey() {
+ return resolutionKey;
+ }
+
+ public void setResolutionKey(String resolutionKey) {
+ this.resolutionKey = resolutionKey;
+ }
+
+ public ConfigDeployPropertiesForVnf getConfigDeployPropertiesForVnf() {
+ return configDeployPropertiesForVnf;
+ }
+
+ public void setConfigDeployPropertiesForVnf(ConfigDeployPropertiesForVnf configDeployPropertiesForVnf) {
+ this.configDeployPropertiesForVnf = configDeployPropertiesForVnf;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("{\"config-deploy-request\":{");
+ sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
+ sb.append(", \"config-deploy-properties\":").append(configDeployPropertiesForVnf.toString());
+ sb.append('}');
+ sb.append('}');
+
+ return sb.toString();
+ }
}
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
index c5f08d4809..b037a86a78 100644
--- 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
@@ -17,24 +17,23 @@
* 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<String, String> properties;
+ private final Map<String, String> properties;
- public DefaultDmaapPropertiesImpl() {
- this.properties = new DmaapPropertiesMap();
- }
+ public DefaultDmaapPropertiesImpl() {
+ this.properties = new DmaapPropertiesMap();
+ }
- @Override
- public Map<String, String> getProperties() {
- return properties;
- }
+ @Override
+ public Map<String, String> 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
index cbedefe7eb..cc262b250f 100644
--- 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
@@ -23,7 +23,6 @@
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;
@@ -33,86 +32,90 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 Logger logger = LoggerFactory.getLogger(DmaapPropertiesClient.class);
-
- @Autowired
- private Provider<GlobalDmaapPublisher> 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) {
- logger.error("Exception occurred", 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);
- }
+ private static final Logger logger = LoggerFactory.getLogger(DmaapPropertiesClient.class);
+
+ @Autowired
+ private Provider<GlobalDmaapPublisher> 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) {
+ logger.error("Exception occurred", 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
index 796ccf18b7..b6ec2c5b9c 100644
--- 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
@@ -21,27 +21,26 @@
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
+ * 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 <K> Key for Map Entry
* @param <V> Value for Map Entry
*/
-public class DmaapPropertiesMap<K,V> extends HashMap<K,V> {
+public class DmaapPropertiesMap<K, V> extends HashMap<K, V> {
@Override
public V get(Object key) {
- return (V)UrnPropertiesReader.getVariable((String)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;
+ 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
index 17b99e2741..cb22fc5c7c 100644
--- 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
@@ -21,10 +21,8 @@ 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;
@@ -32,32 +30,32 @@ import org.springframework.stereotype.Component;
@Scope("prototype")
public class GlobalDmaapPublisher extends DmaapPublisher {
-
- public GlobalDmaapPublisher() throws IOException {
- super();
- }
-
- @Override
- public String getAuth() {
- return UrnPropertiesReader.getVariable("mso.global.dmaap.auth");
- }
+ public GlobalDmaapPublisher() throws IOException {
+ super();
+ }
+
+ @Override
+ public String getAuth() {
+
+ return UrnPropertiesReader.getVariable("mso.global.dmaap.auth");
+ }
- @Override
- public String getKey() {
+ @Override
+ public String getKey() {
- return UrnPropertiesReader.getVariable("mso.msoKey");
- }
+ return UrnPropertiesReader.getVariable("mso.msoKey");
+ }
- @Override
- public String getTopic() {
- return UrnPropertiesReader.getVariable("mso.global.dmaap.publisher.topic");
- }
+ @Override
+ public String getTopic() {
+ return UrnPropertiesReader.getVariable("mso.global.dmaap.publisher.topic");
+ }
- @Override
- public Optional<String> getHost() {
- return Optional.ofNullable(UrnPropertiesReader.getVariable("mso.global.dmaap.host"));
- }
+ @Override
+ public Optional<String> 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
index 26c8d80075..8a1a110fac 100644
--- 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
@@ -22,24 +22,23 @@ 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 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 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;
+ return resourceKey;
}
-
+
public String getResourceValue() {
- return resourceValue;
+ 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
index ac8ff9efe4..333d99ed2e 100644
--- 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
@@ -20,13 +20,12 @@
package org.onap.so.client.exception;
-public class BadResponseException extends Exception{
+public class BadResponseException extends Exception {
- public BadResponseException() {}
+ public BadResponseException() {}
- public BadResponseException(String message)
- {
- super(message);
+ 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
index cb65f4d420..ae5e41f7ce 100644
--- 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
@@ -35,96 +35,101 @@ import org.springframework.stereotype.Component;
@Component
public class ExceptionBuilder {
- private static final Logger logger = LoggerFactory.getLogger(ExceptionBuilder.class);
-
- public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception) {
- String msg = "Exception in %s.%s ";
- try{
- logger.error("Exception occurred", 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;
- }
- }
-
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue(), msg.toString());
- execution.setVariable(errorVariable, exception.getMessage());
- } catch (Exception ex){
- //log trace, allow process to complete gracefully
- logger.error("Exception occurred", ex);
- }
-
- if (exception.getMessage() != null)
- msg = msg.concat(exception.getMessage());
- buildAndThrowWorkflowException(execution, errorCode, msg);
- }
-
- public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, Exception exception) {
- String msg = "Exception in %s.%s ";
- try{
- logger.error("Exception occurred", 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;
- }
- }
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue(), msg.toString());
- execution.setVariable(errorVariable, exception.getMessage());
- } catch (Exception ex){
- //log trace, allow process to complete gracefully
- logger.error("Exception occurred", 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);
- logger.info("Building a WorkflowException for Subflow");
-
- WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage);
- execution.setVariable("WorkflowException", exception);
- execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
- logger.info("Outgoing WorkflowException is {}", exception);
- logger.info("Throwing MSOWorkflowException");
- throw new BpmnError("MSOWorkflowException");
- }
-
- public void buildAndThrowWorkflowException(DelegateExecution execution, String errorCode, String errorMessage) {
- execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
- throw new BpmnError(errorCode,errorMessage);
- }
-
- public String getProcessKey(DelegateExecution execution) {
- String testKey = (String) execution.getVariable("testProcessKey");
- if (testKey != null) {
- return testKey;
- }
- return execution.getProcessEngineServices().getRepositoryService()
- .getProcessDefinition(execution.getProcessDefinitionId()).getKey();
- }
+ private static final Logger logger = LoggerFactory.getLogger(ExceptionBuilder.class);
+
+ public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception) {
+ String msg = "Exception in %s.%s ";
+ try {
+ logger.error("Exception occurred", 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;
+ }
+ }
+
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue(), msg.toString());
+ execution.setVariable(errorVariable, exception.getMessage());
+ } catch (Exception ex) {
+ // log trace, allow process to complete gracefully
+ logger.error("Exception occurred", ex);
+ }
+
+ if (exception.getMessage() != null)
+ msg = msg.concat(exception.getMessage());
+ buildAndThrowWorkflowException(execution, errorCode, msg);
+ }
+
+ public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, Exception exception) {
+ String msg = "Exception in %s.%s ";
+ try {
+ logger.error("Exception occurred", 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;
+ }
+ }
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue(), msg.toString());
+ execution.setVariable(errorVariable, exception.getMessage());
+ } catch (Exception ex) {
+ // log trace, allow process to complete gracefully
+ logger.error("Exception occurred", 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);
+ logger.info("Building a WorkflowException for Subflow");
+
+ WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage);
+ execution.setVariable("WorkflowException", exception);
+ execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
+ logger.info("Outgoing WorkflowException is {}", exception);
+ logger.info("Throwing MSOWorkflowException");
+ throw new BpmnError("MSOWorkflowException");
+ }
+
+ public void buildAndThrowWorkflowException(DelegateExecution execution, String errorCode, String errorMessage) {
+ execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
+ throw new BpmnError(errorCode, errorMessage);
+ }
+
+ 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
index 3f3beadb92..354c669d62 100644
--- 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
@@ -20,13 +20,12 @@
package org.onap.so.client.exception;
-public class MapperException extends Exception{
-
+public class MapperException extends Exception {
+
public MapperException() {}
- public MapperException(String message)
- {
- super(message);
+ 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
index fe7b079568..e9d1e1fba0 100644
--- 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
@@ -20,10 +20,10 @@
package org.onap.so.client.exception;
-public class OrchestrationStatusValidationException extends Exception{
- public OrchestrationStatusValidationException() {}
+public class OrchestrationStatusValidationException extends Exception {
+ public OrchestrationStatusValidationException() {}
public OrchestrationStatusValidationException(String message) {
- super(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
index b7164e327e..c88e9ae34f 100644
--- 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
@@ -22,7 +22,6 @@ 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;
@@ -31,33 +30,33 @@ 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);
- }
+ 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/CDSPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java
index d1888b17df..64c45653e1 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java
@@ -75,9 +75,9 @@ public class CDSPropertiesImpl implements CDSProperties {
public boolean mapNotFoundToEmpty() {
return false;
}
-
+
@Override
- public int getTimeout() {
- return Integer.parseInt(Objects.requireNonNull(UrnPropertiesReader.getVariable(TIMEOUT)));
- }
+ public int getTimeout() {
+ return Integer.parseInt(Objects.requireNonNull(UrnPropertiesReader.getVariable(TIMEOUT)));
+ }
}
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
index 1e43adceba..4bdb8bd0fb 100644
--- 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
@@ -22,44 +22,42 @@ 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);
- }
+ 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
index 030eff92e2..5cd567a7e3 100644
--- 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
@@ -24,7 +24,7 @@ import org.onap.so.bpmn.core.UrnPropertiesReader;
public class UrnPropertiesReaderWrapper {
- public String getVariable(String key) {
- return UrnPropertiesReader.getVariable(key);
- }
+ public String getVariable(String key) {
+ return UrnPropertiesReader.getVariable(key);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java
index 64283d78ca..528b10ef6f 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java
@@ -23,8 +23,8 @@ package org.openecomp.mso.bpmn.common.workflow.service;
import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
/**
- * Exception thrown when an error occurs while processing the workflow.
- * This encapsulates the workflow response so that the same can be sent back to api handler.
+ * Exception thrown when an error occurs while processing the workflow. This encapsulates the workflow response so that
+ * the same can be sent back to api handler.
*/
public class WorkflowProcessorException extends RuntimeException {
WorkflowResponse workflowResponse;
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllBaseTaskTestSuite.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllBaseTaskTestSuite.java
index cd9bdc9532..f56256fac8 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllBaseTaskTestSuite.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllBaseTaskTestSuite.java
@@ -21,13 +21,13 @@
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"})
+@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
+ // 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
index 696323c4ad..2608fad987 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllGroovyTestSuites.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllGroovyTestSuites.java
@@ -19,14 +19,14 @@
*/
package org.onap.so;
-import org.junit.runner.RunWith;
+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
+ // 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
index fa70ccf23d..0bcae3f4cf 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllTestSuites.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllTestSuites.java
@@ -19,14 +19,14 @@
*/
package org.onap.so;
-import org.junit.runner.RunWith;
+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
+ // 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
index 0f702fca2d..e7395b716e 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java
@@ -26,7 +26,6 @@ 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.junit.Before;
@@ -51,7 +50,6 @@ 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.WireMockServer;
@@ -63,88 +61,86 @@ import com.github.tomakehurst.wiremock.WireMockServer;
@AutoConfigureWireMock(port = 0)
@Category(SpringAware.class)
public abstract class BaseTest extends BuildingBlockTestDataSetup {
-
-
- protected Map<String, Object> variables = new HashMap<>();
-
- protected TestRestTemplate restTemplate = new TestRestTemplate();
-
- protected HttpHeaders headers = new HttpHeaders();
-
-
- @Autowired
- protected RuntimeService runtimeService;
-
- @Autowired
- private RepositoryService repositoryService;
-
- @Autowired
- protected WireMockServer wireMockServer;
- /*
- * 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() {
- wireMockServer.resetAll();
- 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;
- }
-
+
+
+ protected Map<String, Object> variables = new HashMap<>();
+
+ protected TestRestTemplate restTemplate = new TestRestTemplate();
+
+ protected HttpHeaders headers = new HttpHeaders();
+
+
+ @Autowired
+ protected RuntimeService runtimeService;
+
+ @Autowired
+ private RepositoryService repositoryService;
+
+ @Autowired
+ protected WireMockServer wireMockServer;
+ /*
+ * 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() {
+ wireMockServer.resetAll();
+ 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;
+ }
+
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseUnitTest.java
index 5719ce15e2..fc5709d1be 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseUnitTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseUnitTest.java
@@ -20,6 +20,6 @@
package org.onap.so;
-public abstract class BaseUnitTest extends BuildingBlockTestDataSetup{
+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
index bf98648dbc..79a94d5298 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
@@ -21,13 +21,11 @@ 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;
@@ -71,511 +69,513 @@ 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<ResourceKey, String> 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<ResourceKey, String>();
- 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<String, String> buildUserInput() {
- Map<String, String> userInput = new HashMap<>();
- userInput.put("testUserInputKey", "testUserInputValue");
-
- return userInput;
- }
-
- public Map<String, String> setUserInput() {
- Map<String, String> 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<String,Object> dataMap = new HashMap<>();
- dataMap.put("vpnId","testVpnId");
- dataMap.put("vpnRegion","testVpnRegion");
- dataMap.put("vpnRt","testVpnRt");
- dataMap.put("vpnName","vpnName");
+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<ResourceKey, String> 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<ResourceKey, String>();
+ 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<String, String> buildUserInput() {
+ Map<String, String> userInput = new HashMap<>();
+ userInput.put("testUserInputKey", "testUserInputValue");
+
+ return userInput;
+ }
+
+ public Map<String, String> setUserInput() {
+ Map<String, String> 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<String, Object> dataMap = new HashMap<>();
+ dataMap.put("vpnId", "testVpnId");
+ dataMap.put("vpnRegion", "testVpnRegion");
+ dataMap.put("vpnRt", "testVpnRt");
+ dataMap.put("vpnName", "vpnName");
ArrayList<String> vpnRegions = new ArrayList<String>();
vpnRegions.add("USA");
vpnRegions.add("EMEA");
vpnRegions.add("APAC");
dataMap.put("vpnRegion", vpnRegions);
- HashMap<String,Object> userParams = new HashMap<>();
- userParams.put("vpnData",dataMap);
+ HashMap<String, Object> userParams = new HashMap<>();
+ userParams.put("vpnData", dataMap);
- List<Map<String,Object>> userParamsList = new ArrayList<>();
- userParamsList.add(userParams);
+ List<Map<String, Object>> userParamsList = new ArrayList<>();
+ userParamsList.add(userParams);
- RequestParameters requestParameters = new RequestParameters();
- requestParameters.setUserParams(userParamsList);
- requestContext.setRequestParameters(requestParameters);
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setUserParams(userParamsList);
+ requestContext.setRequestParameters(requestParameters);
- return requestContext;
- }
+ return requestContext;
+ }
- public RequestContext setRequestContext() {
- RequestContext requestContext = buildRequestContext();
+ public RequestContext setRequestContext() {
+ RequestContext requestContext = buildRequestContext();
- gBBInput.setRequestContext(requestContext);
+ gBBInput.setRequestContext(requestContext);
- return requestContext;
- }
+ return requestContext;
+ }
- public CloudRegion buildCloudRegion() {
- CloudRegion cloudRegion = new CloudRegion();
- cloudRegion.setLcpCloudRegionId("testLcpCloudRegionId");
- cloudRegion.setTenantId("testTenantId");
- cloudRegion.setCloudOwner("testCloudOwner");
+ public CloudRegion buildCloudRegion() {
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setLcpCloudRegionId("testLcpCloudRegionId");
+ cloudRegion.setTenantId("testTenantId");
+ cloudRegion.setCloudOwner("testCloudOwner");
- return cloudRegion;
- }
+ return cloudRegion;
+ }
- public CloudRegion setCloudRegion() {
- CloudRegion cloudRegion = buildCloudRegion();
+ public CloudRegion setCloudRegion() {
+ CloudRegion cloudRegion = buildCloudRegion();
- gBBInput.setCloudRegion(cloudRegion);
+ gBBInput.setCloudRegion(cloudRegion);
- return cloudRegion;
- }
+ return cloudRegion;
+ }
- public OrchestrationContext buildOrchestrationContext() {
- OrchestrationContext orchestrationContext = new OrchestrationContext();
+ public OrchestrationContext buildOrchestrationContext() {
+ OrchestrationContext orchestrationContext = new OrchestrationContext();
- return orchestrationContext;
- }
+ return orchestrationContext;
+ }
- public OrchestrationContext setOrchestrationContext() {
- OrchestrationContext orchestrationContext = buildOrchestrationContext();
+ public OrchestrationContext setOrchestrationContext() {
+ OrchestrationContext orchestrationContext = buildOrchestrationContext();
- gBBInput.setOrchContext(orchestrationContext);
+ gBBInput.setOrchContext(orchestrationContext);
- return orchestrationContext;
- }
+ return orchestrationContext;
+ }
- public Collection buildCollection() {
- collectionCounter++;
+ public Collection buildCollection() {
+ collectionCounter++;
- Collection collection = new Collection();
- collection.setId("testId" + collectionCounter);
- collection.setInstanceGroup(buildInstanceGroup());
+ Collection collection = new Collection();
+ collection.setId("testId" + collectionCounter);
+ collection.setInstanceGroup(buildInstanceGroup());
- return collection;
- }
+ return collection;
+ }
- public Configuration buildConfiguration() {
- configurationCounter++;
+ public Configuration buildConfiguration() {
+ configurationCounter++;
- Configuration configuration = new Configuration();
- configuration.setConfigurationId("testConfigurationId" + configurationCounter);
- configuration.setConfigurationName("testConfigurationName" + 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);
+ ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
+ modelInfoConfiguration.setModelVersionId("testModelVersionId" + configurationCounter);
+ modelInfoConfiguration.setModelInvariantId("testModelInvariantId" + configurationCounter);
+ modelInfoConfiguration.setModelCustomizationId("testModelCustomizationId" + configurationCounter);
- configuration.setModelInfoConfiguration(modelInfoConfiguration);
+ configuration.setModelInfoConfiguration(modelInfoConfiguration);
- return configuration;
- }
+ return configuration;
+ }
- public OwningEntity buildOwningEntity() {
- owningEntityCounter++;
+ public OwningEntity buildOwningEntity() {
+ owningEntityCounter++;
- OwningEntity owningEntity = new OwningEntity();
- owningEntity.setOwningEntityId("testOwningEntityId" + owningEntityCounter);
- owningEntity.setOwningEntityName("testOwningEntityName" + owningEntityCounter);
+ OwningEntity owningEntity = new OwningEntity();
+ owningEntity.setOwningEntityId("testOwningEntityId" + owningEntityCounter);
+ owningEntity.setOwningEntityName("testOwningEntityName" + owningEntityCounter);
- return owningEntity;
- }
+ return owningEntity;
+ }
- public Project buildProject() {
- projectCounter++;
+ public Project buildProject() {
+ projectCounter++;
- Project project = new Project();
- project.setProjectName("testProjectName" + projectCounter);
+ Project project = new Project();
+ project.setProjectName("testProjectName" + projectCounter);
- return project;
- }
+ return project;
+ }
- public ServiceSubscription buildServiceSubscription() {
- serviceSubscriptionCounter++;
+ public ServiceSubscription buildServiceSubscription() {
+ serviceSubscriptionCounter++;
- ServiceSubscription serviceSubscription = new ServiceSubscription();
- serviceSubscription.setTempUbSubAccountId("testTempUbSubAccountId" + serviceSubscriptionCounter);
- serviceSubscription.setServiceType("testServiceType" + serviceSubscriptionCounter);
+ ServiceSubscription serviceSubscription = new ServiceSubscription();
+ serviceSubscription.setTempUbSubAccountId("testTempUbSubAccountId" + serviceSubscriptionCounter);
+ serviceSubscription.setServiceType("testServiceType" + serviceSubscriptionCounter);
- return serviceSubscription;
- }
+ return serviceSubscription;
+ }
- public Customer buildCustomer() {
- customerCounter++;
+ public Customer buildCustomer() {
+ customerCounter++;
- Customer customer = new Customer();
- customer.setGlobalCustomerId("testGlobalCustomerId" + customerCounter);
- customer.setSubscriberType("testSubscriberType" + customerCounter);
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("testGlobalCustomerId" + customerCounter);
+ customer.setSubscriberType("testSubscriberType" + customerCounter);
- customer.setServiceSubscription(buildServiceSubscription());
+ customer.setServiceSubscription(buildServiceSubscription());
- return customer;
- }
+ return customer;
+ }
- public ServiceInstance buildServiceInstance() {
- serviceInstanceCounter++;
+ public ServiceInstance buildServiceInstance() {
+ serviceInstanceCounter++;
- ServiceInstance serviceInstance = new ServiceInstance();
- serviceInstance.setServiceInstanceId("testServiceInstanceId" + serviceInstanceCounter);
- serviceInstance.setServiceInstanceName("testServiceInstanceName" + 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);
+ 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.setProject(buildProject());
- serviceInstance.setOwningEntity(buildOwningEntity());
+ serviceInstance.setOwningEntity(buildOwningEntity());
- serviceInstance.setCollection(buildCollection());
+ serviceInstance.setCollection(buildCollection());
- serviceInstance.getConfigurations().add(buildConfiguration());
+ serviceInstance.getConfigurations().add(buildConfiguration());
- return serviceInstance;
- }
+ return serviceInstance;
+ }
- public ServiceInstance setServiceInstance() {
- ServiceInstance serviceInstance = buildServiceInstance();
+ 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());
+ if (gBBInput.getCustomer() == null) {
+ gBBInput.setCustomer(buildCustomer());
+ }
+ gBBInput.getCustomer().getServiceSubscription().getServiceInstances().add(serviceInstance);
+ lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId());
- return serviceInstance;
- }
+ return serviceInstance;
+ }
- public Customer setCustomer() {
- if(gBBInput.getCustomer() != null) return gBBInput.getCustomer();
- Customer customer = new Customer();
- customer.setGlobalCustomerId("testGlobalCustomerId");
- customer.setSubscriberType("testSubscriberType");
+ public Customer setCustomer() {
+ if (gBBInput.getCustomer() != null)
+ return gBBInput.getCustomer();
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("testGlobalCustomerId");
+ customer.setSubscriberType("testSubscriberType");
- customer.setServiceSubscription(buildServiceSubscription());
+ customer.setServiceSubscription(buildServiceSubscription());
- gBBInput.setCustomer(customer);
+ gBBInput.setCustomer(customer);
- return customer;
- }
+ return customer;
+ }
- public Collection setCollection() {
- Collection collection = new Collection();
- collection.setId("testId");
+ public Collection setCollection() {
+ Collection collection = new Collection();
+ collection.setId("testId");
- ServiceInstance serviceInstance = null;
+ ServiceInstance serviceInstance = null;
- try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- } catch(BBObjectNotFoundException e) {
- serviceInstance = setServiceInstance();
- }
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ } catch (BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
- serviceInstance.setCollection(collection);
+ serviceInstance.setCollection(collection);
- return collection;
- }
+ return collection;
+ }
- public InstanceGroup setInstanceGroup() {
- InstanceGroup instanceGroup = new InstanceGroup();
- instanceGroup.setId("testId");
- instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction");
+ public InstanceGroup setInstanceGroup() {
+ InstanceGroup instanceGroup = new InstanceGroup();
+ instanceGroup.setId("testId");
+ instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction");
- Collection collection = null;
+ Collection collection = null;
- try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- collection = serviceInstance.getCollection();
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ collection = serviceInstance.getCollection();
- if (collection == null) {
- collection = setCollection();
- }
- } catch(BBObjectNotFoundException e) {
- collection = setCollection();
- }
+ if (collection == null) {
+ collection = setCollection();
+ }
+ } catch (BBObjectNotFoundException e) {
+ collection = setCollection();
+ }
- collection.setInstanceGroup(instanceGroup);
+ collection.setInstanceGroup(instanceGroup);
- return instanceGroup;
- }
+ return instanceGroup;
+ }
- public VpnBinding buildVpnBinding() {
- vpnBindingCounter++;
+ public VpnBinding buildVpnBinding() {
+ vpnBindingCounter++;
- VpnBinding vpnBinding = new VpnBinding();
- vpnBinding.setVpnId("testVpnId" + vpnBindingCounter);
- vpnBinding.setVpnName("testVpnName" + vpnBindingCounter);
- vpnBinding.setCustomerVpnId("testCustomerVpnId" + vpnBindingCounter);
+ VpnBinding vpnBinding = new VpnBinding();
+ vpnBinding.setVpnId("testVpnId" + vpnBindingCounter);
+ vpnBinding.setVpnName("testVpnName" + vpnBindingCounter);
+ vpnBinding.setCustomerVpnId("testCustomerVpnId" + vpnBindingCounter);
- return vpnBinding;
- }
+ return vpnBinding;
+ }
- public VpnBinding setVpnBinding() {
- VpnBinding vpnBinding = buildVpnBinding();
+ public VpnBinding setVpnBinding() {
+ VpnBinding vpnBinding = buildVpnBinding();
- Customer customer = gBBInput.getCustomer();
+ Customer customer = gBBInput.getCustomer();
- if(customer == null){
- customer = buildCustomer();
- }
+ if (customer == null) {
+ customer = buildCustomer();
+ }
- customer.getVpnBindings().add(vpnBinding);
- lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId());
+ customer.getVpnBindings().add(vpnBinding);
+ lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId());
- return vpnBinding;
- }
+ return vpnBinding;
+ }
- public InstanceGroup buildInstanceGroup() {
- instanceGroupCounter++;
+ public InstanceGroup buildInstanceGroup() {
+ instanceGroupCounter++;
- InstanceGroup instanceGroup = new InstanceGroup();
- instanceGroup.setId("testId" + instanceGroupCounter);
- instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction" + instanceGroupCounter);
+ InstanceGroup instanceGroup = new InstanceGroup();
+ instanceGroup.setId("testId" + instanceGroupCounter);
+ instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction" + instanceGroupCounter);
- return instanceGroup;
- }
+ return instanceGroup;
+ }
- public L3Network buildL3Network() {
- l3NetworkCounter++;
+ public L3Network buildL3Network() {
+ l3NetworkCounter++;
- L3Network network = new L3Network();
- network.setNetworkId("testNetworkId" + l3NetworkCounter);
- network.setNetworkName("testNetworkName" + l3NetworkCounter);
- network.setNetworkType("testNetworkType" + 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);
+ 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;
- }
+ return network;
+ }
- public L3Network setL3Network() {
- L3Network network = buildL3Network();
+ public L3Network setL3Network() {
+ L3Network network = buildL3Network();
- ServiceInstance serviceInstance = null;
+ ServiceInstance serviceInstance = null;
- try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- } catch(BBObjectNotFoundException e) {
- serviceInstance = setServiceInstance();
- }
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ } catch (BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
- serviceInstance.getNetworks().add(network);
- lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId());
+ serviceInstance.getNetworks().add(network);
+ lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId());
- return network;
- }
+ return network;
+ }
- public GenericVnf buildGenericVnf() {
- genericVnfCounter++;
+ public GenericVnf buildGenericVnf() {
+ genericVnfCounter++;
- GenericVnf genericVnf = new GenericVnf();
- genericVnf.setVnfId("testVnfId" + genericVnfCounter);
- genericVnf.setVnfName("testVnfName" + genericVnfCounter);
- genericVnf.setVnfType("testVnfType" + 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);
+ Platform platform = new Platform();
+ platform.setPlatformName("testPlatformName");
+ genericVnf.setPlatform(platform);
- LineOfBusiness lob = new LineOfBusiness();
- lob.setLineOfBusinessName("testLineOfBusinessName");
- genericVnf.setLineOfBusiness(lob);
+ 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);
+ 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;
- }
+ return genericVnf;
+ }
- public GenericVnf setGenericVnf() {
- GenericVnf genericVnf = buildGenericVnf();
+ public GenericVnf setGenericVnf() {
+ GenericVnf genericVnf = buildGenericVnf();
- ServiceInstance serviceInstance = null;
+ ServiceInstance serviceInstance = null;
- try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- } catch(BBObjectNotFoundException e) {
- serviceInstance = setServiceInstance();
- }
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ } catch (BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
- serviceInstance.getVnfs().add(genericVnf);
- lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId());
+ serviceInstance.getVnfs().add(genericVnf);
+ lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId());
- return genericVnf;
- }
+ return genericVnf;
+ }
- public VfModule buildVfModule() {
- vfModuleCounter++;
+ public VfModule buildVfModule() {
+ vfModuleCounter++;
- VfModule vfModule = new VfModule();
- vfModule.setVfModuleId("testVfModuleId" + vfModuleCounter);
- vfModule.setVfModuleName("testVfModuleName" + 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);
+ 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;
- }
+ return vfModule;
+ }
- public VfModule setVfModule() {
- VfModule vfModule = buildVfModule();
+ public VfModule setVfModule() {
+ VfModule vfModule = buildVfModule();
- GenericVnf genericVnf = null;
+ GenericVnf genericVnf = null;
- try {
- genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- } catch(BBObjectNotFoundException e) {
- genericVnf = setGenericVnf();
- }
+ try {
+ genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ } catch (BBObjectNotFoundException e) {
+ genericVnf = setGenericVnf();
+ }
- genericVnf.getVfModules().add(vfModule);
- lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId());
+ genericVnf.getVfModules().add(vfModule);
+ lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId());
- return vfModule;
- }
+ return vfModule;
+ }
- public VolumeGroup buildVolumeGroup() {
- volumeGroupCounter++;
+ public VolumeGroup buildVolumeGroup() {
+ volumeGroupCounter++;
- VolumeGroup volumeGroup = new VolumeGroup();
- volumeGroup.setVolumeGroupId("testVolumeGroupId" + volumeGroupCounter);
- volumeGroup.setVolumeGroupName("testVolumeGroupName" + volumeGroupCounter);
- volumeGroup.setHeatStackId("testHeatStackId" + volumeGroupCounter);
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupId("testVolumeGroupId" + volumeGroupCounter);
+ volumeGroup.setVolumeGroupName("testVolumeGroupName" + volumeGroupCounter);
+ volumeGroup.setHeatStackId("testHeatStackId" + volumeGroupCounter);
- return volumeGroup;
- }
+ return volumeGroup;
+ }
- public VolumeGroup setVolumeGroup() {
- VolumeGroup volumeGroup = buildVolumeGroup();
+ public VolumeGroup setVolumeGroup() {
+ VolumeGroup volumeGroup = buildVolumeGroup();
- GenericVnf genericVnf = null;
+ GenericVnf genericVnf = null;
- try {
- genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- } catch(BBObjectNotFoundException e) {
- genericVnf = setGenericVnf();
- }
+ try {
+ genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ } catch (BBObjectNotFoundException e) {
+ genericVnf = setGenericVnf();
+ }
- genericVnf.getVolumeGroups().add(volumeGroup);
- lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId());
+ genericVnf.getVolumeGroups().add(volumeGroup);
+ lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId());
- return volumeGroup;
- }
+ return volumeGroup;
+ }
- public Pnf buildPnf() {
- pnfCounter++;
+ public Pnf buildPnf() {
+ pnfCounter++;
- Pnf pnf = new Pnf();
- pnf.setPnfId("testPnfId" + pnfCounter);
- pnf.setPnfName("testPnfName" + pnfCounter);
+ Pnf pnf = new Pnf();
+ pnf.setPnfId("testPnfId" + pnfCounter);
+ pnf.setPnfName("testPnfName" + pnfCounter);
- return pnf;
- }
+ return pnf;
+ }
- public ServiceProxy buildServiceProxy() {
- serviceProxyCounter++;
+ public ServiceProxy buildServiceProxy() {
+ serviceProxyCounter++;
ServiceProxy serviceProxy = new ServiceProxy();
serviceProxy.setServiceInstance(buildServiceInstance());
@@ -590,106 +590,106 @@ public class BuildingBlockTestDataSetup{
serviceProxy.getServiceInstance().getPnfs().add(secondaryPnf);
return serviceProxy;
- }
+ }
- public VpnBondingLink buildVpnBondingLink() {
- vpnBondingLinkCounter++;
+ public VpnBondingLink buildVpnBondingLink() {
+ vpnBondingLinkCounter++;
- VpnBondingLink vpnBondingLink = new VpnBondingLink();
- vpnBondingLink.setVpnBondingLinkId("testVpnBondingLinkId" + vpnBondingLinkCounter);
+ VpnBondingLink vpnBondingLink = new VpnBondingLink();
+ vpnBondingLink.setVpnBondingLinkId("testVpnBondingLinkId" + vpnBondingLinkCounter);
- Configuration vnrConfiguration = buildConfiguration();
- vnrConfiguration.setNetwork(buildL3Network());
- vpnBondingLink.setVnrConfiguration(vnrConfiguration);
+ Configuration vnrConfiguration = buildConfiguration();
+ vnrConfiguration.setNetwork(buildL3Network());
+ vpnBondingLink.setVnrConfiguration(vnrConfiguration);
- vpnBondingLink.setVrfConfiguration(buildConfiguration());
+ 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);
- } 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;
- }
-
- public Configuration setConfiguration () {
- Configuration config = new Configuration();
- config.setConfigurationId("testConfigurationId");
- ModelInfoConfiguration modelInfoConfig = new ModelInfoConfiguration();
- modelInfoConfig.setModelCustomizationId("modelCustomizationId");
- modelInfoConfig.setModelVersionId("modelVersionId");
- modelInfoConfig.setModelInvariantId("modelInvariantId");
- modelInfoConfig.setPolicyName("policyName");
- config.setModelInfoConfiguration(modelInfoConfig);
-
- List<Configuration> configurations = new ArrayList<>();
- configurations.add(config);
- ServiceInstance serviceInstance = new ServiceInstance();
- try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- } catch(BBObjectNotFoundException e) {
- serviceInstance = setServiceInstance();
- }
- lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "testConfigurationId");
- serviceInstance.setConfigurations(configurations);
- return config;
- }
-} \ No newline at end of file
+ return vpnBondingLink;
+ }
+
+ public VpnBondingLink setVpnBondingLink() {
+ VpnBondingLink vpnBondingLink = buildVpnBondingLink();
+
+ ServiceInstance serviceInstance = null;
+
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, 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;
+ }
+
+ public Configuration setConfiguration() {
+ Configuration config = new Configuration();
+ config.setConfigurationId("testConfigurationId");
+ ModelInfoConfiguration modelInfoConfig = new ModelInfoConfiguration();
+ modelInfoConfig.setModelCustomizationId("modelCustomizationId");
+ modelInfoConfig.setModelVersionId("modelVersionId");
+ modelInfoConfig.setModelInvariantId("modelInvariantId");
+ modelInfoConfig.setPolicyName("policyName");
+ config.setModelInfoConfiguration(modelInfoConfig);
+
+ List<Configuration> configurations = new ArrayList<>();
+ configurations.add(config);
+ ServiceInstance serviceInstance = new ServiceInstance();
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ } catch (BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
+ lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "testConfigurationId");
+ serviceInstance.setConfigurations(configurations);
+ return config;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java
index fb08e5e830..62d9ecee44 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java
@@ -19,6 +19,7 @@
*/
package org.onap.so;
+
import ch.vorburger.exec.ManagedProcessException;
import ch.vorburger.mariadb4j.DBConfigurationBuilder;
import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
@@ -35,30 +36,25 @@ public class EmbeddedMariaDbConfig {
@Bean
MariaDB4jSpringService mariaDB4jSpringService() {
- MariaDB4jSpringService service = new MariaDB4jSpringService();
-
-
- service.getConfiguration().addArg("--lower_case_table_names=1");
+ 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
+ @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();
+ 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/NonSpringSuite.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/NonSpringSuite.java
index ee2848cf3a..4a9b3e1775 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/NonSpringSuite.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/NonSpringSuite.java
@@ -22,7 +22,6 @@ package org.onap.so;
import org.junit.runner.RunWith;
import org.onap.so.test.categories.SpringAware;
-
import com.googlecode.junittoolbox.ExcludeCategories;
import com.googlecode.junittoolbox.SuiteClasses;
import com.googlecode.junittoolbox.WildcardPatternSuite;
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/SerializableChecker.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/SerializableChecker.java
index 97c17d5238..47ddea1b4f 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/SerializableChecker.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/SerializableChecker.java
@@ -29,78 +29,65 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-public final class SerializableChecker
-{
- public static class SerializationFailure
- {
+public final class SerializableChecker {
+ public static class SerializationFailure {
private final String mContainingClass;
private final String mMemberName;
- public SerializationFailure(String inNonSerializableClass, String inMemberName)
- {
+ public SerializationFailure(String inNonSerializableClass, String inMemberName) {
mContainingClass = inNonSerializableClass;
mMemberName = inMemberName;
}
- public String getContainingClass()
- {
+ public String getContainingClass() {
return mContainingClass;
}
- public String getMemberName()
- {
+ public String getMemberName() {
return mMemberName;
}
- public String getBadMemberString()
- {
+ public String getBadMemberString() {
if (mMemberName == null)
return mContainingClass;
return mContainingClass + "." + mMemberName;
}
@Override
- public String toString()
- {
- return "SerializationFailure [mNonSerializableClass=" + mContainingClass + ", mMemberName=" + mMemberName + "]";
+ public String toString() {
+ return "SerializationFailure [mNonSerializableClass=" + mContainingClass + ", mMemberName=" + mMemberName
+ + "]";
}
}
- private static class SerializationCheckerData
- {
+ private static class SerializationCheckerData {
private Set<Class<?>> mSerializableClasses;
- SerializationCheckerData()
- {
+ SerializationCheckerData() {
mSerializableClasses = new HashSet<Class<?>>();
}
- boolean isAlreadyChecked(Class<?> inClass)
- {
+ boolean isAlreadyChecked(Class<?> inClass) {
return mSerializableClasses.contains(inClass);
}
- void addSerializableClass(Class<?> inClass)
- {
+ void addSerializableClass(Class<?> inClass) {
mSerializableClasses.add(inClass);
}
}
- private SerializableChecker()
- { }
+ private SerializableChecker() {}
- public static SerializationFailure isFullySerializable(Class<?> inClass)
- {
+ 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))
- {
+ private static SerializationFailure isFullySerializable(Class<?> inClass,
+ SerializationCheckerData inSerializationCheckerData) {
+ for (Field field : declaredFields(inClass)) {
Class<?> fieldDeclaringClass = field.getType();
if (field.getType() == Object.class)
@@ -121,8 +108,7 @@ public final class SerializableChecker
if (inSerializationCheckerData.isAlreadyChecked(fieldDeclaringClass))
continue;
- if (isSerializable(fieldDeclaringClass))
- {
+ if (isSerializable(fieldDeclaringClass)) {
inSerializationCheckerData.addSerializableClass(inClass);
SerializationFailure failure = isFullySerializable(field.getType(), inSerializationCheckerData);
@@ -140,8 +126,7 @@ public final class SerializableChecker
return null;
}
- private static boolean isSerializable(Class<?> inClass)
- {
+ private static boolean isSerializable(Class<?> inClass) {
Set<Class<?>> interfaces = getInterfaces(inClass);
if (interfaces == null)
return false;
@@ -149,8 +134,7 @@ public final class SerializableChecker
if (isSerializable)
return true;
- for (Class<?> classInterface : interfaces)
- {
+ for (Class<?> classInterface : interfaces) {
if (isSerializable(classInterface))
return true;
}
@@ -161,13 +145,11 @@ public final class SerializableChecker
return false;
}
- private static Set<Class<?>> getInterfaces(Class<?> inFieldDeclaringClass)
- {
+ private static Set<Class<?>> getInterfaces(Class<?> inFieldDeclaringClass) {
return new HashSet<Class<?>>(Arrays.asList(inFieldDeclaringClass.getInterfaces()));
}
- private static List<Field> declaredFields(Class<?> inClass)
- {
+ private static List<Field> declaredFields(Class<?> inClass) {
List<Field> fields = new ArrayList<Field>(Arrays.asList(inClass.getDeclaredFields()));
Class<?> parentClasses = inClass.getSuperclass();
@@ -177,5 +159,5 @@ public final class SerializableChecker
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
index 11309914ef..029b77319b 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java
@@ -30,14 +30,14 @@ import org.springframework.context.annotation.Profile;
@SpringBootApplication
@Profile("test")
-@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {
- @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
+@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class,
+ excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.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");
-
-
- }
+ 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
index c483f13887..d2bc728eb2 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplicationConfig.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplicationConfig.java
@@ -24,73 +24,71 @@ 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<ResponseTransformer> transformerList = new ArrayList<ResponseTransformer>();
-
- 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);
- }
- };
- }
-
+
+ @Bean
+ protected ResponseTransformer[] transformerArray() {
+ // Process WorkflowTestTransformer annotations
+ List<ResponseTransformer> transformerList = new ArrayList<ResponseTransformer>();
+
+ 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
index 20c69fafe3..2ecf741869 100644
--- 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
@@ -21,61 +21,61 @@
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<String> payload = Optional.of(jsonObject.toString());
- Optional<String> payloadClient = PayloadClient.upgradeFormat(payload, "vnfName1");
- assertEquals(payloadResult, payloadClient.get());
- }
+ @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<String> payload = Optional.of(jsonObject.toString());
+ Optional<String> payloadClient = PayloadClient.upgradeFormat(payload, "vnfName1");
+ assertEquals(payloadResult, payloadClient.get());
+ }
+
+ @Test
+ public void resumeTrafficFormatTest() throws Exception {
+ String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\"}}";
+ Optional<String> 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<String> payload = Optional.of(jsonObject.toString());
+ Optional<String> payloadClient = PayloadClient.quiesceTrafficFormat(payload, "vnfName1");
+ assertEquals(payloadResult, payloadClient.get());
+ }
+
+ @Test
+ public void startStopFormatTest() throws Exception {
+ String payloadResult = "{\" AICIdentity \":\"aicIdentity1\"}";
+ Optional<String> payloadClient = PayloadClient.startStopFormat("aicIdentity1");
+ assertEquals(payloadResult, payloadClient.get());
+ }
+
+ @Test
+ public void healthCheckFormatTest() throws Exception {
+ String payloadResult = "{\"request-parameters\":{\"host-ip-address\":\"hostIpAddress1\"}}";
+ Optional<String> payloadClient = PayloadClient.healthCheckFormat("vnfName1", "hostIpAddress1");
+ assertEquals(payloadResult, payloadClient.get());
+ }
+
+ @Test
+ public void snapshotFormatTest() throws Exception {
+ String payloadResult = "{\"vm-id\":\"vmId1\",\"identity-url\":\"identityUrl1\"}";
+ Optional<String> payloadClient = PayloadClient.snapshotFormat("vmId1", "identityUrl1");
+ assertEquals(payloadResult, payloadClient.get());
+ }
- @Test
- public void resumeTrafficFormatTest() throws Exception {
- String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\"}}";
- Optional<String> 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<String> payload = Optional.of(jsonObject.toString());
- Optional<String> payloadClient = PayloadClient.quiesceTrafficFormat(payload, "vnfName1");
- assertEquals(payloadResult, payloadClient.get());
- }
-
- @Test
- public void startStopFormatTest() throws Exception {
- String payloadResult = "{\" AICIdentity \":\"aicIdentity1\"}";
- Optional<String> payloadClient = PayloadClient.startStopFormat("aicIdentity1");
- assertEquals(payloadResult, payloadClient.get());
- }
-
- @Test
- public void healthCheckFormatTest() throws Exception {
- String payloadResult = "{\"request-parameters\":{\"host-ip-address\":\"hostIpAddress1\"}}";
- Optional<String> payloadClient = PayloadClient.healthCheckFormat("vnfName1", "hostIpAddress1");
- assertEquals(payloadResult, payloadClient.get());
- }
-
- @Test
- public void snapshotFormatTest() throws Exception {
- String payloadResult = "{\"vm-id\":\"vmId1\",\"identity-url\":\"identityUrl1\"}";
- Optional<String> payloadClient = PayloadClient.snapshotFormat("vmId1", "identityUrl1");
- assertEquals(payloadResult, payloadClient.get());
- }
-
}
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
index 7949fd26e6..3f0d01d649 100644
--- 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
@@ -22,7 +22,6 @@ 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;
@@ -38,37 +37,34 @@ import com.openpojo.validation.test.impl.SetterTester;
public class BeansTest {
- private PojoClassFilter filterTestClasses = new FilterTestClasses();
-
- private PojoClassFilter enumFilter = new FilterEnum();
-
+ 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();
+
- @Test
- public void pojoStructure() {
- test("org.onap.so.bpmn.appc.payload.beans");
- }
+ validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses, enumFilter,
+ new FilterNonConcrete());
+ }
- 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/");
- }
- }
+ 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
index 8a2c8fbfdd..d18170f828 100644
--- 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
@@ -23,9 +23,7 @@ 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;
@@ -37,29 +35,31 @@ 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<String>());
- when(annotatedBeanDefinition.getBeanClassName()).thenReturn("org.onap.so.BeanName");
- when(annotatedBeanDefinition.getMetadata()).thenReturn(metadata);
- String actualBeanName = customBeanNameGenerator.generateBeanName(annotatedBeanDefinition, beanDefinitionRegistry);
-
- assertEquals(expectedBeanName, actualBeanName);
- }
-
+ @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<String>());
+ 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
index a30aadc1f8..44b6f35dae 100644
--- 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
@@ -25,13 +25,11 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
-
import java.io.Serializable;
import java.util.Arrays;
import java.util.HashMap;
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;
@@ -41,7 +39,6 @@ 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 com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
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
index 63e5ccbbf3..58ac7cacca 100644
--- 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
@@ -24,7 +24,6 @@ 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;
@@ -48,54 +47,52 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@SpringBootApplication
@EnableAsync
-@ComponentScan(basePackages = { "org.onap" }, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {
- @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
+@ComponentScan(basePackages = {"org.onap"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class,
+ excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
public class MSOCommonApplication {
- private static final Logger logger = LoggerFactory.getLogger(MSOCommonApplication.class);
+ private static final Logger logger = LoggerFactory.getLogger(MSOCommonApplication.class);
- @Value("${mso.async.core-pool-size}")
- private int corePoolSize;
+ @Value("${mso.async.core-pool-size}")
+ private int corePoolSize;
- @Value("${mso.async.max-pool-size}")
- private int maxPoolSize;
+ @Value("${mso.async.max-pool-size}")
+ private int maxPoolSize;
- @Value("${mso.async.queue-capacity}")
- private int queueCapacity;
+ @Value("${mso.async.queue-capacity}")
+ private int queueCapacity;
- private static final String LOGS_DIR = "logs_dir";
+ 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/");
- }
- }
+ 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();
- }
+ public static void main(String... args) {
+ SpringApplication.run(MSOCommonApplication.class, args);
+ System.getProperties().setProperty("mso.config.path", ".");
+ setLogsDir();
+ }
- @PostDeploy
- public void postDeploy(ProcessEngine processEngineInstance) {
- }
+ @PostDeploy
+ public void postDeploy(ProcessEngine processEngineInstance) {}
- @PreUndeploy
- public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo,
- List<ProcessEngine> processEngines) {
- }
+ @PreUndeploy
+ public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo,
+ List<ProcessEngine> processEngines) {}
- @Bean
- public Executor asyncExecutor() {
- ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+ @Bean
+ public Executor asyncExecutor() {
+ ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
- executor.setCorePoolSize(corePoolSize);
- executor.setMaxPoolSize(maxPoolSize);
- executor.setQueueCapacity(queueCapacity);
- executor.setThreadNamePrefix("Camunda-");
- executor.initialize();
- return executor;
- }
+ executor.setCorePoolSize(corePoolSize);
+ executor.setMaxPoolSize(maxPoolSize);
+ executor.setQueueCapacity(queueCapacity);
+ executor.setThreadNamePrefix("Camunda-");
+ executor.initialize();
+ return executor;
+ }
}
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
index 052fd5dc94..45ef0add2b 100644
--- 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
@@ -23,18 +23,16 @@ 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.urlMatching;
-
import com.github.tomakehurst.wiremock.WireMockServer;
public class MockAAIDeleteGenericVnf {
- public MockAAIDeleteGenericVnf(WireMockServer wireMockServer){
- wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021"))
- .willReturn(aResponse()
- .withStatus(200)));
- wireMockServer.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 MockAAIDeleteGenericVnf(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(delete(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021"))
+ .willReturn(aResponse().withStatus(200)));
+ wireMockServer.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
index 1cbe0b9244..f405fc943b 100644
--- 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
@@ -24,31 +24,30 @@ 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.urlMatching;
-
import com.github.tomakehurst.wiremock.WireMockServer;
public class MockAAIDeleteVfModule {
-
- public MockAAIDeleteVfModule(WireMockServer wireMockServer)
- {
- wireMockServer.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)));
- wireMockServer.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)));
- wireMockServer.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)));
- wireMockServer.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")));
- wireMockServer.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")));
- wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
- .willReturn(aResponse().withStatus(200)));
- }
+ public MockAAIDeleteVfModule(WireMockServer wireMockServer) {
+ wireMockServer.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)));
+ wireMockServer.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)));
+ wireMockServer.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)));
+ wireMockServer.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")));
+ wireMockServer.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")));
+
+ wireMockServer.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
index 1d6337ffc4..a33268efbe 100644
--- 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
@@ -23,319 +23,219 @@ 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.urlMatching;
-
import com.github.tomakehurst.wiremock.WireMockServer;
public class MockAAIGenericVnfSearch {
-
- private static final String EOL = "\n";
- public MockAAIGenericVnfSearch(WireMockServer wireMockServer){
- String body;
-
- // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
-
- wireMockServer.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")));
-
- wireMockServer.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")));
- wireMockServer.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 =
- "<generic-vnf xmlns=\"http://com.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>1508691</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.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)));
- wireMockServer.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 =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>1508691</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.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)));
- wireMockServer.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
-
- wireMockServer.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")));
-
- wireMockServer.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 =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000021</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000073</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.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 =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000020</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000074</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000075</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.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 =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000019</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC19-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000076</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000077</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.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 =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000018</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000078</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.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 =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000021</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000073</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.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)));
-
- }
+ private static final String EOL = "\n";
+
+ public MockAAIGenericVnfSearch(WireMockServer wireMockServer) {
+ String body;
+
+ // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
+
+ wireMockServer.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")));
+
+ wireMockServer.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")));
+ wireMockServer.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 = "<generic-vnf xmlns=\"http://com.aai.inventory/v7\">" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>1508691</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>1508692</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.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)));
+ wireMockServer.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 = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+ + " <vnf-id>2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>1508691</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>1508692</resource-version>" + EOL + " </vf-module>" + EOL
+ + " <vf-module>" + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>"
+ + EOL + " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>false</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>1508692</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.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)));
+ wireMockServer.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
+
+ wireMockServer.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")));
+
+ wireMockServer.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 = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>0000021</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000073</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.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 = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>0000020</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000074</resource-version>" + EOL + " </vf-module>" + EOL
+ + " <vf-module>" + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>"
+ + EOL + " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>false</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000075</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.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 = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>0000019</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC19-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000076</resource-version>" + EOL + " </vf-module>" + EOL
+ + " <vf-module>" + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>"
+ + EOL + " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>false</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000077</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.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 = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>0000018</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000078</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.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 = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>0000021</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000073</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.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/SPIPropertiesTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java
index 9239889f28..96ea1cad9b 100644
--- 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
@@ -22,10 +22,8 @@ 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;
@@ -36,34 +34,37 @@ 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);
- }
-
+ @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
index 4a51d34c3e..23f9818669 100644
--- 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
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
@@ -34,35 +34,35 @@ 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());
-
-
-
- }
+ @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
index dbad35a6a4..794e772dcd 100644
--- 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
@@ -26,16 +26,15 @@ 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:
+ * 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:
+ *
* <pre>
- * @WorkflowTestTransformer
- * public static final ResponseTransformer sdncAdapterMockTransformer =
- * new SDNCAdapterMockTransformer();
+ * &#64;WorkflowTestTransformer
+ * public static final ResponseTransformer sdncAdapterMockTransformer = new SDNCAdapterMockTransformer();
* </pre>
*/
@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/baseclient/BaseClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java
index 1be7c652b9..ee2c10ca4b 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java
@@ -25,41 +25,39 @@ import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
-
import java.util.Map;
-
import javax.ws.rs.core.UriBuilder;
-
import org.junit.Test;
import org.onap.so.BaseTest;
import org.springframework.core.ParameterizedTypeReference;
-
import wiremock.org.apache.http.entity.ContentType;
public class BaseClientTest extends BaseTest {
- @Test
- public void verifyString() {
- BaseClient<String, String> client = new BaseClient<>();
- String response = "{\"hello\" : \"world\"}";
- client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(Integer.parseInt(wireMockPort)).build().toString());
- wireMockServer.stubFor(get(urlEqualTo("/test"))
- .willReturn(aResponse().withStatus(200).withBody(response).withHeader("Content-Type", ContentType.APPLICATION_JSON.toString())));
-
- String result = client.get("", new ParameterizedTypeReference<String>() {});
- assertThat(result, equalTo(response));
- }
-
- @Test
- public void verifyMap() {
- BaseClient<String, Map<String, Object>> client = new BaseClient<>();
- String response = "{\"hello\" : \"world\"}";
- client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(Integer.parseInt(wireMockPort)).build().toString());
- wireMockServer.stubFor(get(urlEqualTo("/test"))
- .willReturn(aResponse().withStatus(200).withBody(response).withHeader("Content-Type", ContentType.APPLICATION_JSON.toString())));
-
- Map<String, Object> result = client.get("", new ParameterizedTypeReference<Map<String, Object>>() {});
- assertThat("world", equalTo(result.get("hello")));
- }
+ @Test
+ public void verifyString() {
+ BaseClient<String, String> client = new BaseClient<>();
+ String response = "{\"hello\" : \"world\"}";
+ client.setTargetUrl(
+ UriBuilder.fromUri("http://localhost/test").port(Integer.parseInt(wireMockPort)).build().toString());
+ wireMockServer.stubFor(get(urlEqualTo("/test")).willReturn(aResponse().withStatus(200).withBody(response)
+ .withHeader("Content-Type", ContentType.APPLICATION_JSON.toString())));
+
+ String result = client.get("", new ParameterizedTypeReference<String>() {});
+ assertThat(result, equalTo(response));
+ }
+
+ @Test
+ public void verifyMap() {
+ BaseClient<String, Map<String, Object>> client = new BaseClient<>();
+ String response = "{\"hello\" : \"world\"}";
+ client.setTargetUrl(
+ UriBuilder.fromUri("http://localhost/test").port(Integer.parseInt(wireMockPort)).build().toString());
+ wireMockServer.stubFor(get(urlEqualTo("/test")).willReturn(aResponse().withStatus(200).withBody(response)
+ .withHeader("Content-Type", ContentType.APPLICATION_JSON.toString())));
+
+ Map<String, Object> result = client.get("", new ParameterizedTypeReference<Map<String, Object>>() {});
+ assertThat("world", equalTo(result.get("hello")));
+ }
}
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
index 5510e21b31..94320b75d7 100644
--- 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
@@ -1,41 +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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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);
- }
+ 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/BpmnRestClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/BpmnRestClientTest.java
index 465ec416b5..730915a60c 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/BpmnRestClientTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/BpmnRestClientTest.java
@@ -25,36 +25,29 @@ import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-
import java.io.IOException;
-
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.junit.Test;
import org.onap.so.BaseTest;
import org.springframework.beans.factory.annotation.Autowired;
-public class BpmnRestClientTest extends BaseTest{
+public class BpmnRestClientTest extends BaseTest {
@Autowired
private BpmnRestClient bpmnRestClient;
@Test
- public void postTest() throws IOException, Exception{
+ public void postTest() throws IOException, Exception {
wireMockServer.stubFor(post(urlPathMatching("/testRecipeUri"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(org.springframework.http.HttpStatus.OK.value()).withBody("{}")));
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(org.springframework.http.HttpStatus.OK.value()).withBody("{}")));
- HttpResponse httpResponse = bpmnRestClient.post(
- "http://localhost:" + wireMockPort +"/testRecipeUri",
- "test-req-id",
- 1000,
- "testRequestAction",
- "1234",
- "testServiceType",
- "testRequestDetails",
- "testRecipeparamXsd");
+ HttpResponse httpResponse =
+ bpmnRestClient.post("http://localhost:" + wireMockPort + "/testRecipeUri", "test-req-id", 1000,
+ "testRequestAction", "1234", "testServiceType", "testRequestDetails", "testRecipeparamXsd");
assertNotNull(httpResponse);
- assertEquals(HttpStatus.SC_OK,httpResponse.getStatusLine().getStatusCode());
+ assertEquals(HttpStatus.SC_OK, httpResponse.getStatusLine().getStatusCode());
}
}
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
index 5da47c973e..d25e4437ce 100644
--- 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
@@ -1,66 +1,62 @@
/*
-* ============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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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.bpmn.core.domain.ModelInfo;
import org.onap.so.BaseTest;
-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);
+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);
- }
+ 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
index f0f6fa79e0..7008791dd0 100644
--- 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
@@ -1,52 +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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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{
+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);
+ }
- 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);
- }
+ @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
index a074174f6e..0c2862bf91 100644
--- 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
@@ -23,11 +23,9 @@ import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.ok;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static org.junit.Assert.assertEquals;
-
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import org.junit.Test;
import org.onap.so.BaseTest;
@@ -39,362 +37,283 @@ public class ResourceRequestBuilderTest extends BaseTest {
- wireMockServer.stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5"))
- .willReturn(ok("{ \"serviceResources\" : {\n" +
- "\t\"modelInfo\" : {\n" +
- "\t\t\"modelName\" : \"demoVFWCL\",\n" +
- "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n" +
- "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n" +
- "\t\t\"modelVersion\" : \"1.0\"\n" +
- "\t},\n" +
- "\t\"serviceType\" : \"\",\n" +
- "\t\"serviceRole\" : \"\",\n" +
- "\t\"environmentContext\" : null,\n" +
- "\t\"resourceOrder\" : \"res1,res2\",\n" +
- "\t\"workloadContext\" : \"Production\",\n" +
- "\t\"serviceVnfs\": [\n" +
- "\t\n" +
- "\t\t{ \"modelInfo\" : {\n" +
- "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n" +
- "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n" +
- "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n" +
- "\t\t\t\"modelVersion\" : \"1.0\",\n" +
- "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n" +
- "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" +
- "\t\t\t},\n" +
- "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n" +
- "\t\t\"nfFunction\" \t: null,\n" +
- "\"resourceInput\":\"{\\\"a\\\":\\\"b\\\"}\"," +
- "\t\t\"nfType\" \t\t: null,\n" +
- "\t\t\"nfRole\" \t\t: null,\n" +
- "\t\t\"nfNamingCode\" \t: null,\n" +
- "\t\t\"multiStageDesign\" : \"false\",\n" +
- "\t\t\t\"vfModules\": [\n" +
- "\t\t\t\t{\n" +
- "\t\t\t\t\t\"modelInfo\" : { \n" +
- "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n" +
- "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n" +
- "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n" +
- "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" +
- "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n" +
- "\t\t\t\t\t},\t\t\"isBase\" : true,\n" +
- "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n" +
- "\t\t\t\t\t\"initialCount\" : 1,\n" +
- "\t\t\t\t\t\"hasVolumeGroup\" : true\n" +
- "\t\t\t\t}\n" +
- "\t\t\t]\n" +
- "\t\t},\n" +
- "\t\n" +
- "\t\t{ \"modelInfo\" : {\n" +
- "\t\t\t\"modelName\" : \"f971106a-248f-4202-9d1f\",\n" +
- "\t\t\t\"modelUuid\" : \"4fbc08a4-35ed-4a59-9e47-79975e4add7e\",\n" +
- "\t\t\t\"modelInvariantUuid\" : \"c669799e-adf1-46ae-8c70-48b326fe89f3\",\n" +
- "\t\t\t\"modelVersion\" : \"1.0\",\n" +
- "\t\t\t\"modelCustomizationUuid\" : \"e776449e-2b10-45c5-9217-2775c88ca1a0\",\n" +
- "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" +
- "\t\t\t},\n" +
- "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n" +
- "\t\t\"nfFunction\" \t: null,\n" +
- "\t\t\"nfType\" \t\t: null,\n" +
- "\t\t\"nfRole\" \t\t: null,\n" +
- "\"resourceInput\":\"{\\\"a\\\":\\\"key|default_value\\\"}\"," +
- "\t\t\"nfNamingCode\" \t: null,\n" +
- "\t\t\"multiStageDesign\" : \"false\",\n" +
- "\t\t\t\"vfModules\": [\n" +
- "\t\t\t\t{\n" +
- "\t\t\t\t\t\"modelInfo\" : { \n" +
- "\t\t\t\t\t\t\"modelName\" : \"F971106a248f42029d1f..base_vpkg..module-0\",\n" +
- "\t\t\t\t\t\t\"modelUuid\" : \"47d5273a-7456-4786-9035-b3911944cc35\",\n" +
- "\t\t\t\t\t\t\"modelInvariantUuid\" : \"0ea3e57e-ac7a-425a-928b-b4aee8806c15\",\n" +
- "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" +
- "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"9ed9fef6-d3f8-4433-9807-7e23393a16bc\"\n" +
- "\t\t\t\t\t},\t\t\"isBase\" : true,\n" +
- "\t\t\t\t\t\"vfModuleLabel\" : \"base_vpkg\",\n" +
- "\t\t\t\t\t\"initialCount\" : 1,\n" +
- "\t\t\t\t\t\"hasVolumeGroup\" : true\n" +
- "\t\t\t\t}\n" +
- "\t\t\t]\n" +
- "\t\t}\n" +
- "\t],\n" +
- "\t\"serviceNetworks\": [],\n" +
- "\t\"serviceAllottedResources\": []\n" +
- "\t}}")));
+ wireMockServer.stubFor(get(urlEqualTo(
+ "/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5"))
+ .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n"
+ + "\t\t\"modelName\" : \"demoVFWCL\",\n"
+ + "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n"
+ + "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n"
+ + "\t\t\"modelVersion\" : \"1.0\"\n" + "\t},\n"
+ + "\t\"serviceType\" : \"\",\n" + "\t\"serviceRole\" : \"\",\n"
+ + "\t\"environmentContext\" : null,\n" + "\t\"resourceOrder\" : \"res1,res2\",\n"
+ + "\t\"workloadContext\" : \"Production\",\n" + "\t\"serviceVnfs\": [\n" + "\t\n"
+ + "\t\t{ \"modelInfo\" : {\n"
+ + "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n"
+ + "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n"
+ + "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n"
+ + "\t\t\t\"modelVersion\" : \"1.0\",\n"
+ + "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n"
+ + "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" + "\t\t\t},\n"
+ + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n"
+ + "\t\t\"nfFunction\" \t: null,\n"
+ + "\"resourceInput\":\"{\\\"a\\\":\\\"b\\\"}\","
+ + "\t\t\"nfType\" \t\t: null,\n"
+ + "\t\t\"nfRole\" \t\t: null,\n"
+ + "\t\t\"nfNamingCode\" \t: null,\n"
+ + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n"
+ + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n"
+ + "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n"
+ + "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n"
+ + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n"
+ + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n"
+ + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n"
+ + "\t\t\t\t\t},\t\t\"isBase\" : true,\n"
+ + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n"
+ + "\t\t\t\t\t\"initialCount\" : 1,\n"
+ + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n"
+ + "\t\t},\n" + "\t\n" + "\t\t{ \"modelInfo\" : {\n"
+ + "\t\t\t\"modelName\" : \"f971106a-248f-4202-9d1f\",\n"
+ + "\t\t\t\"modelUuid\" : \"4fbc08a4-35ed-4a59-9e47-79975e4add7e\",\n"
+ + "\t\t\t\"modelInvariantUuid\" : \"c669799e-adf1-46ae-8c70-48b326fe89f3\",\n"
+ + "\t\t\t\"modelVersion\" : \"1.0\",\n"
+ + "\t\t\t\"modelCustomizationUuid\" : \"e776449e-2b10-45c5-9217-2775c88ca1a0\",\n"
+ + "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" + "\t\t\t},\n"
+ + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n"
+ + "\t\t\"nfFunction\" \t: null,\n"
+ + "\t\t\"nfType\" \t\t: null,\n"
+ + "\t\t\"nfRole\" \t\t: null,\n"
+ + "\"resourceInput\":\"{\\\"a\\\":\\\"key|default_value\\\"}\","
+ + "\t\t\"nfNamingCode\" \t: null,\n"
+ + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n"
+ + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n"
+ + "\t\t\t\t\t\t\"modelName\" : \"F971106a248f42029d1f..base_vpkg..module-0\",\n"
+ + "\t\t\t\t\t\t\"modelUuid\" : \"47d5273a-7456-4786-9035-b3911944cc35\",\n"
+ + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"0ea3e57e-ac7a-425a-928b-b4aee8806c15\",\n"
+ + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n"
+ + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"9ed9fef6-d3f8-4433-9807-7e23393a16bc\"\n"
+ + "\t\t\t\t\t},\t\t\"isBase\" : true,\n"
+ + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vpkg\",\n"
+ + "\t\t\t\t\t\"initialCount\" : 1,\n"
+ + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n"
+ + "\t\t}\n" + "\t],\n" + "\t\"serviceNetworks\": [],\n"
+ + "\t\"serviceAllottedResources\": []\n" + "\t}}")));
-// when(UrnPropertiesReader.getVariable(anyString())).thenReturn("http://localhost:8080");
+ // when(UrnPropertiesReader.getVariable(anyString())).thenReturn("http://localhost:8080");
HashMap serviceInput = new HashMap();
serviceInput.put("key", "value");
- Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5",
- "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
+ Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(
+ "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
assertEquals(stringObjectMap.get("a"), "value");
}
@Test
public void getResourceInputDefaultValueTest() throws Exception {
- wireMockServer.stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5"))
- .willReturn(ok("{ \"serviceResources\" : {\n" +
- "\t\"modelInfo\" : {\n" +
- "\t\t\"modelName\" : \"demoVFWCL\",\n" +
- "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n" +
- "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n" +
- "\t\t\"modelVersion\" : \"1.0\"\n" +
- "\t},\n" +
- "\t\"serviceType\" : \"\",\n" +
- "\t\"serviceRole\" : \"\",\n" +
- "\t\"environmentContext\" : null,\n" +
- "\t\"workloadContext\" : \"Production\",\n" +
- "\t\"serviceVnfs\": [\n" +
- "\t\n" +
- "\t\t{ \"modelInfo\" : {\n" +
- "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n" +
- "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n" +
- "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n" +
- "\t\t\t\"modelVersion\" : \"1.0\",\n" +
- "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n" +
- "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" +
- "\t\t\t},\n" +
- "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n" +
- "\t\t\"nfFunction\" \t: null,\n" +
- "\"resourceInput\":\"{\\\"a\\\":\\\"b\\\"}\"," +
- "\t\t\"nfType\" \t\t: null,\n" +
- "\t\t\"nfRole\" \t\t: null,\n" +
- "\t\t\"nfNamingCode\" \t: null,\n" +
- "\t\t\"multiStageDesign\" : \"false\",\n" +
- "\t\t\t\"vfModules\": [\n" +
- "\t\t\t\t{\n" +
- "\t\t\t\t\t\"modelInfo\" : { \n" +
- "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n" +
- "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n" +
- "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n" +
- "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" +
- "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n" +
- "\t\t\t\t\t},\t\t\"isBase\" : true,\n" +
- "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n" +
- "\t\t\t\t\t\"initialCount\" : 1,\n" +
- "\t\t\t\t\t\"hasVolumeGroup\" : true\n" +
- "\t\t\t\t}\n" +
- "\t\t\t]\n" +
- "\t\t},\n" +
- "\t\n" +
- "\t\t{ \"modelInfo\" : {\n" +
- "\t\t\t\"modelName\" : \"f971106a-248f-4202-9d1f\",\n" +
- "\t\t\t\"modelUuid\" : \"4fbc08a4-35ed-4a59-9e47-79975e4add7e\",\n" +
- "\t\t\t\"modelInvariantUuid\" : \"c669799e-adf1-46ae-8c70-48b326fe89f3\",\n" +
- "\t\t\t\"modelVersion\" : \"1.0\",\n" +
- "\t\t\t\"modelCustomizationUuid\" : \"e776449e-2b10-45c5-9217-2775c88ca1a0\",\n" +
- "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" +
- "\t\t\t},\n" +
- "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n" +
- "\t\t\"nfFunction\" \t: null,\n" +
- "\t\t\"nfType\" \t\t: null,\n" +
- "\t\t\"nfRole\" \t\t: null,\n" +
- "\"resourceInput\":\"{\\\"a\\\":\\\"key|default_value\\\"}\"," +
- "\t\t\"nfNamingCode\" \t: null,\n" +
- "\t\t\"multiStageDesign\" : \"false\",\n" +
- "\t\t\t\"vfModules\": [\n" +
- "\t\t\t\t{\n" +
- "\t\t\t\t\t\"modelInfo\" : { \n" +
- "\t\t\t\t\t\t\"modelName\" : \"F971106a248f42029d1f..base_vpkg..module-0\",\n" +
- "\t\t\t\t\t\t\"modelUuid\" : \"47d5273a-7456-4786-9035-b3911944cc35\",\n" +
- "\t\t\t\t\t\t\"modelInvariantUuid\" : \"0ea3e57e-ac7a-425a-928b-b4aee8806c15\",\n" +
- "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" +
- "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"9ed9fef6-d3f8-4433-9807-7e23393a16bc\"\n" +
- "\t\t\t\t\t},\t\t\"isBase\" : true,\n" +
- "\t\t\t\t\t\"vfModuleLabel\" : \"base_vpkg\",\n" +
- "\t\t\t\t\t\"initialCount\" : 1,\n" +
- "\t\t\t\t\t\"hasVolumeGroup\" : true\n" +
- "\t\t\t\t}\n" +
- "\t\t\t]\n" +
- "\t\t}\n" +
- "\t],\n" +
- "\t\"serviceNetworks\": [],\n" +
- "\t\"serviceAllottedResources\": []\n" +
- "\t}}")));
+ wireMockServer.stubFor(get(urlEqualTo(
+ "/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5"))
+ .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n"
+ + "\t\t\"modelName\" : \"demoVFWCL\",\n"
+ + "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n"
+ + "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n"
+ + "\t\t\"modelVersion\" : \"1.0\"\n" + "\t},\n"
+ + "\t\"serviceType\" : \"\",\n" + "\t\"serviceRole\" : \"\",\n"
+ + "\t\"environmentContext\" : null,\n" + "\t\"workloadContext\" : \"Production\",\n"
+ + "\t\"serviceVnfs\": [\n" + "\t\n" + "\t\t{ \"modelInfo\" : {\n"
+ + "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n"
+ + "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n"
+ + "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n"
+ + "\t\t\t\"modelVersion\" : \"1.0\",\n"
+ + "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n"
+ + "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" + "\t\t\t},\n"
+ + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n"
+ + "\t\t\"nfFunction\" \t: null,\n"
+ + "\"resourceInput\":\"{\\\"a\\\":\\\"b\\\"}\","
+ + "\t\t\"nfType\" \t\t: null,\n"
+ + "\t\t\"nfRole\" \t\t: null,\n"
+ + "\t\t\"nfNamingCode\" \t: null,\n"
+ + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n"
+ + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n"
+ + "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n"
+ + "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n"
+ + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n"
+ + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n"
+ + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n"
+ + "\t\t\t\t\t},\t\t\"isBase\" : true,\n"
+ + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n"
+ + "\t\t\t\t\t\"initialCount\" : 1,\n"
+ + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n"
+ + "\t\t},\n" + "\t\n" + "\t\t{ \"modelInfo\" : {\n"
+ + "\t\t\t\"modelName\" : \"f971106a-248f-4202-9d1f\",\n"
+ + "\t\t\t\"modelUuid\" : \"4fbc08a4-35ed-4a59-9e47-79975e4add7e\",\n"
+ + "\t\t\t\"modelInvariantUuid\" : \"c669799e-adf1-46ae-8c70-48b326fe89f3\",\n"
+ + "\t\t\t\"modelVersion\" : \"1.0\",\n"
+ + "\t\t\t\"modelCustomizationUuid\" : \"e776449e-2b10-45c5-9217-2775c88ca1a0\",\n"
+ + "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" + "\t\t\t},\n"
+ + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n"
+ + "\t\t\"nfFunction\" \t: null,\n"
+ + "\t\t\"nfType\" \t\t: null,\n"
+ + "\t\t\"nfRole\" \t\t: null,\n"
+ + "\"resourceInput\":\"{\\\"a\\\":\\\"key|default_value\\\"}\","
+ + "\t\t\"nfNamingCode\" \t: null,\n"
+ + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n"
+ + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n"
+ + "\t\t\t\t\t\t\"modelName\" : \"F971106a248f42029d1f..base_vpkg..module-0\",\n"
+ + "\t\t\t\t\t\t\"modelUuid\" : \"47d5273a-7456-4786-9035-b3911944cc35\",\n"
+ + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"0ea3e57e-ac7a-425a-928b-b4aee8806c15\",\n"
+ + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n"
+ + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"9ed9fef6-d3f8-4433-9807-7e23393a16bc\"\n"
+ + "\t\t\t\t\t},\t\t\"isBase\" : true,\n"
+ + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vpkg\",\n"
+ + "\t\t\t\t\t\"initialCount\" : 1,\n"
+ + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n"
+ + "\t\t}\n" + "\t],\n" + "\t\"serviceNetworks\": [],\n"
+ + "\t\"serviceAllottedResources\": []\n" + "\t}}")));
-// when(UrnPropertiesReader.getVariable(anyString())).thenReturn("http://localhost:8080");
+ // when(UrnPropertiesReader.getVariable(anyString())).thenReturn("http://localhost:8080");
HashMap serviceInput = new HashMap();
serviceInput.put("key1", "value");
- Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5",
- "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
+ Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(
+ "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
assertEquals(stringObjectMap.get("a"), "default_value");
}
@Test
public void getResourceInputValueNoDefaultTest() throws Exception {
- wireMockServer.stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5"))
- .willReturn(ok("{ \"serviceResources\" : {\n" +
- "\t\"modelInfo\" : {\n" +
- "\t\t\"modelName\" : \"demoVFWCL\",\n" +
- "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n" +
- "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n" +
- "\t\t\"modelVersion\" : \"1.0\"\n" +
- "\t},\n" +
- "\t\"serviceType\" : \"\",\n" +
- "\t\"serviceRole\" : \"\",\n" +
- "\t\"environmentContext\" : null,\n" +
- "\t\"workloadContext\" : \"Production\",\n" +
- "\t\"serviceVnfs\": [\n" +
- "\t\n" +
- "\t\t{ \"modelInfo\" : {\n" +
- "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n" +
- "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n" +
- "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n" +
- "\t\t\t\"modelVersion\" : \"1.0\",\n" +
- "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n" +
- "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" +
- "\t\t\t},\n" +
- "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n" +
- "\t\t\"nfFunction\" \t: null,\n" +
- "\"resourceInput\":\"{\\\"a\\\":\\\"b\\\"}\"," +
- "\t\t\"nfType\" \t\t: null,\n" +
- "\t\t\"nfRole\" \t\t: null,\n" +
- "\t\t\"nfNamingCode\" \t: null,\n" +
- "\t\t\"multiStageDesign\" : \"false\",\n" +
- "\t\t\t\"vfModules\": [\n" +
- "\t\t\t\t{\n" +
- "\t\t\t\t\t\"modelInfo\" : { \n" +
- "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n" +
- "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n" +
- "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n" +
- "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" +
- "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n" +
- "\t\t\t\t\t},\t\t\"isBase\" : true,\n" +
- "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n" +
- "\t\t\t\t\t\"initialCount\" : 1,\n" +
- "\t\t\t\t\t\"hasVolumeGroup\" : true\n" +
- "\t\t\t\t}\n" +
- "\t\t\t]\n" +
- "\t\t},\n" +
- "\t\n" +
- "\t\t{ \"modelInfo\" : {\n" +
- "\t\t\t\"modelName\" : \"f971106a-248f-4202-9d1f\",\n" +
- "\t\t\t\"modelUuid\" : \"4fbc08a4-35ed-4a59-9e47-79975e4add7e\",\n" +
- "\t\t\t\"modelInvariantUuid\" : \"c669799e-adf1-46ae-8c70-48b326fe89f3\",\n" +
- "\t\t\t\"modelVersion\" : \"1.0\",\n" +
- "\t\t\t\"modelCustomizationUuid\" : \"e776449e-2b10-45c5-9217-2775c88ca1a0\",\n" +
- "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" +
- "\t\t\t},\n" +
- "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n" +
- "\t\t\"nfFunction\" \t: null,\n" +
- "\t\t\"nfType\" \t\t: null,\n" +
- "\t\t\"nfRole\" \t\t: null,\n" +
- "\"resourceInput\":\"{\\\"a\\\":\\\"value\\\"}\"," +
- "\t\t\"nfNamingCode\" \t: null,\n" +
- "\t\t\"multiStageDesign\" : \"false\",\n" +
- "\t\t\t\"vfModules\": [\n" +
- "\t\t\t\t{\n" +
- "\t\t\t\t\t\"modelInfo\" : { \n" +
- "\t\t\t\t\t\t\"modelName\" : \"F971106a248f42029d1f..base_vpkg..module-0\",\n" +
- "\t\t\t\t\t\t\"modelUuid\" : \"47d5273a-7456-4786-9035-b3911944cc35\",\n" +
- "\t\t\t\t\t\t\"modelInvariantUuid\" : \"0ea3e57e-ac7a-425a-928b-b4aee8806c15\",\n" +
- "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" +
- "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"9ed9fef6-d3f8-4433-9807-7e23393a16bc\"\n" +
- "\t\t\t\t\t},\t\t\"isBase\" : true,\n" +
- "\t\t\t\t\t\"vfModuleLabel\" : \"base_vpkg\",\n" +
- "\t\t\t\t\t\"initialCount\" : 1,\n" +
- "\t\t\t\t\t\"hasVolumeGroup\" : true\n" +
- "\t\t\t\t}\n" +
- "\t\t\t]\n" +
- "\t\t}\n" +
- "\t],\n" +
- "\t\"serviceNetworks\": [],\n" +
- "\t\"serviceAllottedResources\": []\n" +
- "\t}}")));
+ wireMockServer.stubFor(get(urlEqualTo(
+ "/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5"))
+ .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n"
+ + "\t\t\"modelName\" : \"demoVFWCL\",\n"
+ + "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n"
+ + "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n"
+ + "\t\t\"modelVersion\" : \"1.0\"\n" + "\t},\n"
+ + "\t\"serviceType\" : \"\",\n" + "\t\"serviceRole\" : \"\",\n"
+ + "\t\"environmentContext\" : null,\n" + "\t\"workloadContext\" : \"Production\",\n"
+ + "\t\"serviceVnfs\": [\n" + "\t\n" + "\t\t{ \"modelInfo\" : {\n"
+ + "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n"
+ + "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n"
+ + "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n"
+ + "\t\t\t\"modelVersion\" : \"1.0\",\n"
+ + "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n"
+ + "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" + "\t\t\t},\n"
+ + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n"
+ + "\t\t\"nfFunction\" \t: null,\n"
+ + "\"resourceInput\":\"{\\\"a\\\":\\\"b\\\"}\","
+ + "\t\t\"nfType\" \t\t: null,\n"
+ + "\t\t\"nfRole\" \t\t: null,\n"
+ + "\t\t\"nfNamingCode\" \t: null,\n"
+ + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n"
+ + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n"
+ + "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n"
+ + "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n"
+ + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n"
+ + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n"
+ + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n"
+ + "\t\t\t\t\t},\t\t\"isBase\" : true,\n"
+ + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n"
+ + "\t\t\t\t\t\"initialCount\" : 1,\n"
+ + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n"
+ + "\t\t},\n" + "\t\n" + "\t\t{ \"modelInfo\" : {\n"
+ + "\t\t\t\"modelName\" : \"f971106a-248f-4202-9d1f\",\n"
+ + "\t\t\t\"modelUuid\" : \"4fbc08a4-35ed-4a59-9e47-79975e4add7e\",\n"
+ + "\t\t\t\"modelInvariantUuid\" : \"c669799e-adf1-46ae-8c70-48b326fe89f3\",\n"
+ + "\t\t\t\"modelVersion\" : \"1.0\",\n"
+ + "\t\t\t\"modelCustomizationUuid\" : \"e776449e-2b10-45c5-9217-2775c88ca1a0\",\n"
+ + "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" + "\t\t\t},\n"
+ + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n"
+ + "\t\t\"nfFunction\" \t: null,\n"
+ + "\t\t\"nfType\" \t\t: null,\n"
+ + "\t\t\"nfRole\" \t\t: null,\n"
+ + "\"resourceInput\":\"{\\\"a\\\":\\\"value\\\"}\","
+ + "\t\t\"nfNamingCode\" \t: null,\n"
+ + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n"
+ + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n"
+ + "\t\t\t\t\t\t\"modelName\" : \"F971106a248f42029d1f..base_vpkg..module-0\",\n"
+ + "\t\t\t\t\t\t\"modelUuid\" : \"47d5273a-7456-4786-9035-b3911944cc35\",\n"
+ + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"0ea3e57e-ac7a-425a-928b-b4aee8806c15\",\n"
+ + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n"
+ + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"9ed9fef6-d3f8-4433-9807-7e23393a16bc\"\n"
+ + "\t\t\t\t\t},\t\t\"isBase\" : true,\n"
+ + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vpkg\",\n"
+ + "\t\t\t\t\t\"initialCount\" : 1,\n"
+ + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n"
+ + "\t\t}\n" + "\t],\n" + "\t\"serviceNetworks\": [],\n"
+ + "\t\"serviceAllottedResources\": []\n" + "\t}}")));
-// when(UrnPropertiesReader.getVariable(anyString())).thenReturn("http://localhost:8080");
+ // when(UrnPropertiesReader.getVariable(anyString())).thenReturn("http://localhost:8080");
HashMap serviceInput = new HashMap();
serviceInput.put("key1", "value");
- Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5",
- "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
+ Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(
+ "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
assertEquals(stringObjectMap.get("a"), "value");
}
@Test
public void getResourceSequenceTest() throws Exception {
- wireMockServer.stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5"))
- .willReturn(ok("{ \"serviceResources\" : {\n" +
- "\t\"modelInfo\" : {\n" +
- "\t\t\"modelName\" : \"demoVFWCL\",\n" +
- "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n" +
- "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n" +
- "\t\t\"modelVersion\" : \"1.0\"\n" +
- "\t},\n" +
- "\t\"serviceType\" : \"\",\n" +
- "\t\"serviceRole\" : \"\",\n" +
- "\t\"environmentContext\" : null,\n" +
- "\t\"resourceOrder\" : \"res1,res2\",\n" +
- "\t\"workloadContext\" : \"Production\",\n" +
- "\t\"serviceVnfs\": [\n" +
- "\t\n" +
- "\t\t{ \"modelInfo\" : {\n" +
- "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n" +
- "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n" +
- "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n" +
- "\t\t\t\"modelVersion\" : \"1.0\",\n" +
- "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n" +
- "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" +
- "\t\t\t},\n" +
- "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n" +
- "\t\t\"nfFunction\" \t: null,\n" +
- "\"resourceInput\":\"{\\\"a\\\":\\\"b\\\"}\"," +
- "\t\t\"nfType\" \t\t: null,\n" +
- "\t\t\"nfRole\" \t\t: null,\n" +
- "\t\t\"nfNamingCode\" \t: null,\n" +
- "\t\t\"multiStageDesign\" : \"false\",\n" +
- "\t\t\t\"vfModules\": [\n" +
- "\t\t\t\t{\n" +
- "\t\t\t\t\t\"modelInfo\" : { \n" +
- "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n" +
- "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n" +
- "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n" +
- "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" +
- "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n" +
- "\t\t\t\t\t},\t\t\"isBase\" : true,\n" +
- "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n" +
- "\t\t\t\t\t\"initialCount\" : 1,\n" +
- "\t\t\t\t\t\"hasVolumeGroup\" : true\n" +
- "\t\t\t\t}\n" +
- "\t\t\t]\n" +
- "\t\t},\n" +
- "\t\n" +
- "\t\t{ \"modelInfo\" : {\n" +
- "\t\t\t\"modelName\" : \"f971106a-248f-4202-9d1f\",\n" +
- "\t\t\t\"modelUuid\" : \"4fbc08a4-35ed-4a59-9e47-79975e4add7e\",\n" +
- "\t\t\t\"modelInvariantUuid\" : \"c669799e-adf1-46ae-8c70-48b326fe89f3\",\n" +
- "\t\t\t\"modelVersion\" : \"1.0\",\n" +
- "\t\t\t\"modelCustomizationUuid\" : \"e776449e-2b10-45c5-9217-2775c88ca1a0\",\n" +
- "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" +
- "\t\t\t},\n" +
- "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n" +
- "\t\t\"nfFunction\" \t: null,\n" +
- "\t\t\"nfType\" \t\t: null,\n" +
- "\t\t\"nfRole\" \t\t: null,\n" +
- "\"resourceInput\":\"{\\\"a\\\":\\\"key|default_value\\\"}\"," +
- "\t\t\"nfNamingCode\" \t: null,\n" +
- "\t\t\"multiStageDesign\" : \"false\",\n" +
- "\t\t\t\"vfModules\": [\n" +
- "\t\t\t\t{\n" +
- "\t\t\t\t\t\"modelInfo\" : { \n" +
- "\t\t\t\t\t\t\"modelName\" : \"F971106a248f42029d1f..base_vpkg..module-0\",\n" +
- "\t\t\t\t\t\t\"modelUuid\" : \"47d5273a-7456-4786-9035-b3911944cc35\",\n" +
- "\t\t\t\t\t\t\"modelInvariantUuid\" : \"0ea3e57e-ac7a-425a-928b-b4aee8806c15\",\n" +
- "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" +
- "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"9ed9fef6-d3f8-4433-9807-7e23393a16bc\"\n" +
- "\t\t\t\t\t},\t\t\"isBase\" : true,\n" +
- "\t\t\t\t\t\"vfModuleLabel\" : \"base_vpkg\",\n" +
- "\t\t\t\t\t\"initialCount\" : 1,\n" +
- "\t\t\t\t\t\"hasVolumeGroup\" : true\n" +
- "\t\t\t\t}\n" +
- "\t\t\t]\n" +
- "\t\t}\n" +
- "\t],\n" +
- "\t\"serviceNetworks\": [],\n" +
- "\t\"serviceAllottedResources\": []\n" +
- "\t}}")));
+ wireMockServer.stubFor(get(urlEqualTo(
+ "/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5"))
+ .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n"
+ + "\t\t\"modelName\" : \"demoVFWCL\",\n"
+ + "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n"
+ + "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n"
+ + "\t\t\"modelVersion\" : \"1.0\"\n" + "\t},\n"
+ + "\t\"serviceType\" : \"\",\n" + "\t\"serviceRole\" : \"\",\n"
+ + "\t\"environmentContext\" : null,\n" + "\t\"resourceOrder\" : \"res1,res2\",\n"
+ + "\t\"workloadContext\" : \"Production\",\n" + "\t\"serviceVnfs\": [\n" + "\t\n"
+ + "\t\t{ \"modelInfo\" : {\n"
+ + "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n"
+ + "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n"
+ + "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n"
+ + "\t\t\t\"modelVersion\" : \"1.0\",\n"
+ + "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n"
+ + "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" + "\t\t\t},\n"
+ + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n"
+ + "\t\t\"nfFunction\" \t: null,\n"
+ + "\"resourceInput\":\"{\\\"a\\\":\\\"b\\\"}\","
+ + "\t\t\"nfType\" \t\t: null,\n"
+ + "\t\t\"nfRole\" \t\t: null,\n"
+ + "\t\t\"nfNamingCode\" \t: null,\n"
+ + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n"
+ + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n"
+ + "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n"
+ + "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n"
+ + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n"
+ + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n"
+ + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n"
+ + "\t\t\t\t\t},\t\t\"isBase\" : true,\n"
+ + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n"
+ + "\t\t\t\t\t\"initialCount\" : 1,\n"
+ + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n"
+ + "\t\t},\n" + "\t\n" + "\t\t{ \"modelInfo\" : {\n"
+ + "\t\t\t\"modelName\" : \"f971106a-248f-4202-9d1f\",\n"
+ + "\t\t\t\"modelUuid\" : \"4fbc08a4-35ed-4a59-9e47-79975e4add7e\",\n"
+ + "\t\t\t\"modelInvariantUuid\" : \"c669799e-adf1-46ae-8c70-48b326fe89f3\",\n"
+ + "\t\t\t\"modelVersion\" : \"1.0\",\n"
+ + "\t\t\t\"modelCustomizationUuid\" : \"e776449e-2b10-45c5-9217-2775c88ca1a0\",\n"
+ + "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" + "\t\t\t},\n"
+ + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n"
+ + "\t\t\"nfFunction\" \t: null,\n"
+ + "\t\t\"nfType\" \t\t: null,\n"
+ + "\t\t\"nfRole\" \t\t: null,\n"
+ + "\"resourceInput\":\"{\\\"a\\\":\\\"key|default_value\\\"}\","
+ + "\t\t\"nfNamingCode\" \t: null,\n"
+ + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n"
+ + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n"
+ + "\t\t\t\t\t\t\"modelName\" : \"F971106a248f42029d1f..base_vpkg..module-0\",\n"
+ + "\t\t\t\t\t\t\"modelUuid\" : \"47d5273a-7456-4786-9035-b3911944cc35\",\n"
+ + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"0ea3e57e-ac7a-425a-928b-b4aee8806c15\",\n"
+ + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n"
+ + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"9ed9fef6-d3f8-4433-9807-7e23393a16bc\"\n"
+ + "\t\t\t\t\t},\t\t\"isBase\" : true,\n"
+ + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vpkg\",\n"
+ + "\t\t\t\t\t\"initialCount\" : 1,\n"
+ + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n"
+ + "\t\t}\n" + "\t],\n" + "\t\"serviceNetworks\": [],\n"
+ + "\t\"serviceAllottedResources\": []\n" + "\t}}")));
- List<String> resourceSequence = ResourceRequestBuilder.getResourceSequence("c3954379-4efe-431c-8258-f84905b158e5");
+ List<String> resourceSequence =
+ ResourceRequestBuilder.getResourceSequence("c3954379-4efe-431c-8258-f84905b158e5");
assertEquals(resourceSequence.size(), 2);
assertEquals(resourceSequence.get(0), "res1");
assertEquals(resourceSequence.get(1), "res2");
@@ -403,27 +322,22 @@ public class ResourceRequestBuilderTest extends BaseTest {
@Test
public void getResourceInputWithEmptyServiceResourcesTest() throws Exception {
- wireMockServer.stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5"))
- .willReturn(ok("{ \"serviceResources\" : {\n" +
- "\t\"modelInfo\" : {\n" +
- "\t\t\"modelName\" : \"demoVFWCL\",\n" +
- "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n" +
- "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n" +
- "\t\t\"modelVersion\" : \"1.0\"\n" +
- "\t},\n" +
- "\t\"serviceType\" : \"\",\n" +
- "\t\"serviceRole\" : \"\",\n" +
- "\t\"environmentContext\" : null,\n" +
- "\t\"workloadContext\" : \"Production\",\n" +
- "\t\"serviceVnfs\": [], \n" +
- "\t\"serviceNetworks\": [],\n" +
- "\t\"serviceAllottedResources\": []\n" +
- "\t}}")));
+ wireMockServer.stubFor(get(urlEqualTo(
+ "/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5"))
+ .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n"
+ + "\t\t\"modelName\" : \"demoVFWCL\",\n"
+ + "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n"
+ + "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n"
+ + "\t\t\"modelVersion\" : \"1.0\"\n" + "\t},\n"
+ + "\t\"serviceType\" : \"\",\n" + "\t\"serviceRole\" : \"\",\n"
+ + "\t\"environmentContext\" : null,\n" + "\t\"workloadContext\" : \"Production\",\n"
+ + "\t\"serviceVnfs\": [], \n" + "\t\"serviceNetworks\": [],\n"
+ + "\t\"serviceAllottedResources\": []\n" + "\t}}")));
HashMap serviceInput = new HashMap();
serviceInput.put("key1", "value");
- Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5",
- "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
+ Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(
+ "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
assertEquals(0, stringObjectMap.size());
}
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
index 76bc830d26..273e9f0e3c 100644
--- 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
@@ -23,34 +23,33 @@ package org.onap.so.bpmn.common.util;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
-
import static org.junit.Assert.assertEquals;
public class CryptoHandlerTest {
- private static final String plainPswd = "mso0206";
- private CryptoHandler cryptoHandler;
- private static String encryptPwd;
-
-
- @Before
- public void setup() {
- cryptoHandler = new CryptoHandler();
- encryptPwd = cryptoHandler.encryptMsoPassword(plainPswd);
- }
-
- @Test
- @Ignore // ignored until we can mock the properties file.
- public void getMsoAaiPasswordTest() {
- assertEquals(plainPswd, cryptoHandler.getMsoAaiPassword());
- }
-
- @Test
- public void encryptMsoPasswordTest() {
- assertEquals(plainPswd,cryptoHandler.decryptMsoPassword(cryptoHandler.encryptMsoPassword(plainPswd)));
- }
-
- @Test
- public void decryptMsoPasswordTest() {
- assertEquals(plainPswd, cryptoHandler.decryptMsoPassword(encryptPwd));
- }
-} \ No newline at end of file
+ private static final String plainPswd = "mso0206";
+ private CryptoHandler cryptoHandler;
+ private static String encryptPwd;
+
+
+ @Before
+ public void setup() {
+ cryptoHandler = new CryptoHandler();
+ encryptPwd = cryptoHandler.encryptMsoPassword(plainPswd);
+ }
+
+ @Test
+ @Ignore // ignored until we can mock the properties file.
+ public void getMsoAaiPasswordTest() {
+ assertEquals(plainPswd, cryptoHandler.getMsoAaiPassword());
+ }
+
+ @Test
+ public void encryptMsoPasswordTest() {
+ assertEquals(plainPswd, cryptoHandler.decryptMsoPassword(cryptoHandler.encryptMsoPassword(plainPswd)));
+ }
+
+ @Test
+ public void decryptMsoPasswordTest() {
+ assertEquals(plainPswd, cryptoHandler.decryptMsoPassword(encryptPwd));
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunnerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunnerTest.java
index 617f63f6f8..f13bcb8a93 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunnerTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunnerTest.java
@@ -24,10 +24,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
-
import java.util.Arrays;
import java.util.List;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Rule;
@@ -45,46 +43,48 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@ContextConfiguration(classes = {ValidationConfig.class})
public class BuildingBlockValidatorRunnerTest {
- @Rule
- public ExpectedException thrown= ExpectedException.none();
-
- @Autowired
- private BuildingBlockValidatorRunner runner;
-
- @Test
- public void filterValidatorTest() {
-
- MyPreValidatorOne one = new MyPreValidatorOne();
- MyPreValidatorTwo two = new MyPreValidatorTwo();
- MyPreValidatorThree three = new MyPreValidatorThree();
- List<FlowValidator> validators = Arrays.asList(one, two, three);
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Autowired
+ private BuildingBlockValidatorRunner runner;
+
+ @Test
+ public void filterValidatorTest() {
+
+ MyPreValidatorOne one = new MyPreValidatorOne();
+ MyPreValidatorTwo two = new MyPreValidatorTwo();
+ MyPreValidatorThree three = new MyPreValidatorThree();
+ List<FlowValidator> validators = Arrays.asList(one, two, three);
+
+ List<FlowValidator> result = runner.filterValidators(validators, "test");
+
+ List<FlowValidator> expected = Arrays.asList(two, one);
+
+ assertEquals(expected, result);
+ }
+
+ @Test
+ public void testValidate() {
+
+ BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake());
+ execution.setVariable("testProcessKey", "1234");
+ try {
+ runner.preValidate("test", execution);
+ fail("exception not thrown");
+ } catch (BpmnError e) {
+ WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
+ assertEquals(
+ "Failed Validations:\norg.onap.so.bpmn.common.validation.MyPreValidatorTwo: my-error-two\norg.onap.so.bpmn.common.validation.MyPreValidatorOne: my-error-one",
+ workflowException.getErrorMessage());
+ }
+ runner.preValidate("test2", mock(BuildingBlockExecution.class));
+ }
- List<FlowValidator> result = runner.filterValidators(validators, "test");
+ @Test
+ public void testEmptyList() {
+ boolean result = runner.preValidate("test3", mock(BuildingBlockExecution.class));
- List<FlowValidator> expected = Arrays.asList(two, one);
-
- assertEquals(expected, result);
- }
-
- @Test
- public void testValidate() {
-
- BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake());
- execution.setVariable("testProcessKey", "1234");
- try {
- runner.preValidate("test", execution);
- fail("exception not thrown");
- } catch (BpmnError e) {
- WorkflowException workflowException = (WorkflowException)execution.getVariable("WorkflowException");
- assertEquals("Failed Validations:\norg.onap.so.bpmn.common.validation.MyPreValidatorTwo: my-error-two\norg.onap.so.bpmn.common.validation.MyPreValidatorOne: my-error-one", workflowException.getErrorMessage());
- }
- runner.preValidate("test2", mock(BuildingBlockExecution.class));
- }
-
- @Test
- public void testEmptyList() {
- boolean result = runner.preValidate("test3", mock(BuildingBlockExecution.class));
-
- assertTrue(result);
- }
+ assertTrue(result);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyDisabledValidator.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyDisabledValidator.java
index 78e4791b1c..7572e930cd 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyDisabledValidator.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyDisabledValidator.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.common.validation;
import java.util.Collections;
import java.util.Optional;
-
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.springframework.stereotype.Component;
@@ -30,15 +29,15 @@ import org.springframework.stereotype.Component;
@Skip
public class MyDisabledValidator implements PreBuildingBlockValidator {
- @Override
- public boolean shouldRunFor(String bbName) {
-
- return Collections.singleton("test").contains(bbName);
- }
+ @Override
+ public boolean shouldRunFor(String bbName) {
+
+ return Collections.singleton("test").contains(bbName);
+ }
- @Override
- public Optional<String> validate(BuildingBlockExecution exeuction) {
- return Optional.of("my-disabled-validator");
- }
+ @Override
+ public Optional<String> validate(BuildingBlockExecution exeuction) {
+ return Optional.of("my-disabled-validator");
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorFour.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorFour.java
index af45a129e2..85531719d5 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorFour.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorFour.java
@@ -23,21 +23,20 @@ package org.onap.so.bpmn.common.validation;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
-
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.springframework.stereotype.Component;
@Component
public class MyPreValidatorFour implements PreBuildingBlockValidator {
- @Override
- public boolean shouldRunFor(String bbName) {
- return Collections.singleton("test2").contains(bbName);
- }
+ @Override
+ public boolean shouldRunFor(String bbName) {
+ return Collections.singleton("test2").contains(bbName);
+ }
- @Override
- public Optional<String> validate(BuildingBlockExecution exeuction) {
- return Optional.of("my-error-four");
- }
+ @Override
+ public Optional<String> validate(BuildingBlockExecution exeuction) {
+ return Optional.of("my-error-four");
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorOne.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorOne.java
index d1d50e2a89..989a65fe47 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorOne.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorOne.java
@@ -23,22 +23,21 @@ package org.onap.so.bpmn.common.validation;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
-
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.springframework.stereotype.Component;
@Component
public class MyPreValidatorOne implements PreBuildingBlockValidator {
- @Override
- public boolean shouldRunFor(String bbName) {
-
- return Collections.singleton("test").contains(bbName);
- }
+ @Override
+ public boolean shouldRunFor(String bbName) {
+
+ return Collections.singleton("test").contains(bbName);
+ }
- @Override
- public Optional<String> validate(BuildingBlockExecution exeuction) {
- return Optional.of("my-error-one");
- }
+ @Override
+ public Optional<String> validate(BuildingBlockExecution exeuction) {
+ return Optional.of("my-error-one");
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorThree.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorThree.java
index 363020de71..a51d3836da 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorThree.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorThree.java
@@ -23,21 +23,20 @@ package org.onap.so.bpmn.common.validation;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
-
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.springframework.stereotype.Component;
@Component
public class MyPreValidatorThree implements PreBuildingBlockValidator {
- @Override
- public boolean shouldRunFor(String bbName) {
- return Collections.singleton("test2").contains(bbName);
- }
+ @Override
+ public boolean shouldRunFor(String bbName) {
+ return Collections.singleton("test2").contains(bbName);
+ }
- @Override
- public Optional<String> validate(BuildingBlockExecution exeuction) {
- return Optional.of("my-error-three");
- }
+ @Override
+ public Optional<String> validate(BuildingBlockExecution exeuction) {
+ return Optional.of("my-error-three");
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorTwo.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorTwo.java
index 4d78f4e458..1276d8f1d2 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorTwo.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorTwo.java
@@ -23,9 +23,7 @@ package org.onap.so.bpmn.common.validation;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
-
import javax.annotation.Priority;
-
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.springframework.stereotype.Component;
@@ -33,14 +31,14 @@ import org.springframework.stereotype.Component;
@Component
public class MyPreValidatorTwo implements PreBuildingBlockValidator {
- @Override
- public boolean shouldRunFor(String bbName) {
- return Collections.singleton("test").contains(bbName);
- }
+ @Override
+ public boolean shouldRunFor(String bbName) {
+ return Collections.singleton("test").contains(bbName);
+ }
- @Override
- public Optional<String> validate(BuildingBlockExecution exeuction) {
- return Optional.of("my-error-two");
- }
+ @Override
+ public Optional<String> validate(BuildingBlockExecution exeuction) {
+ return Optional.of("my-error-two");
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/ValidationConfig.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/ValidationConfig.java
index 7570e4c915..90d094ce41 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/ValidationConfig.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/ValidationConfig.java
@@ -27,7 +27,8 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
@Configuration
-@ComponentScan(basePackages = {"org.onap.so.bpmn.common.validation"}, basePackageClasses = {ExceptionBuilder.class}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class)
+@ComponentScan(basePackages = {"org.onap.so.bpmn.common.validation"}, basePackageClasses = {ExceptionBuilder.class},
+ nameGenerator = DefaultToShortClassNameBeanNameGenerator.class)
public class ValidationConfig {
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorOne.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorOne.java
index 891496fa2b..485aae2fcc 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorOne.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorOne.java
@@ -23,22 +23,21 @@ package org.onap.so.bpmn.common.validation;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
-
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.springframework.stereotype.Component;
@Component
public class WorkflowPreValidatorOne implements PreWorkflowValidator {
- @Override
- public boolean shouldRunFor(String bbName) {
-
- return Collections.singleton("test").contains(bbName);
- }
+ @Override
+ public boolean shouldRunFor(String bbName) {
+
+ return Collections.singleton("test").contains(bbName);
+ }
- @Override
- public Optional<String> validate(BuildingBlockExecution exeuction) {
- return Optional.of("my-error-one");
- }
+ @Override
+ public Optional<String> validate(BuildingBlockExecution exeuction) {
+ return Optional.of("my-error-one");
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorTwo.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorTwo.java
index 80b55df8f5..9596524a56 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorTwo.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorTwo.java
@@ -23,9 +23,7 @@ package org.onap.so.bpmn.common.validation;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
-
import javax.annotation.Priority;
-
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.springframework.stereotype.Component;
@@ -33,14 +31,14 @@ import org.springframework.stereotype.Component;
@Component
public class WorkflowPreValidatorTwo implements PreWorkflowValidator {
- @Override
- public boolean shouldRunFor(String bbName) {
- return Collections.singleton("test").contains(bbName);
- }
+ @Override
+ public boolean shouldRunFor(String bbName) {
+ return Collections.singleton("test").contains(bbName);
+ }
- @Override
- public Optional<String> validate(BuildingBlockExecution exeuction) {
- return Optional.of("my-error-two");
- }
+ @Override
+ public Optional<String> validate(BuildingBlockExecution exeuction) {
+ return Optional.of("my-error-two");
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunnerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunnerTest.java
index 5629f99feb..07cd790ed1 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunnerTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunnerTest.java
@@ -24,10 +24,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
-
import java.util.Arrays;
import java.util.List;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
@@ -45,45 +43,47 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@ContextConfiguration(classes = {ValidationConfig.class})
public class WorkflowValidatorRunnerTest {
- @Rule
- public ExpectedException thrown= ExpectedException.none();
-
- @Autowired
- private WorkflowValidatorRunner runner;
-
- @Test
- public void filterValidatorTest() {
-
- WorkflowPreValidatorOne one = new WorkflowPreValidatorOne();
- WorkflowPreValidatorTwo two = new WorkflowPreValidatorTwo();
- List<FlowValidator> validators = Arrays.asList(one, two);
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Autowired
+ private WorkflowValidatorRunner runner;
+
+ @Test
+ public void filterValidatorTest() {
+
+ WorkflowPreValidatorOne one = new WorkflowPreValidatorOne();
+ WorkflowPreValidatorTwo two = new WorkflowPreValidatorTwo();
+ List<FlowValidator> validators = Arrays.asList(one, two);
+
+ List<FlowValidator> result = runner.filterValidators(validators, "test");
+
+ List<FlowValidator> expected = Arrays.asList(two, one);
+
+ assertEquals(expected, result);
+ }
+
+ @Test
+ public void testValidate() {
+
+ DelegateExecution execution = new DelegateExecutionFake();
+ execution.setVariable("testProcessKey", "1234");
+ try {
+ runner.preValidate("test", execution);
+ fail("exception not thrown");
+ } catch (BpmnError e) {
+ WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
+ assertEquals(
+ "Failed Validations:\norg.onap.so.bpmn.common.validation.WorkflowPreValidatorTwo: my-error-two\norg.onap.so.bpmn.common.validation.WorkflowPreValidatorOne: my-error-one",
+ workflowException.getErrorMessage());
+ }
+ runner.preValidate("test2", mock(DelegateExecution.class));
+ }
- List<FlowValidator> result = runner.filterValidators(validators, "test");
+ @Test
+ public void testEmptyList() {
+ boolean result = runner.preValidate("test3", mock(DelegateExecution.class));
- List<FlowValidator> expected = Arrays.asList(two, one);
-
- assertEquals(expected, result);
- }
-
- @Test
- public void testValidate() {
-
- DelegateExecution execution = new DelegateExecutionFake();
- execution.setVariable("testProcessKey", "1234");
- try {
- runner.preValidate("test", execution);
- fail("exception not thrown");
- } catch (BpmnError e) {
- WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
- assertEquals("Failed Validations:\norg.onap.so.bpmn.common.validation.WorkflowPreValidatorTwo: my-error-two\norg.onap.so.bpmn.common.validation.WorkflowPreValidatorOne: my-error-one", workflowException.getErrorMessage());
- }
- runner.preValidate("test2", mock(DelegateExecution.class));
- }
-
- @Test
- public void testEmptyList() {
- boolean result = runner.preValidate("test3", mock(DelegateExecution.class));
-
- assertTrue(result);
- }
+ assertTrue(result);
+ }
}
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
index 6a3668b175..e74dece785 100644
--- 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
@@ -34,51 +34,50 @@ import org.slf4j.LoggerFactory;
* </p>
*
* @author
- * @version ONAP Sep 15, 2017
+ * @version ONAP Sep 15, 2017
*/
public class FileUtil {
private static final Logger logger = LoggerFactory.getLogger(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;
- }
+
+ /**
+ * 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/StubResponseAAI.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java
index 80625dd4d5..0d09a72edd 100644
--- 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
@@ -30,7 +30,6 @@ 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.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-
import com.github.tomakehurst.wiremock.WireMockServer;
@@ -40,1059 +39,1027 @@ import com.github.tomakehurst.wiremock.WireMockServer;
*/
public class StubResponseAAI {
- public static void setupAllMocks() {
-
- }
-
-
- /**
- * Allotted Resource Mock StubResponses below
- */
- public static void MockGetAllottedResource(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String responseFile) {
- wireMockServer.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(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
- wireMockServer.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(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
- wireMockServer.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(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String resourceVersion) {
- wireMockServer.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(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
- wireMockServer.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(WireMockServer wireMockServer, String allottedResourceId, String responseFile){
- wireMockServer.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(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String serviceInstanceId) {
- wireMockServer.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(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) {
- wireMockServer.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(WireMockServer wireMockServer, String customer, String serviceSubscription, String serviceInstanceId){
- wireMockServer.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(WireMockServer wireMockServer, String customer, String serviceSubscription, String serviceInstanceId){
- wireMockServer.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(WireMockServer wireMockServer, String customer, String serviceSubscription, String serviceInstanceId, String responseFile){
- wireMockServer.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(WireMockServer wireMockServer, String serviceInstanceName, String responseFile){
- wireMockServer.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(WireMockServer wireMockServer, String serviceInstanceName){
- wireMockServer.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(WireMockServer wireMockServer, String serviceInstanceName){
- wireMockServer.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(WireMockServer wireMockServer, String serviceInstanceId, String responseFile){
- wireMockServer.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(WireMockServer wireMockServer, String serviceInstanceId){
- wireMockServer.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(WireMockServer wireMockServer, String serviceInstanceId){
- wireMockServer.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(WireMockServer wireMockServer, String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){
- wireMockServer.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(WireMockServer wireMockServer, String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){
- wireMockServer.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(WireMockServer wireMockServer, String customer, String serviceSubscription, int statusCode){
- wireMockServer.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(WireMockServer wireMockServer, String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){
- wireMockServer.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(WireMockServer wireMockServer, String customer, String serviceSubscription, String resourceVersion, int statusCode){
- wireMockServer.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(WireMockServer wireMockServer, String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){
- wireMockServer.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(WireMockServer wireMockServer, String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){
- wireMockServer.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(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) {
- wireMockServer.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(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String serviceInstanceId) {
- wireMockServer.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(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String responseFile) {
- wireMockServer.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(WireMockServer wireMockServer, String globalCustId, String subscriptionType, int statusCode) {
- wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockDeleteServiceInstanceId(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String serviceInstanceId) {
- wireMockServer.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(WireMockServer wireMockServer, String globalCustId, String subscriptionType) {
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockGetServiceSubscription(WireMockServer wireMockServer, String globalCustId, String subscriptionType, int statusCode) {
- wireMockServer.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(WireMockServer wireMockServer, String globalCustId, String responseFile) {
- wireMockServer.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(WireMockServer wireMockServer, String globalCustId) {
- wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutCustomer(WireMockServer wireMockServer, String globalCustId) {
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutCustomer_500(WireMockServer wireMockServer, String globalCustId) {
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
-
- /**
- * Generic-Vnf Mock StubResponses below
- */
-
- public static void MockGetGenericVnfById(WireMockServer wireMockServer, String vnfId, String responseFile){
- wireMockServer.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(WireMockServer wireMockServer, String vnfId, String responseFile, int statusCode){
- wireMockServer.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(WireMockServer wireMockServer, String vnfId, int statusCode, String responseFile) {
- wireMockServer.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(WireMockServer wireMockServer, String vnfId, String vfModuleId, int statusCode, String responseFile, int priority) {
- wireMockServer.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(WireMockServer wireMockServer, String vnfId, int depth, String responseFile){
- wireMockServer.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(WireMockServer wireMockServer, String vnfId){
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockGetGenericVnfById_500(WireMockServer wireMockServer, String vnfId){
- wireMockServer.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(WireMockServer wireMockServer, String vnfName, String responseFile){
- wireMockServer.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(WireMockServer wireMockServer, String vnfName, int depth, String responseFile){
- wireMockServer.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(WireMockServer wireMockServer, String vnfName){
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockDeleteGenericVnf(WireMockServer wireMockServer, String vnfId, String resourceVersion){
- wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(204)));
- }
-
- public static void MockDeleteGenericVnf(WireMockServer wireMockServer, String vnfId, String resourceVersion, int statusCode){
- wireMockServer.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(WireMockServer wireMockServer, String vnfId, String resourceVersion){
- wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockPutGenericVnf(WireMockServer wireMockServer, String vnfId){
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutGenericVnf(WireMockServer wireMockServer, String vnfId, String requestBodyContaining, int statusCode) {
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
- .withRequestBody(containing(requestBodyContaining))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockPutGenericVnf(WireMockServer wireMockServer, String vnfId, int statusCode) {
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockPutGenericVnf_Bad(WireMockServer wireMockServer, String vnfId, int statusCode){
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockPatchGenericVnf(WireMockServer wireMockServer, String vnfId){
- wireMockServer.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(WireMockServer wireMockServer, String vnfId, String responseFile){
- wireMockServer.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(WireMockServer wireMockServer, String vnfName, String responseFile){
- wireMockServer.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(WireMockServer wireMockServer, String vnfId, String resourceVersion, int statusCode){
- wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockPutVce(WireMockServer wireMockServer, String vnfId){
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockGetGenericVceByNameWithDepth(WireMockServer wireMockServer, String vnfName, int depth, String responseFile){
- wireMockServer.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(WireMockServer wireMockServer, String serviceInstanceName, int depth, int statusCode, String responseFile){
- wireMockServer.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(WireMockServer wireMockServer, String customer, String serviceType, String responseFile) {
- wireMockServer.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(WireMockServer wireMockServer, String tenantId, String responseFile) {
- wireMockServer.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(WireMockServer wireMockServer, String networkId, String responseFile, int statusCode) {
- wireMockServer.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(WireMockServer wireMockServer, String networkId, String responseFile, String depth) {
- wireMockServer.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(WireMockServer wireMockServer, String responseFile, String cloudRegion) {
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"+cloudRegion))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkByName(WireMockServer wireMockServer, String networkName, String responseFile) {
- wireMockServer.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(WireMockServer wireMockServer, String responseFile, String networkName) {
- wireMockServer.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(WireMockServer wireMockServer, String cloudRegion) {
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"+cloudRegion))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockPutNetwork(WireMockServer wireMockServer, String networkId, int statusCode, String responseFile) {
- wireMockServer.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(WireMockServer wireMockServer, String networkPolicyId, String responseFile, int statusCode) {
- wireMockServer.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 setupAllMocks() {
+
+ }
+
+
+ /**
+ * Allotted Resource Mock StubResponses below
+ */
+ public static void MockGetAllottedResource(WireMockServer wireMockServer, String globalCustId,
+ String subscriptionType, String serviceInstanceId, String allottedResourceId, String responseFile) {
+ wireMockServer.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(WireMockServer wireMockServer, String globalCustId,
+ String subscriptionType, String serviceInstanceId, String allottedResourceId) {
+ wireMockServer.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(WireMockServer wireMockServer, String globalCustId,
+ String subscriptionType, String serviceInstanceId, String allottedResourceId) {
+ wireMockServer.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(WireMockServer wireMockServer, String globalCustId,
+ String subscriptionType, String serviceInstanceId, String allottedResourceId, String resourceVersion) {
+ wireMockServer.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(WireMockServer wireMockServer, String globalCustId,
+ String subscriptionType, String serviceInstanceId, String allottedResourceId) {
+ wireMockServer.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(WireMockServer wireMockServer, String allottedResourceId,
+ String responseFile) {
+ wireMockServer.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(WireMockServer wireMockServer, String globalCustId,
+ String subscriptionType, String serviceInstanceId) {
+ wireMockServer.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(WireMockServer wireMockServer, String globalCustId,
+ String subscriptionType, String serviceInstanceId, String responseFile) {
+ wireMockServer.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(WireMockServer wireMockServer, String customer,
+ String serviceSubscription, String serviceInstanceId) {
+ wireMockServer.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(WireMockServer wireMockServer, String customer,
+ String serviceSubscription, String serviceInstanceId) {
+ wireMockServer.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(WireMockServer wireMockServer, String customer,
+ String serviceSubscription, String serviceInstanceId, String responseFile) {
+ wireMockServer.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(WireMockServer wireMockServer, String serviceInstanceName,
+ String responseFile) {
+ wireMockServer.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(WireMockServer wireMockServer,
+ String serviceInstanceName) {
+ wireMockServer.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(WireMockServer wireMockServer,
+ String serviceInstanceName) {
+ wireMockServer.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(WireMockServer wireMockServer, String serviceInstanceId,
+ String responseFile) {
+ wireMockServer.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(WireMockServer wireMockServer, String serviceInstanceId) {
+ wireMockServer.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(WireMockServer wireMockServer, String serviceInstanceId) {
+ wireMockServer.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(WireMockServer wireMockServer, String customer,
+ String serviceSubscription, String serviceInstanceId, String resourceVersion) {
+ wireMockServer.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(WireMockServer wireMockServer, String customer,
+ String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode) {
+ wireMockServer.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(WireMockServer wireMockServer, String customer,
+ String serviceSubscription, int statusCode) {
+ wireMockServer.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(WireMockServer wireMockServer, String customer,
+ String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode) {
+ wireMockServer.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(WireMockServer wireMockServer, String customer,
+ String serviceSubscription, String resourceVersion, int statusCode) {
+ wireMockServer.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(WireMockServer wireMockServer, String customer,
+ String serviceSubscription, String serviceInstanceId, String resourceVersion) {
+ wireMockServer.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(WireMockServer wireMockServer, String customer,
+ String serviceSubscription, String serviceInstanceId, String resourceVersion) {
+ wireMockServer.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(WireMockServer wireMockServer, String globalCustId,
+ String subscriptionType, String serviceInstanceId, String responseFile) {
+ wireMockServer.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(WireMockServer wireMockServer, String globalCustId,
+ String subscriptionType, String serviceInstanceId) {
+ wireMockServer.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(WireMockServer wireMockServer, String globalCustId,
+ String subscriptionType, String responseFile) {
+ wireMockServer.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(WireMockServer wireMockServer, String globalCustId,
+ String subscriptionType, int statusCode) {
+ wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId
+ + "/service-subscriptions/service-subscription/" + subscriptionType))
+ .willReturn(aResponse().withStatus(statusCode)));
+ }
+
+ public static void MockDeleteServiceInstanceId(WireMockServer wireMockServer, String globalCustId,
+ String subscriptionType, String serviceInstanceId) {
+ wireMockServer.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(WireMockServer wireMockServer, String globalCustId,
+ String subscriptionType) {
+ wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId
+ + "/service-subscriptions/service-subscription/" + subscriptionType))
+ .willReturn(aResponse().withStatus(200)));
+ }
+
+ public static void MockGetServiceSubscription(WireMockServer wireMockServer, String globalCustId,
+ String subscriptionType, int statusCode) {
+ wireMockServer.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(WireMockServer wireMockServer, String globalCustId, String responseFile) {
+ wireMockServer.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(WireMockServer wireMockServer, String globalCustId) {
+ wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
+ .willReturn(aResponse().withStatus(200)));
+ }
+
+ public static void MockPutCustomer(WireMockServer wireMockServer, String globalCustId) {
+ wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
+ .willReturn(aResponse().withStatus(200)));
+ }
+
+ public static void MockPutCustomer_500(WireMockServer wireMockServer, String globalCustId) {
+ wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
+ .willReturn(aResponse().withStatus(500)));
+ }
+
+
+ /**
+ * Generic-Vnf Mock StubResponses below
+ */
+
+ public static void MockGetGenericVnfById(WireMockServer wireMockServer, String vnfId, String responseFile) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfId, String responseFile,
+ int statusCode) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfId, int statusCode,
+ String responseFile) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfId, String vfModuleId,
+ int statusCode, String responseFile, int priority) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfId, int depth,
+ String responseFile) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfId) {
+ wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
+ .willReturn(aResponse().withStatus(404)));
+ }
+
+ public static void MockGetGenericVnfById_500(WireMockServer wireMockServer, String vnfId) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfName, String responseFile) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfName, int depth,
+ String responseFile) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfName) {
+ wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName))
+ .willReturn(aResponse().withStatus(404)));
+ }
+
+ public static void MockDeleteGenericVnf(WireMockServer wireMockServer, String vnfId, String resourceVersion) {
+ wireMockServer.stubFor(delete(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
+ .willReturn(aResponse().withStatus(204)));
+ }
+
+ public static void MockDeleteGenericVnf(WireMockServer wireMockServer, String vnfId, String resourceVersion,
+ int statusCode) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfId, String resourceVersion) {
+ wireMockServer.stubFor(delete(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
+ .willReturn(aResponse().withStatus(500)));
+ }
+
+ public static void MockPutGenericVnf(WireMockServer wireMockServer, String vnfId) {
+ wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
+ .willReturn(aResponse().withStatus(200)));
+ }
+
+ public static void MockPutGenericVnf(WireMockServer wireMockServer, String vnfId, String requestBodyContaining,
+ int statusCode) {
+ wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
+ .withRequestBody(containing(requestBodyContaining)).willReturn(aResponse().withStatus(statusCode)));
+ }
+
+ public static void MockPutGenericVnf(WireMockServer wireMockServer, String vnfId, int statusCode) {
+ wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
+ .willReturn(aResponse().withStatus(statusCode)));
+ }
+
+ public static void MockPutGenericVnf_Bad(WireMockServer wireMockServer, String vnfId, int statusCode) {
+ wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
+ .willReturn(aResponse().withStatus(statusCode)));
+ }
+
+ public static void MockPatchGenericVnf(WireMockServer wireMockServer, String vnfId) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfId, String responseFile) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfName, String responseFile) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfId, String resourceVersion,
+ int statusCode) {
+ wireMockServer.stubFor(
+ delete(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId + "[?]resource-version=" + resourceVersion))
+ .willReturn(aResponse().withStatus(statusCode)));
+ }
+
+ public static void MockPutVce(WireMockServer wireMockServer, String vnfId) {
+ wireMockServer.stubFor(
+ put(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId)).willReturn(aResponse().withStatus(200)));
+ }
+
+ public static void MockGetGenericVceByNameWithDepth(WireMockServer wireMockServer, String vnfName, int depth,
+ String responseFile) {
+ wireMockServer
+ .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(WireMockServer wireMockServer, String serviceInstanceName, int depth,
+ int statusCode, String responseFile) {
+ wireMockServer.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(WireMockServer wireMockServer, String customer, String serviceType,
+ String responseFile) {
+ wireMockServer.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(WireMockServer wireMockServer, String tenantId, String responseFile) {
+ wireMockServer.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(WireMockServer wireMockServer, String networkId, String responseFile,
+ int statusCode) {
+ wireMockServer.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(WireMockServer wireMockServer, String networkId, String responseFile,
+ String depth) {
+ wireMockServer.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(WireMockServer wireMockServer, String responseFile,
+ String cloudRegion) {
+ wireMockServer.stubFor(get(
+ urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegion))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetNetworkByName(WireMockServer wireMockServer, String networkName, String responseFile) {
+ wireMockServer
+ .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(WireMockServer wireMockServer, String responseFile,
+ String networkName) {
+ wireMockServer
+ .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(WireMockServer wireMockServer, String cloudRegion) {
+ wireMockServer.stubFor(get(
+ urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegion))
+ .willReturn(aResponse().withStatus(404)));
+ }
+
+ public static void MockPutNetwork(WireMockServer wireMockServer, String networkId, int statusCode,
+ String responseFile) {
+ wireMockServer.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(WireMockServer wireMockServer, String networkPolicyId, String responseFile,
+ int statusCode) {
+ wireMockServer
+ .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 MockPostNetwork(WireMockServer wireMockServer, String networkId) {
wireMockServer.stubFor(post(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId))
- .willReturn(aResponse()
- .withStatus(201)
- .withHeader("Content-Type", "text/xml")));
+ .willReturn(aResponse().withStatus(201).withHeader("Content-Type", "text/xml")));
}
public static void MockPostNetworkSubnet(WireMockServer wireMockServer, String networkId, String subnetId) {
- wireMockServer.stubFor(post(urlMatching(
- "/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "/subnets/subnet/" + subnetId))
- .willReturn(aResponse()
- .withStatus(201)
- .withHeader("Content-Type", "text/xml")));
+ wireMockServer.stubFor(post(
+ urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "/subnets/subnet/" + subnetId))
+ .willReturn(aResponse().withStatus(201).withHeader("Content-Type", "text/xml")));
}
- public static void MockGetNetworkName(WireMockServer wireMockServer, String networkPolicyName, String responseFile, int statusCode) {
- wireMockServer.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 MockGetNetworkName(WireMockServer wireMockServer, String networkPolicyName, String responseFile,
+ int statusCode) {
+ wireMockServer.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(WireMockServer wireMockServer, String responseFile, String vpnBinding) {
MockGetNetworkVpnBindingWithDepth(wireMockServer, responseFile, vpnBinding, "all");
}
public static void MockGetNetworkVpnBindingWithDepth(WireMockServer wireMockServer, String responseFile,
- String vpnBinding, String depth) {
+ String vpnBinding, String depth) {
+ wireMockServer.stubFor(
+ get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + vpnBinding + "[?]depth=" + depth))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetNetworkPolicy(WireMockServer wireMockServer, String responseFile, String policy) {
+ wireMockServer.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(WireMockServer wireMockServer, String networkBindingId,
+ String responseFile, int statusCode) {
+ wireMockServer.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(WireMockServer wireMockServer, String networkPolicy, String responseFile,
+ int statusCode) {
+ wireMockServer.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(WireMockServer wireMockServer, String responseFile,
+ String tableReference) {
+ wireMockServer.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(WireMockServer wireMockServer, String responseFile, String networkId,
+ String depth) {
+ wireMockServer.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(WireMockServer wireMockServer, String networkPolicy,
+ String responseFile, int statusCode) {
+ wireMockServer.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(WireMockServer wireMockServer, String networkRouteId,
+ String responseFile, int statusCode) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfId, String vfModuleId) {
+ wireMockServer.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(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool"))
+ .willReturn(aResponse().withStatus(202).withHeader("Content-Type", "application/xml")));
+ wireMockServer.stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules"))
+ .willReturn(aResponse().withStatus(202).withHeader("Content-Type", "application/xml")));
+ wireMockServer.stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules"))
+ .willReturn(aResponse().withStatus(202).withHeader("Content-Type", "application/xml")));
+ wireMockServer.stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987"))
+ .willReturn(aResponse().withStatus(202).withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void MockDBUpdateVfModule(WireMockServer wireMockServer) {
+ wireMockServer.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(WireMockServer wireMockServer) {
+ // simplified the implementation to return "success" for all requests
+ wireMockServer.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(WireMockServer wireMockServer) {
+ wireMockServer.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")));
+ wireMockServer.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")));
+ wireMockServer
+ .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")));
+ wireMockServer.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")));
+ wireMockServer.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)));
+ wireMockServer.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
+ wireMockServer
+ .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
+ wireMockServer
+ .stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
+ .withRequestBody(containing("MODULELABEL")).willReturn(aResponse().withStatus(200)));
+ wireMockServer.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")));
+ wireMockServer.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")));
+ wireMockServer.stubFor(get(urlMatching(
+ "/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/MDTWNJ21/volume-groups/volume-group/78987"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
+ .withBodyFile("VfModularity/VolumeGroup.xml")));
+ wireMockServer.stubFor(get(urlMatching(
+ "/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/volume-groups/volume-group/78987"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
+ .withBodyFile("VfModularity/VolumeGroup.xml")));
+ wireMockServer.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")));
+ wireMockServer.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")));
+ wireMockServer.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(WireMockServer wireMockServer, String cloudRegionId, int statusCode,
+ String responseFile) {
+ wireMockServer.stubFor(get(
+ urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId))
+ .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ /**
+ * Volume Group StubResponse below
+ */
+ public static void MockGetVolumeGroupById(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupId,
+ String responseFile) {
+ MockGetVolumeGroupById(wireMockServer, cloudRegionId, volumeGroupId, responseFile, 200);
+ }
+
+ public static void MockGetVolumeGroupById(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupId,
+ String responseFile, int responseCode) {
+ wireMockServer
+ .stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"
+ + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))
+ .willReturn(aResponse().withStatus(responseCode).withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockPutVolumeGroupById(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupId,
+ String responseFile, int statusCode) {
+ wireMockServer
+ .stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"
+ + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))
+ .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetVolumeGroupByName(WireMockServer wireMockServer, String cloudRegionId,
+ String volumeGroupName, String responseFile, int statusCode) {
+ wireMockServer
+ .stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"
+ + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName))
+ .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockDeleteVolumeGroupById(WireMockServer wireMockServer, String cloudRegionId,
+ String volumeGroupId, String resourceVersion, int statusCode) {
+ wireMockServer.stubFor(delete(
+ urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId
+ + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion))
+ .willReturn(aResponse().withStatus(statusCode)));
+ }
+
+ public static void MockGetVolumeGroupByName_404(WireMockServer wireMockServer, String cloudRegionId,
+ String volumeGroupName) {
+ wireMockServer.stubFor(get(urlMatching("/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"
+ + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName))
+ .willReturn(aResponse().withStatus(404)));
+ }
+
+ public static void MockDeleteVolumeGroup(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupId,
+ String resourceVersion) {
+ wireMockServer.stubFor(delete(
+ urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId
+ + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion))
+ .willReturn(aResponse().withStatus(200)));
+ }
+
+ /**
+ * VF-Module StubResponse below
+ *
+ * @param statusCode TODO
+ */
+ public static void MockGetVfModuleId(WireMockServer wireMockServer, String vnfId, String vfModuleId,
+ String responseFile, int statusCode) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfId, String vfModuleName,
+ int depth, String responseFile, int statusCode) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfId, String vfModuleName,
+ String responseFile, int statusCode) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfId,
+ String requestContaining, String vfModuleId) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfId,
+ String requestContaining, String vfModuleId) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfId, String vfModuleId) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfId, String vfModuleId,
+ int returnCode) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfId, String vfModuleId,
+ String resourceVersion, int returnCode) {
+ wireMockServer.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(WireMockServer wireMockServer, String endpoint, int statusCode) {
+ wireMockServer.stubFor(patch(urlMatching(endpoint)).willReturn(aResponse().withStatus(statusCode)));
+ }
+
+ /* AAI Pserver Queries */
+ public static void MockGetPserverByVnfId(WireMockServer wireMockServer, String vnfId, String responseFile,
+ int statusCode) {
+ wireMockServer.stubFor(put(urlMatching("/aai/v1[0-9]/query.*")).willReturn(aResponse().withStatus(statusCode)
+ .withHeader("Content-Type", "application/json").withBodyFile(responseFile)));
+ }
+
+ public static void MockGetGenericVnfsByVnfId(WireMockServer wireMockServer, String vnfId, String responseFile,
+ int statusCode) {
+ wireMockServer.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(WireMockServer wireMockServer, String vnfId, int statusCode) {
+ wireMockServer.stubFor(patch(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*"))
+ .willReturn(aResponse().withStatus(statusCode)));
+ }
+
+ public static void MockSetInMaintFlagByVnfId(WireMockServer wireMockServer, String vnfId, String responseFile,
+ int statusCode) {
+ wireMockServer.stubFor(post(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*"))
+ .willReturn(aResponse().withStatus(statusCode).withBodyFile(responseFile)));
+ }
+
+ public static void MockGetDefaultCloudRegionByCloudRegionId(WireMockServer wireMockServer, String cloudRegionId,
+ String responseFile, int statusCode) {
+ wireMockServer.stubFor(get(urlMatching(
+ "/aai/v1[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + 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(WireMockServer wireMockServer) {
+ wireMockServer.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(WireMockServer wireMockServer) {
+ wireMockServer.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(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(
+ put(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123")).willReturn(aResponse().withStatus(200)));
+ }
+
+ @Deprecated
+ public static void MockDeleteVce(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(
+ delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
+ .willReturn(aResponse().withStatus(204)));
+ }
+
+ @Deprecated
+ public static void MockDeleteVce_404(WireMockServer wireMockServer) {
wireMockServer.stubFor(
- get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + vpnBinding + "[?]depth=" + depth))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkPolicy(WireMockServer wireMockServer, String responseFile, String policy) {
- wireMockServer.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(WireMockServer wireMockServer, String networkBindingId, String responseFile, int statusCode) {
- wireMockServer.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(WireMockServer wireMockServer, String networkPolicy, String responseFile, int statusCode) {
- wireMockServer.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(WireMockServer wireMockServer, String responseFile, String tableReference) {
- wireMockServer.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(WireMockServer wireMockServer, String responseFile, String networkId, String depth) {
- wireMockServer.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(WireMockServer wireMockServer, String networkPolicy, String responseFile, int statusCode) {
- wireMockServer.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(WireMockServer wireMockServer, String networkRouteId, String responseFile, int statusCode) {
- wireMockServer.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(WireMockServer wireMockServer, String vnfId, String vfModuleId) {
- wireMockServer.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(WireMockServer wireMockServer) {
- wireMockServer.stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- wireMockServer.stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- wireMockServer.stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- wireMockServer.stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void MockDBUpdateVfModule(WireMockServer wireMockServer){
- wireMockServer.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(WireMockServer wireMockServer) {
- // simplified the implementation to return "success" for all requests
- wireMockServer.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(WireMockServer wireMockServer) {
- wireMockServer.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")));
- wireMockServer.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")));
- wireMockServer.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")));
- wireMockServer.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")));
- wireMockServer.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)));
- wireMockServer.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
- wireMockServer.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
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
- .withRequestBody(containing("MODULELABEL"))
- .willReturn(aResponse()
- .withStatus(200)));
- wireMockServer.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")));
- wireMockServer.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")));
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/MDTWNJ21/volume-groups/volume-group/78987"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/VolumeGroup.xml")));
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/volume-groups/volume-group/78987"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/VolumeGroup.xml")));
- wireMockServer.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")));
- wireMockServer.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")));
- wireMockServer.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(WireMockServer wireMockServer, String cloudRegionId, int statusCode, String responseFile) {
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- /**
- * Volume Group StubResponse below
- */
- public static void MockGetVolumeGroupById(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupId, String responseFile) {
- MockGetVolumeGroupById(wireMockServer, cloudRegionId, volumeGroupId, responseFile, 200);
- }
-
- public static void MockGetVolumeGroupById(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupId, String responseFile, int responseCode) {
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))
- .willReturn(aResponse()
- .withStatus(responseCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPutVolumeGroupById(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupId, String responseFile, int statusCode) {
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetVolumeGroupByName(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupName, String responseFile, int statusCode) {
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockDeleteVolumeGroupById(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupId, String resourceVersion, int statusCode) {
- wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockGetVolumeGroupByName_404(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupName) {
- wireMockServer.stubFor(get(urlMatching("/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockDeleteVolumeGroup(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupId, String resourceVersion) {
- wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- /**
- * VF-Module StubResponse below
- * @param statusCode TODO
- */
- public static void MockGetVfModuleId(WireMockServer wireMockServer, String vnfId, String vfModuleId, String responseFile, int statusCode) {
- wireMockServer.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(WireMockServer wireMockServer, String vnfId, String vfModuleName, int depth, String responseFile, int statusCode) {
- wireMockServer.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(WireMockServer wireMockServer, String vnfId, String vfModuleName, String responseFile, int statusCode) {
- wireMockServer.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(WireMockServer wireMockServer, String vnfId, String requestContaining, String vfModuleId) {
- wireMockServer.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(WireMockServer wireMockServer, String vnfId, String requestContaining, String vfModuleId) {
- wireMockServer.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(WireMockServer wireMockServer, String vnfId, String vfModuleId) {
- wireMockServer.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(WireMockServer wireMockServer, String vnfId, String vfModuleId, int returnCode) {
- wireMockServer.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(WireMockServer wireMockServer, String vnfId, String vfModuleId, String resourceVersion, int returnCode) {
- wireMockServer.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(WireMockServer wireMockServer, String endpoint, int statusCode) {
- wireMockServer.stubFor(patch(urlMatching(endpoint))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- /* AAI Pserver Queries */
- public static void MockGetPserverByVnfId(WireMockServer wireMockServer, String vnfId, String responseFile, int statusCode) {
- wireMockServer.stubFor(put(urlMatching("/aai/v1[0-9]/query.*"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfsByVnfId(WireMockServer wireMockServer, String vnfId, String responseFile, int statusCode) {
- wireMockServer.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(WireMockServer wireMockServer, String vnfId, int statusCode) {
- wireMockServer.stubFor(patch(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- ));
- }
-
- public static void MockSetInMaintFlagByVnfId(WireMockServer wireMockServer, String vnfId, String responseFile, int statusCode) {
- wireMockServer.stubFor(post(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withBodyFile(responseFile)
- ));
- }
-
- public static void MockGetDefaultCloudRegionByCloudRegionId(WireMockServer wireMockServer, String cloudRegionId, String responseFile, int statusCode) {
- wireMockServer.stubFor(get(urlMatching("/aai/v1[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"+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(WireMockServer wireMockServer){
- wireMockServer.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(WireMockServer wireMockServer){
- wireMockServer.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(WireMockServer wireMockServer){
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
- @Deprecated
- public static void MockDeleteVce(WireMockServer wireMockServer){
- wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(204)));
- }
- @Deprecated
- public static void MockDeleteVce_404(WireMockServer wireMockServer){
- wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- @Deprecated
- public static void MockDeleteServiceSubscription(WireMockServer wireMockServer){
- wireMockServer.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(WireMockServer wireMockServer){
- wireMockServer.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(WireMockServer wireMockServer){
- wireMockServer.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(WireMockServer wireMockServer) {
- wireMockServer.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 MockGetGenericVnfById(WireMockServer wireMockServer){
- wireMockServer.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(WireMockServer wireMockServer){
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(404)));
- }
- @Deprecated
- public static void MockGetGenericVnfByName(WireMockServer wireMockServer){
- wireMockServer.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(WireMockServer wireMockServer){
- wireMockServer.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(WireMockServer wireMockServer){
- wireMockServer.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(WireMockServer wireMockServer){
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
- @Deprecated
- public static void MockGetGenericVnfByName_404(WireMockServer wireMockServer){
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
- .willReturn(aResponse()
- .withStatus(404)));
- }
- @Deprecated
- public static void MockPutGenericVnf(WireMockServer wireMockServer){
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
- @Deprecated
- public static void MockPutGenericVnf_400(WireMockServer wireMockServer){
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(400)));
- }
- @Deprecated
- public static void MockDeleteGenericVnf(WireMockServer wireMockServer){
- wireMockServer.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(WireMockServer wireMockServer){
- wireMockServer.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(WireMockServer wireMockServer){
- wireMockServer.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(WireMockServer wireMockServer){
- wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[[?]]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(412)));
- }
+ delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
+ .willReturn(aResponse().withStatus(404)));
+ }
+
+ @Deprecated
+ public static void MockDeleteServiceSubscription(WireMockServer wireMockServer) {
+ wireMockServer.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(WireMockServer wireMockServer) {
+ wireMockServer.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(WireMockServer wireMockServer) {
+ wireMockServer.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(WireMockServer wireMockServer) {
+ wireMockServer.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 MockGetGenericVnfById(WireMockServer wireMockServer) {
+ wireMockServer.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(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
+ .willReturn(aResponse().withStatus(404)));
+ }
+
+ @Deprecated
+ public static void MockGetGenericVnfByName(WireMockServer wireMockServer) {
+ wireMockServer
+ .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(WireMockServer wireMockServer) {
+ wireMockServer
+ .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(WireMockServer wireMockServer) {
+ wireMockServer.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(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
+ .willReturn(aResponse().withStatus(500)));
+ }
+
+ @Deprecated
+ public static void MockGetGenericVnfByName_404(WireMockServer wireMockServer) {
+ wireMockServer
+ .stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
+ .willReturn(aResponse().withStatus(404)));
+ }
+
+ @Deprecated
+ public static void MockPutGenericVnf(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
+ .willReturn(aResponse().withStatus(200)));
+ }
+
+ @Deprecated
+ public static void MockPutGenericVnf_400(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
+ .willReturn(aResponse().withStatus(400)));
+ }
+
+ @Deprecated
+ public static void MockDeleteGenericVnf(WireMockServer wireMockServer) {
+ wireMockServer.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(WireMockServer wireMockServer) {
+ wireMockServer.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(WireMockServer wireMockServer) {
+ wireMockServer.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(WireMockServer wireMockServer) {
+ wireMockServer.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
index 2f2cf45814..53c08a3d6c 100644
--- 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
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.mock;
@@ -24,7 +24,6 @@ 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.urlMatching;
-
import com.github.tomakehurst.wiremock.WireMockServer;
/**
@@ -33,29 +32,25 @@ import com.github.tomakehurst.wiremock.WireMockServer;
*/
public class StubResponseAPPC {
- public static void setupAllMocks() {
-
- }
-
- // start of Policy mocks
- public static void MockAppcError(WireMockServer wireMockServer) {
- wireMockServer.stubFor(get(urlMatching("/events/.*"))
- // .withRequestBody(containing("APPC"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("APPC/appc_error.json")));
- wireMockServer.stubFor(put(urlMatching("/events/.*"))
- // .withRequestBody(containing("APPC"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("APPC/appc_error.json")));
-
-
-
- }
-
-
-
+ public static void setupAllMocks() {
+
+ }
+
+ // start of Policy mocks
+ public static void MockAppcError(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(get(urlMatching("/events/.*"))
+ // .withRequestBody(containing("APPC"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
+ .withBodyFile("APPC/appc_error.json")));
+ wireMockServer.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
index 8fd745d765..241b549101 100644
--- 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
@@ -24,96 +24,79 @@ 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.urlEqualTo;
-
import com.github.tomakehurst.wiremock.WireMockServer;
/**
- * Stub response class for Database stubs
- * including database adapter, catalog db,
- * and other databases.
+ * Stub response class for Database stubs including database adapter, catalog db, and other databases.
*/
public class StubResponseDatabase {
- public static void setupAllMocks() {
+ public static void setupAllMocks() {
+
+ }
+
+ public static void MockUpdateRequestDB(WireMockServer wireMockServer, String fileName) {
+ wireMockServer.stubFor(post(urlEqualTo("/services/RequestsDbAdapter"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBodyFile(fileName)));
+ }
+
+ public static void mockUpdateRequestDB(WireMockServer wireMockServer, int statusCode, String reponseFile) {
+ wireMockServer.stubFor(post(urlEqualTo("/services/RequestsDbAdapter")).willReturn(
+ aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml").withBodyFile(reponseFile)));
+ }
+
+ public static void MockGetAllottedResourcesByModelInvariantId(WireMockServer wireMockServer,
+ String modelInvariantId, String responseFile) {
+ wireMockServer
+ .stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetAllottedResourcesByModelInvariantId_500(WireMockServer wireMockServer,
+ String modelInvariantId, String responseFile) {
+ wireMockServer
+ .stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId))
+ .willReturn(aResponse().withStatus(500)));
+ }
+
+ public static void MockGetVnfCatalogDataCustomizationUuid(WireMockServer wireMockServer,
+ String vnfModelCustomizationUuid, String responseFile) {
+ wireMockServer.stubFor(get(urlEqualTo("/v2/serviceVnfs?vnfModelCustomizationUuid=" + vnfModelCustomizationUuid))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
+ .withBodyFile(responseFile)));
+ }
- }
+ public static void MockGetVfModuleByModelNameCatalogData(WireMockServer wireMockServer, String vfModuleModelName,
+ String responseFile) {
+ wireMockServer.stubFor(get(urlEqualTo("/v2/vfModules?vfModuleModelName=" + vfModuleModelName)).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBodyFile(responseFile)));
+ }
- public static void MockUpdateRequestDB(WireMockServer wireMockServer, String fileName){
- wireMockServer.stubFor(post(urlEqualTo("/services/RequestsDbAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(fileName)));
- }
-
- public static void mockUpdateRequestDB(WireMockServer wireMockServer, int statusCode, String reponseFile) {
- wireMockServer.stubFor(post(urlEqualTo("/services/RequestsDbAdapter"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(reponseFile)));
- }
+ public static void MockGetServiceResourcesCatalogData(WireMockServer wireMockServer,
+ String serviceModelInvariantUuid, String serviceModelVersion, String responseFile) {
+ wireMockServer.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 MockGetAllottedResourcesByModelInvariantId(WireMockServer wireMockServer, String modelInvariantId, String responseFile){
- wireMockServer.stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
+ public static void MockGetServiceResourcesCatalogData(WireMockServer wireMockServer,
+ String serviceModelInvariantUuid, String responseFile) {
+ wireMockServer.stubFor(get(urlEqualTo(
+ "/ecomp/mso/catalog/v2/serviceResources?serviceModelInvariantUuid=" + serviceModelInvariantUuid))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
+ .withBodyFile(responseFile)));
+ }
- public static void MockGetAllottedResourcesByModelInvariantId_500(WireMockServer wireMockServer, String modelInvariantId, String responseFile){
- wireMockServer.stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockGetVnfCatalogDataCustomizationUuid(WireMockServer wireMockServer, String vnfModelCustomizationUuid, String responseFile){
- wireMockServer.stubFor(get(urlEqualTo("/v2/serviceVnfs?vnfModelCustomizationUuid=" + vnfModelCustomizationUuid))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
+ public static void MockGetServiceResourcesCatalogDataByModelUuid(WireMockServer wireMockServer,
+ String serviceModelUuid, String responseFile) {
+ wireMockServer.stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelUuid=" + serviceModelUuid)).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBodyFile(responseFile)));
+ }
- public static void MockGetVfModuleByModelNameCatalogData(WireMockServer wireMockServer, String vfModuleModelName, String responseFile){
- wireMockServer.stubFor(get(urlEqualTo("/v2/vfModules?vfModuleModelName=" + vfModuleModelName))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetServiceResourcesCatalogData(WireMockServer wireMockServer, String serviceModelInvariantUuid, String serviceModelVersion, String responseFile){
- wireMockServer.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(WireMockServer wireMockServer, String serviceModelInvariantUuid, String responseFile){
- wireMockServer.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(WireMockServer wireMockServer, String serviceModelUuid, String responseFile){
- wireMockServer.stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelUuid=" + serviceModelUuid))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPostRequestDB(WireMockServer wireMockServer){
- wireMockServer.stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")));
- }
+ public static void MockPostRequestDB(WireMockServer wireMockServer) {
+ wireMockServer.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
index 3e1567412a..19c1a76f52 100644
--- 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
@@ -26,7 +26,6 @@ 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.urlEqualTo;
-
import com.github.tomakehurst.wiremock.WireMockServer;
/**
@@ -35,82 +34,62 @@ import com.github.tomakehurst.wiremock.WireMockServer;
*/
public class StubResponseNetworkAdapter {
- private static final String EOL = "\n";
-
- public static void setupAllMocks() {
-
- }
-
-
- public static void MockNetworkAdapter(WireMockServer wireMockServer) {
- wireMockServer.stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockNetworkAdapter(WireMockServer wireMockServer, String response) {
- wireMockServer.stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(response)));
- }
-
- public static void MockNetworkAdapter_500(WireMockServer wireMockServer) {
- wireMockServer.stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockNetworkAdapterPost(WireMockServer wireMockServer, String responseFile, String requestContaining) {
- wireMockServer.stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNetworkAdapter(WireMockServer wireMockServer, String networkId, int statusCode, String responseFile) {
- wireMockServer.stubFor(delete(urlEqualTo("/networks/NetworkAdapter/" + networkId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNetworkAdapterContainingRequest(WireMockServer wireMockServer, String requestContaining, int statusCode, String responseFile) {
- wireMockServer.stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPutNetworkAdapter(WireMockServer wireMockServer, String networkId, String requestContaining, int statusCode, String responseFile) {
- wireMockServer.stubFor(put(urlEqualTo("/networks/NetworkAdapter/" + networkId))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNetworkAdapterRestRollbackDelete(WireMockServer wireMockServer, String responseFile, String networkId) {
- wireMockServer.stubFor(delete(urlEqualTo("/networks/NetworkAdapter/"+networkId+"/rollback"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNetworkAdapterRestPut(WireMockServer wireMockServer, String responseFile, String networkId) {
- wireMockServer.stubFor(put(urlEqualTo("/networks/NetworkAdapter/"+networkId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
+ private static final String EOL = "\n";
+
+ public static void setupAllMocks() {
+
+ }
+
+
+ public static void MockNetworkAdapter(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(post(urlEqualTo("/networks/NetworkAdapter")).willReturn(aResponse().withStatus(200)));
+ }
+
+ public static void MockNetworkAdapter(WireMockServer wireMockServer, String response) {
+ wireMockServer.stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBodyFile(response)));
+ }
+
+ public static void MockNetworkAdapter_500(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(post(urlEqualTo("/networks/NetworkAdapter")).willReturn(aResponse().withStatus(500)));
+ }
+
+ public static void MockNetworkAdapterPost(WireMockServer wireMockServer, String responseFile,
+ String requestContaining) {
+ wireMockServer.stubFor(
+ post(urlEqualTo("/networks/NetworkAdapter")).withRequestBody(containing(requestContaining)).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
+ }
+
+ public static void MockNetworkAdapter(WireMockServer wireMockServer, String networkId, int statusCode,
+ String responseFile) {
+ wireMockServer.stubFor(delete(urlEqualTo("/networks/NetworkAdapter/" + networkId)).willReturn(aResponse()
+ .withStatus(statusCode).withHeader("Content-Type", "application/xml").withBodyFile(responseFile)));
+ }
+
+ public static void MockNetworkAdapterContainingRequest(WireMockServer wireMockServer, String requestContaining,
+ int statusCode, String responseFile) {
+ wireMockServer.stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
+ .withRequestBody(containing(requestContaining)).willReturn(aResponse().withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
+ }
+
+ public static void MockPutNetworkAdapter(WireMockServer wireMockServer, String networkId, String requestContaining,
+ int statusCode, String responseFile) {
+ wireMockServer.stubFor(put(urlEqualTo("/networks/NetworkAdapter/" + networkId))
+ .withRequestBody(containing(requestContaining)).willReturn(aResponse().withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
+ }
+
+ public static void MockNetworkAdapterRestRollbackDelete(WireMockServer wireMockServer, String responseFile,
+ String networkId) {
+ wireMockServer.stubFor(delete(urlEqualTo("/networks/NetworkAdapter/" + networkId + "/rollback")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
+ }
+
+ public static void MockNetworkAdapterRestPut(WireMockServer wireMockServer, String responseFile, String networkId) {
+ wireMockServer.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
index fe6c6a1396..aab2d38b35 100644
--- 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
@@ -23,7 +23,6 @@ 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.urlEqualTo;
-
import com.github.tomakehurst.wiremock.WireMockServer;
/**
@@ -37,31 +36,22 @@ public class StubResponseOof {
public static void mockOof(WireMockServer wireMockServer) {
wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")));
+ .willReturn(aResponse().withStatus(202).withHeader("Content-Type", "application/json")));
}
public static void mockOof(WireMockServer wireMockServer, String responseFile) {
- wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
+ wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")).willReturn(
+ aResponse().withStatus(202).withHeader("Content-Type", "application/json").withBodyFile(responseFile)));
}
public static void mockOof_400(WireMockServer wireMockServer) {
wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement"))
- .willReturn(aResponse()
- .withStatus(400)
- .withHeader("Content-Type", "application/json")));
+ .willReturn(aResponse().withStatus(400).withHeader("Content-Type", "application/json")));
}
public static void mockOof_500(WireMockServer wireMockServer) {
wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "application/json")));
+ .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
index a6c7fa57f0..bf3df503f3 100644
--- 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
@@ -24,7 +24,6 @@ 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.urlEqualTo;
-
import com.github.tomakehurst.wiremock.WireMockServer;
/**
@@ -33,89 +32,59 @@ import com.github.tomakehurst.wiremock.WireMockServer;
*/
public class StubResponsePolicy {
- public static void setupAllMocks() {
-
- }
-
- // start of Policy mocks
- public static void MockPolicyAbort(WireMockServer wireMockServer) {
- wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("BB1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("policyAbortResponse.json")));
-
- wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("UPDVnfI"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("policyAbortResponse.json")));
-
- wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("RPLVnfI"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("policyAbortResponse.json")));
-
- wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("VnfIPU"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("policyAbortResponse.json")));
-
- wireMockServer.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(WireMockServer wireMockServer) {
- wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("BB1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("Policy/policySkipResponse.json")));
-
- wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("UPDVnfI"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("Policy/policySkipResponse.json")));
-
- wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("RPLVnfI"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("Policy/policySkipResponse.json")));
-
- wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("VnfIPU"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("Policy/policySkipResponse.json")));
-
- wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("VnfCU"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("Policy/policySkipResponse.json")));
-
-
- }
-
-
+ public static void setupAllMocks() {
+
+ }
+
+ // start of Policy mocks
+ public static void MockPolicyAbort(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")).withRequestBody(containing("BB1"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
+ .withBodyFile("policyAbortResponse.json")));
+
+ wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")).withRequestBody(containing("UPDVnfI"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
+ .withBodyFile("policyAbortResponse.json")));
+
+ wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")).withRequestBody(containing("RPLVnfI"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
+ .withBodyFile("policyAbortResponse.json")));
+
+ wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")).withRequestBody(containing("VnfIPU"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
+ .withBodyFile("policyAbortResponse.json")));
+
+ wireMockServer.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(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")).withRequestBody(containing("BB1"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
+ .withBodyFile("Policy/policySkipResponse.json")));
+
+ wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")).withRequestBody(containing("UPDVnfI"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
+ .withBodyFile("Policy/policySkipResponse.json")));
+
+ wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")).withRequestBody(containing("RPLVnfI"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
+ .withBodyFile("Policy/policySkipResponse.json")));
+
+ wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")).withRequestBody(containing("VnfIPU"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
+ .withBodyFile("Policy/policySkipResponse.json")));
+
+ wireMockServer.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
index 10557ce091..9196e6a58c 100644
--- 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
@@ -25,7 +25,6 @@ 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.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-
import com.github.tomakehurst.wiremock.WireMockServer;
/**
@@ -33,82 +32,60 @@ import com.github.tomakehurst.wiremock.WireMockServer;
*/
public class StubResponseSDNCAdapter {
- public static void setupAllMocks() {
-
- }
-
- public static void mockSDNCAdapter_500(WireMockServer wireMockServer) {
- wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void mockSDNCAdapter_500(WireMockServer wireMockServer, String requestContaining) {
- wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void mockSDNCAdapter(WireMockServer wireMockServer, int statusCode) {
- wireMockServer.stubFor(post(urlMatching(".*/SDNCAdapter"))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void mockSDNCAdapter(WireMockServer wireMockServer, String endpoint, int statusCode, String responseFile) {
- wireMockServer.stubFor(post(urlEqualTo(endpoint))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void mockSDNCAdapter(WireMockServer wireMockServer, String responseFile) {
- wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void mockSDNCAdapter(WireMockServer wireMockServer, String endpoint, String requestContaining, int statusCode, String responseFile) {
- wireMockServer.stubFor(post(urlEqualTo(endpoint))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void mockSDNCAdapterRest(WireMockServer wireMockServer) {
- wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")));
- }
-
- public static void mockSDNCAdapterRest_500(WireMockServer wireMockServer) {
- wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "application/json")));
- }
-
- public static void mockSDNCAdapterRest(WireMockServer wireMockServer, String requestContaining) {
- wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")));
- }
-
- public static void mockSDNCAdapterRest_500(WireMockServer wireMockServer, String requestContaining) {
- wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "application/json")));
- }
+ public static void setupAllMocks() {
+
+ }
+
+ public static void mockSDNCAdapter_500(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter")).willReturn(aResponse().withStatus(500)));
+ }
+
+ public static void mockSDNCAdapter_500(WireMockServer wireMockServer, String requestContaining) {
+ wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter")).withRequestBody(containing(requestContaining))
+ .willReturn(aResponse().withStatus(500)));
+ }
+
+ public static void mockSDNCAdapter(WireMockServer wireMockServer, int statusCode) {
+ wireMockServer.stubFor(post(urlMatching(".*/SDNCAdapter")).willReturn(aResponse().withStatus(statusCode)));
+ }
+
+ public static void mockSDNCAdapter(WireMockServer wireMockServer, String endpoint, int statusCode,
+ String responseFile) {
+ wireMockServer.stubFor(post(urlEqualTo(endpoint)).willReturn(
+ aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
+ }
+
+ public static void mockSDNCAdapter(WireMockServer wireMockServer, String responseFile) {
+ wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
+ }
+
+ public static void mockSDNCAdapter(WireMockServer wireMockServer, String endpoint, String requestContaining,
+ int statusCode, String responseFile) {
+ wireMockServer.stubFor(post(urlEqualTo(endpoint)).withRequestBody(containing(requestContaining)).willReturn(
+ aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
+ }
+
+ public static void mockSDNCAdapterRest(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
+ .willReturn(aResponse().withStatus(202).withHeader("Content-Type", "application/json")));
+ }
+
+ public static void mockSDNCAdapterRest_500(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
+ .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "application/json")));
+ }
+
+ public static void mockSDNCAdapterRest(WireMockServer wireMockServer, String requestContaining) {
+ wireMockServer.stubFor(
+ post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")).withRequestBody(containing(requestContaining))
+ .willReturn(aResponse().withStatus(202).withHeader("Content-Type", "application/json")));
+ }
+
+ public static void mockSDNCAdapterRest_500(WireMockServer wireMockServer, String requestContaining) {
+ wireMockServer.stubFor(
+ post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")).withRequestBody(containing(requestContaining))
+ .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "application/json")));
+ }
}
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
index f040a0973c..e0ebf7d356 100644
--- 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
@@ -23,7 +23,6 @@ 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.urlEqualTo;
-
import com.github.tomakehurst.wiremock.WireMockServer;
/**
@@ -32,37 +31,28 @@ import com.github.tomakehurst.wiremock.WireMockServer;
*/
public class StubResponseSNIRO {
- public static void setupAllMocks() {
+ public static void setupAllMocks() {
- }
+ }
- public static void mockSNIRO(WireMockServer wireMockServer) {
- wireMockServer.stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")));
- }
+ public static void mockSNIRO(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
+ .willReturn(aResponse().withStatus(202).withHeader("Content-Type", "application/json")));
+ }
- public static void mockSNIRO(WireMockServer wireMockServer, String responseFile) {
- wireMockServer.stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
+ public static void mockSNIRO(WireMockServer wireMockServer, String responseFile) {
+ wireMockServer.stubFor(post(urlEqualTo("/sniro/api/v2/placement")).willReturn(
+ aResponse().withStatus(202).withHeader("Content-Type", "application/json").withBodyFile(responseFile)));
+ }
- public static void mockSNIRO_400(WireMockServer wireMockServer) {
- wireMockServer.stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
- .willReturn(aResponse()
- .withStatus(400)
- .withHeader("Content-Type", "application/json")));
- }
+ public static void mockSNIRO_400(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
+ .willReturn(aResponse().withStatus(400).withHeader("Content-Type", "application/json")));
+ }
- public static void mockSNIRO_500(WireMockServer wireMockServer) {
- wireMockServer.stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "application/json")));
- }
+ public static void mockSNIRO_500(WireMockServer wireMockServer) {
+ wireMockServer.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
index e90d358ba8..2501a8acd3 100644
--- 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
@@ -26,7 +26,6 @@ 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.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-
import com.github.tomakehurst.wiremock.WireMockServer;
/**
@@ -34,150 +33,101 @@ import com.github.tomakehurst.wiremock.WireMockServer;
*/
public class StubResponseVNFAdapter {
- public static void mockVNFAdapter(WireMockServer wireMockServer) {
- wireMockServer.stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void mockVNFAdapter(WireMockServer wireMockServer, String responseFile) {
- wireMockServer.stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void mockVNFAdapter_500(WireMockServer wireMockServer) {
- wireMockServer.stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void mockVNFPost(WireMockServer wireMockServer, String vfModuleId, int statusCode, String vnfId) {
- wireMockServer.stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- wireMockServer.stubFor(post(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockVNFPut(WireMockServer wireMockServer, String vfModuleId, int statusCode) {
- wireMockServer.stubFor(put(urlEqualTo("/services/rest/v1/vnfsvnfId/vf-modules" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- wireMockServer.stubFor(put(urlEqualTo("/services/rest/v1/vnfs/vnfId/vf-modules" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockVNFPut(WireMockServer wireMockServer, String vnfId, String vfModuleId, int statusCode) {
- wireMockServer.stubFor(put(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- wireMockServer.stubFor(put(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockVNFDelete(WireMockServer wireMockServer, String vnfId, String vfModuleId, int statusCode) {
- wireMockServer.stubFor(delete(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- wireMockServer.stubFor(delete(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockVNFRollbackDelete(WireMockServer wireMockServer, String vfModuleId, int statusCode) {
- wireMockServer.stubFor(delete(urlEqualTo("/services/rest/v1/vnfsvnfId/vf-modules" + vfModuleId + "/rollback"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- wireMockServer.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(WireMockServer wireMockServer, String volumeGroupId, int statusCode) {
- wireMockServer.stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/" + volumeGroupId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- wireMockServer.stubFor(put(urlEqualTo("/vnfs/rest/v1/volume-groups/" + volumeGroupId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockPutVNFVolumeGroupRollback(WireMockServer wireMockServer, String volumeGroupId, int statusCode) {
- wireMockServer.stubFor(delete(urlMatching("/vnfs/v1/volume-groups/" + volumeGroupId + "/rollback"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- wireMockServer.stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/" + volumeGroupId + "/rollback"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
- public static void mockPostVNFVolumeGroup(WireMockServer wireMockServer, int statusCode) {
- wireMockServer.stubFor(post(urlEqualTo("/vnfs/v1/volume-groups"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- wireMockServer.stubFor(post(urlEqualTo("/vnfs/rest/v1/volume-groups"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockVNFAdapterRest(WireMockServer wireMockServer, String vnfId) {
- wireMockServer.stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules"))
- .willReturn(aResponse()
- .withStatus(200)));
- wireMockServer.stubFor(post(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void mockVNFAdapterRest_500(WireMockServer wireMockServer, String vnfId) {
- wireMockServer.stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules"))
- .willReturn(aResponse()
- .withStatus(500)));
- wireMockServer.stubFor(post(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void mockVfModuleDelete(WireMockServer wireMockServer, String volumeGroupId) {
- wireMockServer.stubFor(delete(urlMatching("/vnfs/v1/volume-groups/"+ volumeGroupId))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- wireMockServer.stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/"+ volumeGroupId))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockVfModuleDelete(WireMockServer wireMockServer, String volumeGroupId, int statusCode) {
- wireMockServer.stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- wireMockServer.stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
+ public static void mockVNFAdapter(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")).willReturn(aResponse().withStatus(200)));
+ }
+
+ public static void mockVNFAdapter(WireMockServer wireMockServer, String responseFile) {
+ wireMockServer.stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
+ }
+
+ public static void mockVNFAdapter_500(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")).willReturn(aResponse().withStatus(500)));
+ }
+
+ public static void mockVNFPost(WireMockServer wireMockServer, String vfModuleId, int statusCode, String vnfId) {
+ wireMockServer.stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId))
+ .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "application/xml")));
+ wireMockServer.stubFor(post(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
+ .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void mockVNFPut(WireMockServer wireMockServer, String vfModuleId, int statusCode) {
+ wireMockServer.stubFor(put(urlEqualTo("/services/rest/v1/vnfsvnfId/vf-modules" + vfModuleId))
+ .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "application/xml")));
+ wireMockServer.stubFor(put(urlEqualTo("/services/rest/v1/vnfs/vnfId/vf-modules" + vfModuleId))
+ .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void mockVNFPut(WireMockServer wireMockServer, String vnfId, String vfModuleId, int statusCode) {
+ wireMockServer.stubFor(put(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId))
+ .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "application/xml")));
+ wireMockServer.stubFor(put(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
+ .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void mockVNFDelete(WireMockServer wireMockServer, String vnfId, String vfModuleId, int statusCode) {
+ wireMockServer.stubFor(delete(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId))
+ .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "application/xml")));
+ wireMockServer.stubFor(delete(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
+ .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void mockVNFRollbackDelete(WireMockServer wireMockServer, String vfModuleId, int statusCode) {
+ wireMockServer.stubFor(delete(urlEqualTo("/services/rest/v1/vnfsvnfId/vf-modules" + vfModuleId + "/rollback"))
+ .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "application/xml")));
+ wireMockServer.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(WireMockServer wireMockServer, String volumeGroupId, int statusCode) {
+ wireMockServer.stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/" + volumeGroupId))
+ .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "application/xml")));
+ wireMockServer.stubFor(put(urlEqualTo("/vnfs/rest/v1/volume-groups/" + volumeGroupId))
+ .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void mockPutVNFVolumeGroupRollback(WireMockServer wireMockServer, String volumeGroupId,
+ int statusCode) {
+ wireMockServer.stubFor(delete(urlMatching("/vnfs/v1/volume-groups/" + volumeGroupId + "/rollback"))
+ .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "application/xml")));
+ wireMockServer.stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/" + volumeGroupId + "/rollback"))
+ .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void mockPostVNFVolumeGroup(WireMockServer wireMockServer, int statusCode) {
+ wireMockServer.stubFor(post(urlEqualTo("/vnfs/v1/volume-groups"))
+ .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "application/xml")));
+ wireMockServer.stubFor(post(urlEqualTo("/vnfs/rest/v1/volume-groups"))
+ .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void mockVNFAdapterRest(WireMockServer wireMockServer, String vnfId) {
+ wireMockServer.stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules"))
+ .willReturn(aResponse().withStatus(200)));
+ wireMockServer.stubFor(post(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules"))
+ .willReturn(aResponse().withStatus(200)));
+ }
+
+ public static void mockVNFAdapterRest_500(WireMockServer wireMockServer, String vnfId) {
+ wireMockServer.stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules"))
+ .willReturn(aResponse().withStatus(500)));
+ wireMockServer.stubFor(post(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules"))
+ .willReturn(aResponse().withStatus(500)));
+ }
+
+ public static void mockVfModuleDelete(WireMockServer wireMockServer, String volumeGroupId) {
+ wireMockServer.stubFor(delete(urlMatching("/vnfs/v1/volume-groups/" + volumeGroupId))
+ .willReturn(aResponse().withStatus(202).withHeader("Content-Type", "application/xml")));
+ wireMockServer.stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/" + volumeGroupId))
+ .willReturn(aResponse().withStatus(202).withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void mockVfModuleDelete(WireMockServer wireMockServer, String volumeGroupId, int statusCode) {
+ wireMockServer.stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
+ .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "application/xml")));
+ wireMockServer.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/servicedecomposition/BBDecompPojoTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBDecompPojoTest.java
index a72db062aa..7498044c53 100644
--- 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
@@ -32,24 +32,22 @@ import org.onap.so.openpojo.rules.HasEqualsAndHashCodeRule;
public class BBDecompPojoTest {
- private PojoClassFilter filterTestClasses = new FilterTestClasses();
+ private PojoClassFilter filterTestClasses = new FilterTestClasses();
- @Test
- public void pojoStructure() {
- test("org.onap.so.bpmn.servicedecomposition.bbobjects");
- }
+ @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 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/");
- }
- }
+ 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
index eac6c0a8b7..d7c5ec9d55 100644
--- 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
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.servicedecomposition;
import org.junit.Test;
-
import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.PojoClassFilter;
import com.openpojo.reflection.filters.FilterNonConcrete;
@@ -36,31 +35,27 @@ import com.openpojo.validation.test.impl.SetterTester;
public class BBPojoTest {
- 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 NoPrimitivesRule())
- .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/");
- }
- }
+ 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 NoPrimitivesRule())
+ .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/");
+ }
+ }
}
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
index 5de0903d65..8ab2c8e155 100644
--- 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
@@ -21,10 +21,8 @@
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;
@@ -39,191 +37,194 @@ import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.BaseTest;
-public class ExtractPojosForBBTest extends BaseTest{
- ExtractPojosForBB extractPojos = new ExtractPojosForBB();
- private BuildingBlockExecution execution;
- private GeneralBuildingBlock gBBInput;
- private HashMap<ResourceKey, String> 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<GenericVnf> vnfsPend = serviceInstancePend.getVnfs();
- GenericVnf vnfPend = new GenericVnf();
- vnfPend.setVnfId("abc");
- lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfPend.getVnfId());
-
- List<VfModule> 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<L3Network> networksPend = serviceInstancePend.getNetworks();
- L3Network networkPend = new L3Network();
- networkPend.setNetworkId("abc");
- networksPend.add(networkPend);
- lookupKeyMap.put(ResourceKey.NETWORK_ID, networkPend.getNetworkId());
-
- List<VolumeGroup> 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<AllottedResource> 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());
-
- List<InstanceGroup> instanceGroupsPend = serviceInstancePend.getInstanceGroups();
- InstanceGroup instanceGroupPend = new InstanceGroup();
- instanceGroupPend.setId("test-instance-group-1");
- instanceGroupsPend.add(instanceGroupPend);
- lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, instanceGroupPend.getId());
-
- customer.getServiceSubscription().getServiceInstances().add(serviceInstancePend);
- gBBInput.setCustomer(customer);
-
- ServiceInstance extractServPend = extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- assertEquals(extractServPend.getServiceInstanceId(), serviceInstancePend.getServiceInstanceId());
- GenericVnf extractVnfPend = extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- assertEquals(extractVnfPend.getVnfId(), vnfPend.getVnfId());
- L3Network extractNetworkPend = extractPojos.extractByKey(execution, ResourceKey.NETWORK_ID);
- assertEquals(extractNetworkPend.getNetworkId(), networkPend.getNetworkId());
- VolumeGroup extractVolumeGroupPend = extractPojos.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- assertEquals(extractVolumeGroupPend.getVolumeGroupId(), volumeGroupPend.getVolumeGroupId());
- AllottedResource extractallotedResourcePend = extractPojos.extractByKey(execution,
- ResourceKey.ALLOTTED_RESOURCE_ID);
- assertEquals(extractallotedResourcePend.getId(), allotedResourcePend.getId());
- Configuration extractConfigurationPend = extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
- assertEquals(extractConfigurationPend.getConfigurationId(), configurationPend.getConfigurationId());
- VpnBinding extractVpnBinding = extractPojos.extractByKey(execution, ResourceKey.VPN_ID);
- assertEquals(extractVpnBinding.getVpnId(), vpnBinding.getVpnId());
-
- VfModule extractVfModulePend = extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- assertEquals(extractVfModulePend.getVfModuleId(), vfModulePend.getVfModuleId());
-
- VpnBondingLink extractVpnBondingLinkPend = extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID);
- assertEquals(extractVpnBondingLinkPend.getVpnBondingLinkId(), vpnBondingLinkPend.getVpnBondingLinkId());
-
- InstanceGroup extractInstanceGroupPend = extractPojos.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
- assertEquals(instanceGroupPend.getId(), extractInstanceGroupPend.getId());
- }
-
- @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);
- }
-
- @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);
- }
-
- @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);
- }
-
- @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);
- }
- @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);
- }
- @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);
- }
-
- @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);
- }
+public class ExtractPojosForBBTest extends BaseTest {
+ ExtractPojosForBB extractPojos = new ExtractPojosForBB();
+ private BuildingBlockExecution execution;
+ private GeneralBuildingBlock gBBInput;
+ private HashMap<ResourceKey, String> 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<GenericVnf> vnfsPend = serviceInstancePend.getVnfs();
+ GenericVnf vnfPend = new GenericVnf();
+ vnfPend.setVnfId("abc");
+ lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfPend.getVnfId());
+
+ List<VfModule> 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<L3Network> networksPend = serviceInstancePend.getNetworks();
+ L3Network networkPend = new L3Network();
+ networkPend.setNetworkId("abc");
+ networksPend.add(networkPend);
+ lookupKeyMap.put(ResourceKey.NETWORK_ID, networkPend.getNetworkId());
+
+ List<VolumeGroup> 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<AllottedResource> 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());
+
+ List<InstanceGroup> instanceGroupsPend = serviceInstancePend.getInstanceGroups();
+ InstanceGroup instanceGroupPend = new InstanceGroup();
+ instanceGroupPend.setId("test-instance-group-1");
+ instanceGroupsPend.add(instanceGroupPend);
+ lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, instanceGroupPend.getId());
+
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstancePend);
+ gBBInput.setCustomer(customer);
+
+ ServiceInstance extractServPend = extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ assertEquals(extractServPend.getServiceInstanceId(), serviceInstancePend.getServiceInstanceId());
+ GenericVnf extractVnfPend = extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ assertEquals(extractVnfPend.getVnfId(), vnfPend.getVnfId());
+ L3Network extractNetworkPend = extractPojos.extractByKey(execution, ResourceKey.NETWORK_ID);
+ assertEquals(extractNetworkPend.getNetworkId(), networkPend.getNetworkId());
+ VolumeGroup extractVolumeGroupPend = extractPojos.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+ assertEquals(extractVolumeGroupPend.getVolumeGroupId(), volumeGroupPend.getVolumeGroupId());
+ AllottedResource extractallotedResourcePend =
+ extractPojos.extractByKey(execution, ResourceKey.ALLOTTED_RESOURCE_ID);
+ assertEquals(extractallotedResourcePend.getId(), allotedResourcePend.getId());
+ Configuration extractConfigurationPend = extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
+ assertEquals(extractConfigurationPend.getConfigurationId(), configurationPend.getConfigurationId());
+ VpnBinding extractVpnBinding = extractPojos.extractByKey(execution, ResourceKey.VPN_ID);
+ assertEquals(extractVpnBinding.getVpnId(), vpnBinding.getVpnId());
+
+ VfModule extractVfModulePend = extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ assertEquals(extractVfModulePend.getVfModuleId(), vfModulePend.getVfModuleId());
+
+ VpnBondingLink extractVpnBondingLinkPend =
+ extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID);
+ assertEquals(extractVpnBondingLinkPend.getVpnBondingLinkId(), vpnBondingLinkPend.getVpnBondingLinkId());
+
+ InstanceGroup extractInstanceGroupPend = extractPojos.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
+ assertEquals(instanceGroupPend.getId(), extractInstanceGroupPend.getId());
+ }
+
+ @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);
+ }
+
+ @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);
+ }
+
+ @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);
+ }
+
+ @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);
+ }
+
+ @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);
+ }
+
+ @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);
+ }
+
+ @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);
+ }
}
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
index cfafe1622b..b970b95b97 100644
--- 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
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.servicedecomposition;
import static org.junit.Assert.assertEquals;
-
import java.io.ByteArrayOutputStream;
import java.io.Externalizable;
import java.io.File;
@@ -31,7 +30,6 @@ 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;
@@ -41,50 +39,44 @@ 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<ResourceKey, String> 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)
- {
+
+ 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<ResourceKey, String> 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))
- {
+ if (implementsInterface(o)) {
retVal = attemptToSerialize(o);
- }
- else
- {
+ } else {
retVal = false;
}
return (retVal);
}
- private static boolean implementsInterface(final Object o)
- {
+ private static boolean implementsInterface(final Object o) {
final boolean retVal;
retVal = ((o instanceof Serializable) || (o instanceof Externalizable));
@@ -92,34 +84,24 @@ public class SerializationTest {
return (retVal);
}
- private static boolean attemptToSerialize(final Object o)
- {
+ private static boolean attemptToSerialize(final Object o) {
final OutputStream sink;
ObjectOutputStream stream;
stream = null;
- try
- {
- sink = new ByteArrayOutputStream();
+ try {
+ sink = new ByteArrayOutputStream();
stream = new ObjectOutputStream(sink);
stream.writeObject(o);
// could also re-serilalize at this point too
- }
- catch(final IOException ex)
- {
+ } catch (final IOException ex) {
return (false);
- }
- finally
- {
- if(stream != null)
- {
- try
- {
+ } finally {
+ if (stream != null) {
+ try {
stream.close();
- }
- catch(final IOException ex)
- {
+ } catch (final IOException ex) {
// should not be able to happen
}
}
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
index 9d34a95e79..958eb069b8 100644
--- 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
@@ -21,47 +21,48 @@
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());
- }
+ 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
index 9ac148f5bd..e7afa9ec8b 100644
--- 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
@@ -26,7 +26,6 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -34,7 +33,6 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import org.junit.Test;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
@@ -81,647 +79,665 @@ import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.VnfcCustomization;
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 {
-
- 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<String> 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<ResourceKey, String> 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(true);
-
- 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("test-owner-name");
- 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("test-owner-name");
- cloudRegion.setCloudRegionId("cloudRegionId");
- cloudRegion.setComplexName("complexName");
-
- CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion);
-
- assertThat(actual, sameBeanAs(expected));
- }
-
- @Test
- public void testMapCloudRegion() {
- CloudRegion expected = new CloudRegion();
- expected.setCloudOwner("test-owner-name");
- 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("test-owner-name");
- cloudRegion.setCloudRegionId("cloudRegionId");
- cloudRegion.setCloudRegionVersion("cloudRegionVersion");
-
- CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion);
-
- assertThat(actual, sameBeanAs(expected));
- }
-
- @Test
- public void testMapTenant() {
- Tenant expected = new Tenant();
- expected.setTenantId("tenantId");
- expected.setTenantName("tenantName");
- expected.setTenantContext("tenantContext");
-
- org.onap.aai.domain.yang.Tenant aaiTenant = new org.onap.aai.domain.yang.Tenant();
- aaiTenant.setTenantId("tenantId");
- aaiTenant.setTenantName("tenantName");
- aaiTenant.setTenantContext("tenantContext");
-
- Tenant actual = bbInputSetupMapperLayer.mapTenant(aaiTenant);
-
- assertThat(actual, sameBeanAs(expected));
- }
-
- @Test
- public void testMapCloudRegionWithNullCheck() {
- CloudRegion expected = new CloudRegion();
-
- CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(null, null);
-
- assertThat(actual, sameBeanAs(expected));
- }
-
- @Test
- public void testmapCatalogConfigurationToConfiguration() {
- String modelCustUUID = "modelCustomizationUUID";
- String modelInvariantUUID = "modelInvariantUUID";
- String modelVersionUUID = "modelUUID";
- String policyName = "policyName";
- ModelInfoConfiguration expected = new ModelInfoConfiguration();
- expected.setModelCustomizationId(modelCustUUID);
- expected.setModelInvariantId(modelInvariantUUID);
- expected.setModelVersionId(modelVersionUUID);
- expected.setPolicyName(policyName);
- ConfigurationResourceCustomization configurationResourceCustomization = new ConfigurationResourceCustomization();
- configurationResourceCustomization.setModelCustomizationUUID(modelCustUUID);
- configurationResourceCustomization.setConfigurationResource(new ConfigurationResource());
- configurationResourceCustomization.getConfigurationResource().setModelInvariantUUID(modelInvariantUUID);
- configurationResourceCustomization.getConfigurationResource().setModelUUID(modelVersionUUID);
- CvnfcConfigurationCustomization policyNameTable = new CvnfcConfigurationCustomization();
- policyNameTable.setCvnfcCustomization(new CvnfcCustomization());
- policyNameTable.getCvnfcCustomization().setVnfcCustomization(new VnfcCustomization());
- policyNameTable.setPolicyName(policyName);
-
- ModelInfoConfiguration actual = bbInputSetupMapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization, policyNameTable);
-
- assertThat(actual, sameBeanAs(expected));
- }
-
- @Test
- public void testmapCatalogConfigurationToFabricConfiguration() {
- String modelCustUUID = "modelCustomizationUUID";
- String modelInvariantUUID = "modelInvariantUUID";
- String modelVersionUUID = "modelUUID";
- String policyName = "policyName";
- ModelInfoConfiguration expected = new ModelInfoConfiguration();
- expected.setModelCustomizationId(modelCustUUID);
- expected.setModelInvariantId(modelInvariantUUID);
- expected.setModelVersionId(modelVersionUUID);
- expected.setPolicyName(policyName);
-
- CvnfcConfigurationCustomization fabricCustomization = new CvnfcConfigurationCustomization();
- fabricCustomization.setCvnfcCustomization(new CvnfcCustomization());
- fabricCustomization.getCvnfcCustomization().setVnfcCustomization(new VnfcCustomization());
- fabricCustomization.setPolicyName(policyName);
- fabricCustomization.setModelCustomizationUUID(modelCustUUID);
-
- ConfigurationResource configurationResource = new ConfigurationResource();
- configurationResource.setModelUUID(modelVersionUUID);
- configurationResource.setModelInvariantUUID(modelInvariantUUID);
- fabricCustomization.setConfigurationResource(configurationResource);
-
- ModelInfoConfiguration actual = bbInputSetupMapperLayer.mapCatalogConfigurationToConfiguration(fabricCustomization);
-
- assertThat(actual, sameBeanAs(expected));
- }
-
- @Test
- public void testMapNameValueUserParams() throws IOException {
- RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class);
- Map<String,Object> actual = bbInputSetupMapperLayer.mapNameValueUserParams(requestDetails.getRequestParameters());
-
- assertTrue(actual.containsKey("mns_vfw_protected_route_prefixes"));
- assertTrue(actual.get("mns_vfw_protected_route_prefixes").toString().contains("interface_route_table_routes_route"));
- assertTrue(actual.get("mns_vfw_protected_route_prefixes").toString().contains("1.1.1.1/32"));
- assertTrue(actual.get("mns_vfw_protected_route_prefixes").toString().contains("0::1/128"));
- assertTrue(actual.containsKey("name1"));
- assertTrue(actual.containsValue("value1"));
- assertTrue(actual.get("name1").equals("value1"));
-
- assertFalse(actual.containsKey("ignore"));
- assertFalse(actual.containsValue("ignore"));
- }
-
- @Test
- public void testMapRequestParameters() throws IOException {
- RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class);
- RequestParameters actual = bbInputSetupMapperLayer.mapRequestParameters(requestDetails.getRequestParameters());
-
- assertEquals(actual.getUsePreload(), requestDetails.getRequestParameters().getUsePreload());
- assertEquals(actual.getSubscriptionServiceType(), requestDetails.getRequestParameters().getSubscriptionServiceType());
- assertEquals(actual.getPayload(), requestDetails.getRequestParameters().getPayload());
- }
-
- protected RequestParameters mapRequestParameters(org.onap.so.serviceinstancebeans.RequestParameters requestParameters) {
- RequestParameters requestParams = new RequestParameters();
- requestParams.setaLaCarte(requestParameters.getALaCarte());
- requestParams.setUsePreload(requestParameters.getUsePreload());
- requestParams.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType());
- requestParams.setUserParams(requestParameters.getUserParams());
- requestParams.setPayload(requestParameters.getPayload());
- return requestParams;
- }
-
+
+ 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<String> 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<ResourceKey, String> 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(true);
+
+ 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("test-owner-name");
+ 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("test-owner-name");
+ cloudRegion.setCloudRegionId("cloudRegionId");
+ cloudRegion.setComplexName("complexName");
+
+ CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void testMapCloudRegion() {
+ CloudRegion expected = new CloudRegion();
+ expected.setCloudOwner("test-owner-name");
+ 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("test-owner-name");
+ cloudRegion.setCloudRegionId("cloudRegionId");
+ cloudRegion.setCloudRegionVersion("cloudRegionVersion");
+
+ CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void testMapTenant() {
+ Tenant expected = new Tenant();
+ expected.setTenantId("tenantId");
+ expected.setTenantName("tenantName");
+ expected.setTenantContext("tenantContext");
+
+ org.onap.aai.domain.yang.Tenant aaiTenant = new org.onap.aai.domain.yang.Tenant();
+ aaiTenant.setTenantId("tenantId");
+ aaiTenant.setTenantName("tenantName");
+ aaiTenant.setTenantContext("tenantContext");
+
+ Tenant actual = bbInputSetupMapperLayer.mapTenant(aaiTenant);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void testMapCloudRegionWithNullCheck() {
+ CloudRegion expected = new CloudRegion();
+
+ CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(null, null);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void testmapCatalogConfigurationToConfiguration() {
+ String modelCustUUID = "modelCustomizationUUID";
+ String modelInvariantUUID = "modelInvariantUUID";
+ String modelVersionUUID = "modelUUID";
+ String policyName = "policyName";
+ ModelInfoConfiguration expected = new ModelInfoConfiguration();
+ expected.setModelCustomizationId(modelCustUUID);
+ expected.setModelInvariantId(modelInvariantUUID);
+ expected.setModelVersionId(modelVersionUUID);
+ expected.setPolicyName(policyName);
+ ConfigurationResourceCustomization configurationResourceCustomization =
+ new ConfigurationResourceCustomization();
+ configurationResourceCustomization.setModelCustomizationUUID(modelCustUUID);
+ configurationResourceCustomization.setConfigurationResource(new ConfigurationResource());
+ configurationResourceCustomization.getConfigurationResource().setModelInvariantUUID(modelInvariantUUID);
+ configurationResourceCustomization.getConfigurationResource().setModelUUID(modelVersionUUID);
+ CvnfcConfigurationCustomization policyNameTable = new CvnfcConfigurationCustomization();
+ policyNameTable.setCvnfcCustomization(new CvnfcCustomization());
+ policyNameTable.getCvnfcCustomization().setVnfcCustomization(new VnfcCustomization());
+ policyNameTable.setPolicyName(policyName);
+
+ ModelInfoConfiguration actual = bbInputSetupMapperLayer
+ .mapCatalogConfigurationToConfiguration(configurationResourceCustomization, policyNameTable);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void testmapCatalogConfigurationToFabricConfiguration() {
+ String modelCustUUID = "modelCustomizationUUID";
+ String modelInvariantUUID = "modelInvariantUUID";
+ String modelVersionUUID = "modelUUID";
+ String policyName = "policyName";
+ ModelInfoConfiguration expected = new ModelInfoConfiguration();
+ expected.setModelCustomizationId(modelCustUUID);
+ expected.setModelInvariantId(modelInvariantUUID);
+ expected.setModelVersionId(modelVersionUUID);
+ expected.setPolicyName(policyName);
+
+ CvnfcConfigurationCustomization fabricCustomization = new CvnfcConfigurationCustomization();
+ fabricCustomization.setCvnfcCustomization(new CvnfcCustomization());
+ fabricCustomization.getCvnfcCustomization().setVnfcCustomization(new VnfcCustomization());
+ fabricCustomization.setPolicyName(policyName);
+ fabricCustomization.setModelCustomizationUUID(modelCustUUID);
+
+ ConfigurationResource configurationResource = new ConfigurationResource();
+ configurationResource.setModelUUID(modelVersionUUID);
+ configurationResource.setModelInvariantUUID(modelInvariantUUID);
+ fabricCustomization.setConfigurationResource(configurationResource);
+
+ ModelInfoConfiguration actual =
+ bbInputSetupMapperLayer.mapCatalogConfigurationToConfiguration(fabricCustomization);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void testMapNameValueUserParams() throws IOException {
+ RequestDetails requestDetails = mapper
+ .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class);
+ Map<String, Object> actual =
+ bbInputSetupMapperLayer.mapNameValueUserParams(requestDetails.getRequestParameters());
+
+ assertTrue(actual.containsKey("mns_vfw_protected_route_prefixes"));
+ assertTrue(actual.get("mns_vfw_protected_route_prefixes").toString()
+ .contains("interface_route_table_routes_route"));
+ assertTrue(actual.get("mns_vfw_protected_route_prefixes").toString().contains("1.1.1.1/32"));
+ assertTrue(actual.get("mns_vfw_protected_route_prefixes").toString().contains("0::1/128"));
+ assertTrue(actual.containsKey("name1"));
+ assertTrue(actual.containsValue("value1"));
+ assertTrue(actual.get("name1").equals("value1"));
+
+ assertFalse(actual.containsKey("ignore"));
+ assertFalse(actual.containsValue("ignore"));
+ }
+
+ @Test
+ public void testMapRequestParameters() throws IOException {
+ RequestDetails requestDetails = mapper
+ .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class);
+ RequestParameters actual = bbInputSetupMapperLayer.mapRequestParameters(requestDetails.getRequestParameters());
+
+ assertEquals(actual.getUsePreload(), requestDetails.getRequestParameters().getUsePreload());
+ assertEquals(actual.getSubscriptionServiceType(),
+ requestDetails.getRequestParameters().getSubscriptionServiceType());
+ assertEquals(actual.getPayload(), requestDetails.getRequestParameters().getPayload());
+ }
+
+ protected RequestParameters mapRequestParameters(
+ org.onap.so.serviceinstancebeans.RequestParameters requestParameters) {
+ RequestParameters requestParams = new RequestParameters();
+ requestParams.setaLaCarte(requestParameters.getALaCarte());
+ requestParams.setUsePreload(requestParameters.getUsePreload());
+ requestParams.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType());
+ requestParams.setUserParams(requestParameters.getUserParams());
+ requestParams.setPayload(requestParameters.getPayload());
+ return requestParams;
+ }
+
}
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
index 8d0b2f60e1..ad1918e6da 100644
--- 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
@@ -34,7 +34,6 @@ 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;
@@ -43,7 +42,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.junit.Assert;
import org.junit.Before;
@@ -116,2624 +114,2684 @@ 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 = "CloudOwner";
-
- @Spy
- private BBInputSetup SPY_bbInputSetup = new BBInputSetup();
-
- @Mock
- private BBInputSetupUtils SPY_bbInputSetupUtils;
-
- @Mock
- private CloudInfoFromAAI SPY_cloudInfoFromAAI;
-
- @Spy
- private BBInputSetupMapperLayer bbInputSetupMapperLayer;
-
- @Before
- public void setup(){
- SPY_bbInputSetup.setBbInputSetupUtils(SPY_bbInputSetupUtils);
- SPY_bbInputSetup.setMapperLayer(bbInputSetupMapperLayer);
- SPY_bbInputSetup.setCloudInfoFromAAI(SPY_cloudInfoFromAAI);
- }
-
- @Test
- public void testGetVolumeGroupIdRelatedToVfModule() {
- String expected = "volumeGroupId";
- String modelCustomizationId = "modelCustomizationId";
- ModelInfo modelInfo = new ModelInfo();
- modelInfo.setModelCustomizationId(modelCustomizationId);
- String cloudOwner = "cloudOwner";
- String cloudRegionId = "cloudRegionId";
- String volumeGroupId = "volumeGroupId";
- GenericVnf vnf = new GenericVnf();
- VolumeGroup volumeGroup = new VolumeGroup();
- volumeGroup.setVolumeGroupId(expected);
- vnf.getVolumeGroups().add(volumeGroup);
- Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
- lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, null);
- org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup = new org.onap.aai.domain.yang.VolumeGroup();
- aaiVolumeGroup.setModelCustomizationId(modelCustomizationId);
- doReturn(aaiVolumeGroup).when(SPY_bbInputSetupUtils).getAAIVolumeGroup(cloudOwner, cloudRegionId, volumeGroupId);
-
- Optional<String> actual = SPY_bbInputSetup.getVolumeGroupIdRelatedToVfModule(vnf, modelInfo, cloudOwner, cloudRegionId, lookupKeyMap);
-
- assertEquals(expected, actual.get());
- }
-
- @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<ResourceKey, String> 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<ResourceKey, String> 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);
-
-
- 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<ResourceKey, String> 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<ResourceKey, String> 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(executeBB.getWorkflowResourceIds(),lookupKeyMap);
- boolean aLaCarte = true;
- GeneralBuildingBlock actual = SPY_bbInputSetup.getGBB(executeBB, lookupKeyMap, requestAction, aLaCarte,
- resourceId, null);
-
- assertThat(actual, sameBeanAs(expected));
- }
-
- @Test
- public void testGetGBBCM() throws Exception {
- GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockCMExpected.json"),
- GeneralBuildingBlock.class);
-
- ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock();
- executeBB.setRequestId("requestId");
- RequestDetails requestDetails = new RequestDetails();
- requestDetails.setModelInfo(null);
- RequestParameters requestParams = new RequestParameters();
- requestParams.setaLaCarte(true);
- requestDetails.setRequestParameters(requestParams);
- RequestInfo requestInfo = new RequestInfo();
- requestInfo.setSuppressRollback(true);
- requestInfo.setSource("VID");
- requestDetails.setRequestInfo(requestInfo);
- CloudConfiguration cloudConfiguration = new CloudConfiguration();
- cloudConfiguration.setLcpCloudRegionId("myRegionId");
- requestDetails.setCloudConfiguration(cloudConfiguration);
- Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
- String resourceId = "123";
- String requestAction = "createInstance";
-
- lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnf-001");
-
- doReturn(new org.onap.aai.domain.yang.GenericVnf()).when(SPY_bbInputSetupUtils).getAAIGenericVnf(ArgumentMatchers.isA(String.class));
- doReturn(null).when(bbInputSetupMapperLayer).mapAAIGenericVnfIntoGenericVnf(ArgumentMatchers.isA(org.onap.aai.domain.yang.GenericVnf.class));
- GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBCM(executeBB, requestDetails, lookupKeyMap, requestAction,
- resourceId);
- assertThat(actual, sameBeanAs(expected));
- }
-
- @Test
- public void testGetGBBCMAddMembersAction() throws Exception {
- GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockInstanceGroupExpected.json"),
- GeneralBuildingBlock.class);
- ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
- ExecuteBuildingBlock.class);
- RequestDetails requestDetails = mapper.readValue(
- new File(RESOURCE_PATH + "RequestDetailsInput_instanceGroupAddMembers.json"), RequestDetails.class);
- Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
- String requestAction = "addMembers";
- String instanceGroupId = "instance-group-001";
-
- WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
- workflowResourceIds.setInstanceGroupId(instanceGroupId);
- executeBB.setWorkflowResourceIds(workflowResourceIds);
-
- lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, instanceGroupId);
-
- org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = new org.onap.aai.domain.yang.InstanceGroup();
- aaiInstanceGroup.setId(instanceGroupId);
- aaiInstanceGroup.setInstanceGroupName("test instance group 1");
-
- org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance();
- aaiServiceInstance.setServiceInstanceId("service-instance-001");
- aaiServiceInstance.setServiceInstanceName("test service instance 1");
- Optional<org.onap.aai.domain.yang.ServiceInstance> optSI = Optional.of(aaiServiceInstance);
-
- org.onap.aai.domain.yang.GenericVnf vnf1 = new org.onap.aai.domain.yang.GenericVnf();
- vnf1.setVnfId("vnf-001");
- vnf1.setVnfName("test vnf 1");
-
- org.onap.aai.domain.yang.GenericVnf vnf2 = new org.onap.aai.domain.yang.GenericVnf();
- vnf2.setVnfId("vnf-002");
- vnf2.setVnfName("test vnf 2");
-
- doReturn(aaiInstanceGroup).when(SPY_bbInputSetupUtils).getAAIInstanceGroup(instanceGroupId);
- doReturn(optSI).when(SPY_bbInputSetupUtils).getRelatedServiceInstanceFromInstanceGroup(instanceGroupId);
- doReturn(vnf1).when(SPY_bbInputSetupUtils).getAAIGenericVnf("vnf-001");
- doReturn(vnf2).when(SPY_bbInputSetupUtils).getAAIGenericVnf("vnf-002");
-
- GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBCM(executeBB, requestDetails, lookupKeyMap,
- requestAction, instanceGroupId);
-
- 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<ResourceKey, String> 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");
-
- doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(requestDetails, service, "bbName",
- serviceInstance, lookupKeyMap, resourceId, vnfType, null, null);
- 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<ResourceKey, String> 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";
-
- 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<ResourceKey, String> 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");
-
- doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(requestDetails, service, "bbName",
- serviceInstance, lookupKeyMap, resourceId, vnfType, null, null);
-
- 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<ResourceKey, String> 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(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, Boolean.TRUE.equals(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<ResourceKey, String> 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(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, Boolean.TRUE.equals(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<ResourceKey, String> 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<String, String> uriKeys = new HashMap<>();
- uriKeys.put("global-customer-id", "globalCustomerId");
- uriKeys.put("service-type", "serviceType");
-
- doReturn(service).when(SPY_bbInputSetupUtils)
- .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId());
-
- doReturn(customer).when(SPY_bbInputSetup).getCustomerAndServiceSubscription(requestDetails, resourceId);
-
- doReturn(serviceInstance).when(SPY_bbInputSetup).getALaCarteServiceInstance(service, requestDetails, customer,
- null, null, lookupKeyMap, resourceId, Boolean.TRUE.equals(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<ResourceKey, String> 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<ResourceKey, String> 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<ResourceKey, String> 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<ResourceKey, String> lookupKeyMap = new HashMap<>();
- String bbName = "ActivateServiceInstanceBB";
- Service differentService = new Service();
- differentService.setModelUUID("modelUUIDDifferent");
-
- doReturn(serviceInstanceAAI).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(serviceInstanceId);
-
-
- 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<ResourceKey, String> 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 vnfType = "vnfType";
- String resourceId = "networkId";
- String productFamilyId = "productFamilyId";
- 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<ResourceKey, String> lookupKeyMap = new HashMap<>();
-
- doNothing().when(SPY_bbInputSetup).populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, null);
- doReturn(modelInfo).when(requestDetails).getModelInfo();
- doReturn(productFamilyId).when(requestInfo).getProductFamilyId();
- 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, null, null);
- verify(SPY_bbInputSetup, times(1)).populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, null);
- assertEquals("NetworkId populated", true, lookupKeyMap.get(ResourceKey.NETWORK_ID).equalsIgnoreCase(resourceId));
-
- doReturn(ModelType.vnf).when(modelInfo).getModelType();
- resourceId = "vnfId";
- doNothing().when(SPY_bbInputSetup).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness,
- service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, productFamilyId);
- SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, vnfType, null, null);
- verify(SPY_bbInputSetup, times(1)).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness,
- service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, productFamilyId);
- assertEquals("VnfId populated", true, lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID).equalsIgnoreCase(resourceId));
-
- doReturn(ModelType.volumeGroup).when(modelInfo).getModelType();
- resourceId = "volumeGroupId";
- doNothing().when(SPY_bbInputSetup).populateVolumeGroup(modelInfo, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null);
- SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, vnfType, null, null);
- verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(modelInfo, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null);
- assertEquals("VolumeGroupId populated", true, lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID).equalsIgnoreCase(resourceId));
-
- doReturn(ModelType.vfModule).when(modelInfo).getModelType();
- resourceId = "vfModuleId";
- doNothing().when(SPY_bbInputSetup).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap,
- resourceId, relatedInstanceList, instanceName, null, cloudConfiguration);
- SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, vnfType, null, null);
- verify(SPY_bbInputSetup, times(1)).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap,
- resourceId, relatedInstanceList, instanceName, null, cloudConfiguration);
- assertEquals("VfModuleId populated", true, lookupKeyMap.get(ResourceKey.VF_MODULE_ID).equalsIgnoreCase(resourceId));
- }
-
- @Test
- public void testPopulateGBBWithSIAndAdditionalInfo() throws Exception {
- GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpectedWUserParamsInfo.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);
- CloudConfiguration cloudConfiguration = new CloudConfiguration();
- cloudConfiguration.setTenantId("tenantId");
- requestDetails.setCloudConfiguration(cloudConfiguration);
- OrchestrationContext orchestrationContext = new OrchestrationContext();
- orchestrationContext.setIsRollbackEnabled(false);
-
- CloudRegion cloudRegion = new CloudRegion();
- cloudRegion.setCloudOwner("test-owner-name");
- cloudRegion.setLcpCloudRegionId("lcpCloudRegionId");
- cloudRegion.setComplex("complexName");
- cloudRegion.setTenantId("tenantId");
-
- Map<String, String> 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.so.bpmn.servicedecomposition.bbobjects.Tenant tenant = new org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant();
- tenant.setTenantContext("tenantContext");
- tenant.setTenantId("tenantId");
- tenant.setTenantName("tenantName");
-
- org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class);
- org.onap.aai.domain.yang.Tenants aaiTenants = Mockito.mock(org.onap.aai.domain.yang.Tenants.class);
- org.onap.aai.domain.yang.Tenant aaiTenant = new org.onap.aai.domain.yang.Tenant();
- aaiTenant.setTenantId("tenantId");
- List<org.onap.aai.domain.yang.Tenant> tenants = new ArrayList<>();
- tenants.add(aaiTenant);
-
- 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());
- doReturn(orchestrationContext).when(bbInputSetupMapperLayer).mapOrchestrationContext(requestDetails);
- doReturn(requestContext).when(bbInputSetupMapperLayer).mapRequestContext(requestDetails);
- doReturn(cloudRegion).when(bbInputSetupMapperLayer).mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion);
- doReturn(tenant).when(bbInputSetupMapperLayer).mapTenant(aaiTenant);
- doReturn(aaiTenants).when(aaiCloudRegion).getTenants();
- doReturn(tenants).when(aaiTenants).getTenant();
-
- 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<ResourceKey, String> 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);
-
-
- 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);
-
- 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<CollectionResourceCustomization> 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 testPopulateInstanceGroup() throws Exception {
- ModelInfo modelInfo = Mockito.mock(ModelInfo.class);
- Service service = Mockito.mock(Service.class);
- List<InstanceGroup> instanceGroups = Mockito.spy(new ArrayList<>());
- ServiceInstance serviceInstance = Mockito.spy(new ServiceInstance());
- serviceInstance.setServiceInstanceId("si-001");
- serviceInstance.setServiceInstanceName("test service instance");
- serviceInstance.setInstanceGroups(instanceGroups);
-
- SPY_bbInputSetup.populateInstanceGroup(modelInfo, service, serviceInstance, "instance-group-001", "test instance group");
- verify(SPY_bbInputSetup, times(1)).mapCatalogInstanceGroup(isA(InstanceGroup.class), isA(ModelInfo.class), isA(Service.class));
- verify(instanceGroups, times(1)).add(isA(InstanceGroup.class));
- }
-
- @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<CollectionResourceCustomization> 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);
- serviceInstance.getVnfs().add(vnf);
-
- Service service = mapper.readValue(
- new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class);
- Map<ResourceKey, String> 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());
-
- lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId");
- SPY_bbInputSetup.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- requestDetails.getRelatedInstanceList(), reqInfo.getInstanceName(), null, null);
- verify(SPY_bbInputSetup, times(1)).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<ResourceKey, String> 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(1)).mapCatalogNetwork(network, modelInfo, service);
-
- instanceName = "networkName2";
- L3Network network2 = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, resourceId, null);
- SPY_bbInputSetup.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap,
- resourceId, null);
- verify(SPY_bbInputSetup, times(2)).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";
- String vnfcName = "vnfcName";
- // 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<ResourceKey, String> lookupKeyMap = new HashMap<>();
- lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
- String bbName = AssignFlows.FABRIC_CONFIGURATION.toString();
- ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
- configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
- configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
- configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
- configResourceKeys.setVnfcName(vnfcName);
- Vnfc vnfc = new Vnfc();
- vnfc.setVnfcName(vnfcName);
-
- doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys);
- doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName);
- SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- instanceName, configResourceKeys);
- verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys);
-
- lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, null);
-
- SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- instanceName, configResourceKeys);
- verify(SPY_bbInputSetup, times(2)).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys);
-
- 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, configResourceKeys);
- SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- instanceName, configResourceKeys);
- verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration2, modelInfo, service, configResourceKeys);
- }
-
- @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 testPopulateFabricConfiguration() 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";
- String vnfcName = "vnfcName";
- // Mock service
- Service service = mapper.readValue(
- new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class);
- Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
- lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
- String bbName = AssignFlows.FABRIC_CONFIGURATION.toString();
- ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
- configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
- configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
- configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
- configResourceKeys.setVnfcName(vnfcName);
- Vnfc vnfc = new Vnfc();
- vnfc.setVnfcName(vnfcName);
-
- CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new CvnfcConfigurationCustomization();
- ConfigurationResource configurationResource = new ConfigurationResource();
- configurationResource.setModelUUID("modelUUID");
- configurationResource.setModelInvariantUUID("modelInvariantUUID");
- vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
-
- doReturn(null).when(SPY_bbInputSetup).findConfigurationResourceCustomization(modelInfo, service);
- doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName);
-
- SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- instanceName, configResourceKeys);
- verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys);
- }
-
- @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<ResourceKey, String> 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);
- org.onap.aai.domain.yang.GenericVnf vnfAAI = new org.onap.aai.domain.yang.GenericVnf();
- vnfAAI.setModelCustomizationId("modelCustId");
- doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
- doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf, modelInfo, service);
- org.onap.aai.domain.yang.InstanceGroup instanceGroupAAI = new org.onap.aai.domain.yang.InstanceGroup();
- doReturn(instanceGroupAAI).when(SPY_bbInputSetupUtils).getAAIInstanceGroup(any());
- org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = new org.onap.so.db.catalog.beans.InstanceGroup();
- doReturn(catalogInstanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup(any());
-
- SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
- serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null,
- requestDetails.getRequestInfo().getProductFamilyId());
-
- lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
-
- SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
- serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null,
- requestDetails.getRequestInfo().getProductFamilyId());
- verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf, modelInfo, service);
-
- instanceName = "vnfName2";
- GenericVnf vnf2 = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness,
- resourceId, vnfType, null, requestDetails.getRequestInfo().getProductFamilyId());
- doReturn(vnf2).when(SPY_bbInputSetup).createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness,
- resourceId, vnfType, null, requestDetails.getRequestInfo().getProductFamilyId());
- doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}");
- doNothing().when(SPY_bbInputSetup).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service);
-
- lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId2");
-
- SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
- serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null,
- requestDetails.getRequestInfo().getProductFamilyId());
- verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf2, modelInfo, service);
- verify(SPY_bbInputSetup, times(2)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}");
- verify(SPY_bbInputSetup, times(2)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service);
- }
-
- @Test
- public void testMapVnfcCollectionInstanceGroup() {
- VnfResourceCustomization vnfResourceCust = Mockito.mock(VnfResourceCustomization.class);
- GenericVnf genericVnf = new GenericVnf();
- ModelInfo modelInfo = Mockito.mock(ModelInfo.class);
- Service service = Mockito.mock(Service.class);
- org.onap.so.db.catalog.beans.InstanceGroup instanceGroup = new org.onap.so.db.catalog.beans.InstanceGroup();
- instanceGroup.setModelUUID("modelUUID");
- List<VnfcInstanceGroupCustomization> vnfcInstanceGroups = new ArrayList<>();
- VnfcInstanceGroupCustomization vnfcInstanceGroupCust = new VnfcInstanceGroupCustomization();
- vnfcInstanceGroupCust.setInstanceGroup(instanceGroup);
- vnfcInstanceGroupCust.setFunction("function");
- vnfcInstanceGroupCust.setDescription("description");
- vnfcInstanceGroups.add(vnfcInstanceGroupCust);
-
- ModelInfoInstanceGroup modelInfoInstanceGroup = new ModelInfoInstanceGroup();
- modelInfoInstanceGroup.setModelUUID("modelUUID");
- doReturn(vnfResourceCust).when(SPY_bbInputSetup).getVnfResourceCustomizationFromService(modelInfo, service);
- doReturn(vnfcInstanceGroups).when(vnfResourceCust).getVnfcInstanceGroupCustomizations();
- doReturn(instanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup("modelUUID");
- doReturn(modelInfoInstanceGroup).when(bbInputSetupMapperLayer).mapCatalogInstanceGroupToInstanceGroup(null, instanceGroup);
-
- SPY_bbInputSetup.mapVnfcCollectionInstanceGroup(genericVnf, modelInfo, service);
-
- assertEquals("Instance Group was created", true, genericVnf.getInstanceGroups().size() == 1);
- }
- @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<ResourceKey, String> 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);
- org.onap.aai.domain.yang.GenericVnf vnfAAI = new org.onap.aai.domain.yang.GenericVnf();
- vnfAAI.setModelCustomizationId("modelCustId");
- doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
- doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf, modelInfo, service);
- org.onap.aai.domain.yang.InstanceGroup instanceGroupAAI = new org.onap.aai.domain.yang.InstanceGroup();
- doReturn(instanceGroupAAI).when(SPY_bbInputSetupUtils).getAAIInstanceGroup(any());
- org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = new org.onap.so.db.catalog.beans.InstanceGroup();
- doReturn(catalogInstanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup(any());
-
- SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
- serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null,
- requestDetails.getRequestInfo().getProductFamilyId());
-
- lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
-
- SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
- serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null,
- requestDetails.getRequestInfo().getProductFamilyId());
- verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf, modelInfo, service);
-
- instanceName = "vnfName2";
- GenericVnf vnf2 = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness,
- resourceId, vnfType, null, requestDetails.getRequestInfo().getProductFamilyId());
-
- org.onap.aai.domain.yang.GenericVnf vnf2AAI = new org.onap.aai.domain.yang.GenericVnf();
- vnfAAI.setModelCustomizationId("modelCustId2");
- doReturn(vnf2AAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf2.getVnfId());
- doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf2, modelInfo, service);
- doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}");
- SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
- serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null,
- requestDetails.getRequestInfo().getProductFamilyId());
- verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf2, modelInfo, service);
- verify(SPY_bbInputSetup, times(2)).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<CollectionResourceInstanceGroupCustomization> instanceGroupCustList = new ArrayList<>();
- CollectionResourceInstanceGroupCustomization instanceGroupCust = new CollectionResourceInstanceGroupCustomization();
- instanceGroupCust.setFunction("function");
- instanceGroupCust.setDescription("description");
-
- doReturn(modelInfoCollection).when(bbInputSetupMapperLayer).mapCatalogCollectionToCollection(collectionCust,
- collectionResource);
-
- 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<String, String> uriKeys = new HashMap<>();
- uriKeys.put("global-customer-id", "globalCustomerId");
- uriKeys.put("service-type", "serviceType");
-
-
- 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<Configuration> 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<GenericVnf> 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<VolumeGroup> 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<AAIResultWrapper> 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();
- ModelInfoCollection modelInfoCollection = new ModelInfoCollection();
- List<InstanceGroup> instanceGroupsList = new ArrayList<>();
- InstanceGroup instanceGroup = new InstanceGroup();
- instanceGroupsList.add(instanceGroup);
- NetworkCollectionResourceCustomization networkCollectionCust = Mockito.mock(NetworkCollectionResourceCustomization.class);
- CollectionResource collectionResource = new CollectionResource();
- doReturn(collection).when(bbInputSetupMapperLayer)
- .mapAAICollectionIntoCollection(isA(org.onap.aai.domain.yang.Collection.class));
- doReturn(instanceGroupsList).when(SPY_bbInputSetup).mapInstanceGroups(any());
- doReturn(networkCollectionCust).when(SPY_bbInputSetupUtils).getCatalogNetworkCollectionResourceCustByID(aaiCollection.getCollectionCustomizationId());
- doReturn(collectionResource).when(networkCollectionCust).getCollectionResource();
- doReturn(modelInfoCollection).when(bbInputSetupMapperLayer).mapCatalogCollectionToCollection(networkCollectionCust, collectionResource);
+ private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/";
+
+ protected ObjectMapper mapper = new ObjectMapper();
+ private static final String CLOUD_OWNER = "CloudOwner";
+
+ @Spy
+ private BBInputSetup SPY_bbInputSetup = new BBInputSetup();
+
+ @Mock
+ private BBInputSetupUtils SPY_bbInputSetupUtils;
+
+ @Mock
+ private CloudInfoFromAAI SPY_cloudInfoFromAAI;
+
+ @Spy
+ private BBInputSetupMapperLayer bbInputSetupMapperLayer;
+
+ @Before
+ public void setup() {
+ SPY_bbInputSetup.setBbInputSetupUtils(SPY_bbInputSetupUtils);
+ SPY_bbInputSetup.setMapperLayer(bbInputSetupMapperLayer);
+ SPY_bbInputSetup.setCloudInfoFromAAI(SPY_cloudInfoFromAAI);
+ }
+
+ @Test
+ public void testGetVolumeGroupIdRelatedToVfModule() {
+ String expected = "volumeGroupId";
+ String modelCustomizationId = "modelCustomizationId";
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationId(modelCustomizationId);
+ String cloudOwner = "cloudOwner";
+ String cloudRegionId = "cloudRegionId";
+ String volumeGroupId = "volumeGroupId";
+ GenericVnf vnf = new GenericVnf();
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupId(expected);
+ vnf.getVolumeGroups().add(volumeGroup);
+ Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, null);
+ org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup = new org.onap.aai.domain.yang.VolumeGroup();
+ aaiVolumeGroup.setModelCustomizationId(modelCustomizationId);
+ doReturn(aaiVolumeGroup).when(SPY_bbInputSetupUtils).getAAIVolumeGroup(cloudOwner, cloudRegionId,
+ volumeGroupId);
+
+ Optional<String> actual = SPY_bbInputSetup.getVolumeGroupIdRelatedToVfModule(vnf, modelInfo, cloudOwner,
+ cloudRegionId, lookupKeyMap);
+
+ assertEquals(expected, actual.get());
+ }
+
+ @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<ResourceKey, String> 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<ResourceKey, String> 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);
+
+
+ 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<ResourceKey, String> 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<ResourceKey, String> 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(executeBB.getWorkflowResourceIds(),
+ lookupKeyMap);
+ boolean aLaCarte = true;
+ GeneralBuildingBlock actual =
+ SPY_bbInputSetup.getGBB(executeBB, lookupKeyMap, requestAction, aLaCarte, resourceId, null);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void testGetGBBCM() throws Exception {
+ GeneralBuildingBlock expected = mapper
+ .readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockCMExpected.json"), GeneralBuildingBlock.class);
+
+ ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock();
+ executeBB.setRequestId("requestId");
+ RequestDetails requestDetails = new RequestDetails();
+ requestDetails.setModelInfo(null);
+ RequestParameters requestParams = new RequestParameters();
+ requestParams.setaLaCarte(true);
+ requestDetails.setRequestParameters(requestParams);
+ RequestInfo requestInfo = new RequestInfo();
+ requestInfo.setSuppressRollback(true);
+ requestInfo.setSource("VID");
+ requestDetails.setRequestInfo(requestInfo);
+ CloudConfiguration cloudConfiguration = new CloudConfiguration();
+ cloudConfiguration.setLcpCloudRegionId("myRegionId");
+ requestDetails.setCloudConfiguration(cloudConfiguration);
+ Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ String resourceId = "123";
+ String requestAction = "createInstance";
+
+ lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnf-001");
+
+ doReturn(new org.onap.aai.domain.yang.GenericVnf()).when(SPY_bbInputSetupUtils)
+ .getAAIGenericVnf(ArgumentMatchers.isA(String.class));
+ doReturn(null).when(bbInputSetupMapperLayer)
+ .mapAAIGenericVnfIntoGenericVnf(ArgumentMatchers.isA(org.onap.aai.domain.yang.GenericVnf.class));
+ GeneralBuildingBlock actual =
+ SPY_bbInputSetup.getGBBCM(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId);
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void testGetGBBCMAddMembersAction() throws Exception {
+ GeneralBuildingBlock expected = mapper.readValue(
+ new File(RESOURCE_PATH + "GeneralBuildingBlockInstanceGroupExpected.json"), GeneralBuildingBlock.class);
+ ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
+ ExecuteBuildingBlock.class);
+ RequestDetails requestDetails = mapper.readValue(
+ new File(RESOURCE_PATH + "RequestDetailsInput_instanceGroupAddMembers.json"), RequestDetails.class);
+ Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ String requestAction = "addMembers";
+ String instanceGroupId = "instance-group-001";
+
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setInstanceGroupId(instanceGroupId);
+ executeBB.setWorkflowResourceIds(workflowResourceIds);
+
+ lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, instanceGroupId);
+
+ org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = new org.onap.aai.domain.yang.InstanceGroup();
+ aaiInstanceGroup.setId(instanceGroupId);
+ aaiInstanceGroup.setInstanceGroupName("test instance group 1");
+
+ org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance();
+ aaiServiceInstance.setServiceInstanceId("service-instance-001");
+ aaiServiceInstance.setServiceInstanceName("test service instance 1");
+ Optional<org.onap.aai.domain.yang.ServiceInstance> optSI = Optional.of(aaiServiceInstance);
+
+ org.onap.aai.domain.yang.GenericVnf vnf1 = new org.onap.aai.domain.yang.GenericVnf();
+ vnf1.setVnfId("vnf-001");
+ vnf1.setVnfName("test vnf 1");
+
+ org.onap.aai.domain.yang.GenericVnf vnf2 = new org.onap.aai.domain.yang.GenericVnf();
+ vnf2.setVnfId("vnf-002");
+ vnf2.setVnfName("test vnf 2");
+
+ doReturn(aaiInstanceGroup).when(SPY_bbInputSetupUtils).getAAIInstanceGroup(instanceGroupId);
+ doReturn(optSI).when(SPY_bbInputSetupUtils).getRelatedServiceInstanceFromInstanceGroup(instanceGroupId);
+ doReturn(vnf1).when(SPY_bbInputSetupUtils).getAAIGenericVnf("vnf-001");
+ doReturn(vnf2).when(SPY_bbInputSetupUtils).getAAIGenericVnf("vnf-002");
+
+ GeneralBuildingBlock actual =
+ SPY_bbInputSetup.getGBBCM(executeBB, requestDetails, lookupKeyMap, requestAction, instanceGroupId);
+
+ 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<ResourceKey, String> 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");
+
+ doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(requestDetails, service, "bbName",
+ serviceInstance, lookupKeyMap, resourceId, vnfType, null, null);
+ 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<ResourceKey, String> 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";
+
+ 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<ResourceKey, String> 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");
+
+ doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(requestDetails, service, "bbName",
+ serviceInstance, lookupKeyMap, resourceId, vnfType, null, null);
+
+ 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<ResourceKey, String> 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(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, Boolean.TRUE.equals(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<ResourceKey, String> 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(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, Boolean.TRUE.equals(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<ResourceKey, String> 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<String, String> uriKeys = new HashMap<>();
+ uriKeys.put("global-customer-id", "globalCustomerId");
+ uriKeys.put("service-type", "serviceType");
+
+ doReturn(service).when(SPY_bbInputSetupUtils)
+ .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId());
+
+ doReturn(customer).when(SPY_bbInputSetup).getCustomerAndServiceSubscription(requestDetails, resourceId);
+
+ doReturn(serviceInstance).when(SPY_bbInputSetup).getALaCarteServiceInstance(service, requestDetails, customer,
+ null, null, lookupKeyMap, resourceId, Boolean.TRUE.equals(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<ResourceKey, String> 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<ResourceKey, String> 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<ResourceKey, String> 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<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ String bbName = "ActivateServiceInstanceBB";
+ Service differentService = new Service();
+ differentService.setModelUUID("modelUUIDDifferent");
+
+ doReturn(serviceInstanceAAI).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(serviceInstanceId);
+
+
+ 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<ResourceKey, String> 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 vnfType = "vnfType";
+ String resourceId = "networkId";
+ String productFamilyId = "productFamilyId";
+ 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<ResourceKey, String> lookupKeyMap = new HashMap<>();
+
+ doNothing().when(SPY_bbInputSetup).populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance,
+ lookupKeyMap, resourceId, null);
+ doReturn(modelInfo).when(requestDetails).getModelInfo();
+ doReturn(productFamilyId).when(requestInfo).getProductFamilyId();
+ 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, null, null);
+ verify(SPY_bbInputSetup, times(1)).populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance,
+ lookupKeyMap, resourceId, null);
+ assertEquals("NetworkId populated", true,
+ lookupKeyMap.get(ResourceKey.NETWORK_ID).equalsIgnoreCase(resourceId));
+
+ doReturn(ModelType.vnf).when(modelInfo).getModelType();
+ resourceId = "vnfId";
+ doNothing().when(SPY_bbInputSetup).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness,
+ service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null,
+ productFamilyId);
+ SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
+ lookupKeyMap, resourceId, vnfType, null, null);
+ verify(SPY_bbInputSetup, times(1)).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness,
+ service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null,
+ productFamilyId);
+ assertEquals("VnfId populated", true,
+ lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID).equalsIgnoreCase(resourceId));
+
+ doReturn(ModelType.volumeGroup).when(modelInfo).getModelType();
+ resourceId = "volumeGroupId";
+ doNothing().when(SPY_bbInputSetup).populateVolumeGroup(modelInfo, service, bbName, serviceInstance,
+ lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null);
+ SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
+ lookupKeyMap, resourceId, vnfType, null, null);
+ verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(modelInfo, service, bbName, serviceInstance,
+ lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null);
+ assertEquals("VolumeGroupId populated", true,
+ lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID).equalsIgnoreCase(resourceId));
+
+ doReturn(ModelType.vfModule).when(modelInfo).getModelType();
+ resourceId = "vfModuleId";
+ doNothing().when(SPY_bbInputSetup).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap,
+ resourceId, relatedInstanceList, instanceName, null, cloudConfiguration);
+ SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
+ lookupKeyMap, resourceId, vnfType, null, null);
+ verify(SPY_bbInputSetup, times(1)).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap,
+ resourceId, relatedInstanceList, instanceName, null, cloudConfiguration);
+ assertEquals("VfModuleId populated", true,
+ lookupKeyMap.get(ResourceKey.VF_MODULE_ID).equalsIgnoreCase(resourceId));
+ }
+
+ @Test
+ public void testPopulateGBBWithSIAndAdditionalInfo() throws Exception {
+ GeneralBuildingBlock expected =
+ mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpectedWUserParamsInfo.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);
+ CloudConfiguration cloudConfiguration = new CloudConfiguration();
+ cloudConfiguration.setTenantId("tenantId");
+ requestDetails.setCloudConfiguration(cloudConfiguration);
+ OrchestrationContext orchestrationContext = new OrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(false);
+
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setCloudOwner("test-owner-name");
+ cloudRegion.setLcpCloudRegionId("lcpCloudRegionId");
+ cloudRegion.setComplex("complexName");
+ cloudRegion.setTenantId("tenantId");
+
+ Map<String, String> 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.so.bpmn.servicedecomposition.bbobjects.Tenant tenant =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant();
+ tenant.setTenantContext("tenantContext");
+ tenant.setTenantId("tenantId");
+ tenant.setTenantName("tenantName");
+
+ org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class);
+ org.onap.aai.domain.yang.Tenants aaiTenants = Mockito.mock(org.onap.aai.domain.yang.Tenants.class);
+ org.onap.aai.domain.yang.Tenant aaiTenant = new org.onap.aai.domain.yang.Tenant();
+ aaiTenant.setTenantId("tenantId");
+ List<org.onap.aai.domain.yang.Tenant> tenants = new ArrayList<>();
+ tenants.add(aaiTenant);
+
+ 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());
+ doReturn(orchestrationContext).when(bbInputSetupMapperLayer).mapOrchestrationContext(requestDetails);
+ doReturn(requestContext).when(bbInputSetupMapperLayer).mapRequestContext(requestDetails);
+ doReturn(cloudRegion).when(bbInputSetupMapperLayer).mapCloudRegion(requestDetails.getCloudConfiguration(),
+ aaiCloudRegion);
+ doReturn(tenant).when(bbInputSetupMapperLayer).mapTenant(aaiTenant);
+ doReturn(aaiTenants).when(aaiCloudRegion).getTenants();
+ doReturn(tenants).when(aaiTenants).getTenant();
+
+ 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<ResourceKey, String> 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);
+
+
+ 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);
+
+ 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<CollectionResourceCustomization> 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 testPopulateInstanceGroup() throws Exception {
+ ModelInfo modelInfo = Mockito.mock(ModelInfo.class);
+ Service service = Mockito.mock(Service.class);
+ List<InstanceGroup> instanceGroups = Mockito.spy(new ArrayList<>());
+ ServiceInstance serviceInstance = Mockito.spy(new ServiceInstance());
+ serviceInstance.setServiceInstanceId("si-001");
+ serviceInstance.setServiceInstanceName("test service instance");
+ serviceInstance.setInstanceGroups(instanceGroups);
+
+ SPY_bbInputSetup.populateInstanceGroup(modelInfo, service, serviceInstance, "instance-group-001",
+ "test instance group");
+ verify(SPY_bbInputSetup, times(1)).mapCatalogInstanceGroup(isA(InstanceGroup.class), isA(ModelInfo.class),
+ isA(Service.class));
+ verify(instanceGroups, times(1)).add(isA(InstanceGroup.class));
+ }
+
+ @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<CollectionResourceCustomization> 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);
+ serviceInstance.getVnfs().add(vnf);
+
+ Service service = mapper.readValue(
+ new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class);
+ Map<ResourceKey, String> 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());
+
+ lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId");
+ SPY_bbInputSetup.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ requestDetails.getRelatedInstanceList(), reqInfo.getInstanceName(), null, null);
+ verify(SPY_bbInputSetup, times(1)).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<ResourceKey, String> 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(1)).mapCatalogNetwork(network, modelInfo, service);
+
+ instanceName = "networkName2";
+ L3Network network2 = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, resourceId, null);
+ SPY_bbInputSetup.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap,
+ resourceId, null);
+ verify(SPY_bbInputSetup, times(2)).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";
+ String vnfcName = "vnfcName";
+ // 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<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
+ String bbName = AssignFlows.FABRIC_CONFIGURATION.toString();
+ ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
+ configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
+ configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
+ configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
+ configResourceKeys.setVnfcName(vnfcName);
+ Vnfc vnfc = new Vnfc();
+ vnfc.setVnfcName(vnfcName);
+
+ doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service,
+ configResourceKeys);
+ doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName);
+ SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ instanceName, configResourceKeys);
+ verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service,
+ configResourceKeys);
+
+ lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, null);
+
+ SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ instanceName, configResourceKeys);
+ verify(SPY_bbInputSetup, times(2)).mapCatalogConfiguration(configuration, modelInfo, service,
+ configResourceKeys);
+
+ 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,
+ configResourceKeys);
+ SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ instanceName, configResourceKeys);
+ verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration2, modelInfo, service,
+ configResourceKeys);
+ }
+
+ @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 testPopulateFabricConfiguration() 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";
+ String vnfcName = "vnfcName";
+ // Mock service
+ Service service = mapper.readValue(
+ new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class);
+ Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
+ String bbName = AssignFlows.FABRIC_CONFIGURATION.toString();
+ ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
+ configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
+ configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
+ configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
+ configResourceKeys.setVnfcName(vnfcName);
+ Vnfc vnfc = new Vnfc();
+ vnfc.setVnfcName(vnfcName);
+
+ CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization =
+ new CvnfcConfigurationCustomization();
+ ConfigurationResource configurationResource = new ConfigurationResource();
+ configurationResource.setModelUUID("modelUUID");
+ configurationResource.setModelInvariantUUID("modelInvariantUUID");
+ vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
+
+ doReturn(null).when(SPY_bbInputSetup).findConfigurationResourceCustomization(modelInfo, service);
+ doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName);
+
+ SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ instanceName, configResourceKeys);
+ verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service,
+ configResourceKeys);
+ }
+
+ @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<ResourceKey, String> 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);
+ org.onap.aai.domain.yang.GenericVnf vnfAAI = new org.onap.aai.domain.yang.GenericVnf();
+ vnfAAI.setModelCustomizationId("modelCustId");
+ doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
+ doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf, modelInfo, service);
+ org.onap.aai.domain.yang.InstanceGroup instanceGroupAAI = new org.onap.aai.domain.yang.InstanceGroup();
+ doReturn(instanceGroupAAI).when(SPY_bbInputSetupUtils).getAAIInstanceGroup(any());
+ org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup =
+ new org.onap.so.db.catalog.beans.InstanceGroup();
+ doReturn(catalogInstanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup(any());
+
+ SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
+ serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null,
+ requestDetails.getRequestInfo().getProductFamilyId());
+
+ lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
+
+ SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
+ serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null,
+ requestDetails.getRequestInfo().getProductFamilyId());
+ verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf, modelInfo, service);
+
+ instanceName = "vnfName2";
+ GenericVnf vnf2 = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness,
+ resourceId, vnfType, null, requestDetails.getRequestInfo().getProductFamilyId());
+ doReturn(vnf2).when(SPY_bbInputSetup).createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness,
+ resourceId, vnfType, null, requestDetails.getRequestInfo().getProductFamilyId());
+ doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}");
+ doNothing().when(SPY_bbInputSetup).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service);
+
+ lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId2");
+
+ SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
+ serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null,
+ requestDetails.getRequestInfo().getProductFamilyId());
+ verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf2, modelInfo, service);
+ verify(SPY_bbInputSetup, times(2)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}");
+ verify(SPY_bbInputSetup, times(2)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service);
+ }
+
+ @Test
+ public void testMapVnfcCollectionInstanceGroup() {
+ VnfResourceCustomization vnfResourceCust = Mockito.mock(VnfResourceCustomization.class);
+ GenericVnf genericVnf = new GenericVnf();
+ ModelInfo modelInfo = Mockito.mock(ModelInfo.class);
+ Service service = Mockito.mock(Service.class);
+ org.onap.so.db.catalog.beans.InstanceGroup instanceGroup = new org.onap.so.db.catalog.beans.InstanceGroup();
+ instanceGroup.setModelUUID("modelUUID");
+ List<VnfcInstanceGroupCustomization> vnfcInstanceGroups = new ArrayList<>();
+ VnfcInstanceGroupCustomization vnfcInstanceGroupCust = new VnfcInstanceGroupCustomization();
+ vnfcInstanceGroupCust.setInstanceGroup(instanceGroup);
+ vnfcInstanceGroupCust.setFunction("function");
+ vnfcInstanceGroupCust.setDescription("description");
+ vnfcInstanceGroups.add(vnfcInstanceGroupCust);
+
+ ModelInfoInstanceGroup modelInfoInstanceGroup = new ModelInfoInstanceGroup();
+ modelInfoInstanceGroup.setModelUUID("modelUUID");
+ doReturn(vnfResourceCust).when(SPY_bbInputSetup).getVnfResourceCustomizationFromService(modelInfo, service);
+ doReturn(vnfcInstanceGroups).when(vnfResourceCust).getVnfcInstanceGroupCustomizations();
+ doReturn(instanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup("modelUUID");
+ doReturn(modelInfoInstanceGroup).when(bbInputSetupMapperLayer).mapCatalogInstanceGroupToInstanceGroup(null,
+ instanceGroup);
+
+ SPY_bbInputSetup.mapVnfcCollectionInstanceGroup(genericVnf, modelInfo, service);
+
+ assertEquals("Instance Group was created", true, genericVnf.getInstanceGroups().size() == 1);
+ }
+
+ @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<ResourceKey, String> 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);
+ org.onap.aai.domain.yang.GenericVnf vnfAAI = new org.onap.aai.domain.yang.GenericVnf();
+ vnfAAI.setModelCustomizationId("modelCustId");
+ doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
+ doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf, modelInfo, service);
+ org.onap.aai.domain.yang.InstanceGroup instanceGroupAAI = new org.onap.aai.domain.yang.InstanceGroup();
+ doReturn(instanceGroupAAI).when(SPY_bbInputSetupUtils).getAAIInstanceGroup(any());
+ org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup =
+ new org.onap.so.db.catalog.beans.InstanceGroup();
+ doReturn(catalogInstanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup(any());
+
+ SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
+ serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null,
+ requestDetails.getRequestInfo().getProductFamilyId());
+
+ lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
+
+ SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
+ serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null,
+ requestDetails.getRequestInfo().getProductFamilyId());
+ verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf, modelInfo, service);
+
+ instanceName = "vnfName2";
+ GenericVnf vnf2 = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness,
+ resourceId, vnfType, null, requestDetails.getRequestInfo().getProductFamilyId());
+
+ org.onap.aai.domain.yang.GenericVnf vnf2AAI = new org.onap.aai.domain.yang.GenericVnf();
+ vnfAAI.setModelCustomizationId("modelCustId2");
+ doReturn(vnf2AAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf2.getVnfId());
+ doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf2, modelInfo, service);
+ doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}");
+ SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
+ serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null,
+ requestDetails.getRequestInfo().getProductFamilyId());
+ verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf2, modelInfo, service);
+ verify(SPY_bbInputSetup, times(2)).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<CollectionResourceInstanceGroupCustomization> instanceGroupCustList = new ArrayList<>();
+ CollectionResourceInstanceGroupCustomization instanceGroupCust =
+ new CollectionResourceInstanceGroupCustomization();
+ instanceGroupCust.setFunction("function");
+ instanceGroupCust.setDescription("description");
+
+ doReturn(modelInfoCollection).when(bbInputSetupMapperLayer).mapCatalogCollectionToCollection(collectionCust,
+ collectionResource);
+
+ 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<String, String> uriKeys = new HashMap<>();
+ uriKeys.put("global-customer-id", "globalCustomerId");
+ uriKeys.put("service-type", "serviceType");
+
+
+ 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<Configuration> 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<GenericVnf> 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<VolumeGroup> 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<AAIResultWrapper> 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();
+ ModelInfoCollection modelInfoCollection = new ModelInfoCollection();
+ List<InstanceGroup> instanceGroupsList = new ArrayList<>();
+ InstanceGroup instanceGroup = new InstanceGroup();
+ instanceGroupsList.add(instanceGroup);
+ NetworkCollectionResourceCustomization networkCollectionCust =
+ Mockito.mock(NetworkCollectionResourceCustomization.class);
+ CollectionResource collectionResource = new CollectionResource();
+ doReturn(collection).when(bbInputSetupMapperLayer)
+ .mapAAICollectionIntoCollection(isA(org.onap.aai.domain.yang.Collection.class));
+ doReturn(instanceGroupsList).when(SPY_bbInputSetup).mapInstanceGroups(any());
+ doReturn(networkCollectionCust).when(SPY_bbInputSetupUtils)
+ .getCatalogNetworkCollectionResourceCustByID(aaiCollection.getCollectionCustomizationId());
+ doReturn(collectionResource).when(networkCollectionCust).getCollectionResource();
+ doReturn(modelInfoCollection).when(bbInputSetupMapperLayer)
+ .mapCatalogCollectionToCollection(networkCollectionCust, collectionResource);
+
+ 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());
+ }
- SPY_bbInputSetup.mapCollection(collections, serviceInstance);
+ @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);
- 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());
- }
+ L3Network expected = new L3Network();
+ List<L3Network> l3Networks = new ArrayList<>();
+ AAIResultWrapper l3NetworksWrapper =
+ new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI));
+ AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, "networkId");
- @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);
+ 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<RouteTableReference> 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<ResourceKey, String> expected = new HashMap<>();
+ Map<ResourceKey, String> actual = new HashMap<>();
+ String serviceInstanceId = "serviceInstanceId";
+ String networkId = "networkId";
+ String vnfId = "vnfId";
+ String vfModuleId = "vfModuleId";
+ String volumeGroupId = "volumeGroupId";
+ String configurationId = "configurationId";
+ String instanceGroupId = "instancegroupId";
+
+ 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);
+ expected.put(ResourceKey.INSTANCE_GROUP_ID, instanceGroupId);
+
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId(serviceInstanceId);
+ workflowResourceIds.setNetworkId(networkId);
+ workflowResourceIds.setVnfId(vnfId);
+ workflowResourceIds.setVfModuleId(vfModuleId);
+ workflowResourceIds.setVolumeGroupId(volumeGroupId);
+ workflowResourceIds.setConfigurationId(configurationId);
+ workflowResourceIds.setInstanceGroupId(instanceGroupId);
+
+ 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<ResourceKey, String> 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";
+
+ ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
+ configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
+ configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
+ configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
+ executeBB.setConfigurationResourceKeys(configResourceKeys);
+
+ executeBB.setRequestDetails(requestDetails);
+ doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
+ requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
+ 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(),
+ any(String.class));
+
+ 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), ArgumentMatchers.isNull(),
+ ArgumentMatchers.isNull(), any(String.class), any());
+
+ Configuration configuration = new Configuration();
+ configuration.setConfigurationId("configurationId");
+ gBB.getServiceInstance().getConfigurations().add(configuration);
+ List<ConfigurationResourceCustomization> 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), ArgumentMatchers.isNull(),
+ isA(ConfigurationResourceKeys.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), ArgumentMatchers.isNull(),
+ isA(ConfigurationResourceKeys.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();
+ aaiCloudRegion.setCloudOwner("test-owner-name");
+ Resources resources = serviceMacro.getResources();
+ doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(any(CloudConfiguration.class));
+ CloudRegion expected = new CloudRegion();
+ expected.setLcpCloudRegionId("mdt1");
+ expected.setCloudOwner("test-owner-name");
+ 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<ResourceKey, String> 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, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
+ doReturn(service).when(SPY_bbInputSetupUtils)
+ .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
+
+ executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString());
+ executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
+ executeBB.getBuildingBlock().setIsVirtualLink(Boolean.FALSE);
+ 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<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ String resourceId = "123";
+ String vnfType = "vnfType";
+ Service service = Mockito.mock(Service.class);
+ String requestAction = "createInstance";
+
+ 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<ResourceKey, String> 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";
+
+
+ executeBB.setRequestDetails(requestDetails);
+ doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
+ requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
+ 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(), ArgumentMatchers.isNull(), any(String.class),
+ ArgumentMatchers.isNull(), any(), any(String.class));
+
+ 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), ArgumentMatchers.isNull(),
+ ArgumentMatchers.isNull(), ArgumentMatchers.isNull(), 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<ResourceKey, String> 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";
+
+ executeBB.setRequestDetails(requestDetails);
+ doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
+ requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
+ 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(),
+ any(String.class));
+
+ 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), ArgumentMatchers.isNull(),
+ ArgumentMatchers.isNull(), 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<ResourceKey, String> 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, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
+ doReturn(service).when(SPY_bbInputSetupUtils)
+ .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
+ String generatedId = "12131";
+
+ 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<ResourceKey, String> 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");
+
+ ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
+ configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
+ configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
+ configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
+ executeBB.setConfigurationResourceKeys(configResourceKeys);
+
+ 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, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
+
+
+ doReturn(service).when(SPY_bbInputSetupUtils)
+ .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
+ List<NetworkResourceCustomization> 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("CreateNetworkBB");
+ 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(1)).getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap,
+ executeBB.getBuildingBlock().getBpmnFlowName(), "ab153b6e-c364-44c0-bef6-1f2982117f04", 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<ResourceKey, String> 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";
+
+ executeBB.setRequestDetails(requestDetails);
+ ServiceInstance serviceInstance = gBB.getServiceInstance();
+ org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance();
+ aaiServiceInstance.setModelVersionId("modelVersionId");
+ doReturn(service).when(SPY_bbInputSetupUtils)
+ .getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
+ doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils)
+ .getAAIServiceInstanceById(lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
+ doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
+ doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
+ executeBB, requestAction, null);
+
+ 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());
+ 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), isA(String.class), isA(CloudConfiguration.class));
+
+ requestAction = "activateInstance";
+ doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
+ executeBB, requestAction, null);
+ 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), isA(String.class), isA(CloudConfiguration.class));
+
+ requestAction = "unassignInstance";
+ doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
+ executeBB, requestAction, null);
+ 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), isA(String.class), isA(CloudConfiguration.class));
+
+ requestAction = "activateFabricConfiguration";
+ doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
+ executeBB, requestAction, null);
+ 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), 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<ResourceKey, String> 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, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
+ doReturn(service).when(SPY_bbInputSetupUtils)
+ .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
+ String generatedId = "12131";
+
+ 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<ResourceKey, String> 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";
+ executeBB.setRequestDetails(requestDetails);
+
+ ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
+ configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
+ configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
+ configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
+ executeBB.setConfigurationResourceKeys(configResourceKeys);
+
+ ServiceInstance serviceInstance = gBB.getServiceInstance();
+ org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance();
+ aaiServiceInstance.setModelVersionId("modelVersionId");
+ doReturn(service).when(SPY_bbInputSetupUtils)
+ .getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
+ doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils)
+ .getAAIServiceInstanceById(lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
+ doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
+ doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
+ executeBB, requestAction, null);
+
+ 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(), requestAction, null);
+ 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(), 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(), 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));
+
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setLcpCloudRegionId("cloudRegionId");
+ cloudRegion.setCloudOwner("CloudOwner");
+ doReturn(Optional.of(cloudRegion)).when(SPY_cloudInfoFromAAI).getCloudInfoFromAAI(gBB.getServiceInstance());
+ 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(cloudRegion.getCloudOwner(),
+ cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+
+ executeBB.getBuildingBlock().setBpmnFlowName("UnassignVolumeGroupBB");
+ executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
+ SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap,
+ executeBB.getBuildingBlock().getBpmnFlowName(), requestAction, null);
+ 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());
+ doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(isA(Configuration.class), isA(ModelInfo.class),
+ isA(Service.class), isA(ConfigurationResourceKeys.class));
+
+ executeBB.getBuildingBlock().setBpmnFlowName("ActivateFabricConfigurationBB");
+ executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
+ SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap,
+ executeBB.getBuildingBlock().getBpmnFlowName(), requestAction, cloudConfiguration);
+ verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(any(Configuration.class), any(ModelInfo.class),
+ any(Service.class), isA(ConfigurationResourceKeys.class));
+ }
+
+ @Test
+ public void testGetVnfId() {
+ String expected = "vnfId";
+ ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock();
+ Map<ResourceKey, String> 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<String, String> 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<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ List<Map<String, String>> 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<String, String> 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<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ List<Map<String, String>> 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<String, String> 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<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ List<Map<String, String>> 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";
+ String productFamilyId = "productFamilyId";
+ Platform platform = new Platform();
+ platform.setPlatformName(platformName);
+ LineOfBusiness lineOfBusiness = new LineOfBusiness();
+ lineOfBusiness.setLineOfBusinessName(lineOfBusinessName);
+ Map<String, String> 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);
+ expected.setProvStatus("PREPROV");
+ expected.setServiceId(productFamilyId);
+ Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ List<Map<String, String>> 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, productFamilyId);
+
+ 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, productFamilyId);
+ 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);
+ VfModule vfModule1 = new VfModule();
+ vfModule1.setVfModuleId("vfModuleId1");
+ VfModule vfModule2 = new VfModule();
+ vfModule2.setVfModuleId("vfModuleId2");
+ vnf.getVfModules().add(vfModule1);
+ vnf.getVfModules().add(vfModule2);
+ Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfId);
+ String resourceId = vfModuleId;
+ RelatedInstanceList[] relatedInstanceList = null;
+ String instanceName = "vfModuleName";
+ List<Map<String, String>> 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);
+ org.onap.aai.domain.yang.VfModule vfModuleAAI = new org.onap.aai.domain.yang.VfModule();
+ vfModuleAAI.setModelCustomizationId(vfModuleCustomizationId);
+
+ doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
+ doReturn(volumeGroupAAI).when(SPY_bbInputSetupUtils).getAAIVolumeGroup(CLOUD_OWNER,
+ cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+ doReturn(vfModuleAAI).when(SPY_bbInputSetupUtils).getAAIVfModule(isA(String.class), isA(String.class));
+ 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);
+
+ verify(SPY_bbInputSetup, times(3)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class),
+ isA(Service.class), isA(String.class));
+ 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));
+ }
+
+ @Test
+ public void testGettingVnfcToConfiguration() throws Exception {
+
+ String vnfcName = "vnfcName";
+ org.onap.aai.domain.yang.Configuration expectedAAI = new org.onap.aai.domain.yang.Configuration();
+ AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName);
+ AAIResultWrapper configurationWrapper =
+ new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI));
+
+ doReturn(new AAIResultWrapper(null)).when(SPY_bbInputSetupUtils).getAAIResourceDepthOne(aaiResourceUri);
+ Vnfc vnfc = SPY_bbInputSetup.getVnfcToConfiguration(vnfcName);
+ Assert.assertNull(vnfc);
+
+ doReturn(configurationWrapper).when(SPY_bbInputSetupUtils).getAAIResourceDepthOne(aaiResourceUri);
+ vnfc = SPY_bbInputSetup.getVnfcToConfiguration(vnfcName);
+ Assert.assertNotNull(vnfc);
+ }
- L3Network expected = new L3Network();
- List<L3Network> 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<RouteTableReference> 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<ResourceKey, String> expected = new HashMap<>();
- Map<ResourceKey, String> actual = new HashMap<>();
- String serviceInstanceId = "serviceInstanceId";
- String networkId = "networkId";
- String vnfId = "vnfId";
- String vfModuleId = "vfModuleId";
- String volumeGroupId = "volumeGroupId";
- String configurationId = "configurationId";
- String instanceGroupId = "instancegroupId";
-
- 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);
- expected.put(ResourceKey.INSTANCE_GROUP_ID, instanceGroupId);
-
- WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
- workflowResourceIds.setServiceInstanceId(serviceInstanceId);
- workflowResourceIds.setNetworkId(networkId);
- workflowResourceIds.setVnfId(vnfId);
- workflowResourceIds.setVfModuleId(vfModuleId);
- workflowResourceIds.setVolumeGroupId(volumeGroupId);
- workflowResourceIds.setConfigurationId(configurationId);
- workflowResourceIds.setInstanceGroupId(instanceGroupId);
-
- 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<ResourceKey, String> 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";
-
- ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
- configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
- configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
- configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
- executeBB.setConfigurationResourceKeys(configResourceKeys);
-
- executeBB.setRequestDetails(requestDetails);
- doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
- requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
- 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(), any(String.class));
-
- 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),ArgumentMatchers.isNull(),ArgumentMatchers.isNull(),
- any(String.class), any());
-
- Configuration configuration = new Configuration();
- configuration.setConfigurationId("configurationId");
- gBB.getServiceInstance().getConfigurations().add(configuration);
- List<ConfigurationResourceCustomization> 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), ArgumentMatchers.isNull(), isA(ConfigurationResourceKeys.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),ArgumentMatchers.isNull(), isA(ConfigurationResourceKeys.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();
- aaiCloudRegion.setCloudOwner("test-owner-name");
- Resources resources = serviceMacro.getResources();
- doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(any(CloudConfiguration.class));
- CloudRegion expected = new CloudRegion();
- expected.setLcpCloudRegionId("mdt1");
- expected.setCloudOwner("test-owner-name");
- 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<ResourceKey, String> 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, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
- doReturn(service).when(SPY_bbInputSetupUtils)
- .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
-
- executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString());
- executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
- executeBB.getBuildingBlock().setIsVirtualLink(Boolean.FALSE);
- 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<ResourceKey, String> lookupKeyMap = new HashMap<>();
- String resourceId = "123";
- String vnfType = "vnfType";
- Service service = Mockito.mock(Service.class);
- String requestAction = "createInstance";
-
- 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<ResourceKey, String> 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";
-
-
- executeBB.setRequestDetails(requestDetails);
- doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
- requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
- 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(),ArgumentMatchers.isNull(), any(String.class), ArgumentMatchers.isNull(), any(), any(String.class));
-
- 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), ArgumentMatchers.isNull(), ArgumentMatchers.isNull(),
- ArgumentMatchers.isNull(), 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<ResourceKey, String> 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";
-
- executeBB.setRequestDetails(requestDetails);
- doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
- requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
- 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(),
- any(String.class));
-
- 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), ArgumentMatchers.isNull(), ArgumentMatchers.isNull(),
- 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<ResourceKey, String> 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, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
- doReturn(service).when(SPY_bbInputSetupUtils)
- .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
- String generatedId = "12131";
-
- 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<ResourceKey, String> 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");
-
- ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
- configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
- configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
- configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
- executeBB.setConfigurationResourceKeys(configResourceKeys);
-
- 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, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
-
-
- doReturn(service).when(SPY_bbInputSetupUtils)
- .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
- List<NetworkResourceCustomization> 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("CreateNetworkBB");
- 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(1)).getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap,
- executeBB.getBuildingBlock().getBpmnFlowName(), "ab153b6e-c364-44c0-bef6-1f2982117f04", 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<ResourceKey, String> 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";
-
- executeBB.setRequestDetails(requestDetails);
- ServiceInstance serviceInstance = gBB.getServiceInstance();
- org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance();
- aaiServiceInstance.setModelVersionId("modelVersionId");
- doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
- doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
- doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
- doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
- executeBB, requestAction, null);
-
- 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());
- 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), isA(String.class),
- isA(CloudConfiguration.class));
-
- requestAction = "activateInstance";
- doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
- executeBB, requestAction, null);
- 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), isA(String.class),
- isA(CloudConfiguration.class));
-
- requestAction = "unassignInstance";
- doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
- executeBB, requestAction, null);
- 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), isA(String.class),
- isA(CloudConfiguration.class));
-
- requestAction = "activateFabricConfiguration";
- doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
- executeBB, requestAction, null);
- 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), 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<ResourceKey, String> 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, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
- doReturn(service).when(SPY_bbInputSetupUtils)
- .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
- String generatedId = "12131";
-
- 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<ResourceKey, String> 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";
- executeBB.setRequestDetails(requestDetails);
-
- ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
- configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
- configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
- configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
- executeBB.setConfigurationResourceKeys(configResourceKeys);
-
- ServiceInstance serviceInstance = gBB.getServiceInstance();
- org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance();
- aaiServiceInstance.setModelVersionId("modelVersionId");
- doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
- doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
- doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
- doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
- executeBB, requestAction, null);
-
- 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(), requestAction, null);
- 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(), 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(), 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));
-
- CloudRegion cloudRegion = new CloudRegion();
- cloudRegion.setLcpCloudRegionId("cloudRegionId");
- cloudRegion.setCloudOwner("CloudOwner");
- doReturn(Optional.of(cloudRegion)).when(SPY_cloudInfoFromAAI).getCloudInfoFromAAI(gBB.getServiceInstance());
- 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(cloudRegion.getCloudOwner(),
- cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
-
- executeBB.getBuildingBlock().setBpmnFlowName("UnassignVolumeGroupBB");
- executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
- SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap,
- executeBB.getBuildingBlock().getBpmnFlowName(), requestAction, null);
- 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());
- doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(isA(Configuration.class), isA(ModelInfo.class), isA(Service.class), isA(ConfigurationResourceKeys.class));
-
- executeBB.getBuildingBlock().setBpmnFlowName("ActivateFabricConfigurationBB");
- executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
- SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap,
- executeBB.getBuildingBlock().getBpmnFlowName(), requestAction, cloudConfiguration);
- verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(any(Configuration.class), any(ModelInfo.class),
- any(Service.class), isA(ConfigurationResourceKeys.class));
- }
-
- @Test
- public void testGetVnfId() {
- String expected = "vnfId";
- ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock();
- Map<ResourceKey, String> 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<String, String> 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<ResourceKey, String> lookupKeyMap = new HashMap<>();
- List<Map<String, String>> 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<String, String> 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<ResourceKey, String> lookupKeyMap = new HashMap<>();
- List<Map<String, String>> 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<String, String> 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<ResourceKey, String> lookupKeyMap = new HashMap<>();
- List<Map<String, String>> 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";
- String productFamilyId = "productFamilyId";
- Platform platform = new Platform();
- platform.setPlatformName(platformName);
- LineOfBusiness lineOfBusiness = new LineOfBusiness();
- lineOfBusiness.setLineOfBusinessName(lineOfBusinessName);
- Map<String, String> 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);
- expected.setProvStatus("PREPROV");
- expected.setServiceId(productFamilyId);
- Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
- List<Map<String, String>> 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,
- productFamilyId);
-
- 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, productFamilyId);
- 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);
- VfModule vfModule1 = new VfModule();
- vfModule1.setVfModuleId("vfModuleId1");
- VfModule vfModule2 = new VfModule();
- vfModule2.setVfModuleId("vfModuleId2");
- vnf.getVfModules().add(vfModule1);
- vnf.getVfModules().add(vfModule2);
- Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
- lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfId);
- String resourceId = vfModuleId;
- RelatedInstanceList[] relatedInstanceList = null;
- String instanceName = "vfModuleName";
- List<Map<String, String>> 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);
- org.onap.aai.domain.yang.VfModule vfModuleAAI = new org.onap.aai.domain.yang.VfModule();
- vfModuleAAI.setModelCustomizationId(vfModuleCustomizationId);
-
- doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
- doReturn(volumeGroupAAI).when(SPY_bbInputSetupUtils).getAAIVolumeGroup(CLOUD_OWNER,
- cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
- doReturn(vfModuleAAI).when(SPY_bbInputSetupUtils).getAAIVfModule(isA(String.class), isA(String.class));
- 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);
-
- verify(SPY_bbInputSetup, times(3)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), isA(Service.class), isA(String.class));
- 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));
- }
-
- @Test
- public void testGettingVnfcToConfiguration() throws Exception {
-
- String vnfcName = "vnfcName";
- org.onap.aai.domain.yang.Configuration expectedAAI = new org.onap.aai.domain.yang.Configuration();
- AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName);
- AAIResultWrapper configurationWrapper =
- new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI));
-
- doReturn(new AAIResultWrapper(null)).when(SPY_bbInputSetupUtils).getAAIResourceDepthOne(aaiResourceUri);
- Vnfc vnfc = SPY_bbInputSetup.getVnfcToConfiguration(vnfcName);
- Assert.assertNull(vnfc);
-
- doReturn(configurationWrapper).when(SPY_bbInputSetupUtils).getAAIResourceDepthOne(aaiResourceUri);
- vnfc = SPY_bbInputSetup.getVnfcToConfiguration(vnfcName);
- Assert.assertNotNull(vnfc);
- }
-
-
}
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
index 54e513e7d9..25135a0254 100644
--- 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
@@ -30,13 +30,11 @@ import static org.mockito.ArgumentMatchers.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;
@@ -67,7 +65,6 @@ 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.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
@@ -77,733 +74,762 @@ import org.onap.so.db.request.client.RequestsDbClient;
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<VnfcInstanceGroupCustomization> 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() {
- CloudConfiguration cloudConfig = new CloudConfiguration();
- cloudConfig.setLcpCloudRegionId("lcpCloudRegionId");
- Optional<org.onap.aai.domain.yang.CloudRegion> 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, cloudConfig.getCloudOwner(),
- cloudConfig.getLcpCloudRegionId()).depth(Depth.TWO));
-
- AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudConfig.getCloudOwner(),
- cloudConfig.getLcpCloudRegionId()).depth(Depth.TWO);
- bbInputSetupUtils.getCloudRegion(cloudConfig);
-
- verify(MOCK_aaiResourcesClient, times(1)).get(CloudRegion.class, expectedUri);
- }
-
- @Test
- public void testGetCloudRegionExceptionTest() {
-
- 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);
-
- assertNull(cloudRegion);
- }
-
- @Test
- public void testGetCloudRegionEmptyId() {
- CloudConfiguration cloudConfig = new CloudConfiguration();
- cloudConfig.setLcpCloudRegionId("");
-
- RequestDetails requestDetails = new RequestDetails();
- requestDetails.setCloudConfiguration(cloudConfig);
-
- CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfig);
-
- assertNull(cloudRegion);
- }
-
- @Test
- public void testGetCloudRegionEmptyConfiguration() {
- RequestDetails requestDetails = new RequestDetails();
-
- CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(requestDetails.getCloudConfiguration());
-
- assertNull(cloudRegion);
- }
-
- @Test
- public void testGetAAIInstanceGroup() {
- Optional<org.onap.aai.domain.yang.InstanceGroup> 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<org.onap.aai.domain.yang.Customer> 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<org.onap.aai.domain.yang.ServiceSubscription> 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<ServiceInstance> 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<CollectionResourceInstanceGroupCustomization> 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<L3Networks> 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<L3Network> 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<L3Network> actualNetwork = bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance(serviceInstanceId, networkName);
-
- assertEquals(Optional.empty(), actualNetwork);
- }
-
- @Test
- public void getRelatedServiceInstanceFromInstanceGroupTest() throws Exception {
- Optional<ServiceInstances> expected = Optional.of(new ServiceInstances());
- ServiceInstance serviceInstance = new ServiceInstance();
- serviceInstance.setServiceInstanceId("serviceInstanceId");
- serviceInstance.setServiceInstanceName("serviceInstanceName");
- expected.get().getServiceInstance().add(serviceInstance);
-
- doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class), any(AAIResourceUri.class));
- Optional<ServiceInstance> actual = this.bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup("ig-001");
- assertEquals(actual.get().getServiceInstanceId(), expected.get().getServiceInstance().get(0).getServiceInstanceId());
- }
-
- @Test
- public void getRelatedServiceInstanceFromInstanceGroupMultipleTest() throws Exception {
- expectedException.expect(MultipleObjectsFoundException.class);
- Optional<ServiceInstances> serviceInstances = Optional.of(new ServiceInstances());
- ServiceInstance si1 = Mockito.mock(ServiceInstance.class);
- ServiceInstance si2 = Mockito.mock(ServiceInstance.class);
- serviceInstances.get().getServiceInstance().add(si1);
- serviceInstances.get().getServiceInstance().add(si2);
-
- doReturn(serviceInstances).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class), any(AAIResourceUri.class));
- this.bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup("ig-001");
- }
-
- @Test
- public void getRelatedServiceInstanceFromInstanceGroupNotFoundTest() throws Exception {
- expectedException.expect(NoServiceInstanceFoundException.class);
- Optional<ServiceInstances> serviceInstances = Optional.of(new ServiceInstances());
-
- doReturn(serviceInstances).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class), any(AAIResourceUri.class));
- this.bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup("ig-001");
- }
-
- @Test
- public void getRelatedVnfByNameFromServiceInstanceTest() throws Exception {
- Optional<GenericVnfs> 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<GenericVnf> 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<GenericVnf> actualVnf = this.bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(serviceInstanceId, vnfName);
-
- assertEquals(actualVnf, Optional.empty());
- }
-
- @Test
- public void getRelatedVolumeGroupByNameFromVnfTest() throws Exception {
- Optional<VolumeGroups> 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<VolumeGroup> 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<VolumeGroup> actualVolumeGroup = bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(vnfId, volumeGroupName);
-
- assertEquals(actualVolumeGroup, Optional.empty());
- }
-
- @Test
- public void getRelatedVolumeGroupByNameFromVfModuleTest() throws Exception {
- Optional<VolumeGroups> 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<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123", "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 volumeGroupId = "volumeGroupId";
- 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, volumeGroupId, volumeGroupName);
- }
-
- @Test
- public void getRelatedVolumeGroupByNameFromVfModuleNotFoundTest() throws Exception {
- String vnfId = "vnfId";
- String volumeGroupId = "volumeGroupId";
- String volumeGroupName = "volumeGroupName";
-
- doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class));
-
- Optional<VolumeGroup> actualVolumeGroup = bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupId, volumeGroupName);
-
- assertEquals(actualVolumeGroup, Optional.empty());
- }
-} \ No newline at end of file
+ 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<VnfcInstanceGroupCustomization> 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() {
+ CloudConfiguration cloudConfig = new CloudConfiguration();
+ cloudConfig.setLcpCloudRegionId("lcpCloudRegionId");
+ Optional<org.onap.aai.domain.yang.CloudRegion> 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, cloudConfig.getCloudOwner(),
+ cloudConfig.getLcpCloudRegionId()).depth(Depth.TWO));
+
+ AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
+ cloudConfig.getCloudOwner(), cloudConfig.getLcpCloudRegionId()).depth(Depth.TWO);
+ bbInputSetupUtils.getCloudRegion(cloudConfig);
+
+ verify(MOCK_aaiResourcesClient, times(1)).get(CloudRegion.class, expectedUri);
+ }
+
+ @Test
+ public void testGetCloudRegionExceptionTest() {
+
+ 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);
+
+ assertNull(cloudRegion);
+ }
+
+ @Test
+ public void testGetCloudRegionEmptyId() {
+ CloudConfiguration cloudConfig = new CloudConfiguration();
+ cloudConfig.setLcpCloudRegionId("");
+
+ RequestDetails requestDetails = new RequestDetails();
+ requestDetails.setCloudConfiguration(cloudConfig);
+
+ CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfig);
+
+ assertNull(cloudRegion);
+ }
+
+ @Test
+ public void testGetCloudRegionEmptyConfiguration() {
+ RequestDetails requestDetails = new RequestDetails();
+
+ CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(requestDetails.getCloudConfiguration());
+
+ assertNull(cloudRegion);
+ }
+
+ @Test
+ public void testGetAAIInstanceGroup() {
+ Optional<org.onap.aai.domain.yang.InstanceGroup> 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<org.onap.aai.domain.yang.Customer> 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<org.onap.aai.domain.yang.ServiceSubscription> 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<ServiceInstance> 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<CollectionResourceInstanceGroupCustomization> 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<L3Networks> 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<L3Network> 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<L3Network> actualNetwork =
+ bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance(serviceInstanceId, networkName);
+
+ assertEquals(Optional.empty(), actualNetwork);
+ }
+
+ @Test
+ public void getRelatedServiceInstanceFromInstanceGroupTest() throws Exception {
+ Optional<ServiceInstances> expected = Optional.of(new ServiceInstances());
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ serviceInstance.setServiceInstanceName("serviceInstanceName");
+ expected.get().getServiceInstance().add(serviceInstance);
+
+ doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class), any(AAIResourceUri.class));
+ Optional<ServiceInstance> actual = this.bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup("ig-001");
+ assertEquals(actual.get().getServiceInstanceId(),
+ expected.get().getServiceInstance().get(0).getServiceInstanceId());
+ }
+
+ @Test
+ public void getRelatedServiceInstanceFromInstanceGroupMultipleTest() throws Exception {
+ expectedException.expect(MultipleObjectsFoundException.class);
+ Optional<ServiceInstances> serviceInstances = Optional.of(new ServiceInstances());
+ ServiceInstance si1 = Mockito.mock(ServiceInstance.class);
+ ServiceInstance si2 = Mockito.mock(ServiceInstance.class);
+ serviceInstances.get().getServiceInstance().add(si1);
+ serviceInstances.get().getServiceInstance().add(si2);
+
+ doReturn(serviceInstances).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class),
+ any(AAIResourceUri.class));
+ this.bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup("ig-001");
+ }
+
+ @Test
+ public void getRelatedServiceInstanceFromInstanceGroupNotFoundTest() throws Exception {
+ expectedException.expect(NoServiceInstanceFoundException.class);
+ Optional<ServiceInstances> serviceInstances = Optional.of(new ServiceInstances());
+
+ doReturn(serviceInstances).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class),
+ any(AAIResourceUri.class));
+ this.bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup("ig-001");
+ }
+
+ @Test
+ public void getRelatedVnfByNameFromServiceInstanceTest() throws Exception {
+ Optional<GenericVnfs> 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<GenericVnf> 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<GenericVnf> actualVnf =
+ this.bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(serviceInstanceId, vnfName);
+
+ assertEquals(actualVnf, Optional.empty());
+ }
+
+ @Test
+ public void getRelatedVolumeGroupByNameFromVnfTest() throws Exception {
+ Optional<VolumeGroups> 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<VolumeGroup> 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<VolumeGroup> actualVolumeGroup =
+ bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(vnfId, volumeGroupName);
+
+ assertEquals(actualVolumeGroup, Optional.empty());
+ }
+
+ @Test
+ public void getRelatedVolumeGroupByNameFromVfModuleTest() throws Exception {
+ Optional<VolumeGroups> 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<VolumeGroup> actual =
+ this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123", "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 volumeGroupId = "volumeGroupId";
+ 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, volumeGroupId, volumeGroupName);
+ }
+
+ @Test
+ public void getRelatedVolumeGroupByNameFromVfModuleNotFoundTest() throws Exception {
+ String vnfId = "vnfId";
+ String volumeGroupId = "volumeGroupId";
+ String volumeGroupName = "volumeGroupName";
+
+ doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class));
+
+ Optional<VolumeGroup> actualVolumeGroup =
+ bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupId, volumeGroupName);
+
+ assertEquals(actualVolumeGroup, Optional.empty());
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java
index af7dc582e0..1f4c8d3f1d 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java
@@ -26,13 +26,11 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
-
import java.io.File;
import java.io.IOException;
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;
@@ -48,7 +46,6 @@ 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 com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
@@ -57,106 +54,106 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(MockitoJUnitRunner.class)
public class CloudInfoFromAAITest {
- private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/";
-
- @Spy
- private CloudInfoFromAAI SPY_CloudInfoFromAAI = new CloudInfoFromAAI();
-
- protected ObjectMapper mapper = new ObjectMapper();
-
- @Mock
- private BBInputSetupUtils SPY_bbInputSetupUtils;
-
- @Before
- public void setup(){
- SPY_CloudInfoFromAAI.setBbInputSetupUtils(SPY_bbInputSetupUtils);
- }
-
- @Test
- public void testGetCloudInfoFromAAI() throws JsonParseException, JsonMappingException, IOException {
- //Test vnfs
- ServiceInstance serviceInstance = mapper.readValue(
- new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"),
- ServiceInstance.class);
- CloudRegion expected = new CloudRegion();
- GenericVnf vnf = new GenericVnf();
- String vnfId = "vnfId";
- vnf.setVnfId(vnfId);
- serviceInstance.getVnfs().add(vnf);
- org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf();
- aaiVnf.setVnfId(vnfId);
- Relationships relationships = Mockito.mock(Relationships.class);
- Optional<Relationships> relationshipsOp= Optional.of(relationships);
- doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
- doReturn(relationshipsOp).when(SPY_CloudInfoFromAAI).getRelationshipsFromWrapper(isA(AAIResultWrapper.class));
- doReturn(Optional.of(expected)).when(SPY_CloudInfoFromAAI).getRelatedCloudRegionAndTenant(relationships);
- Optional<CloudRegion> actual = SPY_CloudInfoFromAAI.getCloudInfoFromAAI(serviceInstance);
- assertThat(actual.get(), sameBeanAs(expected));
-
- //Test networks
- serviceInstance = mapper.readValue(
- new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"),
- ServiceInstance.class);
- L3Network l3Network = new L3Network();
- String networkId = "networkId";
- l3Network.setNetworkId(networkId);
- serviceInstance.getNetworks().add(l3Network);
- org.onap.aai.domain.yang.L3Network aaiL3Network = new org.onap.aai.domain.yang.L3Network();
- aaiL3Network.setNetworkId(networkId);
- doReturn(aaiL3Network).when(SPY_bbInputSetupUtils).getAAIL3Network(l3Network.getNetworkId());
- actual = SPY_CloudInfoFromAAI.getCloudInfoFromAAI(serviceInstance);
- assertThat(actual.get(), sameBeanAs(expected));
-
- //Test no relationships
-
- doReturn(Optional.empty()).when(SPY_CloudInfoFromAAI).getRelationshipsFromWrapper(isA(AAIResultWrapper.class));
- actual = SPY_CloudInfoFromAAI.getCloudInfoFromAAI(serviceInstance);
- assertEquals(actual, Optional.empty());
-
- //Test null
- serviceInstance = mapper.readValue(
- new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"),
- ServiceInstance.class);
- actual = SPY_CloudInfoFromAAI.getCloudInfoFromAAI(serviceInstance);
- assertEquals(actual, Optional.empty());
- }
-
- @Test
- public void testGetRelatedCloudRegionAndTenant() throws JsonProcessingException {
- String cloudOwner = "cloudOwner";
- String cloudRegionId = "cloudRegionId";
- String cloudRegionVersion = "cloudRegionVersion";
- String cloudRegionComplexName = "cloudRegionComplexName";
- String tenantId = "tenantId";
- CloudRegion expected = new CloudRegion();
- expected.setCloudOwner(cloudOwner);
- expected.setCloudRegionVersion(cloudRegionVersion);
- expected.setComplex(cloudRegionComplexName);
- expected.setLcpCloudRegionId(cloudRegionId);
- expected.setTenantId(tenantId);
-
- Relationships relationships = Mockito.mock(Relationships.class);
- List<AAIResultWrapper> cloudRegions = new ArrayList<>();
- org.onap.aai.domain.yang.CloudRegion cloudRegion = new org.onap.aai.domain.yang.CloudRegion();
- cloudRegion.setCloudOwner(cloudOwner);
- cloudRegion.setCloudRegionId(cloudRegionId);
- cloudRegion.setCloudRegionVersion(cloudRegionVersion);
- cloudRegion.setComplexName(cloudRegionComplexName);
- AAIResultWrapper cloudRegionWrapper = new AAIResultWrapper(
- new AAICommonObjectMapperProvider().getMapper().writeValueAsString(cloudRegion));
- cloudRegions.add(cloudRegionWrapper);
-
- doReturn(cloudRegions).when(relationships).getByType(AAIObjectType.CLOUD_REGION);
- List<AAIResultWrapper> tenants = new ArrayList<>();
- org.onap.aai.domain.yang.Tenant tenant = new org.onap.aai.domain.yang.Tenant();
- tenant.setTenantId(tenantId);
- AAIResultWrapper tenantWrapper = new AAIResultWrapper(
- new AAICommonObjectMapperProvider().getMapper().writeValueAsString(tenant));
- tenants.add(tenantWrapper);
- doReturn(tenants).when(relationships).getByType(AAIObjectType.TENANT);
-
- Optional<CloudRegion> actual = SPY_CloudInfoFromAAI.getRelatedCloudRegionAndTenant(relationships);
-
- assertThat(actual.get(), sameBeanAs(expected));
- }
+ private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/";
+
+ @Spy
+ private CloudInfoFromAAI SPY_CloudInfoFromAAI = new CloudInfoFromAAI();
+
+ protected ObjectMapper mapper = new ObjectMapper();
+
+ @Mock
+ private BBInputSetupUtils SPY_bbInputSetupUtils;
+
+ @Before
+ public void setup() {
+ SPY_CloudInfoFromAAI.setBbInputSetupUtils(SPY_bbInputSetupUtils);
+ }
+
+ @Test
+ public void testGetCloudInfoFromAAI() throws JsonParseException, JsonMappingException, IOException {
+ // Test vnfs
+ ServiceInstance serviceInstance =
+ mapper.readValue(new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"),
+ ServiceInstance.class);
+ CloudRegion expected = new CloudRegion();
+ GenericVnf vnf = new GenericVnf();
+ String vnfId = "vnfId";
+ vnf.setVnfId(vnfId);
+ serviceInstance.getVnfs().add(vnf);
+ org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf();
+ aaiVnf.setVnfId(vnfId);
+ Relationships relationships = Mockito.mock(Relationships.class);
+ Optional<Relationships> relationshipsOp = Optional.of(relationships);
+ doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
+ doReturn(relationshipsOp).when(SPY_CloudInfoFromAAI).getRelationshipsFromWrapper(isA(AAIResultWrapper.class));
+ doReturn(Optional.of(expected)).when(SPY_CloudInfoFromAAI).getRelatedCloudRegionAndTenant(relationships);
+ Optional<CloudRegion> actual = SPY_CloudInfoFromAAI.getCloudInfoFromAAI(serviceInstance);
+ assertThat(actual.get(), sameBeanAs(expected));
+
+ // Test networks
+ serviceInstance =
+ mapper.readValue(new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"),
+ ServiceInstance.class);
+ L3Network l3Network = new L3Network();
+ String networkId = "networkId";
+ l3Network.setNetworkId(networkId);
+ serviceInstance.getNetworks().add(l3Network);
+ org.onap.aai.domain.yang.L3Network aaiL3Network = new org.onap.aai.domain.yang.L3Network();
+ aaiL3Network.setNetworkId(networkId);
+ doReturn(aaiL3Network).when(SPY_bbInputSetupUtils).getAAIL3Network(l3Network.getNetworkId());
+ actual = SPY_CloudInfoFromAAI.getCloudInfoFromAAI(serviceInstance);
+ assertThat(actual.get(), sameBeanAs(expected));
+
+ // Test no relationships
+
+ doReturn(Optional.empty()).when(SPY_CloudInfoFromAAI).getRelationshipsFromWrapper(isA(AAIResultWrapper.class));
+ actual = SPY_CloudInfoFromAAI.getCloudInfoFromAAI(serviceInstance);
+ assertEquals(actual, Optional.empty());
+
+ // Test null
+ serviceInstance =
+ mapper.readValue(new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"),
+ ServiceInstance.class);
+ actual = SPY_CloudInfoFromAAI.getCloudInfoFromAAI(serviceInstance);
+ assertEquals(actual, Optional.empty());
+ }
+
+ @Test
+ public void testGetRelatedCloudRegionAndTenant() throws JsonProcessingException {
+ String cloudOwner = "cloudOwner";
+ String cloudRegionId = "cloudRegionId";
+ String cloudRegionVersion = "cloudRegionVersion";
+ String cloudRegionComplexName = "cloudRegionComplexName";
+ String tenantId = "tenantId";
+ CloudRegion expected = new CloudRegion();
+ expected.setCloudOwner(cloudOwner);
+ expected.setCloudRegionVersion(cloudRegionVersion);
+ expected.setComplex(cloudRegionComplexName);
+ expected.setLcpCloudRegionId(cloudRegionId);
+ expected.setTenantId(tenantId);
+
+ Relationships relationships = Mockito.mock(Relationships.class);
+ List<AAIResultWrapper> cloudRegions = new ArrayList<>();
+ org.onap.aai.domain.yang.CloudRegion cloudRegion = new org.onap.aai.domain.yang.CloudRegion();
+ cloudRegion.setCloudOwner(cloudOwner);
+ cloudRegion.setCloudRegionId(cloudRegionId);
+ cloudRegion.setCloudRegionVersion(cloudRegionVersion);
+ cloudRegion.setComplexName(cloudRegionComplexName);
+ AAIResultWrapper cloudRegionWrapper =
+ new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(cloudRegion));
+ cloudRegions.add(cloudRegionWrapper);
+
+ doReturn(cloudRegions).when(relationships).getByType(AAIObjectType.CLOUD_REGION);
+ List<AAIResultWrapper> tenants = new ArrayList<>();
+ org.onap.aai.domain.yang.Tenant tenant = new org.onap.aai.domain.yang.Tenant();
+ tenant.setTenantId(tenantId);
+ AAIResultWrapper tenantWrapper =
+ new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(tenant));
+ tenants.add(tenantWrapper);
+ doReturn(tenants).when(relationships).getByType(AAIObjectType.TENANT);
+
+ Optional<CloudRegion> actual = SPY_CloudInfoFromAAI.getRelatedCloudRegionAndTenant(relationships);
+
+ assertThat(actual.get(), sameBeanAs(expected));
+ }
}
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
index 6344a3f1a6..e8d597a823 100644
--- 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
@@ -27,7 +27,6 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.junit.Before;
@@ -43,199 +42,215 @@ 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;
- private static final String ASTERISK = "*";
-
- @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("PT40S",delegateExecution.getVariable("RetryDuration"));
- }
-
- @Test
- public void setRetryTimerExceptionTest() {
- expectedException.expect(BpmnError.class);
- DelegateExecution execution = mock(DelegateExecution.class);
- when(execution.getVariable(eq("retryCount"))).thenThrow(BpmnError.class);
- executeBuildingBlockRainyDay.setRetryTimer(execution);
- }
-
- @Test
- public void queryRainyDayTableExists() throws Exception{
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
- vnf.setVnfType("vnft1");
- delegateExecution.setVariable("aLaCarte", true);
- delegateExecution.setVariable("suppressRollback", false);
- delegateExecution.setVariable("WorkflowExceptionCode", "7000");
- 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,true);
-
- assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
- }
-
- @Test
- public void queryRainyDayTableDefault() throws Exception{
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
- vnf.setVnfType("vnft1");
- delegateExecution.setVariable("aLaCarte", true);
- delegateExecution.setVariable("suppressRollback", false);
- delegateExecution.setVariable("WorkflowExceptionCode", ASTERISK);
- 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,true);
-
- assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
- assertEquals(5,delegateExecution.getVariable("maxRetries"));
- }
-
- @Test
- public void queryRainyDayTableDoesNotExist() throws Exception{
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
- vnf.setVnfType("vnft1");
- delegateExecution.setVariable("aLaCarte", true);
- doReturn(null).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class));
- delegateExecution.setVariable("suppressRollback", false);
-
- executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution,true);
-
- assertEquals("Abort", delegateExecution.getVariable("handlingCode"));
- }
-
- @Test
- public void queryRainyDayTableExceptionTest() {
- doThrow(RuntimeException.class).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class));
- delegateExecution.setVariable("aLaCarte", true);
- executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution,true);
- delegateExecution.setVariable("suppressRollback", false);
-
- assertEquals("Abort", delegateExecution.getVariable("handlingCode"));
- }
-
- @Test
- public void queryRainyDayTableSecondaryPolicyExists() throws Exception{
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
- vnf.setVnfType("vnft1");
- delegateExecution.setVariable("aLaCarte", true);
- delegateExecution.setVariable("suppressRollback", false);
- delegateExecution.setVariable("WorkflowExceptionCode", "7000");
- RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
- rainyDayHandlerStatus.setErrorCode("7000");
- rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB");
- rainyDayHandlerStatus.setServiceType("st1");
- rainyDayHandlerStatus.setVnfType("vnft1");
- rainyDayHandlerStatus.setPolicy("Retry");
- rainyDayHandlerStatus.setWorkStep(ASTERISK);
- rainyDayHandlerStatus.setSecondaryPolicy("Abort");
-
- doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep("AssignServiceInstanceBB", "st1", "vnft1", "7000", "*");
-
- executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution,false);
-
- assertEquals("Abort", delegateExecution.getVariable("handlingCode"));
- }
-
- @Test
- public void queryRainyDayTableRollbackToAssignedMacro() throws Exception{
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
- vnf.setVnfType("vnft1");
- delegateExecution.setVariable("aLaCarte", false);
- delegateExecution.setVariable("suppressRollback", false);
- delegateExecution.setVariable("WorkflowExceptionCode", "7000");
- RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
- rainyDayHandlerStatus.setErrorCode("7000");
- rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB");
- rainyDayHandlerStatus.setServiceType("st1");
- rainyDayHandlerStatus.setVnfType("vnft1");
- rainyDayHandlerStatus.setPolicy("RollbackToAssigned");
- rainyDayHandlerStatus.setWorkStep(ASTERISK);
- rainyDayHandlerStatus.setSecondaryPolicy("Abort");
-
- doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep("AssignServiceInstanceBB", "st1", "vnft1", "7000", "*");
-
- executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution,true);
-
- assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
- }
-
- @Test
- public void queryRainyDayTableRollbackToAssignedALaCarte() throws Exception{
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
- vnf.setVnfType("vnft1");
- delegateExecution.setVariable("aLaCarte", true);
- delegateExecution.setVariable("suppressRollback", false);
- delegateExecution.setVariable("WorkflowExceptionCode", "7000");
- RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
- rainyDayHandlerStatus.setErrorCode("7000");
- rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB");
- rainyDayHandlerStatus.setServiceType("st1");
- rainyDayHandlerStatus.setVnfType("vnft1");
- rainyDayHandlerStatus.setPolicy("RollbackToAssigned");
- rainyDayHandlerStatus.setWorkStep(ASTERISK);
- rainyDayHandlerStatus.setSecondaryPolicy("Abort");
-
- doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep("AssignServiceInstanceBB", "st1", "vnft1", "7000", "*");
-
- executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution,true);
-
- assertEquals("RollbackToAssigned", delegateExecution.getVariable("handlingCode"));
- }
-
- @Test
- public void suppressRollbackTest() throws Exception {
- delegateExecution.setVariable("suppressRollback", true);
- delegateExecution.setVariable("aLaCarte", true);
- executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution,true);
- assertEquals("Abort", delegateExecution.getVariable("handlingCode"));
- }
-
+ @Autowired
+ private ExecuteBuildingBlockRainyDay executeBuildingBlockRainyDay;
+
+ private ServiceInstance serviceInstance;
+ private Customer customer; // will build service sub
+ private GenericVnf vnf;
+ private BuildingBlock buildingBlock;
+ private ExecuteBuildingBlock executeBuildingBlock;
+ private static final String ASTERISK = "*";
+
+ @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("PT40S", delegateExecution.getVariable("RetryDuration"));
+ }
+
+ @Test
+ public void setRetryTimerExceptionTest() {
+ expectedException.expect(BpmnError.class);
+ DelegateExecution execution = mock(DelegateExecution.class);
+ when(execution.getVariable(eq("retryCount"))).thenThrow(BpmnError.class);
+ executeBuildingBlockRainyDay.setRetryTimer(execution);
+ }
+
+ @Test
+ public void queryRainyDayTableExists() throws Exception {
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
+ vnf.setVnfType("vnft1");
+ delegateExecution.setVariable("aLaCarte", true);
+ delegateExecution.setVariable("suppressRollback", false);
+ delegateExecution.setVariable("WorkflowExceptionCode", "7000");
+ 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, true);
+
+ assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
+ }
+
+ @Test
+ public void queryRainyDayTableDefault() throws Exception {
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
+ vnf.setVnfType("vnft1");
+ delegateExecution.setVariable("aLaCarte", true);
+ delegateExecution.setVariable("suppressRollback", false);
+ delegateExecution.setVariable("WorkflowExceptionCode", ASTERISK);
+ 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, true);
+
+ assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
+ assertEquals(5, delegateExecution.getVariable("maxRetries"));
+ }
+
+ @Test
+ public void queryRainyDayTableDoesNotExist() throws Exception {
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
+ vnf.setVnfType("vnft1");
+ delegateExecution.setVariable("aLaCarte", true);
+ doReturn(null).when(MOCK_catalogDbClient)
+ .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(isA(String.class),
+ isA(String.class), isA(String.class), isA(String.class), isA(String.class));
+ delegateExecution.setVariable("suppressRollback", false);
+
+ executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
+
+ assertEquals("Abort", delegateExecution.getVariable("handlingCode"));
+ }
+
+ @Test
+ public void queryRainyDayTableExceptionTest() {
+ doThrow(RuntimeException.class).when(MOCK_catalogDbClient)
+ .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(isA(String.class),
+ isA(String.class), isA(String.class), isA(String.class), isA(String.class));
+ delegateExecution.setVariable("aLaCarte", true);
+ executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
+ delegateExecution.setVariable("suppressRollback", false);
+
+ assertEquals("Abort", delegateExecution.getVariable("handlingCode"));
+ }
+
+ @Test
+ public void queryRainyDayTableSecondaryPolicyExists() throws Exception {
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
+ vnf.setVnfType("vnft1");
+ delegateExecution.setVariable("aLaCarte", true);
+ delegateExecution.setVariable("suppressRollback", false);
+ delegateExecution.setVariable("WorkflowExceptionCode", "7000");
+ RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
+ rainyDayHandlerStatus.setErrorCode("7000");
+ rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB");
+ rainyDayHandlerStatus.setServiceType("st1");
+ rainyDayHandlerStatus.setVnfType("vnft1");
+ rainyDayHandlerStatus.setPolicy("Retry");
+ rainyDayHandlerStatus.setWorkStep(ASTERISK);
+ rainyDayHandlerStatus.setSecondaryPolicy("Abort");
+
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient)
+ .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
+ "AssignServiceInstanceBB", "st1", "vnft1", "7000", "*");
+
+ executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, false);
+
+ assertEquals("Abort", delegateExecution.getVariable("handlingCode"));
+ }
+
+ @Test
+ public void queryRainyDayTableRollbackToAssignedMacro() throws Exception {
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
+ vnf.setVnfType("vnft1");
+ delegateExecution.setVariable("aLaCarte", false);
+ delegateExecution.setVariable("suppressRollback", false);
+ delegateExecution.setVariable("WorkflowExceptionCode", "7000");
+ RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
+ rainyDayHandlerStatus.setErrorCode("7000");
+ rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB");
+ rainyDayHandlerStatus.setServiceType("st1");
+ rainyDayHandlerStatus.setVnfType("vnft1");
+ rainyDayHandlerStatus.setPolicy("RollbackToAssigned");
+ rainyDayHandlerStatus.setWorkStep(ASTERISK);
+ rainyDayHandlerStatus.setSecondaryPolicy("Abort");
+
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient)
+ .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
+ "AssignServiceInstanceBB", "st1", "vnft1", "7000", "*");
+
+ executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
+
+ assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
+ }
+
+ @Test
+ public void queryRainyDayTableRollbackToAssignedALaCarte() throws Exception {
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
+ vnf.setVnfType("vnft1");
+ delegateExecution.setVariable("aLaCarte", true);
+ delegateExecution.setVariable("suppressRollback", false);
+ delegateExecution.setVariable("WorkflowExceptionCode", "7000");
+ RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
+ rainyDayHandlerStatus.setErrorCode("7000");
+ rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB");
+ rainyDayHandlerStatus.setServiceType("st1");
+ rainyDayHandlerStatus.setVnfType("vnft1");
+ rainyDayHandlerStatus.setPolicy("RollbackToAssigned");
+ rainyDayHandlerStatus.setWorkStep(ASTERISK);
+ rainyDayHandlerStatus.setSecondaryPolicy("Abort");
+
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient)
+ .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
+ "AssignServiceInstanceBB", "st1", "vnft1", "7000", "*");
+
+ executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
+
+ assertEquals("RollbackToAssigned", delegateExecution.getVariable("handlingCode"));
+ }
+
+ @Test
+ public void suppressRollbackTest() throws Exception {
+ delegateExecution.setVariable("suppressRollback", true);
+ delegateExecution.setVariable("aLaCarte", true);
+ executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
+ assertEquals("Abort", delegateExecution.getVariable("handlingCode"));
+ }
+
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundExceptionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundExceptionTest.java
index 1cf70d050a..75df1a08d9 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundExceptionTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundExceptionTest.java
@@ -21,47 +21,46 @@
package org.onap.so.bpmn.servicedecomposition.tasks.exceptions;
import static org.junit.Assert.assertEquals;
-
import org.junit.Test;
import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException;
public class MultipleObjectsFoundExceptionTest {
- private static final String MESSAGE = "message";
- private static final Throwable CAUSE = new Throwable();
- private MultipleObjectsFoundException MultipleObjectsFoundException;
-
- @Test
- public void defaultConstructorTest() {
- MultipleObjectsFoundException = new MultipleObjectsFoundException();
- assertEquals(null, MultipleObjectsFoundException.getMessage());
- assertEquals(null, MultipleObjectsFoundException.getCause());
- }
-
- @Test
- public void messageConstructorTest() {
- MultipleObjectsFoundException = new MultipleObjectsFoundException(MESSAGE);
- assertEquals(MESSAGE, MultipleObjectsFoundException.getMessage());
- assertEquals(null, MultipleObjectsFoundException.getCause());
- }
-
- @Test
- public void causeConstructorTest() {
- MultipleObjectsFoundException = new MultipleObjectsFoundException(CAUSE);
- assertEquals(CAUSE.toString(), MultipleObjectsFoundException.getMessage());
- assertEquals(CAUSE, MultipleObjectsFoundException.getCause());
- }
-
- @Test
- public void messageAndCauseConstructorTest() {
- MultipleObjectsFoundException = new MultipleObjectsFoundException(MESSAGE, CAUSE);
- assertEquals(MESSAGE, MultipleObjectsFoundException.getMessage());
- assertEquals(CAUSE, MultipleObjectsFoundException.getCause());
- }
-
- @Test
- public void messageAndCauseAndFlagsConstructorTest() {
- MultipleObjectsFoundException = new MultipleObjectsFoundException(MESSAGE, CAUSE, true, true);
- assertEquals(MESSAGE, MultipleObjectsFoundException.getMessage());
- assertEquals(CAUSE, MultipleObjectsFoundException.getCause());
- }
+ private static final String MESSAGE = "message";
+ private static final Throwable CAUSE = new Throwable();
+ private MultipleObjectsFoundException MultipleObjectsFoundException;
+
+ @Test
+ public void defaultConstructorTest() {
+ MultipleObjectsFoundException = new MultipleObjectsFoundException();
+ assertEquals(null, MultipleObjectsFoundException.getMessage());
+ assertEquals(null, MultipleObjectsFoundException.getCause());
+ }
+
+ @Test
+ public void messageConstructorTest() {
+ MultipleObjectsFoundException = new MultipleObjectsFoundException(MESSAGE);
+ assertEquals(MESSAGE, MultipleObjectsFoundException.getMessage());
+ assertEquals(null, MultipleObjectsFoundException.getCause());
+ }
+
+ @Test
+ public void causeConstructorTest() {
+ MultipleObjectsFoundException = new MultipleObjectsFoundException(CAUSE);
+ assertEquals(CAUSE.toString(), MultipleObjectsFoundException.getMessage());
+ assertEquals(CAUSE, MultipleObjectsFoundException.getCause());
+ }
+
+ @Test
+ public void messageAndCauseConstructorTest() {
+ MultipleObjectsFoundException = new MultipleObjectsFoundException(MESSAGE, CAUSE);
+ assertEquals(MESSAGE, MultipleObjectsFoundException.getMessage());
+ assertEquals(CAUSE, MultipleObjectsFoundException.getCause());
+ }
+
+ @Test
+ public void messageAndCauseAndFlagsConstructorTest() {
+ MultipleObjectsFoundException = new MultipleObjectsFoundException(MESSAGE, CAUSE, true, true);
+ assertEquals(MESSAGE, MultipleObjectsFoundException.getMessage());
+ assertEquals(CAUSE, MultipleObjectsFoundException.getCause());
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundExceptionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundExceptionTest.java
index 344481dbed..c5970f64ee 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundExceptionTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundExceptionTest.java
@@ -21,46 +21,45 @@
package org.onap.so.bpmn.servicedecomposition.tasks.exceptions;
import static org.junit.Assert.assertEquals;
-
import org.junit.Test;
public class NoServiceInstanceFoundExceptionTest {
- private static final String MESSAGE = "message";
- private static final Throwable CAUSE = new Throwable();
- private NoServiceInstanceFoundException NoObjectFoundException;
-
- @Test
- public void defaultConstructorTest() {
- NoObjectFoundException = new NoServiceInstanceFoundException();
- assertEquals(null, NoObjectFoundException.getMessage());
- assertEquals(null, NoObjectFoundException.getCause());
- }
-
- @Test
- public void messageConstructorTest() {
- NoObjectFoundException = new NoServiceInstanceFoundException(MESSAGE);
- assertEquals(MESSAGE, NoObjectFoundException.getMessage());
- assertEquals(null, NoObjectFoundException.getCause());
- }
-
- @Test
- public void causeConstructorTest() {
- NoObjectFoundException = new NoServiceInstanceFoundException(CAUSE);
- assertEquals(CAUSE.toString(), NoObjectFoundException.getMessage());
- assertEquals(CAUSE, NoObjectFoundException.getCause());
- }
-
- @Test
- public void messageAndCauseConstructorTest() {
- NoObjectFoundException = new NoServiceInstanceFoundException(MESSAGE, CAUSE);
- assertEquals(MESSAGE, NoObjectFoundException.getMessage());
- assertEquals(CAUSE, NoObjectFoundException.getCause());
- }
-
- @Test
- public void messageAndCauseAndFlagsConstructorTest() {
- NoObjectFoundException = new NoServiceInstanceFoundException(MESSAGE, CAUSE, true, true);
- assertEquals(MESSAGE, NoObjectFoundException.getMessage());
- assertEquals(CAUSE, NoObjectFoundException.getCause());
- }
+ private static final String MESSAGE = "message";
+ private static final Throwable CAUSE = new Throwable();
+ private NoServiceInstanceFoundException NoObjectFoundException;
+
+ @Test
+ public void defaultConstructorTest() {
+ NoObjectFoundException = new NoServiceInstanceFoundException();
+ assertEquals(null, NoObjectFoundException.getMessage());
+ assertEquals(null, NoObjectFoundException.getCause());
+ }
+
+ @Test
+ public void messageConstructorTest() {
+ NoObjectFoundException = new NoServiceInstanceFoundException(MESSAGE);
+ assertEquals(MESSAGE, NoObjectFoundException.getMessage());
+ assertEquals(null, NoObjectFoundException.getCause());
+ }
+
+ @Test
+ public void causeConstructorTest() {
+ NoObjectFoundException = new NoServiceInstanceFoundException(CAUSE);
+ assertEquals(CAUSE.toString(), NoObjectFoundException.getMessage());
+ assertEquals(CAUSE, NoObjectFoundException.getCause());
+ }
+
+ @Test
+ public void messageAndCauseConstructorTest() {
+ NoObjectFoundException = new NoServiceInstanceFoundException(MESSAGE, CAUSE);
+ assertEquals(MESSAGE, NoObjectFoundException.getMessage());
+ assertEquals(CAUSE, NoObjectFoundException.getCause());
+ }
+
+ @Test
+ public void messageAndCauseAndFlagsConstructorTest() {
+ NoObjectFoundException = new NoServiceInstanceFoundException(MESSAGE, CAUSE, true, true);
+ assertEquals(MESSAGE, NoObjectFoundException.getMessage());
+ assertEquals(CAUSE, NoObjectFoundException.getCause());
+ }
}
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
index 14a30391f9..cb98b1b603 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/ResponseExceptionMapperImplTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/ResponseExceptionMapperImplTest.java
@@ -22,11 +22,9 @@ package org.onap.so.client;
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;
@@ -38,85 +36,79 @@ 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.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
-
import junitparams.JUnitParamsRunner;
import junitparams.Parameters;
@RunWith(JUnitParamsRunner.class)
-public class ResponseExceptionMapperImplTest{
+public class ResponseExceptionMapperImplTest {
- private static final ResponseExceptionMapperImpl mapper = new ResponseExceptionMapperImpl();
+ 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},
- };
- }
+ 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},};
+ }
- @Rule
- public ExpectedException expectedExceptionTest = ExpectedException.none();
+ @Rule
+ public ExpectedException expectedExceptionTest = ExpectedException.none();
- @Test
- @Parameters(method = "statusesAndCorrespondingExceptions")
- public void shouldThrowExceptionWhenStatusIsNotOk(Status status, Class<Exception> expectedException) {
- // given
- Response response = createMockResponse(status);
- // when, then
- expectedExceptionTest.expect(expectedException);
- mapper.map(response);
- }
+ @Test
+ @Parameters(method = "statusesAndCorrespondingExceptions")
+ public void shouldThrowExceptionWhenStatusIsNotOk(Status status, Class<Exception> expectedException) {
+ // given
+ Response response = createMockResponse(status);
+ // when, then
+ expectedExceptionTest.expect(expectedException);
+ mapper.map(response);
+ }
+
+ @Test
+ public void shouldNotThrowExceptionWhenStatusIsOk() {
+ // given
+ Response response = createMockResponse(Status.OK);
+ // when, then
+ expectedExceptionTest.none();
+ mapper.map(response);
+ }
- @Test
- public void shouldNotThrowExceptionWhenStatusIsOk() {
- // given
- Response response = createMockResponse(Status.OK);
- // when, then
- expectedExceptionTest.none();
- mapper.map(response);
- }
-
@Test
public void shouldThrowExceptionWithCustomMessageWhenResponseHasEntity() throws UnsupportedEncodingException {
// given
- Response response = createMockResponse(Status.BAD_REQUEST);
+ Response response = createMockResponse(Status.BAD_REQUEST);
when(response.hasEntity()).thenReturn(true);
when(response.readEntity(String.class)).thenReturn("test message");
-
+
expectedExceptionTest.expect(BadRequestException.class);
expectedExceptionTest.expectMessage("test message");
- mapper.map(response);
+ mapper.map(response);
}
@Test
public void shouldThrowExceptionWithDefaultMessageWhenResponseHasNoEntity() {
// given
- Response response = createMockResponse(Status.BAD_REQUEST);
+ Response response = createMockResponse(Status.BAD_REQUEST);
when(response.hasEntity()).thenReturn(false);
// when, then
expectedExceptionTest.expect(BadRequestException.class);
expectedExceptionTest.expectMessage("");
- mapper.map(response);
+ mapper.map(response);
+ }
+
+ private static Response createMockResponse(Status status) {
+ Response responseContext = mock(Response.class);
+ when(responseContext.getStatusInfo()).thenReturn(status);
+ when(responseContext.getStatus()).thenReturn(status.getStatusCode());
+ return responseContext;
}
-
- 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
index 2f65f9ce66..32db3a7bf6 100644
--- 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
@@ -26,11 +26,9 @@ 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;
@@ -43,420 +41,444 @@ import org.onap.so.BaseTest;
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<String> payload = Optional.empty();
- Optional<String> vserverId = Optional.empty();
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- payloadInfo.put("vnfName", "testVnfName");
- String controllerType = "testControllerType";
-
- //Prepare mocks
- Status status = new Status();
- Optional<String> 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<String> payload = Optional.empty();
- Optional<String> vserverId = Optional.empty();
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- payloadInfo.put("vnfName", "testVnfName");
- String controllerType = "testControllerType";
-
- //Prepare mocks
- Status status = new Status();
- Optional<String> 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<String> payload = Optional.empty();
- Optional<String> vserverId = Optional.empty();
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- String controllerType = "testControllerType";
-
- //Prepare mocks
- Status status = new Status();
- Optional<String> 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<String> payload = Optional.of("testPayload");
- Optional<String> vserverId = Optional.empty();
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- payloadInfo.put("vnfName", "testVnfName");
- String controllerType = "testControllerType";
-
- //Prepare mocks
- Status status = new Status();
- Optional<String> 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<String> payload = Optional.empty();
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- 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<String> payload = Optional.empty();
- Optional<String> vserverId = Optional.empty();
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- payloadInfo.put("vnfName", "testVnfName");
- payloadInfo.put("vnfHostIpAddress", "testVnfHostIpAddress");
- String controllerType = "testControllerType";
-
- //Prepare mocks
- Status status = new Status();
- Optional<String> 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<String> payload = Optional.empty();
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- payloadInfo.put("identityUrl", "testIdentityUrl");
- ArrayList<String> vmIdList = new ArrayList<String>();
- 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<String> vserverIdList = new ArrayList<String>();
- String vserverId1 = "testVserverId1";
- Optional<String> vserverIdString1 = Optional.of(vserverId1);
- vserverIdList.add(vserverId1);
- String vserverId2 = "testVserverId2";
- Optional<String> 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<String> otherPayloadVm1 = PayloadClient.snapshotFormat(vmId1, payloadInfo.get("identityUrl"));
- Optional<String> 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<String> payload = Optional.of("testPayload");
- Optional<String> vserverId = Optional.empty();
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- 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<String> payload = Optional.empty();
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- 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<String> payload = Optional.of("testPayload");
- Optional<String> vserverId = Optional.empty();
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- payloadInfo.put("vnfName", "testVnfName");
- String controllerType = "testControllerType";
-
- //Prepare mocks
- Status status = new Status();
- Optional<String> 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<String> payload = Optional.empty();
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- 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<String> payload = Optional.empty();
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- 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<String> payload = Optional.empty();
- Optional<String> vserverId = Optional.empty();
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- payloadInfo.put("vnfName", "testVnfName");
- String controllerType = "testControllerType";
-
- //Prepare mocks
- Status status = new Status();
- status.setCode(100);
- Optional<String> 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<String> payload = Optional.empty();
- Optional<String> vserverId = Optional.empty();
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- payloadInfo.put("vnfName", "testVnfName");
- String controllerType = "testControllerType";
-
- //Prepare mocks
- Optional<String> 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());
- }
-
+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<String> payload = Optional.empty();
+ Optional<String> vserverId = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", "testVnfName");
+ String controllerType = "testControllerType";
+
+ // Prepare mocks
+ Status status = new Status();
+ Optional<String> 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<String> payload = Optional.empty();
+ Optional<String> vserverId = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", "testVnfName");
+ String controllerType = "testControllerType";
+
+ // Prepare mocks
+ Status status = new Status();
+ Optional<String> 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<String> payload = Optional.empty();
+ Optional<String> vserverId = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ String controllerType = "testControllerType";
+
+ // Prepare mocks
+ Status status = new Status();
+ Optional<String> 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<String> payload = Optional.of("testPayload");
+ Optional<String> vserverId = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", "testVnfName");
+ String controllerType = "testControllerType";
+
+ // Prepare mocks
+ Status status = new Status();
+ Optional<String> 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<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ 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<String> payload = Optional.empty();
+ Optional<String> vserverId = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", "testVnfName");
+ payloadInfo.put("vnfHostIpAddress", "testVnfHostIpAddress");
+ String controllerType = "testControllerType";
+
+ // Prepare mocks
+ Status status = new Status();
+ Optional<String> 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<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("identityUrl", "testIdentityUrl");
+ ArrayList<String> vmIdList = new ArrayList<String>();
+ 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<String> vserverIdList = new ArrayList<String>();
+ String vserverId1 = "testVserverId1";
+ Optional<String> vserverIdString1 = Optional.of(vserverId1);
+ vserverIdList.add(vserverId1);
+ String vserverId2 = "testVserverId2";
+ Optional<String> 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<String> otherPayloadVm1 = PayloadClient.snapshotFormat(vmId1, payloadInfo.get("identityUrl"));
+ Optional<String> 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<String> payload = Optional.of("testPayload");
+ Optional<String> vserverId = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ 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<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ 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<String> payload = Optional.of("testPayload");
+ Optional<String> vserverId = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", "testVnfName");
+ String controllerType = "testControllerType";
+
+ // Prepare mocks
+ Status status = new Status();
+ Optional<String> 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<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ 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<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ 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<String> payload = Optional.empty();
+ Optional<String> vserverId = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", "testVnfName");
+ String controllerType = "testControllerType";
+
+ // Prepare mocks
+ Status status = new Status();
+ status.setCode(100);
+ Optional<String> 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<String> payload = Optional.empty();
+ Optional<String> vserverId = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", "testVnfName");
+ String controllerType = "testControllerType";
+
+ // Prepare mocks
+ Optional<String> 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
index 77daee6050..c242017838 100644
--- 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
@@ -35,96 +35,98 @@ 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
+ ApplicationControllerSupport applicationControllerSupport;
+
+ @Mock
+ ApplicationControllerConfiguration applicationControllerConfiguration;
+
+ @InjectMocks
+ ApplicationControllerClientV2 client;
+
- @Mock
- ApplicationControllerConfiguration applicationControllerConfiguration;
+ @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();
+ }
- @InjectMocks
- ApplicationControllerClientV2 client;
+ @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");
+ }
- @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_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 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");
- }
+ @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
index b388d8ba0a..9a7e1716cd 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -31,54 +30,39 @@ import junitparams.JUnitParamsRunner;
import junitparams.Parameters;
@RunWith(JUnitParamsRunner.class)
-public class ApplicationControllerSupportTest{
+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[][] 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},
- };
- }
+ 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 = "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);
- }
+ @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
+ private Status createStatus(int code) {
+ Status status = new Status();
+ status.setCode(code);
+ return status;
+ }
+}
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
index 30ab21b2dd..cb0d31b8ff 100644
--- 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
@@ -21,13 +21,10 @@
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;
@@ -39,28 +36,22 @@ 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{
+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";
+ 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<PojoClass> pojoClasses = PojoClassFactory.getPojoClasses( POJO_PACKAGE,
- new FilterPackageInfo());
- Affirm.affirmEquals("Classes added / removed?", EXPECTED_CLASS_COUNT, pojoClasses.size());
- }
+ @Test
+ public void ensureExpectedPojoCount() {
+ List<PojoClass> 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();
+ @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());
- }
+ validator.validate(POJO_PACKAGE, new FilterPackageInfo());
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java
index 161f879716..f558932d33 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java
@@ -26,9 +26,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-
import java.util.UUID;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.junit.Before;
import org.junit.Test;
@@ -49,8 +47,9 @@ public class AbstractCDSProcessingBBUtilsTest {
ExceptionBuilder exceptionUtil;
@Before
- public void init(){
- String requestObject = "{\"config-assign-request\":{\"resolution-key\":\"resolutionKey\", \"config-assign-properties\":{\"service-instance-id\":\"serviceInstanceId\", \"vnf-id\":\"vnfId\", \"vnf-name\":\"vnfName\", \"service-model-uuid\":\"serviceModelUuid\", \"vnf-customization-uuid\":\"vnfCustomizationUuid\",\"Instance1\":\"Instance1Value\",\"Instance2\":\"Instance2Value\",\"Param3\":\"Param3Value\"}}}";
+ public void init() {
+ String requestObject =
+ "{\"config-assign-request\":{\"resolution-key\":\"resolutionKey\", \"config-assign-properties\":{\"service-instance-id\":\"serviceInstanceId\", \"vnf-id\":\"vnfId\", \"vnf-name\":\"vnfName\", \"service-model-uuid\":\"serviceModelUuid\", \"vnf-customization-uuid\":\"vnfCustomizationUuid\",\"Instance1\":\"Instance1Value\",\"Instance2\":\"Instance2Value\",\"Param3\":\"Param3Value\"}}}";
String blueprintName = "blueprintName";
String blueprintVersion = "blueprintVersion";
String actionName = "actionName";
@@ -76,8 +75,8 @@ public class AbstractCDSProcessingBBUtilsTest {
when(execution.getVariable("executionObject")).thenReturn(abstractCDSPropertiesBean);
abstractCDSProcessingBBUtils.constructExecutionServiceInputObject(execution);
- verify(exceptionUtil, times(0))
- .buildAndThrowWorkflowException(any(DelegateExecution.class), anyInt(), any(Exception.class));
+ verify(exceptionUtil, times(0)).buildAndThrowWorkflowException(any(DelegateExecution.class), anyInt(),
+ any(Exception.class));
}
@Test
@@ -86,8 +85,8 @@ public class AbstractCDSProcessingBBUtilsTest {
DelegateExecution execution = mock(DelegateExecution.class);
when(execution.getVariable("executionServiceInput")).thenReturn(abstractCDSPropertiesBean);
abstractCDSProcessingBBUtils.sendRequestToCDSClient(execution);
- verify(exceptionUtil, times(1))
- .buildAndThrowWorkflowException(any(DelegateExecution.class), anyInt(), any(Exception.class));
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(DelegateExecution.class), anyInt(),
+ any(Exception.class));
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnfTest.java
index c294124e69..3eadd800ad 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnfTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnfTest.java
@@ -2,10 +2,8 @@ package org.onap.so.client.cds.beans;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-
import java.util.HashMap;
import java.util.Map;
-
import org.junit.Test;
public class ConfigAssignPropertiesForPnfTest {
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnfTest.java
index 8b732af6d0..4b91cdf803 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnfTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnfTest.java
@@ -2,10 +2,8 @@ package org.onap.so.client.cds.beans;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-
import java.util.HashMap;
import java.util.Map;
-
import org.junit.Test;
public class ConfigAssignPropertiesForVnfTest {
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnfTest.java
index e4f062ad05..da82721e5e 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnfTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnfTest.java
@@ -2,10 +2,8 @@ package org.onap.so.client.cds.beans;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-
import java.util.HashMap;
import java.util.Map;
-
import org.junit.Test;
public class ConfigAssignRequestPnfTest {
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnfTest.java
index ad3af47453..a73fa6c01e 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnfTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnfTest.java
@@ -2,10 +2,8 @@ package org.onap.so.client.cds.beans;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-
import java.util.HashMap;
import java.util.Map;
-
import org.junit.Test;
public class ConfigAssignRequestVnfTest {
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnfTest.java
index 8e16ce6337..771196d53c 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnfTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnfTest.java
@@ -2,7 +2,6 @@ package org.onap.so.client.cds.beans;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-
import org.junit.Before;
import org.junit.Test;
@@ -18,7 +17,7 @@ public class ConfigDeployPropertiesForPnfTest {
private static final String TEST_SERVICE_INSTANCE_ID = "service-instance-id";
@Before
- public void setUp(){
+ public void setUp() {
configDeployPropertiesForPnf.setServiceInstanceId(TEST_SERVICE_INSTANCE_ID);
configDeployPropertiesForPnf.setServiceModelUuid(TEST_SERVICE_MODEL_UUID);
configDeployPropertiesForPnf.setPnfCustomizationUuid(TEST_PNF_CUSTOMIZATION_UUID);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnfTest.java
index 47c59b93e9..6039bd649c 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnfTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnfTest.java
@@ -2,7 +2,6 @@ package org.onap.so.client.cds.beans;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-
import org.junit.Test;
public class ConfigDeployPropertiesForVnfTest {
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnfTest.java
index df41bf23b8..a977f8dd9e 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnfTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnfTest.java
@@ -2,7 +2,6 @@ package org.onap.so.client.cds.beans;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-
import org.junit.Test;
public class ConfigDeployRequestPnfTest {
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnfTest.java
index f771710f8b..4b86eeb438 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnfTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnfTest.java
@@ -2,7 +2,6 @@ package org.onap.so.client.cds.beans;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-
import org.junit.Test;
public class ConfigDeployRequestVnfTest {
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
index 886025cb51..a6b97d086e 100644
--- 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
@@ -28,10 +28,8 @@ 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 org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -41,61 +39,63 @@ import org.onap.so.client.avpn.dmaap.beans.AVPNDmaapBean;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.dmaapproperties.GlobalDmaapPublisher;
import org.springframework.beans.factory.annotation.Autowired;
-
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-public class DmaapPropertiesClientTest extends BaseTest{
-
- @Autowired
- private DmaapPropertiesClient dmaapPropertiesClient;
+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 {
+ DmaapPropertiesClient client = Mockito.spy(DmaapPropertiesClient.class);
+ GlobalDmaapPublisher mockedClientDmaapPublisher = Mockito.mock(GlobalDmaapPublisher.class);
+ AVPNDmaapBean mockedDmaapBean = Mockito.mock(AVPNDmaapBean.class);
+ String request = "test";
+ doReturn(mockedDmaapBean).when(client).buildRequestJson(requestId, clientSource, correlator, serviceInstanceId,
+ startTime, finishTime, requestScope, requestType, timestamp, requestState, statusMessage,
+ percentProgress, false);
- 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 actualDmaapBean =
+ client.buildRequestJson(requestId, clientSource, correlator, serviceInstanceId, startTime, finishTime,
+ requestScope, requestType, timestamp, requestState, statusMessage, percentProgress, false);
+ mockedClientDmaapPublisher.send(request);
- AVPNDmaapBean expected = new ObjectMapper().readValue(new File(file), AVPNDmaapBean.class);
+ doNothing().when(mockedClientDmaapPublisher).send(anyString());
- assertNotNull(actualBean);
- assertThat(actualBean, sameBeanAs(expected));
- }
+ verify(client, times(1)).buildRequestJson(requestId, clientSource, correlator, serviceInstanceId, startTime,
+ finishTime, requestScope, requestType, timestamp, requestState, statusMessage, percentProgress, false);
+ verify(mockedClientDmaapPublisher, times(1)).send(request);
- @Test
- public void testDmaapPublishRequest() throws JsonProcessingException, MapperException {
- DmaapPropertiesClient client = Mockito.spy(DmaapPropertiesClient.class);
- GlobalDmaapPublisher mockedClientDmaapPublisher = Mockito.mock(GlobalDmaapPublisher.class);
- AVPNDmaapBean mockedDmaapBean = Mockito.mock(AVPNDmaapBean.class);
- String request = "test";
-
- doReturn(mockedDmaapBean).when(client).buildRequestJson(requestId, clientSource, correlator, serviceInstanceId, startTime, finishTime, requestScope,
- requestType, timestamp, requestState, statusMessage, percentProgress, false);
-
- AVPNDmaapBean actualDmaapBean = client.buildRequestJson(requestId, clientSource, correlator, serviceInstanceId, startTime, finishTime, requestScope,
- requestType, timestamp, requestState, statusMessage, percentProgress, false);
- mockedClientDmaapPublisher.send(request);
-
- doNothing().when(mockedClientDmaapPublisher).send(anyString());
-
- verify(client, times(1)).buildRequestJson(requestId, clientSource, correlator, serviceInstanceId, startTime,
- finishTime, requestScope, requestType, timestamp, requestState, statusMessage, percentProgress, false);
- verify(mockedClientDmaapPublisher, times(1)).send(request);
-
- assertNotNull(actualDmaapBean);
- }
+ assertNotNull(actualDmaapBean);
+ }
}
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
index 088b01873c..b71d5f9113 100644
--- 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
@@ -21,27 +21,28 @@
package org.onap.so.client.dmaapproperties;
import static org.junit.Assert.assertEquals;
-
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.so.BaseTest;
import org.springframework.beans.factory.annotation.Autowired;
-public class GlobalDmaapPublisherTest extends BaseTest{
+public class GlobalDmaapPublisherTest extends BaseTest {
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ System.setProperty("mso.global.dmaap.host", "http://test:1234");
+ }
+
+ @Autowired
+ private GlobalDmaapPublisher globalDmaapPublisher;
- @BeforeClass
- public static void setUp() throws Exception {
- System.setProperty("mso.global.dmaap.host", "http://test:1234");
- }
-
- @Autowired
- private GlobalDmaapPublisher globalDmaapPublisher;
-
- @Test
- public void testGetters() {
- assertEquals("81B7E3533B91A6706830611FB9A8ECE529BBCCE754B1F1520FA7C8698B42F97235BEFA993A387E664D6352C63A6185D68DA7F0B1D360637CBA102CB166E3E62C11EB1F75386D3506BCECE51E54", globalDmaapPublisher.getAuth());
- assertEquals("07a7159d3bf51a0e53be7a8f89699be7", globalDmaapPublisher.getKey());
- assertEquals("com.att.mso.asyncStatusUpdate", globalDmaapPublisher.getTopic());
- assertEquals("http://test:1234", globalDmaapPublisher.getHost().get());
- }
+ @Test
+ public void testGetters() {
+ assertEquals(
+ "81B7E3533B91A6706830611FB9A8ECE529BBCCE754B1F1520FA7C8698B42F97235BEFA993A387E664D6352C63A6185D68DA7F0B1D360637CBA102CB166E3E62C11EB1F75386D3506BCECE51E54",
+ globalDmaapPublisher.getAuth());
+ assertEquals("07a7159d3bf51a0e53be7a8f89699be7", globalDmaapPublisher.getKey());
+ assertEquals("com.att.mso.asyncStatusUpdate", globalDmaapPublisher.getTopic());
+ assertEquals("http://test:1234", 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
index 2e25449937..ef066853ca 100644
--- 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
@@ -29,49 +29,52 @@ import org.onap.so.BaseTest;
public class ExceptionBuilderTest extends BaseTest {
- private static final String RESOURCE_PATH = "__files/";
- private static final String VALID_ERROR_MESSAGE = "{test error message}";
+ 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 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());
- }
- }
+ @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
index 2e74d443bd..0d6fede4bf 100644
--- 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
@@ -21,30 +21,28 @@
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{
+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);
+ }
- 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);
- }
+ @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
index d1de702a81..528e4f99cb 100644
--- 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
@@ -21,32 +21,30 @@
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);
- }
+
+
+ @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/ThreadedReadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java
index 08c92d33f0..badf444fc6 100644
--- 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
@@ -22,7 +22,6 @@ 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;
@@ -34,71 +33,70 @@ 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.client.RestPropertiesLoader;
import org.onap.so.client.aai.AAIProperties;
import org.onap.so.BaseTest;
public class ThreadedReadTest {
- @Test
- public void allAtOnce() throws InterruptedException {
- ExecutorService executorService = Executors.newFixedThreadPool(10);
-
- Callable<AAIProperties> callableTask = () -> {
- return RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class);
- };
- List<Callable<AAIProperties>> callableTasks = new ArrayList<>();
-
- callableTasks.add(callableTask);
- callableTasks.add(callableTask);
- callableTasks.add(callableTask);
- callableTasks.add(callableTask);
- callableTasks.add(callableTask);
-
- List<Future<AAIProperties>> futures = executorService.invokeAll(callableTasks);
-
- Set<AAIProperties> 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<AAIProperties> callableTask = () -> {
- TimeUnit.MILLISECONDS.sleep(500);
- return RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class);
- };
- List<Callable<AAIProperties>> callableTasks = new ArrayList<>();
-
- callableTasks.add(callableTask);
- callableTasks.add(callableTask);
- callableTasks.add(callableTask);
- callableTasks.add(callableTask);
- callableTasks.add(callableTask);
-
- Set<AAIProperties> results = new HashSet<>();
- callableTasks.forEach(callable -> {
- try {
- TimeUnit.MILLISECONDS.sleep(300);
- Future<AAIProperties> 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()));
- }
-
+ @Test
+ public void allAtOnce() throws InterruptedException {
+ ExecutorService executorService = Executors.newFixedThreadPool(10);
+
+ Callable<AAIProperties> callableTask = () -> {
+ return RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class);
+ };
+ List<Callable<AAIProperties>> callableTasks = new ArrayList<>();
+
+ callableTasks.add(callableTask);
+ callableTasks.add(callableTask);
+ callableTasks.add(callableTask);
+ callableTasks.add(callableTask);
+ callableTasks.add(callableTask);
+
+ List<Future<AAIProperties>> futures = executorService.invokeAll(callableTasks);
+
+ Set<AAIProperties> 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<AAIProperties> callableTask = () -> {
+ TimeUnit.MILLISECONDS.sleep(500);
+ return RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class);
+ };
+ List<Callable<AAIProperties>> callableTasks = new ArrayList<>();
+
+ callableTasks.add(callableTask);
+ callableTasks.add(callableTask);
+ callableTasks.add(callableTask);
+ callableTasks.add(callableTask);
+ callableTasks.add(callableTask);
+
+ Set<AAIProperties> results = new HashSet<>();
+ callableTasks.forEach(callable -> {
+ try {
+ TimeUnit.MILLISECONDS.sleep(300);
+ Future<AAIProperties> 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/onap/so/test/categories/SpringAware.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/test/categories/SpringAware.java
index 21035fcd4d..2462e678d9 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/test/categories/SpringAware.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/test/categories/SpringAware.java
@@ -21,5 +21,5 @@
package org.onap.so.test.categories;
public interface SpringAware {
- /* category marker */
+ /* category marker */
}
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
index 3002d0e70a..7bf1a108a0 100644
--- 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
@@ -22,31 +22,28 @@ package org.onap.so.bpmn.core;
public class BadInjectedFieldException extends RuntimeException {
- private static final long serialVersionUID = 1L;
+ 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
+ */
+ 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);
- }
+ /**
+ * 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
index 99157410d5..2e66493a25 100644
--- 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
@@ -31,31 +31,25 @@ import org.onap.so.bpmn.core.internal.VariableNameExtractor;
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.
+ * 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) {
+ 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:
+ * Gets the value of an optional field. There are three conditions in which this method returns null:
* <p>
* <ol>
- * <li> The expression itself is null (i.e. the field is missing
- * altogether.</li>
+ * <li>The expression itself is null (i.e. the field is missing altogether.</li>
* <li>The expression evaluates to a null value.</li>
- * <li>The expression references a single variable which has not
- * been set.</li>
+ * <li>The expression references a single variable which has not been set.</li>
* </ol>
* <p>
* Examples:<br>
@@ -68,77 +62,65 @@ public class BaseTask implements JavaDelegate {
* @param fieldName the field name (for logging and exceptions)
* @return the field value, possibly null
*/
- protected Object getOptionalField(Expression expression,
- DelegateExecution execution, String fieldName) {
+ 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 ('_').
+ * 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) {
+ 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");
+ 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());
+ 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 ('_').
+ * 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) {
+ 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");
+ 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());
+ 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.
+ * 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.
* <p>
* Note: the result is coerced to a string value, if necessary.
*
@@ -147,28 +129,23 @@ public class BaseTask implements JavaDelegate {
* @param fieldName the field name (for logging and exceptions)
* @return the field value
*/
- protected String getStringField(Expression expression,
- DelegateExecution execution, String fieldName) {
+ 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");
+ 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:
+ * Gets the value of an optional string field. There are three conditions in which this method returns null:
* <p>
* <ol>
- * <li> The expression itself is null (i.e. the field is missing
- * altogether.</li>
+ * <li>The expression itself is null (i.e. the field is missing altogether.</li>
* <li>The expression evaluates to a null value.</li>
- * <li>The expression references a single variable which has not
- * been set.</li>
+ * <li>The expression references a single variable which has not been set.</li>
* </ol>
* <p>
* Examples:<br>
@@ -183,8 +160,7 @@ public class BaseTask implements JavaDelegate {
* @param fieldName the field name (for logging and exceptions)
* @return the field value, possibly null
*/
- protected String getOptionalStringField(Expression expression,
- DelegateExecution execution, String fieldName) {
+ protected String getOptionalStringField(Expression expression, DelegateExecution execution, String fieldName) {
Object o = getFieldImpl(expression, execution, fieldName, true);
if (o instanceof String) {
return (String) o;
@@ -196,18 +172,16 @@ public class BaseTask implements JavaDelegate {
}
/**
- * 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.
+ * 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) {
+ protected Integer getIntegerField(Expression expression, DelegateExecution execution, String fieldName) {
Object o = getFieldImpl(expression, execution, fieldName, false);
if (o instanceof Integer) {
return (Integer) o;
@@ -215,23 +189,19 @@ public class BaseTask implements JavaDelegate {
try {
return Integer.parseInt(o.toString());
} catch (NumberFormatException e) {
- throw new BadInjectedFieldException(
- fieldName, getTaskName(), "cannot convert '" + o.toString()
- + "' to Integer");
+ 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:
+ * Gets the value of an optional integer field. There are three conditions in which this method returns null:
* <p>
* <ol>
- * <li> The expression itself is null (i.e. the field is missing
- * altogether.</li>
+ * <li>The expression itself is null (i.e. the field is missing altogether.</li>
* <li>The expression evaluates to a null value.</li>
- * <li>The expression references a single variable which has not
- * been set.</li>
+ * <li>The expression references a single variable which has not been set.</li>
* </ol>
* <p>
* Examples:<br>
@@ -239,17 +209,15 @@ public class BaseTask implements JavaDelegate {
* Expression ${x} when x is unset: return null<br>
* Expression ${x+y} when x and/or y are unset: exception<br>
* <p>
- * Note: the result is coerced to an integer value, if necessary. This
- * method throws BadInjectedFieldException if the result cannot be coerced
- * to an integer.
+ * 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) {
+ protected Integer getOptionalIntegerField(Expression expression, DelegateExecution execution, String fieldName) {
Object o = getFieldImpl(expression, execution, fieldName, true);
if (o instanceof Integer) {
return (Integer) o;
@@ -259,23 +227,19 @@ public class BaseTask implements JavaDelegate {
try {
return Integer.parseInt(o.toString());
} catch (NumberFormatException e) {
- throw new BadInjectedFieldException(
- fieldName, getTaskName(), "cannot convert '" + o.toString()
- + "' to Integer");
+ 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:
+ * Gets the value of an optional long field. There are three conditions in which this method returns null:
* <p>
* <ol>
- * <li> The expression itself is null (i.e. the field is missing
- * altogether.</li>
+ * <li>The expression itself is null (i.e. the field is missing altogether.</li>
* <li>The expression evaluates to a null value.</li>
- * <li>The expression references a single variable which has not
- * been set.</li>
+ * <li>The expression references a single variable which has not been set.</li>
* </ol>
* <p>
* Examples:<br>
@@ -283,17 +247,15 @@ public class BaseTask implements JavaDelegate {
* Expression ${x} when x is unset: return null<br>
* Expression ${x+y} when x and/or y are unset: exception<br>
* <p>
- * Note: the result is coerced to a long value, if necessary. This
- * method throws BadInjectedFieldException if the result cannot be coerced
- * to a long.
+ * 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) {
+ protected Long getOptionalLongField(Expression expression, DelegateExecution execution, String fieldName) {
Object o = getFieldImpl(expression, execution, fieldName, true);
if (o instanceof Long) {
return (Long) o;
@@ -303,26 +265,23 @@ public class BaseTask implements JavaDelegate {
try {
return Long.parseLong(o.toString());
} catch (NumberFormatException e) {
- throw new BadInjectedFieldException(
- fieldName, getTaskName(), "cannot convert '" + o.toString()
- + "' to Long");
+ 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.
+ * 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) {
+ protected Long getLongField(Expression expression, DelegateExecution execution, String fieldName) {
Object o = getFieldImpl(expression, execution, fieldName, false);
if (o instanceof Long) {
return (Long) o;
@@ -330,9 +289,8 @@ public class BaseTask implements JavaDelegate {
try {
return Long.parseLong(o.toString());
} catch (NumberFormatException e) {
- throw new BadInjectedFieldException(
- fieldName, getTaskName(), "cannot convert '" + o.toString()
- + "' to Long");
+ throw new BadInjectedFieldException(fieldName, getTaskName(),
+ "cannot convert '" + o.toString() + "' to Long");
}
}
}
@@ -346,12 +304,11 @@ public class BaseTask implements JavaDelegate {
* @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) {
+ private Object getFieldImpl(Expression expression, DelegateExecution execution, String fieldName,
+ boolean optional) {
if (expression == null) {
if (!optional) {
- throw new MissingInjectedFieldException(
- fieldName, getTaskName());
+ throw new MissingInjectedFieldException(fieldName, getTaskName());
}
return null;
}
@@ -362,8 +319,7 @@ public class BaseTask implements JavaDelegate {
value = expression.getValue(execution);
} catch (Exception e) {
if (!optional) {
- throw new BadInjectedFieldException(
- fieldName, getTaskName(), e.getClass().getSimpleName(), e);
+ throw new BadInjectedFieldException(fieldName, getTaskName(), e.getClass().getSimpleName(), e);
}
// At this point, we have an exception that occurred while
@@ -373,7 +329,7 @@ public class BaseTask implements JavaDelegate {
// ${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
+ // 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.
@@ -382,15 +338,13 @@ public class BaseTask implements JavaDelegate {
String s = expression.getExpressionText();
new VariableNameExtractor(s).extract().ifPresent(name -> {
if (execution.hasVariable(name)) {
- throw new BadInjectedFieldException(
- fieldName, getTaskName(), e.getClass().getSimpleName(), e);
+ throw new BadInjectedFieldException(fieldName, getTaskName(), e.getClass().getSimpleName(), e);
}
});
}
if (value == null && !optional) {
- throw new BadInjectedFieldException(
- fieldName, getTaskName(), "required field has null value");
+ throw new BadInjectedFieldException(fieldName, getTaskName(), "required field has null value");
}
return value;
@@ -449,6 +403,5 @@ public class BaseTask implements JavaDelegate {
}
@Override
- public void execute(DelegateExecution execution) throws Exception {
- }
+ 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
index 17a78d37b8..f0b56364af 100644
--- 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
@@ -25,15 +25,15 @@ package org.onap.so.bpmn.core;
*/
public class MissingInjectedFieldException extends BadInjectedFieldException {
- private static final long serialVersionUID = 1L;
+ 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");
- }
+ /**
+ * 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
index fb794e251d..a3f5253765 100644
--- 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
@@ -27,11 +27,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * 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!
+ * 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!
* <p>
* OUTPUT MAPPING
+ *
* <pre>
* SOURCE EXPRESSION TARGET
* ${ResponseBuilder.buildWorkflowException(execution)} WorkflowException
@@ -39,254 +39,254 @@ import org.slf4j.LoggerFactory;
* </pre>
*/
public class ResponseBuilder implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
- private static final Logger logger = LoggerFactory.getLogger(ResponseBuilder.class);
-
- /**
- * 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() +
- ")";
-
- logger.debug("Entered " + method);
-
- String prefix = (String) execution.getVariable("prefix");
- String processKey = getProcessKey(execution);
-
- logger.debug("processKey=" + processKey);
-
- // See if there"s already a WorkflowException object in the execution.
- WorkflowException theException = (WorkflowException) execution.getVariable("WorkflowException");
-
- if (theException != null) {
- logger.debug("Exited " + method + " - propagated " + theException);
- 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);
- logger.debug("errorResponse=" + errorResponse);
- logger.debug("responseCode=" + responseCode);
- 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) {
- logger.debug("xmlErrorMessage=" + xmlErrorMessage);
- logger.debug("xmlErrorCode=" + xmlErrorCode);
-
- 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);
- logger.debug("Exited " + method + " - created " + theException);
- return theException;
- }
-
- logger.debug("Exited " + method + " - no WorkflowException");
- 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() +
- ")";
- logger.debug("Entered " + method);
-
- 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");
- }
- }
-
- logger.debug("Exited " + method);
- 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();
- }
-
- /**
- * 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("(</)(\\w+:)(.*?>)", "$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. "<name>"
- * @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);
- }
+ private static final long serialVersionUID = 1L;
+ private static final Logger logger = LoggerFactory.getLogger(ResponseBuilder.class);
+
+ /**
+ * 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() + ")";
+
+ logger.debug("Entered " + method);
+
+ String prefix = (String) execution.getVariable("prefix");
+ String processKey = getProcessKey(execution);
+
+ logger.debug("processKey=" + processKey);
+
+ // See if there"s already a WorkflowException object in the execution.
+ WorkflowException theException = (WorkflowException) execution.getVariable("WorkflowException");
+
+ if (theException != null) {
+ logger.debug("Exited " + method + " - propagated " + theException);
+ 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);
+ logger.debug("errorResponse=" + errorResponse);
+ logger.debug("responseCode=" + responseCode);
+ 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) {
+ logger.debug("xmlErrorMessage=" + xmlErrorMessage);
+ logger.debug("xmlErrorCode=" + xmlErrorCode);
+
+ 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);
+ logger.debug("Exited " + method + " - created " + theException);
+ return theException;
+ }
+
+ logger.debug("Exited " + method + " - no WorkflowException");
+ 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() + ")";
+ logger.debug("Entered " + method);
+
+ 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");
+ }
+ }
+
+ logger.debug("Exited " + method);
+ 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();
+ }
+
+ /**
+ * 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("(</)(\\w+:)(.*?>)", "$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. "<name>"
+ * @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
index 52207f2156..68ce85f7df 100644
--- 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
@@ -24,13 +24,11 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
-
import com.fasterxml.jackson.annotation.JsonProperty;
/**
- * 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.
+ * 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 {
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
index 0c88e3ed88..78a73c5a10 100644
--- 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
@@ -23,7 +23,6 @@
package org.onap.so.bpmn.core;
import java.util.Optional;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,31 +42,30 @@ public class UrnPropertiesReader {
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
+ 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.
+ * @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, {}, from the execution object: {}", variableName,
- String.valueOf(value));
+ 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, {}, from the environment variable: {}", variableName,
- variableValue);
+ variableValue);
execution.setVariable(variableName, variableValue);
return variableValue;
}
@@ -80,33 +78,35 @@ public class UrnPropertiesReader {
/**
* Return the URN property value from the environment object
+ *
* @param variableName URN property name
* @return URN property value
*/
- public static String getVariable(String variableName){
+ public static String getVariable(String variableName) {
if (environment != null) {
return environment.getProperty(variableName);
} else {
return null;
}
}
-
+
/**
* Return the String array URN property value from the environment object
+ *
* @param variableName URN property name
* @return URN property value
*/
- public static String[] getVariablesArray(String variableName){
+ public static String[] getVariablesArray(String variableName) {
if (environment != null) {
return environment.getProperty(variableName, String[].class);
} else {
return null;
}
}
-
+
public static String getVariable(String variableName, String defaultValue) {
- return Optional.ofNullable(getVariable(variableName)).orElse(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
index 8551007795..1692045d33 100644
--- 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
@@ -26,69 +26,68 @@ import java.io.Serializable;
* An object that represents a workflow exception.
*/
public class WorkflowException implements Serializable {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- private final String processKey;
- private final int errorCode;
- private final String errorMessage;
- private final String workStep;
+ 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;
- }
+ /**
+ * 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 = "*";
+ }
- /**
- * Returns the process key.
- */
- public String getProcessKey() {
- return processKey;
- }
+ public WorkflowException(String processKey, int errorCode, String errorMessage, String workStep) {
+ this.processKey = processKey;
+ this.errorCode = errorCode;
+ this.errorMessage = errorMessage;
+ this.workStep = workStep;
+ }
- /**
- * Returns the error code.
- */
- public int getErrorCode() {
- return errorCode;
- }
+ /**
+ * Returns the process key.
+ */
+ public String getProcessKey() {
+ return processKey;
+ }
- /**
- * Returns the error message.
- */
- public String getErrorMessage() {
- return errorMessage;
- }
-
- /**
- * Returns the error message.
- */
- public String getWorkStep() {
- return workStep;
- }
+ /**
+ * Returns the error code.
+ */
+ public int getErrorCode() {
+ return errorCode;
+ }
- /**
- * Returns a string representation of this object.
- */
+ /**
+ * 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() + "]";
- }
+ 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
index c7c7bba20c..841eaee675 100644
--- 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
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.core.domain;
import java.util.UUID;
-
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonRootName;
@@ -33,104 +32,122 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@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;
-
- @JsonIgnore
- private String resourceInput;
-
- /*
- * 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 String getResourceInput() {
- return resourceInput;
- }
-
- public void setResourceInput(String resourceInput) {
- this.resourceInput = resourceInput;
- }
-} \ No newline at end of file
+ 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;
+
+ @JsonIgnore
+ private String resourceInput;
+
+ /*
+ * 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 String getResourceInput() {
+ return resourceInput;
+ }
+
+ public void setResourceInput(String resourceInput) {
+ this.resourceInput = resourceInput;
+ }
+}
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
index d021394731..7afd864062 100644
--- 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
@@ -23,31 +23,35 @@ 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;
-
- private List<ResourceModelInfo> addedResourceList;
- private List<ResourceModelInfo> deletedResourceList;
- private List<String> requestInputs;
-
- public List<ResourceModelInfo> getAddedResourceList() {
- return addedResourceList;
- }
- public void setAddedResourceList(List<ResourceModelInfo> addedResourceList) {
- this.addedResourceList = addedResourceList;
- }
- public List<ResourceModelInfo> getDeletedResourceList() {
- return deletedResourceList;
- }
- public void setDeletedResourceList(List<ResourceModelInfo> deletedResourceList) {
- this.deletedResourceList = deletedResourceList;
- }
- public List<String> getRequestInputs() {
- return requestInputs;
- }
- public void setRequestInputs(List<String> requestInputs) {
- this.requestInputs = requestInputs;
- }
+public class CompareModelsResult extends JsonWrapper implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private List<ResourceModelInfo> addedResourceList;
+ private List<ResourceModelInfo> deletedResourceList;
+ private List<String> requestInputs;
+
+ public List<ResourceModelInfo> getAddedResourceList() {
+ return addedResourceList;
+ }
+
+ public void setAddedResourceList(List<ResourceModelInfo> addedResourceList) {
+ this.addedResourceList = addedResourceList;
+ }
+
+ public List<ResourceModelInfo> getDeletedResourceList() {
+ return deletedResourceList;
+ }
+
+ public void setDeletedResourceList(List<ResourceModelInfo> deletedResourceList) {
+ this.deletedResourceList = deletedResourceList;
+ }
+
+ public List<String> getRequestInputs() {
+ return requestInputs;
+ }
+
+ public void setRequestInputs(List<String> 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
index 1a8a1d83d9..95a82772db 100644
--- 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
@@ -21,25 +21,24 @@
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;
+ private static final long serialVersionUID = 1L;
- /*
- * set resourceType for this object
- */
- public ConfigResource(){
- resourceType = ResourceType.CONFIGURATION;
- setResourceId(UUID.randomUUID().toString());
- }
+ /*
+ * set resourceType for this object
+ */
+ public ConfigResource() {
+ resourceType = ResourceType.CONFIGURATION;
+ setResourceId(UUID.randomUUID().toString());
+ }
- /*
- * fields specific to Config Resource resource type
- */
+ /*
+ * 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
index 815d85692e..baf7d198a1 100644
--- 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
@@ -21,68 +21,80 @@
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
+ * 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;
- }
+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
index ca6d35cf46..f76ed9497c 100644
--- 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
@@ -21,9 +21,9 @@
package org.onap.so.bpmn.core.domain;
import java.io.Serializable;
+
/**
- * This class is used to store customer
- * data of services aka ServiceDecomposition
+ * This class is used to store customer data of services aka ServiceDecomposition
*
* @author bb3476
*
@@ -31,22 +31,25 @@ import java.io.Serializable;
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;
- }
-
+ 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
index e4eb01e7fb..897cbe3573 100644
--- 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
@@ -22,7 +22,6 @@ 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;
@@ -32,124 +31,127 @@ import com.fasterxml.jackson.annotation.JsonRootName;
*/
@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 String oofDirectives;
- 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<string, string> key is label name, value is any flavor
- */
- public String getOofDirectives() {
- return oofDirectives;
- }
-
- public void setOofDirectives(String oofDirectives) {
- this.oofDirectives = oofDirectives;
- }
-
- 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
+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 String oofDirectives;
+ 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<string, string> key is label name, value is any flavor
+ */
+ public String getOofDirectives() {
+ return oofDirectives;
+ }
+
+ public void setOofDirectives(String oofDirectives) {
+ this.oofDirectives = oofDirectives;
+ }
+
+ public License getLicense() {
+ return license;
+ }
+
+ public void setLicense(License license) {
+ this.license = license;
+ }
+
+
+ public static long getSerialversionuid() {
+ return serialVersionUID;
+ }
+
+
+}
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
index e56ca76b2b..494eb2a61d 100644
--- 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
@@ -20,18 +20,17 @@
package org.onap.so.bpmn.core.domain;
-public enum InventoryType{
+public enum InventoryType {
- cloud("CLOUD"),
- service("SERVICE");
+ cloud("CLOUD"), service("SERVICE");
- private String type;
+ private String type;
- InventoryType(String type){
- this.type = type;
- }
+ InventoryType(String type) {
+ this.type = type;
+ }
- public String type(){
- return type;
- }
-} \ No newline at end of file
+ public String type() {
+ return type;
+ }
+}
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
index c3eefcd3cd..602172f8a4 100644
--- 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
@@ -25,10 +25,8 @@ 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;
@@ -36,100 +34,99 @@ 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.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Wrapper encapsulates needed JSON functionality
- * to be extended by MSO service decomposition objects
- * providing ways to convert to and from JSON
+ * 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 Logger logger = LoggerFactory.getLogger(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();
- }
+public abstract class JsonWrapper implements Serializable {
+
+ private static final Logger logger = LoggerFactory.getLogger(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
index 93dfd4f1f1..1db360f391 100644
--- 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
@@ -24,95 +24,88 @@ 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 <class>HomingSolution</class>
+ * Stores licensing information and is an attribute of a <class>HomingSolution</class>
*
*/
@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<String> entitlementPoolList = new ArrayList<String>();
- @JsonInclude(JsonInclude.Include.NON_EMPTY)
- private List<String> licenseKeyGroupList = new ArrayList<String>();
-
-
- public List<String> getEntitlementPoolList() {
- return entitlementPoolList;
- }
-
- public void setEntitlementPoolList(List<String> entitlementPoolList) {
- this.entitlementPoolList = entitlementPoolList;
- }
-
- public List<String> getLicenseKeyGroupList() {
- return licenseKeyGroupList;
- }
-
- public void setLicenseKeyGroupList(List<String> 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() {
+public class License extends JsonWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ private List<String> entitlementPoolList = new ArrayList<String>();
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ private List<String> licenseKeyGroupList = new ArrayList<String>();
+
+
+ public List<String> getEntitlementPoolList() {
+ return entitlementPoolList;
+ }
+
+ public void setEntitlementPoolList(List<String> entitlementPoolList) {
+ this.entitlementPoolList = entitlementPoolList;
+ }
+
+ public List<String> getLicenseKeyGroupList() {
+ return licenseKeyGroupList;
+ }
+
+ public void setLicenseKeyGroupList(List<String> 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() {
+ 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;
- }
+ 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
index 983fe50d88..4c8401335d 100644
--- 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
@@ -21,77 +21,90 @@
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
+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;
+ }
+
+}
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
index 459d203325..a67149b71f 100644
--- 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
@@ -23,72 +23,85 @@ 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
+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;
+ }
+
+}
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
index f0e97f15ef..7523c378e9 100644
--- 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
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.core.domain;
import java.util.UUID;
-
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonRootName;
@@ -34,58 +33,67 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@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;
-
- @JsonIgnore
- private String resourceInput;
-
- /*
- * 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;
- }
-
- public String getResourceInput() {
- return resourceInput;
- }
-
- public void setResourceInput(String resourceInput) {
- this.resourceInput = resourceInput;
- }
-} \ No newline at end of file
+ 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;
+
+ @JsonIgnore
+ private String resourceInput;
+
+ /*
+ * 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;
+ }
+
+ public String getResourceInput() {
+ return resourceInput;
+ }
+
+ public void setResourceInput(String resourceInput) {
+ this.resourceInput = resourceInput;
+ }
+}
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
index 903b84ac8a..de637fdcc6 100644
--- 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
@@ -21,12 +21,10 @@
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
+ * This class is used to store instance data of owningEntity for ServiceDecomposition
*
* @author bb3476
*
@@ -34,20 +32,24 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@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;
- }
-
+ 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
index 337626ec61..e05035a92d 100644
--- 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
@@ -21,12 +21,10 @@
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
+ * This class is used to store instance data of projects for ServiceDecomposition
*
* @author bb3476
*
@@ -34,14 +32,15 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("project")
public class Project extends JsonWrapper implements Serializable {
- private static final long serialVersionUID = 1L;
- private String projectName;
+ private static final long serialVersionUID = 1L;
+ private String projectName;
+
+ public String getProjectName() {
+ return projectName;
+ }
+
+ public void setProjectName(String projectName) {
+ this.projectName = 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
index dac7336013..6c33d37cfe 100644
--- 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
@@ -21,12 +21,10 @@
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
+ * This class is used to store instance data of services aka ServiceDecomposition
*
* @author bb3476
*
@@ -34,63 +32,78 @@ import com.fasterxml.jackson.annotation.JsonRootName;
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;
- }
-
+ 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
index 00fdbec305..62a2e9370e 100644
--- 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
@@ -21,114 +21,126 @@
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
+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;
+ }
+
+}
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
index 7cbd565c77..b291765252 100644
--- 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
@@ -21,66 +21,71 @@
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() {
-// }
+// @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
index 085e278e11..2c29ff882d 100644
--- 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
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.core.domain;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
/**
@@ -30,36 +29,37 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
* @author cb645j
*
*/
-//@JsonIgnoreProperties
-//TODO update any existing references then remove this pointless class
+// @JsonIgnoreProperties
+// TODO update any existing references then remove this pointless class
@Deprecated
-public class ResourceInstance extends JsonWrapper implements Serializable {
+public class ResourceInstance extends JsonWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private String instanceId;
+ private String instanceName;
- 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 getInstanceId() {
- return instanceId;
- }
+ public String getInstanceName() {
+ return instanceName;
+ }
- /**
- * 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;
- }
+ 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
index af36fa01df..95ecd7ee85 100644
--- 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
@@ -22,37 +22,44 @@ 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;
- }
+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
index 6147822d31..a30d0df825 100644
--- 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
@@ -22,5 +22,5 @@ package org.onap.so.bpmn.core.domain;
public enum ResourceType {
- VNF, NETWORK, MODULE, ALLOTTED_RESOURCE, CONFIGURATION // etc.
-} \ No newline at end of file
+ VNF, NETWORK, MODULE, ALLOTTED_RESOURCE, CONFIGURATION // etc.
+}
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
index 5be0fb4f59..633736a25a 100644
--- 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
@@ -24,24 +24,24 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
-public class RollbackData implements Serializable{
+public class RollbackData implements Serializable {
- private static final long serialVersionUID = -4811571658272937718L;
+ private static final long serialVersionUID = -4811571658272937718L;
- private String requestId;
- private Map<String, String> additionalData = new HashMap<String, String>();
+ private String requestId;
+ private Map<String, String> additionalData = new HashMap<String, String>();
- public String getRequestId(){
- return requestId;
- }
+ public String getRequestId() {
+ return requestId;
+ }
- public void setRequestId(String requestId){
- this.requestId = requestId;
- }
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
- public Map<String, String> getAdditionalData(){
- return additionalData;
- }
+ public Map<String, String> 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
index 5e7a4796c4..0e03989e64 100644
--- 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
@@ -26,7 +26,6 @@ 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;
@@ -36,509 +35,556 @@ 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
+ * 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)
+// @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 <VnfResource> vnfResources;
- @JsonProperty("serviceNetworks")
- private List <NetworkResource> networkResources;
- @JsonProperty("serviceAllottedResources")
- private List <AllottedResource> allottedResources;
- @JsonProperty("configResource")
- private List <ConfigResource> 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<VnfResource> getVnfResources() {
- return vnfResources;
- }
- public void setVnfResources(List<VnfResource> vnfResources) {
- this.vnfResources = vnfResources;
- }
- public void setConfigResources(List<ConfigResource> configResources) {
- this.configResources = configResources;
- }
- public List<ConfigResource> getConfigResources() {
- return configResources;
- }
- public void setNetworkResources(List<NetworkResource> networkResources) {
- this.networkResources = networkResources;
- }
- public List<NetworkResource> getNetworkResources() {
- return networkResources;
- }
- public List<AllottedResource> getAllottedResources() {
- return allottedResources;
- }
- public void setAllottedResources(List<AllottedResource> 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<Resource> 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) {
+ 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<VnfResource> vnfResources;
+ @JsonProperty("serviceNetworks")
+ private List<NetworkResource> networkResources;
+ @JsonProperty("serviceAllottedResources")
+ private List<AllottedResource> allottedResources;
+ @JsonProperty("configResource")
+ private List<ConfigResource> 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<VnfResource> getVnfResources() {
+ return vnfResources;
+ }
+
+ public void setVnfResources(List<VnfResource> vnfResources) {
+ this.vnfResources = vnfResources;
+ }
+
+ public void setConfigResources(List<ConfigResource> configResources) {
+ this.configResources = configResources;
+ }
+
+ public List<ConfigResource> getConfigResources() {
+ return configResources;
+ }
+
+ public void setNetworkResources(List<NetworkResource> networkResources) {
+ this.networkResources = networkResources;
+ }
+
+ public List<NetworkResource> getNetworkResources() {
+ return networkResources;
+ }
+
+ public List<AllottedResource> getAllottedResources() {
+ return allottedResources;
+ }
+
+ public void setAllottedResources(List<AllottedResource> 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<Resource> 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();
+ // 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<Resource>) 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<Resource>) 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<Resource> resources){
- if(resources != null && !resources.isEmpty()) {
- //create resource based upon type
- switch (resources.get(0).resourceType) {
- case VNF:
- this.setVnfResources((List<VnfResource>)(List<?>)resources);
- break;
- case NETWORK:
- this.setNetworkResources((List<NetworkResource>)(List<?>)resources);
- break;
- case ALLOTTED_RESOURCE:
- this.setAllottedResources((List<AllottedResource>)(List<?>)resources);
- break;
- case CONFIGURATION:
- this.setConfigResources((List<ConfigResource>)(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<Resource> resources = getServiceResources();
- for (Resource resource : resources) {
- if (resource.getResourceId().equalsIgnoreCase(resourceId)) {
- //match
- return resource;
- }
- }
- return null;
- }
+ 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<Resource>) 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<Resource>) 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<Resource> resources) {
+ if (resources != null && !resources.isEmpty()) {
+ // create resource based upon type
+ switch (resources.get(0).resourceType) {
+ case VNF:
+ this.setVnfResources((List<VnfResource>) (List<?>) resources);
+ break;
+ case NETWORK:
+ this.setNetworkResources((List<NetworkResource>) (List<?>) resources);
+ break;
+ case ALLOTTED_RESOURCE:
+ this.setAllottedResources((List<AllottedResource>) (List<?>) resources);
+ break;
+ case CONFIGURATION:
+ this.setConfigResources((List<ConfigResource>) (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<Resource> 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
index 5cdbbcb7c9..b0b837b3b9 100644
--- 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
@@ -22,14 +22,12 @@ package org.onap.so.bpmn.core.domain;
import java.io.Serializable;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonRootName;
/**
- * This class is used to store instance
- * data of services aka ServiceDecomposition
+ * This class is used to store instance data of services aka ServiceDecomposition
*
* @author cb645j
*
@@ -37,96 +35,118 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@JsonIgnoreProperties(ignoreUnknown = true)
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;
- private Customer customer = new Customer();
- private String e2eVpnKey;
-
- 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;
- }
- public Customer getCustomer(){
- return customer;
- }
-
- public String getE2eVpnKey(){
- return e2eVpnKey;
- }
-
- public void setE2eVpnKey(String e2eVpnKey){
- this.e2eVpnKey = e2eVpnKey;
- }
+ 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;
+ private Customer customer = new Customer();
+ private String e2eVpnKey;
+
+ 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;
+ }
+
+ public Customer getCustomer() {
+ return customer;
+ }
+
+ public String getE2eVpnKey() {
+ return e2eVpnKey;
+ }
+
+ public void setE2eVpnKey(String e2eVpnKey) {
+ this.e2eVpnKey = e2eVpnKey;
+ }
}
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
index e9028ded17..620d8311e7 100644
--- 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
@@ -24,46 +24,46 @@ import java.io.Serializable;
public class Subscriber implements Serializable {
- private static final long serialVersionUID = -2416018315129127022L;
- private String globalId;
- private String name;
- private String commonSiteId;
+ 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 Subscriber(String globalId, String name, String commonSiteId) {
+ super();
+ this.globalId = globalId;
+ this.name = name;
+ this.commonSiteId = commonSiteId;
+ }
- public String getGlobalId(){
- return globalId;
- }
+ public String getGlobalId() {
+ return globalId;
+ }
- public void setGlobalId(String globalId){
- this.globalId = globalId;
- }
+ public void setGlobalId(String globalId) {
+ this.globalId = globalId;
+ }
- public String getName(){
- return name;
- }
+ public String getName() {
+ return name;
+ }
- public void setName(String name){
- this.name = name;
- }
+ public void setName(String name) {
+ this.name = name;
+ }
- public String getCommonSiteId(){
- return commonSiteId;
- }
+ public String getCommonSiteId() {
+ return commonSiteId;
+ }
- public void setCommonSiteId(String commonSiteId){
- this.commonSiteId = 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
index 83043b3ec5..293378f969 100644
--- 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
@@ -21,12 +21,10 @@
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
+ * This class is used to store instance data of Vnf for ServiceDecomposition
*
* @author bb3476
*
@@ -34,106 +32,133 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@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;
- }
-
+ 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
index a7e5389583..f66ad36058 100644
--- 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
@@ -23,7 +23,6 @@ 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.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -36,154 +35,170 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@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 <ModuleResource> 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;
-
- @JsonIgnore
- private String resourceInput;
-
- /*
- * GET and SET
- */
- public List<ModuleResource> getVfModules() {
- return vfModules;
- }
- public void setModules(List<ModuleResource> 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;
- }
-
- public String getResourceInput() {
- return resourceInput;
- }
-
- public void setResourceInput(String resourceInput) {
- this.resourceInput = resourceInput;
- }
-
- /**
- * Returns a list of all VfModule objects.
- * Base module is first entry in the list
- * @return ordered list of ModuleResources objects
- */
- @JsonIgnore
- public List<ModuleResource> 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
- * <serviceResources.modelInfo.modelName>/<serviceVnfs.modelInfo.modelInstanceName>
- *
- * 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
+ 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<ModuleResource> 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;
+
+ @JsonIgnore
+ private String resourceInput;
+
+ /*
+ * GET and SET
+ */
+ public List<ModuleResource> getVfModules() {
+ return vfModules;
+ }
+
+ public void setModules(List<ModuleResource> 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;
+ }
+
+ public String getResourceInput() {
+ return resourceInput;
+ }
+
+ public void setResourceInput(String resourceInput) {
+ this.resourceInput = resourceInput;
+ }
+
+ /**
+ * Returns a list of all VfModule objects. Base module is first entry in the list
+ *
+ * @return ordered list of ModuleResources objects
+ */
+ @JsonIgnore
+ public List<ModuleResource> 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
+ * <serviceResources.modelInfo.modelName>/<serviceVnfs.modelInfo.modelInstanceName>
+ *
+ * default setter for this field deprecated
+ *
+ * @param modelName << serviceResources.modelInfo.modelName
+ */
+ public void constructVnfType(String modelName) {
+ this.vnfType = modelName.concat("/").concat(this.modelInfo.getModelInstanceName());
+ }
+}
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
index f63ab31496..1604e91979 100644
--- 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
@@ -25,27 +25,24 @@ 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}".
+ * 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
+ * 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 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) {
@@ -54,6 +51,7 @@ public class VariableNameExtractor {
/**
* Extracts variable name from expression given in constructor
+ *
* @return Optional of variable name, empty if expression wasn't single variable
*/
public Optional<String> extract() {
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
index 89f61fec75..93a47ff6b1 100644
--- 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
@@ -24,14 +24,12 @@ 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 com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
@@ -39,16 +37,15 @@ import org.slf4j.LoggerFactory;
public class DecomposeJsonUtil implements Serializable {
- private static final Logger logger = LoggerFactory.getLogger(DecomposeJsonUtil.class);
- /**
- *
- */
- private static final long serialVersionUID = 1L;
+ private static final Logger logger = LoggerFactory.getLogger(DecomposeJsonUtil.class);
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
private static final ObjectMapper OBJECT_MAPPER = createObjectMapper();
- private DecomposeJsonUtil() {
- }
+ private DecomposeJsonUtil() {}
private static ObjectMapper createObjectMapper() {
ObjectMapper om = new ObjectMapper();
@@ -56,24 +53,24 @@ public class DecomposeJsonUtil implements Serializable {
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);
+ 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) {
+ } catch (IOException e) {
throw new JsonDecomposingException("Exception while converting json to service decomposition", e);
}
- }
-
+ }
+
/**
* Method to construct Service Decomposition object converting JSON structure
*
@@ -88,59 +85,59 @@ public class DecomposeJsonUtil implements Serializable {
ServiceInstance serviceInstance = new ServiceInstance();
serviceInstance.setInstanceId(serviceInstanceId);
serviceDecomposition.setServiceInstance(serviceInstance);
- return serviceDecomposition;
- }
-
- /**
+ 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 {
+ try {
return OBJECT_MAPPER.readValue(jsonString, VnfResource.class);
- } catch (IOException e) {
+ } 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 {
+ try {
return OBJECT_MAPPER.readValue(jsonString, NetworkResource.class);
- } catch (IOException e) {
+ } 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
+ *
+ * @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 {
+ try {
return OBJECT_MAPPER.readValue(jsonString, AllottedResource.class);
- } catch (IOException e) {
+ } catch (IOException e) {
throw new JsonDecomposingException("Exception while converting json to allotted resource", e);
- }
- }
-
+ }
+ }
+
public static ConfigResource jsonToConfigResource(String jsonString) throws JsonDecomposingException {
- try {
+ try {
return OBJECT_MAPPER.readValue(jsonString, ConfigResource.class);
- } catch (IOException e) {
+ } catch (IOException e) {
throw new JsonDecomposingException("Exception while converting json to allotted resource", e);
- }
- }
+ }
+ }
}
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
index ccc5ea667e..d3d07f9014 100644
--- 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
@@ -30,7 +30,6 @@ 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;
@@ -39,7 +38,6 @@ import org.json.JSONObject;
import org.json.XML;
import org.onap.so.bpmn.core.xml.XmlTool;
import org.onap.so.exceptions.ValidationException;
-
import com.fasterxml.jackson.databind.JsonNode;
import com.github.fge.jackson.JsonLoader;
import com.github.fge.jsonschema.core.exceptions.ProcessingException;
@@ -54,1016 +52,1019 @@ import org.slf4j.LoggerFactory;
*
* @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.
+ * 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 Logger logger = LoggerFactory.getLogger(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){
- logger.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) {
-// use the local class method which properly handles certain JSONArray content
- return XmlTool.normalize(toXMLString(jsonObj, null));
- } else {
-// use the local class method which properly handles certain JSONArray content
- return toXMLString(jsonObj, null);
- }
- } catch (Exception e){
- logger.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<String> keys;
- int len;
- String str;
- Object curObj;
- if (obj instanceof JSONObject) {
- // append "<tagName>" to the XML output
- if (tagName != null) {
- strBuf.append("<");
- strBuf.append(tagName);
- strBuf.append(">");
- }
- // iterate thru the keys.
- jsonObj = (JSONObject) obj;
- keys = jsonObj.keys();
- while (keys.hasNext()) {
- key = keys.next();
- 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();
- 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("</");
-// strBuf.append(key);
-// strBuf.append(">");
- } else {
- // 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("</");
- strBuf.append(key);
- strBuf.append(">");
- }
- }
- }
- } else if (curObj.equals("")) {
- // append a closing tag "<key>" to the XML output
- strBuf.append("<");
- strBuf.append(key);
- strBuf.append("/>");
- } else {
- strBuf.append(toXMLString(curObj, key));
- }
- }
- if (tagName != null) {
- // append the closing tag "</tagName>" to the XML output
- strBuf.append("</");
- strBuf.append(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 {
- str = (obj == null) ? "null" : XML.escape(obj.toString());
- return (tagName == null) ? "\"" + str + "\""
- : (str.length() == 0) ? "<" + tagName + "/>" : "<"
- + tagName + ">" + str + "</" + tagName + ">";
- }
- }
-
- /**
- * 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) {
- try {
- JSONObject jsonObj = new JSONObject(jsonStr);
- return jsonObj.toString(MSOJsonIndentFactor);
- } catch (Exception e){
- logger.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 <String> 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<String> 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) {
- logger.debug("getJsonValue(): the raw value is a String Object={}", rawValue);
- return (String) rawValue;
- } else {
- logger.debug("getJsonValue(): the raw value is NOT a String Object={}", rawValue.toString());
- return rawValue.toString();
- }
- }
- } catch (Exception e) {
- logger.debug("getJsonValue(): unable to parse json to retrieve value for field={}. Exception was: {}", keys,
- 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) {
- try {
- Object rawValue = getJsonRawValue(jsonStr, keys, true);
- if (rawValue == null) {
- return null;
- } else {
- if (rawValue instanceof String) {
- logger.debug("getJsonNodeValue(): the raw value is a String Object={}", rawValue);
- return (String) rawValue;
- } else {
- logger.debug("getJsonNodeValue(): the raw value is NOT a String Object={}", rawValue.toString());
- return rawValue.toString();
- }
- }
- } catch (Exception e) {
- logger.debug("getJsonNodeValue(): unable to parse json to retrieve node for field={}. Exception was: {}", keys,
- 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) {
- try {
- Object rawValue = getJsonRawValue(jsonStr, keys);
- if (rawValue == null) {
- return 0;
- } else {
- if (rawValue instanceof Integer) {
- logger.debug("getJsonIntValue(): the raw value is an Integer Object={}", ((String) rawValue).toString());
- return (Integer) rawValue;
- } else {
- logger.debug("getJsonIntValue(): the raw value is NOT an Integer Object={}", rawValue.toString());
- return 0;
- }
- }
- } catch (Exception e) {
- logger.debug("getJsonIntValue(): unable to parse json to retrieve value for field={}. Exception was: {}", keys,
- 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) {
- logger.debug("getJsonBooleanValue(): the raw value is a Boolean Object={}", rawValue);
- return (Boolean) rawValue;
- } else {
- logger.debug("getJsonBooleanValue(): the raw value is NOT an Boolean Object={}", rawValue.toString());
- return false;
- }
- }
- } catch (Exception e) {
- logger.debug("getJsonBooleanValue(): unable to parse json to retrieve value for field={}. Exception was: {}", keys,
- 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) {
- logger.debug("getJsonParamValue(): keys={} points to JSONArray: {}", keys, rawValue.toString());
- int arrayLen = ((JSONArray) rawValue).length();
- if (index < 0 || arrayLen < index+1) {
- logger.debug("getJsonParamValue(): index: {} is out of bounds for array size of {}", index, arrayLen);
- return null;
- }
- int foundCnt = 0;
- for (int i = 0; i < arrayLen; i++) {
- logger.debug("getJsonParamValue(): index: {}, value: {}", i, ((JSONArray) rawValue).get(i).toString());
- if (((JSONArray) rawValue).get(i) instanceof JSONObject) {
- JSONObject jsonObj = (JSONObject)((JSONArray) rawValue).get(i);
- String parmValue = jsonObj.get(name).toString();
- if (parmValue != null) {
- logger.debug("getJsonParamValue(): found value: {} for name: {} and index: {}", parmValue, name, i);
- if (foundCnt == index) {
- return parmValue;
- } else {
- foundCnt++;
- continue;
- }
- } else {
- continue;
- }
- } else {
- logger.debug("getJsonParamValue(): the JSONArray element is NOT a JSONObject={}", rawValue.toString());
- return null;
- }
- }
- logger.debug("getJsonParamValue(): content value NOT found for name: {}", name);
- return null;
- } else {
- logger.debug("getJsonParamValue(): the raw value is NOT a JSONArray Object={}", rawValue.toString());
- return null;
- }
- }
- } catch (Exception e) {
- if (e.getMessage().contains("not found")) {
- logger.debug("getJsonParamValue(): failed to retrieve param value for keys:{}, name={} : {}", keys, name,
- e.getMessage());
- } else {
- logger.debug("getJsonParamValue(): unable to parse json to retrieve value for field={}. Exception was: {}", keys,
- 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) {
- logger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field={}. Exception was: {}", key,
- 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);
- logger.debug("getJsonValueForKey(): found value={}, for key={}", (String) value, key);
- if (value == null) {
- return null;
- } else {
- return ((String) value);
- }
- } else {
- Iterator <String> itr = jsonObj.keys();
- while (itr.hasNext()) {
- String nextKey = itr.next();
- Object obj = jsonObj.get(nextKey);
- if (obj instanceof JSONObject) {
- keyValue = getJsonValueForKey((JSONObject) obj, key);
- if (keyValue != null) {
- break;
- }
- } else {
- logger.debug("getJsonValueForKey(): key={}, does not point to a JSONObject, next key", nextKey);
- }
- }
- }
- } 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")) {
- logger.debug("getJsonValueForKey(): failed to retrieve param value for key={}: {}", key, e.getMessage());
- } else {
- logger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field={}. Exception was {}", key,
- 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) {
- Integer keyValue = null;
- try {
- if (jsonObj.has(key)) {
- Integer value = (Integer) jsonObj.get(key);
- logger.debug("getJsonIntValueForKey(): found value={}, for key={}", value, key);
- return value;
- } else {
- Iterator <String> itr = jsonObj.keys();
- while (itr.hasNext()) {
- String nextKey = itr.next();
- Object obj = jsonObj.get(nextKey);
- if (obj instanceof JSONObject) {
- keyValue = getJsonIntValueForKey((JSONObject) obj, key);
- if (keyValue != null) {
- break;
- }
- } else {
- logger.debug("getJsonIntValueForKey(): key={}, does not point to a JSONObject, next key", nextKey);
- }
- }
- }
- } 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")) {
- logger.debug("getJsonIntValueForKey(): failed to retrieve param value for key={}: {}", key, e.getMessage());
- } else {
- logger.debug("getJsonIntValueForKey(): unable to parse json to retrieve value for field={}. Exception was: {}", key,
- 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);
- logger.debug("getJsonBooleanValueForKey(): found value={}, for key={}", value, key);
- return value;
- } else {
- Iterator <String> itr = jsonObj.keys();
- while (itr.hasNext()) {
- String nextKey = itr.next();
- Object obj = jsonObj.get(nextKey);
- if (obj instanceof JSONObject) {
- keyValue = getJsonBooleanValueForKey((JSONObject) obj, key);
- if (keyValue != null) {
- break;
- }
- } else {
- logger.debug("getJsonBooleanValueForKey(): key={}, does not point to a JSONObject, next key", nextKey);
- }
- }
- }
- } 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")) {
- logger.debug("getJsonBooleanValueForKey(): failed to retrieve param value for key={}: {}", key, e.getMessage());
- } else {
- logger.debug("getJsonBooleanValueForKey(): unable to parse json to retrieve value for field={}. Exception was: {}",
- key, e.toString(), e);
- }
- keyValue = null;
- }
- return keyValue;
- }
+ private static Logger logger = LoggerFactory.getLogger(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) {
+ logger.debug("xml2json(): unable to parse xml and convert to json. Exception was: {}", e.toString(), e);
+ return null;
+ }
+ }
- /**
- * 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;
- }
- }
+ /**
+ * 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);
+ }
- /**
- * 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) {
+ /**
+ * 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) {
+ // use the local class method which properly handles certain JSONArray content
+ return XmlTool.normalize(toXMLString(jsonObj, null));
+ } else {
+ // use the local class method which properly handles certain JSONArray content
+ return toXMLString(jsonObj, null);
+ }
+ } catch (Exception e) {
+ logger.debug("json2xml(): unable to parse json and convert to xml. Exception was: {}", e.toString(), e);
+ return null;
+ }
+ }
- // only attempt to insert the key/value pair if it does not exist
- if (!jsonValueExists(jsonStr, keys)) {
- return putJsonValue(jsonStr, keys, value);
- } else {
- logger.debug("addJsonValue(): JSON add failed, key={}/value={} already exists", keys, value);
- return jsonStr;
- }
- }
+ /**
+ * 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<String> keys;
+ int len;
+ String str;
+ Object curObj;
+ if (obj instanceof JSONObject) {
+ // append "<tagName>" to the XML output
+ if (tagName != null) {
+ strBuf.append("<");
+ strBuf.append(tagName);
+ strBuf.append(">");
+ }
+ // iterate thru the keys.
+ jsonObj = (JSONObject) obj;
+ keys = jsonObj.keys();
+ while (keys.hasNext()) {
+ key = keys.next();
+ 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();
+ 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("</");
+ // strBuf.append(key);
+ // strBuf.append(">");
+ } else {
+ // 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("</");
+ strBuf.append(key);
+ strBuf.append(">");
+ }
+ }
+ }
+ } else if (curObj.equals("")) {
+ // append a closing tag "<key>" to the XML output
+ strBuf.append("<");
+ strBuf.append(key);
+ strBuf.append("/>");
+ } else {
+ strBuf.append(toXMLString(curObj, key));
+ }
+ }
+ if (tagName != null) {
+ // append the closing tag "</tagName>" to the XML output
+ strBuf.append("</");
+ strBuf.append(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 {
+ str = (obj == null) ? "null" : XML.escape(obj.toString());
+ return (tagName == null) ? "\"" + str + "\""
+ : (str.length() == 0) ? "<" + tagName + "/>" : "<" + tagName + ">" + str + "</" + tagName + ">";
+ }
+ }
- /**
- * 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 {
- logger.debug("updJsonValue(): JSON update failed, no value exists for key={}", keys);
- return jsonStr;
- }
- }
+ /**
+ * 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);
+ }
- /**
- * 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) {
+ /**
+ * 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) {
+ try {
+ JSONObject jsonObj = new JSONObject(jsonStr);
+ return jsonObj.toString(MSOJsonIndentFactor);
+ } catch (Exception e) {
+ logger.debug("prettyJson(): unable to parse/format json input. Exception was: {}", e.toString(), e);
+ return null;
+ }
+ }
- // 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 {
- logger.debug("delJsonValue(): JSON delete failed, no value exists for key={}", keys);
- return jsonStr;
- }
- }
+ /**
+ * 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<String> getJsonIterator(String jsonStr) throws JSONException {
+ return new JSONObject(jsonStr).keys();
+ }
- /**
- * 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);
- }
+ /**
+ * 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<String> 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;
+ }
- /**
- * 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) {
+ /**
+ * 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) {
+ logger.debug("getJsonValue(): the raw value is a String Object={}", rawValue);
+ return (String) rawValue;
+ } else {
+ logger.debug("getJsonValue(): the raw value is NOT a String Object={}", rawValue.toString());
+ return rawValue.toString();
+ }
+ }
+ } catch (Exception e) {
+ logger.debug("getJsonValue(): unable to parse json to retrieve value for field={}. Exception was: {}", keys,
+ e.toString(), e);
+ }
+ return null;
+ }
- 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) {
- jsonObj = (JSONObject) keyValue;
- } else {
- if (keyTokens.hasMoreElements()) {
- logger.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();
- }
+ /**
+ * 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) {
+ try {
+ Object rawValue = getJsonRawValue(jsonStr, keys, true);
+ if (rawValue == null) {
+ return null;
+ } else {
+ if (rawValue instanceof String) {
+ logger.debug("getJsonNodeValue(): the raw value is a String Object={}", rawValue);
+ return (String) rawValue;
+ } else {
+ logger.debug("getJsonNodeValue(): the raw value is NOT a String Object={}", rawValue.toString());
+ return rawValue.toString();
+ }
+ }
+ } catch (Exception e) {
+ logger.debug("getJsonNodeValue(): unable to parse json to retrieve node for field={}. Exception was: {}",
+ keys, e.toString(), e);
+ }
+ 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")) {
- logger.debug("getJsonRawValue(): failed to retrieve param value for key={}: {}", keyStr, e.getMessage());
- } else {
- logger.debug("getJsonRawValue(): unable to parse json to retrieve value for field={}. Exception was: {}", keys,
- 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) {
+ try {
+ Object rawValue = getJsonRawValue(jsonStr, keys);
+ if (rawValue == null) {
+ return 0;
+ } else {
+ if (rawValue instanceof Integer) {
+ logger.debug("getJsonIntValue(): the raw value is an Integer Object={}",
+ ((String) rawValue).toString());
+ return (Integer) rawValue;
+ } else {
+ logger.debug("getJsonIntValue(): the raw value is NOT an Integer Object={}", rawValue.toString());
+ return 0;
+ }
+ }
+ } catch (Exception e) {
+ logger.debug("getJsonIntValue(): unable to parse json to retrieve value for field={}. Exception was: {}",
+ keys, e.toString(), e);
+ }
+ return 0;
+ }
- /**
- * 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) {
+ /**
+ * 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) {
+ logger.debug("getJsonBooleanValue(): the raw value is a Boolean Object={}", rawValue);
+ return (Boolean) rawValue;
+ } else {
+ logger.debug("getJsonBooleanValue(): the raw value is NOT an Boolean Object={}",
+ rawValue.toString());
+ return false;
+ }
+ }
+ } catch (Exception e) {
+ logger.debug(
+ "getJsonBooleanValue(): unable to parse json to retrieve value for field={}. Exception was: {}",
+ keys, e.toString(), e);
+ }
+ return false;
+ }
- 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) {
- jsonObj = (JSONObject) keyValue;
- } else {
- logger.debug("putJsonValue(): key={} not the last key but points to non-json object: {}", keyStr, 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;
+ /**
+ * 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);
+ }
- } 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")) {
- logger.debug("putJsonValue(): failed to put param value for key={}: {}", keyStr, e.getMessage());
- } else {
- logger.debug("putJsonValue(): unable to parse json to put value for key={}. Exception was: {}", keys, e.toString(),
- e);
- }
- }
- return null;
- }
+ /**
+ * 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) {
+ logger.debug("getJsonParamValue(): keys={} points to JSONArray: {}", keys, rawValue.toString());
+ int arrayLen = ((JSONArray) rawValue).length();
+ if (index < 0 || arrayLen < index + 1) {
+ logger.debug("getJsonParamValue(): index: {} is out of bounds for array size of {}", index,
+ arrayLen);
+ return null;
+ }
+ int foundCnt = 0;
+ for (int i = 0; i < arrayLen; i++) {
+ logger.debug("getJsonParamValue(): index: {}, value: {}", i,
+ ((JSONArray) rawValue).get(i).toString());
+ if (((JSONArray) rawValue).get(i) instanceof JSONObject) {
+ JSONObject jsonObj = (JSONObject) ((JSONArray) rawValue).get(i);
+ String parmValue = jsonObj.get(name).toString();
+ if (parmValue != null) {
+ logger.debug("getJsonParamValue(): found value: {} for name: {} and index: {}",
+ parmValue, name, i);
+ if (foundCnt == index) {
+ return parmValue;
+ } else {
+ foundCnt++;
+ continue;
+ }
+ } else {
+ continue;
+ }
+ } else {
+ logger.debug("getJsonParamValue(): the JSONArray element is NOT a JSONObject={}",
+ rawValue.toString());
+ return null;
+ }
+ }
+ logger.debug("getJsonParamValue(): content value NOT found for name: {}", name);
+ return null;
+ } else {
+ logger.debug("getJsonParamValue(): the raw value is NOT a JSONArray Object={}",
+ rawValue.toString());
+ return null;
+ }
+ }
+ } catch (Exception e) {
+ if (e.getMessage().contains("not found")) {
+ logger.debug("getJsonParamValue(): failed to retrieve param value for keys:{}, name={} : {}", keys,
+ name, e.getMessage());
+ } else {
+ logger.debug(
+ "getJsonParamValue(): unable to parse json to retrieve value for field={}. Exception was: {}",
+ keys, 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<String, String> jsonStringToMap(DelegateExecution execution, String entry) {
- logger.debug("Started Json String To Map Method");
+ /**
+ * 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) {
+ logger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field={}. Exception was: {}",
+ key, e.toString(), e);
+ }
+ return null;
+ }
- Map<String, String> map = new HashMap<>();
+ /**
+ * 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);
+ logger.debug("getJsonValueForKey(): found value={}, for key={}", (String) value, key);
+ if (value == null) {
+ return null;
+ } else {
+ return ((String) value);
+ }
+ } else {
+ Iterator<String> itr = jsonObj.keys();
+ while (itr.hasNext()) {
+ String nextKey = itr.next();
+ Object obj = jsonObj.get(nextKey);
+ if (obj instanceof JSONObject) {
+ keyValue = getJsonValueForKey((JSONObject) obj, key);
+ if (keyValue != null) {
+ break;
+ }
+ } else {
+ logger.debug("getJsonValueForKey(): key={}, does not point to a JSONObject, next key", nextKey);
+ }
+ }
+ }
+ } 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")) {
+ logger.debug("getJsonValueForKey(): failed to retrieve param value for key={}: {}", key,
+ e.getMessage());
+ } else {
+ logger.debug(
+ "getJsonValueForKey(): unable to parse json to retrieve value for field={}. Exception was {}",
+ key, e.toString(), e);
+ }
+ keyValue = null;
+ }
+ return keyValue;
+ }
- //Populate Map
- JSONObject obj = new JSONObject(entry);
+ /**
+ * 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) {
+ Integer keyValue = null;
+ try {
+ if (jsonObj.has(key)) {
+ Integer value = (Integer) jsonObj.get(key);
+ logger.debug("getJsonIntValueForKey(): found value={}, for key={}", value, key);
+ return value;
+ } else {
+ Iterator<String> itr = jsonObj.keys();
+ while (itr.hasNext()) {
+ String nextKey = itr.next();
+ Object obj = jsonObj.get(nextKey);
+ if (obj instanceof JSONObject) {
+ keyValue = getJsonIntValueForKey((JSONObject) obj, key);
+ if (keyValue != null) {
+ break;
+ }
+ } else {
+ logger.debug("getJsonIntValueForKey(): key={}, does not point to a JSONObject, next key",
+ nextKey);
+ }
+ }
+ }
+ } 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")) {
+ logger.debug("getJsonIntValueForKey(): failed to retrieve param value for key={}: {}", key,
+ e.getMessage());
+ } else {
+ logger.debug(
+ "getJsonIntValueForKey(): unable to parse json to retrieve value for field={}. Exception was: {}",
+ key, e.toString(), e);
+ }
+ keyValue = null;
+ }
+ return keyValue;
+ }
- /* 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<String> keys = obj.keys();
- while (keys.hasNext()) {
- final String key = keys.next();
- map.put(key, obj.getString(key));
- }
- logger.debug("Outgoing Map is: {}", map);
- logger.debug("Completed Json String To Map Method");
- return map;
- }
+ /**
+ * 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);
+ logger.debug("getJsonBooleanValueForKey(): found value={}, for key={}", value, key);
+ return value;
+ } else {
+ Iterator<String> itr = jsonObj.keys();
+ while (itr.hasNext()) {
+ String nextKey = itr.next();
+ Object obj = jsonObj.get(nextKey);
+ if (obj instanceof JSONObject) {
+ keyValue = getJsonBooleanValueForKey((JSONObject) obj, key);
+ if (keyValue != null) {
+ break;
+ }
+ } else {
+ logger.debug("getJsonBooleanValueForKey(): key={}, does not point to a JSONObject, next key",
+ nextKey);
+ }
+ }
+ }
+ } 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")) {
+ logger.debug("getJsonBooleanValueForKey(): failed to retrieve param value for key={}: {}", key,
+ e.getMessage());
+ } else {
+ logger.debug(
+ "getJsonBooleanValueForKey(): unable to parse json to retrieve value for field={}. Exception was: {}",
+ key, e.toString(), e);
+ }
+ keyValue = null;
+ }
+ return keyValue;
+ }
- /**
- * 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<String, String> entryArrayToMap(DelegateExecution execution, String entryArray, String keyNode, String valueNode) {
- logger.debug("Started Entry Array To Map Util Method");
+ /**
+ * 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;
+ }
+ }
- Map<String, String> 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.get(valueNode).toString();
- map.put(key, value);
- }
- logger.debug("Completed Entry Array To Map Util Method");
- return map;
- }
+ /**
+ * 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 {
+ logger.debug("addJsonValue(): JSON add failed, key={}/value={} already exists", keys, value);
+ return jsonStr;
+ }
+ }
- /**
- * 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<String, String> entryArrayToMap(String entryArray, String keyNode, String valueNode){
- logger.debug("Started Entry Array To Map Util Method");
+ /**
+ * 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 {
+ logger.debug("updJsonValue(): JSON update failed, no value exists for key={}", keys);
+ return jsonStr;
+ }
+ }
- Map<String, String> 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.get(valueNode).toString();
- map.put(key, value);
- }
- logger.debug("Completed Entry Array To Map Util Method");
- return map;
- }
+ /**
+ * 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 {
+ logger.debug("delJsonValue(): JSON delete failed, no value exists for key={}", keys);
+ return jsonStr;
+ }
+ }
- /**
- * 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<String>.
- *
- * @param execution
- * @param jsonArray - string value of a json array
- * @return List - a java list containing the strings
- *
- * @author cb645j
- */
- public List<String> StringArrayToList(Execution execution, String jsonArray){
- logger.debug("Started String Array To List Util Method");
+ /**
+ * 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);
+ }
- List<String> 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);
- }
- logger.debug("Outgoing List is: {}", list);
- logger.debug("Completed String Array To List Util Method");
- return list;
- }
+ /**
+ * 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) {
+ jsonObj = (JSONObject) keyValue;
+ } else {
+ if (keyTokens.hasMoreElements()) {
+ logger.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")) {
+ logger.debug("getJsonRawValue(): failed to retrieve param value for key={}: {}", keyStr,
+ e.getMessage());
+ } else {
+ logger.debug(
+ "getJsonRawValue(): unable to parse json to retrieve value for field={}. Exception was: {}",
+ keys, e.toString(), e);
+ }
+ }
+ return null;
+ }
- /**
- * 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<String>.
- *
- * @param jsonArray - string value of a json array
- * @return List - a java list containing the strings
- *
- * @author cb645j
- */
- public List<String> StringArrayToList(String jsonArray){
- logger.debug("Started Json Util String Array To List");
- List<String> list = new ArrayList<>();
+ /**
+ * 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) {
+ jsonObj = (JSONObject) keyValue;
+ } else {
+ logger.debug("putJsonValue(): key={} not the last key but points to non-json object: {}",
+ keyStr, 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")) {
+ logger.debug("putJsonValue(): failed to put param value for key={}: {}", keyStr, e.getMessage());
+ } else {
+ logger.debug("putJsonValue(): unable to parse json to put value for key={}. Exception was: {}", keys,
+ e.toString(), e);
+ }
+ }
+ return null;
+ }
- JSONArray arr = new JSONArray(jsonArray);
- for(int i = 0; i < arr.length(); i++){
- String s = arr.get(i).toString();
- list.add(s);
- }
- logger.debug("Completed Json Util String Array To List");
- return list;
- }
+ /**
+ * 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<String, String> jsonStringToMap(DelegateExecution execution, String entry) {
+ logger.debug("Started Json String To Map Method");
+
+ Map<String, String> 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<String> keys = obj.keys();
+ while (keys.hasNext()) {
+ final String key = keys.next();
+ map.put(key, obj.getString(key));
+ }
+ logger.debug("Outgoing Map is: {}", map);
+ logger.debug("Completed Json String To Map 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<String>.
- *
- * @param jsonArray - json array
- * @return List - a java list containing the strings
- *
- * @author cb645j
- */
- public List<String> StringArrayToList(JSONArray jsonArray){
- logger.debug("Started Json Util String Array To List");
- List<String> list = new ArrayList<>();
+ /**
+ * 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<String, String> entryArrayToMap(DelegateExecution execution, String entryArray, String keyNode,
+ String valueNode) {
+ logger.debug("Started Entry Array To Map Util Method");
+
+ Map<String, String> 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.get(valueNode).toString();
+ map.put(key, value);
+ }
+ logger.debug("Completed Entry Array To Map Util Method");
+ return map;
+ }
- for(int i = 0; i < jsonArray.length(); i++){
- String s = jsonArray.get(i).toString();
- list.add(s);
- }
- logger.debug("Completed Json Util String Array To List");
- return list;
- }
+ /**
+ * 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<String, String> entryArrayToMap(String entryArray, String keyNode, String valueNode) {
+ logger.debug("Started Entry Array To Map Util Method");
+
+ Map<String, String> 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.get(valueNode).toString();
+ map.put(key, value);
+ }
+ logger.debug("Completed Entry Array To Map Util Method");
+ return map;
+ }
- /**
- *
- * 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){
+ /**
+ * 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<String>.
+ *
+ * @param execution
+ * @param jsonArray - string value of a json array
+ * @return List - a java list containing the strings
+ *
+ * @author cb645j
+ */
+ public List<String> StringArrayToList(Execution execution, String jsonArray) {
+ logger.debug("Started String Array To List Util Method");
+
+ List<String> 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);
+ }
+ logger.debug("Outgoing List is: {}", list);
+ logger.debug("Completed String Array To List Util Method");
+ return list;
+ }
- try{
- Object rawValue = getJsonRawValue(jsonStr, keys);
+ /**
+ * 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<String>.
+ *
+ * @param jsonArray - string value of a json array
+ * @return List - a java list containing the strings
+ *
+ * @author cb645j
+ */
+ public List<String> StringArrayToList(String jsonArray) {
+ logger.debug("Started Json Util String Array To List");
+ List<String> 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);
+ }
+ logger.debug("Completed Json Util String Array To List");
+ return list;
+ }
- return !(rawValue == null);
+ /**
+ * 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<String>.
+ *
+ * @param jsonArray - json array
+ * @return List - a java list containing the strings
+ *
+ * @author cb645j
+ */
+ public List<String> StringArrayToList(JSONArray jsonArray) {
+ logger.debug("Started Json Util String Array To List");
+ List<String> list = new ArrayList<>();
+
+ for (int i = 0; i < jsonArray.length(); i++) {
+ String s = jsonArray.get(i).toString();
+ list.add(s);
+ }
+ logger.debug("Completed Json Util String Array To List");
+ return list;
+ }
- } catch(Exception e){
- logger.debug("jsonElementExist(): unable to determine if json element exist. Exception is: {}", e.toString(), e);
- }
- return true;
- }
+ /**
+ *
+ * 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) {
+ logger.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
- *
- */
+ /**
+ *
+ * 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 {
- logger.debug("JSON document to be validated: {}", jsonStr);
- JsonNode document = JsonLoader.fromString(jsonStr);
- JsonNode schema = JsonLoader.fromPath(jsonSchemaPath);
-
- JsonSchemaFactory factory = JsonSchemaFactory.byDefault();
- JsonValidator validator = factory.getValidator();
-
- ProcessingReport report = validator.validate(schema, document);
- logger.debug("JSON schema validation report: {}", report.toString());
- return report.toString();
- } catch (IOException e) {
- logger.debug("IOException performing JSON schema validation on document: {}", e.toString());
- throw new ValidationException(e.getMessage());
- } catch (ProcessingException e) {
- logger.debug("ProcessingException performing JSON schema validation on document: {}", e.toString());
- throw new ValidationException(e.getMessage());
- }
+ try {
+ logger.debug("JSON document to be validated: {}", jsonStr);
+ JsonNode document = JsonLoader.fromString(jsonStr);
+ JsonNode schema = JsonLoader.fromPath(jsonSchemaPath);
+
+ JsonSchemaFactory factory = JsonSchemaFactory.byDefault();
+ JsonValidator validator = factory.getValidator();
+
+ ProcessingReport report = validator.validate(schema, document);
+ logger.debug("JSON schema validation report: {}", report.toString());
+ return report.toString();
+ } catch (IOException e) {
+ logger.debug("IOException performing JSON schema validation on document: {}", e.toString());
+ throw new ValidationException(e.getMessage());
+ } catch (ProcessingException e) {
+ logger.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
index 6c8070f9bd..da096e5461 100644
--- 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
@@ -32,7 +32,6 @@ 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;
@@ -49,7 +48,6 @@ 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.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -64,193 +62,194 @@ import org.xml.sax.SAXException;
*/
public final class XmlTool {
- private static final Map<String, Integer> ENTITIES = new HashMap<>();
- private static final Logger logger = LoggerFactory.getLogger(XmlTool.class);
- static {
- ENTITIES.put("amp", 38);
- ENTITIES.put("quot", 34);
- ENTITIES.put("lt", 60);
- ENTITIES.put("gt", 62);
- }
+ private static final Map<String, Integer> ENTITIES = new HashMap<>();
+ private static final Logger logger = LoggerFactory.getLogger(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() {
+ 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();
+ transformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ 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();
}
-
- /**
- * 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();
- transformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
- 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("(</)(\\w+:)(.*?>)", "$1$3");
- // remove extra spaces left when xmlns declarations are removed
- text = text.replaceAll("\\s+>", ">");
-
- return text;
- }
+ /**
+ * 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;
+ }
- /**
- * 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 {
+ return String.valueOf(xml).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "");
+ }
- try (InputStream stream = XmlTool.class.getClassLoader().getResourceAsStream(file);
- Reader reader = new InputStreamReader(stream, "UTF-8")) {
+ /**
+ * 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("(</)(\\w+:)(.*?>)", "$1$3");
+ // remove extra spaces left when xmlns declarations are removed
+ text = text.replaceAll("\\s+>", ">");
+
+ return text;
+ }
- 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<String> modifyElement(String xml, String elementTag, String newValue) throws IOException, TransformerException,
- ParserConfigurationException, SAXException {
+ /**
+ * 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;
+ }
+ }
- 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());
- }
+ /**
+ * 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<String> 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/test/java/org/onap/so/bpmn/core/BadInjectedFiledExceptionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BadInjectedFiledExceptionTest.java
index b35e65485f..67b33602dd 100644
--- 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
@@ -1,22 +1,17 @@
/*
-* ============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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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;
@@ -25,22 +20,22 @@ 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());
-
- }
+ 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
index 40fcb982c1..49f373c01e 100644
--- 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
@@ -1,22 +1,17 @@
/*
-* ============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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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;
@@ -24,7 +19,6 @@ 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;
@@ -33,215 +27,215 @@ 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);
- }
-
+ 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
index 2415e619d7..965a9cc04d 100644
--- 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
@@ -24,17 +24,14 @@ 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;
@@ -55,37 +52,35 @@ 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/");
- }
- }
+ 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
index b0aa41b05d..1bc0153956 100644
--- 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
@@ -1,22 +1,17 @@
/*
-* ============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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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;
@@ -25,15 +20,15 @@ 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());
- }
+ 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
index b605209739..b06837aa0d 100644
--- 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
@@ -1,29 +1,23 @@
/*
-* ============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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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;
@@ -33,78 +27,79 @@ 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 = "<ErrorMessage>any error message!</ErrorMessage><ErrorCode>200</ErrorCode>";
- private String response = "<WorkflowResponse>bad</WorkflowResponse>";
-
- 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());
- }
+ 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 = "<ErrorMessage>any error message!</ErrorMessage><ErrorCode>200</ErrorCode>";
+ private String response = "<WorkflowResponse>bad</WorkflowResponse>";
+
+ 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 = "<WorkflowResponse>good</WorkflowResponse>";
+ when(mockExecution.getVariable("WorkflowResponse")).thenReturn(workflowResponse);
+ obj = responseBuilder.buildWorkflowResponse(mockExecution);
+ assertEquals(workflowResponse, obj);
+ }
- @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 = "<WorkflowResponse>good</WorkflowResponse>";
- 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
index 875df6cf94..86a9ecf57e 100644
--- 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
@@ -29,7 +29,6 @@ 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 {
@@ -48,11 +47,11 @@ public class RollbackDataTest {
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}]")));
+ 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
@@ -89,4 +88,4 @@ public class RollbackDataTest {
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
index 5d9a1d61f2..f0c3d39625 100644
--- 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
@@ -24,36 +24,35 @@ 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() {
+ public void testGetVariableFromExecution() {
ExecutionEntity mockExecution = mock(ExecutionEntity.class);
when(mockExecution.getVariable("testKey")).thenReturn("testValue");
- String value = UrnPropertiesReader.getVariable("testKey",mockExecution);
+ String value = UrnPropertiesReader.getVariable("testKey", mockExecution);
Assert.assertEquals("testValue", value);
verify(mockExecution).getVariable("testKey");
verify(mockExecution, never()).setVariable("testKey", value);
}
@Test
- public void testGetVariableFromEnvironment() {
+ 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);
+ String value = UrnPropertiesReader.getVariable("testKey", mockExecution);
+ Assert.assertEquals("testValue", value);
verify(mockExecution).getVariable("testKey");
verify(mockExecution).setVariable("testKey", value);
}
@Test
- public void testGetVariableNotExist() {
+ public void testGetVariableNotExist() {
ExecutionEntity mockExecution = mock(ExecutionEntity.class);
String value = UrnPropertiesReader.getVariable("notExist", mockExecution);
Assert.assertEquals(null, 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
index c1e9b8776b..2792b1bd73 100644
--- 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
@@ -1,47 +1,41 @@
/*
-* ============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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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());
- }
+ 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
index cca28d411f..fcd502f982 100644
--- 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
@@ -1,66 +1,59 @@
/*
-* ============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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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 com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
-
import java.io.IOException;
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");
-
- }
-
- @Test
- public void allottedResourceMapperTest() throws IOException {
- String jsonStr = "{\"allottedResourceType\": \"code123\", \"resourceInput\": \"sample\"}";
- ObjectMapper objectMapper = new ObjectMapper();
- AllottedResource vnfResource = objectMapper.readValue(jsonStr, AllottedResource.class);
-
- assertTrue(vnfResource != null);
- }
+ 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");
+
+ }
+
+ @Test
+ public void allottedResourceMapperTest() throws IOException {
+ String jsonStr = "{\"allottedResourceType\": \"code123\", \"resourceInput\": \"sample\"}";
+ ObjectMapper objectMapper = new ObjectMapper();
+ AllottedResource vnfResource = objectMapper.readValue(jsonStr, AllottedResource.class);
+
+ assertTrue(vnfResource != null);
+ }
}
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
index af9c7a7fa6..4c371d3cff 100644
--- 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
@@ -1,83 +1,76 @@
/*
-* ============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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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<ResourceModelInfo> addedResourceList;
- private List<ResourceModelInfo> deletedResourceList;
- private ResourceModelInfo resourceModelInfo1;
- private ResourceModelInfo resourceModelInfo2;
- private List<String> 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<ResourceModelInfo>();
- addedResourceList.add(resourceModelInfo1);
- addedResourceList.add(resourceModelInfo2);
- modelsResult = new CompareModelsResult();
- modelsResult.setAddedResourceList(addedResourceList);
- assertEquals(addedResourceList, modelsResult.getAddedResourceList());
- }
- @Test
- public void testSetDeletedResourceList() {
- deletedResourceList = new ArrayList<ResourceModelInfo>();
- deletedResourceList.add(resourceModelInfo1);
- deletedResourceList.add(resourceModelInfo2);
- modelsResult = new CompareModelsResult();
- modelsResult.setDeletedResourceList(deletedResourceList);
- assertEquals(deletedResourceList, modelsResult.getDeletedResourceList());
- }
+ private CompareModelsResult modelsResult;
+ private List<ResourceModelInfo> addedResourceList;
+ private List<ResourceModelInfo> deletedResourceList;
+ private ResourceModelInfo resourceModelInfo1;
+ private ResourceModelInfo resourceModelInfo2;
+ private List<String> 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<ResourceModelInfo>();
+ addedResourceList.add(resourceModelInfo1);
+ addedResourceList.add(resourceModelInfo2);
+ modelsResult = new CompareModelsResult();
+ modelsResult.setAddedResourceList(addedResourceList);
+ assertEquals(addedResourceList, modelsResult.getAddedResourceList());
+ }
+
+ @Test
+ public void testSetDeletedResourceList() {
+ deletedResourceList = new ArrayList<ResourceModelInfo>();
+ deletedResourceList.add(resourceModelInfo1);
+ deletedResourceList.add(resourceModelInfo2);
+ modelsResult = new CompareModelsResult();
+ modelsResult.setDeletedResourceList(deletedResourceList);
+ assertEquals(deletedResourceList, modelsResult.getDeletedResourceList());
+ }
+
+ @Test
+ public void testSetRequestInputs() {
+ requestInputs = new ArrayList<String>();
+ requestInputs.add("requestInput1");
+ requestInputs.add("requestInput2");
+ modelsResult = new CompareModelsResult();
+ modelsResult.setRequestInputs(requestInputs);
+ assertEquals(requestInputs, modelsResult.getRequestInputs());
+ }
- @Test
- public void testSetRequestInputs() {
- requestInputs = new ArrayList<String>();
- 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
index 13a30d26ee..1e1595f048 100644
--- 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
@@ -1,39 +1,34 @@
/*
-* ============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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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;
- }
+ private ConfigResource configresource = new ConfigResource();
+ {
+ configresource.resourceType = ResourceType.CONFIGURATION;
+ }
+
+ @Test
+ public void testConfigResource() {
+ configresource.setToscaNodeType("toscaNodeType");
+ assertEquals(configresource.getToscaNodeType(), "toscaNodeType");
+
- @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
index fe84a1b5a7..68839a7ad6 100644
--- 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
@@ -1,47 +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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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();
+ 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");
- }
+ @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
index 86eb717664..9640cfce07 100644
--- 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
@@ -1,38 +1,32 @@
/*
-* ============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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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();
+ private Customer customer = new Customer();
+
+ @Test
+ public void testCustomer() {
+ customer.setSubscriptionServiceType("subscriptionServiceType");
+ customer.setGlobalSubscriberId("globalSubscriberId");
+ assertEquals(customer.getSubscriptionServiceType(), "subscriptionServiceType");
+ assertEquals(customer.getGlobalSubscriberId(), "globalSubscriberId");
- @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
index b4860c6323..ae1aff7275 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -33,24 +32,21 @@ 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/");
- }
- }
+ 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
index 9750e03b4c..249307cbbc 100644
--- 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
@@ -1,58 +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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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);
-
- }
+ 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
index f3a96bf4eb..bacaaf77c9 100644
--- 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
@@ -1,54 +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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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.assertEquals;
-
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Test;
-public class LicenseTest {
-
- private License license= new License();
- List<String> entitlementPoolList = new ArrayList<String>();
- private List<String> licenseKeyGroupList = new ArrayList<String>();
-
- Long serialVersionUID = 333L;
-
- @Test
- public void testLicense() {
- license.setEntitlementPoolList(entitlementPoolList);
- license.setLicenseKeyGroupList(licenseKeyGroupList);
- license.addLicenseKeyGroup("licenseKeyGroupUuid");
- assertEquals(license.getEntitlementPoolList(), entitlementPoolList);
- assertEquals(license.getLicenseKeyGroupList(), licenseKeyGroupList);
- assert(license.getEntitlementPoolListAsString()!= null);
- assert(license.getLicenseKeyGroupListAsString()!=null);
- license.addEntitlementPool("entitlementPoolUuid");
-
-
- }
-
+public class LicenseTest {
+
+ private License license = new License();
+ List<String> entitlementPoolList = new ArrayList<String>();
+ private List<String> licenseKeyGroupList = new ArrayList<String>();
+
+ Long serialVersionUID = 333L;
+
+ @Test
+ public void testLicense() {
+ license.setEntitlementPoolList(entitlementPoolList);
+ license.setLicenseKeyGroupList(licenseKeyGroupList);
+ license.addLicenseKeyGroup("licenseKeyGroupUuid");
+ assertEquals(license.getEntitlementPoolList(), entitlementPoolList);
+ assertEquals(license.getLicenseKeyGroupList(), licenseKeyGroupList);
+ assert (license.getEntitlementPoolListAsString() != null);
+ assert (license.getLicenseKeyGroupListAsString() != null);
+ license.addEntitlementPool("entitlementPoolUuid");
+
+
+ }
+
}
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
index 3d07f85c04..807338745f 100644
--- 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
@@ -1,47 +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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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();
+ 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");
- }
+ @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
index dcb62cfc40..6e915b2a60 100644
--- 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
@@ -1,48 +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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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();
+ private ModuleResource moduleresource = new ModuleResource();
+
+ @Test
+ public void testModuleResource() {
- @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);
- }
+ 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
index ee23ebd438..668d6dc1de 100644
--- 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
@@ -1,54 +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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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 com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
-
import java.io.IOException;
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");
-
- }
-
- @Test
- public void networkResourceMapperTest() throws IOException {
- String jsonStr = "{\"networkScope\": \"code123\", \"resourceInput\": \"sample\"}";
- ObjectMapper objectMapper = new ObjectMapper();
- NetworkResource networkResource = objectMapper.readValue(jsonStr, NetworkResource.class);
-
- assertTrue(networkResource != null);
- }
+ 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");
+
+ }
+
+ @Test
+ public void networkResourceMapperTest() throws IOException {
+ String jsonStr = "{\"networkScope\": \"code123\", \"resourceInput\": \"sample\"}";
+ ObjectMapper objectMapper = new ObjectMapper();
+ NetworkResource networkResource = objectMapper.readValue(jsonStr, NetworkResource.class);
+
+ assertTrue(networkResource != null);
+ }
}
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
index 396d866446..23a1d866a2 100644
--- 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
@@ -1,39 +1,33 @@
/*
-* ============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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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();
+ private OwningEntity oe = new OwningEntity();
+
+ @Test
+ public void testOwingEntity() {
+ oe.setOwningEntityId("owningEntityId");
+ oe.setOwningEntityName("owningEntityName");
+ assertEquals(oe.getOwningEntityId(), "owningEntityId");
+ assertEquals(oe.getOwningEntityName(), "owningEntityName");
- @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
index 9081f9dd14..47ce61b8fe 100644
--- 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
@@ -1,36 +1,30 @@
/*
-* ============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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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");
- }
+ 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
index 0c552ce19e..a890289943 100644
--- 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
@@ -1,44 +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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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");
-
- }
+ 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
index 573ffab4aa..112139ce95 100644
--- 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
@@ -1,50 +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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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");
- }
+ 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
index afdbcd9f98..271ed6b32e 100644
--- 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
@@ -1,68 +1,60 @@
/*
-* ============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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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();
+ 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);
+
+
- @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
index 5d8d55152c..5db277628e 100644
--- 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
@@ -1,22 +1,17 @@
/*
-* ============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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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;
@@ -24,104 +19,109 @@ 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);
-
- System.out.println(serviceDecomp.toJsonString());
-
- 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());
- }
+ 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);
+
+ System.out.println(serviceDecomp.toJsonString());
+
+ 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
index c04dc9d601..1fb51412f6 100644
--- 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
@@ -1,71 +1,64 @@
/*
-* ============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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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.io.IOException;
import java.util.Map;
-
import com.fasterxml.jackson.databind.ObjectMapper;
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");
-
-
- }
+ 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");
+
+
+ }
- @Test
- public void serviceInstanceMapperTest() throws IOException {
- String jsonStr = "{\"workloadContext\": \"code123\", \"resourceOrder\": \"sample\"}";
- ObjectMapper objectMapper = new ObjectMapper();
- ServiceInstance serviceInstance = objectMapper.readValue(jsonStr, ServiceInstance.class);
- assertTrue(serviceInstance != null);
- }
+ @Test
+ public void serviceInstanceMapperTest() throws IOException {
+ String jsonStr = "{\"workloadContext\": \"code123\", \"resourceOrder\": \"sample\"}";
+ ObjectMapper objectMapper = new ObjectMapper();
+ ServiceInstance serviceInstance = objectMapper.readValue(jsonStr, ServiceInstance.class);
+ assertTrue(serviceInstance != null);
+ }
}
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
index b862c8704f..8f1b666d0b 100644
--- 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
@@ -1,41 +1,35 @@
/*
-* ============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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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");
+ 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");
+
- @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
index 5271bb3c53..09bcfe8470 100644
--- 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
@@ -1,100 +1,93 @@
/*
-* ============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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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.io.IOException;
import java.util.ArrayList;
import java.util.List;
-
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
public class VnfResourceTest {
- private final static String ALL_VF_MODULES_JSON =
- "{\"ArrayList\":[{\"resourceType\":\"MODULE\",\"resourceInstance\":{},\"homingSolution\":{\"license\":{},\"rehome\":false},\"vfModuleName\":\"vfModuleName\",\"vfModuleType\":\"vfModuleType\",\"heatStackId\":\"heatStackId\",\"hasVolumeGroup\":true,\"isBase\":true,\"vfModuleLabel\":\"vfModuleLabel\",\"initialCount\":0},{\"resourceType\":\"MODULE\",\"resourceInstance\":{},\"homingSolution\":{\"license\":{},\"rehome\":false},\"vfModuleName\":\"vfModuleName\",\"vfModuleType\":\"vfModuleType\",\"heatStackId\":\"heatStackId\",\"hasVolumeGroup\":true,\"isBase\":true,\"vfModuleLabel\":\"vfModuleLabel\",\"initialCount\":0}]}";
-
- private VnfResource vnf= new VnfResource();
- List<ModuleResource> 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");
-
-
- }
-
- @Test
- public void vnfResourceMapperTest() throws IOException {
- String jsonStr = "{\"vnfHostname\": \"home\", \"resourceInput\": \"sample\"}";
- ObjectMapper objectMapper = new ObjectMapper();
- VnfResource vnfResource = objectMapper.readValue(jsonStr, VnfResource.class);
-
- assertTrue(vnfResource != null);
- }
-
- @Test
- public void testVfModules() {
-
- moduleResources = new ArrayList<>();
-
- ModuleResource moduleresource = new ModuleResource();
- moduleresource.setVfModuleName("vfModuleName");
- moduleresource.setHeatStackId("heatStackId");
- moduleresource.setIsBase(true);
- moduleresource.setVfModuleLabel("vfModuleLabel");
- moduleresource.setInitialCount(0);
- moduleresource.setVfModuleType("vfModuleType");
- moduleresource.setHasVolumeGroup(true);
-
- moduleResources.add(moduleresource);
-
- vnf.setModules(moduleResources);
- assertEquals(vnf.getVfModules(), moduleResources);
-
- List<ModuleResource> moduleResources = vnf.getAllVfModuleObjects();
- assertEquals(1, moduleResources.size());
-
- vnf.addVfModule(moduleresource);
- moduleResources = vnf.getAllVfModuleObjects();
- assertEquals(2, moduleResources.size());
-
- assertEquals(ALL_VF_MODULES_JSON, vnf.getAllVfModulesJson());
-
- }
+ private final static String ALL_VF_MODULES_JSON =
+ "{\"ArrayList\":[{\"resourceType\":\"MODULE\",\"resourceInstance\":{},\"homingSolution\":{\"license\":{},\"rehome\":false},\"vfModuleName\":\"vfModuleName\",\"vfModuleType\":\"vfModuleType\",\"heatStackId\":\"heatStackId\",\"hasVolumeGroup\":true,\"isBase\":true,\"vfModuleLabel\":\"vfModuleLabel\",\"initialCount\":0},{\"resourceType\":\"MODULE\",\"resourceInstance\":{},\"homingSolution\":{\"license\":{},\"rehome\":false},\"vfModuleName\":\"vfModuleName\",\"vfModuleType\":\"vfModuleType\",\"heatStackId\":\"heatStackId\",\"hasVolumeGroup\":true,\"isBase\":true,\"vfModuleLabel\":\"vfModuleLabel\",\"initialCount\":0}]}";
+
+ private VnfResource vnf = new VnfResource();
+ List<ModuleResource> 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");
+
+
+ }
+
+ @Test
+ public void vnfResourceMapperTest() throws IOException {
+ String jsonStr = "{\"vnfHostname\": \"home\", \"resourceInput\": \"sample\"}";
+ ObjectMapper objectMapper = new ObjectMapper();
+ VnfResource vnfResource = objectMapper.readValue(jsonStr, VnfResource.class);
+
+ assertTrue(vnfResource != null);
+ }
+
+ @Test
+ public void testVfModules() {
+
+ moduleResources = new ArrayList<>();
+
+ ModuleResource moduleresource = new ModuleResource();
+ moduleresource.setVfModuleName("vfModuleName");
+ moduleresource.setHeatStackId("heatStackId");
+ moduleresource.setIsBase(true);
+ moduleresource.setVfModuleLabel("vfModuleLabel");
+ moduleresource.setInitialCount(0);
+ moduleresource.setVfModuleType("vfModuleType");
+ moduleresource.setHasVolumeGroup(true);
+
+ moduleResources.add(moduleresource);
+
+ vnf.setModules(moduleResources);
+ assertEquals(vnf.getVfModules(), moduleResources);
+
+ List<ModuleResource> moduleResources = vnf.getAllVfModuleObjects();
+ assertEquals(1, moduleResources.size());
+
+ vnf.addVfModule(moduleresource);
+ moduleResources = vnf.getAllVfModuleObjects();
+ assertEquals(2, moduleResources.size());
+
+ assertEquals(ALL_VF_MODULES_JSON, vnf.getAllVfModulesJson());
+
+ }
}
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
index 14b8c49655..e62ff09545 100644
--- 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
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.core.internal;
+
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.*;
import static org.mockito.ArgumentMatchers.contains;
-
import java.util.Optional;
import org.junit.Test;
@@ -86,4 +86,4 @@ public class VariableNameExtractorTest {
// 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
index c1f7cce30b..3a8948c00d 100644
--- 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
@@ -1,27 +1,21 @@
/*
-* ============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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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;
@@ -34,137 +28,140 @@ 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;
- }
+ 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
index 6c8b7326e2..a9df2d9ea6 100644
--- 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
@@ -1,22 +1,17 @@
/*
-* ============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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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;
@@ -25,14 +20,14 @@ 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());
- }
+ 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
index 667027f8de..1a2ceb5b39 100644
--- 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
@@ -22,12 +22,10 @@ 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;
@@ -46,102 +44,78 @@ import org.xmlunit.diff.ElementSelectors;
public class JsonUtils2Test {
private static final String EOL = "\n";
- private static final String XML_REQ =
- "<vnf-request xmlns=\"http://org.onap/so/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <request-id>DEV-VF-0021</request-id>" + EOL +
- " <action>CREATE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <vf-module-model-name>STMTN5MMSC21-MMSC::model-1-0</vf-module-model-name>" + EOL +
- " <is-base-module>true</is-base-module>" + EOL +
- " <persona-model-id>00000000-0000-0000-0000-000000000000</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <vnf-persona-model-id>999999999-0000-0000-0000-000000000000</vnf-persona-model-id>" + EOL +
- " <vnf-persona-model-version>1.5</vnf-persona-model-version>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " <asdc-service-model-version>1</asdc-service-model-version>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://org.onap/so/infra/vnf-request/v1\">" + EOL +
- " <param name=\"network\">network1111</param>" + EOL +
- " <param name=\"server\">server1111</param>" + EOL +
- " </vnf-params> " + EOL +
- "</vnf-request>" + EOL;
-
- private static final String XML_REQ_NO_ATTRS =
- "<vnf-request xmlns=\"http://org.onap/so/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://org.onap/so/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
+ private static final String XML_REQ = "<vnf-request xmlns=\"http://org.onap/so/infra/vnf-request/v1\">" + EOL
+ + " <request-info>" + EOL + " <request-id>DEV-VF-0021</request-id>" + EOL
+ + " <action>CREATE_VF_MODULE</action>" + EOL + " <source>PORTAL</source>" + EOL + " </request-info>"
+ + EOL + " <vnf-inputs>" + EOL + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL + " <vnf-type>asc_heat-int</vnf-type>" + EOL
+ + " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <vf-module-model-name>STMTN5MMSC21-MMSC::model-1-0</vf-module-model-name>" + EOL
+ + " <is-base-module>true</is-base-module>" + EOL
+ + " <persona-model-id>00000000-0000-0000-0000-000000000000</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <vnf-persona-model-id>999999999-0000-0000-0000-000000000000</vnf-persona-model-id>" + EOL
+ + " <vnf-persona-model-version>1.5</vnf-persona-model-version>" + EOL
+ + " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL
+ + " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL
+ + " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL
+ + " <orchestration-status>pending-delete</orchestration-status>" + EOL
+ + " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL
+ + " <asdc-service-model-version>1</asdc-service-model-version>" + EOL + " </vnf-inputs>" + EOL
+ + " <vnf-params xmlns:tns=\"http://org.onap/so/infra/vnf-request/v1\">" + EOL
+ + " <param name=\"network\">network1111</param>" + EOL + " <param name=\"server\">server1111</param>"
+ + EOL + " </vnf-params> " + EOL + "</vnf-request>" + EOL;
+
+ private static final String XML_REQ_NO_ATTRS = "<vnf-request xmlns=\"http://org.onap/so/infra/vnf-request/v1\">"
+ + EOL + " <request-info>" + EOL + " <action>DELETE_VF_MODULE</action>" + EOL
+ + " <source>PORTAL</source>" + EOL + " </request-info>" + EOL + " <vnf-inputs>" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL + " <vnf-type>asc_heat-int</vnf-type>" + EOL
+ + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL
+ + " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL
+ + " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL
+ + " <orchestration-status>pending-delete</orchestration-status>" + EOL
+ + " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL + " </vnf-inputs>" + EOL
+ + " <vnf-params xmlns:tns=\"http://org.onap/so/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>" + EOL;
private static final String XML_ARRAY_REQ =
- "<ucpeInfo>" + EOL +
- " <outOfBandManagementModem>BROADBAND</outOfBandManagementModem>" + EOL +
- " <internetTopology>IVLAN</internetTopology>" + EOL +
- " <ucpeAliasHostName>SHELLUCPE31</ucpeAliasHostName>" + EOL +
- " <wanList>" + EOL +
- " <wanInfo>" + EOL +
- " <wanType>AVPN</wanType>" + EOL +
- " <interfaceType>1000BASE-T</interfaceType>" + EOL +
- " <transportProviderName>ATT</transportProviderName>" + EOL +
- " <circuitId>BT/SLIR/70911</circuitId>" + EOL +
- " <dualMode>Active</dualMode>" + EOL +
- " <wanPortNumber>WAN1</wanPortNumber>" + EOL +
- " <transportManagementOption>ATT</transportManagementOption>" + EOL +
- " <transportVendorTotalBandwidth>100</transportVendorTotalBandwidth>" + EOL +
- " <mediaType>ELECTRICAL</mediaType>" + EOL +
- " </wanInfo>" + EOL +
- " <wanInfo>" + EOL +
- " <wanType>AVPN</wanType>" + EOL +
- " <interfaceType>10/100/1000BASE-T</interfaceType>" + EOL +
- " <transportProviderName>ATT</transportProviderName>" + EOL +
- " <circuitId>AS/KRFN/34611</circuitId>" + EOL +
- " <dualMode>Active</dualMode>" + EOL +
- " <wanPortNumber>WAN2</wanPortNumber>" + EOL +
- " <transportManagementOption>ATT</transportManagementOption>" + EOL +
- " <transportVendorTotalBandwidth>10000</transportVendorTotalBandwidth>" + EOL +
- " <mediaType>MMF</mediaType>" + EOL +
- " </wanInfo>" + EOL +
- " </wanList>" + EOL +
- " <ucpeActivationCode>ASD-987-M31</ucpeActivationCode>" + EOL +
- " <ucpeHostName>USOSTCDALTX0101UJZZ31</ucpeHostName>" + EOL +
- " <ucpePartNumber>FG-VM00*</ucpePartNumber>" + EOL +
- "</ucpeInfo>";
+ "<ucpeInfo>" + EOL + " <outOfBandManagementModem>BROADBAND</outOfBandManagementModem>" + EOL
+ + " <internetTopology>IVLAN</internetTopology>" + EOL
+ + " <ucpeAliasHostName>SHELLUCPE31</ucpeAliasHostName>" + EOL + " <wanList>" + EOL
+ + " <wanInfo>" + EOL + " <wanType>AVPN</wanType>" + EOL
+ + " <interfaceType>1000BASE-T</interfaceType>" + EOL
+ + " <transportProviderName>ATT</transportProviderName>" + EOL
+ + " <circuitId>BT/SLIR/70911</circuitId>" + EOL
+ + " <dualMode>Active</dualMode>" + EOL
+ + " <wanPortNumber>WAN1</wanPortNumber>" + EOL
+ + " <transportManagementOption>ATT</transportManagementOption>" + EOL
+ + " <transportVendorTotalBandwidth>100</transportVendorTotalBandwidth>" + EOL
+ + " <mediaType>ELECTRICAL</mediaType>" + EOL + " </wanInfo>" + EOL
+ + " <wanInfo>" + EOL + " <wanType>AVPN</wanType>" + EOL
+ + " <interfaceType>10/100/1000BASE-T</interfaceType>" + EOL
+ + " <transportProviderName>ATT</transportProviderName>" + EOL
+ + " <circuitId>AS/KRFN/34611</circuitId>" + EOL
+ + " <dualMode>Active</dualMode>" + EOL
+ + " <wanPortNumber>WAN2</wanPortNumber>" + EOL
+ + " <transportManagementOption>ATT</transportManagementOption>" + EOL
+ + " <transportVendorTotalBandwidth>10000</transportVendorTotalBandwidth>" + EOL
+ + " <mediaType>MMF</mediaType>" + EOL + " </wanInfo>" + EOL
+ + " </wanList>" + EOL + " <ucpeActivationCode>ASD-987-M31</ucpeActivationCode>" + EOL
+ + " <ucpeHostName>USOSTCDALTX0101UJZZ31</ucpeHostName>" + EOL
+ + " <ucpePartNumber>FG-VM00*</ucpePartNumber>" + EOL + "</ucpeInfo>";
// 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);
@@ -149,16 +123,16 @@ public class JsonUtils2Test {
@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
-
+ // 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);
+ String xmlOut = JsonUtils.json2xml(json);
// then
Diff diffXml = DiffBuilder.compare(xmlIn).withTest(xmlOut).ignoreWhitespace()
.withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName)).checkForSimilar().build();
@@ -214,7 +188,7 @@ public class JsonUtils2Test {
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
@@ -265,11 +239,11 @@ public class JsonUtils2Test {
// 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);
+ 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
@@ -282,26 +256,26 @@ public class JsonUtils2Test {
// 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));
+ 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);
+ 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);
+ 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();
@@ -311,19 +285,19 @@ public class JsonUtils2Test {
@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();
- }
+ 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
index 067ae9806d..36ffc0b04d 100644
--- 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
@@ -23,13 +23,11 @@ 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;
@@ -43,203 +41,232 @@ 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<String, String> 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<String, String> map = utils.entryArrayToMap(execution, assignmentInfo.toString(), "variableName", "variableValue");
- assertEquals(map.get("cloudOwner"), "CloudOwner");
- }
- @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<String, String> map = utils.entryArrayToMap(assignmentInfo.toString(), "variableName", "variableValue");
- assertEquals(map.get("cloudOwner"), "CloudOwner");
- }
- @Test
- public void entryArrayToMapStringTestOof() throws IOException {
- JsonUtils utils = new JsonUtils();
- String response = this.getJson("OofExample.json");
- String entry = JsonUtils.getJsonValue(response, "solutions.placementSolutions");
- JSONArray arr = new JSONArray(entry);
- JSONArray arr2 = arr.getJSONArray(0);
- JSONObject homingDataJson = arr2.getJSONObject(0);
- JSONArray assignmentInfo = homingDataJson.getJSONArray("assignmentInfo");
- Map<String, String> map = utils.entryArrayToMap(assignmentInfo.toString(), "key", "value");
- assertEquals(map.get("cloudOwner"), "HPA-cloud");
- }
- @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<String> 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<String> 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<String> 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 = "<name>myName</name>";
- assertEquals(expectedJson, JsonUtils.xml2json(xml,false));
- }
- @Test
- public void xml2jsonErrorTest() throws IOException {
- String malformedXml = "<name>myName<name>";
- assertNull(JsonUtils.xml2json(malformedXml));
- }
- @Test
- public void json2xmlTest() throws IOException {
- String expectedXml = "<name>myName</name>";
- 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)));
- }
+ @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<String, String> 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<String, String> map =
+ utils.entryArrayToMap(execution, assignmentInfo.toString(), "variableName", "variableValue");
+ assertEquals(map.get("cloudOwner"), "CloudOwner");
+ }
+
+ @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<String, String> map = utils.entryArrayToMap(assignmentInfo.toString(), "variableName", "variableValue");
+ assertEquals(map.get("cloudOwner"), "CloudOwner");
+ }
+
+ @Test
+ public void entryArrayToMapStringTestOof() throws IOException {
+ JsonUtils utils = new JsonUtils();
+ String response = this.getJson("OofExample.json");
+ String entry = JsonUtils.getJsonValue(response, "solutions.placementSolutions");
+ JSONArray arr = new JSONArray(entry);
+ JSONArray arr2 = arr.getJSONArray(0);
+ JSONObject homingDataJson = arr2.getJSONObject(0);
+ JSONArray assignmentInfo = homingDataJson.getJSONArray("assignmentInfo");
+ Map<String, String> map = utils.entryArrayToMap(assignmentInfo.toString(), "key", "value");
+ assertEquals(map.get("cloudOwner"), "HPA-cloud");
+ }
+
+ @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<String> 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<String> 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<String> 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 = "<name>myName</name>";
+ assertEquals(expectedJson, JsonUtils.xml2json(xml, false));
+ }
+
+ @Test
+ public void xml2jsonErrorTest() throws IOException {
+ String malformedXml = "<name>myName<name>";
+ assertNull(JsonUtils.xml2json(malformedXml));
+ }
+
+ @Test
+ public void json2xmlTest() throws IOException {
+ String expectedXml = "<name>myName</name>";
+ 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
index 15f6fbe008..b6a2e789ba 100644
--- 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
@@ -25,7 +25,6 @@ package org.onap.so.bpmn.core.utils;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -33,43 +32,42 @@ import org.slf4j.LoggerFactory;
* Sets up the unit test (H2) database for Camunda.
*/
public class CamundaDBSetup {
- private static boolean isDBConfigured = false;
- private static final Logger logger = LoggerFactory.getLogger(CamundaDBSetup.class);
-
- private CamundaDBSetup() {
- }
-
- public static synchronized void configure() throws SQLException {
- if (isDBConfigured) {
- return;
- }
+ private static boolean isDBConfigured = false;
+ private static final Logger logger = LoggerFactory.getLogger(CamundaDBSetup.class);
+
+ private CamundaDBSetup() {}
+
+ public static synchronized void configure() throws SQLException {
+ if (isDBConfigured) {
+ return;
+ }
+
+ logger.debug("Configuring the Camunda H2 database for MSO");
- logger.debug ("Configuring the Camunda H2 database for MSO");
+ Connection connection = null;
+ PreparedStatement stmt = null;
- Connection connection = null;
- PreparedStatement stmt = null;
+ try {
- try {
+ isDBConfigured = true;
- isDBConfigured = true;
-
- } finally {
- if (stmt != null) {
- try {
- stmt.close();
- } catch (Exception e) {
- logger.debug("Exception :",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);
- }
- }
- }
- }
+ if (connection != null) {
+ try {
+ connection.close();
+ } catch (Exception e) {
+ logger.debug("Exception :", e);
+ }
+ }
+ }
+ }
}
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
index 6bad0c6c29..d099cbebcc 100644
--- 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
@@ -1,82 +1,72 @@
/*
-* ============LICENSE_START=======================================================
- * ONAP : SO
- * ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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 = "<Response>good</Response>";
- private String responseModified = "<Response>veryGood</Response>";
- private String encodeResponse = "&lt;Response&gt;good&lt;/Response&gt;";
- private String encodeResponseNamespace = "<Response xmlns:ns2=\"http://ecomp.att.com/mso/request/types/v1\">good</Response>";
- private String attribute = "<Response>good&\"bad\"</Response>";
- private String updatedAttribute = "&lt;Response&gt;good&amp;&quot;bad&quot;&lt;/Response&gt;";
+ private String response = "<Response>good</Response>";
+ private String responseModified = "<Response>veryGood</Response>";
+ private String encodeResponse = "&lt;Response&gt;good&lt;/Response&gt;";
+ private String encodeResponseNamespace =
+ "<Response xmlns:ns2=\"http://ecomp.att.com/mso/request/types/v1\">good</Response>";
+ private String attribute = "<Response>good&\"bad\"</Response>";
+ private String updatedAttribute = "&lt;Response&gt;good&amp;&quot;bad&quot;&lt;/Response&gt;";
+
+ private String content = "<dummy><configuration-event>" + "<event-type>test</event-type>"
+ + "<event-correlator-type>test</event-correlator-type>" + "<event-correlator>123</event-correlator>"
+ + "<event-parameters><event-parameter>" + "<tag-name>test</tag-name>"
+ + "<tag-value>test</tag-value></event-parameter></event-parameters>" + "</configuration-event></dummy>";
+
+ @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<String> 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);
- private String content = "<dummy><configuration-event>" +
- "<event-type>test</event-type>" +
- "<event-correlator-type>test</event-correlator-type>" +
- "<event-correlator>123</event-correlator>" +
- "<event-parameters><event-parameter>" +
- "<tag-name>test</tag-name>" +
- "<tag-value>test</tag-value></event-parameter></event-parameters>" +
- "</configuration-event></dummy>";
-
- @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<String> 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"));
- }
+ 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 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);
- }
+ @Test
+ public void modifyElementTest() throws Exception {
+ String response = XmlTool.modifyElement(content, "event-type", "uCPE-VMS").get();
+ assertNotNull(response);
+ }
}
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
index bf4c59ca09..1172d77c13 100644
--- 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
@@ -28,9 +28,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -49,28 +51,24 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
- "requestId",
- "responseCode",
- "responseMessage"
-}, namespace="http://org.onap/workflow/sdnc/adapter/schema/v1")
+@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")
+ @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")
+ @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")
+ @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 }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getRequestId() {
return requestId;
@@ -79,10 +77,8 @@ public class CallbackHeader {
/**
* Sets the value of the requestId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setRequestId(String value) {
this.requestId = value;
@@ -91,10 +87,8 @@ public class CallbackHeader {
/**
* Gets the value of the responseCode property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getResponseCode() {
return responseCode;
@@ -103,10 +97,8 @@ public class CallbackHeader {
/**
* Sets the value of the responseCode property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setResponseCode(String value) {
this.responseCode = value;
@@ -115,10 +107,8 @@ public class CallbackHeader {
/**
* Gets the value of the responseMessage property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getResponseMessage() {
return responseMessage;
@@ -127,10 +117,8 @@ public class CallbackHeader {
/**
* Sets the value of the responseMessage property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @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
index a72e23e57f..721bc1d4f3 100644
--- 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
@@ -24,17 +24,13 @@ 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.
- * <p>An ObjectFactory allows you to programatically
- * construct new instances of the Java representation
- * for XML content. The Java representation of XML
- * content can consist of schema derived interfaces
- * and classes representing the binding of schema
- * type definitions, element declarations and model
- * groups. Factory methods for each of these are
- * provided in this class.
+ * 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.
+ * <p>
+ * An ObjectFactory allows you to programatically construct new instances of the Java representation for XML content.
+ * The Java representation of XML content can consist of schema derived interfaces and classes representing the binding
+ * of schema type definitions, element declarations and model groups. Factory methods for each of these are provided in
+ * this class.
*
*/
@XmlRegistry
@@ -42,11 +38,11 @@ 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
+ * 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() {
- }
+ public ObjectFactory() {}
/**
* Create an instance of {@link RequestHeader }
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
index 2c56a110db..58f5c468f5 100644
--- 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
@@ -28,9 +28,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -52,14 +54,7 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
- "requestId",
- "svcInstanceId",
- "svcAction",
- "svcOperation",
- "callbackUrl",
- "msoAction"
-})
+@XmlType(name = "", propOrder = {"requestId", "svcInstanceId", "svcAction", "svcOperation", "callbackUrl", "msoAction"})
@XmlRootElement(name = "RequestHeader")
public class RequestHeader {
@@ -79,10 +74,8 @@ public class RequestHeader {
/**
* Gets the value of the requestId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getRequestId() {
return requestId;
@@ -91,10 +84,8 @@ public class RequestHeader {
/**
* Sets the value of the requestId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setRequestId(String value) {
this.requestId = value;
@@ -103,10 +94,8 @@ public class RequestHeader {
/**
* Gets the value of the svcInstanceId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getSvcInstanceId() {
return svcInstanceId;
@@ -115,10 +104,8 @@ public class RequestHeader {
/**
* Sets the value of the svcInstanceId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setSvcInstanceId(String value) {
this.svcInstanceId = value;
@@ -127,10 +114,8 @@ public class RequestHeader {
/**
* Gets the value of the svcAction property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getSvcAction() {
return svcAction;
@@ -139,10 +124,8 @@ public class RequestHeader {
/**
* Sets the value of the svcAction property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setSvcAction(String value) {
this.svcAction = value;
@@ -151,10 +134,8 @@ public class RequestHeader {
/**
* Gets the value of the svcOperation property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getSvcOperation() {
return svcOperation;
@@ -163,10 +144,8 @@ public class RequestHeader {
/**
* Sets the value of the svcOperation property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setSvcOperation(String value) {
this.svcOperation = value;
@@ -175,10 +154,8 @@ public class RequestHeader {
/**
* Gets the value of the callbackUrl property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getCallbackUrl() {
return callbackUrl;
@@ -187,10 +164,8 @@ public class RequestHeader {
/**
* Sets the value of the callbackUrl property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setCallbackUrl(String value) {
this.callbackUrl = value;
@@ -199,10 +174,8 @@ public class RequestHeader {
/**
* Gets the value of the msoAction property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getMsoAction() {
return msoAction;
@@ -211,10 +184,8 @@ public class RequestHeader {
/**
* Sets the value of the msoAction property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @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
index e77232510a..2b4b8cb90f 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -33,9 +32,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -53,25 +54,21 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@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")
+@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")
+ @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")
+ @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 }
- *
+ * @return possible object is {@link CallbackHeader }
+ *
*/
public CallbackHeader getCallbackHeader() {
return callbackHeader;
@@ -80,10 +77,8 @@ public class SDNCAdapterCallbackRequest {
/**
* Sets the value of the callbackHeader property.
*
- * @param value
- * allowed object is
- * {@link CallbackHeader }
- *
+ * @param value allowed object is {@link CallbackHeader }
+ *
*/
public void setCallbackHeader(CallbackHeader value) {
this.callbackHeader = value;
@@ -92,10 +87,8 @@ public class SDNCAdapterCallbackRequest {
/**
* Gets the value of the requestData property.
*
- * @return
- * possible object is
- * {@link Object }
- *
+ * @return possible object is {@link Object }
+ *
*/
public Object getRequestData() {
return requestData;
@@ -104,27 +97,24 @@ public class SDNCAdapterCallbackRequest {
/**
* Sets the value of the requestData property.
*
- * @param value
- * allowed object is
- * {@link Object }
- *
+ * @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 "";
- }
- }
+ 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
index 179776d95d..0ae5f7a614 100644
--- 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
@@ -28,9 +28,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -48,10 +50,7 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
- "requestHeader",
- "requestData"
-})
+@XmlType(name = "", propOrder = {"requestHeader", "requestData"})
@XmlRootElement(name = "SDNCAdapterRequest")
public class SDNCAdapterRequest {
@@ -63,10 +62,8 @@ public class SDNCAdapterRequest {
/**
* Gets the value of the requestHeader property.
*
- * @return
- * possible object is
- * {@link RequestHeader }
- *
+ * @return possible object is {@link RequestHeader }
+ *
*/
public RequestHeader getRequestHeader() {
return requestHeader;
@@ -75,10 +72,8 @@ public class SDNCAdapterRequest {
/**
* Sets the value of the requestHeader property.
*
- * @param value
- * allowed object is
- * {@link RequestHeader }
- *
+ * @param value allowed object is {@link RequestHeader }
+ *
*/
public void setRequestHeader(RequestHeader value) {
this.requestHeader = value;
@@ -87,10 +82,8 @@ public class SDNCAdapterRequest {
/**
* Gets the value of the requestData property.
*
- * @return
- * possible object is
- * {@link Object }
- *
+ * @return possible object is {@link Object }
+ *
*/
public Object getRequestData() {
return requestData;
@@ -99,10 +92,8 @@ public class SDNCAdapterRequest {
/**
* Sets the value of the requestData property.
*
- * @param value
- * allowed object is
- * {@link Object }
- *
+ * @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
index 3666cb56a6..332b3ebbbd 100644
--- 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
@@ -27,9 +27,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
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
index eff70f5b12..887b1994d5 100644
--- 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
@@ -28,12 +28,11 @@ 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
+ * 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")
+@WebService(name = "SDNCCallbackAdapterPortType",
+ targetNamespace = "http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface SDNCCallbackAdapterPortType {
@@ -41,13 +40,13 @@ public interface SDNCCallbackAdapterPortType {
/**
*
* @param sdncAdapterCallbackRequest
- * @return
- * returns org.openecomp.domain2.workflow.sdnc.adapter.schema.v1.SDNCAdapterResponse
+ * @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);
+ @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
index ec341d82b5..88be09ee85 100644
--- 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
@@ -18,5 +18,6 @@
* ============LICENSE_END=========================================================
*/
-@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+@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
index aa348c7765..e1cb6fd38e 100644
--- 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
@@ -22,7 +22,6 @@ 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;
@@ -30,9 +29,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for createVnfNotification complex type.
+ * <p>
+ * Java class for createVnfNotification complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="createVnfNotification">
@@ -76,15 +77,8 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "createVnfNotification1", propOrder = {
- "messageId",
- "completed",
- "exception",
- "errorMessage",
- "vnfId",
- "outputs",
- "rollback"
-})
+@XmlType(name = "createVnfNotification1",
+ propOrder = {"messageId", "completed", "exception", "errorMessage", "vnfId", "outputs", "rollback"})
public class CreateVnfNotification {
@XmlElement(required = true)
@@ -99,10 +93,8 @@ public class CreateVnfNotification {
/**
* Gets the value of the messageId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getMessageId() {
return messageId;
@@ -111,10 +103,8 @@ public class CreateVnfNotification {
/**
* Sets the value of the messageId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setMessageId(String value) {
this.messageId = value;
@@ -139,10 +129,8 @@ public class CreateVnfNotification {
/**
* Gets the value of the exception property.
*
- * @return
- * possible object is
- * {@link MsoExceptionCategory }
- *
+ * @return possible object is {@link MsoExceptionCategory }
+ *
*/
public MsoExceptionCategory getException() {
return exception;
@@ -151,10 +139,8 @@ public class CreateVnfNotification {
/**
* Sets the value of the exception property.
*
- * @param value
- * allowed object is
- * {@link MsoExceptionCategory }
- *
+ * @param value allowed object is {@link MsoExceptionCategory }
+ *
*/
public void setException(MsoExceptionCategory value) {
this.exception = value;
@@ -163,10 +149,8 @@ public class CreateVnfNotification {
/**
* Gets the value of the errorMessage property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getErrorMessage() {
return errorMessage;
@@ -175,10 +159,8 @@ public class CreateVnfNotification {
/**
* Sets the value of the errorMessage property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setErrorMessage(String value) {
this.errorMessage = value;
@@ -187,10 +169,8 @@ public class CreateVnfNotification {
/**
* Gets the value of the vnfId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getVnfId() {
return vnfId;
@@ -199,10 +179,8 @@ public class CreateVnfNotification {
/**
* Sets the value of the vnfId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setVnfId(String value) {
this.vnfId = value;
@@ -211,10 +189,8 @@ public class CreateVnfNotification {
/**
* Gets the value of the outputs property.
*
- * @return
- * possible object is
- * {@link CreateVnfNotification.Outputs }
- *
+ * @return possible object is {@link CreateVnfNotification.Outputs }
+ *
*/
public CreateVnfNotification.Outputs getOutputs() {
return outputs;
@@ -223,10 +199,8 @@ public class CreateVnfNotification {
/**
* Sets the value of the outputs property.
*
- * @param value
- * allowed object is
- * {@link CreateVnfNotification.Outputs }
- *
+ * @param value allowed object is {@link CreateVnfNotification.Outputs }
+ *
*/
public void setOutputs(CreateVnfNotification.Outputs value) {
this.outputs = value;
@@ -235,10 +209,8 @@ public class CreateVnfNotification {
/**
* Gets the value of the rollback property.
*
- * @return
- * possible object is
- * {@link VnfRollback }
- *
+ * @return possible object is {@link VnfRollback }
+ *
*/
public VnfRollback getRollback() {
return rollback;
@@ -247,10 +219,8 @@ public class CreateVnfNotification {
/**
* Sets the value of the rollback property.
*
- * @param value
- * allowed object is
- * {@link VnfRollback }
- *
+ * @param value allowed object is {@link VnfRollback }
+ *
*/
public void setRollback(VnfRollback value) {
this.rollback = value;
@@ -258,9 +228,11 @@ public class CreateVnfNotification {
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -288,32 +260,29 @@ public class CreateVnfNotification {
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "entry"
- })
+ @XmlType(name = "", propOrder = {"entry"})
public static class Outputs {
protected List<CreateVnfNotification.Outputs.Entry> entry;
-
+
/**
* Gets the value of the entry property.
*
* <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the 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 <CODE>set</CODE>
+ * method for the entry property.
*
* <p>
* For example, to add a new item, do as follows:
+ *
* <pre>
- * getEntry().add(newItem);
+ * getEntry().add(newItem);
* </pre>
*
*
* <p>
- * Objects of the following type(s) are allowed in the list
- * {@link CreateVnfNotification.Outputs.Entry }
+ * Objects of the following type(s) are allowed in the list {@link CreateVnfNotification.Outputs.Entry }
*
*
*/
@@ -325,24 +294,26 @@ public class CreateVnfNotification {
}
// Not a generated method
- @Override
+ @Override
public String toString() {
- StringBuilder out = new StringBuilder();
- out.append("<outputs>\n");
- if (entry != null) {
- for (Entry e : entry) {
- out.append(e.toString());
- out.append('\n');
- }
- }
- out.append("</outputs>");
- return out.toString();
+ StringBuilder out = new StringBuilder();
+ out.append("<outputs>\n");
+ if (entry != null) {
+ for (Entry e : entry) {
+ out.append(e.toString());
+ out.append('\n');
+ }
+ }
+ out.append("</outputs>");
+ return out.toString();
}
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -360,10 +331,7 @@ public class CreateVnfNotification {
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "key",
- "value"
- })
+ @XmlType(name = "", propOrder = {"key", "value"})
public static class Entry {
protected String key;
@@ -372,10 +340,8 @@ public class CreateVnfNotification {
/**
* Gets the value of the key property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getKey() {
return key;
@@ -384,10 +350,8 @@ public class CreateVnfNotification {
/**
* Sets the value of the key property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setKey(String value) {
this.key = value;
@@ -396,10 +360,8 @@ public class CreateVnfNotification {
/**
* Gets the value of the value property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getValue() {
return value;
@@ -408,55 +370,45 @@ public class CreateVnfNotification {
/**
* Sets the value of the value property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @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 =
- "<entry>"+ '\n' +
- " <key>"+key+"</key>" + '\n' +
- " <value>"+value+"</value>" + '\n' +
- "</entry>";
- return entrystr;
+ String entrystr;
+ entrystr = "<entry>" + '\n' + " <key>" + key + "</key>" + '\n' + " <value>" + value + "</value>"
+ + '\n' + "</entry>";
+ return entrystr;
}
}
}
- // Not a generated method
- @Override
- public String toString() {
- String createVnfNotification;
- if (exception==null) {
- createVnfNotification = "<ns2:createVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- " <vnfId>"+vnfId+"</vnfId>" + '\n' +
- (outputs == null ? "" : outputs.toString() + '\n') +
- " <rollback>"+rollback+"</rollback>" + '\n' +
- "</ns2:createVnfNotification>";
- } else {
- createVnfNotification = "<ns2:createVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- (outputs == null ? "" : outputs.toString() + '\n') +
- " <exception>"+exception+"</exception>" + '\n' +
- " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
- "</ns2:createVnfNotification>";
- }
- return createVnfNotification;
- }
+ // Not a generated method
+ @Override
+ public String toString() {
+ String createVnfNotification;
+ if (exception == null) {
+ createVnfNotification = "<ns2:createVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n'
+ + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + " <messageId>"
+ + messageId + "</messageId>" + '\n' + " <completed>" + completed + "</completed>" + '\n'
+ + " <vnfId>" + vnfId + "</vnfId>" + '\n' + (outputs == null ? "" : outputs.toString() + '\n')
+ + " <rollback>" + rollback + "</rollback>" + '\n' + "</ns2:createVnfNotification>";
+ } else {
+ createVnfNotification = "<ns2:createVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n'
+ + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + " <messageId>"
+ + messageId + "</messageId>" + '\n' + " <completed>" + completed + "</completed>" + '\n'
+ + (outputs == null ? "" : outputs.toString() + '\n') + " <exception>" + exception + "</exception>"
+ + '\n' + " <errorMessage>" + errorMessage + "</errorMessage>" + '\n'
+ + "</ns2:createVnfNotification>";
+ }
+ 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
index 3ad217306d..cd4257ec60 100644
--- 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
@@ -27,9 +27,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for deleteVnfNotification complex type.
+ * <p>
+ * Java class for deleteVnfNotification complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="deleteVnfNotification">
@@ -49,12 +51,7 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "deleteVnfNotification1", propOrder = {
- "messageId",
- "completed",
- "exception",
- "errorMessage"
-})
+@XmlType(name = "deleteVnfNotification1", propOrder = {"messageId", "completed", "exception", "errorMessage"})
public class DeleteVnfNotification {
@XmlElement(required = true)
@@ -66,10 +63,8 @@ public class DeleteVnfNotification {
/**
* Gets the value of the messageId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getMessageId() {
return messageId;
@@ -78,10 +73,8 @@ public class DeleteVnfNotification {
/**
* Sets the value of the messageId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setMessageId(String value) {
this.messageId = value;
@@ -106,10 +99,8 @@ public class DeleteVnfNotification {
/**
* Gets the value of the exception property.
*
- * @return
- * possible object is
- * {@link MsoExceptionCategory }
- *
+ * @return possible object is {@link MsoExceptionCategory }
+ *
*/
public MsoExceptionCategory getException() {
return exception;
@@ -118,10 +109,8 @@ public class DeleteVnfNotification {
/**
* Sets the value of the exception property.
*
- * @param value
- * allowed object is
- * {@link MsoExceptionCategory }
- *
+ * @param value allowed object is {@link MsoExceptionCategory }
+ *
*/
public void setException(MsoExceptionCategory value) {
this.exception = value;
@@ -130,10 +119,8 @@ public class DeleteVnfNotification {
/**
* Gets the value of the errorMessage property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getErrorMessage() {
return errorMessage;
@@ -142,57 +129,43 @@ public class DeleteVnfNotification {
/**
* Sets the value of the errorMessage property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setErrorMessage(String value) {
this.errorMessage = value;
}
/**
- * Overrides toString() method
+ * Overrides toString() method
+ *
* @return String type (deleteVnfNotification)
*/
-
+
@Override
- public String toString() {
- String deleteVnfNotification;
- if (exception == null) {
- deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- "</ns2:deleteVnfNotification>";
- } else {
- deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- " <exception>"+exception+"</exception>" + '\n' +
- " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
- "</ns2:deleteVnfNotification>";
- }
- 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 "";
- }
- }
-*/
-
+ public String toString() {
+ String deleteVnfNotification;
+ if (exception == null) {
+ deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n'
+ + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + " <messageId>"
+ + messageId + "</messageId>" + '\n' + " <completed>" + completed + "</completed>" + '\n'
+ + "</ns2:deleteVnfNotification>";
+ } else {
+ deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n'
+ + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + " <messageId>"
+ + messageId + "</messageId>" + '\n' + " <completed>" + completed + "</completed>" + '\n'
+ + " <exception>" + exception + "</exception>" + '\n' + " <errorMessage>" + errorMessage
+ + "</errorMessage>" + '\n' + "</ns2:deleteVnfNotification>";
+ }
+ 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
index e4c95e82cd..aae624dde1 100644
--- 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
@@ -25,10 +25,13 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for msoExceptionCategory.
+ * <p>
+ * Java class for msoExceptionCategory.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
* <p>
+ * The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ *
* <pre>
* &lt;simpleType name="msoExceptionCategory">
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
@@ -45,10 +48,7 @@ import javax.xml.bind.annotation.XmlType;
@XmlEnum
public enum MsoExceptionCategory {
- OPENSTACK,
- IO,
- INTERNAL,
- USERDATA;
+ OPENSTACK, IO, INTERNAL, USERDATA;
public String value() {
return name();
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
index 6830109097..3db5ca159a 100644
--- 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
@@ -26,9 +26,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for msoRequest complex type.
+ * <p>
+ * Java class for msoRequest complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="msoRequest">
@@ -46,10 +48,7 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "msoRequest", propOrder = {
- "requestId",
- "serviceInstanceId"
-})
+@XmlType(name = "msoRequest", propOrder = {"requestId", "serviceInstanceId"})
public class MsoRequest {
protected String requestId;
@@ -58,10 +57,8 @@ public class MsoRequest {
/**
* Gets the value of the requestId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getRequestId() {
return requestId;
@@ -70,10 +67,8 @@ public class MsoRequest {
/**
* Sets the value of the requestId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setRequestId(String value) {
this.requestId = value;
@@ -82,10 +77,8 @@ public class MsoRequest {
/**
* Gets the value of the serviceInstanceId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getServiceInstanceId() {
return serviceInstanceId;
@@ -94,10 +87,8 @@ public class MsoRequest {
/**
* Sets the value of the serviceInstanceId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setServiceInstanceId(String value) {
this.serviceInstanceId = value;
@@ -106,7 +97,7 @@ public class MsoRequest {
@Override
public String toString() {
return "<requestId>" + requestId + "</requestId>" + '\n' + "<serviceInstanceId>" + serviceInstanceId
- + "</serviceInstanceId>";
+ + "</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
index 21bd08fae7..c84a9356b8 100644
--- 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
@@ -27,22 +27,18 @@ 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.
- * <p>An ObjectFactory allows you to programatically
- * construct new instances of the Java representation
- * for XML content. The Java representation of XML
- * content can consist of schema derived interfaces
- * and classes representing the binding of schema
- * type definitions, element declarations and model
- * groups. Factory methods for each of these are
- * provided in this class.
+ * 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.
+ * <p>
+ * An ObjectFactory allows you to programatically construct new instances of the Java representation for XML content.
+ * The Java representation of XML content can consist of schema derived interfaces and classes representing the binding
+ * of schema type definitions, element declarations and model groups. Factory methods for each of these are provided in
+ * this class.
*
*/
@XmlRegistry
public class ObjectFactory {
- private static final String VNF_NOTIFY = "http://org.onap.so/vnfNotify";
+ 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");
@@ -50,11 +46,11 @@ public class ObjectFactory {
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
+ * 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() {
- }
+ public ObjectFactory() {}
/**
* Create an instance of {@link UpdateVnfNotification }
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
index e7496b8028..d3ac2439c1 100644
--- 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
@@ -22,7 +22,6 @@ 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;
@@ -30,9 +29,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for queryVnfNotification complex type.
+ * <p>
+ * Java class for queryVnfNotification complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="queryVnfNotification">
@@ -77,16 +78,8 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "queryVnfNotification1", propOrder = {
- "messageId",
- "completed",
- "exception",
- "errorMessage",
- "vnfExists",
- "vnfId",
- "status",
- "outputs"
-})
+@XmlType(name = "queryVnfNotification1",
+ propOrder = {"messageId", "completed", "exception", "errorMessage", "vnfExists", "vnfId", "status", "outputs"})
public class QueryVnfNotification {
@XmlElement(required = true)
@@ -102,10 +95,8 @@ public class QueryVnfNotification {
/**
* Gets the value of the messageId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getMessageId() {
return messageId;
@@ -114,10 +105,8 @@ public class QueryVnfNotification {
/**
* Sets the value of the messageId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setMessageId(String value) {
this.messageId = value;
@@ -142,10 +131,8 @@ public class QueryVnfNotification {
/**
* Gets the value of the exception property.
*
- * @return
- * possible object is
- * {@link MsoExceptionCategory }
- *
+ * @return possible object is {@link MsoExceptionCategory }
+ *
*/
public MsoExceptionCategory getException() {
return exception;
@@ -154,10 +141,8 @@ public class QueryVnfNotification {
/**
* Sets the value of the exception property.
*
- * @param value
- * allowed object is
- * {@link MsoExceptionCategory }
- *
+ * @param value allowed object is {@link MsoExceptionCategory }
+ *
*/
public void setException(MsoExceptionCategory value) {
this.exception = value;
@@ -166,10 +151,8 @@ public class QueryVnfNotification {
/**
* Gets the value of the errorMessage property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getErrorMessage() {
return errorMessage;
@@ -178,10 +161,8 @@ public class QueryVnfNotification {
/**
* Sets the value of the errorMessage property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setErrorMessage(String value) {
this.errorMessage = value;
@@ -190,10 +171,8 @@ public class QueryVnfNotification {
/**
* Gets the value of the vnfExists property.
*
- * @return
- * possible object is
- * {@link Boolean }
- *
+ * @return possible object is {@link Boolean }
+ *
*/
public Boolean isVnfExists() {
return vnfExists;
@@ -202,10 +181,8 @@ public class QueryVnfNotification {
/**
* Sets the value of the vnfExists property.
*
- * @param value
- * allowed object is
- * {@link Boolean }
- *
+ * @param value allowed object is {@link Boolean }
+ *
*/
public void setVnfExists(Boolean value) {
this.vnfExists = value;
@@ -214,10 +191,8 @@ public class QueryVnfNotification {
/**
* Gets the value of the vnfId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getVnfId() {
return vnfId;
@@ -226,10 +201,8 @@ public class QueryVnfNotification {
/**
* Sets the value of the vnfId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setVnfId(String value) {
this.vnfId = value;
@@ -238,10 +211,8 @@ public class QueryVnfNotification {
/**
* Gets the value of the status property.
*
- * @return
- * possible object is
- * {@link VnfStatus }
- *
+ * @return possible object is {@link VnfStatus }
+ *
*/
public VnfStatus getStatus() {
return status;
@@ -250,10 +221,8 @@ public class QueryVnfNotification {
/**
* Sets the value of the status property.
*
- * @param value
- * allowed object is
- * {@link VnfStatus }
- *
+ * @param value allowed object is {@link VnfStatus }
+ *
*/
public void setStatus(VnfStatus value) {
this.status = value;
@@ -262,10 +231,8 @@ public class QueryVnfNotification {
/**
* Gets the value of the outputs property.
*
- * @return
- * possible object is
- * {@link QueryVnfNotification.Outputs }
- *
+ * @return possible object is {@link QueryVnfNotification.Outputs }
+ *
*/
public QueryVnfNotification.Outputs getOutputs() {
return outputs;
@@ -274,10 +241,8 @@ public class QueryVnfNotification {
/**
* Sets the value of the outputs property.
*
- * @param value
- * allowed object is
- * {@link QueryVnfNotification.Outputs }
- *
+ * @param value allowed object is {@link QueryVnfNotification.Outputs }
+ *
*/
public void setOutputs(QueryVnfNotification.Outputs value) {
this.outputs = value;
@@ -285,9 +250,11 @@ public class QueryVnfNotification {
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -315,9 +282,7 @@ public class QueryVnfNotification {
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "entry"
- })
+ @XmlType(name = "", propOrder = {"entry"})
public static class Outputs {
protected List<QueryVnfNotification.Outputs.Entry> entry;
@@ -326,21 +291,20 @@ public class QueryVnfNotification {
* Gets the value of the entry property.
*
* <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the 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 <CODE>set</CODE>
+ * method for the entry property.
*
* <p>
* For example, to add a new item, do as follows:
+ *
* <pre>
- * getEntry().add(newItem);
+ * getEntry().add(newItem);
* </pre>
*
*
* <p>
- * Objects of the following type(s) are allowed in the list
- * {@link QueryVnfNotification.Outputs.Entry }
+ * Objects of the following type(s) are allowed in the list {@link QueryVnfNotification.Outputs.Entry }
*
*
*/
@@ -350,26 +314,28 @@ public class QueryVnfNotification {
}
return this.entry;
}
-
+
// Not a generated method
public String toString() {
- StringBuilder out = new StringBuilder();
- out.append("<outputs>\n");
- if (entry != null) {
- for (Entry e : entry) {
- out.append(e.toString());
- out.append('\n');
- }
- }
- out.append("</outputs>");
- return out.toString();
+ StringBuilder out = new StringBuilder();
+ out.append("<outputs>\n");
+ if (entry != null) {
+ for (Entry e : entry) {
+ out.append(e.toString());
+ out.append('\n');
+ }
+ }
+ out.append("</outputs>");
+ return out.toString();
}
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -387,10 +353,7 @@ public class QueryVnfNotification {
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "key",
- "value"
- })
+ @XmlType(name = "", propOrder = {"key", "value"})
public static class Entry {
protected String key;
@@ -399,10 +362,8 @@ public class QueryVnfNotification {
/**
* Gets the value of the key property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getKey() {
return key;
@@ -411,10 +372,8 @@ public class QueryVnfNotification {
/**
* Sets the value of the key property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setKey(String value) {
this.key = value;
@@ -423,10 +382,8 @@ public class QueryVnfNotification {
/**
* Gets the value of the value property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getValue() {
return value;
@@ -435,54 +392,44 @@ public class QueryVnfNotification {
/**
* Sets the value of the value property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @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 =
- "<entry>"+ '\n' +
- " <key>"+key+"</key>" + '\n' +
- " <value>"+value+"</value>" + '\n' +
- "</entry>";
- return entry;
+ String entry = "";
+ entry = "<entry>" + '\n' + " <key>" + key + "</key>" + '\n' + " <value>" + value + "</value>" + '\n'
+ + "</entry>";
+ return entry;
}
}
}
-
- // Not a generated method
- public String toString() {
- String queryVnfNotification = "";
- if (exception==null) {
- queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- " <vnfExists>"+vnfExists+"</vnfExists>" + '\n' +
- " <vnfId>"+vnfId+"</vnfId>" + '\n' +
- " <status>"+status+"</status>" + '\n' +
- (outputs == null ? "" : outputs.toString() + '\n') +
- "</ns2:queryVnfNotification>";
- } else {
- queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- (outputs == null ? "" : outputs.toString() + '\n') +
- " <exception>"+exception+"</exception>" + '\n' +
- " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
- "</ns2:queryVnfNotification>";
- }
- return queryVnfNotification;
- }
+
+ // Not a generated method
+ public String toString() {
+ String queryVnfNotification = "";
+ if (exception == null) {
+ queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n'
+ + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + " <messageId>"
+ + messageId + "</messageId>" + '\n' + " <completed>" + completed + "</completed>" + '\n'
+ + " <vnfExists>" + vnfExists + "</vnfExists>" + '\n' + " <vnfId>" + vnfId + "</vnfId>" + '\n'
+ + " <status>" + status + "</status>" + '\n' + (outputs == null ? "" : outputs.toString() + '\n')
+ + "</ns2:queryVnfNotification>";
+ } else {
+ queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n'
+ + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + " <messageId>"
+ + messageId + "</messageId>" + '\n' + " <completed>" + completed + "</completed>" + '\n'
+ + (outputs == null ? "" : outputs.toString() + '\n') + " <exception>" + exception + "</exception>"
+ + '\n' + " <errorMessage>" + errorMessage + "</errorMessage>" + '\n'
+ + "</ns2:queryVnfNotification>";
+ }
+ 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
index 6b143a2494..70e8199e95 100644
--- 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
@@ -27,9 +27,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for rollbackVnfNotification complex type.
+ * <p>
+ * Java class for rollbackVnfNotification complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="rollbackVnfNotification">
@@ -49,12 +51,7 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "rollbackVnfNotification1", propOrder = {
- "messageId",
- "completed",
- "exception",
- "errorMessage"
-})
+@XmlType(name = "rollbackVnfNotification1", propOrder = {"messageId", "completed", "exception", "errorMessage"})
public class RollbackVnfNotification {
@XmlElement(required = true)
@@ -66,10 +63,8 @@ public class RollbackVnfNotification {
/**
* Gets the value of the messageId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getMessageId() {
return messageId;
@@ -78,10 +73,8 @@ public class RollbackVnfNotification {
/**
* Sets the value of the messageId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setMessageId(String value) {
this.messageId = value;
@@ -106,10 +99,8 @@ public class RollbackVnfNotification {
/**
* Gets the value of the exception property.
*
- * @return
- * possible object is
- * {@link MsoExceptionCategory }
- *
+ * @return possible object is {@link MsoExceptionCategory }
+ *
*/
public MsoExceptionCategory getException() {
return exception;
@@ -118,10 +109,8 @@ public class RollbackVnfNotification {
/**
* Sets the value of the exception property.
*
- * @param value
- * allowed object is
- * {@link MsoExceptionCategory }
- *
+ * @param value allowed object is {@link MsoExceptionCategory }
+ *
*/
public void setException(MsoExceptionCategory value) {
this.exception = value;
@@ -130,10 +119,8 @@ public class RollbackVnfNotification {
/**
* Gets the value of the errorMessage property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getErrorMessage() {
return errorMessage;
@@ -142,34 +129,29 @@ public class RollbackVnfNotification {
/**
* Sets the value of the errorMessage property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setErrorMessage(String value) {
this.errorMessage = value;
}
-
+
public String toString() {
- String rollbackVnfNotification = "";
- if (exception==null) {
- rollbackVnfNotification = "<ns2:rollbackVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- "</ns2:rollbackVnfNotification>";
- } else {
- rollbackVnfNotification = "<ns2:rollbackVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- " <exception>"+exception+"</exception>" + '\n' +
- " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
- "</ns2:rollbackVnfNotification>";
- }
- return rollbackVnfNotification;
+ String rollbackVnfNotification = "";
+ if (exception == null) {
+ rollbackVnfNotification = "<ns2:rollbackVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n'
+ + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + " <messageId>"
+ + messageId + "</messageId>" + '\n' + " <completed>" + completed + "</completed>" + '\n'
+ + "</ns2:rollbackVnfNotification>";
+ } else {
+ rollbackVnfNotification = "<ns2:rollbackVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n'
+ + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + " <messageId>"
+ + messageId + "</messageId>" + '\n' + " <completed>" + completed + "</completed>" + '\n'
+ + " <exception>" + exception + "</exception>" + '\n' + " <errorMessage>" + errorMessage
+ + "</errorMessage>" + '\n' + "</ns2:rollbackVnfNotification>";
+ }
+ 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
index b89135b865..dd86f340a2 100644
--- 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
@@ -22,7 +22,6 @@ 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;
@@ -30,9 +29,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for updateVnfNotification complex type.
+ * <p>
+ * Java class for updateVnfNotification complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="updateVnfNotification">
@@ -75,14 +76,8 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "updateVnfNotification1", propOrder = {
- "messageId",
- "completed",
- "exception",
- "errorMessage",
- "outputs",
- "rollback"
-})
+@XmlType(name = "updateVnfNotification1",
+ propOrder = {"messageId", "completed", "exception", "errorMessage", "outputs", "rollback"})
public class UpdateVnfNotification {
@XmlElement(required = true)
@@ -96,9 +91,7 @@ public class UpdateVnfNotification {
/**
* Gets the value of the messageId property.
*
- * @return
- * possible object is
- * {@link String }
+ * @return possible object is {@link String }
*
*/
public String getMessageId() {
@@ -108,9 +101,7 @@ public class UpdateVnfNotification {
/**
* Sets the value of the messageId property.
*
- * @param value
- * allowed object is
- * {@link String }
+ * @param value allowed object is {@link String }
*
*/
public void setMessageId(String value) {
@@ -136,9 +127,7 @@ public class UpdateVnfNotification {
/**
* Gets the value of the exception property.
*
- * @return
- * possible object is
- * {@link MsoExceptionCategory }
+ * @return possible object is {@link MsoExceptionCategory }
*
*/
public MsoExceptionCategory getException() {
@@ -148,9 +137,7 @@ public class UpdateVnfNotification {
/**
* Sets the value of the exception property.
*
- * @param value
- * allowed object is
- * {@link MsoExceptionCategory }
+ * @param value allowed object is {@link MsoExceptionCategory }
*
*/
public void setException(MsoExceptionCategory value) {
@@ -160,9 +147,7 @@ public class UpdateVnfNotification {
/**
* Gets the value of the errorMessage property.
*
- * @return
- * possible object is
- * {@link String }
+ * @return possible object is {@link String }
*
*/
public String getErrorMessage() {
@@ -172,9 +157,7 @@ public class UpdateVnfNotification {
/**
* Sets the value of the errorMessage property.
*
- * @param value
- * allowed object is
- * {@link String }
+ * @param value allowed object is {@link String }
*
*/
public void setErrorMessage(String value) {
@@ -184,9 +167,7 @@ public class UpdateVnfNotification {
/**
* Gets the value of the outputs property.
*
- * @return
- * possible object is
- * {@link UpdateVnfNotification.Outputs }
+ * @return possible object is {@link UpdateVnfNotification.Outputs }
*
*/
public UpdateVnfNotification.Outputs getOutputs() {
@@ -196,9 +177,7 @@ public class UpdateVnfNotification {
/**
* Sets the value of the outputs property.
*
- * @param value
- * allowed object is
- * {@link UpdateVnfNotification.Outputs }
+ * @param value allowed object is {@link UpdateVnfNotification.Outputs }
*
*/
public void setOutputs(UpdateVnfNotification.Outputs value) {
@@ -208,9 +187,7 @@ public class UpdateVnfNotification {
/**
* Gets the value of the rollback property.
*
- * @return
- * possible object is
- * {@link VnfRollback }
+ * @return possible object is {@link VnfRollback }
*
*/
public VnfRollback getRollback() {
@@ -220,9 +197,7 @@ public class UpdateVnfNotification {
/**
* Sets the value of the rollback property.
*
- * @param value
- * allowed object is
- * {@link VnfRollback }
+ * @param value allowed object is {@link VnfRollback }
*
*/
public void setRollback(VnfRollback value) {
@@ -231,9 +206,11 @@ public class UpdateVnfNotification {
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -261,9 +238,7 @@ public class UpdateVnfNotification {
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "entry"
- })
+ @XmlType(name = "", propOrder = {"entry"})
public static class Outputs {
protected List<UpdateVnfNotification.Outputs.Entry> entry;
@@ -272,21 +247,20 @@ public class UpdateVnfNotification {
* Gets the value of the entry property.
*
* <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the 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 <CODE>set</CODE>
+ * method for the entry property.
*
* <p>
* For example, to add a new item, do as follows:
+ *
* <pre>
- * getEntry().add(newItem);
+ * getEntry().add(newItem);
* </pre>
*
*
* <p>
- * Objects of the following type(s) are allowed in the list
- * {@link UpdateVnfNotification.Outputs.Entry }
+ * Objects of the following type(s) are allowed in the list {@link UpdateVnfNotification.Outputs.Entry }
*
*
*/
@@ -299,9 +273,11 @@ public class UpdateVnfNotification {
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -319,10 +295,7 @@ public class UpdateVnfNotification {
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "key",
- "value"
- })
+ @XmlType(name = "", propOrder = {"key", "value"})
public static class Entry {
protected String key;
@@ -331,9 +304,7 @@ public class UpdateVnfNotification {
/**
* Gets the value of the key property.
*
- * @return
- * possible object is
- * {@link String }
+ * @return possible object is {@link String }
*
*/
public String getKey() {
@@ -343,9 +314,7 @@ public class UpdateVnfNotification {
/**
* Sets the value of the key property.
*
- * @param value
- * allowed object is
- * {@link String }
+ * @param value allowed object is {@link String }
*
*/
public void setKey(String value) {
@@ -355,9 +324,7 @@ public class UpdateVnfNotification {
/**
* Gets the value of the value property.
*
- * @return
- * possible object is
- * {@link String }
+ * @return possible object is {@link String }
*
*/
public String getValue() {
@@ -367,9 +334,7 @@ public class UpdateVnfNotification {
/**
* Sets the value of the value property.
*
- * @param value
- * allowed object is
- * {@link String }
+ * @param value allowed object is {@link String }
*
*/
public void setValue(String value) {
@@ -377,36 +342,30 @@ public class UpdateVnfNotification {
}
public String toString() {
- String entry = "";
- entry =
- " <key>"+key+"</key>" + '\n' +
- " <value>"+value+"</value>";
- return entry;
+ String entry = "";
+ entry = " <key>" + key + "</key>" + '\n' + " <value>" + value + "</value>";
+ return entry;
}
}
}
- public String toString(){
- String updateVnfNotification = "";
- if (exception==null) {
- updateVnfNotification = "<ns2:updateVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- " <rollback>"+rollback+"</rollback>" + '\n' +
- "</ns2:updateVnfNotification>";
- } else {
- updateVnfNotification = "<ns2:updateVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- " <exception>"+exception+"</exception>" + '\n' +
- " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
- "</ns2:updateVnfNotification>";
- }
-
- return updateVnfNotification;
+ public String toString() {
+ String updateVnfNotification = "";
+ if (exception == null) {
+ updateVnfNotification = "<ns2:updateVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n'
+ + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + " <messageId>"
+ + messageId + "</messageId>" + '\n' + " <completed>" + completed + "</completed>" + '\n'
+ + " <rollback>" + rollback + "</rollback>" + '\n' + "</ns2:updateVnfNotification>";
+ } else {
+ updateVnfNotification = "<ns2:updateVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n'
+ + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + " <messageId>"
+ + messageId + "</messageId>" + '\n' + " <completed>" + completed + "</completed>" + '\n'
+ + " <exception>" + exception + "</exception>" + '\n' + " <errorMessage>" + errorMessage
+ + "</errorMessage>" + '\n' + "</ns2:updateVnfNotification>";
+ }
+
+ 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
index adedca9ac5..1390b82c50 100644
--- 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
@@ -30,15 +30,11 @@ 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
+ * 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
-})
+@XmlSeeAlso({ObjectFactory.class})
public interface VnfAdapterNotify {
@@ -51,17 +47,13 @@ public interface VnfAdapterNotify {
*/
@WebMethod
@Oneway
- @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.RollbackVnfNotification")
+ @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);
+ 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);
/**
*
@@ -76,25 +68,17 @@ public interface VnfAdapterNotify {
*/
@WebMethod
@Oneway
- @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.QueryVnfNotification")
+ @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);
+ 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);
/**
*
@@ -108,23 +92,17 @@ public interface VnfAdapterNotify {
*/
@WebMethod
@Oneway
- @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.CreateVnfNotification")
+ @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);
+ 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);
/**
*
@@ -137,21 +115,16 @@ public interface VnfAdapterNotify {
*/
@WebMethod
@Oneway
- @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.UpdateVnfNotification")
+ @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);
+ 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);
/**
*
@@ -162,16 +135,12 @@ public interface VnfAdapterNotify {
*/
@WebMethod
@Oneway
- @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.DeleteVnfNotification")
+ @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);
+ 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
index 667545d855..531b6d572e 100644
--- 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
@@ -30,24 +30,24 @@ 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
+ * 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
-{
+@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");
+ 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.");
+ e = new WebServiceException(
+ "Cannot find '/VnfAdapterNotify.wsdl' wsdl. Place the resource correctly in the classpath.");
}
VNFADAPTERNOTIFY_EXCEPTION = e;
}
@@ -78,28 +78,28 @@ public class VnfAdapterNotify_Service extends Service
/**
*
- * @return
- * returns VnfAdapterNotify
+ * @return returns VnfAdapterNotify
*/
@WebEndpoint(name = "MsoVnfAdapterAsyncImplPort")
public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort() {
- return super.getPort(new QName("http://org.onap.so/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class);
+ 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 <code>features</code> parameter will have their default values.
- * @return
- * returns VnfAdapterNotify
+ * @param features A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features
+ * not in the <code>features</code> 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);
+ return super.getPort(new QName("http://org.onap.so/vnfNotify", "MsoVnfAdapterAsyncImplPort"),
+ VnfAdapterNotify.class, features);
}
private static URL __getWsdlLocation() {
- if (VNFADAPTERNOTIFY_EXCEPTION!= null) {
+ 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
index 9fd3bc596f..1e02c0d07c 100644
--- 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
@@ -26,9 +26,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for vnfRollback complex type.
+ * <p>
+ * Java class for vnfRollback complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="vnfRollback">
@@ -51,15 +53,8 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "vnfRollback", propOrder = {
- "cloudSiteId",
- "cloudOwner",
- "msoRequest",
- "tenantCreated",
- "tenantId",
- "vnfCreated",
- "vnfId"
-})
+@XmlType(name = "vnfRollback",
+ propOrder = {"cloudSiteId", "cloudOwner", "msoRequest", "tenantCreated", "tenantId", "vnfCreated", "vnfId"})
public class VnfRollback {
protected String cloudSiteId;
@@ -73,10 +68,8 @@ public class VnfRollback {
/**
* Gets the value of the cloudSiteId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getCloudSiteId() {
return cloudSiteId;
@@ -85,10 +78,8 @@ public class VnfRollback {
/**
* Sets the value of the cloudSiteId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setCloudSiteId(String value) {
this.cloudSiteId = value;
@@ -97,10 +88,8 @@ public class VnfRollback {
/**
* Gets the value of the cloudOwner property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getCloudOwner() {
return cloudOwner;
@@ -109,10 +98,8 @@ public class VnfRollback {
/**
* Sets the value of the cloudOwner property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setCloudOwner(String value) {
this.cloudOwner = value;
@@ -121,10 +108,8 @@ public class VnfRollback {
/**
* Gets the value of the msoRequest property.
*
- * @return
- * possible object is
- * {@link MsoRequest }
- *
+ * @return possible object is {@link MsoRequest }
+ *
*/
public MsoRequest getMsoRequest() {
return msoRequest;
@@ -133,10 +118,8 @@ public class VnfRollback {
/**
* Sets the value of the msoRequest property.
*
- * @param value
- * allowed object is
- * {@link MsoRequest }
- *
+ * @param value allowed object is {@link MsoRequest }
+ *
*/
public void setMsoRequest(MsoRequest value) {
this.msoRequest = value;
@@ -161,10 +144,8 @@ public class VnfRollback {
/**
* Gets the value of the tenantId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getTenantId() {
return tenantId;
@@ -173,10 +154,8 @@ public class VnfRollback {
/**
* Sets the value of the tenantId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setTenantId(String value) {
this.tenantId = value;
@@ -201,10 +180,8 @@ public class VnfRollback {
/**
* Gets the value of the vnfId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getVnfId() {
return vnfId;
@@ -213,26 +190,19 @@ public class VnfRollback {
/**
* Sets the value of the vnfId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setVnfId(String value) {
this.vnfId = value;
}
-
+
public String toString() {
- String msoRequestElement = msoRequest == null ? ""
- : "<msoRequest>"+msoRequest+"</msoRequest>" + '\n';
-
- return
- "<cloudSiteId>"+cloudSiteId+"</cloudSiteId>" + '\n' +
- "<cloudOwner>"+cloudOwner+"</cloudOwner>" + '\n' +
- msoRequestElement +
- "<tenantCreated>"+tenantCreated+"</tenantCreated>" + '\n' +
- "<tenantId>"+tenantId+"</tenantId>" + '\n' +
- "<vnfCreated>"+vnfCreated+"</vnfCreated>" + '\n' +
- "<vnfId>"+vnfId+"</vnfId>";
+ String msoRequestElement = msoRequest == null ? "" : "<msoRequest>" + msoRequest + "</msoRequest>" + '\n';
+
+ return "<cloudSiteId>" + cloudSiteId + "</cloudSiteId>" + '\n' + "<cloudOwner>" + cloudOwner + "</cloudOwner>"
+ + '\n' + msoRequestElement + "<tenantCreated>" + tenantCreated + "</tenantCreated>" + '\n'
+ + "<tenantId>" + tenantId + "</tenantId>" + '\n' + "<vnfCreated>" + vnfCreated + "</vnfCreated>" + '\n'
+ + "<vnfId>" + vnfId + "</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
index d093f79e03..007b5ab487 100644
--- 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
@@ -25,10 +25,13 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for vnfStatus.
+ * <p>
+ * Java class for vnfStatus.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
* <p>
+ * The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ *
* <pre>
* &lt;simpleType name="vnfStatus">
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
@@ -45,10 +48,7 @@ import javax.xml.bind.annotation.XmlType;
@XmlEnum
public enum VnfStatus {
- ACTIVE,
- FAILED,
- NOTFOUND,
- UNKNOWN;
+ ACTIVE, FAILED, NOTFOUND, UNKNOWN;
public String value() {
return name();
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
index 46a6fa3ef3..7c0c2f20b3 100644
--- 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
@@ -26,7 +26,6 @@ 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;
@@ -46,372 +45,354 @@ import org.springframework.stereotype.Service;
*/
@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 Logger logger = LoggerFactory.getLogger(CallbackHandlerService.class);
-
- private RuntimeService runtimeService;
-
- @Autowired
- public CallbackHandlerService(RuntimeService runtimeService) {
- this.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<String, Object> injectedVariables) {
-
- long startTime = System.currentTimeMillis();
-
- logger.debug(logMarker + " " + method + " received message: "
- + (message == null ? "" : System.lineSeparator()) + message);
-
- try {
- Map<String, Object> 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
- */
- protected boolean correlate(String messageEventName, String correlationVariable,
- String correlationValue, Map<String, Object> variables, String logMarker) {
- 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<Execution> 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<Execution>(0);
- }
-
- int count = waitingProcesses.size();
-
- List<ExecInfo> 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.toString(), "BPMN",
- ErrorCode.UnknownError.getValue(), 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.toString(), "BPMN CORRELATION ERROR -",
- ErrorCode.UnknownError.getValue(), 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.toString(), "BPMN",
- ErrorCode.UnknownError.getValue(), 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.toString(), "BPMN",
- ErrorCode.UnknownError.getValue(), 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.toString(), "BPMN",
- ErrorCode.UnknownError.getValue(), 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.toString(), "BPMN CORRELATION ERROR -",
- ErrorCode.UnknownError.getValue(), 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) {
- }
-
- /**
- * 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.toString(), "BPMN",
- ErrorCode.UnknownError.getValue(), msg);
- } else {
- logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN",
- ErrorCode.UnknownError.getValue(), msg, e);
- }
- }
-
- /**
- * 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() + "]";
- }
- }
+ 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 Logger logger = LoggerFactory.getLogger(CallbackHandlerService.class);
+
+ private RuntimeService runtimeService;
+
+ @Autowired
+ public CallbackHandlerService(RuntimeService runtimeService) {
+ this.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<String, Object> injectedVariables) {
+
+ long startTime = System.currentTimeMillis();
+
+ logger.debug(logMarker + " " + method + " received message: " + (message == null ? "" : System.lineSeparator())
+ + message);
+
+ try {
+ Map<String, Object> 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
+ */
+ protected boolean correlate(String messageEventName, String correlationVariable, String correlationValue,
+ Map<String, Object> variables, String logMarker) {
+ 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<Execution> 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<Execution>(0);
+ }
+
+ int count = waitingProcesses.size();
+
+ List<ExecInfo> 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.toString(), "BPMN",
+ ErrorCode.UnknownError.getValue(), 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.toString(), "BPMN CORRELATION ERROR -",
+ ErrorCode.UnknownError.getValue(), 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.toString(), "BPMN",
+ ErrorCode.UnknownError.getValue(), 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.toString(), "BPMN",
+ ErrorCode.UnknownError.getValue(), 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.toString(), "BPMN",
+ ErrorCode.UnknownError.getValue(), 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.toString(), "BPMN CORRELATION ERROR -",
+ ErrorCode.UnknownError.getValue(), 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) {}
+
+ /**
+ * 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.toString(), "BPMN",
+ ErrorCode.UnknownError.getValue(), msg);
+ } else {
+ logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN",
+ ErrorCode.UnknownError.getValue(), msg, e);
+ }
+ }
+
+ /**
+ * 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
index 8ceb1c1277..1134bc052b 100644
--- 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
@@ -22,45 +22,45 @@
package org.onap.so.bpmn.common.workflow.service;
import java.util.Optional;
-
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.
+ * 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<ProcessEngineServices> 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()));
- }
+ private final String processEngineName = "default";
+ private volatile Optional<ProcessEngineServices> 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);
- }
+ /**
+ * 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
index a74bdfc649..b81506ead9 100644
--- 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
@@ -28,7 +28,6 @@ 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;
@@ -40,50 +39,53 @@ import org.springframework.stereotype.Service;
/**
* Implementation of SDNCAdapterCallbackService.
*/
-@WebService(serviceName="SDNCAdapterCallbackService", targetNamespace="http://org.onap/workflow/sdnc/adapter/schema/v1")
+@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]";
+ private final static String logMarker = "[SDNC-CALLBACK]";
+
+ @Context
+ WebServiceContext wsContext;
- @Context WebServiceContext wsContext;
-
- @Autowired
- CallbackHandlerService callback;
+ @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) {
+ @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();
+ String method = "sdncAdapterCallback";
+ Object message = sdncAdapterCallbackRequest;
+ String messageEventName = "sdncAdapterCallbackRequest";
+ String messageVariable = "sdncAdapterCallbackRequest";
+ String correlationVariable = "SDNCA_requestId";
+ String correlationValue = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId();
- CallbackResult result = callback.handleCallback(method, message, messageEventName,
- messageVariable, correlationVariable, correlationValue, logMarker);
+ 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();
- }
- }
+ 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;
+ // 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 SDNCAdapterErrorResponse(String error) {
+ this.error = error;
+ }
- public String getError() {
- return error;
- }
- }
+ public String getError() {
+ return error;
+ }
+ }
}
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
index ed524c115e..5f70ab5924 100644
--- 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
@@ -30,7 +30,6 @@ 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;
@@ -48,195 +47,167 @@ import org.springframework.stereotype.Service;
*/
@WebService(serviceName = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify")
@Service
-public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService implements VnfAdapterNotify{
+public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService implements VnfAdapterNotify {
+
+ private final String logMarker = "[VNF-NOTIFY]";
- private final String logMarker = "[VNF-NOTIFY]";
-
- @Autowired
- CallbackHandlerService callback;
+ @Autowired
+ CallbackHandlerService callback;
- @Context WebServiceContext wsContext;
+ @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")
+ @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);
+ 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")
+ @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;
-
- 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);
+ 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;
+
+ 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")
+ @WebMethod(operationName = "createVnfNotification")
@Oneway
- @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.CreateVnfNotification")
+ @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;
-
- 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")
+ 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;
+
+ 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")
+ @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;
-
- 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);
- }
+ 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;
+
+ 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")
+ @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;
-
- 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);
- }
+ 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;
+
+ 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);
+ }
}
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
index a9a3a63f2f..a534e57b3a 100644
--- 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
@@ -26,8 +26,8 @@ import org.camunda.bpm.engine.ProcessEngines;
public class WorkflowAsyncCommonResource extends WorkflowAsyncResource {
- @Override
+ @Override
public String getProcessEngineName() {
- return "default";
- }
+ 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
index f9f06447a7..e8e4b85cae 100644
--- 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
@@ -26,7 +26,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
-
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
@@ -34,7 +33,6 @@ 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.logging.ref.slf4j.ONAPLogConstants;
@@ -47,20 +45,19 @@ import org.slf4j.LoggerFactory;
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
+ * @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
+ * 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")
@@ -68,81 +65,79 @@ import io.swagger.annotations.ApiOperation;
@Component
public class WorkflowAsyncResource extends ProcessEngineAwareService {
- private static final WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
-
- long workflowPollInterval=1000;
-
- @Autowired
- private WorkflowProcessor processor;
-
- @Autowired
- private WorkflowContextHolder workflowContext;
-
- public void setProcessor(WorkflowProcessor processor) {
- this.processor = processor;
- }
-
- protected static final Logger logger = LoggerFactory.getLogger(WorkflowAsyncResource.class);
- protected static final long DEFAULT_WAIT_TIME = 60000; //default wait time
-
- /**
- * Asynchronous JAX-RS method that starts a process instance.
- * @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<String, Object> inputVariables = getInputVariables(variableMap);
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, getRequestId(inputVariables));
- processor.startProcess(processKey, variableMap);
- WorkflowResponse response = waitForResponse(getRequestId(inputVariables));
- return Response.status(202).entity(response).build();
- } catch (WorkflowProcessorException e) {
- WorkflowResponse response = e.getWorkflowResponse();
- return Response.status(500).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 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();
- }
-
+ private static final WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
+
+ long workflowPollInterval = 1000;
+
+ @Autowired
+ private WorkflowProcessor processor;
+
+ @Autowired
+ private WorkflowContextHolder workflowContext;
+
+ public void setProcessor(WorkflowProcessor processor) {
+ this.processor = processor;
+ }
+
+ protected static final Logger logger = LoggerFactory.getLogger(WorkflowAsyncResource.class);
+ protected static final long DEFAULT_WAIT_TIME = 60000; // default wait time
+
+ /**
+ * Asynchronous JAX-RS method that starts a process instance.
+ *
+ * @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<String, Object> inputVariables = getInputVariables(variableMap);
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, getRequestId(inputVariables));
+ processor.startProcess(processKey, variableMap);
+ WorkflowResponse response = waitForResponse(getRequestId(inputVariables));
+ return Response.status(202).entity(response).build();
+ } catch (WorkflowProcessorException e) {
+ WorkflowResponse response = e.getWorkflowResponse();
+ return Response.status(500).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 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<String, Object> inputVariables, String key) {
String value = Objects.toString(inputVariables.get(key), null);
if (value == null) {
@@ -152,27 +147,28 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
return value;
}
- protected static String getRequestId(Map<String, Object> inputVariables) {
+ protected static String getRequestId(Map<String, Object> inputVariables) {
return getOrCreate(inputVariables, "mso-request-id");
- }
-
- protected boolean isProcessEnded(String processInstanceId) {
- ProcessEngineServices pes = getProcessEngineServices();
- return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null;
- }
-
- protected static Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
- Map<String, Object> inputVariables = new HashMap<>();
- @SuppressWarnings("unchecked")
- Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
- for (Map.Entry<String, Object> entry : vMap.entrySet()) {
- String vName = entry.getKey();
- Object value = entry.getValue();
- @SuppressWarnings("unchecked")
- Map<String, Object> valueMap = (Map<String,Object>)value; // value, type
- inputVariables.put(vName, valueMap.get("value"));
- }
- return inputVariables;
- }
+ }
+
+ protected boolean isProcessEnded(String processInstanceId) {
+ ProcessEngineServices pes = getProcessEngineServices();
+ return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId)
+ .singleResult() == null;
+ }
+
+ protected static Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
+ Map<String, Object> inputVariables = new HashMap<>();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
+ for (Map.Entry<String, Object> entry : vMap.entrySet()) {
+ String vName = entry.getKey();
+ Object value = entry.getValue();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> valueMap = (Map<String, Object>) value; // value, type
+ inputVariables.put(vName, valueMap.get("value"));
+ }
+ return inputVariables;
+ }
}
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
index 075102331c..1e9ebdf0b2 100644
--- 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
@@ -24,7 +24,6 @@ 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;
@@ -33,7 +32,6 @@ 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.ErrorCode;
@@ -42,13 +40,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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:
+ * Generalized REST interface that injects a message event into a waiting BPMN process. Examples:
+ *
* <pre>
* /WorkflowMessage/SDNCAResponse/6d10d075-100c-42d0-9d84-a52432681cae-1478486185286
* /WorkflowMessage/SDNCAEvent/USOSTCDALTX0101UJZZ01
@@ -57,70 +54,62 @@ import io.swagger.annotations.ApiOperation;
@Path("/")
@Api(description = "Provides a generic service to inject messages into a waiting BPMN Proccess")
@Component
-public class WorkflowMessageResource{
- private static final Logger logger = LoggerFactory.getLogger(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) {
+public class WorkflowMessageResource {
+ private static final Logger logger = LoggerFactory.getLogger(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";
+ String method = "receiveWorkflowMessage";
- logger.debug(LOGMARKER + " Received workflow message"
- + " type='" + messageType + "'"
- + " correlator='" + correlator + "'"
- + (contentType == null ? "" : " contentType='" + contentType + "'")
- + " message=" + System.lineSeparator() + message);
+ 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.toString(), "BPMN",
- ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg);
- return Response.status(400).entity(msg).build();
- }
+ if (messageType == null || messageType.isEmpty()) {
+ String msg = "Missing message type";
+ logger.debug(LOGMARKER + " " + msg);
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
+ ErrorCode.DataError.getValue(), 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.toString(), "BPMN",
- ErrorCode.DataError.getValue(), 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.toString(), "BPMN",
+ ErrorCode.DataError.getValue(), 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";
+ String messageEventName = "WorkflowMessage";
+ String messageVariable = messageType + "_MESSAGE";
+ String correlationVariable = messageType + "_CORRELATOR";
+ String correlationValue = correlator;
+ String contentTypeVariable = messageType + "_CONTENT_TYPE";
- Map<String, Object> variables = new HashMap<>();
+ Map<String, Object> variables = new HashMap<>();
- if (contentType != null) {
- variables.put(contentTypeVariable, contentType);
- }
+ if (contentType != null) {
+ variables.put(contentTypeVariable, contentType);
+ }
- CallbackResult result = callback.handleCallback(method, message, messageEventName,
- messageVariable, correlationVariable, correlationValue, LOGMARKER, variables);
+ 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();
- }
- }
+ if (result instanceof CallbackError) {
+ return Response.status(500).entity(((CallbackError) result).getErrorMessage()).build();
+ } else {
+ return Response.status(204).build();
+ }
+ }
}
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
index b1062962a6..4e9e9fdf0e 100644
--- 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
@@ -26,7 +26,6 @@ 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;
@@ -39,65 +38,64 @@ import org.springframework.stereotype.Service;
@Service
public class WorkflowProcessor extends ProcessEngineAwareService {
-
- private static final Logger logger = LoggerFactory.getLogger(WorkflowProcessor.class);
- protected static final String logMarker = "[WRKFLOW-RESOURCE]";
-
- @Async
- public void startProcess( String processKey, VariableMapImpl variableMap)
- {
-
- long startTime = System.currentTimeMillis();
- Map<String, Object> inputVariables = null;
- String processInstanceId = null;
- try {
- inputVariables = getInputVariables(variableMap);
- // This variable indicates that the flow was invoked asynchronously
- inputVariables.put("isAsyncProcess", "true");
- // Note: this creates a random businessKey if it wasn't specified.
- String businessKey = getBusinessKey(inputVariables);
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowProcessor.class);
+ protected static final String logMarker = "[WRKFLOW-RESOURCE]";
+
+ @Async
+ public void startProcess(String processKey, VariableMapImpl variableMap) {
+
+ long startTime = System.currentTimeMillis();
+ Map<String, Object> inputVariables = null;
+ String processInstanceId = null;
+ try {
+ inputVariables = getInputVariables(variableMap);
+ // This variable indicates that the flow was invoked asynchronously
+ inputVariables.put("isAsyncProcess", "true");
- logger.debug("***Received MSO startProcessInstanceByKey with processKey: {} and variables: {}", processKey,
- inputVariables);
+ // Note: this creates a random businessKey if it wasn't specified.
+ String businessKey = getBusinessKey(inputVariables);
- RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
- ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processKey, businessKey,
- inputVariables);
- processInstanceId = processInstance.getId();
+ logger.debug("***Received MSO startProcessInstanceByKey with processKey: {} and variables: {}", processKey,
+ inputVariables);
- logger.debug(logMarker + "Process " + processKey + ":" + processInstanceId + " "
- + (processInstance.isEnded() ? "ENDED" : "RUNNING"));
- } catch (Exception e) {
- WorkflowResponse workflowResponse = new WorkflowResponse();
- workflowResponse.setResponse("Error occurred while executing the process: " + e);
- workflowResponse.setProcessInstanceID(processInstanceId);
- workflowResponse.setMessageCode(500);
- workflowResponse.setMessage("Fail");
- throw new WorkflowProcessorException(workflowResponse);
- }
- }
+ RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
+ ProcessInstance processInstance =
+ runtimeService.startProcessInstanceByKey(processKey, businessKey, inputVariables);
+ processInstanceId = processInstance.getId();
+
+ logger.debug(logMarker + "Process " + processKey + ":" + processInstanceId + " "
+ + (processInstance.isEnded() ? "ENDED" : "RUNNING"));
+ } catch (Exception e) {
+ WorkflowResponse workflowResponse = new WorkflowResponse();
+ workflowResponse.setResponse("Error occurred while executing the process: " + e);
+ workflowResponse.setProcessInstanceID(processInstanceId);
+ workflowResponse.setMessageCode(500);
+ workflowResponse.setMessage("Fail");
+ throw new WorkflowProcessorException(workflowResponse);
+ }
+ }
- // Note: the business key is used to identify the process in unit tests
- protected static String getBusinessKey(Map<String, Object> inputVariables) {
+ // Note: the business key is used to identify the process in unit tests
+ protected static String getBusinessKey(Map<String, Object> inputVariables) {
return getOrCreate(inputVariables, "mso-business-key");
- }
+ }
+
+
+ protected static Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
+ Map<String, Object> inputVariables = new HashMap<>();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
+ for (Map.Entry<String, Object> entry : vMap.entrySet()) {
+ String vName = entry.getKey();
+ Object value = entry.getValue();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> valueMap = (Map<String, Object>) value; // value, type
+ inputVariables.put(vName, valueMap.get("value"));
+ }
+ return inputVariables;
+ }
-
- protected static Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
- Map<String, Object> inputVariables = new HashMap<>();
- @SuppressWarnings("unchecked")
- Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
- for (Map.Entry<String, Object> entry : vMap.entrySet()) {
- String vName = entry.getKey();
- Object value = entry.getValue();
- @SuppressWarnings("unchecked")
- Map<String, Object> valueMap = (Map<String,Object>)value; // value, type
- inputVariables.put(vName, valueMap.get("value"));
- }
- return inputVariables;
- }
-
protected static String getOrCreate(Map<String, Object> inputVariables, String key) {
String value = Objects.toString(inputVariables.get(key), null);
if (value == null) {
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
index a5d479ae41..9d63e8eaf1 100644
--- 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
@@ -28,7 +28,6 @@ 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;
@@ -37,7 +36,6 @@ 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;
@@ -56,7 +54,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.stereotype.Component;
-
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -64,534 +61,531 @@ import io.swagger.annotations.ApiOperation;
@Api(value = "/workflow", description = "Root of workflow services")
@Component
public class WorkflowResource extends ProcessEngineAwareService {
-
- private static final Logger logger = LoggerFactory.getLogger(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<String, Object> 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);
- thread.start();
-
- Map<String, Object> 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) {
- logger.debug("{} process has not been created yet", LOGMARKER + processKey );
- continue;
- }
-
- String processInstanceId = processInstance.getId();
- workflowResponse.setProcessInstanceID(processInstanceId);
-
- responseMap = getResponseMap(processInstance, processKey, timeProcessEnded);
-
- if (responseMap == null) {
- logger.debug("{} has not produced a response yet", LOGMARKER + processKey);
-
- 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) {
- logger.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());
-
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", MDC.get(processKey),
- ErrorCode.UnknownError.getValue(),
- 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<String, Object> 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) {
- logger.debug("Invalid input for mso-service-request-timeout");
- }
- }
- return DEFAULT_WAIT_TIME;
- }
-
- private void recordEvents(String processKey, WorkflowResponse response, long startTime) {
- }
-
- private void setLogContext(String processKey, Map<String, Object> inputVariables) {
- }
-
- private String getValueFromInputVariables(Map<String,Object> 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) {
- logger.debug("Exception :",e);
- return true;
- }
- }
-
- private void processResponseMap(WorkflowResponse workflowResponse, Map<String, Object> 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) {
- logger.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 {
- logger.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<String,Object> inputVariables;
- private final String processKey;
- private final String businessKey;
- private ProcessInstance processInstance = null;
- private Exception exception = null;
-
- public ProcessThread(Map<String, Object> inputVariables, String processKey) {
- this.inputVariables = inputVariables;
- this.processKey = processKey;
- 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 {
-
- 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) {
- logger.debug(LOGMARKER + "ProcessThread caught an exception executing "
- + processKey + ": " + e);
- setException(e);
- }
- }
-
- }
-
- private Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
- VariableMap inputVariables = Variables.createVariables();
- @SuppressWarnings("unchecked")
- Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
- for (String key : vMap.keySet()) { //variabe name vn
- @SuppressWarnings("unchecked")
- Map<String, Object> valueMap = (Map<String,Object>)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<String, Object> 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<Execution> executions = runtimeService.createExecutionQuery()
- .processInstanceId(processInstanceId).list();
-
- for (Execution execution : executions) {
- @SuppressWarnings("unchecked")
- Map<String, Object> responseMap = (Map<String, Object>)
- 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<String, Object> responseMap = (Map<String, Object>)
- getVariableFromHistory(historyService, processInstance.getId(),
- responseMapVariable);
-
- if (responseMap != null) {
- logger.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);
- logger.debug(LOGMARKER + "WorkflowResponse: " + workflowResponse);
-
- if (workflowResponse != null) {
- Object responseCodeObject = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = responseCodeObject == null ? null : String.valueOf(responseCodeObject);
- logger.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;
- }
-
- }
- logger.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);
- logger.debug(LOGMARKER + processKey + "Response: " + response);
-
- if (response != null) {
- object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
- logger.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);
- logger.debug(LOGMARKER + prefix + "ErrorResponse: " + errorResponse);
-
- if (errorResponse != null) {
- object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
- logger.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.
- logger.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) {
- logger.debug("Error retrieving process {} variable {} from history: ", processInstanceId,
- variableName, 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<HistoricVariableInstance> variables = engine.getHistoryService().createHistoricVariableInstanceQuery().processInstanceId(processInstanceId).list();
- Map<String,String> variablesMap = new HashMap<>();
- for (HistoricVariableInstance variableInstance: variables) {
- variablesMap.put(variableInstance.getName(), variableInstance.getValue().toString());
- }
-
- logger.debug(LOGMARKER + "***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);
-
- logger.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);
-
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", MDC.get(processKey),
- ErrorCode.UnknownError.getValue(),
- LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response
- .getResponse());
- logger.debug("Exception :",ex);
- }
- return response;
- }
+
+ private static final Logger logger = LoggerFactory.getLogger(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<String, Object> 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);
+ thread.start();
+
+ Map<String, Object> 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) {
+ logger.debug("{} process has not been created yet", LOGMARKER + processKey);
+ continue;
+ }
+
+ String processInstanceId = processInstance.getId();
+ workflowResponse.setProcessInstanceID(processInstanceId);
+
+ responseMap = getResponseMap(processInstance, processKey, timeProcessEnded);
+
+ if (responseMap == null) {
+ logger.debug("{} has not produced a response yet", LOGMARKER + processKey);
+
+ 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) {
+ logger.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());
+
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN",
+ MDC.get(processKey), ErrorCode.UnknownError.getValue(), 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<String, Object> 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) {
+ logger.debug("Invalid input for mso-service-request-timeout");
+ }
+ }
+ return DEFAULT_WAIT_TIME;
+ }
+
+ private void recordEvents(String processKey, WorkflowResponse response, long startTime) {}
+
+ private void setLogContext(String processKey, Map<String, Object> inputVariables) {}
+
+ private String getValueFromInputVariables(Map<String, Object> 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) {
+ logger.debug("Exception :", e);
+ return true;
+ }
+ }
+
+ private void processResponseMap(WorkflowResponse workflowResponse, Map<String, Object> 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) {
+ logger.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 {
+ logger.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<String, Object> inputVariables;
+ private final String processKey;
+ private final String businessKey;
+ private ProcessInstance processInstance = null;
+ private Exception exception = null;
+
+ public ProcessThread(Map<String, Object> inputVariables, String processKey) {
+ this.inputVariables = inputVariables;
+ this.processKey = processKey;
+ 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 {
+
+ 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) {
+ logger.debug(LOGMARKER + "ProcessThread caught an exception executing " + processKey + ": " + e);
+ setException(e);
+ }
+ }
+
+ }
+
+ private Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
+ VariableMap inputVariables = Variables.createVariables();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
+ for (String key : vMap.keySet()) { // variabe name vn
+ @SuppressWarnings("unchecked")
+ Map<String, Object> valueMap = (Map<String, Object>) 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<String, Object> 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<Execution> executions =
+ * runtimeService.createExecutionQuery() .processInstanceId(processInstanceId).list();
+ *
+ * for (Execution execution : executions) {
+ *
+ * @SuppressWarnings("unchecked") Map<String, Object> responseMap = (Map<String, Object>)
+ * 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<String, Object> responseMap = (Map<String, Object>) getVariableFromHistory(historyService,
+ processInstance.getId(), responseMapVariable);
+
+ if (responseMap != null) {
+ logger.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);
+ logger.debug(LOGMARKER + "WorkflowResponse: " + workflowResponse);
+
+ if (workflowResponse != null) {
+ Object responseCodeObject =
+ getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
+ String responseCode = responseCodeObject == null ? null : String.valueOf(responseCodeObject);
+ logger.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;
+ }
+
+ }
+ logger.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);
+ logger.debug(LOGMARKER + processKey + "Response: " + response);
+
+ if (response != null) {
+ object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
+ String responseCode = object == null ? null : String.valueOf(object);
+ logger.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);
+ logger.debug(LOGMARKER + prefix + "ErrorResponse: " + errorResponse);
+
+ if (errorResponse != null) {
+ object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
+ String responseCode = object == null ? null : String.valueOf(object);
+ logger.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.
+ logger.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) {
+ logger.debug("Error retrieving process {} variable {} from history: ", processInstanceId, variableName, 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<HistoricVariableInstance> variables = engine.getHistoryService().createHistoricVariableInstanceQuery()
+ .processInstanceId(processInstanceId).list();
+ Map<String, String> variablesMap = new HashMap<>();
+ for (HistoricVariableInstance variableInstance : variables) {
+ variablesMap.put(variableInstance.getName(), variableInstance.getValue().toString());
+ }
+
+ logger.debug(LOGMARKER + "***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);
+
+ logger.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);
+
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN",
+ MDC.get(processKey), ErrorCode.UnknownError.getValue(), LOGMARKER + response.getMessage()
+ + " for processKey: " + processKey + " with response: " + response.getResponse());
+ logger.debug("Exception :", ex);
+ }
+ 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
index 3eed14bc30..296ab64df3 100644
--- 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
@@ -32,7 +32,6 @@ 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;
@@ -53,8 +52,6 @@ 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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -72,256 +69,259 @@ import org.springframework.stereotype.Component;
@Component
public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
- @Autowired
- private LoggingParseListener loggingParseListener;
-
- @Override
- public void preInit(
- ProcessEngineConfigurationImpl processEngineConfiguration) {
- List<BpmnParseListener> 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<ProcessDefinitionEntity> processDefinitions) {
-
- }
-
- @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 Logger logger = LoggerFactory.getLogger(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 {
- //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();
-
-
- String requestId = (String) execution.getVariable("mso-request-id");
- String svcid = (String) execution.getVariable("mso-service-instance-id");
- }
- } catch(Exception e) {
- logger.error("Exception occurred", e);
- }
- }
- }
-
- private boolean isBlank(Object object) {
- return object == null || "".equals(object.toString().trim());
- }
- }
+ @Autowired
+ private LoggingParseListener loggingParseListener;
+
+ @Override
+ public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
+ List<BpmnParseListener> 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<ProcessDefinitionEntity> processDefinitions) {
+
+ }
+
+ @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 Logger logger = LoggerFactory.getLogger(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 {
+ // 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();
+
+
+ String requestId = (String) execution.getVariable("mso-request-id");
+ String svcid = (String) execution.getVariable("mso-service-instance-id");
+ }
+ } catch (Exception e) {
+ logger.error("Exception occurred", 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
index 8bc0055343..ab21c0807e 100644
--- 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
@@ -25,7 +25,6 @@ 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;
@@ -41,7 +40,6 @@ 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.WorkflowException;
import org.springframework.stereotype.Component;
import org.slf4j.Logger;
@@ -50,125 +48,115 @@ import org.slf4j.LoggerFactory;
/**
* This plugin does the following:
* <ol>
- * <li>
- * 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).
- * </li>
- * <li>
- * Adds logic at the end of every Call Activity to generate a MSOWorkflowException
- * event if there is a WorkflowException object in the execution.
- * </li>
+ * <li>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).</li>
+ * <li>Adds logic at the end of every Call Activity to generate a MSOWorkflowException event if there is a
+ * WorkflowException object in the execution.</li>
* </ol>
*/
@Component
public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin {
- private static final Logger logger = LoggerFactory.getLogger(WorkflowExceptionPlugin.class);
-
- @Override
- public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
- List<BpmnParseListener> 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<ActivityImpl> 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<ActivityImpl> 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<PvmTransition> 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);
- }
- }
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowExceptionPlugin.class);
+
+ @Override
+ public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
+ List<BpmnParseListener> 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<ActivityImpl> 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<ActivityImpl> 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<PvmTransition> 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).
+ * 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");
+ 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);
- }
+ if (workflowException instanceof WorkflowException) {
+ int index = 1;
+ String saveName = "SavedWorkflowException" + index;
+ while (execution.getVariable(saveName) != null) {
+ saveName = "SavedWorkflowException" + (++index);
+ }
- logger.debug("WorkflowExceptionResetTask is moving WorkflowException to " + saveName);
+ logger.debug("WorkflowExceptionResetTask is moving WorkflowException to " + saveName);
- execution.setVariable(saveName, workflowException);
- execution.setVariable("WorkflowException", null);
- }
- }
- }
+ execution.setVariable(saveName, workflowException);
+ execution.setVariable("WorkflowException", null);
+ }
+ }
+ }
/**
- * Generates an MSOWorkflowException event if there is a WorkflowException
- * object in the execution.
+ * 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) {
- logger.debug("WorkflowExceptionTriggerTask is generating a MSOWorkflowException event");
- throw new BpmnError("MSOWorkflowException");
- }
- }
- }
+ public static class WorkflowExceptionTriggerTask implements JavaDelegate {
+ public void execute(DelegateExecution execution) throws Exception {
+ if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
+ logger.debug("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
index cb20ded8de..6572beaba9 100644
--- 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
@@ -23,9 +23,7 @@
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;
@@ -47,45 +45,44 @@ 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 Logger logger = LoggerFactory.getLogger(CXFConfiguration.class);
-
+
+ private static final Logger logger = LoggerFactory.getLogger(CXFConfiguration.class);
+
+ @Autowired
+ private Bus bus;
+
+ @Autowired
+ private WorkflowMessageResource wmr;
+
+ @Autowired
+ private WorkflowResource workflowResource;
+
+ @Autowired
+ private WorkflowAsyncResource workflowAsyncResource;
+
@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
+ 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);
@@ -95,7 +92,7 @@ public class CXFConfiguration {
endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor());
return endpoint;
}
-
+
@Bean
public Endpoint sndcAdapterCallback() {
EndpointImpl endpoint = new EndpointImpl(bus, sdncAdapterCallbackServiceImpl);
@@ -105,22 +102,22 @@ public class CXFConfiguration {
endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor());
return endpoint;
}
-
+
@Bean
public Server rsServer() {
JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean();
endpoint.setBus(bus);
endpoint.setServiceBeans(Arrays.<Object>asList(wmr, workflowResource, workflowAsyncResource));
- endpoint.setAddress("/");
+ endpoint.setAddress("/");
endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature()));
- endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper),jaxRsFilterLogging));
-
+ endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), jaxRsFilterLogging));
+
return endpoint.create();
}
@Bean
public Swagger2Feature createSwaggerFeature() {
- Swagger2Feature swagger2Feature= new Swagger2Feature();
+ Swagger2Feature swagger2Feature = new Swagger2Feature();
swagger2Feature.setPrettyPrint(true);
swagger2Feature.setTitle("SO Orchestration Application");
swagger2Feature.setContact("The ONAP SO team");
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
index af9ab2899e..bd430fd679 100644
--- 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
@@ -24,7 +24,6 @@ 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;
@@ -51,55 +50,53 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@SpringBootApplication
@EnableAsync
-@ComponentScan(basePackages = { "org.onap" }, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {
- @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class) })
+@ComponentScan(basePackages = {"org.onap"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class,
+ excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
public class MSOInfrastructureApplication {
- private static final Logger logger = LoggerFactory.getLogger(MSOInfrastructureApplication.class);
+ private static final Logger logger = LoggerFactory.getLogger(MSOInfrastructureApplication.class);
- @Value("${mso.async.core-pool-size}")
- private int corePoolSize;
+ @Value("${mso.async.core-pool-size}")
+ private int corePoolSize;
- @Value("${mso.async.max-pool-size}")
- private int maxPoolSize;
+ @Value("${mso.async.max-pool-size}")
+ private int maxPoolSize;
- @Value("${mso.async.queue-capacity}")
- private int queueCapacity;
+ @Value("${mso.async.queue-capacity}")
+ private int queueCapacity;
- private static final String LOGS_DIR = "logs_dir";
+ 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/");
- }
- }
+ 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();
- }
+ public static void main(String... args) {
+ SpringApplication.run(MSOInfrastructureApplication.class, args);
+ System.getProperties().setProperty("mso.config.path", ".");
+ setLogsDir();
+ }
- @PostDeploy
- public void postDeploy(ProcessEngine processEngineInstance) {
- }
+ @PostDeploy
+ public void postDeploy(ProcessEngine processEngineInstance) {}
- @PreUndeploy
- public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo,
- List<ProcessEngine> processEngines) {
- }
+ @PreUndeploy
+ public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo,
+ List<ProcessEngine> processEngines) {}
- @Bean
- @Primary
- public Executor asyncExecutor() {
- ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
- executor.setTaskDecorator(new MDCTaskDecorator());
- executor.setCorePoolSize(corePoolSize);
- executor.setMaxPoolSize(maxPoolSize);
- executor.setQueueCapacity(queueCapacity);
- executor.setThreadNamePrefix("Camunda-");
- executor.initialize();
- return executor;
- }
+ @Bean
+ @Primary
+ public Executor asyncExecutor() {
+ ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+ executor.setTaskDecorator(new MDCTaskDecorator());
+ executor.setCorePoolSize(corePoolSize);
+ executor.setMaxPoolSize(maxPoolSize);
+ executor.setQueueCapacity(queueCapacity);
+ executor.setThreadNamePrefix("Camunda-");
+ executor.initialize();
+ return executor;
+ }
}
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
index ad9e210452..c2af155d51 100644
--- 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
@@ -31,22 +31,19 @@ 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);
- }
+ @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/test/java/RequestHeaderTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java
index e56b45f19d..b185f80aaf 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java
@@ -1,46 +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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR 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();
+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);
- }
+ @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
index 884c2ac9c6..7ce82810be 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java
@@ -1,44 +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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR 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.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";
+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());
- }
+ @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
index 79bffe40d0..8a976711c6 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java
@@ -1,41 +1,35 @@
/*
-* ============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
+ * ============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
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR 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);
- }
+ 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
index fc21ff905d..2176dd885b 100644
--- 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
@@ -31,7 +31,6 @@ 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.WireMockServer;
import com.github.tomakehurst.wiremock.client.WireMock;
@@ -40,19 +39,19 @@ import com.github.tomakehurst.wiremock.client.WireMock;
@ActiveProfiles("test")
@ContextConfiguration
@AutoConfigureWireMock(port = 0)
-public abstract class BaseIntegrationTest extends WorkflowTest {
- @Autowired
- BPMNUtil bpmnUtil;
+public abstract class BaseIntegrationTest extends WorkflowTest {
+ @Autowired
+ BPMNUtil bpmnUtil;
+
+ @Value("${wiremock.server.port}")
+ protected String wiremockPort;
+
+ @Autowired
+ protected WireMockServer wireMockServer;
- @Value("${wiremock.server.port}")
- protected String wiremockPort;
-
- @Autowired
- protected WireMockServer wireMockServer;
-
- @After
- public void baseAfterTest() {
- wireMockServer.resetAll();
- }
+ @After
+ public void baseAfterTest() {
+ wireMockServer.resetAll();
+ }
}
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
index c28a86c49a..0a532663b8 100644
--- 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
@@ -19,6 +19,7 @@
*/
package org.onap.so.bpmn;
+
import ch.vorburger.exec.ManagedProcessException;
import ch.vorburger.mariadb4j.DBConfigurationBuilder;
import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
@@ -35,38 +36,27 @@ 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"}
-)
+@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")
+ 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
- ) {
+ @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
index f65cadae3c..bc002c7022 100644
--- 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
@@ -27,6 +27,6 @@ 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
+ // 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
index 5f0722aa3d..f417a550d1 100644
--- 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
@@ -25,14 +25,11 @@ 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;
@@ -52,306 +49,303 @@ import org.springframework.stereotype.Component;
@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 extends Object> 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> T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) {
- String pID = getProcessInstanceId(processEngineServices,
- processDefinitionID);
- return getRawVariable( processEngineServices, processDefinitionID, name, pID);
- }
-
- @SuppressWarnings("unchecked")
- public static <T> 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<HistoricProcessInstance> 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<HistoricProcessInstance> historyList = processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().list();
- List<String> 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<HistoricProcessInstance> 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<String,Object> variableValueType) {
- Map<String, Object> host = new HashMap<>();
- host.put("value", value);
- host.put("type", "String");
- variableValueType.put(key, host);
- }
-
- public static WorkflowResponse executeWorkFlow(ProcessEngineServices processEngineServices, String processKey, Map<String,String> variables) {
- VariableMapImpl variableMap = new VariableMapImpl();
-
- Map<String, Object> 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<String,String> variables, WorkflowResource workflowResource) {
-
- VariableMapImpl variableMap = new VariableMapImpl();
-
- Map<String, Object> variableValueType = new HashMap<String, Object>();
- 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<String,String> 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<String,String> variables) throws InterruptedException {
- VariableMapImpl variableMap = new VariableMapImpl();
-
- Map<String, Object> 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<String,String> variables;
-
- public ProcessThread(String processKey, ProcessEngineServices processEngineServices, Map<String,String> variables) {
- this.processKey = processKey;
- this.processEngineServices = processEngineServices;
- this.variables = variables;
- }
-
- public void run() {
- started = true;
- /*doAnswer(new Answer<Void>() {
- 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();
- }
- }
- }
+ 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 extends Object> 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> T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID,
+ String name) {
+ String pID = getProcessInstanceId(processEngineServices, processDefinitionID);
+ return getRawVariable(processEngineServices, processDefinitionID, name, pID);
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> 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<HistoricProcessInstance> 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<HistoricProcessInstance> historyList =
+ processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().list();
+ List<String> 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<HistoricProcessInstance> 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<String, Object> variableValueType) {
+ Map<String, Object> host = new HashMap<>();
+ host.put("value", value);
+ host.put("type", "String");
+ variableValueType.put(key, host);
+ }
+
+ public static WorkflowResponse executeWorkFlow(ProcessEngineServices processEngineServices, String processKey,
+ Map<String, String> variables) {
+ VariableMapImpl variableMap = new VariableMapImpl();
+
+ Map<String, Object> 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<String, String> variables, WorkflowResource workflowResource) {
+
+ VariableMapImpl variableMap = new VariableMapImpl();
+
+ Map<String, Object> variableValueType = new HashMap<String, Object>();
+ 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<String, String> 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<String, String> variables) throws InterruptedException {
+ VariableMapImpl variableMap = new VariableMapImpl();
+
+ Map<String, Object> 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<String, String> variables;
+
+ public ProcessThread(String processKey, ProcessEngineServices processEngineServices,
+ Map<String, String> variables) {
+ this.processKey = processKey;
+ this.processEngineServices = processEngineServices;
+ this.variables = variables;
+ }
+
+ public void run() {
+ started = true;
+ /*
+ * doAnswer(new Answer<Void>() { 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
index f528205d17..2be72184af 100644
--- 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
@@ -16,17 +16,15 @@
* 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;
@@ -36,148 +34,140 @@ import org.onap.so.BaseIntegrationTest;
*/
public class CompleteMsoProcessIT extends BaseIntegrationTest {
-
- private void executeFlow(String inputRequestFile) throws InterruptedException {
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
- Map<String, Object> 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 = ""
- + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://ecomp.openecomp.org.com/mso/workflow/schema/v1\">"
- + " <ns:request-information>"
- + " <ns:request-id>STUW105_5002</ns:request-id>"
- + " <ns:request-action>RequestAction</ns:request-action>"
- + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
- + " <ns:source>SOURCE</ns:source>"
- + " <ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"
- + " <ns:order-number>10205000</ns:order-number>"
- + " <ns:order-version>1</ns:order-version>"
- + " </ns:request-information>"
- + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
- + "</sdncadapterworkflow:MsoCompletionRequest>";
-
- return xml;
- }
-
-
-
- public String gMsoCompletionRequestWithNoNotificationurl() {
- //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
- String xml = ""
- + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
- + " <ns:request-information>"
- + " <ns:request-id>STUW105_5002</ns:request-id>"
- + " <ns:request-action>RequestAction</ns:request-action>"
- + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
- + " <ns:source>SOURCE</ns:source>"
- + " <ns:notification-url></ns:notification-url>"
- + " <ns:order-number>10205000</ns:order-number>"
- + " <ns:order-version>1</ns:order-version>"
- + " </ns:request-information>"
- + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
- + "</sdncadapterworkflow:MsoCompletionRequest>";
-
- return xml;
- }
-
- public String gMsoCompletionRequestWithNoNotificationurlNoRequestId() {
- //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
- String xml = ""
- + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
- + " <ns:request-information>"
- + " <ns:request-id></ns:request-id>"
- + " <ns:request-action>RequestAction</ns:request-action>"
- + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
- + " <ns:source>SOURCE</ns:source>"
- + " <ns:notification-url></ns:notification-url>"
- + " <ns:order-number>10205000</ns:order-number>"
- + " <ns:order-version>1</ns:order-version>"
- + " </ns:request-information>"
- + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
- + "</sdncadapterworkflow:MsoCompletionRequest>";
-
- return xml;
- }
-
- public String gMsoCompletionRequestWithNotificationurlNoRequestId() {
- //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
- String xml = ""
- + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
- + " <ns:request-information>"
- + " <ns:request-id></ns:request-id>"
- + " <ns:request-action>RequestAction</ns:request-action>"
- + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
- + " <ns:source>SOURCE</ns:source>"
- + " <ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"
- + " <ns:order-number>10205000</ns:order-number>"
- + " <ns:order-version>1</ns:order-version>"
- + " </ns:request-information>"
- + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
- + "</sdncadapterworkflow:MsoCompletionRequest>";
-
- return xml;
- }
+
+ private void executeFlow(String inputRequestFile) throws InterruptedException {
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+ Map<String, Object> 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 = ""
+ + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://ecomp.openecomp.org.com/mso/workflow/schema/v1\">"
+ + " <ns:request-information>" + " <ns:request-id>STUW105_5002</ns:request-id>"
+ + " <ns:request-action>RequestAction</ns:request-action>"
+ + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>" + " <ns:source>SOURCE</ns:source>"
+ + " <ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"
+ + " <ns:order-number>10205000</ns:order-number>" + " <ns:order-version>1</ns:order-version>"
+ + " </ns:request-information>"
+ + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
+ + "</sdncadapterworkflow:MsoCompletionRequest>";
+
+ return xml;
+ }
+
+
+
+ public String gMsoCompletionRequestWithNoNotificationurl() {
+ // Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
+ + " <ns:request-information>" + " <ns:request-id>STUW105_5002</ns:request-id>"
+ + " <ns:request-action>RequestAction</ns:request-action>"
+ + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>" + " <ns:source>SOURCE</ns:source>"
+ + " <ns:notification-url></ns:notification-url>"
+ + " <ns:order-number>10205000</ns:order-number>" + " <ns:order-version>1</ns:order-version>"
+ + " </ns:request-information>"
+ + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
+ + "</sdncadapterworkflow:MsoCompletionRequest>";
+
+ return xml;
+ }
+
+ public String gMsoCompletionRequestWithNoNotificationurlNoRequestId() {
+ // Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
+ + " <ns:request-information>" + " <ns:request-id></ns:request-id>"
+ + " <ns:request-action>RequestAction</ns:request-action>"
+ + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>" + " <ns:source>SOURCE</ns:source>"
+ + " <ns:notification-url></ns:notification-url>"
+ + " <ns:order-number>10205000</ns:order-number>" + " <ns:order-version>1</ns:order-version>"
+ + " </ns:request-information>"
+ + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
+ + "</sdncadapterworkflow:MsoCompletionRequest>";
+
+ return xml;
+ }
+
+ public String gMsoCompletionRequestWithNotificationurlNoRequestId() {
+ // Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
+ + " <ns:request-information>" + " <ns:request-id></ns:request-id>"
+ + " <ns:request-action>RequestAction</ns:request-action>"
+ + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>" + " <ns:source>SOURCE</ns:source>"
+ + " <ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"
+ + " <ns:order-number>10205000</ns:order-number>" + " <ns:order-version>1</ns:order-version>"
+ + " </ns:request-information>"
+ + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
+ + "</sdncadapterworkflow:MsoCompletionRequest>";
+
+ 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
index cc3ca941e4..ad0428c68e 100644
--- 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
@@ -16,17 +16,15 @@
* 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;
@@ -38,79 +36,83 @@ import org.onap.so.BaseIntegrationTest;
*/
public class ConfirmVolumeGroupNameIT extends BaseIntegrationTest {
- /**
- * Sunny day scenario.
- *
- * @throws Exception
- */
- @Test
- public void sunnyDay() throws Exception {
- logStart();
- MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml");
-
- Map<String, Object> 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(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST", "aai-volume-group-id-info.xml", 404);
-
- Map<String, Object> 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(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml", 200);
-
- Map<String, Object> 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();
- }
+ /**
+ * Sunny day scenario.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void sunnyDay() throws Exception {
+ logStart();
+ MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml");
+
+ Map<String, Object> 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(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST",
+ "aai-volume-group-id-info.xml", 404);
+
+ Map<String, Object> 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(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml", 200);
+
+ Map<String, Object> 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
index fd1f7c1a2b..f190b6243b 100644
--- 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
@@ -19,17 +19,15 @@
* 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;
@@ -40,49 +38,59 @@ import org.onap.so.BaseIntegrationTest;
public class ConfirmVolumeGroupTenantIT extends BaseIntegrationTest {
- @Test
- public void testRemoveLayer3Service_success() throws Exception{
- MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume.xml");
-
- Map<String, Object> 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(wireMockServer, "MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml");
-
- Map<String, Object> 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<String, Object> 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());
- }
+ @Test
+ public void testRemoveLayer3Service_success() throws Exception {
+ MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58",
+ "CRTGVNF_queryAAIResponseVolume.xml");
+
+ Map<String, Object> 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(wireMockServer, "MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58",
+ "CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml");
+
+ Map<String, Object> 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<String, Object> 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
index f6cd74a55b..47d3799e7d 100644
--- 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
@@ -18,7 +18,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
@@ -26,18 +26,15 @@ 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.urlMatching;
-
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.core.WorkflowException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import com.github.tomakehurst.wiremock.WireMockServer;
/**
@@ -45,223 +42,228 @@ import com.github.tomakehurst.wiremock.WireMockServer;
*/
public class CreateAAIVfModuleIT extends BaseIntegrationTest {
-
- Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
-
- @Test
- public void TestCreateGenericVnfSuccess_200() {
- new MockAAIGenericVnfSearch(wireMockServer);
- MockAAICreateGenericVnf(wireMockServer);
- MockAAIVfModulePUT(wireMockServer, true);
-
- Map<String, Object> 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);
- }
+ Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
+
+ @Test
+ public void TestCreateGenericVnfSuccess_200() {
+
+ new MockAAIGenericVnfSearch(wireMockServer);
+ MockAAICreateGenericVnf(wireMockServer);
+ MockAAIVfModulePUT(wireMockServer, true);
+
+ Map<String, Object> 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(wireMockServer);
+ MockAAICreateGenericVnf(wireMockServer);
+ MockAAIVfModulePUT(wireMockServer, true);
+ Map<String, Object> 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(wireMockServer);
+ MockAAICreateGenericVnf(wireMockServer);
+ MockAAIVfModulePUT(wireMockServer, true);
+
+ Map<String, Object> 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(wireMockServer);
+ MockAAICreateGenericVnf(wireMockServer);
+ MockAAIVfModulePUT(wireMockServer, true);
+
+ Map<String, Object> 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(wireMockServer);
+ MockAAICreateGenericVnf(wireMockServer);
+ MockAAIVfModulePUT(wireMockServer, true);
+
+ Map<String, Object> 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(wireMockServer);
+ MockAAICreateGenericVnf(wireMockServer);
+ MockAAIVfModulePUT(wireMockServer, true);
+
+ Map<String, Object> 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("<messageId>SVC3002</messageId>"));
+ logger.debug(exception.getErrorMessage());
+ }
- @Test
- public void TestCreateVfModuleSuccess_200() {
- // create Add-on VF Module for existing Generic VNF
- new MockAAIGenericVnfSearch(wireMockServer);
- MockAAICreateGenericVnf(wireMockServer);
- MockAAIVfModulePUT(wireMockServer, true);
- Map<String, Object> 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 TestCreateGenericVnfFailure_1002() {
+ new MockAAIGenericVnfSearch(wireMockServer);
+ MockAAICreateGenericVnf(wireMockServer);
+ MockAAIVfModulePUT(wireMockServer, true);
- @Test
- public void TestQueryGenericVnfFailure_5000() {
- new MockAAIGenericVnfSearch(wireMockServer);
- MockAAICreateGenericVnf(wireMockServer);
- MockAAIVfModulePUT(wireMockServer, true);
-
- Map<String, Object> 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());
- }
+ Map<String, Object> 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 TestCreateDupGenericVnfFailure_1002() {
- new MockAAIGenericVnfSearch(wireMockServer);
- MockAAICreateGenericVnf(wireMockServer);
- MockAAIVfModulePUT(wireMockServer, true);
-
- Map<String, Object> 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 TestCreateVfModuleFailure_5000() {
+ new MockAAIGenericVnfSearch(wireMockServer);
+ MockAAICreateGenericVnf(wireMockServer);
+ MockAAIVfModulePUT(wireMockServer, true);
- @Test
- public void TestCreateDupVfModuleFailure_1002() {
- new MockAAIGenericVnfSearch(wireMockServer);
- MockAAICreateGenericVnf(wireMockServer);
- MockAAIVfModulePUT(wireMockServer, true);
-
- Map<String, Object> 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(wireMockServer);
- MockAAICreateGenericVnf(wireMockServer);
- MockAAIVfModulePUT(wireMockServer, true);
-
- Map<String, Object> 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("<messageId>SVC3002</messageId>"));
- logger.debug(exception.getErrorMessage());
- }
+ Map<String, Object> 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("<messageId>SVC3002</messageId>"));
+ logger.debug(exception.getErrorMessage());
+ }
- @Test
- public void TestCreateGenericVnfFailure_1002() {
- new MockAAIGenericVnfSearch(wireMockServer);
- MockAAICreateGenericVnf(wireMockServer);
- MockAAIVfModulePUT(wireMockServer, true);
-
- Map<String, Object> 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());
- }
+ public static void MockAAICreateGenericVnf(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
+ .withRequestBody(containing("<service-id>00000000-0000-0000-0000-000000000000</service-id>"))
+ .willReturn(aResponse().withStatus(201)));
+ wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
+ .withRequestBody(containing("<service-id>99999999-9999-9999-9999-999999999999</service-id>"))
+ .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+ }
- @Test
- public void TestCreateVfModuleFailure_5000() {
- new MockAAIGenericVnfSearch(wireMockServer);
- MockAAICreateGenericVnf(wireMockServer);
- MockAAIVfModulePUT(wireMockServer, true);
-
- Map<String, Object> 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("<messageId>SVC3002</messageId>"));
- logger.debug(exception.getErrorMessage());
- }
+ // start of mocks used locally and by other VF Module unit tests
+ public static void MockAAIVfModulePUT(WireMockServer wireMockServer, boolean isCreate) {
+ wireMockServer
+ .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)));
+ wireMockServer
+ .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")));
+ wireMockServer.stubFor(
+ put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
+ .willReturn(aResponse().withStatus(200)));
+ }
- public static void MockAAICreateGenericVnf(WireMockServer wireMockServer){
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
- .withRequestBody(containing("<service-id>00000000-0000-0000-0000-000000000000</service-id>"))
- .willReturn(aResponse()
- .withStatus(201)));
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
- .withRequestBody(containing("<service-id>99999999-9999-9999-9999-999999999999</service-id>"))
- .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(WireMockServer wireMockServer, boolean isCreate){
- wireMockServer.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)));
- wireMockServer.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")));
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
}
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
index 39a7e0c74b..b78c5b8aad 100644
--- 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
@@ -26,12 +26,10 @@ import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPri
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;
@@ -45,91 +43,95 @@ import org.slf4j.LoggerFactory;
public class CreateAAIVfModuleVolumeGroupIT extends BaseIntegrationTest {
- Logger logger = LoggerFactory.getLogger(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(wireMockServer, "skask", "lukewarm", 200, "VfModularity/VfModule-lukewarm.xml", 2);
- MockPutVfModuleIdNoResponse(wireMockServer, "skask", "PCRF", "lukewarm");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, "skask", ".*", "VfModularity/VfModule-supercool.xml", 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, "skask", "lukewarm", "VfModularity/VfModule-lukewarm.xml", 200);
- MockPutVfModuleId(wireMockServer, "skask", "lukewarm", 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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();
- }
+ Logger logger = LoggerFactory.getLogger(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(wireMockServer, "skask", "lukewarm", 200,
+ "VfModularity/VfModule-lukewarm.xml", 2);
+ MockPutVfModuleIdNoResponse(wireMockServer, "skask", "PCRF", "lukewarm");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, "skask", ".*", "VfModularity/VfModule-supercool.xml", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, "skask", "lukewarm", "VfModularity/VfModule-lukewarm.xml", 200);
+ MockPutVfModuleId(wireMockServer, "skask", "lukewarm", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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
index 3d15a4b29b..0bfcbd370d 100644
--- 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
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
@@ -25,7 +25,6 @@ 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;
@@ -40,56 +39,55 @@ import org.onap.so.BaseIntegrationTest;
public class DecomposeServiceIT extends BaseIntegrationTest {
- public DecomposeServiceIT() throws IOException {
+ public DecomposeServiceIT() throws IOException {
+
+ }
- }
+ @Test
+ public void testDecomposeService_success() throws Exception {
+ MockGetServiceResourcesCatalogData(wireMockServer, "cmw-123-456-789", "1.0",
+ "/getCatalogServiceResourcesDataWithConfig.json");
- @Test
- public void testDecomposeService_success() throws Exception{
- MockGetServiceResourcesCatalogData(wireMockServer, "cmw-123-456-789", "1.0", "/getCatalogServiceResourcesDataWithConfig.json");
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ invokeSubProcess("DecomposeService", businessKey, variables);
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
- invokeSubProcess("DecomposeService", businessKey, variables);
+ waitForProcessEnd(businessKey, 10000);
- waitForProcessEnd(businessKey, 10000);
+ Assert.assertTrue(isProcessEnded(businessKey));
- Assert.assertTrue(isProcessEnded(businessKey));
+ }
- }
-
- //@Test
- @Test
- public void testDecomposeService_success_partial() throws Exception{
- MockGetServiceResourcesCatalogData(wireMockServer, "cmw-123-456-789", "1.0", "/getCatalogServiceResourcesDataNoNetwork.json");
+ // @Test
+ @Test
+ public void testDecomposeService_success_partial() throws Exception {
+ MockGetServiceResourcesCatalogData(wireMockServer, "cmw-123-456-789", "1.0",
+ "/getCatalogServiceResourcesDataNoNetwork.json");
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
- invokeSubProcess("DecomposeService", businessKey, variables);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ invokeSubProcess("DecomposeService", businessKey, variables);
- waitForProcessEnd(businessKey, 10000);
+ waitForProcessEnd(businessKey, 10000);
- Assert.assertTrue(isProcessEnded(businessKey));
+ Assert.assertTrue(isProcessEnded(businessKey));
- }
+ }
- private void setVariablesSuccess(Map<String, Object> variables, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", requestId);
- variables.put("msoRequestId", requestId);
- variables.put("serviceInstanceId",siId);
+ private void setVariablesSuccess(Map<String, Object> 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);
+ 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
index 99e4b8cbde..cac237aec4 100644
--- 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
@@ -16,14 +16,13 @@
* 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.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.junit.Assert;
import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
@@ -36,245 +35,227 @@ import org.slf4j.LoggerFactory;
*/
public class DeleteAAIVfModuleIT extends BaseIntegrationTest {
- private static final String EOL = "\n";
-
- Logger logger = LoggerFactory.getLogger(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(wireMockServer);
- new MockAAIDeleteGenericVnf(wireMockServer);
- new MockAAIDeleteVfModule(wireMockServer);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("DeleteAAIVfModuleRequest","<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\"> <request-info> <action>DELETE_VF_MODULE</action> <source>PORTAL</source> </request-info> <vnf-inputs> <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id> <vnf-name>STMTN5MMSC21</vnf-name> <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id> <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name> </vnf-inputs> <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/> </vnf-request>");
- 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);
- }
+ private static final String EOL = "\n";
+
+ Logger logger = LoggerFactory.getLogger(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(wireMockServer);
+ new MockAAIDeleteGenericVnf(wireMockServer);
+ new MockAAIDeleteVfModule(wireMockServer);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("DeleteAAIVfModuleRequest",
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\"> <request-info> <action>DELETE_VF_MODULE</action> <source>PORTAL</source> </request-info> <vnf-inputs> <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id> <vnf-name>STMTN5MMSC21</vnf-name> <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id> <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name> </vnf-inputs> <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/> </vnf-request>");
+ 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 = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL
+ + " <request-info>" + EOL + " <action>DELETE_VF_MODULE</action>" + EOL
+ + " <source>PORTAL</source>" + EOL + " </request-info>" + EOL + " <vnf-inputs>" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL
+ + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL + " </vnf-inputs>" + EOL
+ + " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>"
+ + EOL;
+
+ new MockAAIGenericVnfSearch(wireMockServer);
+ new MockAAIDeleteGenericVnf(wireMockServer);
+ new MockAAIDeleteVfModule(wireMockServer);
+
+ Map<String, Object> 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 = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL
+ + " <request-info>" + EOL + " <action>DELETE_VF_MODULE</action>" + EOL
+ + " <source>PORTAL</source>" + EOL + " </request-info>" + EOL + " <vnf-inputs>" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c723</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC23</vnf-name>" + EOL
+ + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a71</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL + " </vnf-inputs>" + EOL
+ + " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>"
+ + EOL;
+ new MockAAIGenericVnfSearch(wireMockServer);
+ new MockAAIDeleteGenericVnf(wireMockServer);
+ new MockAAIDeleteVfModule(wireMockServer);
+
+ Map<String, Object> 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("<messageId>SVC3002</messageId>"));
+ 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 = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL
+ + " <request-info>" + EOL + " <action>DELETE_VF_MODULE</action>" + EOL
+ + " <source>PORTAL</source>" + EOL + " </request-info>" + EOL + " <vnf-inputs>" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c722</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC22</vnf-name>" + EOL
+ + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a72</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC22-MMSC::module-1-0</vf-module-name>" + EOL + " </vnf-inputs>" + EOL
+ + " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>"
+ + EOL;
+ new MockAAIGenericVnfSearch(wireMockServer);
+ new MockAAIDeleteGenericVnf(wireMockServer);
+ new MockAAIDeleteVfModule(wireMockServer);
+
+ Map<String, Object> 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 = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL
+ + " <request-info>" + EOL + " <action>DELETE_VF_MODULE</action>" + EOL
+ + " <source>PORTAL</source>" + EOL + " </request-info>" + EOL + " <vnf-inputs>" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL
+ + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL + " </vnf-inputs>" + EOL
+ + " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>"
+ + EOL;
+ new MockAAIGenericVnfSearch(wireMockServer);
+ new MockAAIDeleteGenericVnf(wireMockServer);
+ new MockAAIDeleteVfModule(wireMockServer);
+
+ Map<String, Object> 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("<messageId>SVC3002</messageId>"));
+ logger.debug(exception.getErrorMessage());
+ }
- @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 =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
+ @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 = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL
+ + " <request-info>" + EOL + " <action>DELETE_VF_MODULE</action>" + EOL
+ + " <source>PORTAL</source>" + EOL + " </request-info>" + EOL + " <vnf-inputs>" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL
+ + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL + " </vnf-inputs>" + EOL
+ + " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>"
+ + EOL;
+ new MockAAIGenericVnfSearch(wireMockServer);
+ new MockAAIDeleteGenericVnf(wireMockServer);
+ new MockAAIDeleteVfModule(wireMockServer);
- new MockAAIGenericVnfSearch(wireMockServer);
- new MockAAIDeleteGenericVnf(wireMockServer);
- new MockAAIDeleteVfModule(wireMockServer);
-
- Map<String, Object> 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);
- }
+ Map<String, Object> 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("<messageId>SVC3002</messageId>"));
+ logger.debug(exception.getErrorMessage());
+ }
- @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 =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c723</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC23</vnf-name>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a71</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- new MockAAIGenericVnfSearch(wireMockServer);
- new MockAAIDeleteGenericVnf(wireMockServer);
- new MockAAIDeleteVfModule(wireMockServer);
-
- Map<String, Object> 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("<messageId>SVC3002</messageId>"));
- 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 = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL
+ + " <request-info>" + EOL + " <action>DELETE_VF_MODULE</action>" + EOL
+ + " <source>PORTAL</source>" + EOL + " </request-info>" + EOL + " <vnf-inputs>" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL
+ + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL + " </vnf-inputs>" + EOL
+ + " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>"
+ + EOL;
+ new MockAAIGenericVnfSearch(wireMockServer);
+ new MockAAIDeleteGenericVnf(wireMockServer);
+ new MockAAIDeleteVfModule(wireMockServer);
- @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 =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c722</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC22</vnf-name>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a72</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC22-MMSC::module-1-0</vf-module-name>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- new MockAAIGenericVnfSearch(wireMockServer);
- new MockAAIDeleteGenericVnf(wireMockServer);
- new MockAAIDeleteVfModule(wireMockServer);
-
- Map<String, Object> 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());
- }
+ Map<String, Object> 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 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 =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- new MockAAIGenericVnfSearch(wireMockServer);
- new MockAAIDeleteGenericVnf(wireMockServer);
- new MockAAIDeleteVfModule(wireMockServer);
-
- Map<String, Object> 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("<messageId>SVC3002</messageId>"));
- 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 =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- new MockAAIGenericVnfSearch(wireMockServer);
- new MockAAIDeleteGenericVnf(wireMockServer);
- new MockAAIDeleteVfModule(wireMockServer);
-
- Map<String, Object> 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("<messageId>SVC3002</messageId>"));
- 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 =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- new MockAAIGenericVnfSearch(wireMockServer);
- new MockAAIDeleteGenericVnf(wireMockServer);
- new MockAAIDeleteVfModule(wireMockServer);
-
- Map<String, Object> 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(wireMockServer);
+ new MockAAIDeleteGenericVnf(wireMockServer);
+ new MockAAIDeleteVfModule(wireMockServer);
- @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(wireMockServer);
- new MockAAIDeleteGenericVnf(wireMockServer);
- new MockAAIDeleteVfModule(wireMockServer);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("DeleteAAIVfModuleRequest","<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\"> <request-info> <action>DELETE_VF_MODULE</action> <source>PORTAL</source> </request-info> <vnf-inputs> <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id> <vnf-name>STMTN5MMSC20</vnf-name> <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id> <vf-module-name>STMTN5MMSC20-MMSC::module-2-0</vf-module-name> </vnf-inputs> <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/> </vnf-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("does not exist for Generic Vnf Id"));
- logger.debug(exception.getErrorMessage());
- }
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("DeleteAAIVfModuleRequest",
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\"> <request-info> <action>DELETE_VF_MODULE</action> <source>PORTAL</source> </request-info> <vnf-inputs> <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id> <vnf-name>STMTN5MMSC20</vnf-name> <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id> <vf-module-name>STMTN5MMSC20-MMSC::module-2-0</vf-module-name> </vnf-inputs> <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/> </vnf-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("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
index 88f8e5deb7..59f46b2a93 100644
--- 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
@@ -18,7 +18,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
@@ -26,11 +26,9 @@ 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 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;
@@ -42,185 +40,164 @@ import org.slf4j.LoggerFactory;
*/
public class FalloutHandlerIT extends BaseIntegrationTest {
-
- Logger logger = LoggerFactory.getLogger(FalloutHandlerIT.class);
-
-
- private void setupMocks() {
- wireMockServer.stubFor(post(urlEqualTo("/dbadapters/AttRequestsDbAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody("<DbTag>Notified</DbTag>")));
- wireMockServer.stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody("<DbTag>Notified</DbTag>")));
- }
-
- private String executeFlow(String inputRequestFile) throws InterruptedException {
-
- Map<String, Object> 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 = ""
- + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
- + " <ns7:request-information>"
- + " <ns7:request-id>1020_STUW105_5002</ns7:request-id>"
- + " <ns7:request-action>requestAction</ns7:request-action>"
- + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
- + " <ns7:source>source</ns7:source>"
- + " <ns7:notification-url>http://localhost:28090/CCD/StatusNotification</ns7:notification-url>"
- + " <ns7:order-number>10205000</ns7:order-number>"
- + " <ns7:order-version>1</ns7:order-version>"
- + " </ns7:request-information>"
- + " <sdncadapterworkflow:WorkflowException>"
- + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
- + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
- + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
- + " </sdncadapterworkflow:WorkflowException>"
- + "</sdncadapterworkflow:FalloutHandlerRequest>";
-
- 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 = ""
- + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
- + " <ns7:request-information>"
- + " <ns7:request-id>1020_STUW105_5002</ns7:request-id>"
- + " <ns7:request-action>requestAction</ns7:request-action>"
- + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
- + " <ns7:source>source</ns7:source>"
- + " <ns7:notification-url></ns7:notification-url>"
- + " <ns7:order-number>10205000</ns7:order-number>"
- + " <ns7:order-version>1</ns7:order-version>"
- + " </ns7:request-information>"
- + " <sdncadapterworkflow:WorkflowException>"
- + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
- + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
- + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
- + " </sdncadapterworkflow:WorkflowException>"
- + "</sdncadapterworkflow:FalloutHandlerRequest>";
-
- 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 = ""
- + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
- + " <ns7:request-information>"
- + " <ns7:request-id></ns7:request-id>"
- + " <ns7:request-action>requestAction</ns7:request-action>"
- + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
- + " <ns7:source>source</ns7:source>"
- + " <ns7:notification-url>www.test.com</ns7:notification-url>"
- + " <ns7:order-number>10205000</ns7:order-number>"
- + " <ns7:order-version>1</ns7:order-version>"
- + " </ns7:request-information>"
- + " <sdncadapterworkflow:WorkflowException>"
- + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
- + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
- + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
- + " </sdncadapterworkflow:WorkflowException>"
- + "</sdncadapterworkflow:FalloutHandlerRequest>";
-
- 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 = ""
- + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
- + " <ns7:request-information>"
- + " <ns7:request-id></ns7:request-id>"
- + " <ns7:request-action>requestAction</ns7:request-action>"
- + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
- + " <ns7:source>source</ns7:source>"
- + " <ns7:notification-url></ns7:notification-url>"
- + " <ns7:order-number>10205000</ns7:order-number>"
- + " <ns7:order-version>1</ns7:order-version>"
- + " </ns7:request-information>"
- + " <sdncadapterworkflow:WorkflowException>"
- + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
- + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
- + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
- + " </sdncadapterworkflow:WorkflowException>"
- + "</sdncadapterworkflow:FalloutHandlerRequest>";
-
- return xml;
- }
-
+
+ Logger logger = LoggerFactory.getLogger(FalloutHandlerIT.class);
+
+
+ private void setupMocks() {
+ wireMockServer.stubFor(post(urlEqualTo("/dbadapters/AttRequestsDbAdapter")).willReturn(aResponse()
+ .withStatus(200).withHeader("Content-Type", "text/xml").withBody("<DbTag>Notified</DbTag>")));
+ wireMockServer.stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")).willReturn(aResponse().withStatus(200)
+ .withHeader("Content-Type", "text/xml").withBody("<DbTag>Notified</DbTag>")));
+ }
+
+ private String executeFlow(String inputRequestFile) throws InterruptedException {
+
+ Map<String, Object> 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 = ""
+ + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
+ + " <ns7:request-information>" + " <ns7:request-id>1020_STUW105_5002</ns7:request-id>"
+ + " <ns7:request-action>requestAction</ns7:request-action>"
+ + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
+ + " <ns7:source>source</ns7:source>"
+ + " <ns7:notification-url>http://localhost:28090/CCD/StatusNotification</ns7:notification-url>"
+ + " <ns7:order-number>10205000</ns7:order-number>"
+ + " <ns7:order-version>1</ns7:order-version>" + " </ns7:request-information>"
+ + " <sdncadapterworkflow:WorkflowException>"
+ + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
+ + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
+ + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
+ + " </sdncadapterworkflow:WorkflowException>" + "</sdncadapterworkflow:FalloutHandlerRequest>";
+
+ 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 = ""
+ + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
+ + " <ns7:request-information>" + " <ns7:request-id>1020_STUW105_5002</ns7:request-id>"
+ + " <ns7:request-action>requestAction</ns7:request-action>"
+ + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
+ + " <ns7:source>source</ns7:source>" + " <ns7:notification-url></ns7:notification-url>"
+ + " <ns7:order-number>10205000</ns7:order-number>"
+ + " <ns7:order-version>1</ns7:order-version>" + " </ns7:request-information>"
+ + " <sdncadapterworkflow:WorkflowException>"
+ + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
+ + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
+ + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
+ + " </sdncadapterworkflow:WorkflowException>" + "</sdncadapterworkflow:FalloutHandlerRequest>";
+
+ 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 = ""
+ + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
+ + " <ns7:request-information>" + " <ns7:request-id></ns7:request-id>"
+ + " <ns7:request-action>requestAction</ns7:request-action>"
+ + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
+ + " <ns7:source>source</ns7:source>"
+ + " <ns7:notification-url>www.test.com</ns7:notification-url>"
+ + " <ns7:order-number>10205000</ns7:order-number>"
+ + " <ns7:order-version>1</ns7:order-version>" + " </ns7:request-information>"
+ + " <sdncadapterworkflow:WorkflowException>"
+ + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
+ + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
+ + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
+ + " </sdncadapterworkflow:WorkflowException>" + "</sdncadapterworkflow:FalloutHandlerRequest>";
+
+ 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 = ""
+ + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
+ + " <ns7:request-information>" + " <ns7:request-id></ns7:request-id>"
+ + " <ns7:request-action>requestAction</ns7:request-action>"
+ + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
+ + " <ns7:source>source</ns7:source>" + " <ns7:notification-url></ns7:notification-url>"
+ + " <ns7:order-number>10205000</ns7:order-number>"
+ + " <ns7:order-version>1</ns7:order-version>" + " </ns7:request-information>"
+ + " <sdncadapterworkflow:WorkflowException>"
+ + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
+ + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
+ + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
+ + " </sdncadapterworkflow:WorkflowException>" + "</sdncadapterworkflow:FalloutHandlerRequest>";
+
+ 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
index 7299e0602e..ff0b318df9 100644
--- 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
@@ -22,10 +22,8 @@ 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;
@@ -37,42 +35,37 @@ import org.onap.so.BaseIntegrationTest;
*/
public class GenerateVfModuleNameIT extends BaseIntegrationTest {
- private static final String EOL = "\n";
-
- @Test
- public void TestGenerateVfModuleNameSuvvess() {
- //
- String request =
- "<vnf-request xmlns=\"http://ecomp.att.com/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>CREATE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-name>STMTN5MMSC22</vnf-name>" + EOL +
- " <vf-module-name>STMTN5MMSC22-MMSC::module-0-0</vf-module-name>" + EOL +
- " <vf-module-model-name>MMSC::module-0</vf-module-model-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <aic-node-clli>MDTWNJ21</aic-node-clli>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://ecomp.att.com/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
+ private static final String EOL = "\n";
+
+ @Test
+ public void TestGenerateVfModuleNameSuvvess() {
+ //
+ String request =
+ "<vnf-request xmlns=\"http://ecomp.att.com/mso/infra/vnf-request/v1\">" + EOL + " <request-info>" + EOL
+ + " <action>CREATE_VF_MODULE</action>" + EOL + " <source>PORTAL</source>" + EOL
+ + " </request-info>" + EOL + " <vnf-inputs>" + EOL + " <vnf-name>STMTN5MMSC22</vnf-name>"
+ + EOL + " <vf-module-name>STMTN5MMSC22-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <vf-module-model-name>MMSC::module-0</vf-module-model-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL
+ + " <aic-node-clli>MDTWNJ21</aic-node-clli>" + EOL
+ + " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL + " </vnf-inputs>" + EOL
+ + " <vnf-params xmlns:tns=\"http://ecomp.att.com/mso/infra/vnf-request/v1\"/>" + EOL
+ + "</vnf-request>" + EOL;
+
+ MockGetGenericVnfById(wireMockServer, ".*", "GenericFlows/getGenericVnfByNameResponse.xml");
+ RuntimeService runtimeService = processEngine.getRuntimeService();
+ Map<String, Object> variables = new HashMap<String, Object>();
+ 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");
- MockGetGenericVnfById(wireMockServer, ".*", "GenericFlows/getGenericVnfByNameResponse.xml");
- RuntimeService runtimeService = processEngine.getRuntimeService();
- Map<String, Object> variables = new HashMap<String, Object>();
- 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);
- }
+ assertNotNull(response);
+ }
}
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
index 53d29c51bf..97a09d84aa 100644
--- 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
@@ -23,12 +23,10 @@
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;
@@ -42,58 +40,58 @@ import org.slf4j.LoggerFactory;
* Unit test for RainyDayHandler.bpmn.
*/
public class ManualHandlingIT extends BaseIntegrationTest {
- Logger logger = LoggerFactory.getLogger(ManualHandlingIT.class);
-
- @Test
- public void TestManualHandlingSuccess() {
- MockPostRequestDB(wireMockServer);
-
- Map<String, Object> 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<Task> 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<String,Object> 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));
- }
+ Logger logger = LoggerFactory.getLogger(ManualHandlingIT.class);
+
+ @Test
+ public void TestManualHandlingSuccess() {
+ MockPostRequestDB(wireMockServer);
+
+ Map<String, Object> 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<Task> 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<String, Object> 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));
+ }
}
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
index 052fd5dc94..45ef0add2b 100644
--- 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
@@ -23,18 +23,16 @@ 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.urlMatching;
-
import com.github.tomakehurst.wiremock.WireMockServer;
public class MockAAIDeleteGenericVnf {
- public MockAAIDeleteGenericVnf(WireMockServer wireMockServer){
- wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021"))
- .willReturn(aResponse()
- .withStatus(200)));
- wireMockServer.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 MockAAIDeleteGenericVnf(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(delete(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021"))
+ .willReturn(aResponse().withStatus(200)));
+ wireMockServer.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
index 1cbe0b9244..f405fc943b 100644
--- 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
@@ -24,31 +24,30 @@ 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.urlMatching;
-
import com.github.tomakehurst.wiremock.WireMockServer;
public class MockAAIDeleteVfModule {
-
- public MockAAIDeleteVfModule(WireMockServer wireMockServer)
- {
- wireMockServer.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)));
- wireMockServer.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)));
- wireMockServer.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)));
- wireMockServer.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")));
- wireMockServer.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")));
- wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
- .willReturn(aResponse().withStatus(200)));
- }
+ public MockAAIDeleteVfModule(WireMockServer wireMockServer) {
+ wireMockServer.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)));
+ wireMockServer.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)));
+ wireMockServer.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)));
+ wireMockServer.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")));
+ wireMockServer.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")));
+
+ wireMockServer.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
index 1d6337ffc4..a33268efbe 100644
--- 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
@@ -23,319 +23,219 @@ 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.urlMatching;
-
import com.github.tomakehurst.wiremock.WireMockServer;
public class MockAAIGenericVnfSearch {
-
- private static final String EOL = "\n";
- public MockAAIGenericVnfSearch(WireMockServer wireMockServer){
- String body;
-
- // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
-
- wireMockServer.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")));
-
- wireMockServer.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")));
- wireMockServer.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 =
- "<generic-vnf xmlns=\"http://com.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>1508691</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.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)));
- wireMockServer.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 =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>1508691</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.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)));
- wireMockServer.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
-
- wireMockServer.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")));
-
- wireMockServer.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 =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000021</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000073</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.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 =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000020</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000074</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000075</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.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 =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000019</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC19-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000076</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000077</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.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 =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000018</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000078</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.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 =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000021</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000073</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.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)));
-
- }
+ private static final String EOL = "\n";
+
+ public MockAAIGenericVnfSearch(WireMockServer wireMockServer) {
+ String body;
+
+ // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
+
+ wireMockServer.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")));
+
+ wireMockServer.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")));
+ wireMockServer.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 = "<generic-vnf xmlns=\"http://com.aai.inventory/v7\">" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>1508691</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>1508692</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.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)));
+ wireMockServer.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 = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+ + " <vnf-id>2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>1508691</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>1508692</resource-version>" + EOL + " </vf-module>" + EOL
+ + " <vf-module>" + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>"
+ + EOL + " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>false</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>1508692</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.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)));
+ wireMockServer.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
+
+ wireMockServer.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")));
+
+ wireMockServer.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 = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>0000021</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000073</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.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 = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>0000020</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000074</resource-version>" + EOL + " </vf-module>" + EOL
+ + " <vf-module>" + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>"
+ + EOL + " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>false</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000075</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.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 = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>0000019</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC19-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000076</resource-version>" + EOL + " </vf-module>" + EOL
+ + " <vf-module>" + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>"
+ + EOL + " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>false</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000077</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.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 = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>0000018</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000078</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.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 = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>0000021</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000073</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.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
index 6a9ff2a4a8..0154f2eae7 100644
--- 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
@@ -24,12 +24,12 @@ 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");
- }
+ @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
index 4d7a127a85..c128f58103 100644
--- 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
@@ -25,14 +25,12 @@ 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;
@@ -65,12 +63,12 @@ public class OofHomingIT extends BaseIntegrationTest {
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");
+ 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);
@@ -121,133 +119,73 @@ public class OofHomingIT extends BaseIntegrationTest {
VnfResource vnf = new VnfResource();
vnf.setResourceId("testResourceIdVNF");
vnf.setNfFunction("testVnfFunctionName");
- vnf.getHomingSolution().setOofDirectives(
- "{ \n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"vnfc_directives\":[ \n" +
- " { \n" +
- " \"vnfc_id\":\"<ID of VNFC>\",\n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
- " \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
- " \"attribute_value\":\"<value such as direct/normal>\"\n" +
- " },\n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
- " \"attribute_value\":\"<value such as physnet>\"\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"vnf_directives\":{ \n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value>\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value >\"\n" +
- " },\n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value >\"\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"sdnc_directives\":{ \n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"vnfc_directives\":[ \n" +
- " { \n" +
- " \"vnfc_id\":\"<ID of VNFC>\",\n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
- " \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
- " \"attribute_value\":\"<value such as direct/normal>\"\n" +
- " },\n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
- " \"attribute_value\":\"<value such as physnet>\"\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"vnf_directives\":{ \n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value>\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value >\"\n" +
- " },\n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value >\"\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " }\n" +
- " ]\n" +
- " }");
+ vnf.getHomingSolution().setOofDirectives("{ \n" + " \"directives\":[ \n" + " { \n"
+ + " \"vnfc_directives\":[ \n" + " { \n"
+ + " \"vnfc_id\":\"<ID of VNFC>\",\n" + " \"directives\":[ \n"
+ + " { \n"
+ + " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n"
+ + " \"attribute_value\":\"<value such as cloud specific flavor>\"\n"
+ + " }\n" + " ]\n" + " },\n"
+ + " { \n"
+ + " \"directive_name\":\"<Name of directive,example vnic-info>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n"
+ + " \"attribute_value\":\"<value such as direct/normal>\"\n"
+ + " },\n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n"
+ + " \"attribute_value\":\"<value such as physnet>\"\n"
+ + " }\n" + " ]\n" + " }\n"
+ + " ]\n" + " }\n" + " ]\n" + " },\n" + " { \n"
+ + " \"vnf_directives\":{ \n" + " \"directives\":[ \n"
+ + " { \n" + " \"directive_name\":\"<Name of directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value>\"\n" + " }\n"
+ + " ]\n" + " },\n" + " { \n"
+ + " \"directive_name\":\"<Name of directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value >\"\n" + " },\n"
+ + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value >\"\n" + " }\n"
+ + " ]\n" + " }\n" + " ]\n" + " }\n"
+ + " }\n" + " ]\n" + " },\n" + " \"sdnc_directives\":{ \n" + " \"directives\":[ \n"
+ + " { \n" + " \"vnfc_directives\":[ \n" + " { \n"
+ + " \"vnfc_id\":\"<ID of VNFC>\",\n" + " \"directives\":[ \n"
+ + " { \n"
+ + " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n"
+ + " \"attribute_value\":\"<value such as cloud specific flavor>\"\n"
+ + " }\n" + " ]\n" + " },\n"
+ + " { \n"
+ + " \"directive_name\":\"<Name of directive,example vnic-info>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n"
+ + " \"attribute_value\":\"<value such as direct/normal>\"\n"
+ + " },\n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n"
+ + " \"attribute_value\":\"<value such as physnet>\"\n"
+ + " }\n" + " ]\n" + " }\n"
+ + " ]\n" + " }\n" + " ]\n" + " },\n" + " { \n"
+ + " \"vnf_directives\":{ \n" + " \"directives\":[ \n"
+ + " { \n" + " \"directive_name\":\"<Name of directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value>\"\n" + " }\n"
+ + " ]\n" + " },\n" + " { \n"
+ + " \"directive_name\":\"<Name of directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value >\"\n" + " },\n"
+ + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value >\"\n" + " }\n"
+ + " ]\n" + " }\n" + " ]\n" + " }\n"
+ + " }\n" + " ]\n" + " }");
ModelInfo vnfModel = new ModelInfo();
vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
@@ -264,11 +202,12 @@ public class OofHomingIT extends BaseIntegrationTest {
serviceDecomposition.setServiceInstance(si);
// Subscriber
- subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
+ 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
+ @Test
public void testHoming_success_2AR1Vnf() throws Exception {
mockOof(wireMockServer);
@@ -283,11 +222,11 @@ public class OofHomingIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
- "serviceDecomposition");
+ // 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");
@@ -305,22 +244,23 @@ public class OofHomingIT extends BaseIntegrationTest {
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\"",
+ 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\""),
+ 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
+ @Test
public void testHoming_success_2AR1Vnf2Net() throws Exception {
mockOof(wireMockServer);
@@ -335,11 +275,11 @@ public class OofHomingIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
- "serviceDecomposition");
+ // 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");
@@ -367,28 +307,27 @@ public class OofHomingIT extends BaseIntegrationTest {
assertNull(workflowException);
- assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
- resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx",
- "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ 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\""),
+ 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\""),
+ 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);
@@ -402,8 +341,7 @@ public class OofHomingIT extends BaseIntegrationTest {
"/BuildingBlocks/oofCatalogResp.json");
String busKey = UUID.randomUUID().toString();
Map<String, Object> vars = new HashMap<>();
- setVariablesForServiceDecomposition(vars, "testRequestId123",
- "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ setVariablesForServiceDecomposition(vars, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
invokeSubProcess("DecomposeService", busKey, vars);
ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
@@ -438,12 +376,12 @@ public class OofHomingIT extends BaseIntegrationTest {
injectWorkflowMessages(callbacks, "oof3");
waitForProcessEnd(businessKey, 10000);
- //Get Variables
+ // Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
- "serviceDecomposition");
+ 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");
@@ -457,26 +395,26 @@ public class OofHomingIT extends BaseIntegrationTest {
assertNull(workflowException);
- //Verify request
+ // 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","CloudOwner",
- "mtmnj1a",
- "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," +
- " \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
- "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," +
- " \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString);
+ 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",
+ "CloudOwner", "mtmnj1a",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," + " \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," + " \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceVnfHomingString);
}
- @Test
+ @Test
public void testHoming_success_existingLicense() throws Exception {
mockOof(wireMockServer);
@@ -491,9 +429,11 @@ public class OofHomingIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+ // 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");
@@ -511,24 +451,25 @@ public class OofHomingIT extends BaseIntegrationTest {
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\""),
+ 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\""),
+ 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
+ @Test
public void testHoming_error_inputVariable() throws Exception {
String businessKey = UUID.randomUUID().toString();
@@ -539,15 +480,15 @@ public class OofHomingIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
+ // 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());
+ assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required "
+ + "input variable is missing or null,workStep=*]", workflowException.toString());
}
- @Test
+ @Test
public void testHoming_error_badResponse() throws Exception {
mockOof_500(wireMockServer);
@@ -559,14 +500,16 @@ public class OofHomingIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- assertEquals("WorkflowException[processKey=Homing,errorCode=401,errorMessage=Internal Error - BasicAuth value null,workStep=*]", workflowException.toString());
+ assertEquals(
+ "WorkflowException[processKey=Homing,errorCode=401,errorMessage=Internal Error - BasicAuth value null,workStep=*]",
+ workflowException.toString());
}
- @Test
+ @Test
public void testHoming_error_oofNoSolution() throws Exception {
mockOof(wireMockServer);
@@ -580,15 +523,16 @@ public class OofHomingIT extends BaseIntegrationTest {
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);
+ // 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
+ @Test
public void testHoming_error_oofPolicyException() throws Exception {
mockOof(wireMockServer);
@@ -602,16 +546,16 @@ public class OofHomingIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
+ // 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());
+ 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
+ @Test
public void testHoming_error_oofServiceException() throws Exception {
mockOof(wireMockServer);
@@ -623,14 +567,15 @@ public class OofHomingIT extends BaseIntegrationTest {
injectWorkflowMessages(callbacks, "oofServiceEx");
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
+ // 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]",
+ 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());
}
@@ -649,7 +594,7 @@ public class OofHomingIT extends BaseIntegrationTest {
variables.put("cloudRegionId", "TNZED");
variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR");
variables.put("vgMuxInfraModelId", "testArModelUuid");
- // variables.put("mso-request-id", "testRequestId");
+ // variables.put("mso-request-id", "testRequestId");
variables.put("msoRequestId", "testRequestId");
variables.put("serviceInstanceId", "testServiceInstanceId123");
variables.put("serviceInstanceName", "testServiceName");
@@ -716,7 +661,7 @@ public class OofHomingIT extends BaseIntegrationTest {
variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR");
variables.put("vgMuxInfraModelId", "testArModelUuid");
variables.put("isDebugLogEnabled", "true");
- // variables.put("mso-request-id", "testRequestId");
+ // variables.put("mso-request-id", "testRequestId");
variables.put("msoRequestId", "testRequestId");
variables.put("serviceInstanceId", "testServiceInstanceId123");
variables.put("serviceInstanceName", "testServiceName");
@@ -727,11 +672,15 @@ public class OofHomingIT extends BaseIntegrationTest {
private void setVariablesExistingLicense(Map<String, Object> 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()
+ .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");
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+ .addLicenseKeyGroup("testLicenseKeyGroupId1");
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+ .addLicenseKeyGroup("testLicenseKeyGroupId2");
variables.put("isDebugLogEnabled", "true");
variables.put("msoRequestId", "testRequestId");
@@ -742,56 +691,52 @@ public class OofHomingIT extends BaseIntegrationTest {
}
private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname,
- String vnfResourceId, String cloudOwner,
- String cloudRegionId, String enList,
- String licenseList){
+ 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 } }";
+ 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){
+ 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 } }";
+ 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 } }";
+ 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 } }";
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+ + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"license\" : { \"entitlementPoolList\" : [ "
+ + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
}
return solution;
}
@@ -814,68 +759,67 @@ public class OofHomingIT extends BaseIntegrationTest {
variables.put("cloudRegionId", "TNZED");
- String serviceModelInfo = "{\"modelInvariantId\":\"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\",\"modelUuid\":" +
- "\"2f7f309d-c842-4644-a2e4-34167be5eeb4\",\"modelName\":\"vCPE Service\",\"modelVersion\":\"2.0\",}";
+ 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\":\"" +
- "\"}}}";
+ 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}\"}}";
+ 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
index 390f5294aa..39a8995607 100644
--- 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
@@ -38,14 +38,12 @@ import org.onap.so.bpmn.core.domain.VnfResource;
import org.onap.so.bpmn.mock.FileUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
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;
@@ -59,7 +57,7 @@ import static org.onap.so.bpmn.mock.StubResponseOof.mockOof_500;
@Ignore
public class OofHomingTestIT extends BaseIntegrationTest {
- Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
+ Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
String subscriber = "";
@@ -72,12 +70,11 @@ public class OofHomingTestIT extends BaseIntegrationTest {
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");
+ 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);
@@ -128,133 +125,73 @@ public class OofHomingTestIT extends BaseIntegrationTest {
VnfResource vnf = new VnfResource();
vnf.setResourceId("testResourceIdVNF");
vnf.setResourceInstanceName("testVnfInstanceName");
- vnf.getHomingSolution().setOofDirectives(
- "{ \n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"vnfc_directives\":[ \n" +
- " { \n" +
- " \"vnfc_id\":\"<ID of VNFC>\",\n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
- " \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
- " \"attribute_value\":\"<value such as direct/normal>\"\n" +
- " },\n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
- " \"attribute_value\":\"<value such as physnet>\"\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"vnf_directives\":{ \n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value>\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value >\"\n" +
- " },\n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value >\"\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"sdnc_directives\":{ \n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"vnfc_directives\":[ \n" +
- " { \n" +
- " \"vnfc_id\":\"<ID of VNFC>\",\n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
- " \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
- " \"attribute_value\":\"<value such as direct/normal>\"\n" +
- " },\n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
- " \"attribute_value\":\"<value such as physnet>\"\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"vnf_directives\":{ \n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value>\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value >\"\n" +
- " },\n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value >\"\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " }\n" +
- " ]\n" +
- " }");
+ vnf.getHomingSolution().setOofDirectives("{ \n" + " \"directives\":[ \n" + " { \n"
+ + " \"vnfc_directives\":[ \n" + " { \n"
+ + " \"vnfc_id\":\"<ID of VNFC>\",\n" + " \"directives\":[ \n"
+ + " { \n"
+ + " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n"
+ + " \"attribute_value\":\"<value such as cloud specific flavor>\"\n"
+ + " }\n" + " ]\n" + " },\n"
+ + " { \n"
+ + " \"directive_name\":\"<Name of directive,example vnic-info>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n"
+ + " \"attribute_value\":\"<value such as direct/normal>\"\n"
+ + " },\n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n"
+ + " \"attribute_value\":\"<value such as physnet>\"\n"
+ + " }\n" + " ]\n" + " }\n"
+ + " ]\n" + " }\n" + " ]\n" + " },\n" + " { \n"
+ + " \"vnf_directives\":{ \n" + " \"directives\":[ \n"
+ + " { \n" + " \"directive_name\":\"<Name of directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value>\"\n" + " }\n"
+ + " ]\n" + " },\n" + " { \n"
+ + " \"directive_name\":\"<Name of directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value >\"\n" + " },\n"
+ + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value >\"\n" + " }\n"
+ + " ]\n" + " }\n" + " ]\n" + " }\n"
+ + " }\n" + " ]\n" + " },\n" + " \"sdnc_directives\":{ \n" + " \"directives\":[ \n"
+ + " { \n" + " \"vnfc_directives\":[ \n" + " { \n"
+ + " \"vnfc_id\":\"<ID of VNFC>\",\n" + " \"directives\":[ \n"
+ + " { \n"
+ + " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n"
+ + " \"attribute_value\":\"<value such as cloud specific flavor>\"\n"
+ + " }\n" + " ]\n" + " },\n"
+ + " { \n"
+ + " \"directive_name\":\"<Name of directive,example vnic-info>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n"
+ + " \"attribute_value\":\"<value such as direct/normal>\"\n"
+ + " },\n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n"
+ + " \"attribute_value\":\"<value such as physnet>\"\n"
+ + " }\n" + " ]\n" + " }\n"
+ + " ]\n" + " }\n" + " ]\n" + " },\n" + " { \n"
+ + " \"vnf_directives\":{ \n" + " \"directives\":[ \n"
+ + " { \n" + " \"directive_name\":\"<Name of directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value>\"\n" + " }\n"
+ + " ]\n" + " },\n" + " { \n"
+ + " \"directive_name\":\"<Name of directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value >\"\n" + " },\n"
+ + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value >\"\n" + " }\n"
+ + " ]\n" + " }\n" + " ]\n" + " }\n"
+ + " }\n" + " ]\n" + " }");
ModelInfo vnfModel = new ModelInfo();
vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
@@ -271,7 +208,8 @@ public class OofHomingTestIT extends BaseIntegrationTest {
serviceDecomposition.setServiceInstance(si);
// Subscriber
- subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
+ 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\"}";
}
@@ -285,17 +223,17 @@ public class OofHomingTestIT extends BaseIntegrationTest {
Map<String, Object> variables = new HashMap<>();
setVariables(variables);
- invokeSubProcess("Homing", businessKey, 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");
+ // 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");
@@ -313,17 +251,18 @@ public class OofHomingTestIT extends BaseIntegrationTest {
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\"",
+ 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\""),
+ 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);
}
@@ -338,17 +277,17 @@ public class OofHomingTestIT extends BaseIntegrationTest {
Map<String, Object> variables = new HashMap<>();
setVariables2(variables);
- invokeSubProcess("Homing", businessKey, 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");
+ // 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");
@@ -376,28 +315,27 @@ public class OofHomingTestIT extends BaseIntegrationTest {
assertNull(workflowException);
- assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
- resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx",
- "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ 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\""),
+ 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\""),
+ 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);
@@ -413,12 +351,10 @@ public class OofHomingTestIT extends BaseIntegrationTest {
"/BuildingBlocks/oofCatalogResp.json");
String busKey = UUID.randomUUID().toString();
Map<String, Object> vars = new HashMap<>();
- setVariablesForServiceDecomposition(vars, "testRequestId123",
- "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ setVariablesForServiceDecomposition(vars, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
invokeSubProcess("DecomposeService", busKey, vars);
- ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey,
- "serviceDecomposition");
+ ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
logger.debug("In testHoming_success_vnfResourceList, ServiceDecomposition = {}", sd);
List<VnfResource> vnfResourceList = sd.getVnfResources();
vnfResourceList.get(0).setResourceId("test-resource-id-000");
@@ -450,12 +386,12 @@ public class OofHomingTestIT extends BaseIntegrationTest {
injectWorkflowMessages(callbacks, "oof3");
waitForProcessEnd(businessKey, 10000);
- //Get Variables
+ // Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
- "serviceDecomposition");
+ 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");
@@ -469,21 +405,20 @@ public class OofHomingTestIT extends BaseIntegrationTest {
assertNull(workflowException);
- //Verify request
+ // 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", ""));
-
- assertEquals(homingSolutionService("service", "service-instance-01234",
- "MDTNJ01", "test-resource-id-000","CloudOwner",
- "mtmnj1a",
- "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," +
- " \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
- "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," +
- " \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString);
+ assertEquals(
+ FileUtil.readResourceFile("__files/BuildingBlocks/oofRequest_infravnf").replaceAll("\n", "")
+ .replaceAll("\r", "").replaceAll("\t", ""),
+ oofRequest.replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""));
+
+ assertEquals(
+ homingSolutionService("service", "service-instance-01234", "MDTNJ01", "test-resource-id-000",
+ "CloudOwner", "mtmnj1a",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," + " \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," + " \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceVnfHomingString);
}
@Test
@@ -501,9 +436,11 @@ public class OofHomingTestIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+ // 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");
@@ -521,18 +458,19 @@ public class OofHomingTestIT extends BaseIntegrationTest {
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\""),
+ 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\""),
+ 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);
@@ -549,12 +487,12 @@ public class OofHomingTestIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
+ // 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());
+ assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required "
+ + "input variable is missing or null]", workflowException.toString());
}
@Test
@@ -570,12 +508,12 @@ public class OofHomingTestIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
+ // 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());
+ assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a "
+ + "Bad Sync Response from Sniro/OOF.]", workflowException.toString());
}
@Test
@@ -593,12 +531,12 @@ public class OofHomingTestIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
+ // 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());
+ assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found "
+ + "for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]", workflowException.toString());
}
@Test
@@ -616,13 +554,13 @@ public class OofHomingTestIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
+ // 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());
+ 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
@@ -640,14 +578,15 @@ public class OofHomingTestIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
+ // 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]",
+ 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());
}
@@ -665,7 +604,7 @@ public class OofHomingTestIT extends BaseIntegrationTest {
variables.put("cloudOwner", "amazon");
variables.put("cloudRegionId", "TNZED");
variables.put("isDebugLogEnabled", "true");
- // variables.put("mso-request-id", "testRequestId");
+ // variables.put("mso-request-id", "testRequestId");
variables.put("msoRequestId", "testRequestId");
variables.put("serviceInstanceId", "testServiceInstanceId");
variables.put("serviceDecomposition", serviceDecomposition);
@@ -726,7 +665,7 @@ public class OofHomingTestIT extends BaseIntegrationTest {
variables.put("cloudOwner", "amazon");
variables.put("cloudRegionId", "TNZED");
variables.put("isDebugLogEnabled", "true");
- // variables.put("mso-request-id", "testRequestId");
+ // variables.put("mso-request-id", "testRequestId");
variables.put("msoRequestId", "testRequestId");
variables.put("serviceInstanceId", "testServiceInstanceId");
variables.put("serviceDecomposition", null);
@@ -736,11 +675,15 @@ public class OofHomingTestIT extends BaseIntegrationTest {
private void setVariablesExistingLicense(Map<String, Object> 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()
+ .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");
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+ .addLicenseKeyGroup("testLicenseKeyGroupId1");
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+ .addLicenseKeyGroup("testLicenseKeyGroupId2");
variables.put("isDebugLogEnabled", "true");
variables.put("msoRequestId", "testRequestId");
@@ -751,56 +694,52 @@ public class OofHomingTestIT extends BaseIntegrationTest {
}
private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname,
- String vnfResourceId, String cloudOwner,
- String cloudRegionId, String enList,
- String licenseList){
+ 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 } }";
+ 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){
+ 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 } }";
+ 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 } }";
+ 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 } }";
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+ + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"license\" : { \"entitlementPoolList\" : [ "
+ + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
}
return solution;
}
@@ -823,68 +762,68 @@ public class OofHomingTestIT extends BaseIntegrationTest {
variables.put("cloudRegionId", "TNZED");
- String serviceModelInfo = "{\"modelInvariantId\":\"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\",\"modelUuid\":" +
- "\"2f7f309d-c842-4644-a2e4-34167be5eeb4\",\"modelName\":\"vCPE Service\",\"modelVersion\":\"2.0\",}";
+ 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\":\"\"}}]}}";
+ 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}\"}}";
+ 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
index c994173cd7..ace5fdd15b 100644
--- 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
@@ -18,7 +18,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
@@ -27,12 +27,10 @@ import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDep
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.Test;
@@ -47,164 +45,176 @@ import org.slf4j.LoggerFactory;
*/
public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest {
-
- Logger logger = LoggerFactory.getLogger(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(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
- MockPutGenericVnf(wireMockServer, "/skask/vf-modules/vf-module/supercool", "PCRF", 200);
- MockPatchVfModuleId(wireMockServer, "skask", "supercool");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, "skask[?]depth=1");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
- MockAAIVfModuleBadPatch(wireMockServer, "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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();
- }
+
+ Logger logger = LoggerFactory.getLogger(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(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutGenericVnf(wireMockServer, "/skask/vf-modules/vf-module/supercool", "PCRF", 200);
+ MockPatchVfModuleId(wireMockServer, "skask", "supercool");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, "skask[?]depth=1");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+ MockAAIVfModuleBadPatch(wireMockServer,
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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
index 2f6d2ae85b..d669674297 100644
--- 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
@@ -16,16 +16,14 @@
* 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;
@@ -35,35 +33,35 @@ import org.onap.so.BaseIntegrationTest;
*/
public class RainyDayHandlerIT extends BaseIntegrationTest {
-
- @Test
-
- public void TestRainyDayHandlingSuccess() {
-
- Map<String, Object> 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(wireMockServer);
-
-
- String businessKey = UUID.randomUUID().toString();
- invokeSubProcess("RainyDayHandler", businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
-
- }
-
-
-
-} \ No newline at end of file
+
+ @Test
+
+ public void TestRainyDayHandlingSuccess() {
+
+ Map<String, Object> 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(wireMockServer);
+
+
+ String businessKey = UUID.randomUUID().toString();
+ invokeSubProcess("RainyDayHandler", businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+
+ }
+
+
+
+}
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
index 7f3e884601..d8e3264091 100644
--- 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
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
+
package org.onap.so.bpmn.common;
import static org.junit.Assert.assertEquals;
@@ -25,12 +25,10 @@ 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;
@@ -44,102 +42,85 @@ import org.onap.so.bpmn.core.WorkflowException;
@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<String, Object> 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<String, Object> 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();
- }
+ 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<String, Object> 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<String, Object> 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
index dc5c36f5a7..36adccd758 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -29,56 +28,54 @@ 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:
+ * A JUnit rule that starts the SDNC Adapter Callback Service before every test, and tears it down after every test.
+ * Example:
+ *
* <pre>
- * @Rule
- * public final SDNCAdapterCallbackRule sdncAdapterCallbackRule =
- * new SDNCAdapterCallbackRule(processEngineRule);
+ * &#64;Rule
+ * public final SDNCAdapterCallbackRule sdncAdapterCallbackRule = new SDNCAdapterCallbackRule(processEngineRule);
* </pre>
*/
public class SDNCAdapterCallbackRule implements TestRule {
- public static final String DEFAULT_ENDPOINT_URL =
- "http://localhost:28080/mso/SDNCAdapterCallbackService";
+ public static final String DEFAULT_ENDPOINT_URL = "http://localhost:28080/mso/SDNCAdapterCallbackService";
- private final ProcessEngineServices processEngineServices;
- private final String endpointUrl;
+ private final ProcessEngineServices processEngineServices;
+ private final String endpointUrl;
- public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices) {
- this(processEngineServices, DEFAULT_ENDPOINT_URL);
- }
+ public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices) {
+ this(processEngineServices, DEFAULT_ENDPOINT_URL);
+ }
- public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices,
- String endpointUrl) {
- this.processEngineServices = processEngineServices;
- this.endpointUrl = endpointUrl;
- }
+ 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;
+ @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);
+ 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.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);
+ 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
+ baseStmt.evaluate();
+ } finally {
+ if (endpoint != null) {
+ System.out.println("Stopping Endpoint - " + endpointUrl);
+ endpoint.stop();
+ }
+ }
+ }
+ };
+ }
+}
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
index bf3fefdf9c..415e8096a3 100644
--- 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
@@ -25,12 +25,10 @@ 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.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;
@@ -42,81 +40,78 @@ import org.slf4j.LoggerFactory;
/**
* Unit tests for SDNCAdapterRestV2.bpmn.
*
- * This version of SDNCAdapterRest allows for interim notifications to be sent for
- * any non-final response received from SDNC.
+ * 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();
-
- Logger logger = LoggerFactory.getLogger(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<String, Object> variables = new HashMap<String, Object>();
- 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() {
- wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")));
- }
+ private final CallbackSet callbacks = new CallbackSet();
+
+ Logger logger = LoggerFactory.getLogger(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<String, Object> variables = new HashMap<String, Object>();
+ 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() {
+ wireMockServer.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
index 9239889f28..96ea1cad9b 100644
--- 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
@@ -22,10 +22,8 @@ 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;
@@ -36,34 +34,37 @@ 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);
- }
-
+ @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
index c7ba702212..6b253d2b4d 100644
--- 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
@@ -25,14 +25,12 @@ 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;
@@ -49,504 +47,588 @@ import org.slf4j.LoggerFactory;
*/
@Ignore
public class SniroHomingV1IT extends BaseIntegrationTest {
-
- Logger logger = LoggerFactory.getLogger(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<AllottedResource> arList = new ArrayList<AllottedResource>();
- 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<VnfResource> vnfList = new ArrayList<VnfResource>();
- 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(wireMockServer);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, "2f7f309d-c842-4644-a2e4-34167be5eeb4", "/BuildingBlocks/catalogResp.json");
- String busKey = UUID.randomUUID().toString();
- Map<String, Object> vars = new HashMap<>();
- setVariablesForServiceDecomposition(vars, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
- invokeSubProcess("DecomposeService", busKey, vars);
-
- ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
- List<VnfResource> vnfResourceList = sd.getVnfResources();
- vnfResourceList.get(0).setResourceId("test-resource-id-000");
-
- // Invoke Homing
-
- mockSNIRO(wireMockServer);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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", "CloudOwner", "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(wireMockServer);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<String, Object>();
- setVariablesExistingLicense(variables);
-
- invokeSubProcess("Homing", businessKey, variables);
- injectWorkflowMessages(callbacks, "sniro");
+ Logger logger = LoggerFactory.getLogger(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<AllottedResource> arList = new ArrayList<AllottedResource>();
+ 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<VnfResource> vnfList = new ArrayList<VnfResource>();
+ 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(wireMockServer);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, "2f7f309d-c842-4644-a2e4-34167be5eeb4",
+ "/BuildingBlocks/catalogResp.json");
+ String busKey = UUID.randomUUID().toString();
+ Map<String, Object> vars = new HashMap<>();
+ setVariablesForServiceDecomposition(vars, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ invokeSubProcess("DecomposeService", busKey, vars);
+
+ ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
+ List<VnfResource> vnfResourceList = sd.getVnfResources();
+ vnfResourceList.get(0).setResourceId("test-resource-id-000");
+
+ // Invoke Homing
+
+ mockSNIRO(wireMockServer);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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", "CloudOwner", "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(wireMockServer);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<String, Object>();
+ 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");
- waitForProcessEnd(businessKey, 10000);
+ 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+", "");
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
- String sniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+ 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);
- 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 {
- @Test
-
- public void testHoming_error_inputVariable() throws Exception {
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables3(variables);
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables3(variables);
+ invokeSubProcess("Homing", businessKey, variables);
- invokeSubProcess("Homing", businessKey, variables);
+ waitForProcessEnd(businessKey, 10000);
- waitForProcessEnd(businessKey, 10000);
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- //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());
+ }
- assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required input variable is missing or null]", workflowException.toString());
- }
+ @Test
- @Test
-
- public void testHoming_error_badResponse() throws Exception {
- mockSNIRO_500(wireMockServer);
+ public void testHoming_error_badResponse() throws Exception {
+ mockSNIRO_500(wireMockServer);
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
- invokeSubProcess("Homing", businessKey, variables);
+ invokeSubProcess("Homing", businessKey, variables);
- waitForProcessEnd(businessKey, 10000);
+ waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ // 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());
- }
+ 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(wireMockServer);
+ @Test
+ // 1802 merge
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
+ public void testHoming_error_sniroNoSolution() throws Exception {
+ mockSNIRO(wireMockServer);
- invokeSubProcess("Homing", businessKey, variables);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
- injectWorkflowMessages(callbacks, "sniroNoSol");
+ invokeSubProcess("Homing", businessKey, variables);
- waitForProcessEnd(businessKey, 10000);
+ injectWorkflowMessages(callbacks, "sniroNoSol");
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ waitForProcessEnd(businessKey, 10000);
- assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]", workflowException.toString());
- }
+ // 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(wireMockServer);
+ @Test
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
+ public void testHoming_error_sniroPolicyException() throws Exception {
+ mockSNIRO(wireMockServer);
- invokeSubProcess("Homing", businessKey, variables);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
- injectWorkflowMessages(callbacks, "sniroPolicyEx");
+ invokeSubProcess("Homing", businessKey, variables);
- waitForProcessEnd(businessKey, 10000);
+ injectWorkflowMessages(callbacks, "sniroPolicyEx");
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ waitForProcessEnd(businessKey, 10000);
- 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(wireMockServer);
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
+ 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());
+ }
- invokeSubProcess("Homing", businessKey, variables);
+ @Test
- injectWorkflowMessages(callbacks, "sniroServiceEx");
+ public void testHoming_error_sniroServiceException() throws Exception {
+ mockSNIRO(wireMockServer);
- waitForProcessEnd(businessKey, 10000);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
- //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<String, Object> 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<String, Object> variables) {
- List<NetworkResource> netList = new ArrayList<NetworkResource>();
- 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<String, Object> 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<String, Object> 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<String, Object> 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;
- }
+ 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<String, Object> 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<String, Object> variables) {
+ List<NetworkResource> netList = new ArrayList<NetworkResource>();
+ 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<String, Object> 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<String, Object> 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<String, Object> 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
index 5015a1351a..fc991bd50e 100644
--- 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
@@ -18,7 +18,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
@@ -28,12 +28,10 @@ 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;
@@ -49,129 +47,134 @@ import org.slf4j.LoggerFactory;
*/
public class UpdateAAIGenericVnfIT extends BaseIntegrationTest {
-
- Logger logger = LoggerFactory.getLogger(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(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
- MockPutGenericVnf(wireMockServer, "/skask", 200);
- MockPatchGenericVnf(wireMockServer, "skask");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, "skask[?]depth=1");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
- MockPutGenericVnf_Bad(wireMockServer, "skask", 404);
- MockAAIVfModuleBadPatch(wireMockServer, "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask", 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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();
- }
+
+ Logger logger = LoggerFactory.getLogger(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(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutGenericVnf(wireMockServer, "/skask", 200);
+ MockPatchGenericVnf(wireMockServer, "skask");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, "skask[?]depth=1");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutGenericVnf_Bad(wireMockServer, "skask", 404);
+ MockAAIVfModuleBadPatch(wireMockServer, "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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
index 0a3931a12f..ebf8799121 100644
--- 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
@@ -18,7 +18,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
@@ -28,12 +28,10 @@ import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPri
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;
@@ -48,98 +46,105 @@ import org.slf4j.LoggerFactory;
*/
public class UpdateAAIVfModuleIT extends BaseIntegrationTest {
-
- Logger logger = LoggerFactory.getLogger(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(wireMockServer, "/skask/vf-modules/vf-module/supercool", 200, "VfModularity/VfModule-supercool.xml");
- MockPutGenericVnf(wireMockServer, "/skask/vf-modules/vf-module/supercool", "PCRF", 200);
- MockPatchVfModuleId(wireMockServer, "skask", "supercool");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, "/skask/vf-modules/vf-module/.*", "VfModularity/VfModule-supercool.xml", 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, "/skask/vf-modules/vf-module/supercool");
- MockGetGenericVnfById(wireMockServer, "/skask/vf-modules/vf-module/supercool", "VfModularity/VfModule-supercool.xml", 200);
- MockAAIVfModuleBadPatch(wireMockServer, "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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();
- }
+
+ Logger logger = LoggerFactory.getLogger(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(wireMockServer, "/skask/vf-modules/vf-module/supercool", 200,
+ "VfModularity/VfModule-supercool.xml");
+ MockPutGenericVnf(wireMockServer, "/skask/vf-modules/vf-module/supercool", "PCRF", 200);
+ MockPatchVfModuleId(wireMockServer, "skask", "supercool");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, "/skask/vf-modules/vf-module/.*", "VfModularity/VfModule-supercool.xml",
+ 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, "/skask/vf-modules/vf-module/supercool");
+ MockGetGenericVnfById(wireMockServer, "/skask/vf-modules/vf-module/supercool",
+ "VfModularity/VfModule-supercool.xml", 200);
+ MockAAIVfModuleBadPatch(wireMockServer,
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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
index c0482a52ca..0cefdca9ca 100644
--- 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
@@ -18,7 +18,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
@@ -29,12 +29,10 @@ 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;
@@ -48,347 +46,261 @@ import org.slf4j.LoggerFactory;
*/
public class VnfAdapterRestV1IT extends BaseIntegrationTest {
-
- Logger logger = LoggerFactory.getLogger(VnfAdapterRestV1IT.class);
-
-
- private static final String EOL = "\n";
-
- private final CallbackSet callbacks = new CallbackSet();
-
- private final String CREATE_VF_MODULE_REQUEST =
- "<createVfModuleRequest>" + EOL +
- " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
- " <cloudOwner>cloudOwner</cloudOwner>" + EOL +
- " <tenantId>tenantId</tenantId>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleName>vfModuleName</vfModuleName>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vnfType>vnfType</vnfType>" + EOL +
- " <vnfVersion>vnfVersion</vnfVersion>" + EOL +
- " <vfModuleType>vfModuleType</vfModuleType>" + EOL +
- " <volumeGroupId>volumeGroupId</volumeGroupId>" + EOL +
- " <volumeGroupStackId>volumeGroupStackId</volumeGroupStackId>" + EOL +
- " <baseVfModuleId>baseVfModuleId</baseVfModuleId>" + EOL +
- " <baseVfModuleStackId>baseVfModuleStackId</baseVfModuleStackId>" + EOL +
- " <skipAAI>true</skipAAI>" + EOL +
- " <backout>false</backout>" + EOL +
- " <failIfExists>true</failIfExists>" + EOL +
- " <vfModuleParams>" + EOL +
- " <entry>" + EOL +
- " <key>key1</key>" + EOL +
- " <value>value1</value>" + EOL +
- " </entry>" + EOL +
- " <entry>" + EOL +
- " <key>key2</key>" + EOL +
- " <value>value2</value>" + EOL +
- " </entry>" + EOL +
- " </vfModuleParams>" + EOL +
- " <msoRequest>" + EOL +
- " <requestId>requestId</requestId>" + EOL +
- " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
- " </msoRequest>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
- "</createVfModuleRequest>" + EOL;
-
- private final String UPDATE_VF_MODULE_REQUEST =
- "<updateVfModuleRequest>" + EOL +
- " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
- " <cloudOwner>cloudOwner</cloudOwner>" + EOL +
- " <tenantId>tenantId</tenantId>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleName>vfModuleName</vfModuleName>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
- " <vnfType>vnfType</vnfType>" + EOL +
- " <vnfVersion>vnfVersion</vnfVersion>" + EOL +
- " <vfModuleType>vfModuleType</vfModuleType>" + EOL +
- " <volumeGroupId>volumeGroupId</volumeGroupId>" + EOL +
- " <volumeGroupStackId>volumeGroupStackId</volumeGroupStackId>" + EOL +
- " <baseVfModuleId>baseVfModuleId</baseVfModuleId>" + EOL +
- " <baseVfModuleStackId>baseVfModuleStackId</baseVfModuleStackId>" + EOL +
- " <skipAAI>true</skipAAI>" + EOL +
- " <backout>false</backout>" + EOL +
- " <failIfExists>true</failIfExists>" + EOL +
- " <vfModuleParams>" + EOL +
- " <entry>" + EOL +
- " <key>key1</key>" + EOL +
- " <value>value1</value>" + EOL +
- " </entry>" + EOL +
- " <entry>" + EOL +
- " <key>key2</key>" + EOL +
- " <value>value2</value>" + EOL +
- " </entry>" + EOL +
- " </vfModuleParams>" + EOL +
- " <msoRequest>" + EOL +
- " <requestId>requestId</requestId>" + EOL +
- " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
- " </msoRequest>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
- "</updateVfModuleRequest>" + EOL;
-
- private final String DELETE_VF_MODULE_REQUEST =
- "<deleteVfModuleRequest>" + EOL +
- " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
- " <cloudOwner>cloudOwner</cloudOwner>" + EOL +
- " <tenantId>tenantId</tenantId>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
- " <skipAAI>true</skipAAI>" + EOL +
- " <msoRequest>" + EOL +
- " <requestId>requestId</requestId>" + EOL +
- " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
- " </msoRequest>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
- "</deleteVfModuleRequest>" + EOL;
-
- private final String ROLLBACK_VF_MODULE_REQUEST =
- "<rollbackVfModuleRequest>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
- " <skipAAI>true</skipAAI>" + EOL +
- " <vfModuleRollback>" + EOL +
- " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
- " <cloudOwner>cloudOwner</cloudOwner>" + EOL +
- " <tenantId>tenantId</tenantId>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
- " <msoRequest>" + EOL +
- " <requestId>requestId</requestId>" + EOL +
- " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
- " </msoRequest>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- " <vfModuleCreated>true</vfModuleCreated>" + EOL +
- " </vfModuleRollback>" + EOL +
- "</rollbackVfModuleRequest>" + EOL;
-
- public VnfAdapterRestV1IT() throws IOException {
- callbacks.put("createVfModule",
- "<createVfModuleResponse>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
- " <vfModuleCreated>true</vfModuleCreated>" + EOL +
- " <vfModuleOutputs>" + EOL +
- " <entry>" + EOL +
- " <key>key1</key>" + EOL +
- " <value>value1</value>" + EOL +
- " </entry>" + EOL +
- " <entry>" + EOL +
- " <key>key2</key>" + EOL +
- " <value>value2</value>" + EOL +
- " </entry>" + EOL +
- " </vfModuleOutputs>" + EOL +
- " <rollback>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
- " <vfModuleCreated>true</vfModuleCreated>" + EOL +
- " <tenantId>tenantId</tenantId>" + EOL +
- " <cloudOwner>cloudOwner</cloudOwner>" + EOL +
- " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
- " <msoRequest>" + EOL +
- " <requestId>requestId</requestId>" + EOL +
- " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
- " </msoRequest>" + EOL +
- " <messageId>messageId</messageId>" + EOL +
- " </rollback>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</createVfModuleResponse>" + EOL);
-
- callbacks.put("updateVfModule",
- "<updateVfModuleResponse>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
- " <vfModuleOutputs>" + EOL +
- " <entry>" + EOL +
- " <key>key1</key>" + EOL +
- " <value>value1</value>" + EOL +
- " </entry>" + EOL +
- " <entry>" + EOL +
- " <key>key2</key>" + EOL +
- " <value>value2</value>" + EOL +
- " </entry>" + EOL +
- " </vfModuleOutputs>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</updateVfModuleResponse>" + EOL);
-
- callbacks.put("deleteVfModule",
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL);
-
- callbacks.put("rollbackVfModule",
- "<rollbackVfModuleResponse>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- " <vfModuleRolledback>true</vfModuleRolledback>" + EOL +
- "</rollbackVfModuleResponse>" + EOL);
-
- callbacks.put("vfModuleException",
- "<vfModuleException>" + EOL +
- " <message>message</message>" + EOL +
- " <category>category</category>" + EOL +
- " <rolledBack>false</rolledBack>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</vfModuleException>" + EOL);
- }
-
- @Test
-
- public void testCreateVfModuleSuccess() throws Exception {
- logStart();
-
- mockVNFPost(wireMockServer, "", 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<String, Object> 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("<createVfModuleResponse>"));
- assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
-
- logEnd();
- }
-
- @Test
-
- public void testUpdateVfModuleSuccess() throws Exception {
- logStart();
-
- mockVNFPut(wireMockServer, "/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<String, Object> 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("<updateVfModuleResponse>"));
- assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
-
- logEnd();
- }
-
- @Test
-
- public void testDeleteVfModuleSuccess() throws Exception {
- logStart();
-
- mockVNFDelete(wireMockServer, "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<String, Object> 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("<deleteVfModuleResponse>"));
- assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
-
- logEnd();
- }
-
- @Test
-
- public void testRollbackVfModuleSuccess() throws Exception {
- logStart();
-
- mockVNFRollbackDelete(wireMockServer, "/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<String, Object> 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("<rollbackVfModuleResponse>"));
- assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
-
- logEnd();
- }
-
- @Test
-
- public void testCreateVfModuleException() throws Exception {
- logStart();
-
- mockVNFPost(wireMockServer, "", 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<String, Object> 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("<vfModuleException>"));
- assertFalse((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
- logEnd();
- }
+ Logger logger = LoggerFactory.getLogger(VnfAdapterRestV1IT.class);
+
+
+ private static final String EOL = "\n";
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ private final String CREATE_VF_MODULE_REQUEST = "<createVfModuleRequest>" + EOL
+ + " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + " <cloudOwner>cloudOwner</cloudOwner>" + EOL
+ + " <tenantId>tenantId</tenantId>" + EOL + " <vnfId>vnfId</vnfId>" + EOL
+ + " <vfModuleName>vfModuleName</vfModuleName>" + EOL + " <vfModuleId>vfModuleId</vfModuleId>" + EOL
+ + " <vnfType>vnfType</vnfType>" + EOL + " <vnfVersion>vnfVersion</vnfVersion>" + EOL
+ + " <vfModuleType>vfModuleType</vfModuleType>" + EOL + " <volumeGroupId>volumeGroupId</volumeGroupId>"
+ + EOL + " <volumeGroupStackId>volumeGroupStackId</volumeGroupStackId>" + EOL
+ + " <baseVfModuleId>baseVfModuleId</baseVfModuleId>" + EOL
+ + " <baseVfModuleStackId>baseVfModuleStackId</baseVfModuleStackId>" + EOL + " <skipAAI>true</skipAAI>"
+ + EOL + " <backout>false</backout>" + EOL + " <failIfExists>true</failIfExists>" + EOL
+ + " <vfModuleParams>" + EOL + " <entry>" + EOL + " <key>key1</key>" + EOL
+ + " <value>value1</value>" + EOL + " </entry>" + EOL + " <entry>" + EOL + " <key>key2</key>"
+ + EOL + " <value>value2</value>" + EOL + " </entry>" + EOL + " </vfModuleParams>" + EOL
+ + " <msoRequest>" + EOL + " <requestId>requestId</requestId>" + EOL
+ + " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL + " </msoRequest>" + EOL
+ + " <messageId>{{MESSAGE-ID}}</messageId>" + EOL
+ + " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL
+ + "</createVfModuleRequest>" + EOL;
+
+ private final String UPDATE_VF_MODULE_REQUEST = "<updateVfModuleRequest>" + EOL
+ + " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + " <cloudOwner>cloudOwner</cloudOwner>" + EOL
+ + " <tenantId>tenantId</tenantId>" + EOL + " <vnfId>vnfId</vnfId>" + EOL
+ + " <vfModuleName>vfModuleName</vfModuleName>" + EOL + " <vfModuleId>vfModuleId</vfModuleId>" + EOL
+ + " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL + " <vnfType>vnfType</vnfType>" + EOL
+ + " <vnfVersion>vnfVersion</vnfVersion>" + EOL + " <vfModuleType>vfModuleType</vfModuleType>" + EOL
+ + " <volumeGroupId>volumeGroupId</volumeGroupId>" + EOL
+ + " <volumeGroupStackId>volumeGroupStackId</volumeGroupStackId>" + EOL
+ + " <baseVfModuleId>baseVfModuleId</baseVfModuleId>" + EOL
+ + " <baseVfModuleStackId>baseVfModuleStackId</baseVfModuleStackId>" + EOL + " <skipAAI>true</skipAAI>"
+ + EOL + " <backout>false</backout>" + EOL + " <failIfExists>true</failIfExists>" + EOL
+ + " <vfModuleParams>" + EOL + " <entry>" + EOL + " <key>key1</key>" + EOL
+ + " <value>value1</value>" + EOL + " </entry>" + EOL + " <entry>" + EOL + " <key>key2</key>"
+ + EOL + " <value>value2</value>" + EOL + " </entry>" + EOL + " </vfModuleParams>" + EOL
+ + " <msoRequest>" + EOL + " <requestId>requestId</requestId>" + EOL
+ + " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL + " </msoRequest>" + EOL
+ + " <messageId>{{MESSAGE-ID}}</messageId>" + EOL
+ + " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL
+ + "</updateVfModuleRequest>" + EOL;
+
+ private final String DELETE_VF_MODULE_REQUEST = "<deleteVfModuleRequest>" + EOL
+ + " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + " <cloudOwner>cloudOwner</cloudOwner>" + EOL
+ + " <tenantId>tenantId</tenantId>" + EOL + " <vnfId>vnfId</vnfId>" + EOL
+ + " <vfModuleId>vfModuleId</vfModuleId>" + EOL + " <vfModuleStackId>vfModuleStackId</vfModuleStackId>"
+ + EOL + " <skipAAI>true</skipAAI>" + EOL + " <msoRequest>" + EOL + " <requestId>requestId</requestId>"
+ + EOL + " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL + " </msoRequest>" + EOL
+ + " <messageId>{{MESSAGE-ID}}</messageId>" + EOL
+ + " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL
+ + "</deleteVfModuleRequest>" + EOL;
+
+ private final String ROLLBACK_VF_MODULE_REQUEST = "<rollbackVfModuleRequest>" + EOL
+ + " <messageId>{{MESSAGE-ID}}</messageId>" + EOL
+ + " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL
+ + " <skipAAI>true</skipAAI>" + EOL + " <vfModuleRollback>" + EOL
+ + " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + " <cloudOwner>cloudOwner</cloudOwner>" + EOL
+ + " <tenantId>tenantId</tenantId>" + EOL + " <vnfId>vnfId</vnfId>" + EOL
+ + " <vfModuleId>vfModuleId</vfModuleId>" + EOL + " <vfModuleStackId>vfModuleStackId</vfModuleStackId>"
+ + EOL + " <msoRequest>" + EOL + " <requestId>requestId</requestId>" + EOL
+ + " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL + " </msoRequest>" + EOL
+ + " <messageId>{{MESSAGE-ID}}</messageId>" + EOL + " <vfModuleCreated>true</vfModuleCreated>" + EOL
+ + " </vfModuleRollback>" + EOL + "</rollbackVfModuleRequest>" + EOL;
+
+ public VnfAdapterRestV1IT() throws IOException {
+ callbacks.put("createVfModule", "<createVfModuleResponse>" + EOL + " <vnfId>vnfId</vnfId>" + EOL
+ + " <vfModuleId>vfModuleId</vfModuleId>" + EOL + " <vfModuleStackId>vfModuleStackId</vfModuleStackId>"
+ + EOL + " <vfModuleCreated>true</vfModuleCreated>" + EOL + " <vfModuleOutputs>" + EOL + " <entry>"
+ + EOL + " <key>key1</key>" + EOL + " <value>value1</value>" + EOL + " </entry>" + EOL
+ + " <entry>" + EOL + " <key>key2</key>" + EOL + " <value>value2</value>" + EOL
+ + " </entry>" + EOL + " </vfModuleOutputs>" + EOL + " <rollback>" + EOL
+ + " <vnfId>vnfId</vnfId>" + EOL + " <vfModuleId>vfModuleId</vfModuleId>" + EOL
+ + " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL
+ + " <vfModuleCreated>true</vfModuleCreated>" + EOL + " <tenantId>tenantId</tenantId>" + EOL
+ + " <cloudOwner>cloudOwner</cloudOwner>" + EOL + " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL
+ + " <msoRequest>" + EOL + " <requestId>requestId</requestId>" + EOL
+ + " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL + " </msoRequest>" + EOL
+ + " <messageId>messageId</messageId>" + EOL + " </rollback>" + EOL
+ + " <messageId>{{MESSAGE-ID}}</messageId>" + EOL + "</createVfModuleResponse>" + EOL);
+
+ callbacks.put("updateVfModule",
+ "<updateVfModuleResponse>" + EOL + " <vnfId>vnfId</vnfId>" + EOL
+ + " <vfModuleId>vfModuleId</vfModuleId>" + EOL
+ + " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL + " <vfModuleOutputs>" + EOL
+ + " <entry>" + EOL + " <key>key1</key>" + EOL + " <value>value1</value>" + EOL
+ + " </entry>" + EOL + " <entry>" + EOL + " <key>key2</key>" + EOL
+ + " <value>value2</value>" + EOL + " </entry>" + EOL + " </vfModuleOutputs>" + EOL
+ + " <messageId>{{MESSAGE-ID}}</messageId>" + EOL + "</updateVfModuleResponse>" + EOL);
+
+ callbacks.put("deleteVfModule",
+ "<deleteVfModuleResponse>" + EOL + " <vnfId>vnfId</vnfId>" + EOL
+ + " <vfModuleId>vfModuleId</vfModuleId>" + EOL + " <vfModuleDeleted>true</vfModuleDeleted>"
+ + EOL + " <messageId>{{MESSAGE-ID}}</messageId>" + EOL + "</deleteVfModuleResponse>" + EOL);
+
+ callbacks.put("rollbackVfModule", "<rollbackVfModuleResponse>" + EOL + " <messageId>{{MESSAGE-ID}}</messageId>"
+ + EOL + " <vfModuleRolledback>true</vfModuleRolledback>" + EOL + "</rollbackVfModuleResponse>" + EOL);
+
+ callbacks.put("vfModuleException",
+ "<vfModuleException>" + EOL + " <message>message</message>" + EOL + " <category>category</category>"
+ + EOL + " <rolledBack>false</rolledBack>" + EOL + " <messageId>{{MESSAGE-ID}}</messageId>"
+ + EOL + "</vfModuleException>" + EOL);
+ }
+
+ @Test
+
+ public void testCreateVfModuleSuccess() throws Exception {
+ logStart();
+
+ mockVNFPost(wireMockServer, "", 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<String, Object> 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("<createVfModuleResponse>"));
+ assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ @Test
+
+ public void testUpdateVfModuleSuccess() throws Exception {
+ logStart();
+
+ mockVNFPut(wireMockServer, "/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<String, Object> 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("<updateVfModuleResponse>"));
+ assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ @Test
+
+ public void testDeleteVfModuleSuccess() throws Exception {
+ logStart();
+
+ mockVNFDelete(wireMockServer, "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<String, Object> 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("<deleteVfModuleResponse>"));
+ assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ @Test
+
+ public void testRollbackVfModuleSuccess() throws Exception {
+ logStart();
+
+ mockVNFRollbackDelete(wireMockServer, "/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<String, Object> 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("<rollbackVfModuleResponse>"));
+ assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ @Test
+
+ public void testCreateVfModuleException() throws Exception {
+ logStart();
+
+ mockVNFPost(wireMockServer, "", 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<String, Object> 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("<vfModuleException>"));
+ 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
index a746bbb48e..cc2d6ab640 100644
--- 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
@@ -16,16 +16,14 @@
* 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;
@@ -36,49 +34,53 @@ 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 = "<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns5=\"http://org.onap/so/request/types/v1\"> <msoservtypes:service-information xmlns:msoservtypes=\"http://org.onap/so/request/types/v1\"> <msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type> <msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id> <msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> </aetgt:CreateTenantRequest>";
-
- Map<String,String> 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<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns5=\"http://org.onap/so/request/types/v1\"> <msoservtypes:service-information xmlns:msoservtypes=\"http://org.onap/so/request/types/v1\"> <msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type> <msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id> <msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> </aetgt:CreateTenantRequest>", 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<String, Object> variableValueType = new HashMap<>();
-
- Map<String, Object> requestMsg = new HashMap<>();
- requestMsg.put("value", request);
- requestMsg.put("type", "String");
-
- Map<String, Object> msorequestId = new HashMap<>();
- msorequestId.put("type", "String");
- msorequestId.put("value",requestId);
-
- Map<String, Object> 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);
- }
-
-
+ @Test
+ @Deployment(resources = {"testAsyncResource.bpmn"})
+ public void asyncRequestSuccess() throws InterruptedException {
+ // it can be any request which asynchronously processed by the workflow
+ String request =
+ "<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns5=\"http://org.onap/so/request/types/v1\"> <msoservtypes:service-information xmlns:msoservtypes=\"http://org.onap/so/request/types/v1\"> <msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type> <msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id> <msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> </aetgt:CreateTenantRequest>";
+
+ Map<String, String> 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<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns5=\"http://org.onap/so/request/types/v1\"> <msoservtypes:service-information xmlns:msoservtypes=\"http://org.onap/so/request/types/v1\"> <msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type> <msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id> <msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> </aetgt:CreateTenantRequest>",
+ 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<String, Object> variableValueType = new HashMap<>();
+
+ Map<String, Object> requestMsg = new HashMap<>();
+ requestMsg.put("value", request);
+ requestMsg.put("type", "String");
+
+ Map<String, Object> msorequestId = new HashMap<>();
+ msorequestId.put("type", "String");
+ msorequestId.put("value", requestId);
+
+ Map<String, Object> 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
index 0efecac254..23f9818669 100644
--- 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
@@ -16,14 +16,13 @@
* 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;
@@ -35,35 +34,35 @@ 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());
-
-
-
- }
+ @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
index eed2978bc7..389f931901 100644
--- 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
@@ -26,7 +26,6 @@ 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;
@@ -37,7 +36,6 @@ 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;
@@ -50,7 +48,6 @@ 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;
@@ -98,2158 +95,2108 @@ import org.xml.sax.SAXException;
/**
* A base class for Workflow tests.
* <p>
- * WireMock response transformers may be specified by declaring public
- * static fields with the @WorkflowTestTransformer annotation. For example:
+ * WireMock response transformers may be specified by declaring public static fields with the @WorkflowTestTransformer
+ * annotation. For example:
+ *
* <pre>
- * @WorkflowTestTransformer
- * public static final ResponseTransformer sdncAdapterMockTransformer =
- * new SDNCAdapterMockTransformer();
+ * &#64;WorkflowTestTransformer
+ * public static final ResponseTransformer sdncAdapterMockTransformer = new SDNCAdapterMockTransformer();
* </pre>
*/
public abstract class WorkflowTest {
- private static final Logger logger = LoggerFactory.getLogger(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";
-
- private static final int timeout = 2000;
-
- /**
- * 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() {
- logger.debug("STARTED TEST");
- }
-
- /**
- * Logs a test end method.
- */
- protected void logEnd() {
- logger.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<String, Object> injectedVariables) {
- RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
- List<String> arguments = runtimeMxBean.getInputArguments();
- logger.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";
- logger.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<String, Object> injectedVariables) {
- RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
- List<String> arguments = runtimeMxBean.getInputArguments();
- logger.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";
- logger.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<String, Object> injectedVariables) {
-
- RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
- List<String> arguments = runtimeMxBean.getInputArguments();
- logger.debug("JVM args = {}", arguments);
-
- Map<String, Object> variables = createVariables(schemaVersion, businessKey,
- request, injectedVariables, false);
- VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
-
- logger.debug("Sending {} to {} process", request, processKey);
-
- 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<String, Object> injectedVariables, boolean serviceInstantiationModel) {
-
- RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
- List<String> arguments = runtimeMxBean.getInputArguments();
- logger.debug("JVM args = {}", arguments);
-
- Map<String, Object> variables = createVariables(schemaVersion, businessKey,
- request, injectedVariables, serviceInstantiationModel);
- VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
-
- logger.debug("Sending {} to {} process", request, processKey);
-
- 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<String, Object> createVariables(String schemaVersion,
- String businessKey, String request, Map<String, Object> injectedVariables,
- boolean serviceInstantiationModel) {
-
- Map<String, Object> 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";
- logger.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("")) {
- logger.debug("No requestId element in injectedVariables");
- variables.put("mso-request-id", UUID.randomUUID().toString());
- }
- if (msoServiceInstanceId == null || msoServiceInstanceId.trim().equals("")) {
- logger.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;
- logger.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<String, Object> variables) {
- Map<String, Object> 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<String, Object> wrapVariableValue(Object value) {
- HashMap<String, Object> 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) {
- logger.debug("Waiting {}ms for process with business key {} to send a response", timeout, businessKey);
-
- long now = System.currentTimeMillis() + timeout;
- long endTime = now + timeout;
-
- while (now <= endTime) {
- Response response = asyncResponse.getResponse();
-
- if (response != null) {
- logger.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";
- logger.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;
- logger.debug(msg);
- fail(msg);
- return null; // unreachable
- }
-
- now = System.currentTimeMillis();
- }
-
- String msg = "No response received from process with business key " + businessKey +
- " within " + timeout + "ms";
- logger.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:
- * <pre>
- * reserve, assign, delete:ERR
- * </pre>
- * 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";
- logger.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 + "'";
- logger.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:
- * <pre>
- * event1, event2
- * </pre>
- * 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:
- * <pre>
- * reserve, assign, delete:ERR
- * </pre>
- * Errors are handled with junit assertions and will cause the test to fail.
- * Uses the static/default timeout value for backward compatibility.
- * @param callbacks an object containing callback data for the program
- * @param program the program to execute
- */
- protected void injectSDNCCallbacks(CallbackSet callbacks, String program) {
- injectSDNCCallbacks(callbacks, program, timeout);
- }
-
- /**
- * 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:
- * <pre>
- * reserve, assign, delete:ERR
- * </pre>
- * 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
- * @param timeout a timeout value to wait for the callback
- */
- protected void injectSDNCCallbacks(CallbackSet callbacks, String program, int timeout) {
-
- 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";
- logger.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";
- logger.debug(msg);
- fail(msg);
- }
-
- content = callbackData.getContent();
- respCode = 201;
- respMsg = "Created";
- } else if ("ERR".equals(modifier)) {
- content = "<svc-request-id>((REQUEST-ID))</svc-request-id><response-code>500</response-code><response-message>SIMULATED ERROR FROM SDNC ADAPTER</response-message>";
- respCode = 500;
- respMsg = "SERVER ERROR";
- } else {
- String msg = "Invalid SDNC program modifier: '" + modifier + "'";
- logger.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:
- * <pre>
- * create, rollback
- * </pre>
- * 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";
- logger.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 + "'";
- logger.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:
- * <pre>
- * createVnf, deleteVnf
- * </pre>
- * 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";
- logger.debug(msg);
- fail(msg);
- }
-
- content = callbackData.getContent();
- } else if ("ERR".equals(modifier)) {
- String msg = "Currently unsupported VNF program modifier: '" + modifier + "'";
- logger.debug(msg);
- fail(msg);
- } else {
- String msg = "Invalid VNF program modifier: '" + modifier + "'";
- logger.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";
- logger.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) {
- logger.debug("Waiting {}ms for there to be {} {} instances", timeout, count, processKey);
-
- 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) {
- logger.debug("There are now {} {} instances", actual, processKey);
- last = actual;
- }
-
- if (actual == count) {
- return;
- }
-
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- String msg = "Interrupted waiting for there to be " + count + " "
- + processKey + " instances";
- logger.debug(msg);
- fail(msg);
- }
-
- now = System.currentTimeMillis();
- }
-
- String msg = "Timed out waiting for there to be " + count + " "
- + processKey + " instances";
- logger.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) {
-
- logger.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) {
- logger.debug("Timed out waiting for "
- + processKey + " to start");
- } else {
- logger.debug("Timed out waiting for "
- + processKey + "[" + processInstance.getId()
- + "]." + variable + " to be set");
- }
-
- return null;
- }
-
- ProcessInstanceQuery processInstanceQuery = null;
- if (processInstance == null) {
- processInstanceQuery = runtimeService
- .createProcessInstanceQuery()
- .processDefinitionKey(processKey);
- }
-
- if(processInstanceQuery.count() == 1 || processInstanceQuery.count() == 0){
- processInstance = processInstanceQuery.singleResult();
- }else{
- //TODO There shouldnt be more than one in the list but seems to be happening, need to figure out why happening and best way to get correct one from list
- logger.debug("Process Instance Query returned {} instance. Getting the last instance in the list",
- processInstanceQuery.count());
- List<ProcessInstance> processList = processInstanceQuery.list();
- processInstance = processList.get((processList.size() - 1));
- }
-
-
- if (processInstance != null) {
- value = runtimeService
- .getVariable(processInstance.getId(), variable);
- }
-
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- logger.debug("Interrupted waiting for {}.{} to be set", processKey, variable);
- return null;
- }
-
- now = System.currentTimeMillis();
- }
-
- logger.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) {
- 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);
-
- logger.debug("Injecting SDNC adapter callback");
-
- Response response = workflowMessageResource.deliver(contentType, "SDNCAResponse", sdncRequestId, content);
- logger.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.
-
- logger.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);
- logger.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);
-
- logger.debug("Injecting VNF adapter callback");
-
- Response response = workflowMessageResource.deliver(contentType, "VNFAResponse", messageId, content);
- logger.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);
- }
-
- logger.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 cloudOwner = xpathTool.evaluate(
- "/tns:createVnfNotification/tns:rollback/tns:cloudOwner/text()");
- rollback.setCloudOwner(cloudOwner);
-
- 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) {
- logger.debug("Failed to unmarshal VNF callback content:");
- logger.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);
-
- logger.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) {
- logger.debug("Failed to unmarshal VNF Delete callback content:");
- logger.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);
-
- logger.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 cloudOwner = xpathTool.evaluate(
- "/tns:updateVnfNotification/tns:rollback/tns:cloudOwner/text()");
- rollback.setCloudOwner(cloudOwner);
-
- 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) {
- logger.debug("Failed to unmarshal VNF callback content:");
- logger.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:
- * <pre>
- * event1, event2
- * </pre>
- * 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";
- logger.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";
- logger.debug(msg);
- fail(msg);
- }
-
- content = callbackData.getContent();
- contentType = callbackData.getContentType();
- } else {
- String msg = "Invalid workflow message program modifier: '" + modifier + "'";
- logger.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);
- }
-
- logger.debug("Injecting " + messageType + " message");
-
- Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
- logger.debug("Workflow response to {} message: {}", messageType, 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";
- logger.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";
- logger.debug(msg);
- fail(msg);
- }
-
- content = callbackData.getContent();
- contentType = callbackData.getContentType();
- } else {
- String msg = "Invalid workflow message program modifier: '" + modifier + "'";
- logger.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<Resource> resourceList = decomp.getServiceResources();
- if(resourceList.size() == 1){
- String resourceId = "";
- for(Resource resource:resourceList){
- resourceId = resource.getResourceId();
- }
- String homingList = getJsonValue(content, "solutionInfo.placementInfo");
- 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<placementArr.length(); i++) {
- JSONObject placementObj = placementArr.getJSONObject(i);
- String placementModuleName = placementObj.getString("resourceModuleName");
- if (placementModuleName.equalsIgnoreCase(resourceModuleName)) {
- String placementString = placementObj.toString();
- placementString = placementString.replace("((SERVICE_RESOURCE_ID))", resourceId);
- JSONObject newPlacementObj = new JSONObject(placementString);
- placementArr.put(i, newPlacementObj);
- }
- }
-
- for (int i=0; i<licenseArr.length(); i++) {
- JSONObject licenseObj = licenseArr.getJSONObject(i);
- String licenseModuleName = licenseObj.getString("resourceModuleName");
- if (licenseModuleName.equalsIgnoreCase(resourceModuleName)) {
- String licenseString = licenseObj.toString();
- licenseString = licenseString.replace("((SERVICE_RESOURCE_ID))", resourceId);
- JSONObject newLicenseObj = new JSONObject(licenseString);
- licenseArr.put(i, newLicenseObj);
- }
- }
- }
- String newPlacementInfos = placementArr.toString();
- String newLicenseInfos = licenseArr.toString();
- content = updJsonValue(content, "solutionInfo.placementInfo", newPlacementInfos);
- content = updJsonValue(content, "solutionInfo.licenseInfo", newLicenseInfos);
- }
- catch(Exception e) {
- return false;
- }
-
- }
- }
- }
- logger.debug("Injecting " + messageType + " message");
-
- Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
- logger.debug("Workflow response to {} message: {}", messageType, response);
- return true;
- }
-
-
- /**
- * Wait for the process to end.
- * @param businessKey the process business key
- * @param timeout the amount of time to wait, in milliseconds
- */
- protected void waitForProcessEnd(String businessKey, long timeout) {
- logger.debug("Waiting {}ms for process with business key {} to end", timeout, businessKey);
-
- long now = System.currentTimeMillis() + timeout;
- long endTime = now + timeout;
-
- while (now <= endTime) {
- if (isProcessEnded(businessKey)) {
- logger.debug("Process with business key {} has ended", businessKey);
- return;
- }
-
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- String msg = "Interrupted waiting for process with business key " +
- businessKey + " to end";
- logger.debug(msg);
- fail(msg);
- }
-
- now = System.currentTimeMillis();
- }
-
- String msg = "Process with business key " + businessKey +
- " did not end within " + timeout + "ms";
- logger.debug(msg);
- fail(msg);
- }
-
- /**
- * Wait for the process to end. Must be used when multiple process instances exist with
- * this same business key such as when its passed to subflows or shared across multiple
- * processes.
- *
- * @param businessKey the process business key
- * @param processName the process definition name
- * @param timeout the amount of time to wait, in milliseconds
- * @author cb645j
- */
- protected void waitForProcessEnd(String businessKey, String processName, long timeout) {
- logger.debug("Waiting {}ms for process with business key {} to end", timeout, businessKey);
-
- long now = System.currentTimeMillis() + timeout;
- long endTime = now + timeout;
-
- while (now <= endTime) {
- if (isProcessEnded(businessKey, processName)) {
- logger.debug("Process with business key {} has ended", businessKey);
- return;
- }
-
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- String msg = "Interrupted waiting for process with business key " +
- businessKey + " to end";
- logger.debug(msg);
- fail(msg);
- }
-
- now = System.currentTimeMillis();
- }
-
- String msg = "Process with business key " + businessKey +
- " did not end within " + timeout + "ms";
- logger.debug(msg);
- fail(msg);
- }
-
- /**
- * Verifies that the specified historic process variable has the specified value.
- * If the variable does not have the specified value, the test is failed.
- *
- * @param businessKey the process business key
- * @param variable the variable name
- * @param value the expected variable value
- */
- protected void checkVariable(String businessKey, String variable, Object value) {
- if (!isProcessEnded(businessKey)) {
- fail("Cannot get historic variable " + variable + " because process with business key " +
- businessKey + " has not ended");
- }
-
- Object variableValue = getVariableFromHistory(businessKey, variable);
- assertEquals(value, variableValue);
- }
-
- /**
- * Checks to see if the specified process is ended.
- * @param businessKey the process business Key
- * @return true if the process is ended
- */
- protected boolean isProcessEnded(String businessKey) {
- HistoricProcessInstance processInstance = historyService
- .createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).singleResult();
- return processInstance != null && processInstance.getEndTime() != null;
- }
-
- /**
- * Checks to see if the specified process is ended.
- *
- * @param processInstanceId the process Instance Id
- * @return true if the process is ended
- */
- protected boolean isProcessEndedByProcessInstanceId(String processInstanceId) {
- HistoricProcessInstance processInstance = historyService
- .createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
- return processInstance != null && processInstance.getEndTime() != null;
- }
-
- /**
- * Checks to see if the specified process is ended.
- *
- * @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) {
- logger.debug("Error retrieving variable {} from historical process with business key {}: ", variableName, 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){
- logger.debug("Multiple proccess instances exist with process name {} and business key {}. Must pass instance "
- + "index as a parameter.", processName, businessKey);
- return null;
- }catch(Exception e){
- logger.debug("Error retrieving variable {} from historical process for process {} with business key {}: ",
- variableName, processName, 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<HistoricProcessInstance> 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) {
- logger.debug("Error retrieving variable {} from historical process for process {} with business key {}: ",
- variableName, processName, 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<HistoricProcessInstance> 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) {
- logger.debug("Error retrieving variable {} from sub flow: {}, Exception is: ", variableName, subflowName, 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<HistoricProcessInstance> 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) {
- logger.debug("Error retrieving variable {} from {} instance index of sub flow: {}, Exception is: ", variableName,
- subflowInstanceIndex, subflowName, 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. "<name>"
- * @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("(</)(\\w+:)(.*?>)", "$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());
+ private static final Logger logger = LoggerFactory.getLogger(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";
+
+ private static final int timeout = 2000;
+
+ /**
+ * 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() {
+ logger.debug("STARTED TEST");
+ }
+
+ /**
+ * Logs a test end method.
+ */
+ protected void logEnd() {
+ logger.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<String, Object> injectedVariables) {
+ RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+ List<String> arguments = runtimeMxBean.getInputArguments();
+ logger.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";
+ logger.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<String, Object> injectedVariables) {
+ RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+ List<String> arguments = runtimeMxBean.getInputArguments();
+ logger.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";
+ logger.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<String, Object> injectedVariables) {
+
+ RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+ List<String> arguments = runtimeMxBean.getInputArguments();
+ logger.debug("JVM args = {}", arguments);
+
+ Map<String, Object> variables = createVariables(schemaVersion, businessKey, request, injectedVariables, false);
+ VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
+
+ logger.debug("Sending {} to {} process", request, processKey);
+
+ 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<String, Object> injectedVariables, boolean serviceInstantiationModel) {
+
+ RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+ List<String> arguments = runtimeMxBean.getInputArguments();
+ logger.debug("JVM args = {}", arguments);
+
+ Map<String, Object> variables =
+ createVariables(schemaVersion, businessKey, request, injectedVariables, serviceInstantiationModel);
+ VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
+
+ logger.debug("Sending {} to {} process", request, processKey);
+
+ 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<String, Object> createVariables(String schemaVersion, String businessKey, String request,
+ Map<String, Object> injectedVariables, boolean serviceInstantiationModel) {
+
+ Map<String, Object> 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";
+ logger.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("")) {
+ logger.debug("No requestId element in injectedVariables");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ }
+ if (msoServiceInstanceId == null || msoServiceInstanceId.trim().equals("")) {
+ logger.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;
+ logger.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<String, Object> variables) {
+ Map<String, Object> 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<String, Object> wrapVariableValue(Object value) {
+ HashMap<String, Object> 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) {
+ logger.debug("Waiting {}ms for process with business key {} to send a response", timeout, businessKey);
+
+ long now = System.currentTimeMillis() + timeout;
+ long endTime = now + timeout;
+
+ while (now <= endTime) {
+ Response response = asyncResponse.getResponse();
+
+ if (response != null) {
+ logger.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";
+ logger.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;
+ logger.debug(msg);
+ fail(msg);
+ return null; // unreachable
+ }
+
+ now = System.currentTimeMillis();
+ }
+
+ String msg = "No response received from process with business key " + businessKey + " within " + timeout + "ms";
+ logger.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:
+ *
+ * <pre>
+ * reserve, assign, delete:ERR
+ * </pre>
+ *
+ * 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";
+ logger.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 + "'";
+ logger.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:
+ *
+ * <pre>
+ * event1, event2
+ * </pre>
+ *
+ * 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:
+ *
+ * <pre>
+ * reserve, assign, delete:ERR
+ * </pre>
+ *
+ * Errors are handled with junit assertions and will cause the test to fail. Uses the static/default timeout value
+ * for backward compatibility.
+ *
+ * @param callbacks an object containing callback data for the program
+ * @param program the program to execute
+ */
+ protected void injectSDNCCallbacks(CallbackSet callbacks, String program) {
+ injectSDNCCallbacks(callbacks, program, timeout);
+ }
+
+ /**
+ * 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:
+ *
+ * <pre>
+ * reserve, assign, delete:ERR
+ * </pre>
+ *
+ * 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
+ * @param timeout a timeout value to wait for the callback
+ */
+ protected void injectSDNCCallbacks(CallbackSet callbacks, String program, int timeout) {
+
+ 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";
+ logger.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";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ respCode = 201;
+ respMsg = "Created";
+ } else if ("ERR".equals(modifier)) {
+ content =
+ "<svc-request-id>((REQUEST-ID))</svc-request-id><response-code>500</response-code><response-message>SIMULATED ERROR FROM SDNC ADAPTER</response-message>";
+ respCode = 500;
+ respMsg = "SERVER ERROR";
+ } else {
+ String msg = "Invalid SDNC program modifier: '" + modifier + "'";
+ logger.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:
+ *
+ * <pre>
+ * create, rollback
+ * </pre>
+ *
+ * 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";
+ logger.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 + "'";
+ logger.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:
+ *
+ * <pre>
+ * createVnf, deleteVnf
+ * </pre>
+ *
+ * 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";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ } else if ("ERR".equals(modifier)) {
+ String msg = "Currently unsupported VNF program modifier: '" + modifier + "'";
+ logger.debug(msg);
+ fail(msg);
+ } else {
+ String msg = "Invalid VNF program modifier: '" + modifier + "'";
+ logger.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";
+ logger.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) {
+ logger.debug("Waiting {}ms for there to be {} {} instances", timeout, count, processKey);
+
+ 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) {
+ logger.debug("There are now {} {} instances", actual, processKey);
+ last = actual;
+ }
+
+ if (actual == count) {
+ return;
+ }
+
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ String msg = "Interrupted waiting for there to be " + count + " " + processKey + " instances";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ now = System.currentTimeMillis();
+ }
+
+ String msg = "Timed out waiting for there to be " + count + " " + processKey + " instances";
+ logger.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) {
+
+ logger.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) {
+ logger.debug("Timed out waiting for " + processKey + " to start");
+ } else {
+ logger.debug("Timed out waiting for " + processKey + "[" + processInstance.getId() + "]." + variable
+ + " to be set");
+ }
+
+ return null;
+ }
+
+ ProcessInstanceQuery processInstanceQuery = null;
+ if (processInstance == null) {
+ processInstanceQuery = runtimeService.createProcessInstanceQuery().processDefinitionKey(processKey);
+ }
+
+ if (processInstanceQuery.count() == 1 || processInstanceQuery.count() == 0) {
+ processInstance = processInstanceQuery.singleResult();
+ } else {
+ // TODO There shouldnt be more than one in the list but seems to be happening, need to figure out why
+ // happening and best way to get correct one from list
+ logger.debug("Process Instance Query returned {} instance. Getting the last instance in the list",
+ processInstanceQuery.count());
+ List<ProcessInstance> processList = processInstanceQuery.list();
+ processInstance = processList.get((processList.size() - 1));
+ }
+
+
+ if (processInstance != null) {
+ value = runtimeService.getVariable(processInstance.getId(), variable);
+ }
+
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ logger.debug("Interrupted waiting for {}.{} to be set", processKey, variable);
+ return null;
+ }
+
+ now = System.currentTimeMillis();
+ }
+
+ logger.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) {
+ 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);
+
+ logger.debug("Injecting SDNC adapter callback");
+
+ Response response = workflowMessageResource.deliver(contentType, "SDNCAResponse", sdncRequestId, content);
+ logger.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.
+
+ logger.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);
+ logger.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);
+
+ logger.debug("Injecting VNF adapter callback");
+
+ Response response = workflowMessageResource.deliver(contentType, "VNFAResponse", messageId, content);
+ logger.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);
+ }
+
+ logger.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 cloudOwner = xpathTool.evaluate("/tns:createVnfNotification/tns:rollback/tns:cloudOwner/text()");
+ rollback.setCloudOwner(cloudOwner);
+
+ 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) {
+ logger.debug("Failed to unmarshal VNF callback content:");
+ logger.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;
}
- /**
- * 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<String, CallbackData> 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<String, String> prefixMap = new HashMap<>();
- private Map<String, String> 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<String> getPrefixes(String uri) {
- List<String> 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);
- }
- }
+ /**
+ * 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);
+
+ logger.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) {
+ logger.debug("Failed to unmarshal VNF Delete callback content:");
+ logger.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);
+
+ logger.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 cloudOwner = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:cloudOwner/text()");
+ rollback.setCloudOwner(cloudOwner);
+
+ 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) {
+ logger.debug("Failed to unmarshal VNF callback content:");
+ logger.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:
+ *
+ * <pre>
+ * event1, event2
+ * </pre>
+ *
+ * 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";
+ logger.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";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ contentType = callbackData.getContentType();
+ } else {
+ String msg = "Invalid workflow message program modifier: '" + modifier + "'";
+ logger.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);
+ }
+
+ logger.debug("Injecting " + messageType + " message");
+
+ Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
+ logger.debug("Workflow response to {} message: {}", messageType, 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";
+ logger.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";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ contentType = callbackData.getContentType();
+ } else {
+ String msg = "Invalid workflow message program modifier: '" + modifier + "'";
+ logger.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<Resource> resourceList = decomp.getServiceResources();
+ if (resourceList.size() == 1) {
+ String resourceId = "";
+ for (Resource resource : resourceList) {
+ resourceId = resource.getResourceId();
+ }
+ String homingList = getJsonValue(content, "solutionInfo.placementInfo");
+ 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 < placementArr.length(); i++) {
+ JSONObject placementObj = placementArr.getJSONObject(i);
+ String placementModuleName = placementObj.getString("resourceModuleName");
+ if (placementModuleName.equalsIgnoreCase(resourceModuleName)) {
+ String placementString = placementObj.toString();
+ placementString = placementString.replace("((SERVICE_RESOURCE_ID))", resourceId);
+ JSONObject newPlacementObj = new JSONObject(placementString);
+ placementArr.put(i, newPlacementObj);
+ }
+ }
+
+ for (int i = 0; i < licenseArr.length(); i++) {
+ JSONObject licenseObj = licenseArr.getJSONObject(i);
+ String licenseModuleName = licenseObj.getString("resourceModuleName");
+ if (licenseModuleName.equalsIgnoreCase(resourceModuleName)) {
+ String licenseString = licenseObj.toString();
+ licenseString = licenseString.replace("((SERVICE_RESOURCE_ID))", resourceId);
+ JSONObject newLicenseObj = new JSONObject(licenseString);
+ licenseArr.put(i, newLicenseObj);
+ }
+ }
+ }
+ String newPlacementInfos = placementArr.toString();
+ String newLicenseInfos = licenseArr.toString();
+ content = updJsonValue(content, "solutionInfo.placementInfo", newPlacementInfos);
+ content = updJsonValue(content, "solutionInfo.licenseInfo", newLicenseInfos);
+ } catch (Exception e) {
+ return false;
+ }
+
+ }
+ }
+ }
+ logger.debug("Injecting " + messageType + " message");
+
+ Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
+ logger.debug("Workflow response to {} message: {}", messageType, response);
+ return true;
+ }
+
+
+ /**
+ * Wait for the process to end.
+ *
+ * @param businessKey the process business key
+ * @param timeout the amount of time to wait, in milliseconds
+ */
+ protected void waitForProcessEnd(String businessKey, long timeout) {
+ logger.debug("Waiting {}ms for process with business key {} to end", timeout, businessKey);
+
+ long now = System.currentTimeMillis() + timeout;
+ long endTime = now + timeout;
+
+ while (now <= endTime) {
+ if (isProcessEnded(businessKey)) {
+ logger.debug("Process with business key {} has ended", businessKey);
+ return;
+ }
+
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ String msg = "Interrupted waiting for process with business key " + businessKey + " to end";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ now = System.currentTimeMillis();
+ }
+
+ String msg = "Process with business key " + businessKey + " did not end within " + timeout + "ms";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ /**
+ * Wait for the process to end. Must be used when multiple process instances exist with this same business key such
+ * as when its passed to subflows or shared across multiple processes.
+ *
+ * @param businessKey the process business key
+ * @param processName the process definition name
+ * @param timeout the amount of time to wait, in milliseconds
+ * @author cb645j
+ */
+ protected void waitForProcessEnd(String businessKey, String processName, long timeout) {
+ logger.debug("Waiting {}ms for process with business key {} to end", timeout, businessKey);
+
+ long now = System.currentTimeMillis() + timeout;
+ long endTime = now + timeout;
+
+ while (now <= endTime) {
+ if (isProcessEnded(businessKey, processName)) {
+ logger.debug("Process with business key {} has ended", businessKey);
+ return;
+ }
+
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ String msg = "Interrupted waiting for process with business key " + businessKey + " to end";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ now = System.currentTimeMillis();
+ }
+
+ String msg = "Process with business key " + businessKey + " did not end within " + timeout + "ms";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ /**
+ * Verifies that the specified historic process variable has the specified value. If the variable does not have the
+ * specified value, the test is failed.
+ *
+ * @param businessKey the process business key
+ * @param variable the variable name
+ * @param value the expected variable value
+ */
+ protected void checkVariable(String businessKey, String variable, Object value) {
+ if (!isProcessEnded(businessKey)) {
+ fail("Cannot get historic variable " + variable + " because process with business key " + businessKey
+ + " has not ended");
+ }
+
+ Object variableValue = getVariableFromHistory(businessKey, variable);
+ assertEquals(value, variableValue);
+ }
+
+ /**
+ * Checks to see if the specified process is ended.
+ *
+ * @param businessKey the process business Key
+ * @return true if the process is ended
+ */
+ protected boolean isProcessEnded(String businessKey) {
+ HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery()
+ .processInstanceBusinessKey(businessKey).singleResult();
+ return processInstance != null && processInstance.getEndTime() != null;
+ }
+
+ /**
+ * Checks to see if the specified process is ended.
+ *
+ * @param processInstanceId the process Instance Id
+ * @return true if the process is ended
+ */
+ protected boolean isProcessEndedByProcessInstanceId(String processInstanceId) {
+ HistoricProcessInstance processInstance =
+ historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
+ return processInstance != null && processInstance.getEndTime() != null;
+ }
+
+ /**
+ * Checks to see if the specified process is ended.
+ *
+ * @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) {
+ logger.debug("Error retrieving variable {} from historical process with business key {}: ", variableName,
+ 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) {
+ logger.debug(
+ "Multiple proccess instances exist with process name {} and business key {}. Must pass instance "
+ + "index as a parameter.",
+ processName, businessKey);
+ return null;
+ } catch (Exception e) {
+ logger.debug("Error retrieving variable {} from historical process for process {} with business key {}: ",
+ variableName, processName, 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<HistoricProcessInstance> 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) {
+ logger.debug("Error retrieving variable {} from historical process for process {} with business key {}: ",
+ variableName, processName, 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<HistoricProcessInstance> 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) {
+ logger.debug("Error retrieving variable {} from sub flow: {}, Exception is: ", variableName, subflowName,
+ 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<HistoricProcessInstance> 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) {
+ logger.debug("Error retrieving variable {} from {} instance index of sub flow: {}, Exception is: ",
+ variableName, subflowInstanceIndex, subflowName, 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. "<name>"
+ * @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("(</)(\\w+:)(.*?>)", "$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<String, CallbackData> 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<String, String> prefixMap = new HashMap<>();
+ private Map<String, String> 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<String> getPrefixes(String uri) {
+ List<String> 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
index dbad35a6a4..794e772dcd 100644
--- 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
@@ -26,16 +26,15 @@ 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:
+ * 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:
+ *
* <pre>
- * @WorkflowTestTransformer
- * public static final ResponseTransformer sdncAdapterMockTransformer =
- * new SDNCAdapterMockTransformer();
+ * &#64;WorkflowTestTransformer
+ * public static final ResponseTransformer sdncAdapterMockTransformer = new SDNCAdapterMockTransformer();
* </pre>
*/
@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/common/adapter/sdnc/ObjectFactoryTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java
index bdc48392af..d95a5883c8 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java
@@ -20,7 +20,6 @@
package org.onap.so.bpmn.common.adapter.sdnc;
import static org.junit.Assert.assertEquals;
-
import org.junit.Before;
import org.junit.Test;
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerServiceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerServiceTest.java
index 051107bb13..c58af6b02f 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerServiceTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerServiceTest.java
@@ -23,7 +23,6 @@ package org.onap.so.bpmn.common.workflow.service;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java
index ff5e18c210..62b582ea8e 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java
@@ -16,20 +16,17 @@
* 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 static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-
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.camunda.bpm.engine.variable.impl.VariableMapImpl;
import org.junit.Test;
@@ -38,41 +35,41 @@ import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
public class WorkflowAsyncResourceExceptionHandlingTest {
- @Test
- @Deployment(resources = { "testAsyncResource.bpmn" })
- public void asyncRequestSuccess() throws InterruptedException {
- VariableMapImpl variableMap = new VariableMapImpl();
+ @Test
+ @Deployment(resources = {"testAsyncResource.bpmn"})
+ public void asyncRequestSuccess() throws InterruptedException {
+ VariableMapImpl variableMap = new VariableMapImpl();
- Map<String, Object> variableValueType = new HashMap<>();
+ Map<String, Object> variableValueType = new HashMap<>();
- Map<String, Object> requestMsg = new HashMap<>();
- requestMsg.put("value", "");
- requestMsg.put("type", "String");
+ Map<String, Object> requestMsg = new HashMap<>();
+ requestMsg.put("value", "");
+ requestMsg.put("type", "String");
- Map<String, Object> msorequestId = new HashMap<>();
- msorequestId.put("type", "String");
- msorequestId.put("value",UUID.randomUUID().toString());
+ Map<String, Object> msorequestId = new HashMap<>();
+ msorequestId.put("type", "String");
+ msorequestId.put("value", UUID.randomUUID().toString());
- Map<String, Object> timeout = new HashMap<>();
- timeout.put("type", "String");
- timeout.put("value","5");
+ Map<String, Object> 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);
+ variableValueType.put("testAsyncRequestMsg", requestMsg);
+ variableValueType.put("mso-request-id", msorequestId);
+ variableValueType.put("mso-service-request-timeout", timeout);
- variableMap.put("variables", variableValueType);
- WorkflowAsyncResource workflowAsyncResource = new WorkflowAsyncResource();
- workflowAsyncResource.setProcessor(new WorkflowProcessor());
- Response res = workflowAsyncResource.startProcessInstanceByKey("randomKey", variableMap);
- assertEquals(500,res.getStatus());
- WorkflowResponse workflowResponse = (WorkflowResponse)res.getEntity();
- assertNotNull(workflowResponse);
- assertEquals(500, workflowResponse.getMessageCode());
- assertTrue(workflowResponse.getResponse().startsWith("Error occurred while executing the process:"));
- assertEquals("Fail", workflowResponse.getMessage());
+ variableMap.put("variables", variableValueType);
+ WorkflowAsyncResource workflowAsyncResource = new WorkflowAsyncResource();
+ workflowAsyncResource.setProcessor(new WorkflowProcessor());
+ Response res = workflowAsyncResource.startProcessInstanceByKey("randomKey", variableMap);
+ assertEquals(500, res.getStatus());
+ WorkflowResponse workflowResponse = (WorkflowResponse) res.getEntity();
+ assertNotNull(workflowResponse);
+ assertEquals(500, workflowResponse.getMessageCode());
+ assertTrue(workflowResponse.getResponse().startsWith("Error occurred while executing the process:"));
+ assertEquals("Fail", workflowResponse.getMessage());
- }
+ }
}
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
index 5b5e17c5fc..1c3583d452 100644
--- 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
@@ -21,5 +21,5 @@
package org.onap.so.bpmn.infrastructure;
public interface FlakyTests {
- /* category marker */
+ /* category marker */
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
index 5cc0281407..3734510eed 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
@@ -25,10 +25,8 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
-
import java.util.HashMap;
import java.util.Map;
-
import java.util.UUID;
import org.assertj.core.api.Assertions;
import org.assertj.core.data.MapEntry;
@@ -64,25 +62,17 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
// given
variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITH_ENTRY);
// when
- ProcessInstance instance = runtimeService
- .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
+ ProcessInstance instance =
+ runtimeService.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage");
dmaapClientTestImpl.sendMessage();
// then
- assertThat(instance).isEnded().hasPassedInOrder(
- "CreateAndActivatePnf_StartEvent",
- "CheckInputs",
- "CheckAiiForPnfCorrelationId",
- "DoesAaiContainInfoAboutPnf",
- "AaiEntryExists",
- "InformDmaapClient",
- "WaitForDmaapPnfReadyNotification",
- "CreateRelationId",
- "AaiEntryUpdated"
- );
- Assertions.assertThat(pnfManagementTest.getServiceAndPnfRelationMap()).
- containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID, PnfManagementTestImpl.ID_WITH_ENTRY));
+ assertThat(instance).isEnded().hasPassedInOrder("CreateAndActivatePnf_StartEvent", "CheckInputs",
+ "CheckAiiForPnfCorrelationId", "DoesAaiContainInfoAboutPnf", "AaiEntryExists", "InformDmaapClient",
+ "WaitForDmaapPnfReadyNotification", "CreateRelationId", "AaiEntryUpdated");
+ Assertions.assertThat(pnfManagementTest.getServiceAndPnfRelationMap())
+ .containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID, PnfManagementTestImpl.ID_WITH_ENTRY));
}
@Test
@@ -90,26 +80,17 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
// given
variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY);
// when
- ProcessInstance instance = runtimeService
- .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
+ ProcessInstance instance =
+ runtimeService.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage");
dmaapClientTestImpl.sendMessage();
// then
- assertThat(instance).isEnded().hasPassedInOrder(
- "CreateAndActivatePnf_StartEvent",
- "CheckInputs",
- "CheckAiiForPnfCorrelationId",
- "DoesAaiContainInfoAboutPnf",
- "CreatePnfEntryInAai",
- "AaiEntryExists",
- "InformDmaapClient",
- "WaitForDmaapPnfReadyNotification",
- "CreateRelationId",
- "AaiEntryUpdated"
- );
+ assertThat(instance).isEnded().hasPassedInOrder("CreateAndActivatePnf_StartEvent", "CheckInputs",
+ "CheckAiiForPnfCorrelationId", "DoesAaiContainInfoAboutPnf", "CreatePnfEntryInAai", "AaiEntryExists",
+ "InformDmaapClient", "WaitForDmaapPnfReadyNotification", "CreateRelationId", "AaiEntryUpdated");
Assertions.assertThat(pnfManagementTest.getCreated()).containsOnlyKeys(PnfManagementTestImpl.ID_WITHOUT_ENTRY);
- Assertions.assertThat(pnfManagementTest.getServiceAndPnfRelationMap()).
- containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY));
+ Assertions.assertThat(pnfManagementTest.getServiceAndPnfRelationMap())
+ .containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY));
}
}
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
index 6a5f9fac74..e7ff69ab3b 100644
--- 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
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
import java.util.Objects;
-
import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
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
index 8c31a021ae..65b1962048 100644
--- 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
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
* ============LICENSE_END=========================================================
*/
@@ -22,26 +17,25 @@ 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";
+
+
+ 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
index aa65474acc..bdc24875f0 100644
--- 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
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
* ============LICENSE_END=========================================================
*/
@@ -50,12 +45,10 @@ 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;
@@ -65,58 +58,68 @@ 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(wireMockServer, "uuid-miu-svc-011-abcdef", "2","VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
- MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
- MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
- StubResponseOof.mockOof(wireMockServer);
- // TODO: the SI should NOT have to be URL-encoded yet again!
- MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
-
- MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ 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(wireMockServer, "uuid-miu-svc-011-abcdef", "2",
+ "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef",
+ "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+ StubResponseOof.mockOof(wireMockServer);
+ // TODO: the SI should NOT have to be URL-encoded yet again!
+ MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+ "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+ "GenericFlows/getServiceInstance.xml");
+
+ MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
MockGetGenericVnfByIdWithDepth(wireMockServer, ".*", 1, "VCPE/CreateVcpeResCustService/GenericVnf.xml");
- MockPutGenericVnf(wireMockServer, ".*");
+ MockPutGenericVnf(wireMockServer, ".*");
MockPatchGenericVnf(wireMockServer, ".*");
MockGetGenericVnfByIdWithPriority(wireMockServer, ".*", ".*", 200, "VfModularity/VfModule-new.xml", 5);
@@ -124,46 +127,52 @@ public class CreateVcpeResCustServiceIT extends AbstractTestBase {
MockPutVfModuleIdNoResponse(wireMockServer, ".*", "PCRF", ".*");
MockPutNetwork(wireMockServer, ".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200);
- MockGetNetworkPolicyfqdn(wireMockServer, ".*","CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml",200);
- MockNodeQueryServiceInstanceByName_404(wireMockServer, ".*");
-
- mockVNFPost(wireMockServer, "", 202, ".*");
+ MockGetNetworkPolicyfqdn(wireMockServer, ".*",
+ "CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", 200);
+ MockNodeQueryServiceInstanceByName_404(wireMockServer, ".*");
+
+ mockVNFPost(wireMockServer, "", 202, ".*");
+
+ wireMockServer.stubFor(post(urlMatching("/services/rest/v1/vnfs" + ".*" + "/vf-modules"))
+ .willReturn(aResponse().withStatus(202)));
+ wireMockServer
+ .stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
+ wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*"))
+ .willReturn(aResponse().withStatus(200)));
+ wireMockServer.stubFor(put(urlMatching(
+ ".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship"))
+ .willReturn(aResponse().withStatus(200)));
+ wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
+ MockPostRequestDB(wireMockServer);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+ mockSDNCAdapter(wireMockServer, 200);
- wireMockServer.stubFor(post(urlMatching("/services/rest/v1/vnfs" + ".*" + "/vf-modules" )).willReturn(aResponse().withStatus(202)));
- wireMockServer.stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
- wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200)));
- wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200)));
- wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
- MockPostRequestDB(wireMockServer);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
- mockSDNCAdapter(wireMockServer, 200);
-
- Map<String, Object> variables = setupVariables();
+ Map<String, Object> variables = setupVariables();
- String businessKey = UUID.randomUUID().toString();
- invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+ 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 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
+ // VF Module
injectSDNCCallbacks(callbacks, "queryModule");
injectSDNCCallbacks(callbacks, "assign");
injectSDNCCallbacks(callbacks, "queryModule");
injectSDNCCallbacks(callbacks, "queryModule");
- injectSDNCCallbacks(callbacks, "assign");
- injectSDNCCallbacks(callbacks, "queryModuleNoVnf");
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "queryModuleNoVnf");
injectVNFRestCallbacks(callbacks, "vnfCreate");
injectSDNCCallbacks(callbacks, "activate");
@@ -173,208 +182,233 @@ public class CreateVcpeResCustServiceIT extends AbstractTestBase {
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(wireMockServer, "uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
- MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
- MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
-
- // TODO: the SI should NOT have to be URL-encoded yet again!
- MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
-
- MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
-
- // TODO: should these really be PARENT_INST, or should they be INST?
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+ 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(wireMockServer, "uuid-miu-svc-011-abcdef", "2",
+ "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
+ MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef",
+ "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
+ MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+
+ // TODO: the SI should NOT have to be URL-encoded yet again!
+ MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+ "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+ "GenericFlows/getServiceInstance.xml");
+
+ MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+
+ // TODO: should these really be PARENT_INST, or should they be INST?
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
StubResponseOof.mockOof(wireMockServer);
- wireMockServer.stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
- wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200)));
- wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200)));
+ wireMockServer
+ .stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
+ wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*"))
+ .willReturn(aResponse().withStatus(200)));
+ wireMockServer.stubFor(put(urlMatching(
+ ".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship"))
+ .willReturn(aResponse().withStatus(200)));
wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
MockPostRequestDB(wireMockServer);
mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = setupVariables();
- String businessKey = UUID.randomUUID().toString();
- invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+ Map<String, Object> 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(wireMockServer, "uuid-miu-svc-011-abcdef", "2",
+ "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef",
+ "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+
+ // TODO: the SI should NOT have to be URL-encoded yet again!
+ MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+ "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+ "GenericFlows/getServiceInstance.xml");
+
+ MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance_500(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+
+ mockSDNCAdapter(wireMockServer, 404);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ StubResponseOof.mockOof(wireMockServer);
+ wireMockServer
+ .stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
+ wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*"))
+ .willReturn(aResponse().withStatus(200)));
+ wireMockServer.stubFor(put(urlMatching(
+ ".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship"))
+ .willReturn(aResponse().withStatus(200)));
+ wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
+ MockPostRequestDB(wireMockServer);
+
+ Map<String, Object> 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(wireMockServer, "uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
- MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
- MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
-
- // TODO: the SI should NOT have to be URL-encoded yet again!
- MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
-
- MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance_500(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-
- mockSDNCAdapter(wireMockServer, 404);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ 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(wireMockServer, "uuid-miu-svc-011-abcdef", "2",
+ "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef",
+ "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+
+ // TODO: the SI should NOT have to be URL-encoded yet again!
+ MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+ "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+ "GenericFlows/getServiceInstance.xml");
+
+ MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID,
+ "VCPE/CreateVcpeResCustService/arGetById.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID, ARVERS);
+
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
StubResponseOof.mockOof(wireMockServer);
- wireMockServer.stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
- wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200)));
- wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200)));
+ wireMockServer
+ .stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
+ wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*"))
+ .willReturn(aResponse().withStatus(200)));
+ wireMockServer.stubFor(put(urlMatching(
+ ".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship"))
+ .willReturn(aResponse().withStatus(200)));
wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
MockPostRequestDB(wireMockServer);
-
- Map<String, Object> variables = setupVariables();
+ String req = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestRollback.json");
+
+ Map<String, Object> variables = setupVariables();
- String businessKey = UUID.randomUUID().toString();
- invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+ String businessKey = UUID.randomUUID().toString();
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, req, 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(wireMockServer, "uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
- MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
- MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
-
- // TODO: the SI should NOT have to be URL-encoded yet again!
- MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
-
- MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID, ARVERS);
-
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- StubResponseOof.mockOof(wireMockServer);
- wireMockServer.stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
- wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200)));
- wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200)));
- wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
- MockPostRequestDB(wireMockServer);
- String req = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestRollback.json");
-
- Map<String, Object> 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<String, Object> setupVariables() {
- Map<String, Object> 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;
-
- }
+ // 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<String, Object> setupVariables() {
+ Map<String, Object> 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
index aaabf59e6b..4a03aa9fd4 100644
--- 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
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
* ============LICENSE_END=========================================================
*/
@@ -37,255 +32,244 @@ 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;
-
import java.io.IOException;
import java.io.UnsupportedEncodingException;
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 com.github.tomakehurst.wiremock.stubbing.Scenario;
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(wireMockServer, 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(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
-
- /*
- * cannot use MockGetServiceInstance(wireMockServer, ), because we need to return
- * different responses as we traverse through the flow
- */
-
- // initially, the SI includes the ARs
- wireMockServer.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
- wireMockServer.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(wireMockServer, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/arGetBRGById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID, ARVERS);
-
- // for TXC
- MockQueryAllottedResourceById(wireMockServer, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/arGetTXCById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID, ARVERS);
-
- //MockGetGenericVnfById("vnfX.*", "GenericFlows/getGenericVnfByNameResponse.xml");
+ 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(wireMockServer, 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(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+
+ /*
+ * cannot use MockGetServiceInstance(wireMockServer, ), because we need to return different responses as we
+ * traverse through the flow
+ */
+
+ // initially, the SI includes the ARs
+ wireMockServer.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
+ wireMockServer.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(wireMockServer, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID,
+ "VCPE/DeleteVcpeResCustService/arGetBRGById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID, ARVERS);
+
+ // for TXC
+ MockQueryAllottedResourceById(wireMockServer, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID,
+ "VCPE/DeleteVcpeResCustService/arGetTXCById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID, ARVERS);
+
+ // MockGetGenericVnfById("vnfX.*", "GenericFlows/getGenericVnfByNameResponse.xml");
wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
.withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml")));
- wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
- .willReturn(aResponse()
- .withStatus(204)
- .withHeader("Content-Type", "text/xml")));
+ wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
+ .willReturn(aResponse().withStatus(204).withHeader("Content-Type", "text/xml")));
- MockDeleteServiceInstance(wireMockServer, CUST,SVC,INST,SVC);
+ MockDeleteServiceInstance(wireMockServer, CUST, SVC, INST, SVC);
mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = setupVariables(businessKey);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = setupVariables(businessKey);
- invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
- // for BRG
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- injectSDNCCallbacks(callbacks, "unassign");
+ // for BRG
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
- // for VNF1
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "unassign");
+ // for VNF1
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "unassign");
- // for VNF2
- 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 TXC
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
- // for SI
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
+ // for SI
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
- waitForProcessEnd(businessKey, 70000);
- assertTrue(isProcessEnded(businessKey));
+ waitForProcessEnd(businessKey, 70000);
+ assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
+ 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);
+ 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("<request-id>"+businessKey+"<"));
- assertTrue(completionReq.contains("<action>DELETE<"));
- assertTrue(completionReq.contains("<source>VID<"));
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+ assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+ assertNull(workflowException);
+ assertTrue(completionReq.contains("<request-id>" + businessKey + "<"));
+ assertTrue(completionReq.contains("<action>DELETE<"));
+ assertTrue(completionReq.contains("<source>VID<"));
- assertEquals("2", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+"vnfsDeletedCount"));
+ assertEquals("2", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + "vnfsDeletedCount"));
- BPMNUtil.assertAnyProcessInstanceFinished(processEngine, "DoDeleteVnfAndModules");
- logEnd();
- }
+ BPMNUtil.assertAnyProcessInstanceFinished(processEngine, "DoDeleteVnfAndModules");
+ logEnd();
+ }
- @Test
- public void testDeleteVcpeResCustService_NoBRG_NoTXC_NoVNF() throws Exception {
- logStart();
- MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
+ @Test
+ public void testDeleteVcpeResCustService_NoBRG_NoTXC_NoVNF() throws Exception {
+ logStart();
+ MockNodeQueryServiceInstanceById(wireMockServer, 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(wireMockServer, DEC_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(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = setupVariables(businessKey);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = setupVariables(businessKey);
- invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
- // for SI
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
+ // for SI
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
- waitForProcessEnd(businessKey, 70000);
+ waitForProcessEnd(businessKey, 70000);
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
+ 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);
+ 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("<request-id>"+businessKey+"<"));
- assertTrue(completionReq.contains("<action>DELETE<"));
- assertTrue(completionReq.contains("<source>VID<"));
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+ assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+ assertNull(workflowException);
+ assertTrue(completionReq.contains("<request-id>" + businessKey + "<"));
+ assertTrue(completionReq.contains("<action>DELETE<"));
+ assertTrue(completionReq.contains("<source>VID<"));
- assertEquals("0", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+"vnfsDeletedCount"));
+ assertEquals("0", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + "vnfsDeletedCount"));
- BPMNUtil.assertNoProcessInstance(processEngine, "DoDeleteVnfAndModules");
- logEnd();
- }
+ BPMNUtil.assertNoProcessInstance(processEngine, "DoDeleteVnfAndModules");
+ logEnd();
+ }
- @Test
- public void testDeleteVcpeResCustService_Fault() throws Exception {
- logStart();
- MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
+ @Test
+ public void testDeleteVcpeResCustService_Fault() throws Exception {
+ logStart();
+ MockNodeQueryServiceInstanceById(wireMockServer, 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(wireMockServer, DEC_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(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
- // generate failure
- mockSDNCAdapter(wireMockServer, 404);
+ // generate failure
+ mockSDNCAdapter(wireMockServer, 404);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = setupVariables(businessKey);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = setupVariables(businessKey);
- invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
- waitForProcessEnd(businessKey, 70000);
+ waitForProcessEnd(businessKey, 70000);
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
+ 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);
+ 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();
- }
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+ assertNotNull(workflowException);
+ logEnd();
+ }
- private Map<String, Object> setupVariables(String requestId) throws UnsupportedEncodingException {
- Map<String, Object> 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;
- }
+ private Map<String, Object> setupVariables(String requestId) throws UnsupportedEncodingException {
+ Map<String, Object> 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
index da9b45c8c8..291613bc1a 100644
--- 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
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
* ============LICENSE_END=========================================================
*/
@@ -29,10 +24,8 @@ 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;
@@ -40,227 +33,223 @@ 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(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> 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(wireMockServer, DEC_INST, "GenericFlows/getNotFound.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> 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(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> 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(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
-
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> 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(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(wireMockServer, 404);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> 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<String, Object> 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);
- }
+ 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(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> 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(wireMockServer, DEC_INST, "GenericFlows/getNotFound.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> 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(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> 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(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
+
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> 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(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(wireMockServer, 404);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> 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<String, Object> 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
index f0d275c5cc..cd7004e3aa 100644
--- 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
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
* ============LICENSE_END=========================================================
*/
@@ -24,12 +19,10 @@ 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;
@@ -43,281 +36,295 @@ 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 {
+ 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(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ mockSDNCAdapter(wireMockServer, 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- mockSDNCAdapter(wireMockServer, 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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<String, Object> 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", "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;
- }
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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<String, Object> 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",
+ "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
index 6ecec3240d..80c3fa16e8 100644
--- 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
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
* ============LICENSE_END=========================================================
*/
@@ -31,12 +26,10 @@ 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;
@@ -46,231 +39,227 @@ 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(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> 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(wireMockServer, DEC_INST, "GenericFlows/getNotFound.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> 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(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> 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(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
-
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
-
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> 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(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(wireMockServer, 404);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> 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<String, Object> 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);
- }
+ 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(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> 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(wireMockServer, DEC_INST, "GenericFlows/getNotFound.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> 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(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> 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(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
+
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> 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(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(wireMockServer, 404);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> 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<String, Object> 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
index 4f81a4f725..0b64f4938e 100644
--- 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
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
* ============LICENSE_END=========================================================
*/
@@ -24,12 +19,10 @@ 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;
@@ -43,281 +36,295 @@ 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(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- mockSDNCAdapter(wireMockServer, 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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<String, Object> 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", "/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;
- }
+ 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(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ mockSDNCAdapter(wireMockServer, 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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<String, Object> 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",
+ "/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
index 42f32b8ecc..e4dc5add03 100644
--- 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
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
* ============LICENSE_END=========================================================
*/
@@ -24,11 +19,9 @@ 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;
@@ -37,109 +30,114 @@ 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(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> 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(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- mockSDNCAdapter(wireMockServer, 500);
-
- Map<String, Object> 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<String, Object> 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);
- }
+ 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(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> 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(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ mockSDNCAdapter(wireMockServer, 500);
+
+ Map<String, Object> 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<String, Object> 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
index 13ca58be03..106c2f0611 100644
--- 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
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
* ============LICENSE_END=========================================================
*/
@@ -24,10 +19,8 @@ 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.*;
@@ -37,104 +30,109 @@ 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(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> 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(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> 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(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- mockSDNCAdapter(wireMockServer, 500);
-
- Map<String, Object> 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<String, Object> 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);
- }
+ 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(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> 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(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> 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(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ mockSDNCAdapter(wireMockServer, 500);
+
+ Map<String, Object> 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<String, Object> 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/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java b/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java
index db1f7cb6f9..e4f1998c40 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java
+++ b/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java
@@ -23,9 +23,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.activity;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
-
import javax.ws.rs.core.UriBuilder;
-
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.HttpClient;
@@ -36,68 +34,65 @@ import org.springframework.stereotype.Component;
@Component
public class DeployActivitySpecs {
- private static final String ACTIVITY_FILE_LOCATION = "src/main/resources/ActivitySpec/";
- private static final String ACTIVITY_SPEC_URI = "/activityspec-api/v1.0/activity-spec";
- private static final String CONTENT_TYPE_JSON = "application/json";
-
- public static void main(String[] args) throws Exception {
-
- if (args == null || args.length == 0) {
- System.out.println("Please specify hostname argument");
- return;
- }
-
- String hostname = args[0];
-
- File dir = new File(ACTIVITY_FILE_LOCATION);
- if (!dir.isDirectory()) {
- System.out.println("ActivitySpec store is not a directory");
- return;
- }
-
- for (File f : dir.listFiles()) {
- String activitySpecName = f.getName();
- String errorMessage = deployActivitySpec(hostname, activitySpecName);
- if (errorMessage == null) {
- System.out.println("Deployed Activity Spec: " + activitySpecName);
- }
- else {
- System.out.println("Error deploying Activity Spec: " + activitySpecName + " : " + errorMessage);
- }
- }
- return;
- }
-
- protected static String deployActivitySpec(String hostname, String activitySpecName) throws Exception {
- String payload = new String(Files.readAllBytes(Paths.get(ACTIVITY_FILE_LOCATION + activitySpecName)));
- try {
- HttpClient client = HttpClientBuilder.create().build();
-
- String url = UriBuilder.fromUri(hostname).path(ACTIVITY_SPEC_URI).build().toString();
- HttpPost post = new HttpPost(url);
-
- StringEntity input = new StringEntity(payload);
- input.setContentType(CONTENT_TYPE_JSON);
- post.setEntity(input);
-
- HttpResponse response = client.execute(post);
- StatusLine statusLine = response.getStatusLine();
-
- if (statusLine != null) {
- if (statusLine.getStatusCode() != 200) {
- return (statusLine.toString());
- }
- else {
- return null;
- }
- }
- else {
- return("Empty response from the remote endpoint");
- }
-
- } catch (Exception e) {
- return e.getMessage();
- }
-
- }
+ private static final String ACTIVITY_FILE_LOCATION = "src/main/resources/ActivitySpec/";
+ private static final String ACTIVITY_SPEC_URI = "/activityspec-api/v1.0/activity-spec";
+ private static final String CONTENT_TYPE_JSON = "application/json";
+
+ public static void main(String[] args) throws Exception {
+
+ if (args == null || args.length == 0) {
+ System.out.println("Please specify hostname argument");
+ return;
+ }
+
+ String hostname = args[0];
+
+ File dir = new File(ACTIVITY_FILE_LOCATION);
+ if (!dir.isDirectory()) {
+ System.out.println("ActivitySpec store is not a directory");
+ return;
+ }
+
+ for (File f : dir.listFiles()) {
+ String activitySpecName = f.getName();
+ String errorMessage = deployActivitySpec(hostname, activitySpecName);
+ if (errorMessage == null) {
+ System.out.println("Deployed Activity Spec: " + activitySpecName);
+ } else {
+ System.out.println("Error deploying Activity Spec: " + activitySpecName + " : " + errorMessage);
+ }
+ }
+ return;
+ }
+
+ protected static String deployActivitySpec(String hostname, String activitySpecName) throws Exception {
+ String payload = new String(Files.readAllBytes(Paths.get(ACTIVITY_FILE_LOCATION + activitySpecName)));
+ try {
+ HttpClient client = HttpClientBuilder.create().build();
+
+ String url = UriBuilder.fromUri(hostname).path(ACTIVITY_SPEC_URI).build().toString();
+ HttpPost post = new HttpPost(url);
+
+ StringEntity input = new StringEntity(payload);
+ input.setContentType(CONTENT_TYPE_JSON);
+ post.setEntity(input);
+
+ HttpResponse response = client.execute(post);
+ StatusLine statusLine = response.getStatusLine();
+
+ if (statusLine != null) {
+ if (statusLine.getStatusCode() != 200) {
+ return (statusLine.toString());
+ } else {
+ return null;
+ }
+ } else {
+ return ("Empty response from the remote endpoint");
+ }
+
+ } catch (Exception e) {
+ return e.getMessage();
+ }
+
+ }
}
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
index 98e613efe6..8c8981e6e6 100644
--- 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
@@ -19,14 +19,14 @@
*/
package org.onap.so;
-import org.junit.runner.RunWith;
+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
+ // 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
index 73aa0a7201..5451860a90 100644
--- 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
@@ -26,7 +26,6 @@ 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;
@@ -62,7 +61,6 @@ 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;
@@ -74,134 +72,126 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public abstract class BaseTest extends BuildingBlockTestDataSetup {
- protected Map<String, Object> variables = new HashMap<>();
-
- protected TestRestTemplate restTemplate = new TestRestTemplate();
-
- protected HttpHeaders headers = new HttpHeaders();
-
- @Value("${wiremock.server.port}")
- protected String wireMockPort;
+ protected Map<String, Object> variables = new HashMap<>();
- @Autowired
- protected RuntimeService runtimeService;
+ protected TestRestTemplate restTemplate = new TestRestTemplate();
- @Autowired
- private RepositoryService repositoryService;
- /*
- * Mocked for injection via autowiring
- */
+ protected HttpHeaders headers = new HttpHeaders();
- @Value("${mso.catalog.db.spring.endpoint}")
- protected String endpoint;
+ @Value("${wiremock.server.port}")
+ protected String wireMockPort;
- @MockBean
- protected CatalogDbClient MOCK_catalogDbClient;
+ @Autowired
+ protected RuntimeService runtimeService;
- @SpyBean
- protected InjectionHelper MOCK_injectionHelper;
+ @Autowired
+ private RepositoryService repositoryService;
+ /*
+ * Mocked for injection via autowiring
+ */
- @SpyBean
- protected NetworkAdapterObjectMapper MOCK_networkAdapterObjectMapper;
+ @Value("${mso.catalog.db.spring.endpoint}")
+ protected String endpoint;
- @SpyBean
- protected AAIObjectMapper MOCK_aaiObjectMapper;
- @SpyBean
- protected NetworkAdapterClientImpl MOCK_networkAdapterClient;
- @SpyBean
- protected SDNCClient MOCK_sdncClient;
+ @MockBean
+ protected CatalogDbClient MOCK_catalogDbClient;
- @SpyBean
- protected AAIFlagTasks aaiFlagTasks;
+ @SpyBean
+ protected InjectionHelper MOCK_injectionHelper;
- @SpyBean
- protected AAIVnfResources aaiVnfResources;
+ @SpyBean
+ protected NetworkAdapterObjectMapper MOCK_networkAdapterObjectMapper;
- @SpyBean
- protected ExceptionBuilder exceptionUtil;
+ @SpyBean
+ protected AAIObjectMapper MOCK_aaiObjectMapper;
+ @SpyBean
+ protected NetworkAdapterClientImpl MOCK_networkAdapterClient;
+ @SpyBean
+ protected SDNCClient MOCK_sdncClient;
- @SpyBean
- protected SDNOHealthCheckResources MOCK_sdnoHealthCheckResources;
+ @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
- */
+ /*
+ * 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 BBInputSetupMapperLayer SPY_bbInputSetupMapperLayer;
- @SpyBean
- protected BBInputSetupUtils SPY_bbInputSetupUtils;
- @SpyBean
- protected BBInputSetup SPY_bbInputSetup;
- @SpyBean
- protected SniroHomingV2 sniroHoming;
+ @SpyBean
+ protected SniroClient sniroClient;
- @SpyBean
- protected SniroClient sniroClient;
+ @SpyBean
+ protected SDNOHealthCheckTasks sdnoHealthCheckTasks;
- @SpyBean
- protected SDNOHealthCheckTasks sdnoHealthCheckTasks;
+ /*
+ * Mocked for injection via the IntectionHelper
+ */
- /*
- * Mocked for injection via the IntectionHelper
- */
+ @Before
+ public void baseTestBefore() {
+ variables.put("gBuildingBlockExecution", new DelegateExecutionImpl(new HashMap<>()));
- @Before
- public void baseTestBefore() {
- variables.put("gBuildingBlockExecution", new DelegateExecutionImpl(new HashMap<>()));
+ }
- }
+ @LocalServerPort
+ private int port;
- @LocalServerPort
- private int port;
+ protected String readFile(String path) throws IOException {
+ return readFile(path, Charset.defaultCharset());
+ }
- 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 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 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;
+ }
- 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();
- }
+ /**
+ * 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
index 5719ce15e2..fc5709d1be 100644
--- 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
@@ -20,6 +20,6 @@
package org.onap.so;
-public abstract class BaseUnitTest extends BuildingBlockTestDataSetup{
+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
index 6aa5cf3412..47b05f9690 100644
--- 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
@@ -21,15 +21,12 @@ package org.onap.so;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl;
import org.junit.Before;
@@ -72,507 +69,509 @@ 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<ResourceKey, String> 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<ResourceKey, String>();
- 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<String, String> buildUserInput() {
- Map<String, String> userInput = new HashMap<>();
- userInput.put("testUserInputKey", "testUserInputValue");
-
- return userInput;
- }
-
- public Map<String, String> setUserInput() {
- Map<String, String> 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<String,Object> dataMap = new HashMap<>();
- dataMap.put("vpnId","testVpnId");
- dataMap.put("vpnRegion","testVpnRegion");
- dataMap.put("vpnRt","testVpnRt");
- dataMap.put("vpnName","vpnName");
+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<ResourceKey, String> 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<ResourceKey, String>();
+ 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<String, String> buildUserInput() {
+ Map<String, String> userInput = new HashMap<>();
+ userInput.put("testUserInputKey", "testUserInputValue");
+
+ return userInput;
+ }
+
+ public Map<String, String> setUserInput() {
+ Map<String, String> 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<String, Object> 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<String,Object> userParams = new HashMap<>();
- userParams.put("vpnData",dataMap);
+ HashMap<String, Object> userParams = new HashMap<>();
+ userParams.put("vpnData", dataMap);
- List<Map<String,Object>> userParamsList = new ArrayList<>();
- userParamsList.add(userParams);
+ List<Map<String, Object>> userParamsList = new ArrayList<>();
+ userParamsList.add(userParams);
- RequestParameters requestParameters = new RequestParameters();
- requestParameters.setUserParams(userParamsList);
- requestContext.setRequestParameters(requestParameters);
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setUserParams(userParamsList);
+ requestContext.setRequestParameters(requestParameters);
- return requestContext;
- }
+ return requestContext;
+ }
- public RequestContext setRequestContext() {
- RequestContext requestContext = buildRequestContext();
+ public RequestContext setRequestContext() {
+ RequestContext requestContext = buildRequestContext();
- gBBInput.setRequestContext(requestContext);
+ gBBInput.setRequestContext(requestContext);
- return requestContext;
- }
+ return requestContext;
+ }
- public CloudRegion buildCloudRegion() {
- CloudRegion cloudRegion = new CloudRegion();
- cloudRegion.setLcpCloudRegionId("testLcpCloudRegionId");
- cloudRegion.setTenantId("testTenantId");
- cloudRegion.setCloudOwner("testCloudOwner");
+ public CloudRegion buildCloudRegion() {
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setLcpCloudRegionId("testLcpCloudRegionId");
+ cloudRegion.setTenantId("testTenantId");
+ cloudRegion.setCloudOwner("testCloudOwner");
- return cloudRegion;
- }
+ return cloudRegion;
+ }
- public CloudRegion setCloudRegion() {
- CloudRegion cloudRegion = buildCloudRegion();
+ public CloudRegion setCloudRegion() {
+ CloudRegion cloudRegion = buildCloudRegion();
- gBBInput.setCloudRegion(cloudRegion);
+ gBBInput.setCloudRegion(cloudRegion);
- return cloudRegion;
- }
+ return cloudRegion;
+ }
- public OrchestrationContext buildOrchestrationContext() {
- OrchestrationContext orchestrationContext = new OrchestrationContext();
+ public OrchestrationContext buildOrchestrationContext() {
+ OrchestrationContext orchestrationContext = new OrchestrationContext();
- return orchestrationContext;
- }
+ return orchestrationContext;
+ }
- public OrchestrationContext setOrchestrationContext() {
- OrchestrationContext orchestrationContext = buildOrchestrationContext();
+ public OrchestrationContext setOrchestrationContext() {
+ OrchestrationContext orchestrationContext = buildOrchestrationContext();
- gBBInput.setOrchContext(orchestrationContext);
+ gBBInput.setOrchContext(orchestrationContext);
- return orchestrationContext;
- }
+ return orchestrationContext;
+ }
- public Collection buildCollection() {
- collectionCounter++;
+ public Collection buildCollection() {
+ collectionCounter++;
- Collection collection = new Collection();
- collection.setId("testId" + collectionCounter);
- collection.setInstanceGroup(buildInstanceGroup());
+ Collection collection = new Collection();
+ collection.setId("testId" + collectionCounter);
+ collection.setInstanceGroup(buildInstanceGroup());
- return collection;
- }
+ return collection;
+ }
- public Configuration buildConfiguration() {
- configurationCounter++;
+ public Configuration buildConfiguration() {
+ configurationCounter++;
- Configuration configuration = new Configuration();
- configuration.setConfigurationId("testConfigurationId" + configurationCounter);
- configuration.setConfigurationName("testConfigurationName" + 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);
+ ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
+ modelInfoConfiguration.setModelVersionId("testModelVersionId" + configurationCounter);
+ modelInfoConfiguration.setModelInvariantId("testModelInvariantId" + configurationCounter);
+ modelInfoConfiguration.setModelCustomizationId("testModelCustomizationId" + configurationCounter);
- configuration.setModelInfoConfiguration(modelInfoConfiguration);
+ configuration.setModelInfoConfiguration(modelInfoConfiguration);
- return configuration;
- }
+ return configuration;
+ }
- public OwningEntity buildOwningEntity() {
- owningEntityCounter++;
+ public OwningEntity buildOwningEntity() {
+ owningEntityCounter++;
- OwningEntity owningEntity = new OwningEntity();
- owningEntity.setOwningEntityId("testOwningEntityId" + owningEntityCounter);
- owningEntity.setOwningEntityName("testOwningEntityName" + owningEntityCounter);
+ OwningEntity owningEntity = new OwningEntity();
+ owningEntity.setOwningEntityId("testOwningEntityId" + owningEntityCounter);
+ owningEntity.setOwningEntityName("testOwningEntityName" + owningEntityCounter);
- return owningEntity;
- }
+ return owningEntity;
+ }
- public Project buildProject() {
- projectCounter++;
+ public Project buildProject() {
+ projectCounter++;
- Project project = new Project();
- project.setProjectName("testProjectName" + projectCounter);
+ Project project = new Project();
+ project.setProjectName("testProjectName" + projectCounter);
- return project;
- }
+ return project;
+ }
- public ServiceSubscription buildServiceSubscription() {
- serviceSubscriptionCounter++;
+ public ServiceSubscription buildServiceSubscription() {
+ serviceSubscriptionCounter++;
- ServiceSubscription serviceSubscription = new ServiceSubscription();
- serviceSubscription.setTempUbSubAccountId("testTempUbSubAccountId" + serviceSubscriptionCounter);
- serviceSubscription.setServiceType("testServiceType" + serviceSubscriptionCounter);
+ ServiceSubscription serviceSubscription = new ServiceSubscription();
+ serviceSubscription.setTempUbSubAccountId("testTempUbSubAccountId" + serviceSubscriptionCounter);
+ serviceSubscription.setServiceType("testServiceType" + serviceSubscriptionCounter);
- return serviceSubscription;
- }
+ return serviceSubscription;
+ }
- public Customer buildCustomer() {
- customerCounter++;
+ public Customer buildCustomer() {
+ customerCounter++;
- Customer customer = new Customer();
- customer.setGlobalCustomerId("testGlobalCustomerId" + customerCounter);
- customer.setSubscriberType("testSubscriberType" + customerCounter);
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("testGlobalCustomerId" + customerCounter);
+ customer.setSubscriberType("testSubscriberType" + customerCounter);
- customer.setServiceSubscription(buildServiceSubscription());
+ customer.setServiceSubscription(buildServiceSubscription());
- return customer;
- }
+ return customer;
+ }
- public ServiceInstance buildServiceInstance() {
- serviceInstanceCounter++;
+ public ServiceInstance buildServiceInstance() {
+ serviceInstanceCounter++;
- ServiceInstance serviceInstance = new ServiceInstance();
- serviceInstance.setServiceInstanceId("testServiceInstanceId" + serviceInstanceCounter);
- serviceInstance.setServiceInstanceName("testServiceInstanceName" + 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);
+ 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.setProject(buildProject());
- serviceInstance.setOwningEntity(buildOwningEntity());
+ serviceInstance.setOwningEntity(buildOwningEntity());
- serviceInstance.setCollection(buildCollection());
+ serviceInstance.setCollection(buildCollection());
- serviceInstance.getConfigurations().add(buildConfiguration());
+ serviceInstance.getConfigurations().add(buildConfiguration());
- return serviceInstance;
- }
+ return serviceInstance;
+ }
- public ServiceInstance setServiceInstance() {
- ServiceInstance serviceInstance = buildServiceInstance();
+ 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());
+ if (gBBInput.getCustomer() == null) {
+ gBBInput.setCustomer(buildCustomer());
+ }
+ gBBInput.getCustomer().getServiceSubscription().getServiceInstances().add(serviceInstance);
+ lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId());
- return serviceInstance;
- }
+ return serviceInstance;
+ }
- public Customer setCustomer() {
- if(gBBInput.getCustomer() != null) return gBBInput.getCustomer();
- Customer customer = new Customer();
- customer.setGlobalCustomerId("testGlobalCustomerId");
- customer.setSubscriberType("testSubscriberType");
+ public Customer setCustomer() {
+ if (gBBInput.getCustomer() != null)
+ return gBBInput.getCustomer();
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("testGlobalCustomerId");
+ customer.setSubscriberType("testSubscriberType");
- customer.setServiceSubscription(buildServiceSubscription());
+ customer.setServiceSubscription(buildServiceSubscription());
- gBBInput.setCustomer(customer);
+ gBBInput.setCustomer(customer);
- return customer;
- }
+ return customer;
+ }
- public Collection setCollection() {
- Collection collection = new Collection();
- collection.setId("testId");
+ public Collection setCollection() {
+ Collection collection = new Collection();
+ collection.setId("testId");
- ServiceInstance serviceInstance = null;
+ ServiceInstance serviceInstance = null;
- try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- } catch(BBObjectNotFoundException e) {
- serviceInstance = setServiceInstance();
- }
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ } catch (BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
- serviceInstance.setCollection(collection);
+ serviceInstance.setCollection(collection);
- return collection;
- }
+ return collection;
+ }
- public InstanceGroup setInstanceGroup() {
- InstanceGroup instanceGroup = new InstanceGroup();
- instanceGroup.setId("testId");
- instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction");
+ public InstanceGroup setInstanceGroup() {
+ InstanceGroup instanceGroup = new InstanceGroup();
+ instanceGroup.setId("testId");
+ instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction");
- Collection collection = null;
+ Collection collection = null;
- try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- collection = serviceInstance.getCollection();
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ collection = serviceInstance.getCollection();
- if (collection == null) {
- collection = setCollection();
- }
- } catch(BBObjectNotFoundException e) {
- collection = setCollection();
- }
+ if (collection == null) {
+ collection = setCollection();
+ }
+ } catch (BBObjectNotFoundException e) {
+ collection = setCollection();
+ }
- collection.setInstanceGroup(instanceGroup);
+ collection.setInstanceGroup(instanceGroup);
- return instanceGroup;
- }
+ return instanceGroup;
+ }
- public VpnBinding buildVpnBinding() {
- vpnBindingCounter++;
+ public VpnBinding buildVpnBinding() {
+ vpnBindingCounter++;
- VpnBinding vpnBinding = new VpnBinding();
- vpnBinding.setVpnId("testVpnId" + vpnBindingCounter);
- vpnBinding.setVpnName("testVpnName" + vpnBindingCounter);
- vpnBinding.setCustomerVpnId("testCustomerVpnId" + vpnBindingCounter);
+ VpnBinding vpnBinding = new VpnBinding();
+ vpnBinding.setVpnId("testVpnId" + vpnBindingCounter);
+ vpnBinding.setVpnName("testVpnName" + vpnBindingCounter);
+ vpnBinding.setCustomerVpnId("testCustomerVpnId" + vpnBindingCounter);
- return vpnBinding;
- }
+ return vpnBinding;
+ }
- public VpnBinding setVpnBinding() {
- VpnBinding vpnBinding = buildVpnBinding();
+ public VpnBinding setVpnBinding() {
+ VpnBinding vpnBinding = buildVpnBinding();
- Customer customer = gBBInput.getCustomer();
+ Customer customer = gBBInput.getCustomer();
- if(customer == null){
- customer = buildCustomer();
- }
+ if (customer == null) {
+ customer = buildCustomer();
+ }
- customer.getVpnBindings().add(vpnBinding);
- lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId());
+ customer.getVpnBindings().add(vpnBinding);
+ lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId());
- return vpnBinding;
- }
+ return vpnBinding;
+ }
- public InstanceGroup buildInstanceGroup() {
- instanceGroupCounter++;
+ public InstanceGroup buildInstanceGroup() {
+ instanceGroupCounter++;
- InstanceGroup instanceGroup = new InstanceGroup();
- instanceGroup.setId("testId" + instanceGroupCounter);
- instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction" + instanceGroupCounter);
+ InstanceGroup instanceGroup = new InstanceGroup();
+ instanceGroup.setId("testId" + instanceGroupCounter);
+ instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction" + instanceGroupCounter);
- return instanceGroup;
- }
+ return instanceGroup;
+ }
- public L3Network buildL3Network() {
- l3NetworkCounter++;
+ public L3Network buildL3Network() {
+ l3NetworkCounter++;
- L3Network network = new L3Network();
- network.setNetworkId("testNetworkId" + l3NetworkCounter);
- network.setNetworkName("testNetworkName" + l3NetworkCounter);
- network.setNetworkType("testNetworkType" + 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);
+ 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;
- }
+ return network;
+ }
- public L3Network setL3Network() {
- L3Network network = buildL3Network();
+ public L3Network setL3Network() {
+ L3Network network = buildL3Network();
- ServiceInstance serviceInstance = null;
+ ServiceInstance serviceInstance = null;
- try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- } catch(BBObjectNotFoundException e) {
- serviceInstance = setServiceInstance();
- }
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ } catch (BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
- serviceInstance.getNetworks().add(network);
- lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId());
+ serviceInstance.getNetworks().add(network);
+ lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId());
- return network;
- }
+ return network;
+ }
- public GenericVnf buildGenericVnf() {
- genericVnfCounter++;
+ public GenericVnf buildGenericVnf() {
+ genericVnfCounter++;
- GenericVnf genericVnf = new GenericVnf();
- genericVnf.setVnfId("testVnfId" + genericVnfCounter);
- genericVnf.setVnfName("testVnfName" + genericVnfCounter);
- genericVnf.setVnfType("testVnfType" + 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);
+ Platform platform = new Platform();
+ platform.setPlatformName("testPlatformName");
+ genericVnf.setPlatform(platform);
- LineOfBusiness lob = new LineOfBusiness();
- lob.setLineOfBusinessName("testLineOfBusinessName");
- genericVnf.setLineOfBusiness(lob);
+ 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);
+ 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;
- }
+ return genericVnf;
+ }
- public GenericVnf setGenericVnf() {
- GenericVnf genericVnf = buildGenericVnf();
+ public GenericVnf setGenericVnf() {
+ GenericVnf genericVnf = buildGenericVnf();
- ServiceInstance serviceInstance = null;
+ ServiceInstance serviceInstance = null;
- try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- } catch(BBObjectNotFoundException e) {
- serviceInstance = setServiceInstance();
- }
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ } catch (BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
- serviceInstance.getVnfs().add(genericVnf);
- lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId());
+ serviceInstance.getVnfs().add(genericVnf);
+ lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId());
- return genericVnf;
- }
+ return genericVnf;
+ }
- public VfModule buildVfModule() {
- vfModuleCounter++;
+ public VfModule buildVfModule() {
+ vfModuleCounter++;
- VfModule vfModule = new VfModule();
- vfModule.setVfModuleId("testVfModuleId" + vfModuleCounter);
- vfModule.setVfModuleName("testVfModuleName" + 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);
+ 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;
- }
+ return vfModule;
+ }
- public VfModule setVfModule() {
- VfModule vfModule = buildVfModule();
+ public VfModule setVfModule() {
+ VfModule vfModule = buildVfModule();
- GenericVnf genericVnf = null;
+ GenericVnf genericVnf = null;
- try {
- genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- } catch(BBObjectNotFoundException e) {
- genericVnf = setGenericVnf();
- }
+ try {
+ genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ } catch (BBObjectNotFoundException e) {
+ genericVnf = setGenericVnf();
+ }
- genericVnf.getVfModules().add(vfModule);
- lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId());
+ genericVnf.getVfModules().add(vfModule);
+ lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId());
- return vfModule;
- }
+ return vfModule;
+ }
- public VolumeGroup buildVolumeGroup() {
- volumeGroupCounter++;
+ public VolumeGroup buildVolumeGroup() {
+ volumeGroupCounter++;
- VolumeGroup volumeGroup = new VolumeGroup();
- volumeGroup.setVolumeGroupId("testVolumeGroupId" + volumeGroupCounter);
- volumeGroup.setVolumeGroupName("testVolumeGroupName" + volumeGroupCounter);
- volumeGroup.setHeatStackId("testHeatStackId" + volumeGroupCounter);
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupId("testVolumeGroupId" + volumeGroupCounter);
+ volumeGroup.setVolumeGroupName("testVolumeGroupName" + volumeGroupCounter);
+ volumeGroup.setHeatStackId("testHeatStackId" + volumeGroupCounter);
- return volumeGroup;
- }
+ return volumeGroup;
+ }
- public VolumeGroup setVolumeGroup() {
- VolumeGroup volumeGroup = buildVolumeGroup();
+ public VolumeGroup setVolumeGroup() {
+ VolumeGroup volumeGroup = buildVolumeGroup();
- GenericVnf genericVnf = null;
+ GenericVnf genericVnf = null;
- try {
- genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- } catch(BBObjectNotFoundException e) {
- genericVnf = setGenericVnf();
- }
+ try {
+ genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ } catch (BBObjectNotFoundException e) {
+ genericVnf = setGenericVnf();
+ }
- genericVnf.getVolumeGroups().add(volumeGroup);
- lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId());
+ genericVnf.getVolumeGroups().add(volumeGroup);
+ lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId());
- return volumeGroup;
- }
+ return volumeGroup;
+ }
- public Pnf buildPnf() {
- pnfCounter++;
+ public Pnf buildPnf() {
+ pnfCounter++;
- Pnf pnf = new Pnf();
- pnf.setPnfId("testPnfId" + pnfCounter);
- pnf.setPnfName("testPnfName" + pnfCounter);
+ Pnf pnf = new Pnf();
+ pnf.setPnfId("testPnfId" + pnfCounter);
+ pnf.setPnfName("testPnfName" + pnfCounter);
- return pnf;
- }
+ return pnf;
+ }
- public ServiceProxy buildServiceProxy() {
- serviceProxyCounter++;
+ public ServiceProxy buildServiceProxy() {
+ serviceProxyCounter++;
ServiceProxy serviceProxy = new ServiceProxy();
serviceProxy.setServiceInstance(buildServiceInstance());
@@ -587,83 +586,83 @@ public class BuildingBlockTestDataSetup{
serviceProxy.getServiceInstance().getPnfs().add(secondaryPnf);
return serviceProxy;
- }
+ }
- public VpnBondingLink buildVpnBondingLink() {
- vpnBondingLinkCounter++;
+ public VpnBondingLink buildVpnBondingLink() {
+ vpnBondingLinkCounter++;
- VpnBondingLink vpnBondingLink = new VpnBondingLink();
- vpnBondingLink.setVpnBondingLinkId("testVpnBondingLinkId" + vpnBondingLinkCounter);
+ VpnBondingLink vpnBondingLink = new VpnBondingLink();
+ vpnBondingLink.setVpnBondingLinkId("testVpnBondingLinkId" + vpnBondingLinkCounter);
- Configuration vnrConfiguration = buildConfiguration();
- vnrConfiguration.setNetwork(buildL3Network());
- vpnBondingLink.setVnrConfiguration(vnrConfiguration);
+ Configuration vnrConfiguration = buildConfiguration();
+ vnrConfiguration.setNetwork(buildL3Network());
+ vpnBondingLink.setVnrConfiguration(vnrConfiguration);
- vpnBondingLink.setVrfConfiguration(buildConfiguration());
+ vpnBondingLink.setVrfConfiguration(buildConfiguration());
vpnBondingLink.setInfrastructureServiceProxy(buildServiceProxy());
vpnBondingLink.setTransportServiceProxy(buildServiceProxy());
- return vpnBondingLink;
- }
+ return vpnBondingLink;
+ }
- public VpnBondingLink setVpnBondingLink() {
- VpnBondingLink vpnBondingLink = buildVpnBondingLink();
+ public VpnBondingLink setVpnBondingLink() {
+ VpnBondingLink vpnBondingLink = buildVpnBondingLink();
- ServiceInstance serviceInstance = null;
+ ServiceInstance serviceInstance = null;
- try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- } catch(BBObjectNotFoundException e) {
- serviceInstance = setServiceInstance();
- }
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ } catch (BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
- serviceInstance.getVpnBondingLinks().add(vpnBondingLink);
- lookupKeyMap.put(ResourceKey.VPN_BONDING_LINK_ID, vpnBondingLink.getVpnBondingLinkId());
+ serviceInstance.getVpnBondingLinks().add(vpnBondingLink);
+ lookupKeyMap.put(ResourceKey.VPN_BONDING_LINK_ID, vpnBondingLink.getVpnBondingLinkId());
- return vpnBondingLink;
- }
+ return vpnBondingLink;
+ }
- public Customer setAvpnCustomer() {
- Customer customer = buildCustomer();
+ public Customer setAvpnCustomer() {
+ Customer customer = buildCustomer();
- gBBInput.setCustomer(customer);
+ gBBInput.setCustomer(customer);
- return customer;
- }
+ return customer;
+ }
- public ServiceProxy setServiceProxy(String uniqueIdentifier, String type) {
- ServiceProxy serviceProxy = new ServiceProxy();
- serviceProxy.setId("testProxyId" + uniqueIdentifier);
- serviceProxy.setType(type);
+ 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("testProxyModelInstanceName" + uniqueIdentifier);
+ ModelInfoServiceProxy modelInfo = new ModelInfoServiceProxy();
+ modelInfo.setModelInvariantUuid("testProxyModelInvariantUuid" + uniqueIdentifier);
+ modelInfo.setModelName("testProxyModelName" + uniqueIdentifier);
+ modelInfo.setModelUuid("testProxyModelUuid" + uniqueIdentifier);
+ modelInfo.setModelVersion("testProxyModelVersion" + uniqueIdentifier);
+ modelInfo.setModelInstanceName("testProxyModelInstanceName" + uniqueIdentifier);
- serviceProxy.setModelInfoServiceProxy(modelInfo);
+ serviceProxy.setModelInfoServiceProxy(modelInfo);
- return serviceProxy;
- }
+ return serviceProxy;
+ }
- public AllottedResource setAllottedResource(String uniqueIdentifier) {
- AllottedResource ar = new AllottedResource();
- ar.setId("testAllottedResourceId" + uniqueIdentifier);
+ 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("testAllottedModelInstanceName" + uniqueIdentifier);
+ ModelInfoAllottedResource modelInfo = new ModelInfoAllottedResource();
+ modelInfo.setModelInvariantUuid("testAllottedModelInvariantUuid" + uniqueIdentifier);
+ modelInfo.setModelName("testAllottedModelName" + uniqueIdentifier);
+ modelInfo.setModelUuid("testAllottedModelUuid" + uniqueIdentifier);
+ modelInfo.setModelVersion("testAllottedModelVersion" + uniqueIdentifier);
+ modelInfo.setModelInstanceName("testAllottedModelInstanceName" + uniqueIdentifier);
- ar.setModelInfoAllottedResource(modelInfo);
+ ar.setModelInfoAllottedResource(modelInfo);
- return ar;
- }
-} \ No newline at end of file
+ return ar;
+ }
+}
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
index fb08e5e830..62d9ecee44 100644
--- 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
@@ -19,6 +19,7 @@
*/
package org.onap.so;
+
import ch.vorburger.exec.ManagedProcessException;
import ch.vorburger.mariadb4j.DBConfigurationBuilder;
import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
@@ -35,30 +36,25 @@ public class EmbeddedMariaDbConfig {
@Bean
MariaDB4jSpringService mariaDB4jSpringService() {
- MariaDB4jSpringService service = new MariaDB4jSpringService();
-
-
- service.getConfiguration().addArg("--lower_case_table_names=1");
+ 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
+ @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();
+ 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/MockLoggerDelegate.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/MockLoggerDelegate.java
index 5d4d923426..7b049c63e3 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/MockLoggerDelegate.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/MockLoggerDelegate.java
@@ -24,12 +24,12 @@ 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");
- }
+ @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/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
index 97c17d5238..47ddea1b4f 100644
--- 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
@@ -29,78 +29,65 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-public final class SerializableChecker
-{
- public static class SerializationFailure
- {
+public final class SerializableChecker {
+ public static class SerializationFailure {
private final String mContainingClass;
private final String mMemberName;
- public SerializationFailure(String inNonSerializableClass, String inMemberName)
- {
+ public SerializationFailure(String inNonSerializableClass, String inMemberName) {
mContainingClass = inNonSerializableClass;
mMemberName = inMemberName;
}
- public String getContainingClass()
- {
+ public String getContainingClass() {
return mContainingClass;
}
- public String getMemberName()
- {
+ public String getMemberName() {
return mMemberName;
}
- public String getBadMemberString()
- {
+ public String getBadMemberString() {
if (mMemberName == null)
return mContainingClass;
return mContainingClass + "." + mMemberName;
}
@Override
- public String toString()
- {
- return "SerializationFailure [mNonSerializableClass=" + mContainingClass + ", mMemberName=" + mMemberName + "]";
+ public String toString() {
+ return "SerializationFailure [mNonSerializableClass=" + mContainingClass + ", mMemberName=" + mMemberName
+ + "]";
}
}
- private static class SerializationCheckerData
- {
+ private static class SerializationCheckerData {
private Set<Class<?>> mSerializableClasses;
- SerializationCheckerData()
- {
+ SerializationCheckerData() {
mSerializableClasses = new HashSet<Class<?>>();
}
- boolean isAlreadyChecked(Class<?> inClass)
- {
+ boolean isAlreadyChecked(Class<?> inClass) {
return mSerializableClasses.contains(inClass);
}
- void addSerializableClass(Class<?> inClass)
- {
+ void addSerializableClass(Class<?> inClass) {
mSerializableClasses.add(inClass);
}
}
- private SerializableChecker()
- { }
+ private SerializableChecker() {}
- public static SerializationFailure isFullySerializable(Class<?> inClass)
- {
+ 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))
- {
+ private static SerializationFailure isFullySerializable(Class<?> inClass,
+ SerializationCheckerData inSerializationCheckerData) {
+ for (Field field : declaredFields(inClass)) {
Class<?> fieldDeclaringClass = field.getType();
if (field.getType() == Object.class)
@@ -121,8 +108,7 @@ public final class SerializableChecker
if (inSerializationCheckerData.isAlreadyChecked(fieldDeclaringClass))
continue;
- if (isSerializable(fieldDeclaringClass))
- {
+ if (isSerializable(fieldDeclaringClass)) {
inSerializationCheckerData.addSerializableClass(inClass);
SerializationFailure failure = isFullySerializable(field.getType(), inSerializationCheckerData);
@@ -140,8 +126,7 @@ public final class SerializableChecker
return null;
}
- private static boolean isSerializable(Class<?> inClass)
- {
+ private static boolean isSerializable(Class<?> inClass) {
Set<Class<?>> interfaces = getInterfaces(inClass);
if (interfaces == null)
return false;
@@ -149,8 +134,7 @@ public final class SerializableChecker
if (isSerializable)
return true;
- for (Class<?> classInterface : interfaces)
- {
+ for (Class<?> classInterface : interfaces) {
if (isSerializable(classInterface))
return true;
}
@@ -161,13 +145,11 @@ public final class SerializableChecker
return false;
}
- private static Set<Class<?>> getInterfaces(Class<?> inFieldDeclaringClass)
- {
+ private static Set<Class<?>> getInterfaces(Class<?> inFieldDeclaringClass) {
return new HashSet<Class<?>>(Arrays.asList(inFieldDeclaringClass.getInterfaces()));
}
- private static List<Field> declaredFields(Class<?> inClass)
- {
+ private static List<Field> declaredFields(Class<?> inClass) {
List<Field> fields = new ArrayList<Field>(Arrays.asList(inClass.getDeclaredFields()));
Class<?> parentClasses = inClass.getSuperclass();
@@ -177,5 +159,5 @@ public final class SerializableChecker
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
index 11309914ef..029b77319b 100644
--- 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
@@ -30,14 +30,14 @@ import org.springframework.context.annotation.Profile;
@SpringBootApplication
@Profile("test")
-@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {
- @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
+@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class,
+ excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.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");
-
-
- }
+ 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
index deb985c62b..2a0fef0caa 100644
--- 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
@@ -94,217 +94,209 @@ import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
public abstract class BaseBPMNTest {
- @Autowired
- protected RuntimeService runtimeService;
+ @Autowired
+ protected RuntimeService runtimeService;
- @Autowired
- protected ExternalTaskService externalTaskService;
-
- @Autowired
- private RepositoryService repositoryService;
+ @Autowired
+ protected ExternalTaskService externalTaskService;
- protected Map<String, Object> variables = new HashMap<>();
+ @Autowired
+ private RepositoryService repositoryService;
- protected List<String> mockedSubprocessList = new ArrayList<>();
+ protected Map<String, Object> variables = new HashMap<>();
- protected TestRestTemplate restTemplate = new TestRestTemplate();
+ protected List<String> mockedSubprocessList = new ArrayList<>();
- protected HttpHeaders headers = new HttpHeaders();
+ protected TestRestTemplate restTemplate = new TestRestTemplate();
- @MockBean
- protected AAIUpdateTasks aaiUpdateTasks;
+ protected HttpHeaders headers = new HttpHeaders();
- @MockBean
- protected AAICreateTasks aaiCreateTasks;
+ @MockBean
+ protected AAIUpdateTasks aaiUpdateTasks;
- @MockBean
- protected AAIQueryTasks aaiQueryTasks;
+ @MockBean
+ protected AAICreateTasks aaiCreateTasks;
- @MockBean
- protected AAIDeleteTasks aaiDeleteTasks;
+ @MockBean
+ protected AAIQueryTasks aaiQueryTasks;
- @MockBean
- protected AAIFlagTasks aaiFlagTasks;
+ @MockBean
+ protected AAIDeleteTasks aaiDeleteTasks;
+ @MockBean
+ protected AAIFlagTasks aaiFlagTasks;
- @MockBean
- protected AppcRunTasks appcRunTasks;
- @MockBean
- protected SDNCActivateTasks sdncActivateTasks;
+ @MockBean
+ protected AppcRunTasks appcRunTasks;
- @MockBean
- protected SDNCAssignTasks sdncAssignTasks;
+ @MockBean
+ protected SDNCActivateTasks sdncActivateTasks;
- @MockBean
- protected SDNCUnassignTasks sdncUnassignTasks;
+ @MockBean
+ protected SDNCAssignTasks sdncAssignTasks;
- @MockBean
- protected SDNCDeactivateTasks sdncDeactivateTasks;
+ @MockBean
+ protected SDNCUnassignTasks sdncUnassignTasks;
- @MockBean
- protected SDNCQueryTasks sdncQueryTasks;
+ @MockBean
+ protected SDNCDeactivateTasks sdncDeactivateTasks;
- @MockBean
- protected SDNCChangeAssignTasks sdncChangeAssignTasks;
+ @MockBean
+ protected SDNCQueryTasks sdncQueryTasks;
- @MockBean
- protected NetworkAdapterDeleteTasks networkAdapterDeleteTasks;
+ @MockBean
+ protected SDNCChangeAssignTasks sdncChangeAssignTasks;
- @MockBean
- protected NetworkAdapterUpdateTasks networkAdapterUpdateTasks;
+ @MockBean
+ protected NetworkAdapterDeleteTasks networkAdapterDeleteTasks;
- @MockBean
- protected VnfAdapterCreateTasks vnfAdapterCreateTasks;
+ @MockBean
+ protected NetworkAdapterUpdateTasks networkAdapterUpdateTasks;
- @MockBean
- protected NetworkAdapterCreateTasks networkAdapterCreateTasks;
+ @MockBean
+ protected VnfAdapterCreateTasks vnfAdapterCreateTasks;
- @MockBean
- protected CreateNetwork createNetwork;
+ @MockBean
+ protected NetworkAdapterCreateTasks networkAdapterCreateTasks;
- @MockBean
- protected AssignNetworkBBUtils assignNetworkBBUtils;
+ @MockBean
+ protected CreateNetwork createNetwork;
- @MockBean
- protected AssignNetwork assignNetwork;
+ @MockBean
+ protected AssignNetworkBBUtils assignNetworkBBUtils;
- @MockBean
- protected CreateNetworkCollection createNetworkCollection;
+ @MockBean
+ protected AssignNetwork assignNetwork;
- @MockBean
- protected VnfAdapterDeleteTasks vnfAdapterDeleteTasks;
+ @MockBean
+ protected CreateNetworkCollection createNetworkCollection;
- @MockBean
- protected AAICommonTasks aaiCommonTasks;
+ @MockBean
+ protected VnfAdapterDeleteTasks vnfAdapterDeleteTasks;
- @MockBean
- protected ActivateVfModule activateVfModule;
-
- @MockBean
- protected AssignVnf assignVnf;
+ @MockBean
+ protected AAICommonTasks aaiCommonTasks;
- @MockBean
- protected UnassignVnf unassignVnf;
+ @MockBean
+ protected ActivateVfModule activateVfModule;
- @MockBean
- protected VnfAdapterImpl vnfAdapterImpl;
+ @MockBean
+ protected AssignVnf assignVnf;
- @MockBean
- protected UnassignNetworkBB unassignNetworkBB;
+ @MockBean
+ protected UnassignVnf unassignVnf;
- @MockBean
- protected OrchestrationStatusValidator orchestrationStatusValidator;
+ @MockBean
+ protected VnfAdapterImpl vnfAdapterImpl;
- @MockBean
- protected BBInputSetup bbInputSetup;
+ @MockBean
+ protected UnassignNetworkBB unassignNetworkBB;
- @MockBean
- protected BBInputSetupUtils bbInputSetupUtils;
+ @MockBean
+ protected OrchestrationStatusValidator orchestrationStatusValidator;
- @MockBean
- protected ExecuteBuildingBlockRainyDay executeBuildingBlockRainyDay;
+ @MockBean
+ protected BBInputSetup bbInputSetup;
- @MockBean
- protected WorkflowAction workflowAction;
-
- @MockBean
- protected WorkflowActionBBTasks workflowActionBBTasks;
-
- @MockBean
- protected GenericVnfHealthCheck genericVnfHealthCheck;
-
- @MockBean
- protected ConfigurationScaleOut configurationScaleOut;
-
- @MockBean
- protected FlowCompletionTasks flowCompletionTasks;
-
- @MockBean
- protected BuildingBlockValidatorRunner buildingBlockValidatorRunner;
-
- @MockBean
- protected SDNOHealthCheckTasks sdnoHealthCheckTasks;
-
- @MockBean
- protected SDNCClient sdncClient;
-
- @MockBean
- protected SniroHomingV2 sniroHoming;
-
- @MockBean
- protected NamingServiceDeleteTasks namingServiceDeleteTasks;
-
- @MockBean
- protected NamingServiceCreateTasks namingServiceCreateTasks;
-
- @MockBean
- protected WorkflowActionBBFailure workflowActionBBFailure;
-
- @MockBean
- protected AuditTasks auditTasks;
-
- @MockBean
- protected ManualHandlingTasks manualHandlingTasks;
-
- @LocalServerPort
- protected 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<String, String>());
- }
-
- /**
- * 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<String, String> 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());
- }
+ @MockBean
+ protected BBInputSetupUtils bbInputSetupUtils;
+
+ @MockBean
+ protected ExecuteBuildingBlockRainyDay executeBuildingBlockRainyDay;
+
+ @MockBean
+ protected WorkflowAction workflowAction;
+
+ @MockBean
+ protected WorkflowActionBBTasks workflowActionBBTasks;
+
+ @MockBean
+ protected GenericVnfHealthCheck genericVnfHealthCheck;
+
+ @MockBean
+ protected ConfigurationScaleOut configurationScaleOut;
+
+ @MockBean
+ protected FlowCompletionTasks flowCompletionTasks;
+
+ @MockBean
+ protected BuildingBlockValidatorRunner buildingBlockValidatorRunner;
+
+ @MockBean
+ protected SDNOHealthCheckTasks sdnoHealthCheckTasks;
+
+ @MockBean
+ protected SDNCClient sdncClient;
+
+ @MockBean
+ protected SniroHomingV2 sniroHoming;
+
+ @MockBean
+ protected NamingServiceDeleteTasks namingServiceDeleteTasks;
+
+ @MockBean
+ protected NamingServiceCreateTasks namingServiceCreateTasks;
+
+ @MockBean
+ protected WorkflowActionBBFailure workflowActionBBFailure;
+
+ @MockBean
+ protected AuditTasks auditTasks;
+
+ @MockBean
+ protected ManualHandlingTasks manualHandlingTasks;
+
+ @LocalServerPort
+ protected 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<String, String>());
+ }
+
+ /**
+ * 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<String, String> 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/common/AAICheckVnfInMaintBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAICheckVnfInMaintBBTest.java
index 1101fc85f5..11e6d7798d 100644
--- 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
@@ -23,37 +23,36 @@ package org.onap.so.bpmn.common;
import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat;
import static org.mockito.ArgumentMatchers.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.bpmn.BaseBPMNTest;
-public class AAICheckVnfInMaintBBTest extends BaseBPMNTest{
-
-
- @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();
- }
+public class AAICheckVnfInMaintBBTest extends BaseBPMNTest {
+
+
+ @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
index effd50fcf1..64aa06cd20 100644
--- 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
@@ -23,9 +23,7 @@ package org.onap.so.bpmn.common;
import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -33,25 +31,26 @@ import org.junit.Test;
import org.onap.so.bpmn.BaseBPMNTest;
public class AAISetVnfInMaintBBTest extends BaseBPMNTest {
-
-
- @Test
- public void sunnyDayAAISetVnfInMaintBBTest() throws InterruptedException, IOException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("AAISetVnfInMaintBB", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_AAISetVnfInMaintBB", "Task_SetInMaint", "End_AAISetVnfInMaintBB");
- }
-
- @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();
- }
-
-
+
+
+ @Test
+ public void sunnyDayAAISetVnfInMaintBBTest() throws InterruptedException, IOException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("AAISetVnfInMaintBB", variables);
+ assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_AAISetVnfInMaintBB", "Task_SetInMaint",
+ "End_AAISetVnfInMaintBB");
+ }
+
+ @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
index 7da8823c56..c67db438d9 100644
--- 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
@@ -23,9 +23,7 @@ package org.onap.so.bpmn.common;
import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -33,27 +31,28 @@ import org.junit.Test;
import org.onap.so.bpmn.BaseBPMNTest;
public class AAIUnsetVnfInMaintBBTest extends BaseBPMNTest {
-
-
- @Test
- 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();
- }
-
-
+
+
+ @Test
+ 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
index 70351f9aad..ed1fb3fd91 100644
--- 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
@@ -23,9 +23,7 @@ package org.onap.so.bpmn.common;
import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -33,27 +31,28 @@ import org.junit.Test;
import org.onap.so.bpmn.BaseBPMNTest;
public class SDNOHealthCheckBBTest extends BaseBPMNTest {
-
- @Test
-
- 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();
- }
-
-
+
+ @Test
+
+ 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/activity/DeployActivitySpecsTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecsTest.java
index a346aaf571..64c0e54a10 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecsTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecsTest.java
@@ -24,7 +24,6 @@ import static org.junit.Assert.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-
import org.apache.http.HttpResponse;
import org.apache.http.ProtocolVersion;
import org.apache.http.client.HttpClient;
@@ -35,34 +34,34 @@ import org.junit.Test;
import org.onap.so.bpmn.BaseBPMNTest;
-public class DeployActivitySpecsTest extends BaseBPMNTest{
- private static final String RESULT_STRING = "HTTP/1.1 404 ";
+public class DeployActivitySpecsTest extends BaseBPMNTest {
+ private static final String RESULT_STRING = "HTTP/1.1 404 ";
+
-
- @Test
- public void DeployActivitySpecsMain_Test() throws Exception {
- String HOSTNAME = createURLWithPort("");
- ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1);
- HttpResponse response = new BasicHttpResponse(protocolVersion, 1, "");
- response.setStatusCode(404);
- response.setStatusLine(protocolVersion, 1, "");
- HttpClient clientMock = mock(HttpClient.class);
- when(clientMock.execute(any(HttpPost.class))).thenReturn(response);
- String[] args = new String[] {HOSTNAME};
- DeployActivitySpecs.main(args);
+ @Test
+ public void DeployActivitySpecsMain_Test() throws Exception {
+ String HOSTNAME = createURLWithPort("");
+ ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1);
+ HttpResponse response = new BasicHttpResponse(protocolVersion, 1, "");
+ response.setStatusCode(404);
+ response.setStatusLine(protocolVersion, 1, "");
+ HttpClient clientMock = mock(HttpClient.class);
+ when(clientMock.execute(any(HttpPost.class))).thenReturn(response);
+ String[] args = new String[] {HOSTNAME};
+ DeployActivitySpecs.main(args);
}
-
- @Test
- @Ignore
- public void DeployActivitySpec_Test() throws Exception {
- String HOSTNAME = createURLWithPort("");
- ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1);
- HttpResponse response = new BasicHttpResponse(protocolVersion, 1, "");
- response.setStatusCode(404);
- response.setStatusLine(protocolVersion, 1, "");
- HttpClient clientMock = mock(HttpClient.class);
- when(clientMock.execute(any(HttpPost.class))).thenReturn(response); ;
- String result = DeployActivitySpecs.deployActivitySpec(HOSTNAME, "VNFQuiesceTrafficActivitySpec.json");
- assertEquals(result, RESULT_STRING);
+
+ @Test
+ @Ignore
+ public void DeployActivitySpec_Test() throws Exception {
+ String HOSTNAME = createURLWithPort("");
+ ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1);
+ HttpResponse response = new BasicHttpResponse(protocolVersion, 1, "");
+ response.setStatusCode(404);
+ response.setStatusLine(protocolVersion, 1, "");
+ HttpClient clientMock = mock(HttpClient.class);
+ when(clientMock.execute(any(HttpPost.class))).thenReturn(response);;
+ String result = DeployActivitySpecs.deployActivitySpec(HOSTNAME, "VNFQuiesceTrafficActivitySpec.json");
+ assertEquals(result, RESULT_STRING);
}
}
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
index 3ab1c76ee6..051f373eaf 100644
--- 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
@@ -23,11 +23,9 @@ package org.onap.so.bpmn.infrastructure.bpmn.process;
import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -37,99 +35,117 @@ 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<String, String> map = new HashMap<>();
- map.put("handlingCode", "Success");
- mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map);
-
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", "Task_SendSync",
- "Task_SelectBB", "Call_ExecuteBB", "ExclusiveGateway_Finished", "ExclusiveGateway_isTopLevelFlowCompleted", "Task_UpdateRequestComplete",
- "End_WorkflowActionBB");
-
- }
-
- @Test
- public void sunnyDaySuccessNotTopLevelFlow() throws InterruptedException, IOException {
- variables.put("isTopLevelFlow", false);
- variables.put("completed", true);
-
- Map<String, String> map = new HashMap<>();
- map.put("handlingCode", "Success");
- mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map);
-
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow",
- "Task_SelectBB", "Call_ExecuteBB", "ExclusiveGateway_Finished", "ExclusiveGateway_isTopLevelFlowCompleted", "End_WorkflowActionBB");
- }
-
- @Test
- public void sunnyDayRollback() throws InterruptedException, IOException {
- variables.put("isTopLevelFlow", false);
- variables.put("isRollbackNeeded", false);
-
- Map<String, String> map = new HashMap<>();
- map.put("handlingCode", "Rollback");
- mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map);
-
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow",
- "Task_SelectBB", "Call_ExecuteBB", "ExclusiveGateway_Finished", "Task_RollbackExecutionPath", "Task_UpdateRequestToFailed", "End_RollbackFailed");
-
- }
-
- @Test
- public void rainyDayAbort() throws Exception {
- variables.put("isTopLevelFlow", true);
- variables.put("completed", false);
-
- Map<String, String> map = new HashMap<>();
- map.put("handlingCode", "Abort");
-
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(workflowActionBBFailure).abortCallErrorHandling(any(DelegateExecution.class));
- mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map);
-
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", "Task_SendSync",
- "Task_SelectBB", "Call_ExecuteBB", "ExclusiveGateway_Finished", "ExclusiveGateway_isTopLevelFlowAbort", "Task_AbortAndCallErrorHandling", "ErrorStart",
- "Task_UpdateDb", "ErrorEnd");
-
- }
-
- @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");
-
- }
-
- @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().isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList", "StartEvent_runtimeError", "ServiceTask_HandleRuntimeError", "SubProcess_0fuugr9", "ErrorStart", "ExclusiveGateway_10q79b6", "Task_SendSyncAckError", "Task_UpdateDb", "ErrorEnd", "SubProcess_18226x4");
-
- }
-
- @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().isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList","ExclusiveGateway_isTopLevelFlow","Task_SendSync","Task_SelectBB", "ErrorStart", "ExclusiveGateway_10q79b6", "Task_SendSyncAckError", "Task_UpdateDb", "ErrorEnd", "SubProcess_18226x4");
-
- }
+
+ @Test
+ public void sunnyDaySuccessIsTopLevelFlow() throws InterruptedException, IOException {
+ variables.put("isTopLevelFlow", true);
+ variables.put("completed", true);
+
+ Map<String, String> map = new HashMap<>();
+ map.put("handlingCode", "Success");
+ mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map);
+
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables);
+ assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB",
+ "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", "Task_SendSync", "Task_SelectBB",
+ "Call_ExecuteBB", "ExclusiveGateway_Finished", "ExclusiveGateway_isTopLevelFlowCompleted",
+ "Task_UpdateRequestComplete", "End_WorkflowActionBB");
+
+ }
+
+ @Test
+ public void sunnyDaySuccessNotTopLevelFlow() throws InterruptedException, IOException {
+ variables.put("isTopLevelFlow", false);
+ variables.put("completed", true);
+
+ Map<String, String> map = new HashMap<>();
+ map.put("handlingCode", "Success");
+ mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map);
+
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables);
+ assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB",
+ "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", "Task_SelectBB", "Call_ExecuteBB",
+ "ExclusiveGateway_Finished", "ExclusiveGateway_isTopLevelFlowCompleted", "End_WorkflowActionBB");
+ }
+
+ @Test
+ public void sunnyDayRollback() throws InterruptedException, IOException {
+ variables.put("isTopLevelFlow", false);
+ variables.put("isRollbackNeeded", false);
+
+ Map<String, String> map = new HashMap<>();
+ map.put("handlingCode", "Rollback");
+ mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map);
+
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables);
+ assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB",
+ "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", "Task_SelectBB", "Call_ExecuteBB",
+ "ExclusiveGateway_Finished", "Task_RollbackExecutionPath", "Task_UpdateRequestToFailed",
+ "End_RollbackFailed");
+
+ }
+
+ @Test
+ public void rainyDayAbort() throws Exception {
+ variables.put("isTopLevelFlow", true);
+ variables.put("completed", false);
+
+ Map<String, String> map = new HashMap<>();
+ map.put("handlingCode", "Abort");
+
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(workflowActionBBFailure)
+ .abortCallErrorHandling(any(DelegateExecution.class));
+ mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map);
+
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables);
+ assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB",
+ "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", "Task_SendSync", "Task_SelectBB",
+ "Call_ExecuteBB", "ExclusiveGateway_Finished", "ExclusiveGateway_isTopLevelFlowAbort",
+ "Task_AbortAndCallErrorHandling", "ErrorStart", "Task_UpdateDb", "ErrorEnd");
+
+ }
+
+ @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");
+
+ }
+
+ @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().isStarted().hasPassedInOrder("Start_WorkflowActionBB",
+ "Task_RetrieveBBExectuionList", "StartEvent_runtimeError", "ServiceTask_HandleRuntimeError",
+ "SubProcess_0fuugr9", "ErrorStart", "ExclusiveGateway_10q79b6", "Task_SendSyncAckError",
+ "Task_UpdateDb", "ErrorEnd", "SubProcess_18226x4");
+
+ }
+
+ @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().isStarted().hasPassedInOrder("Start_WorkflowActionBB",
+ "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", "Task_SendSync", "Task_SelectBB",
+ "ErrorStart", "ExclusiveGateway_10q79b6", "Task_SendSyncAckError", "Task_UpdateDb", "ErrorEnd",
+ "SubProcess_18226x4");
+
+ }
}
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
index dcf679610e..affe1857bd 100644
--- 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
@@ -23,30 +23,30 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat;
import static org.mockito.ArgumentMatchers.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{
+public class ActivateNetworkBBTest extends BaseBPMNTest {
@Test
public void sunnyDayActivateNetwork_Test() throws InterruptedException {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateNetworkBB", variables);
assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("activateNetwork_startEvent","Activate_Network_SDNC_ServiceTask","CallActivity_sdncHandler","Activate_Network_AAI_ServiceTask","activateNetwork_EndEvent");
+ assertThat(pi).isStarted().hasPassedInOrder("activateNetwork_startEvent", "Activate_Network_SDNC_ServiceTask",
+ "CallActivity_sdncHandler", "Activate_Network_AAI_ServiceTask", "activateNetwork_EndEvent");
assertThat(pi).isEnded();
}
- @Test
- public void rainyDayActivateNetwork_Test() throws Exception {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusActiveNetwork(any(BuildingBlockExecution.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateNetworkBB", variables);
- assertThat(pi).isStarted()
- .hasPassedInOrder("activateNetwork_startEvent","Activate_Network_SDNC_ServiceTask","Activate_Network_AAI_ServiceTask")
- .hasNotPassed("activateNetwork_EndEvent").isEnded();
- }
+ @Test
+ public void rainyDayActivateNetwork_Test() throws Exception {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks)
+ .updateOrchestrationStatusActiveNetwork(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateNetworkBB", variables);
+ assertThat(pi).isStarted().hasPassedInOrder("activateNetwork_startEvent", "Activate_Network_SDNC_ServiceTask",
+ "Activate_Network_AAI_ServiceTask").hasNotPassed("activateNetwork_EndEvent").isEnded();
+ }
}
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
index c6c301476e..0f0c373c03 100644
--- 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
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -30,22 +30,23 @@ import org.junit.Test;
import org.onap.so.bpmn.BaseBPMNTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-public class ActivateNetworkCollectionBBTest extends BaseBPMNTest{
+public class ActivateNetworkCollectionBBTest extends BaseBPMNTest {
@Test
public void sunnyDayActivateNetworkCollection_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateNetworkCollectionBB",variables);
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateNetworkCollectionBB", variables);
assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("activateNetworkCollection_startEvent","Activate_Network_Collection_AAI_ServiceTask","activateNetworkCollection_EndEvent");
+ 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().isStarted()
- .hasPassedInOrder("activateNetworkCollection_startEvent")
- .hasNotPassed("activateNetworkCollection_EndEvent");
- }
+ @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().isStarted().hasPassedInOrder("activateNetworkCollection_startEvent")
+ .hasNotPassed("activateNetworkCollection_EndEvent");
+ }
}
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
index efe7d87fb2..9eefaded9c 100644
--- 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
@@ -19,22 +19,21 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
-import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
+import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.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();
- }
+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
index deac50ca30..6f89f3c738 100644
--- 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
@@ -19,13 +19,13 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import java.io.IOException;
import java.util.List;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.externaltask.LockedExternalTask;
import org.camunda.bpm.engine.runtime.ProcessInstance;
@@ -34,52 +34,55 @@ import org.junit.Test;
import org.onap.so.bpmn.BaseBPMNTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-public class ActivateVfModuleBBTest extends BaseBPMNTest{
-
- @Before
- public void before() {
- variables.put("vfModuleActivateTimerDuration", "PT2S");
- variables.put("auditInventoryNeeded", "true");
- variables.put("auditIsSuccessful", "true");
- }
+public class ActivateVfModuleBBTest extends BaseBPMNTest {
+
+ @Before
+ public void before() {
+ variables.put("vfModuleActivateTimerDuration", "PT2S");
+ variables.put("auditInventoryNeeded", "true");
+ variables.put("auditIsSuccessful", "true");
+ }
- @Test
- public void sunnyDay() throws InterruptedException, IOException {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables);
- List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
+ @Test
+ public void sunnyDay() throws InterruptedException, IOException {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables);
+ List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
.topic("InventoryAddAudit", 60L * 1000L).execute();
while (!tasks.isEmpty()) {
for (LockedExternalTask task : tasks) {
externalTaskService.complete(task.getId(), "externalWorkerId");
}
- tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
- .topic("InventoryAddAudit", 60L * 1000L).execute();
+ tasks = externalTaskService.fetchAndLock(100, "externalWorkerId").topic("InventoryAddAudit", 60L * 1000L)
+ .execute();
}
-
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("ActivateVfModuleBB_Start","ExclusiveGateway_1v8bmbu","Setup_AAI_Inventory_Audit", "Audit_AAI_Inventory", "ActivateVfModule", "CallActivity_sdncHandler",
- "UpdateVfModuleActiveStatus", "ActivateVfModuleBB_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDay() throws Exception {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- doThrow(BpmnError.class).when(aaiUpdateTasks).updateOrchestrationStatusActivateVfModule(any(BuildingBlockExecution.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables);
- List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
+
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("ActivateVfModuleBB_Start", "ExclusiveGateway_1v8bmbu",
+ "Setup_AAI_Inventory_Audit", "Audit_AAI_Inventory", "ActivateVfModule", "CallActivity_sdncHandler",
+ "UpdateVfModuleActiveStatus", "ActivateVfModuleBB_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDay() throws Exception {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ doThrow(BpmnError.class).when(aaiUpdateTasks)
+ .updateOrchestrationStatusActivateVfModule(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables);
+ List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
.topic("InventoryAddAudit", 60L * 1000L).execute();
while (!tasks.isEmpty()) {
for (LockedExternalTask task : tasks) {
externalTaskService.complete(task.getId(), "externalWorkerId");
}
- tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
- .topic("InventoryAddAudit", 60L * 1000L).execute();
+ tasks = externalTaskService.fetchAndLock(100, "externalWorkerId").topic("InventoryAddAudit", 60L * 1000L)
+ .execute();
}
- assertThat(pi).isNotNull().isStarted()
- .hasPassedInOrder("ActivateVfModuleBB_Start","ExclusiveGateway_1v8bmbu","Setup_AAI_Inventory_Audit", "Audit_AAI_Inventory", "ActivateVfModule", "UpdateVfModuleActiveStatus")
- .hasNotPassed("ActivateVfModuleBB_End");
- }
+ assertThat(pi).isNotNull().isStarted()
+ .hasPassedInOrder("ActivateVfModuleBB_Start", "ExclusiveGateway_1v8bmbu", "Setup_AAI_Inventory_Audit",
+ "Audit_AAI_Inventory", "ActivateVfModule", "UpdateVfModuleActiveStatus")
+ .hasNotPassed("ActivateVfModuleBB_End");
+ }
}
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
index d1d95fee71..7a78a6a6e2 100644
--- 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
@@ -19,23 +19,22 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
-import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
+import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.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 {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVnfBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("Start_ActivateVnfBB", "Task_SDNCAdapterVnfTopologyActivate",
- "CallActivity_sdncHandler", "Task_ActivateOrchestrationStatusVnf", "End_ActivateVnfBB");
- assertThat(pi).isEnded();
- }
+public class ActivateVnfBBTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDay() throws InterruptedException, IOException {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVnfBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("Start_ActivateVnfBB", "Task_SDNCAdapterVnfTopologyActivate",
+ "CallActivity_sdncHandler", "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
index 8fc198ffcd..602f1c874f 100644
--- 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
@@ -19,33 +19,34 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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();
- }
+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();
- }
+ @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/AssignNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetworkBBTest.java
index c581a16349..42291a9593 100644
--- 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
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -30,26 +30,33 @@ import org.junit.Test;
import org.onap.so.bpmn.BaseBPMNTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-public class AssignNetworkBBTest extends BaseBPMNTest{
+public class AssignNetworkBBTest extends BaseBPMNTest {
@Test
- @Deployment(resources = { "subprocess/AssignNetworkRollbackBB.bpmn"})
+ @Deployment(resources = {"subprocess/AssignNetworkRollbackBB.bpmn"})
public void sunnyDayAssignNetwork_Test() throws InterruptedException {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignNetworkBB",variables);
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ 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","CallActivity_sdncHandlerCall","ServiceTask_assign_network_aai","AssignNetworkBB_end");
+ 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", "CallActivity_sdncHandlerCall", "ServiceTask_assign_network_aai",
+ "AssignNetworkBB_end");
assertThat(pi).isEnded();
}
- @Test
- public void rainyDayAssignNetwork_Test() throws Exception {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- 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();
- }
+ @Test
+ public void rainyDayAssignNetwork_Test() throws Exception {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ 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
index 2624cc0ccb..f45ed935a6 100644
--- 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
@@ -19,24 +19,23 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
-import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
+import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.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 {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignServiceInstanceBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("Start_AssignServiceInstanceBB", "Task_CreateServiceInstance",
- "Task_CreateProject", "Task_CreateOwningEntity", "Task_AssignServiceInstance", "CallActivity_sdncHandler",
- "Task_UpdateServiceOstatusToAssigned", "End_AssignServiceInstanceBB");
- assertThat(pi).isEnded();
- }
+public class AssignServiceInstanceBBTest extends BaseBPMNTest {
+
+ @Test
+ public void sunnyDaySDNC() throws InterruptedException, IOException {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignServiceInstanceBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("Start_AssignServiceInstanceBB", "Task_CreateServiceInstance",
+ "Task_CreateProject", "Task_CreateOwningEntity", "Task_AssignServiceInstance",
+ "CallActivity_sdncHandler", "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
index 44d17a350c..358d1a2789 100644
--- 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
@@ -19,40 +19,36 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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 {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVfModuleBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("AssignVfModuleBB_Start",
- "CreateVfModule",
- "ConnectVfModuleToVolumeGroup",
- "AssignVfModule",
- "CallActivity_sdncHandlerCall",
- "UpdateVfModuleStatus",
- "AssignVfModuleBB_End");
- assertThat(pi).isEnded();
- }
+public class AssignVfModuleBBTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayAssignVfModule_Test() throws InterruptedException {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVfModuleBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("AssignVfModuleBB_Start", "CreateVfModule",
+ "ConnectVfModuleToVolumeGroup", "AssignVfModule", "CallActivity_sdncHandlerCall",
+ "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();
- }
+ @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
index f4258f46b8..078b0ae4e2 100644
--- 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
@@ -19,12 +19,11 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -32,27 +31,29 @@ 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);
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVnfBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("Start_AssignVnfBB", "Task_CreateVnf", "ServiceTask_ConnectVnfToCloudRegion", "ServiceTask_ConnectVnfToTenant", "Task_createPlatform", "Task_createLineOfBusiness", "Task_createInstanceGroups",
- "Task_callHoming", "Task_SDNCAdapterVnfTopologyAssign","CallActivity_sdncAssign", "Task_UpdateVnfOrchestrationStatusAssigned",
- "End_AssignVnfBB");
- assertThat(pi).isEnded();
- }
+ @Test
+ public void sunnyDayAssignVnfBBTest() throws InterruptedException, IOException {
+ variables.put("callHoming", true);
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVnfBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("Start_AssignVnfBB", "Task_CreateVnf",
+ "ServiceTask_ConnectVnfToCloudRegion", "ServiceTask_ConnectVnfToTenant", "Task_createPlatform",
+ "Task_createLineOfBusiness", "Task_createInstanceGroups", "Task_callHoming",
+ "Task_SDNCAdapterVnfTopologyAssign", "CallActivity_sdncAssign",
+ "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();
- }
+ @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
index e39370b951..0de657ed7f 100644
--- 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
@@ -19,33 +19,34 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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();
- }
+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();;
- }
+ @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/BuildingBlockValidatorRunnerTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/BuildingBlockValidatorRunnerTest.java
index a241ae5eff..a036f6713e 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/BuildingBlockValidatorRunnerTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/BuildingBlockValidatorRunnerTest.java
@@ -27,16 +27,16 @@ import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.junit.Test;
import org.onap.so.bpmn.BaseBPMNTest;
-public class BuildingBlockValidatorRunnerTest extends BaseBPMNTest{
+public class BuildingBlockValidatorRunnerTest extends BaseBPMNTest {
@Test
public void sunnyDayActivateNetwork_Test() throws InterruptedException {
- variables.put("flowToBeCalled","CreateVolumeGroupBB");
+ variables.put("flowToBeCalled", "CreateVolumeGroupBB");
ProcessInstance pi = runtimeService.startProcessInstanceByKey("BuildingBlockValidatorRunnerTest", variables);
assertThat(pi).isNotNull();
-
+
execute(job());
execute(job());
- assertThat(pi).isStarted().hasPassedInOrder("ServiceTask_1","ServiceTask_2","ServiceTask_3");
+ assertThat(pi).isStarted().hasPassedInOrder("ServiceTask_1", "ServiceTask_2", "ServiceTask_3");
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
index 1772a3af4b..832ee528a1 100644
--- 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
@@ -19,35 +19,40 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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() {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("ChangeModelServiceInstanceBB", variables);
- assertThat(processInstance).isNotNull();
- assertThat(processInstance).isStarted().hasPassedInOrder("ChangeModelServiceInstance_Start" ,"SDNCChangeModelServiceInstance", "CallActivity_sdncHandlerReq", "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();
- }
+public class ChangeModelServiceInstanceBBTest extends BaseBPMNTest {
+ @Test
+ public void changeModelVnfBBTest() {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ ProcessInstance processInstance =
+ runtimeService.startProcessInstanceByKey("ChangeModelServiceInstanceBB", variables);
+ assertThat(processInstance).isNotNull();
+ assertThat(processInstance).isStarted().hasPassedInOrder("ChangeModelServiceInstance_Start",
+ "SDNCChangeModelServiceInstance", "CallActivity_sdncHandlerReq", "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
index 8549b6bc5a..42be6a5711 100644
--- 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
@@ -19,36 +19,37 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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 {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("ChangeModelVfModuleBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("ChangeModelVfModuleBB_Start", "ChangeModelVfModule", "CallActivity_sdncHandler", "UpdateVfModuleModel", "ChangeModelVfModuleBB_End");
- assertThat(pi).isEnded();
- }
+public class ChangeModelVfModuleBBTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayChangeModelVfModuleTest() throws InterruptedException {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("ChangeModelVfModuleBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("ChangeModelVfModuleBB_Start", "ChangeModelVfModule",
+ "CallActivity_sdncHandler", "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();
+ }
+
- @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
index 43ac1630df..a7835e30f0 100644
--- 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
@@ -19,35 +19,36 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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() {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("ChangeModelVnfBB", variables);
- assertThat(processInstance).isNotNull();
- assertThat(processInstance).isStarted().hasPassedInOrder("ChangeModelVnf_Start" ,"SDNCChangeModel", "CallActivity_sdncHandlerCall", "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();
- }
+public class ChangeModelVnfBBTest extends BaseBPMNTest {
+ @Test
+ public void changeModelVnfBBTest() {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("ChangeModelVnfBB", variables);
+ assertThat(processInstance).isNotNull();
+ assertThat(processInstance).isStarted().hasPassedInOrder("ChangeModelVnf_Start", "SDNCChangeModel",
+ "CallActivity_sdncHandlerCall", "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/ConfigurationScaleOutBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java
index 4602ff97ce..8a19bc2561 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java
@@ -19,15 +19,13 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -36,23 +34,23 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
public class ConfigurationScaleOutBBTest extends BaseBPMNTest {
- @Test
- public void sunnyDayConfigurationScaleOutBBTest() throws InterruptedException, IOException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("ConfigurationScaleOutBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("Start_ConfigScaleOutBB", "QueryVfModule", "GetConfigScaleOutParams",
- "Call-AppC-ConfigScaleOut", "End_ConfigScaleOutBB");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void configurationScaleOutBBExceptionTest() throws Exception {
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncQueryTasks).queryVfModule(any(BuildingBlockExecution.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("ConfigurationScaleOutBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted()
- .hasPassedInOrder("Start_ConfigScaleOutBB", "QueryVfModule")
- .hasNotPassed("GetConfigScaleOutParams", "Call-AppC-ConfigScaleOut", "End_ConfigScaleOutBB");
- assertThat(pi).isEnded();
- }
+ @Test
+ public void sunnyDayConfigurationScaleOutBBTest() throws InterruptedException, IOException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("ConfigurationScaleOutBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("Start_ConfigScaleOutBB", "QueryVfModule",
+ "GetConfigScaleOutParams", "Call-AppC-ConfigScaleOut", "End_ConfigScaleOutBB");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void configurationScaleOutBBExceptionTest() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncQueryTasks)
+ .queryVfModule(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("ConfigurationScaleOutBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("Start_ConfigScaleOutBB", "QueryVfModule")
+ .hasNotPassed("GetConfigScaleOutParams", "Call-AppC-ConfigScaleOut", "End_ConfigScaleOutBB");
+ assertThat(pi).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
index 91d3fd20a2..ee85f9bc05 100644
--- 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
@@ -19,34 +19,35 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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();
- }
+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();
- }
+ @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
index 0aba1cc484..ece5b93ee2 100644
--- 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
@@ -19,35 +19,37 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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{
+public class CreateNetworkBBTest extends BaseBPMNTest {
@Test
public void sunnyDayCreateNetwork_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkBB",variables);
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkBB", variables);
assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("createNetwork_startEvent", "ServiceTask_get_cloud_region", "QueryVpnBinding_ServiceTask", "QueryNetworkPolicy_ServiceTask", "QueryNetworkTableRef_ServiceTask", "QueryNetworkSubnet_ServiceTask", "Create_Network_ServiceTask", "Update_Network_AAI_ServiceTask", "createNetwork_EndEvent");
+ assertThat(pi).isStarted().hasPassedInOrder("createNetwork_startEvent", "ServiceTask_get_cloud_region",
+ "QueryVpnBinding_ServiceTask", "QueryNetworkPolicy_ServiceTask", "QueryNetworkTableRef_ServiceTask",
+ "QueryNetworkSubnet_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")
- .hasNotPassed("End Flow");
- 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").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
index 5c67324e0a..1d9cf5ad69 100644
--- 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
@@ -19,33 +19,36 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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{
+public class CreateNetworkCollectionBBTest extends BaseBPMNTest {
@Test
public void sunnyDayCreateNetworkCollection_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkCollectionBB",variables);
+ 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_InstanceGroup_to_CloudRegion", "ServiceTask_Connect_Collection_to_ServiceInstance", "createNetworkCollection_EndEvent");
+ assertThat(pi).isStarted().hasPassedInOrder("createNetworkCollection_startEvent", "BuildName_ServiceTask",
+ "ServiceTask_create_NetworkCollection", "ServiceTask_create_NetworkCollectionInstanceGroup",
+ "ServiceTask_Connect_Collection_to_InstanceGroup", "ServiceTask_Connect_InstanceGroup_to_CloudRegion",
+ "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();
- }
+ @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
index 8c44309cca..4c5edade6e 100644
--- 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
@@ -19,100 +19,99 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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 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",
- "CreateNetworkPolicies",
- "UpdateVnfIpv4OamAddress",
- "UpdateVnfManagementV6Address",
- "UpdateVfModuleContrailServiceInstanceFqdn",
- "UpdateVfModuleHeatStackId",
- "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", "CreateNetworkPolicies", "UpdateVnfIpv4OamAddress",
- "UpdateVnfManagementV6Address","UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId",
- "UpdateVfModuleStatus", "CreateVfModuleBB_End");
- assertThat(pi).isEnded();
- }
+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", "CreateNetworkPolicies", "UpdateVnfIpv4OamAddress",
+ "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn",
+ "UpdateVfModuleHeatStackId", "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", "CreateNetworkPolicies", "UpdateVnfIpv4OamAddress",
+ "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn",
+ "UpdateVfModuleHeatStackId", "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", "CreateNetworkPolicies", "UpdateVnfIpv4OamAddress",
+ "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn",
+ "UpdateVfModuleHeatStackId", "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", "CreateNetworkPolicies", "UpdateVnfIpv4OamAddress",
+ "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn",
+ "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayCreateVfModuleUpdateVfModuleHeatStackIdError_Test() throws Exception {
+ mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub");
+
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks)
+ .updateHeatStackIdVfModule(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted()
+ .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter",
+ "CreateNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address",
+ "UpdateVfModuleContrailServiceInstanceFqdn", "UpdateVfModuleHeatStackId")
+ .hasNotPassed("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", "CreateNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address",
- "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId", "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", "CreateNetworkPolicies","UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address",
- "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayCreateVfModuleUpdateVfModuleHeatStackIdError_Test() throws Exception {
- mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub");
+ }
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateHeatStackIdVfModule(any(BuildingBlockExecution.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted()
- .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter", "CreateNetworkPolicies",
- "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId")
- .hasNotPassed("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", "CreateNetworkPolicies",
- "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId",
- "UpdateVfModuleStatus")
- .hasNotPassed("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",
+ "CreateNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address",
+ "UpdateVfModuleContrailServiceInstanceFqdn", "UpdateVfModuleHeatStackId",
+ "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
index 34a17cbb89..c7eb2ac3d1 100644
--- 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
@@ -19,48 +19,54 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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().hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter", "Vnf_Adapter", "UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End");
- assertThat(pi).isEnded();
- assertThat(pi).hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter", "Vnf_Adapter","UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End");
- }
+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().hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC",
+ "CreateVolumeGroupVnfAdapter", "Vnf_Adapter", "UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI",
+ "CreateVolumeGroupBB_End");
+ 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()
+ .hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter")
+ .hasNotPassed("UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End");
+ assertThat(pi).isEnded();
+ }
- @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()
- .hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter")
- .hasNotPassed("UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayCreateVolumeGroupUpdateHeatStackIdError_Test() throws Exception {
- mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub");
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateHeatStackIdVolumeGroup(any(BuildingBlockExecution.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVolumeGroupBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted()
- .hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter", "Vnf_Adapter")
- .hasNotPassed("UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End");
- assertThat(pi).isEnded();
- }
+ @Test
+ public void rainyDayCreateVolumeGroupUpdateHeatStackIdError_Test() throws Exception {
+ mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub");
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks)
+ .updateHeatStackIdVolumeGroup(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVolumeGroupBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi)
+ .isStarted().hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC",
+ "CreateVolumeGroupVnfAdapter", "Vnf_Adapter")
+ .hasNotPassed("UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End");
+ assertThat(pi).isEnded();
+ }
}
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
index ad93eec514..548dca2225 100644
--- 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
@@ -19,35 +19,36 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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 {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateNetworkBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("DeactivateNetworkBB_Start", "DeactivateNetworkSDNC", "CallActivity_sdncHandler","DeactivateNetworkAAI", "DeactivateNetworkBB_End");
- assertThat(pi).isEnded();
- }
+public class DeactivateNetworkBBTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayDeactivateNetworkBB_Test() throws InterruptedException {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateNetworkBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("DeactivateNetworkBB_Start", "DeactivateNetworkSDNC",
+ "CallActivity_sdncHandler", "DeactivateNetworkAAI", "DeactivateNetworkBB_End");
+ assertThat(pi).isEnded();
+ }
- @Test
- public void rainyDayDeactivateNetworkBB_Test() throws Exception {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- 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();
- }
+ @Test
+ public void rainyDayDeactivateNetworkBB_Test() throws Exception {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ 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
index 428713d9a7..ba9beabce7 100644
--- 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
@@ -19,8 +19,8 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
-import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.junit.Test;
import org.onap.so.bpmn.BaseBPMNTest;
@@ -28,13 +28,15 @@ import org.onap.so.bpmn.BaseBPMNTest;
/**
* Unit test cases for DeActivateServiceInstanceTest.bpmn
*/
-public class DeactivateServiceInstanceBBTest extends BaseBPMNTest{
- @Test
- public void sunnyDayDeactivateServiceInstanceSDNC() throws InterruptedException {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateServiceInstanceBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("Start_DeactivateServiceInstanceBB", "Task_DeactivateServiceInstance_SDNC", "CallActivity_sdncHandler", "Task_DeactivateServiceInstance_AAI", "End_DeactivateServiceInstanceBB");
- assertThat(pi).isEnded();
- }
+public class DeactivateServiceInstanceBBTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayDeactivateServiceInstanceSDNC() throws InterruptedException {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateServiceInstanceBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("Start_DeactivateServiceInstanceBB",
+ "Task_DeactivateServiceInstance_SDNC", "CallActivity_sdncHandler", "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
index c7232e504e..945c212f90 100644
--- 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
@@ -19,39 +19,39 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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 {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVfModuleBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("DeactivateVfModuleBB_Start", "DeactivateVfModule", "CallActivity_sdncHandler",
- "UpdateVfModuleDeactivateStatus", "DeactivateVfModuleBB_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDay() throws Exception {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- 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();
-
- }
+public class DeactivateVfModuleBBTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDay() throws InterruptedException, IOException {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVfModuleBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("DeactivateVfModuleBB_Start", "DeactivateVfModule",
+ "CallActivity_sdncHandler", "UpdateVfModuleDeactivateStatus", "DeactivateVfModuleBB_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDay() throws Exception {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ 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
index bf5e228cbf..0ecf0448e2 100644
--- 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
@@ -19,49 +19,48 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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 {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVnfBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("Start_DeactivateVnfBB","Task_SDNCAdapterVnfTopologyDeactivate",
- "CallActivity_sdncHandler", "Task_DeactivateOrchestrationStatusVnf", "End_DeactivateVnfBB");
- assertThat(pi).isEnded();
- }
+public class DeactivateVnfBBTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDay() throws InterruptedException, IOException {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVnfBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("Start_DeactivateVnfBB", "Task_SDNCAdapterVnfTopologyDeactivate",
+ "CallActivity_sdncHandler", "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 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 {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- 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();
- }
+ @Test
+ public void rainyDayDeactivateVnfAAIError_Test() throws Exception {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ 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
index 8ed3e0710f..ab0903d645 100644
--- 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
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -30,22 +30,23 @@ 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 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();
- }
+ @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/DeleteInstanceGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteInstanceGroupBBTest.java
index 6dc36ae100..b527e8887e 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteInstanceGroupBBTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteInstanceGroupBBTest.java
@@ -18,36 +18,35 @@
* ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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 DeleteInstanceGroupBBTest extends BaseBPMNTest{
- @Test
- public void sunnyDay() throws InterruptedException, IOException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteInstanceGroupBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("DeleteInstanceGroupBB_Start", "DeleteInstanceGroupNaming", "DeleteInstanceGroupAAI",
- "DeleteInstanceGroupBB_End");
- assertThat(pi).isEnded();
- }
+public class DeleteInstanceGroupBBTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDay() throws InterruptedException, IOException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteInstanceGroupBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("DeleteInstanceGroupBB_Start", "DeleteInstanceGroupNaming",
+ "DeleteInstanceGroupAAI", "DeleteInstanceGroupBB_End");
+ assertThat(pi).isEnded();
+ }
- @Test
- public void rainyDay() throws Exception {
- doThrow(BpmnError.class).when(aaiDeleteTasks).deleteInstanceGroup(any(BuildingBlockExecution.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteInstanceGroupBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted()
- .hasPassedInOrder("DeleteInstanceGroupBB_Start", "DeleteInstanceGroupNaming", "DeleteInstanceGroupAAI")
- .hasNotPassed("DeleteInstanceGroupBB_End");
- assertThat(pi).isEnded();
- }
+ @Test
+ public void rainyDay() throws Exception {
+ doThrow(BpmnError.class).when(aaiDeleteTasks).deleteInstanceGroup(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteInstanceGroupBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted()
+ .hasPassedInOrder("DeleteInstanceGroupBB_Start", "DeleteInstanceGroupNaming", "DeleteInstanceGroupAAI")
+ .hasNotPassed("DeleteInstanceGroupBB_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
index ce25a42a26..5a62436bfc 100644
--- 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
@@ -19,33 +19,34 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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{
+public class DeleteNetworkBBTest extends BaseBPMNTest {
@Test
public void sunnyDayDeleteNetwork_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteNetworkBB",variables);
+ 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", "updateNetworkAAI", "deleteNetwork_endEvent");
+ assertThat(pi).isStarted().hasPassedInOrder("deleteNetwork_startEvent", "deleteNetworkAIC")
+ .hasNotPassed("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
index 388f169b9c..f1da33d75a 100644
--- 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
@@ -19,34 +19,36 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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{
+public class DeleteNetworkCollectionBBTest extends BaseBPMNTest {
@Test
public void sunnyDayCreateNetworkCollection_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteNetworkCollectionBB",variables);
+ 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).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();
- }
+ @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
index 48ae22cb1a..e88df73f39 100644
--- 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
@@ -18,13 +18,12 @@
* ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doThrow;
-
import java.io.IOException;
import java.util.List;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.externaltask.LockedExternalTask;
import org.camunda.bpm.engine.runtime.ProcessInstance;
@@ -33,55 +32,54 @@ import org.junit.Test;
import org.onap.so.bpmn.BaseBPMNTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-public class DeleteVfModuleBBTest extends BaseBPMNTest{
+public class DeleteVfModuleBBTest extends BaseBPMNTest {
- @Before
- public void before() {
- variables.put("auditInventoryNeeded", true);
- }
+ @Before
+ public void before() {
+ variables.put("auditInventoryNeeded", true);
+ }
- @Test
- public void sunnyDay() throws InterruptedException, IOException {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub");
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVfModuleBB", variables);
- List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
+ @Test
+ public void sunnyDay() throws InterruptedException, IOException {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub");
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVfModuleBB", variables);
+ List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
.topic("InventoryDeleteAudit", 60L * 1000L).execute();
while (!tasks.isEmpty()) {
for (LockedExternalTask task : tasks) {
externalTaskService.complete(task.getId(), "externalWorkerId");
}
- tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
- .topic("InventoryDeleteAudit", 60L * 1000L).execute();
+ tasks = externalTaskService.fetchAndLock(100, "externalWorkerId").topic("InventoryDeleteAudit", 60L * 1000L)
+ .execute();
}
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassed("DeleteVfModuleBB_Start","ExclusiveGateway_0xrgzm7","ExclusiveGateway_1yvh16a","Check_Audit",
- "Setup_Audit_Variable","Audit_Inventory","DeleteVfModuleVnfAdapter", "VnfAdapter",
- "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address",
- "UpdateVfModuleContrailServiceInstanceFqdn",
- "UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End");
- assertThat(pi).isEnded();
- }
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassed("DeleteVfModuleBB_Start", "ExclusiveGateway_0xrgzm7",
+ "ExclusiveGateway_1yvh16a", "Check_Audit", "Setup_Audit_Variable", "Audit_Inventory",
+ "DeleteVfModuleVnfAdapter", "VnfAdapter", "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress",
+ "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn",
+ "UpdateVfModuleHeatStackId", "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);
- List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
+ @Test
+ public void rainyDay() throws Exception {
+ doThrow(BpmnError.class).when(vnfAdapterDeleteTasks).deleteVfModule(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVfModuleBB", variables);
+ List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
.topic("InventoryDeleteAudit", 60L * 1000L).execute();
while (!tasks.isEmpty()) {
for (LockedExternalTask task : tasks) {
externalTaskService.complete(task.getId(), "externalWorkerId");
}
- tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
- .topic("InventoryDeleteAudit", 60L * 1000L).execute();
+ tasks = externalTaskService.fetchAndLock(100, "externalWorkerId").topic("InventoryDeleteAudit", 60L * 1000L)
+ .execute();
}
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted()
- .hasPassed("DeleteVfModuleBB_Start", "DeleteVfModuleVnfAdapter")
- .hasNotPassed("VnfAdapter", "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address",
- "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus",
- "DeleteVfModuleBB_End");
- assertThat(pi).isEnded();
- }
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassed("DeleteVfModuleBB_Start", "DeleteVfModuleVnfAdapter").hasNotPassed(
+ "VnfAdapter", "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address",
+ "UpdateVfModuleContrailServiceInstanceFqdn", "UpdateVfModuleHeatStackId", "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
index 2336bb54ca..00adcd2c59 100644
--- 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
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -30,24 +30,26 @@ 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 {
- mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub");
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVolumeGroupBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("DeleteVolumeGroupBB_Start", "DeleteVolumeGroupVnfAdapter", "VnfAdapter", "UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI", "DeleteVolumeGroupBB_End");
- assertThat(pi).isEnded();
- }
+ @Test
+ public void sunnyDayDeleteVolumeGroup_Test() throws InterruptedException {
+ mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub");
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVolumeGroupBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("DeleteVolumeGroupBB_Start", "DeleteVolumeGroupVnfAdapter",
+ "VnfAdapter", "UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI", "DeleteVolumeGroupBB_End");
+ assertThat(pi).isEnded();
+ }
- @Test
- public void rainyDayDeleteVolumeGroup_Test() throws Exception {
- mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub");
- 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", "VnfAdapter", "UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI")
- .hasNotPassed("DeleteVolumeGroupBB_End");
- assertThat(pi).isEnded();
- }
+ @Test
+ public void rainyDayDeleteVolumeGroup_Test() throws Exception {
+ mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub");
+ 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",
+ "VnfAdapter", "UpdateVolumeGroupHeatStackId", "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/DistributeTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficActivityTest.java
index 35fbaa1a04..8306de4794 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficActivityTest.java
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
import org.onap.appc.client.lcm.model.Action;
-public class DistributeTrafficActivityTest extends BaseBPMNTest{
- @Test
- public void sunnyDayDistributeTrafficActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("DistributeTrafficActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("DistributeTrafficActivity_Start",
- "TaskPreProcessActivity",
- "TaskDistributeTraffic",
- "DistributeTrafficActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayDistributeTrafficActivity_Test() throws Exception {
- variables.put("actionDistributeTraffic", Action.DistributeTraffic);
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
- .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("DistributeTrafficActivity", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("DistributeTrafficActivity_Start",
- "TaskPreProcessActivity",
- "TaskDistributeTraffic").hasNotPassed(
- "DistributeTrafficActivity_End");
- }
-
+public class DistributeTrafficActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayDistributeTrafficActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DistributeTrafficActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("DistributeTrafficActivity_Start", "TaskPreProcessActivity",
+ "TaskDistributeTraffic", "DistributeTrafficActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayDistributeTrafficActivity_Test() throws Exception {
+ variables.put("actionDistributeTraffic", Action.DistributeTraffic);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DistributeTrafficActivity", variables);
+ assertThat(pi).isNotNull().isStarted()
+ .hasPassedInOrder("DistributeTrafficActivity_Start", "TaskPreProcessActivity", "TaskDistributeTraffic")
+ .hasNotPassed("DistributeTrafficActivity_End");
+ }
+
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java
index e360c83335..195a1ed809 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -30,28 +30,26 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
import org.onap.appc.client.lcm.model.Action;
-public class DistributeTrafficCheckActivityTest extends BaseBPMNTest{
- @Test
- public void sunnyDayDistributeTrafficCheckActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("DistributeTrafficCheckActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("DistributeTrafficCheckActivity_Start",
- "TaskPreProcessActivity",
- "TaskDistributeTrafficCheck",
- "DistributeTrafficCheckActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayDistributeTrafficActivity_Test() throws Exception {
- variables.put("actionDistributeTrafficCheck", Action.DistributeTrafficCheck);
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
- .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("DistributeTrafficCheckActivity", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("DistributeTrafficCheckActivity_Start",
- "TaskPreProcessActivity",
- "TaskDistributeTrafficCheck").hasNotPassed(
- "DistributeTrafficCheckActivity_End");
- }
-
+public class DistributeTrafficCheckActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayDistributeTrafficCheckActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DistributeTrafficCheckActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("DistributeTrafficCheckActivity_Start", "TaskPreProcessActivity",
+ "TaskDistributeTrafficCheck", "DistributeTrafficCheckActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayDistributeTrafficActivity_Test() throws Exception {
+ variables.put("actionDistributeTrafficCheck", Action.DistributeTrafficCheck);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DistributeTrafficCheckActivity", variables);
+ assertThat(pi)
+ .isNotNull().isStarted().hasPassedInOrder("DistributeTrafficCheckActivity_Start",
+ "TaskPreProcessActivity", "TaskDistributeTrafficCheck")
+ .hasNotPassed("DistributeTrafficCheckActivity_End");
+ }
+
}
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
index 03e50591c7..07554cdf97 100644
--- 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
@@ -19,14 +19,13 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.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;
@@ -46,86 +45,98 @@ 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 runExecuteFlowTest() {
-
- variables.put("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.CONTINUE);
- variables.put("flowToBeCalled", "MockFlow");
-
- mockSubprocess("MockFlow", "My Mock Process Name", "GenericStub");
-
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("ExecuteBuildingBlock", variables);
-
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted()
- .hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "StatusPolicy", "CheckOrchestrationStatusValidationResults", "Task_PreValidate", "Call_BBToExecute", "Task_PostValidate", "Task_setHandlingCodeSuccess", "End_ExecuteBuildingBlock");
- assertThat(pi).isEnded();
-
-
- }
- @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","Task_setHandlingCodeSuccess", "End_ExecuteBuildingBlock")
- .hasNotPassed("Call_BBToExecute", "ErrorStart", "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", "ExclusiveGateway_1aonzik", "ErrorEnd2", "Task_SetRetryTimer");
- assertThat(pi).isEnded();
- }
-
- @Test
- @Ignore
- 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", "StartEvent_0tmcs9g", "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", "EndEvent_0mvmk3i", "SubProcess_0tv8zda")
- .hasNotPassed("StatusPolicy", "CheckOrchestrationStatusValidationResults", "Task_setHandlingCodeSuccess","Call_BBToExecute", "End_ExecuteBuildingBlock", "ExclusiveGateway_0ey4zpt", "Task_SetRetryTimer");
- assertThat(pi).isEnded();
- }
-
- @Test
- @Ignore
- 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", "StartEvent_0tmcs9g", "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", "ExclusiveGateway_0ey4zpt", "ErrorEnd2")
- .hasNotPassed("StatusPolicy", "CheckOrchestrationStatusValidationResults", "Task_setHandlingCodeSuccess","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", "Task_setHandlingCodeSuccess","Call_BBToExecute", "End_ExecuteBuildingBlock", "ErrorEnd2");
- }
+ @Autowired
+ private TaskService taskService;
+ @Autowired
+ private ManagementService managementService;
+
+ @Test
+ public void runExecuteFlowTest() {
+
+ variables.put("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.CONTINUE);
+ variables.put("flowToBeCalled", "MockFlow");
+
+ mockSubprocess("MockFlow", "My Mock Process Name", "GenericStub");
+
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("ExecuteBuildingBlock", variables);
+
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "StatusPolicy",
+ "CheckOrchestrationStatusValidationResults", "Task_PreValidate", "Call_BBToExecute",
+ "Task_PostValidate", "Task_setHandlingCodeSuccess", "End_ExecuteBuildingBlock");
+ assertThat(pi).isEnded();
+
+
+ }
+
+ @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", "Task_setHandlingCodeSuccess", "End_ExecuteBuildingBlock")
+ .hasNotPassed("Call_BBToExecute", "ErrorStart", "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik",
+ "ExclusiveGateway_1aonzik", "ErrorEnd2", "Task_SetRetryTimer");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ @Ignore
+ 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", "StartEvent_0tmcs9g",
+ "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", "EndEvent_0mvmk3i", "SubProcess_0tv8zda")
+ .hasNotPassed("StatusPolicy", "CheckOrchestrationStatusValidationResults",
+ "Task_setHandlingCodeSuccess", "Call_BBToExecute", "End_ExecuteBuildingBlock",
+ "ExclusiveGateway_0ey4zpt", "Task_SetRetryTimer");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ @Ignore
+ 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", "StartEvent_0tmcs9g",
+ "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", "ExclusiveGateway_0ey4zpt", "ErrorEnd2")
+ .hasNotPassed("StatusPolicy", "CheckOrchestrationStatusValidationResults",
+ "Task_setHandlingCodeSuccess", "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",
+ "Task_setHandlingCodeSuccess", "Call_BBToExecute", "End_ExecuteBuildingBlock", "ErrorEnd2");
+ }
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java
index 26e8fcb5b9..1b0e8ed8a3 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java
@@ -19,37 +19,35 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
-public class FlowCompleteActivity extends BaseBPMNTest{
- @Test
- public void sunnyDayFlowCompleteActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("FlowCompleteActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("FlowCompleteActivity_Start",
- "TaskUpdateRequestDB",
- "FlowCompleteActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayFlowCompleteActivity_Test() throws Exception {
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(flowCompletionTasks)
- .updateRequestDbStatus(any(BuildingBlockExecution.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("FlowCompleteActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("FlowCompleteActivity_Start",
- "TaskUpdateRequestDB").hasNotPassed(
- "FlowCompleteActivity_End");
- assertThat(pi).isEnded();
- }
-
+public class FlowCompleteActivity extends BaseBPMNTest {
+ @Test
+ public void sunnyDayFlowCompleteActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("FlowCompleteActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("FlowCompleteActivity_Start", "TaskUpdateRequestDB",
+ "FlowCompleteActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayFlowCompleteActivity_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(flowCompletionTasks)
+ .updateRequestDbStatus(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("FlowCompleteActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("FlowCompleteActivity_Start", "TaskUpdateRequestDB")
+ .hasNotPassed("FlowCompleteActivity_End");
+ assertThat(pi).isEnded();
+ }
+
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java
index c321ca1f71..b10a1007f5 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java
@@ -19,12 +19,11 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -34,27 +33,27 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
public class GenericVnfHealthCheckBBTest extends BaseBPMNTest {
-
- @Test
- public void sunnyDayGenericVnfHealthCheckBBTest() throws InterruptedException, IOException {
-
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("GenericVnfHealthCheckBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("Start_GenericVnfHealthChkBB", "SetParamsHealthCheck",
- "Call-AppC-HealthCheck", "End_GenericVnfHealthChkBB");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void genericVnfHealthCheckBBExceptionTest() throws Exception {
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(genericVnfHealthCheck).setParamsForGenericVnfHealthCheck(any(BuildingBlockExecution.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("GenericVnfHealthCheckBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted()
- .hasPassedInOrder("Start_GenericVnfHealthChkBB", "SetParamsHealthCheck")
- .hasNotPassed("Call-AppC-HealthCheck", "End_GenericVnfHealthChkBB");
- assertThat(pi).isEnded();
- }
+
+ @Test
+ public void sunnyDayGenericVnfHealthCheckBBTest() throws InterruptedException, IOException {
+
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("GenericVnfHealthCheckBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("Start_GenericVnfHealthChkBB", "SetParamsHealthCheck",
+ "Call-AppC-HealthCheck", "End_GenericVnfHealthChkBB");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void genericVnfHealthCheckBBExceptionTest() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(genericVnfHealthCheck)
+ .setParamsForGenericVnfHealthCheck(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("GenericVnfHealthCheckBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("Start_GenericVnfHealthChkBB", "SetParamsHealthCheck")
+ .hasNotPassed("Call-AppC-HealthCheck", "End_GenericVnfHealthChkBB");
+ assertThat(pi).isEnded();
+ }
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/HomingBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/HomingBBTest.java
index 27bb328177..f1bb1462d6 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/HomingBBTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/HomingBBTest.java
@@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -34,37 +33,36 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.springframework.boot.test.mock.mockito.MockBean;
-public class HomingBBTest extends BaseBPMNTest{
+public class HomingBBTest extends BaseBPMNTest {
+
+ @Test
+ public void testHomingV2_success() {
+ mockSubprocess("ReceiveWorkflowMessage", "Mock ReceiveWorkflowMessage", "GenericStub");
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("HomingBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("start", "sniroOofCheck", "callSniro", "ExclusiveGateway_1ckp059",
+ "receiveAsyncCallback", "sniroOofCheck2", "processSniroSolution", "ExclusiveGateway_1kvzxpb", "end");
+ assertThat(pi).isEnded();
+ }
- @Test
- public void testHomingV2_success(){
- mockSubprocess("ReceiveWorkflowMessage", "Mock ReceiveWorkflowMessage", "GenericStub");
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("HomingBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("start", "sniroOofCheck", "callSniro", "ExclusiveGateway_1ckp059", "receiveAsyncCallback", "sniroOofCheck2", "processSniroSolution", "ExclusiveGateway_1kvzxpb", "end");
- assertThat(pi).isEnded();
- }
+ @Test
+ public void testHomingV2_error_bpmnError() {
+ doThrow(new BpmnError("MSOWorkflowException")).when(sniroHoming).callSniro(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("HomingBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassed("start", "sniroOofCheck", "startBpmnError", "bpmnErrorSubprocess",
+ "processMsoWorkflowException", "endBpmnError").hasNotPassed("callReceiveAsync");
+ assertThat(pi).isEnded();
+ }
- @Test
- public void testHomingV2_error_bpmnError(){
- doThrow(new BpmnError("MSOWorkflowException")).when(sniroHoming).callSniro(any(BuildingBlockExecution.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("HomingBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted()
- .hasPassed("start", "sniroOofCheck", "startBpmnError", "bpmnErrorSubprocess", "processMsoWorkflowException", "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("HomingBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted()
- .hasPassed("start", "sniroOofCheck", "callSniro", "startJavaError", "processJavaException", "javaExceptionSubProcess", "endJavaError")
- .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("HomingBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassed("start", "sniroOofCheck", "callSniro", "startJavaError",
+ "processJavaException", "javaExceptionSubProcess", "endJavaError").hasNotPassed("callReceiveAsync");
+ assertThat(pi).isEnded();
+ }
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java
index faf485f0d7..484f9b8506 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java
@@ -19,11 +19,11 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doThrow;
-
import org.camunda.bpm.engine.ManagementService;
import org.camunda.bpm.engine.TaskService;
import org.camunda.bpm.engine.delegate.BpmnError;
@@ -37,67 +37,60 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.onap.so.bpmn.BaseBPMNTest;
-public class PauseForManualTaskActivityTest extends BaseBPMNTest{
- private static final String TIMEOUT_10_S = "PT10S";
-
- @Autowired
- protected ManagementService managementService;
-
- @Autowired
- protected TaskService taskService;
-
- @Test
- public void sunnyDayPauseForManualTaskTimeout_Test() throws InterruptedException {
- variables.put("taskTimeout", TIMEOUT_10_S);
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskActivity", variables);
- assertThat(pi).isNotNull();
- BpmnAwareAssertions.assertThat(pi).isWaitingAt("ManualUserTask");
- Task task = taskService.createTaskQuery().active().list().get(0);
- assertThat(pi).task().isNotNull();
- assertNotNull(task);
-
- Job job = managementService.createJobQuery().activityId("ManualTaskTimer").singleResult();
- assertNotNull(job);
- managementService.executeJob(job.getId());
-
- assertThat(pi).isStarted().hasPassedInOrder("PauseForManualTaskActivity_Start",
- "UpdateDbStatusToPendingManualTask",
- "CreateExternalTicket",
- "ManualTaskTimer",
- "UpdateDBStatusToTimeout",
- "ThrowTimeoutError");
- }
-
- @Test
- public void sunnyDayPauseForManualTaskCompleted_Test() throws InterruptedException {
- variables.put("taskTimeout", TIMEOUT_10_S);
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskActivity", variables);
- assertThat(pi).isNotNull();
- BpmnAwareAssertions.assertThat(pi).isWaitingAt("ManualUserTask");
- assertThat(pi).task().isNotNull();
- Task task = taskService.createTaskQuery().active().list().get(0);
- assertNotNull(task);
- taskService.complete(task.getId());
-
- assertThat(pi).isStarted().hasPassedInOrder("PauseForManualTaskActivity_Start",
- "UpdateDbStatusToPendingManualTask",
- "CreateExternalTicket",
- "ManualUserTask",
- "UpdateDbStatusToInProgress",
- "PauseForManualTaskActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayPauseForManualTask_Test() throws Exception {
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(manualHandlingTasks).createExternalTicket((any(DelegateExecution.class)));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskActivity", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("PauseForManualTaskActivity_Start",
- "UpdateDbStatusToPendingManualTask",
- "CreateExternalTicket").hasNotPassed(
- "ManualUserTask",
- "UpdateDbStatusToInProgress",
- "PauseForManualTaskActivity_End");
- }
-
+public class PauseForManualTaskActivityTest extends BaseBPMNTest {
+ private static final String TIMEOUT_10_S = "PT10S";
+
+ @Autowired
+ protected ManagementService managementService;
+
+ @Autowired
+ protected TaskService taskService;
+
+ @Test
+ public void sunnyDayPauseForManualTaskTimeout_Test() throws InterruptedException {
+ variables.put("taskTimeout", TIMEOUT_10_S);
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskActivity", variables);
+ assertThat(pi).isNotNull();
+ BpmnAwareAssertions.assertThat(pi).isWaitingAt("ManualUserTask");
+ Task task = taskService.createTaskQuery().active().list().get(0);
+ assertThat(pi).task().isNotNull();
+ assertNotNull(task);
+
+ Job job = managementService.createJobQuery().activityId("ManualTaskTimer").singleResult();
+ assertNotNull(job);
+ managementService.executeJob(job.getId());
+
+ assertThat(pi).isStarted().hasPassedInOrder("PauseForManualTaskActivity_Start",
+ "UpdateDbStatusToPendingManualTask", "CreateExternalTicket", "ManualTaskTimer",
+ "UpdateDBStatusToTimeout", "ThrowTimeoutError");
+ }
+
+ @Test
+ public void sunnyDayPauseForManualTaskCompleted_Test() throws InterruptedException {
+ variables.put("taskTimeout", TIMEOUT_10_S);
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskActivity", variables);
+ assertThat(pi).isNotNull();
+ BpmnAwareAssertions.assertThat(pi).isWaitingAt("ManualUserTask");
+ assertThat(pi).task().isNotNull();
+ Task task = taskService.createTaskQuery().active().list().get(0);
+ assertNotNull(task);
+ taskService.complete(task.getId());
+
+ assertThat(pi).isStarted().hasPassedInOrder("PauseForManualTaskActivity_Start",
+ "UpdateDbStatusToPendingManualTask", "CreateExternalTicket", "ManualUserTask",
+ "UpdateDbStatusToInProgress", "PauseForManualTaskActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayPauseForManualTask_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(manualHandlingTasks)
+ .createExternalTicket((any(DelegateExecution.class)));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskActivity", variables);
+ assertThat(pi).isNotNull().isStarted()
+ .hasPassedInOrder("PauseForManualTaskActivity_Start", "UpdateDbStatusToPendingManualTask",
+ "CreateExternalTicket")
+ .hasNotPassed("ManualUserTask", "UpdateDbStatusToInProgress", "PauseForManualTaskActivity_End");
+ }
+
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/SDNCHandlerTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/SDNCHandlerTest.java
index ad9f97f951..199ada5909 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/SDNCHandlerTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/SDNCHandlerTest.java
@@ -22,13 +22,11 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
import static org.mockito.Mockito.doReturn;
-
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
-
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.junit.Test;
import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
@@ -37,41 +35,45 @@ import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCRequest;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
-
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-public class SDNCHandlerTest extends BaseBPMNTest{
- @Test
- public void sunnyDay_SDNCHandler_Sync_Final_Test() throws InterruptedException, MapperException, BadResponseException, IOException {
- final String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/SDNCClientPut200Response.json")));
- doReturn(sdncResponse).when(sdncClient).post(createSDNCRequest().getSDNCPayload(),SDNCTopology.CONFIGURATION);
- Map<String, Object> startVariables = new HashMap<>();
- startVariables.put("SDNCRequest", createSDNCRequest());
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("SDNCHandler", startVariables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("SDNC_Start","SNDC_SetupCallback","Call_SDNC","isAsync_Gateway","SDNC_End").isEnded();
- }
+public class SDNCHandlerTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDay_SDNCHandler_Sync_Final_Test()
+ throws InterruptedException, MapperException, BadResponseException, IOException {
+ final String sdncResponse =
+ new String(Files.readAllBytes(Paths.get("src/test/resources/SDNCClientPut200Response.json")));
+ doReturn(sdncResponse).when(sdncClient).post(createSDNCRequest().getSDNCPayload(), SDNCTopology.CONFIGURATION);
+ Map<String, Object> startVariables = new HashMap<>();
+ startVariables.put("SDNCRequest", createSDNCRequest());
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("SDNCHandler", startVariables);
+ assertThat(pi).isNotNull().isStarted()
+ .hasPassedInOrder("SDNC_Start", "SNDC_SetupCallback", "Call_SDNC", "isAsync_Gateway", "SDNC_End")
+ .isEnded();
+ }
- public SDNCRequest createSDNCRequest(){
- SDNCRequest request = new SDNCRequest();
- request.setCorrelationName("correlationName");
- request.setCorrelationValue("correlationValue");
- request.setTopology(SDNCTopology.CONFIGURATION);
- ObjectMapper mapper = new ObjectMapper();
- try {
- GenericResourceApiServiceOperationInformation sdncReq =
- mapper.readValue(Files.readAllBytes(Paths.get("src/test/resources/SDNC_Client_Request.json")), GenericResourceApiServiceOperationInformation.class);
- request.setSDNCPayload(sdncReq);
- } catch (JsonParseException e) {
+ public SDNCRequest createSDNCRequest() {
+ SDNCRequest request = new SDNCRequest();
+ request.setCorrelationName("correlationName");
+ request.setCorrelationValue("correlationValue");
+ request.setTopology(SDNCTopology.CONFIGURATION);
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ GenericResourceApiServiceOperationInformation sdncReq =
+ mapper.readValue(Files.readAllBytes(Paths.get("src/test/resources/SDNC_Client_Request.json")),
+ GenericResourceApiServiceOperationInformation.class);
+ request.setSDNCPayload(sdncReq);
+ } catch (JsonParseException e) {
- } catch (JsonMappingException e) {
+ } catch (JsonMappingException e) {
- } catch (IOException e) {
+ } catch (IOException e) {
- }
+ }
- return request;
- }
+ return request;
+ }
}
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
index b65f30fa9a..c20a56af66 100644
--- 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
@@ -19,36 +19,38 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.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 {
+public class UnassignNetworkBBTest extends BaseBPMNTest {
@Test
public void sunnyDayAssignNetwork_Test() throws InterruptedException {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetworkBB",variables);
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetworkBB", variables);
assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignNetworkBB","Task_VfModuleRelatioship","Task_GetCloudRegionVersion","Task_SNDCUnAssign","CallActivity_sdncHandlerCall","Task_DeleteNetwork","End_UnassignNetworkBB");
+ assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignNetworkBB", "Task_VfModuleRelatioship",
+ "Task_GetCloudRegionVersion", "Task_SNDCUnAssign", "CallActivity_sdncHandlerCall", "Task_DeleteNetwork",
+ "End_UnassignNetworkBB");
assertThat(pi).isEnded();
}
- @Test
- public void rainyDayAssignNetwork_Test() throws Exception {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- 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_VfModuleRelatioship")
- .hasNotPassed("End_UnassignNetworkBB");
- assertThat(pi).isEnded();
- }
+ @Test
+ public void rainyDayAssignNetwork_Test() throws Exception {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ 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_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
index 854c4f9c2e..3b503618f1 100644
--- 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
@@ -19,8 +19,8 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
-import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
+import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.junit.Test;
@@ -28,15 +28,17 @@ 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 {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- 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", "CallActivity_sdncHandlerCall", "Task_AAIDeleteServiceInstance", "End_UnassignServiceInstanceBB");
- assertThat(pi).isEnded();
- }
+public class UnassignServiceInstanceBBTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayUnassignServiceInstanceSDNC() throws InterruptedException {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ 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", "CallActivity_sdncHandlerCall", "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
index 89089770b1..e6fae0b005 100644
--- 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
@@ -19,50 +19,47 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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 {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVfModuleBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("UnassignVfModuleBB_Start",
- "UnassignVfModule",
- "CallActivity_sdncHandler",
- "DeleteVfModule",
- "UnassignVfModuleBB_End");
- assertThat(pi).isEnded();
- }
+public class UnassignVfModuleBBTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayUnassignVfModule_Test() throws InterruptedException {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVfModuleBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("UnassignVfModuleBB_Start", "UnassignVfModule",
+ "CallActivity_sdncHandler", "DeleteVfModule", "UnassignVfModuleBB_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayUnassignVfModuleAAIDeleteFailed_Test() throws Exception {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ 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 rainyDayUnassignVfModuleAAIDeleteFailed_Test() throws Exception {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- 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();
- }
+ @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
index d508f4fcd7..2a6435218d 100644
--- 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
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -30,49 +30,48 @@ 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 {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVnfBB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("UnassignVnfBB_Start",
- "UnassignVnf",
- "CallActivity_sdncHandlerCall",
- "DeleteVnfInstanceGroups",
- "DeleteVnf",
- "UnassignVnfBB_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- @Ignore
- 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().isStarted()
- .hasPassedInOrder("UnassignVnfBB_Start", "UnassignVnf", "DeleteVnfInstanceGroups")
- .hasNotPassed("DeleteVnf","UnassignVnfBB_End");
-
- }
-
- @Test
- public void rainyDayUnassignVnfAAIDeleteFailed_Test() throws Exception {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiDeleteTasks).deleteVnf(any(BuildingBlockExecution.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVnfBB", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("UnassignVnfBB_Start", "UnassignVnf", "DeleteVnfInstanceGroups","DeleteVnf")
- .hasNotPassed("UnassignVnfBB_End");
- }
-
- @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();
- }
+public class UnassignVnfBBTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayUnassignVnf_Test() throws InterruptedException {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVnfBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("UnassignVnfBB_Start", "UnassignVnf",
+ "CallActivity_sdncHandlerCall", "DeleteVnfInstanceGroups", "DeleteVnf", "UnassignVnfBB_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ @Ignore
+ 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().isStarted()
+ .hasPassedInOrder("UnassignVnfBB_Start", "UnassignVnf", "DeleteVnfInstanceGroups")
+ .hasNotPassed("DeleteVnf", "UnassignVnfBB_End");
+
+ }
+
+ @Test
+ public void rainyDayUnassignVnfAAIDeleteFailed_Test() throws Exception {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiDeleteTasks)
+ .deleteVnf(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVnfBB", variables);
+ assertThat(pi).isNotNull().isStarted()
+ .hasPassedInOrder("UnassignVnfBB_Start", "UnassignVnf", "DeleteVnfInstanceGroups", "DeleteVnf")
+ .hasNotPassed("UnassignVnfBB_End");
+ }
+
+ @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
index 6b176293fe..1cc0788613 100644
--- 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
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -30,23 +30,24 @@ 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();
- }
+ @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
index 1bb065ae06..d9194587c6 100644
--- 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
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -33,27 +33,28 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
public class UpdateNetworkBBTest extends BaseBPMNTest {
@Test
public void updateNetworkBBTest() throws InterruptedException {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("UpdateNetworkBB", variables);
- assertThat(processInstance).isNotNull();
- assertThat(processInstance).isStarted().hasPassedInOrder(
- "UpdateNetworkBB_Start", "SDNCChangeAssignNetwork", "CallActivity_sdncHandlerCallChangeAssign",
- "QueryVpnBindingAAI", "QueryNetworkPolicyAAI", "QueryNetworkTableRefAAI",
- "Create_Network_ServiceTask", "CallActivity_NetworkAdapterRestV1", "ServiceTask_ProcessResponse", "Update_Network_AAI_ServiceTask", "UpdateNetworkBB_End");
- assertThat(processInstance).isEnded();
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("UpdateNetworkBB", variables);
+ assertThat(processInstance).isNotNull();
+ assertThat(processInstance).isStarted().hasPassedInOrder("UpdateNetworkBB_Start", "SDNCChangeAssignNetwork",
+ "CallActivity_sdncHandlerCallChangeAssign", "QueryVpnBindingAAI", "QueryNetworkPolicyAAI",
+ "QueryNetworkTableRefAAI", "Create_Network_ServiceTask", "CallActivity_NetworkAdapterRestV1",
+ "ServiceTask_ProcessResponse", "Update_Network_AAI_ServiceTask", "UpdateNetworkBB_End");
+ assertThat(processInstance).isEnded();
}
- @Test
- public void updateNetworkBBExceptionTest() throws Exception {
- mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
- 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", "CallActivity_sdncHandlerCallChangeAssign",
- "QueryVpnBindingAAI")
- .hasNotPassed("QueryNetworkPolicyAAI", "QueryNetworkTableRefAAI",
- "UpdateNetworkAdapter", "UpdateNetworkAAI", "UpdateNetworkBB_End");
- assertThat(processInstance).isEnded();
- }
+ @Test
+ public void updateNetworkBBExceptionTest() throws Exception {
+ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
+ 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",
+ "CallActivity_sdncHandlerCallChangeAssign", "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/VNFCheckClosedLoopDisabledFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java
index ac4499bf89..55d21471fc 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java
@@ -19,37 +19,39 @@
*/
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.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
-public class VNFCheckClosedLoopDisabledFlagActivityTest extends BaseBPMNTest{
- @Test
- public void sunnyDayVNFCheckClosedLoopDisabledFlagActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckClosedLoopDisabledFlagActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFCheckClosedLoopDisabledFlagActivity_Start",
- "TaskCheckClosedLoopDisabledFlagActivity",
- "VNFCheckClosedLoopDisabledFlagActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayVNFCheckClosedLoopDisabledFlagActivity_Test() throws Exception {
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
- .checkVnfClosedLoopDisabledFlag(any(BuildingBlockExecution.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckClosedLoopDisabledFlagActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFCheckClosedLoopDisabledFlagActivity_Start",
- "TaskCheckClosedLoopDisabledFlagActivity").hasNotPassed(
- "VNFCheckClosedLoopDisabledFlagActivity_End");
- assertThat(pi).isEnded();
- }
-
+public class VNFCheckClosedLoopDisabledFlagActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFCheckClosedLoopDisabledFlagActivity_Test() throws InterruptedException {
+ ProcessInstance pi =
+ runtimeService.startProcessInstanceByKey("VNFCheckClosedLoopDisabledFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFCheckClosedLoopDisabledFlagActivity_Start",
+ "TaskCheckClosedLoopDisabledFlagActivity", "VNFCheckClosedLoopDisabledFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFCheckClosedLoopDisabledFlagActivity_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
+ .checkVnfClosedLoopDisabledFlag(any(BuildingBlockExecution.class));
+ ProcessInstance pi =
+ runtimeService.startProcessInstanceByKey("VNFCheckClosedLoopDisabledFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted()
+ .hasPassedInOrder("VNFCheckClosedLoopDisabledFlagActivity_Start",
+ "TaskCheckClosedLoopDisabledFlagActivity")
+ .hasNotPassed("VNFCheckClosedLoopDisabledFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java
index 050d3124f6..6f66df6c0d 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java
@@ -19,10 +19,10 @@
*/
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;
@@ -30,27 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
-public class VNFCheckInMaintFlagActivityTest extends BaseBPMNTest{
- @Test
- public void sunnyDayVNFCheckInMaintFlagActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckInMaintFlagActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFCheckInMaintFlagActivity_Start",
- "TaskCheckInMaintFlag",
- "VNFCheckInMaintFlagActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayVNFCheckInMaintFlagActivity_Test() throws Exception {
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
- .checkVnfInMaintFlag(any(BuildingBlockExecution.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckInMaintFlagActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFCheckInMaintFlagActivity_Start",
- "TaskCheckInMaintFlag").hasNotPassed(
- "VNFCheckInMaintFlagActivity_End");
- assertThat(pi).isEnded();
- }
-
+public class VNFCheckInMaintFlagActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFCheckInMaintFlagActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckInMaintFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFCheckInMaintFlagActivity_Start", "TaskCheckInMaintFlag",
+ "VNFCheckInMaintFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFCheckInMaintFlagActivity_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
+ .checkVnfInMaintFlag(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckInMaintFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFCheckInMaintFlagActivity_Start", "TaskCheckInMaintFlag")
+ .hasNotPassed("VNFCheckInMaintFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java
index e43f47fa6a..8bfe6c020f 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java
@@ -19,37 +19,36 @@
*/
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.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
-public class VNFCheckPserversLockedFlagActivity extends BaseBPMNTest{
- @Test
- public void sunnyDayVNFCheckInMaintFlagActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckPserversLockedFlagActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFCheckPserversLockedFlagActivity_Start",
- "TaskCheckPserversLockedFlagActivity",
- "VNFCheckPserversLockedFlagActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayVNFCheckPserversLockedFlagActivity_Test() throws Exception {
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
- .checkVnfPserversLockedFlag(any(BuildingBlockExecution.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckPserversLockedFlagActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFCheckPserversLockedFlagActivity_Start",
- "TaskCheckPserversLockedFlagActivity").hasNotPassed(
- "VNFCheckPserversLockedFlagActivity_End");
- assertThat(pi).isEnded();
- }
-
+public class VNFCheckPserversLockedFlagActivity extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFCheckInMaintFlagActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckPserversLockedFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFCheckPserversLockedFlagActivity_Start",
+ "TaskCheckPserversLockedFlagActivity", "VNFCheckPserversLockedFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFCheckPserversLockedFlagActivity_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
+ .checkVnfPserversLockedFlag(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckPserversLockedFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted()
+ .hasPassedInOrder("VNFCheckPserversLockedFlagActivity_Start", "TaskCheckPserversLockedFlagActivity")
+ .hasNotPassed("VNFCheckPserversLockedFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java
index 8e76f8f4d1..0b17e3e099 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
import org.onap.appc.client.lcm.model.Action;
-public class VNFHealthCheckActivityTest extends BaseBPMNTest{
- @Test
- public void sunnyDayVNFHealthCheckActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFHealthCheckActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFHealthCheckActivity_Start",
- "TaskPreProcessActivity",
- "TaskHealthCheck",
- "VNFHealthCheckActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayVNFHealthCheckActivity_Test() throws Exception {
- variables.put("actionHealthCheck", Action.HealthCheck);
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
- .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFHealthCheckActivity", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFHealthCheckActivity_Start",
- "TaskPreProcessActivity",
- "TaskHealthCheck").hasNotPassed(
- "VNFHealthCheckActivity_End");
- }
-
+public class VNFHealthCheckActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFHealthCheckActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFHealthCheckActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFHealthCheckActivity_Start", "TaskPreProcessActivity",
+ "TaskHealthCheck", "VNFHealthCheckActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFHealthCheckActivity_Test() throws Exception {
+ variables.put("actionHealthCheck", Action.HealthCheck);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFHealthCheckActivity", variables);
+ assertThat(pi).isNotNull().isStarted()
+ .hasPassedInOrder("VNFHealthCheckActivity_Start", "TaskPreProcessActivity", "TaskHealthCheck")
+ .hasNotPassed("VNFHealthCheckActivity_End");
+ }
+
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java
index f36a72fc01..45cf44848f 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
import org.onap.appc.client.lcm.model.Action;
-public class VNFLockActivityTest extends BaseBPMNTest{
- @Test
- public void sunnyDayVNFLockActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFLockActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFLockActivity_Start",
- "TaskPreProcessActivity",
- "TaskLock",
- "VNFLockActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayVNFLockActivity_Test() throws Exception {
- variables.put("actionLock", Action.Lock);
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
- .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFLockActivity", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFLockActivity_Start",
- "TaskPreProcessActivity",
- "TaskLock").hasNotPassed(
- "VNFLockActivity_End");
- }
-
+public class VNFLockActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFLockActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFLockActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFLockActivity_Start", "TaskPreProcessActivity", "TaskLock",
+ "VNFLockActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFLockActivity_Test() throws Exception {
+ variables.put("actionLock", Action.Lock);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFLockActivity", variables);
+ assertThat(pi).isNotNull().isStarted()
+ .hasPassedInOrder("VNFLockActivity_Start", "TaskPreProcessActivity", "TaskLock")
+ .hasNotPassed("VNFLockActivity_End");
+ }
+
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java
index 2d9b952509..fb462bc02f 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
import org.onap.appc.client.lcm.model.Action;
-public class VNFQuiesceTrafficActivityTest extends BaseBPMNTest{
- @Test
- public void sunnyDayVNFQuiesceTrafficActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFQuiesceTrafficActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFQuiesceTrafficActivity_Start",
- "TaskPreProcessActivity",
- "TaskQuiesceTraffic",
- "VNFQuiesceTrafficActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayVNFQuiesceTrafficActivity_Test() throws Exception {
- variables.put("actionQuiesceTraffic", Action.QuiesceTraffic);
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
- .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFQuiesceTrafficActivity", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFQuiesceTrafficActivity_Start",
- "TaskPreProcessActivity",
- "TaskQuiesceTraffic").hasNotPassed(
- "VNFQuiesceTrafficActivity_End");
- }
-
+public class VNFQuiesceTrafficActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFQuiesceTrafficActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFQuiesceTrafficActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFQuiesceTrafficActivity_Start", "TaskPreProcessActivity",
+ "TaskQuiesceTraffic", "VNFQuiesceTrafficActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFQuiesceTrafficActivity_Test() throws Exception {
+ variables.put("actionQuiesceTraffic", Action.QuiesceTraffic);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFQuiesceTrafficActivity", variables);
+ assertThat(pi).isNotNull().isStarted()
+ .hasPassedInOrder("VNFQuiesceTrafficActivity_Start", "TaskPreProcessActivity", "TaskQuiesceTraffic")
+ .hasNotPassed("VNFQuiesceTrafficActivity_End");
+ }
+
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java
index d541cdf834..61d88a5770 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -30,29 +30,26 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
import org.onap.appc.client.lcm.model.Action;
-public class VNFResumeTrafficActivityTest extends BaseBPMNTest{
- @Test
- public void sunnyDayVNFResumeTrafficActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFResumeTrafficActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFResumeTrafficActivity_Start",
- "TaskPreProcessActivity",
- "TaskResumeTraffic",
- "VNFResumeTrafficActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayVNFResumeTrafficActivity_Test() throws Exception {
- variables.put("actionResumeTraffic", Action.ResumeTraffic);
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
- .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFResumeTrafficActivity", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFResumeTrafficActivity_Start",
- "TaskPreProcessActivity",
- "TaskResumeTraffic").hasNotPassed(
- "VNFResumeTrafficActivity_End");
-
- }
-
+public class VNFResumeTrafficActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFResumeTrafficActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFResumeTrafficActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFResumeTrafficActivity_Start", "TaskPreProcessActivity",
+ "TaskResumeTraffic", "VNFResumeTrafficActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFResumeTrafficActivity_Test() throws Exception {
+ variables.put("actionResumeTraffic", Action.ResumeTraffic);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFResumeTrafficActivity", variables);
+ assertThat(pi).isNotNull().isStarted()
+ .hasPassedInOrder("VNFResumeTrafficActivity_Start", "TaskPreProcessActivity", "TaskResumeTraffic")
+ .hasNotPassed("VNFResumeTrafficActivity_End");
+
+ }
+
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetClosedLoopDisabledFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetClosedLoopDisabledFlagActivityTest.java
index 8e56051f47..001dc70b54 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetClosedLoopDisabledFlagActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetClosedLoopDisabledFlagActivityTest.java
@@ -19,37 +19,38 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
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.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
-public class VNFSetClosedLoopDisabledFlagActivityTest extends BaseBPMNTest{
- @Test
- public void sunnyDayVNFSetClosedLoopDisabledFlagActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetClosedLoopDisabledFlagActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFSetClosedLoopDisabledFlagActivity_Start",
- "TaskSetClosedLoopDisabledFlagActivity",
- "VNFSetClosedLoopDisabledFlagActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayVNFSetClosedLoopDisabledFlagActivity_Test() throws Exception {
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
- .modifyVnfClosedLoopDisabledFlag(any(BuildingBlockExecution.class), any(boolean.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetClosedLoopDisabledFlagActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFSetClosedLoopDisabledFlagActivity_Start",
- "TaskSetClosedLoopDisabledFlagActivity").hasNotPassed(
- "VNFSetInMaintFlagActivity_End");
- assertThat(pi).isEnded();
- }
+public class VNFSetClosedLoopDisabledFlagActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFSetClosedLoopDisabledFlagActivity_Test() throws InterruptedException {
+ ProcessInstance pi =
+ runtimeService.startProcessInstanceByKey("VNFSetClosedLoopDisabledFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFSetClosedLoopDisabledFlagActivity_Start",
+ "TaskSetClosedLoopDisabledFlagActivity", "VNFSetClosedLoopDisabledFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFSetClosedLoopDisabledFlagActivity_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
+ .modifyVnfClosedLoopDisabledFlag(any(BuildingBlockExecution.class), any(boolean.class));
+ ProcessInstance pi =
+ runtimeService.startProcessInstanceByKey("VNFSetClosedLoopDisabledFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted()
+ .hasPassedInOrder("VNFSetClosedLoopDisabledFlagActivity_Start", "TaskSetClosedLoopDisabledFlagActivity")
+ .hasNotPassed("VNFSetInMaintFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetInMaintFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetInMaintFlagActivityTest.java
index 2dc6420688..1df0ea2e65 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetInMaintFlagActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetInMaintFlagActivityTest.java
@@ -19,37 +19,35 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
-public class VNFSetInMaintFlagActivityTest extends BaseBPMNTest{
- @Test
- public void sunnyDayVNFSetInMaintFlagActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetInMaintFlagActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFSetInMaintFlagActivity_Start",
- "TaskSetInMaint",
- "VNFSetInMaintFlagActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayVNFSetInMaintFlagActivity_Test() throws Exception {
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
- .modifyVnfInMaintFlag(any(BuildingBlockExecution.class), any(boolean.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetInMaintFlagActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFSetInMaintFlagActivity_Start",
- "TaskSetInMaint").hasNotPassed(
- "VNFSetInMaintFlagActivity_End");
- assertThat(pi).isEnded();
- }
-
+public class VNFSetInMaintFlagActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFSetInMaintFlagActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetInMaintFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFSetInMaintFlagActivity_Start", "TaskSetInMaint",
+ "VNFSetInMaintFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFSetInMaintFlagActivity_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
+ .modifyVnfInMaintFlag(any(BuildingBlockExecution.class), any(boolean.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetInMaintFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFSetInMaintFlagActivity_Start", "TaskSetInMaint")
+ .hasNotPassed("VNFSetInMaintFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSnapShotActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSnapShotActivityTest.java
index f6bfd04d03..6f1e076c02 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSnapShotActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSnapShotActivityTest.java
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
import org.onap.appc.client.lcm.model.Action;
-public class VNFSnapShotActivityTest extends BaseBPMNTest{
- @Test
- public void sunnyDayVNFSnapShotActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSnapShotActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFSnapShotActivity_Start",
- "TaskPreProcessActivity",
- "TaskSnapShot",
- "VNFSnapShotActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayVNFSnapShotActivity_Test() throws Exception {
- variables.put("actionSnapshot", Action.Snapshot);
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
- .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSnapShotActivity", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFSnapShotActivity_Start",
- "TaskPreProcessActivity",
- "TaskSnapShot").hasNotPassed(
- "VNFSnapShotActivity_End");
- }
-
+public class VNFSnapShotActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFSnapShotActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSnapShotActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFSnapShotActivity_Start", "TaskPreProcessActivity",
+ "TaskSnapShot", "VNFSnapShotActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFSnapShotActivity_Test() throws Exception {
+ variables.put("actionSnapshot", Action.Snapshot);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSnapShotActivity", variables);
+ assertThat(pi).isNotNull().isStarted()
+ .hasPassedInOrder("VNFSnapShotActivity_Start", "TaskPreProcessActivity", "TaskSnapShot")
+ .hasNotPassed("VNFSnapShotActivity_End");
+ }
+
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java
index 6e4be69a91..a8e974d63a 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
import org.onap.appc.client.lcm.model.Action;
-public class VNFStartActivityTest extends BaseBPMNTest{
- @Test
- public void sunnyDayVNFStartActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStartActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFStartActivity_Start",
- "TaskPreProcessActivity",
- "TaskStart",
- "VNFStartActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayVNFStartActivity_Test() throws Exception {
- variables.put("actionStart", Action.Start);
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
- .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStartActivity", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFStartActivity_Start",
- "TaskPreProcessActivity",
- "TaskStart").hasNotPassed(
- "VNFStartActivity_End");
- }
-
+public class VNFStartActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFStartActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStartActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFStartActivity_Start", "TaskPreProcessActivity", "TaskStart",
+ "VNFStartActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFStartActivity_Test() throws Exception {
+ variables.put("actionStart", Action.Start);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStartActivity", variables);
+ assertThat(pi).isNotNull().isStarted()
+ .hasPassedInOrder("VNFStartActivity_Start", "TaskPreProcessActivity", "TaskStart")
+ .hasNotPassed("VNFStartActivity_End");
+ }
+
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java
index 3bc5940493..58dfff8bd7 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
import org.onap.appc.client.lcm.model.Action;
-public class VNFStopActivityTest extends BaseBPMNTest{
- @Test
- public void sunnyDayVNFStopActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStopActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFStopActivity_Start",
- "TaskPreProcessActivity",
- "TaskStop",
- "VNFStopActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayVNFStopActivity_Test() throws Exception {
- variables.put("actionStop", Action.Stop);
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
- .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStopActivity", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFStopActivity_Start",
- "TaskPreProcessActivity",
- "TaskStop").hasNotPassed(
- "VNFStopActivity_End");
- }
-
+public class VNFStopActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFStopActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStopActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFStopActivity_Start", "TaskPreProcessActivity", "TaskStop",
+ "VNFStopActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFStopActivity_Test() throws Exception {
+ variables.put("actionStop", Action.Stop);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStopActivity", variables);
+ assertThat(pi).isNotNull().isStarted()
+ .hasPassedInOrder("VNFStopActivity_Start", "TaskPreProcessActivity", "TaskStop")
+ .hasNotPassed("VNFStopActivity_End");
+ }
+
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java
index d0db70b2aa..b6faf1b806 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
import org.onap.appc.client.lcm.model.Action;
-public class VNFUnlockActivityTest extends BaseBPMNTest{
- @Test
- public void sunnyDayVNFUnlockActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnlockActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFUnlockActivity_Start",
- "TaskPreProcessActivity",
- "TaskUnlock",
- "VNFUnlockActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayVNFUnlockActivity_Test() throws Exception {
- variables.put("actionUnlock", Action.Unlock);
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
- .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnlockActivity", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFUnlockActivity_Start",
- "TaskPreProcessActivity",
- "TaskUnlock").hasNotPassed(
- "VNFUnlockActivity_End");
- }
-
+public class VNFUnlockActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFUnlockActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnlockActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFUnlockActivity_Start", "TaskPreProcessActivity", "TaskUnlock",
+ "VNFUnlockActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFUnlockActivity_Test() throws Exception {
+ variables.put("actionUnlock", Action.Unlock);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnlockActivity", variables);
+ assertThat(pi).isNotNull().isStarted()
+ .hasPassedInOrder("VNFUnlockActivity_Start", "TaskPreProcessActivity", "TaskUnlock")
+ .hasNotPassed("VNFUnlockActivity_End");
+ }
+
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java
index 4c9b33c2c7..035d124402 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java
@@ -19,36 +19,38 @@
*/
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.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
-public class VNFUnsetClosedLoopDisabledFlagActivityTest extends BaseBPMNTest{
- @Test
- public void sunnyDayVNFUnsetClosedLoopDisabledFlagActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInClosedLoopDisabledFlagActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetClosedLoopDisabledFlagActivity_Start",
- "TaskVNFUnsetClosedLoopDisabledFlagActivity",
- "VNFUnsetClosedLoopDisabledFlagActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayVNFUnsetClosedLoopFlag_Test() throws Exception {
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
- .modifyVnfClosedLoopDisabledFlag(any(BuildingBlockExecution.class), any(boolean.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInClosedLoopDisabledFlagActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetClosedLoopDisabledFlagActivity_Start",
- "TaskVNFUnsetClosedLoopDisabledFlagActivity").hasNotPassed(
- "VNFUnsetClosedLoopDisabledFlagActivity_End");
- assertThat(pi).isEnded();
- }
+public class VNFUnsetClosedLoopDisabledFlagActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFUnsetClosedLoopDisabledFlagActivity_Test() throws InterruptedException {
+ ProcessInstance pi =
+ runtimeService.startProcessInstanceByKey("VNFUnsetInClosedLoopDisabledFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetClosedLoopDisabledFlagActivity_Start",
+ "TaskVNFUnsetClosedLoopDisabledFlagActivity", "VNFUnsetClosedLoopDisabledFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFUnsetClosedLoopFlag_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
+ .modifyVnfClosedLoopDisabledFlag(any(BuildingBlockExecution.class), any(boolean.class));
+ ProcessInstance pi =
+ runtimeService.startProcessInstanceByKey("VNFUnsetInClosedLoopDisabledFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted()
+ .hasPassedInOrder("VNFUnsetClosedLoopDisabledFlagActivity_Start",
+ "TaskVNFUnsetClosedLoopDisabledFlagActivity")
+ .hasNotPassed("VNFUnsetClosedLoopDisabledFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetInMaintFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetInMaintFlagActivityTest.java
index fcb328fa0b..15623bab3d 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetInMaintFlagActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetInMaintFlagActivityTest.java
@@ -19,37 +19,35 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
-public class VNFUnsetInMaintFlagActivityTest extends BaseBPMNTest{
- @Test
- public void sunnyDayVNFUnsetInMaintFlagActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInMaintFlagActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetInMaintFlagActivity_Start",
- "TaskUnsetInMaint",
- "VNFUnsetInMaintFlagActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayVNFUnsetInMaintFlag_Test() throws Exception {
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
- .modifyVnfInMaintFlag(any(BuildingBlockExecution.class), any(boolean.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInMaintFlagActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetInMaintFlagActivity_Start",
- "TaskUnsetInMaint").hasNotPassed(
- "VNFUnsetInMaintFlagActivity_End");
- assertThat(pi).isEnded();
- }
-
+public class VNFUnsetInMaintFlagActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFUnsetInMaintFlagActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInMaintFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetInMaintFlagActivity_Start", "TaskUnsetInMaint",
+ "VNFUnsetInMaintFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFUnsetInMaintFlag_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
+ .modifyVnfInMaintFlag(any(BuildingBlockExecution.class), any(boolean.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInMaintFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetInMaintFlagActivity_Start", "TaskUnsetInMaint")
+ .hasNotPassed("VNFUnsetInMaintFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java
index c68196c3bf..4d99147761 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java
@@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -31,30 +30,27 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
import org.onap.appc.client.lcm.model.Action;
-public class VNFUpgradeBackupActivityTest extends BaseBPMNTest{
- @Test
- public void sunnyDayVNFUpgradeBackupActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeBackupActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradeBackupActivity_Start",
- "TaskPreProcessActivity",
- "TaskUpgradeBackup",
- "VNFUpgradeBackupActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayVNFUpgradeBackupActivity_Test() throws Exception {
- variables.put("actionUpgradeBackup", Action.UpgradeBackup);
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
- .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeBackupActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradeBackupActivity_Start",
- "TaskPreProcessActivity",
- "TaskUpgradeBackup").hasNotPassed(
- "VNFUpgradeBackupActivity_End");
- assertThat(pi).isEnded();
- }
-
+public class VNFUpgradeBackupActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFUpgradeBackupActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeBackupActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradeBackupActivity_Start", "TaskPreProcessActivity",
+ "TaskUpgradeBackup", "VNFUpgradeBackupActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFUpgradeBackupActivity_Test() throws Exception {
+ variables.put("actionUpgradeBackup", Action.UpgradeBackup);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeBackupActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted()
+ .hasPassedInOrder("VNFUpgradeBackupActivity_Start", "TaskPreProcessActivity", "TaskUpgradeBackup")
+ .hasNotPassed("VNFUpgradeBackupActivity_End");
+ assertThat(pi).isEnded();
+ }
+
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java
index 5fa930712d..c87cc44f29 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
import org.onap.appc.client.lcm.model.Action;
-public class VNFUpgradePostCheckActivityTest extends BaseBPMNTest{
- @Test
- public void sunnyDayVNFUpgradePostCheckActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePostCheckActivity", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFUpgradePostCheckActivity_Start",
- "TaskPreProcessActivity",
- "TaskUpgradePostCheck",
- "VNFUpgradePostCheckActivity_End");
-
- }
-
- @Test
- public void rainyDayVNFUpgradePostCheckActivity_Test() throws Exception {
- variables.put("actionUpgradePostCheck", Action.UpgradePostCheck);
-
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
- .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePostCheckActivity", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFUpgradePostCheckActivity_Start",
- "TaskPreProcessActivity",
- "TaskUpgradePostCheck").hasNotPassed(
- "VNFUpgradePostCheckActivity_End");
- }
-
+public class VNFUpgradePostCheckActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFUpgradePostCheckActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePostCheckActivity", variables);
+ assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFUpgradePostCheckActivity_Start",
+ "TaskPreProcessActivity", "TaskUpgradePostCheck", "VNFUpgradePostCheckActivity_End");
+
+ }
+
+ @Test
+ public void rainyDayVNFUpgradePostCheckActivity_Test() throws Exception {
+ variables.put("actionUpgradePostCheck", Action.UpgradePostCheck);
+
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePostCheckActivity", variables);
+ assertThat(pi).isNotNull().isStarted()
+ .hasPassedInOrder("VNFUpgradePostCheckActivity_Start", "TaskPreProcessActivity", "TaskUpgradePostCheck")
+ .hasNotPassed("VNFUpgradePostCheckActivity_End");
+ }
+
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java
index 40f5df8dae..79fc43396d 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
import org.onap.appc.client.lcm.model.Action;
-public class VNFUpgradePreCheckActivityTest extends BaseBPMNTest{
- @Test
- public void sunnyDayVNFUpgradePreCheckActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePreCheckActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradePreCheckActivity_Start",
- "TaskPreProcessActivity",
- "TaskUpgradePreCheck",
- "VNFUpgradePreCheckActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayVNFUpgradePreCheckActivity_Test() throws Exception {
- variables.put("actionUpgradePreCheck", Action.UpgradePreCheck);
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
- .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePreCheckActivity", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFUpgradePreCheckActivity_Start",
- "TaskPreProcessActivity",
- "TaskUpgradePreCheck").hasNotPassed(
- "VNFUpgradePreCheckActivity_End");
- }
-
+public class VNFUpgradePreCheckActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFUpgradePreCheckActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePreCheckActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradePreCheckActivity_Start", "TaskPreProcessActivity",
+ "TaskUpgradePreCheck", "VNFUpgradePreCheckActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFUpgradePreCheckActivity_Test() throws Exception {
+ variables.put("actionUpgradePreCheck", Action.UpgradePreCheck);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePreCheckActivity", variables);
+ assertThat(pi).isNotNull().isStarted()
+ .hasPassedInOrder("VNFUpgradePreCheckActivity_Start", "TaskPreProcessActivity", "TaskUpgradePreCheck")
+ .hasNotPassed("VNFUpgradePreCheckActivity_End");
+ }
+
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java
index 91e6bf40be..b550185702 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java
@@ -19,10 +19,10 @@
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
import org.onap.appc.client.lcm.model.Action;
-public class VNFUpgradeSoftwareActivityTest extends BaseBPMNTest{
- @Test
- public void sunnyDayVNFUpgradeSoftwareActivity_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeSoftwareActivity", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradeSoftwareActivity_Start",
- "TaskPreProcessActivity",
- "TaskUpgradeSoftware",
- "VNFUpgradeSoftwareActivity_End");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayVNFUpgradeSoftwareActivity_Test() throws Exception {
- variables.put("actionUpgradeSoftware", Action.UpgradeSoftware);
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
- .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeSoftwareActivity", variables);
- assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFUpgradeSoftwareActivity_Start",
- "TaskPreProcessActivity",
- "TaskUpgradeSoftware").hasNotPassed(
- "VNFUpgradeSoftwareActivity_End");
- }
-
+public class VNFUpgradeSoftwareActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFUpgradeSoftwareActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeSoftwareActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradeSoftwareActivity_Start", "TaskPreProcessActivity",
+ "TaskUpgradeSoftware", "VNFUpgradeSoftwareActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFUpgradeSoftwareActivity_Test() throws Exception {
+ variables.put("actionUpgradeSoftware", Action.UpgradeSoftware);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeSoftwareActivity", variables);
+ assertThat(pi).isNotNull().isStarted()
+ .hasPassedInOrder("VNFUpgradeSoftwareActivity_Start", "TaskPreProcessActivity", "TaskUpgradeSoftware")
+ .hasNotPassed("VNFUpgradeSoftwareActivity_End");
+ }
+
}
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
index 39625ac9bf..8ad4e0f07f 100644
--- 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
@@ -18,10 +18,10 @@
* ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
import static org.mockito.ArgumentMatchers.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;
@@ -32,19 +32,22 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
public class VnfAdapterTest extends BaseBPMNTest {
@Test
public void vnfAdapterCreatedTest() {
- mockSubprocess("vnfAdapterRestV1", "Mocked vnfAdapterRestV1", "GenericStub");
+ mockSubprocess("vnfAdapterRestV1", "Mocked vnfAdapterRestV1", "GenericStub");
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("VnfAdapter", variables);
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VnfAdapter", variables);
assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VnfAdapter_Start", "PreProcessRequest", "Call_vnfAdapterRestV1","PostProcessResponse", "VnfAdapter_End");
+ 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);
+ 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");
+ assertThat(pi).isStarted().hasPassedInOrder("VnfAdapter_Start", "PreProcessRequest")
+ .hasNotPassed("VnfAdapter_End");
}
}
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
index a47b16fc33..d401522800 100644
--- 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
@@ -23,7 +23,6 @@ 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;
@@ -34,57 +33,64 @@ 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<String, String> hashMap= new HashMap<>();
- hashMap.put("owning-entity-name", owningEntityName);
- getAaiClient().createIfNotExists(owningEntityURI, Optional.of(hashMap)).connect(owningEntityURI, serviceInstanceURI);
- }
+ 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<String, String> 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<GenericVnf> getVnfInstance(String vnfId) {
+ try {
+ AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
+ AAIResultWrapper aaiResponse = getAaiClient().get(vnfURI);
+ Optional<GenericVnf> vnf = aaiResponse.asBean(GenericVnf.class);
+ return vnf;
+ } catch (Exception ex) {
+ return Optional.empty();
+ }
+ }
- 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<GenericVnf> getVnfInstance(String vnfId){
- try{
- AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
- AAIResultWrapper aaiResponse = getAaiClient().get(vnfURI);
- Optional<GenericVnf> 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
index cea6fe740d..2526ca5c25 100644
--- 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
@@ -29,21 +29,23 @@ 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{
+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);
+ }
+
+ }
- 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
index 3bc02be476..1410752f76 100644
--- 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
@@ -24,17 +24,17 @@ import org.onap.so.client.aai.AAIResourcesClient;
import org.springframework.stereotype.Component;
@Component
-public abstract class AAIResource {
- private AAIResourcesClient aaiClient;
+public abstract class AAIResource {
+ private AAIResourcesClient aaiClient;
- public AAIResourcesClient getAaiClient() {
- if(aaiClient == null)
- return new AAIResourcesClient();
- else
- return aaiClient;
- }
+ public AAIResourcesClient getAaiClient() {
+ if (aaiClient == null)
+ return new AAIResourcesClient();
+ else
+ return aaiClient;
+ }
- public void setAaiClient(AAIResourcesClient aaiClient) {
- this.aaiClient = 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
index c5cd2c70da..376ca4dbdb 100644
--- 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
@@ -21,129 +21,144 @@
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 static class AAIServiceInstanceBuilder {
- private String serviceInstanceName;
- private String serviceType;
- private String serviceRole;
- private String orchestrationStatus;
- private String modelInvariantUuid;
- private String modelVersionId;
- private String environmentContext;
- private String workloadContext;
-
- public AAIServiceInstanceBuilder setServiceInstanceName(String serviceInstanceName) {
- this.serviceInstanceName = serviceInstanceName;
- return this;
- }
-
- public AAIServiceInstanceBuilder setServiceType(String serviceType) {
- this.serviceType = serviceType;
- return this;
- }
-
- public AAIServiceInstanceBuilder setServiceRole(String serviceRole) {
- this.serviceRole = serviceRole;
- return this;
- }
-
- public AAIServiceInstanceBuilder setOrchestrationStatus(String orchestrationStatus) {
- this.orchestrationStatus = orchestrationStatus;
- return this;
- }
-
- public AAIServiceInstanceBuilder setModelInvariantUuid(String modelInvariantUuid) {
- this.modelInvariantUuid = modelInvariantUuid;
- return this;
- }
-
- public AAIServiceInstanceBuilder setModelVersionId(String modelVersionId) {
- this.modelVersionId = modelVersionId;
- return this;
- }
-
- public AAIServiceInstanceBuilder setEnvironmentContext(String environmentContext) {
- this.environmentContext = environmentContext;
- return this;
- }
-
- public AAIServiceInstanceBuilder setWorkloadContext(String workloadContext) {
- this.workloadContext = workloadContext;
- return this;
- }
-
- public AAIServiceInstance createAAIServiceInstance() {
- return new AAIServiceInstance(this);
- }
- }
-
- public AAIServiceInstance(AAIServiceInstanceBuilder aaiServiceInstanceBuilder) {
- this.serviceInstanceName = aaiServiceInstanceBuilder.serviceInstanceName;
- this.serviceType = aaiServiceInstanceBuilder.serviceType;
- this.serviceRole = aaiServiceInstanceBuilder.serviceRole;
- this.orchestrationStatus = aaiServiceInstanceBuilder.orchestrationStatus;
- this.modelInvariantUuid = aaiServiceInstanceBuilder.modelInvariantUuid;
- this.modelVersionId = aaiServiceInstanceBuilder.modelVersionId;
- this.environmentContext = aaiServiceInstanceBuilder.environmentContext;
- this.workloadContext = aaiServiceInstanceBuilder.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;
- }
-
+ String serviceInstanceName;
+ String serviceType;
+ String serviceRole;
+ String orchestrationStatus;
+ String modelInvariantUuid;
+ String modelVersionId;
+ String environmentContext;
+ String workloadContext;
+
+ public static class AAIServiceInstanceBuilder {
+ private String serviceInstanceName;
+ private String serviceType;
+ private String serviceRole;
+ private String orchestrationStatus;
+ private String modelInvariantUuid;
+ private String modelVersionId;
+ private String environmentContext;
+ private String workloadContext;
+
+ public AAIServiceInstanceBuilder setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setModelInvariantUuid(String modelInvariantUuid) {
+ this.modelInvariantUuid = modelInvariantUuid;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setEnvironmentContext(String environmentContext) {
+ this.environmentContext = environmentContext;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ return this;
+ }
+
+ public AAIServiceInstance createAAIServiceInstance() {
+ return new AAIServiceInstance(this);
+ }
+ }
+
+ public AAIServiceInstance(AAIServiceInstanceBuilder aaiServiceInstanceBuilder) {
+ this.serviceInstanceName = aaiServiceInstanceBuilder.serviceInstanceName;
+ this.serviceType = aaiServiceInstanceBuilder.serviceType;
+ this.serviceRole = aaiServiceInstanceBuilder.serviceRole;
+ this.orchestrationStatus = aaiServiceInstanceBuilder.orchestrationStatus;
+ this.modelInvariantUuid = aaiServiceInstanceBuilder.modelInvariantUuid;
+ this.modelVersionId = aaiServiceInstanceBuilder.modelVersionId;
+ this.environmentContext = aaiServiceInstanceBuilder.environmentContext;
+ this.workloadContext = aaiServiceInstanceBuilder.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
index 0c519ef29f..bbca10be0f 100644
--- 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
@@ -25,7 +25,6 @@ package org.onap.so.bpmn.infrastructure.aai.groovyflows;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
-
import org.onap.aai.domain.yang.OwningEntities;
import org.onap.aai.domain.yang.OwningEntity;
import org.onap.so.client.aai.AAIObjectPlurals;
@@ -37,85 +36,88 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AAICreateResources {
-
- private static final Logger logger = LoggerFactory.getLogger(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<String, String> 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_ENTITY)
- .queryParam("owning-entity-name", owningEntityName))
- .orElseGet(() -> {
- logger.debug("No Owning Entity matched by name");
- return null;
- });
-
- }
-
- public Optional<OwningEntity> 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());
- }
-
+
+ private static final Logger logger = LoggerFactory.getLogger(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<String, String> 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_ENTITY)
+ .queryParam("owning-entity-name", owningEntityName)).orElseGet(() -> {
+ logger.debug("No Owning Entity matched by name");
+ return null;
+ });
+
+ }
+
+ public Optional<OwningEntity> 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
index 495c77255d..fb95ae3993 100644
--- 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
@@ -28,22 +28,24 @@ 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{
+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);
+ }
+
+ }
- 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
index 805ece9de8..2d69351744 100644
--- 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
@@ -21,74 +21,91 @@
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;
- }
-
+ 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
index 3b443cbaf2..55387d6a3d 100644
--- 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
@@ -27,14 +27,15 @@ 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());
- }
- }
-
+ 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/delegate/CheckAaiForPnfCorrelationIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java
index e0fa41b7a1..493340c9ef 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java
@@ -22,9 +22,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate;
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.PNF_CORRELATION_ID;
-
import java.io.IOException;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.bpmn.common.scripts.ExceptionUtil;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java
index 9b60a05e98..d67e6ef0db 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * Foundation. ================================================================================ Licensed under the
+ * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
+ * obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and limitations under the
+ * License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.pnf.delegate;
@@ -26,7 +21,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_INSTANCE_NAME;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_MODEL_INFO;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SKIP_POST_INSTANTIATION_CONFIGURATION;
-
import java.util.List;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
@@ -50,7 +44,7 @@ public class ConfigCheckerDelegate implements JavaDelegate {
private Logger logger = LoggerFactory.getLogger(ConfigCheckerDelegate.class);
- //ERROR CODE for variable not found in the delegation Context
+ // ERROR CODE for variable not found in the delegation Context
private static int ERROR_CODE = 601;
@Autowired
@@ -63,34 +57,33 @@ public class ConfigCheckerDelegate implements JavaDelegate {
public void execute(DelegateExecution delegateExecution) throws Exception {
logger.debug("Running execute block for activity id:{}, name:{}", delegateExecution.getCurrentActivityId(),
- delegateExecution.getCurrentActivityName());
+ delegateExecution.getCurrentActivityName());
if (delegateExecution.hasVariable(SERVICE_MODEL_INFO)) {
String serviceModelInfo = (String) delegateExecution.getVariable(SERVICE_MODEL_INFO);
String serviceModelUuid = JsonUtils.getJsonValue(serviceModelInfo, MODEL_UUID);
delegateExecution.setVariable(MODEL_UUID, serviceModelUuid);
- List<PnfResourceCustomization> pnfCustomizations = catalogDbClient
- .getPnfResourceCustomizationByModelUuid(serviceModelUuid);
+ List<PnfResourceCustomization> pnfCustomizations =
+ catalogDbClient.getPnfResourceCustomizationByModelUuid(serviceModelUuid);
if (pnfCustomizations != null && pnfCustomizations.size() >= 1) {
PnfResourceCustomization pnfResourceCustomization = pnfCustomizations.get(0);
boolean skipPostInstantiationConfiguration = pnfResourceCustomization.isSkipPostInstConf();
- delegateExecution
- .setVariable(SKIP_POST_INSTANTIATION_CONFIGURATION, skipPostInstantiationConfiguration);
+ delegateExecution.setVariable(SKIP_POST_INSTANTIATION_CONFIGURATION,
+ skipPostInstantiationConfiguration);
delegateExecution.setVariable(PRC_BLUEPRINT_NAME, pnfResourceCustomization.getBlueprintName());
delegateExecution.setVariable(PRC_BLUEPRINT_VERSION, pnfResourceCustomization.getBlueprintVersion());
- delegateExecution
- .setVariable(PRC_CUSTOMIZATION_UUID, pnfResourceCustomization.getModelCustomizationUUID());
+ delegateExecution.setVariable(PRC_CUSTOMIZATION_UUID,
+ pnfResourceCustomization.getModelCustomizationUUID());
delegateExecution.setVariable(PRC_INSTANCE_NAME, pnfResourceCustomization.getModelInstanceName());
} else {
- logger
- .warn("Unable to find the PNF resource customizations of model service UUID: {}", serviceModelUuid);
+ logger.warn("Unable to find the PNF resource customizations of model service UUID: {}",
+ serviceModelUuid);
exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE,
- "Unable to find the PNF resource customizations of model service UUID: " + serviceModelUuid);
+ "Unable to find the PNF resource customizations of model service UUID: " + serviceModelUuid);
}
} else {
logger.warn("Unable to find the parameter: {} in the execution context", SERVICE_MODEL_INFO);
- exceptionUtil
- .buildAndThrowWorkflowException(delegateExecution, ERROR_CODE,
+ exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE,
"Unable to find parameter " + SERVICE_MODEL_INFO);
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java
index e56cb83119..cb06085ee8 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java
@@ -24,7 +24,6 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.aai.domain.yang.Pnf;
@@ -37,9 +36,7 @@ import org.springframework.stereotype.Component;
/**
* Implementation of "Create Pnf entry in AAI" task in CreateAndActivatePnfResource.bpmn
*
- * Inputs:
- * - pnfCorrelationId - String
- * - pnfUuid - String
+ * Inputs: - pnfCorrelationId - String - pnfUuid - String
*/
@Component
public class CreatePnfEntryInAaiDelegate implements JavaDelegate {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java
index a367bada02..6d73b61ab2 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java
@@ -51,8 +51,8 @@ public class CreateRelation implements JavaDelegate {
new ExceptionUtil().buildAndThrowWorkflowException(delegateExecution, 9999,
"An exception occurred when making service and pnf relation. Exception: " + e.getMessage());
}
- logger.debug("The relation has been made between service with id: {} and pnf with name: {}",
- serviceInstanceId, pnfName);
+ logger.debug("The relation has been made between service with id: {} and pnf with name: {}", serviceInstanceId,
+ pnfName);
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java
index f5483e489e..852ca4fcef 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
-
import java.util.UUID;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
@@ -35,7 +34,7 @@ public class GeneratePnfUuidDelegate implements JavaDelegate {
private static final Logger logger = LoggerFactory.getLogger(GeneratePnfUuidDelegate.class);
@Override
- public void execute(DelegateExecution delegateExecution){
+ public void execute(DelegateExecution delegateExecution) {
UUID uuid = UUID.randomUUID();
logger.debug("Generated UUID for pnf: {}, version: {}, variant: {}", uuid, uuid.version(), uuid.variant());
delegateExecution.setVariable(PNF_UUID, uuid.toString());
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
index 96455acb84..5cbd530a93 100644
--- 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
@@ -36,12 +36,8 @@ public class InformDmaapClient implements JavaDelegate {
public void execute(DelegateExecution execution) {
String pnfCorrelationId = (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID);
RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService();
- dmaapClient.registerForUpdate(pnfCorrelationId, () ->
- runtimeService
- .createMessageCorrelation("WorkflowMessage")
- .processInstanceBusinessKey(execution.getProcessBusinessKey())
- .correlateWithResult()
- );
+ dmaapClient.registerForUpdate(pnfCorrelationId, () -> runtimeService.createMessageCorrelation("WorkflowMessage")
+ .processInstanceBusinessKey(execution.getProcessBusinessKey()).correlateWithResult());
}
@Autowired
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
index 1caadea0de..b52110ea82 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
@@ -26,7 +26,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION;
-
import com.google.common.base.Strings;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
@@ -38,7 +37,8 @@ import org.springframework.stereotype.Component;
@Component
public class PnfCheckInputs implements JavaDelegate {
- public static final String UUID_REGEX = "(?i)^[0-9a-f]{8}-[0-9a-f]{4}-[1-5]{1}[0-9a-f]{3}-[89ab]{1}[0-9a-f]{3}-[0-9a-f]{12}$";
+ public static final String UUID_REGEX =
+ "(?i)^[0-9a-f]{8}-[0-9a-f]{4}-[1-5]{1}[0-9a-f]{3}-[89ab]{1}[0-9a-f]{3}-[0-9a-f]{12}$";
private String pnfEntryNotificationTimeout;
@@ -58,7 +58,8 @@ public class PnfCheckInputs implements JavaDelegate {
private void validatePnfCorrelationId(DelegateExecution execution) {
String pnfCorrelationId = (String) execution.getVariable(PNF_CORRELATION_ID);
if (Strings.isNullOrEmpty(pnfCorrelationId)) {
- new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "pnfCorrelationId variable not defined");
+ new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999,
+ "pnfCorrelationId variable not defined");
}
}
@@ -83,7 +84,8 @@ public class PnfCheckInputs implements JavaDelegate {
private void validateServiceInstanceId(DelegateExecution execution) {
String serviceInstanceId = (String) execution.getVariable(SERVICE_INSTANCE_ID);
if (Strings.isNullOrEmpty(serviceInstanceId)) {
- new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "serviceInstanceId variable not defined");
+ new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999,
+ "serviceInstanceId variable not defined");
}
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareCdsCallDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareCdsCallDelegate.java
index 49887af4be..c4c299d4b6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareCdsCallDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareCdsCallDelegate.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * Foundation. ================================================================================ Licensed under the
+ * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
+ * obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and limitations under the
+ * License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.pnf.delegate;
@@ -24,7 +19,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_BLUEPRINT_NAME;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_BLUEPRINT_VERSION;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
@@ -50,7 +44,7 @@ public abstract class PrepareCdsCallDelegate implements JavaDelegate {
protected ExceptionBuilder exceptionUtil;
@Override
- public void execute(DelegateExecution delegateExecution){
+ public void execute(DelegateExecution delegateExecution) {
logger.debug("Running execute block for activity:{}", delegateExecution.getCurrentActivityId());
AbstractCDSPropertiesBean cdsPropertiesBean = new AbstractCDSPropertiesBean();
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegate.java
index 5bf167ea7a..dd2601f0d0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegate.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * Foundation. ================================================================================ Licensed under the
+ * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
+ * obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and limitations under the
+ * License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.pnf.delegate;
@@ -25,7 +20,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_CUSTOMIZATION_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_INSTANCE_NAME;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
@@ -48,7 +42,7 @@ public class PrepareConfigAssignDelegate extends PrepareCdsCallDelegate {
}
@Override
- protected String getRequestObject(final DelegateExecution delegateExecution){
+ protected String getRequestObject(final DelegateExecution delegateExecution) {
ConfigAssignPropertiesForPnf configAssignProperties = new ConfigAssignPropertiesForPnf();
configAssignProperties.setServiceInstanceId((String) delegateExecution.getVariable(SERVICE_INSTANCE_ID));
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegate.java
index 5fbed598e3..16f712fa66 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegate.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * Foundation. ================================================================================ Licensed under the
+ * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
+ * obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and limitations under the
+ * License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.pnf.delegate;
@@ -24,7 +19,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_CUSTOMIZATION_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID;
-
import java.io.IOException;
import java.util.Optional;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -55,7 +49,7 @@ public class PrepareConfigDeployDelegate extends PrepareCdsCallDelegate {
}
@Override
- protected String getRequestObject(DelegateExecution delegateExecution){
+ protected String getRequestObject(DelegateExecution delegateExecution) {
ConfigDeployPropertiesForPnf configDeployProperties = new ConfigDeployPropertiesForPnf();
@@ -85,7 +79,8 @@ public class PrepareConfigDeployDelegate extends PrepareCdsCallDelegate {
return configDeployRequest.toString();
}
- private void setIpAddress(ConfigDeployPropertiesForPnf configDeployProperties, DelegateExecution delegateExecution) {
+ private void setIpAddress(ConfigDeployPropertiesForPnf configDeployProperties,
+ DelegateExecution delegateExecution) {
/**
* Retrieve PNF entry from AAI.
@@ -93,21 +88,23 @@ public class PrepareConfigDeployDelegate extends PrepareCdsCallDelegate {
try {
String pnfName = (String) delegateExecution.getVariable(PNF_CORRELATION_ID);
Optional<Pnf> pnfOptional = pnfManagement.getEntryFor(pnfName);
- if ( pnfOptional.isPresent()){
+ if (pnfOptional.isPresent()) {
Pnf pnf = pnfOptional.get();
/**
- * PRH patches the AAI with oam address.
- * Use ipaddress-v4-oam and ipaddress-v6-oam for the config deploy request.
+ * PRH patches the AAI with oam address. Use ipaddress-v4-oam and ipaddress-v6-oam for the config deploy
+ * request.
*/
configDeployProperties.setPnfIpV4Address(pnf.getIpaddressV4Oam());
configDeployProperties.setPnfIpV6Address(pnf.getIpaddressV6Oam());
} else {
- exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE, "AAI entry for PNF: " + pnfName + " does not exist");
+ exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE,
+ "AAI entry for PNF: " + pnfName + " does not exist");
}
} catch (IOException e) {
logger.warn(e.getMessage(), e);
- exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE, "Unable to fetch from AAI" + e.getMessage());
+ exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE,
+ "Unable to fetch from AAI" + e.getMessage());
}
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
index fb5d04328f..7cb78a10e5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
@@ -41,9 +41,8 @@ public final class JsonUtilForPnfCorrelationId {
List<String> list = new ArrayList<>();
Spliterator<JsonElement> spliterator = array.spliterator();
spliterator.forEachRemaining(jsonElement -> {
- handleEscapedCharacters(jsonElement)
- .ifPresent(jsonObject -> getPnfCorrelationId(jsonObject)
- .ifPresent(pnfCorrelationId -> list.add(pnfCorrelationId)));
+ handleEscapedCharacters(jsonElement).ifPresent(jsonObject -> getPnfCorrelationId(jsonObject)
+ .ifPresent(pnfCorrelationId -> list.add(pnfCorrelationId)));
});
return list;
}
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
index 6f828f6cb0..3de0f38b70 100644
--- 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
@@ -60,12 +60,10 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
topicListenerDelayInSeconds = env.getProperty("pnf.dmaap.topicListenerDelayInSeconds", Integer.class);
executor = null;
getRequest = new HttpGet(UriBuilder.fromUri(env.getProperty("pnf.dmaap.uriPathPrefix"))
- .scheme(env.getProperty("pnf.dmaap.protocol"))
- .host(env.getProperty("pnf.dmaap.host"))
- .port(env.getProperty("pnf.dmaap.port", Integer.class))
- .path(env.getProperty("pnf.dmaap.topicName"))
- .path(env.getProperty("pnf.dmaap.consumerGroup"))
- .path(env.getProperty("pnf.dmaap.consumerId")).build());
+ .scheme(env.getProperty("pnf.dmaap.protocol")).host(env.getProperty("pnf.dmaap.host"))
+ .port(env.getProperty("pnf.dmaap.port", Integer.class)).path(env.getProperty("pnf.dmaap.topicName"))
+ .path(env.getProperty("pnf.dmaap.consumerGroup")).path(env.getProperty("pnf.dmaap.consumerId"))
+ .build());
}
@Override
@@ -92,8 +90,8 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
executor = new ScheduledThreadPoolExecutor(1);
executor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
- executor.scheduleWithFixedDelay(new DmaapTopicListenerThread(), 0,
- topicListenerDelayInSeconds, TimeUnit.SECONDS);
+ executor.scheduleWithFixedDelay(new DmaapTopicListenerThread(), 0, topicListenerDelayInSeconds,
+ TimeUnit.SECONDS);
dmaapThreadListenerIsRunning = true;
}
}
@@ -116,8 +114,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
getPnfCorrelationIdListFromResponse(response).forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound);
} catch (IOException e) {
logger.error("Exception caught during sending rest request to dmaap for listening event topic", e);
- }
- finally {
+ } finally {
getRequest.reset();
}
}
@@ -136,7 +133,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
Runnable runnable = unregister(pnfCorrelationId);
if (runnable != null) {
logger.debug("dmaap listener gets pnf ready event for pnfCorrelationId: {}", pnfCorrelationId);
- //runnable.run();
+ // runnable.run();
runnable = null;
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java
index 32ea357817..b1af8b1e0b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java
@@ -46,8 +46,8 @@ public class PnfManagementImpl implements PnfManagement {
@Override
public void createRelation(String serviceInstanceId, String pnfName) {
- AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
- serviceInstanceId);
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
AAIResourceUri pnfUri = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfName);
new AAIResourcesClient().connect(serviceInstanceURI, pnfUri);
}
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
index ee8743f846..8b2bb9a8de 100644
--- 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
@@ -22,22 +22,22 @@ 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.bpmn.core.UrnPropertiesReader;
public class BPMNProperties {
public static String getProperty(String key, String defaultValue) {
- String value = UrnPropertiesReader.getVariable(key);
- if (value == null) {
- return defaultValue;
- } else {
- return value;
- }
+ String value = UrnPropertiesReader.getVariable(key);
+ if (value == null) {
+ return defaultValue;
+ } else {
+ return value;
+ }
}
public static List<String> getResourceSequenceProp(String input) {
- String resourceSequence = UrnPropertiesReader.getVariable("mso.workflow.custom."+ input + ".resource.sequence");
+ String resourceSequence =
+ UrnPropertiesReader.getVariable("mso.workflow.custom." + input + ".resource.sequence");
if (resourceSequence != null) {
return Arrays.asList(resourceSequence.split(","));
}
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
index 292f6ef575..2995e24c00 100644
--- 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
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.vfcmodel;
-
/**
* NS Create Input Parameter For VFC Adapter<br>
* <p>
@@ -44,7 +43,6 @@ public class NSResourceInputParameter {
-
/**
* @return Returns the nsServiceName.
*/
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
index 81826a27eb..3e35952a9e 100644
--- 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
@@ -21,8 +21,7 @@ package org.onap.so.bpmn.infrastructure.vfcmodel;
/**
- * The operation key object for NS
- * <br>
+ * The operation key object for NS <br>
* <p>
* </p>
*
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
index 0d8f2fcbd7..ad388feffc 100644
--- 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
@@ -37,7 +37,8 @@ public class NsParameters {
private List<LocationConstraint> locationConstraints;
- private Map<String, Object> additionalParamForNs = new HashMap<String,Object>();
+ private Map<String, Object> additionalParamForNs = new HashMap<String, Object>();
+
/**
* @return Returns the locationConstraints.
*/
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
index 970fa43d9f..8b9295b44f 100644
--- 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
@@ -28,7 +28,7 @@ package org.onap.so.bpmn.infrastructure.vfcmodel;
* </p>
*
* @author
- * @version ONAP Amsterdam Release 2017-10-18
+ * @version ONAP Amsterdam Release 2017-10-18
*/
public class VimLocation {
private String vimId;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
index 9b878afb7c..896a8bd98c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
@@ -73,549 +73,550 @@ import org.springframework.web.util.UriUtils;
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";
-
- public static final String INVENTORY_OSS_DEFAULT_ENDPOINT = "http://192.168.1.199:8443/oss/inventory";
-
- private static final int DEFAULT_TIME_OUT = 60000;
-
- static JsonUtils jsonUtil = new JsonUtils();
-
- private static Logger logger = LoggerFactory.getLogger(ServicePluginFactory.class);
-
- private static ServicePluginFactory instance;
-
-
- public static synchronized ServicePluginFactory getInstance() {
- if (null == instance) {
- instance = new ServicePluginFactory();
- }
- return instance;
- }
-
- private ServicePluginFactory() {
-
- }
-
- private String getInventoryOSSEndPoint(){
- return UrnPropertiesReader.getVariable("mso.service-plugin.inventory-oss-endpoint", INVENTORY_OSS_DEFAULT_ENDPOINT);
- }
-
- 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);
- }
-
- @SuppressWarnings("unchecked")
- public String doProcessSiteLocation(ServiceDecomposition serviceDecomposition, String uuiRequest) {
- if(!isNeedProcessSite(uuiRequest)) {
- return uuiRequest;
- }
-
- Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class);
- if (uuiObject == null) {
- return uuiRequest;
- }
- Map<String, Object> serviceObject = (Map<String, Object>) uuiObject
- .getOrDefault("service", Collections.emptyMap());
- Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject
- .getOrDefault("parameters", Collections.emptyMap());
- Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject
- .getOrDefault("requestInputs", Collections.emptyMap());
- List<Object> resources = (List<Object>) serviceParametersObject.getOrDefault("resources", Collections.emptyList());
-
- if (isSiteLocationLocal(serviceRequestInputs, resources)) {
- // resources changed : added TP info
- return getJsonString(uuiObject);
- }
-
- List<Resource> addResourceList = new ArrayList<>();
- addResourceList.addAll(serviceDecomposition.getServiceResources());
-
- serviceDecomposition.setVnfResources(null);
- serviceDecomposition.setAllottedResources(null);
- serviceDecomposition.setNetworkResources(null);
- serviceDecomposition.setConfigResources(null);
- for (Resource resource : addResourceList) {
- String resourcemodelName = resource.getModelInfo().getModelName();
- if (StringUtils.containsIgnoreCase(resourcemodelName, "sppartner")) {
- // change serviceDecomposition
- serviceDecomposition.addResource(resource);
- break;
- }
- }
-
- return uuiRequest;
- }
-
- private boolean isNeedProcessSite(String uuiRequest) {
- return uuiRequest.toLowerCase().contains("site_address") && uuiRequest.toLowerCase().contains("sotncondition_clientsignal");
- }
-
- @SuppressWarnings("unchecked")
- private boolean isSiteLocationLocal(Map<String, Object> serviceRequestInputs, List<Object> resources) {
- Map<String, Object> tpInfoMap = getTPforVPNAttachment(serviceRequestInputs);
-
- if(tpInfoMap.isEmpty()) {
- return true;
- }
- String host = (String) tpInfoMap.get("host");
- // host is empty means TP is in local, not empty means TP is in remote ONAP
- if (!host.isEmpty()) {
- return false;
- }
-
- Map<String, Object> accessTPInfo = new HashMap<String, Object>();
- accessTPInfo.put("access-provider-id", tpInfoMap.get("access-provider-id"));
- accessTPInfo.put("access-client-id", tpInfoMap.get("access-client-id"));
- accessTPInfo.put("access-topology-id", tpInfoMap.get("access-topology-id"));
- accessTPInfo.put("access-node-id", tpInfoMap.get("access-node-id"));
- accessTPInfo.put("access-ltp-id", tpInfoMap.get("access-ltp-id"));
-
- // change resources
- String resourceName = (String) tpInfoMap.get("resourceName");
- for(Object curResource : resources) {
- Map<String, Object> resource = (Map<String, Object>)curResource;
- String curResourceName = (String) resource.get("resourceName");
- curResourceName = curResourceName.replaceAll(" ", "");
- if(resourceName.equalsIgnoreCase(curResourceName)) {
- putResourceRequestInputs(resource, accessTPInfo);
- break;
- }
- }
-
- return true;
- }
-
- @SuppressWarnings("unchecked")
- private Map<String, Object> getTPforVPNAttachment(Map<String, Object> serviceRequestInputs) {
- Object location = null;
- Object clientSignal = null;
- String vpnAttachmentResourceName = null;
-
- // support R2 uuiReq and R1 uuiReq
- // logic for R2 uuiRequest params in service level
- for (Entry<String, Object> entry : serviceRequestInputs.entrySet()) {
- String key = entry.getKey();
- if (key.toLowerCase().contains("site_address")) {
- location = entry.getValue();
- }
- if (key.toLowerCase().contains("sotncondition_clientsignal")) {
- clientSignal = entry.getValue();
- vpnAttachmentResourceName = key.substring(0, key.indexOf("_"));
- }
- }
-
- Map<String, Object> tpInfoMap = new HashMap<String, Object>();
-
- // Site resource has location param and SOTNAttachment resource has clientSignal param
- if(location == null || clientSignal == null ) {
- return tpInfoMap;
- }
-
- // Query terminal points from InventoryOSS system by location.
- String locationAddress = (String) location;
- List<Object> locationTPList = queryAccessTPbyLocationFromInventoryOSS(locationAddress);
- if(locationTPList != null && !locationTPList.isEmpty()) {
- for(Object tp: locationTPList) {
- Map<String, Object> tpJson = (Map<String, Object>) tp;
- String loc = (String)tpJson.get ("location");
- if(StringUtils.equalsIgnoreCase (locationAddress, loc)) {
- tpInfoMap = tpJson;
- // add resourceName
- tpInfoMap.put("resourceName", vpnAttachmentResourceName);
- break;
- }
- }
- logger.debug("Get Terminal TP from InventoryOSS");
- return tpInfoMap;
- }
-
- return tpInfoMap;
- }
-
- @SuppressWarnings("unchecked")
- private List<Object> queryAccessTPbyLocationFromInventoryOSS(String locationAddress) {
- String url = getInventoryOSSEndPoint();
- url += "/oss/inventory?location=" + UriUtils.encode(locationAddress,"UTF-8");
- String responseContent = sendRequest(url, "GET", "");
- List<Object> accessTPs = new ArrayList<>();
- if (null != responseContent) {
- accessTPs = getJsonObject(responseContent, List.class);
- }
- return accessTPs;
- }
-
- @SuppressWarnings("unchecked")
- private void putResourceRequestInputs(Map<String, Object> resource, Map<String, Object> resourceInputs) {
- Map<String, Object> resourceParametersObject = new HashMap<>();
- Map<String, Object> resourceRequestInputs = new HashMap<>();
- resourceRequestInputs.put("requestInputs", resourceInputs);
- resourceParametersObject.put("parameters", resourceRequestInputs);
-
- if(resource.containsKey("parameters")) {
- Map<String, Object> resParametersObject = (Map<String, Object>) resource.get("parameters");
- if(resParametersObject.containsKey("requestInputs")) {
- Map<String, Object> resRequestInputs = (Map<String, Object>) resourceRequestInputs.get("requestInputs");
- Map<String, Object> oldRequestInputs = (Map<String, Object>) resParametersObject.get("requestInputs");
- if(oldRequestInputs != null) {
- oldRequestInputs.putAll(resRequestInputs);
- }
- else {
- resParametersObject.put("requestInputs", resRequestInputs);
- }
- }
- else {
- resParametersObject.putAll(resourceRequestInputs);
- }
- }
- else {
- resource.putAll(resourceParametersObject);
- }
-
- return;
- }
-
-
-
- @SuppressWarnings("unchecked")
- public String doTPResourcesAllocation(DelegateExecution execution, String uuiRequest) {
- Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class);
- if (uuiObject == null) {
- return uuiRequest;
- }
- Map<String, Object> serviceObject = (Map<String, Object>) uuiObject
- .getOrDefault("service", Collections.emptyMap());
- Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject
- .getOrDefault("parameters", Collections.emptyMap());
- Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject
- .getOrDefault("requestInputs", Collections.emptyMap());
-
- if (!isNeedAllocateCrossTPResources(serviceRequestInputs)) {
- return uuiRequest;
- }
-
- allocateCrossTPResources(execution, serviceRequestInputs);
- return getJsonString(uuiObject);
- }
-
- @SuppressWarnings("unchecked")
- private boolean isNeedAllocateCrossTPResources(Map<String, Object> serviceRequestInputs) {
- if(serviceRequestInputs.containsKey("CallSource"))
- {
- String callSource = (String) serviceRequestInputs.get("CallSource");
- if("ExternalAPI".equalsIgnoreCase(callSource)) {
- return false;
- }
- }
- for (String input : serviceRequestInputs.keySet())
- {
- if(input.toLowerCase().contains("sotnconnectivity")) {
- return true;
- }
- }
- return false;
- }
-
- @SuppressWarnings("unchecked")
- private void allocateCrossTPResources(DelegateExecution execution, Map<String, Object> serviceRequestInputs) {
-
- Map<String, Object> crossTPs = this.getTPsfromAAI();
-
- if(crossTPs == null || crossTPs.isEmpty()) {
- serviceRequestInputs.put("local-access-provider-id", "");
- serviceRequestInputs.put("local-access-client-id", "");
- serviceRequestInputs.put("local-access-topology-id", "");
- serviceRequestInputs.put("local-access-node-id", "");
- serviceRequestInputs.put("local-access-ltp-id", "");
- serviceRequestInputs.put("remote-access-provider-id", "");
- serviceRequestInputs.put("remote-access-client-id", "");
- serviceRequestInputs.put("remote-access-topology-id", "");
- serviceRequestInputs.put("remote-access-node-id", "");
- serviceRequestInputs.put("remote-access-ltp-id", "");
- }
- else {
- serviceRequestInputs.put("local-access-provider-id", crossTPs.get("local-access-provider-id"));
- serviceRequestInputs.put("local-access-client-id", crossTPs.get("local-access-client-id"));
- serviceRequestInputs.put("local-access-topology-id", crossTPs.get("local-access-topology-id"));
- serviceRequestInputs.put("local-access-node-id", crossTPs.get("local-access-node-id"));
- serviceRequestInputs.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id"));
- serviceRequestInputs.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id"));
- serviceRequestInputs.put("remote-access-client-id", crossTPs.get("remote-client-id"));
- serviceRequestInputs.put("remote-access-topology-id", crossTPs.get("remote-topology-id"));
- serviceRequestInputs.put("remote-access-node-id", crossTPs.get("remote-node-id"));
- serviceRequestInputs.put("remote-access-ltp-id", crossTPs.get("remote-ltp-id"));
- }
-
- return;
- }
-
- // This method returns Local and remote TPs information from AAI
- public Map getTPsfromAAI() {
- Map<String, Object> tpInfo = new HashMap<>();
-
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.LOGICAL_LINK);
- AAIResourcesClient client = new AAIResourcesClient();
- Optional<LogicalLinks> result = client.get(LogicalLinks.class, uri);
-
- if (result.isPresent()) {
- LogicalLinks links = result.get();
- boolean isRemoteLink = false;
-
- links.getLogicalLink();
-
- for (LogicalLink link : links.getLogicalLink()) {
- AAIResultWrapper wrapper = new AAIResultWrapper(link);
- Optional<Relationships> optRelationships = wrapper.getRelationships();
- List<AAIResourceUri> pInterfaces = new ArrayList<>();
- if (optRelationships.isPresent()) {
- Relationships relationships = optRelationships.get();
- if (!relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty()) {
- isRemoteLink = true;
- }
- pInterfaces.addAll(relationships.getRelatedAAIUris(AAIObjectType.P_INTERFACE));
- }
-
- if (isRemoteLink) {
- // find remote p interface
- AAIResourceUri localTP = null;
- AAIResourceUri remoteTP = null;
-
- AAIResourceUri pInterface0 = pInterfaces.get(0);
-
- if (isRemotePInterface(client, pInterface0)) {
- remoteTP = pInterfaces.get(0);
- localTP = pInterfaces.get(1);
- } else {
- localTP = pInterfaces.get(0);
- remoteTP = pInterfaces.get(1);
- }
-
- if (localTP != null && remoteTP != null) {
- // give local tp
- String tpUrl = localTP.build().toString();
- PInterface intfLocal = client.get(PInterface.class, localTP).get();
- tpInfo.put("local-access-node-id", tpUrl.split("/")[6]);
-
- String[] networkRef = intfLocal.getNetworkRef().split("/");
- if (networkRef.length == 6) {
- tpInfo.put("local-access-provider-id", networkRef[1]);
- tpInfo.put("local-access-client-id", networkRef[3]);
- tpInfo.put("local-access-topology-id", networkRef[5]);
- }
- String ltpIdStr = tpUrl.substring(tpUrl.lastIndexOf("/") + 1);
- if (ltpIdStr.contains("-")) {
- tpInfo.put("local-access-ltp-id", ltpIdStr.substring(ltpIdStr.lastIndexOf("-") + 1));
- }
-
- // give remote tp
- tpUrl = remoteTP.build().toString();
- PInterface intfRemote = client.get(PInterface.class, remoteTP).get();
- tpInfo.put("remote-access-node-id", tpUrl.split("/")[6]);
-
- String[] networkRefRemote = intfRemote.getNetworkRef().split("/");
-
- if (networkRefRemote.length == 6) {
- tpInfo.put("remote-access-provider-id", networkRefRemote[1]);
- tpInfo.put("remote-access-client-id", networkRefRemote[3]);
- tpInfo.put("remote-access-topology-id", networkRefRemote[5]);
- }
- String ltpIdStrR = tpUrl.substring(tpUrl.lastIndexOf("/") + 1);
- if (ltpIdStrR.contains("-")) {
- tpInfo.put("remote-access-ltp-id", ltpIdStrR.substring(ltpIdStr.lastIndexOf("-") + 1));
- }
- return tpInfo;
- }
- }
- }
- }
- return tpInfo;
- }
-
- // this method check if pInterface is remote
- private boolean isRemotePInterface(AAIResourcesClient client, AAIResourceUri uri) {
-
- String uriString = uri.build().toString();
-
- if (uriString != null) {
- // get the pnfname
- String[] token = uriString.split("/");
- AAIResourceUri parent = AAIUriFactory.createResourceUri(AAIObjectType.PNF, token[4]);
-
- AAIResultWrapper wrapper = client.get(parent);
- Optional<Relationships> optRelationships = wrapper.getRelationships();
- if (optRelationships.isPresent()) {
- Relationships relationships = optRelationships.get();
-
- return !relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty();
- }
- }
-
- return false;
- }
-
- 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");
- }
-
- @SuppressWarnings("unchecked")
- private String preProcessSOTNService(ServiceDecomposition serviceDecomposition, String uuiRequest) {
- Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class);
- if (uuiObject == null) {
- return uuiRequest;
- }
- Map<String, Object> serviceObject = (Map<String, Object>) uuiObject
- .getOrDefault("service", Collections.emptyMap());
- Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject
- .getOrDefault("parameters", Collections.emptyMap());
- Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject
- .getOrDefault("requestInputs", Collections.emptyMap());
- List<Object> resources = (List<Object>) serviceParametersObject.getOrDefault("resources", Collections.emptyList());
- // 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<String, Object> 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<String, Object> resourceObject = (Map<String, Object>) resource;
- Map<String, Object> resourceParametersObject = (Map<String, Object>) resourceObject.get("parameters");
- Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject.get("requestInputs");
- for (Entry<String, Object> 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<String, Object> vpnRequestInputs = getVPNResourceRequestInputs(resources);
- // here we put client signal to vpn resource inputs
- if(null!=vpnRequestInputs) {
- vpnRequestInputs.put("src-client-signal", srcClientSignal);
- vpnRequestInputs.put("dst-client-signal", dstClientSignal);
- }
-
-
- // Now we need to query terminal points from SP resourcemgr system.
- List<Object> locationTerminalPointList = queryTerminalPointsFromServiceProviderSystem(srcLocation, dstLocation);
- Map<String, Object> tpInfoMap = (Map<String, Object>) 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<String, Object>) 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<Object> queryTerminalPointsFromServiceProviderSystem(String srcLocation, String dstLocation) {
- Map<String, String> locationSrc = new HashMap<>();
- locationSrc.put("location", srcLocation);
- Map<String, String> locationDst = new HashMap<>();
- locationDst.put("location", dstLocation);
- List<Map<String, String>> locations = new ArrayList<>();
- locations.add(locationSrc);
- locations.add(locationDst);
- List<Object> 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;
- }
-
- @SuppressWarnings("unchecked")
- private Map<String, Object> getVPNResourceRequestInputs(List<Object> resources) {
- for (Object resource : resources) {
- Map<String, Object> resourceObject = (Map<String, Object>) resource;
- Map<String, Object> resourceParametersObject = (Map<String, Object>) resourceObject.get("parameters");
- Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject.get("requestInputs");
- for (Entry<String, Object> 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);
-
- }
+ // 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";
+
+ public static final String INVENTORY_OSS_DEFAULT_ENDPOINT = "http://192.168.1.199:8443/oss/inventory";
+
+ private static final int DEFAULT_TIME_OUT = 60000;
+
+ static JsonUtils jsonUtil = new JsonUtils();
+
+ private static Logger logger = LoggerFactory.getLogger(ServicePluginFactory.class);
+
+ private static ServicePluginFactory instance;
+
+
+ public static synchronized ServicePluginFactory getInstance() {
+ if (null == instance) {
+ instance = new ServicePluginFactory();
+ }
+ return instance;
+ }
+
+ private ServicePluginFactory() {
+
+ }
+
+ private String getInventoryOSSEndPoint() {
+ return UrnPropertiesReader.getVariable("mso.service-plugin.inventory-oss-endpoint",
+ INVENTORY_OSS_DEFAULT_ENDPOINT);
+ }
+
+ 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);
+ }
+
+ @SuppressWarnings("unchecked")
+ public String doProcessSiteLocation(ServiceDecomposition serviceDecomposition, String uuiRequest) {
+ if (!isNeedProcessSite(uuiRequest)) {
+ return uuiRequest;
+ }
+
+ Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class);
+ if (uuiObject == null) {
+ return uuiRequest;
+ }
+ Map<String, Object> serviceObject =
+ (Map<String, Object>) uuiObject.getOrDefault("service", Collections.emptyMap());
+ Map<String, Object> serviceParametersObject =
+ (Map<String, Object>) serviceObject.getOrDefault("parameters", Collections.emptyMap());
+ Map<String, Object> serviceRequestInputs =
+ (Map<String, Object>) serviceParametersObject.getOrDefault("requestInputs", Collections.emptyMap());
+ List<Object> resources =
+ (List<Object>) serviceParametersObject.getOrDefault("resources", Collections.emptyList());
+
+ if (isSiteLocationLocal(serviceRequestInputs, resources)) {
+ // resources changed : added TP info
+ return getJsonString(uuiObject);
+ }
+
+ List<Resource> addResourceList = new ArrayList<>();
+ addResourceList.addAll(serviceDecomposition.getServiceResources());
+
+ serviceDecomposition.setVnfResources(null);
+ serviceDecomposition.setAllottedResources(null);
+ serviceDecomposition.setNetworkResources(null);
+ serviceDecomposition.setConfigResources(null);
+ for (Resource resource : addResourceList) {
+ String resourcemodelName = resource.getModelInfo().getModelName();
+ if (StringUtils.containsIgnoreCase(resourcemodelName, "sppartner")) {
+ // change serviceDecomposition
+ serviceDecomposition.addResource(resource);
+ break;
+ }
+ }
+
+ return uuiRequest;
+ }
+
+ private boolean isNeedProcessSite(String uuiRequest) {
+ return uuiRequest.toLowerCase().contains("site_address")
+ && uuiRequest.toLowerCase().contains("sotncondition_clientsignal");
+ }
+
+ @SuppressWarnings("unchecked")
+ private boolean isSiteLocationLocal(Map<String, Object> serviceRequestInputs, List<Object> resources) {
+ Map<String, Object> tpInfoMap = getTPforVPNAttachment(serviceRequestInputs);
+
+ if (tpInfoMap.isEmpty()) {
+ return true;
+ }
+ String host = (String) tpInfoMap.get("host");
+ // host is empty means TP is in local, not empty means TP is in remote ONAP
+ if (!host.isEmpty()) {
+ return false;
+ }
+
+ Map<String, Object> accessTPInfo = new HashMap<String, Object>();
+ accessTPInfo.put("access-provider-id", tpInfoMap.get("access-provider-id"));
+ accessTPInfo.put("access-client-id", tpInfoMap.get("access-client-id"));
+ accessTPInfo.put("access-topology-id", tpInfoMap.get("access-topology-id"));
+ accessTPInfo.put("access-node-id", tpInfoMap.get("access-node-id"));
+ accessTPInfo.put("access-ltp-id", tpInfoMap.get("access-ltp-id"));
+
+ // change resources
+ String resourceName = (String) tpInfoMap.get("resourceName");
+ for (Object curResource : resources) {
+ Map<String, Object> resource = (Map<String, Object>) curResource;
+ String curResourceName = (String) resource.get("resourceName");
+ curResourceName = curResourceName.replaceAll(" ", "");
+ if (resourceName.equalsIgnoreCase(curResourceName)) {
+ putResourceRequestInputs(resource, accessTPInfo);
+ break;
+ }
+ }
+
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Map<String, Object> getTPforVPNAttachment(Map<String, Object> serviceRequestInputs) {
+ Object location = null;
+ Object clientSignal = null;
+ String vpnAttachmentResourceName = null;
+
+ // support R2 uuiReq and R1 uuiReq
+ // logic for R2 uuiRequest params in service level
+ for (Entry<String, Object> entry : serviceRequestInputs.entrySet()) {
+ String key = entry.getKey();
+ if (key.toLowerCase().contains("site_address")) {
+ location = entry.getValue();
+ }
+ if (key.toLowerCase().contains("sotncondition_clientsignal")) {
+ clientSignal = entry.getValue();
+ vpnAttachmentResourceName = key.substring(0, key.indexOf("_"));
+ }
+ }
+
+ Map<String, Object> tpInfoMap = new HashMap<String, Object>();
+
+ // Site resource has location param and SOTNAttachment resource has clientSignal param
+ if (location == null || clientSignal == null) {
+ return tpInfoMap;
+ }
+
+ // Query terminal points from InventoryOSS system by location.
+ String locationAddress = (String) location;
+ List<Object> locationTPList = queryAccessTPbyLocationFromInventoryOSS(locationAddress);
+ if (locationTPList != null && !locationTPList.isEmpty()) {
+ for (Object tp : locationTPList) {
+ Map<String, Object> tpJson = (Map<String, Object>) tp;
+ String loc = (String) tpJson.get("location");
+ if (StringUtils.equalsIgnoreCase(locationAddress, loc)) {
+ tpInfoMap = tpJson;
+ // add resourceName
+ tpInfoMap.put("resourceName", vpnAttachmentResourceName);
+ break;
+ }
+ }
+ logger.debug("Get Terminal TP from InventoryOSS");
+ return tpInfoMap;
+ }
+
+ return tpInfoMap;
+ }
+
+ @SuppressWarnings("unchecked")
+ private List<Object> queryAccessTPbyLocationFromInventoryOSS(String locationAddress) {
+ String url = getInventoryOSSEndPoint();
+ url += "/oss/inventory?location=" + UriUtils.encode(locationAddress, "UTF-8");
+ String responseContent = sendRequest(url, "GET", "");
+ List<Object> accessTPs = new ArrayList<>();
+ if (null != responseContent) {
+ accessTPs = getJsonObject(responseContent, List.class);
+ }
+ return accessTPs;
+ }
+
+ @SuppressWarnings("unchecked")
+ private void putResourceRequestInputs(Map<String, Object> resource, Map<String, Object> resourceInputs) {
+ Map<String, Object> resourceParametersObject = new HashMap<>();
+ Map<String, Object> resourceRequestInputs = new HashMap<>();
+ resourceRequestInputs.put("requestInputs", resourceInputs);
+ resourceParametersObject.put("parameters", resourceRequestInputs);
+
+ if (resource.containsKey("parameters")) {
+ Map<String, Object> resParametersObject = (Map<String, Object>) resource.get("parameters");
+ if (resParametersObject.containsKey("requestInputs")) {
+ Map<String, Object> resRequestInputs = (Map<String, Object>) resourceRequestInputs.get("requestInputs");
+ Map<String, Object> oldRequestInputs = (Map<String, Object>) resParametersObject.get("requestInputs");
+ if (oldRequestInputs != null) {
+ oldRequestInputs.putAll(resRequestInputs);
+ } else {
+ resParametersObject.put("requestInputs", resRequestInputs);
+ }
+ } else {
+ resParametersObject.putAll(resourceRequestInputs);
+ }
+ } else {
+ resource.putAll(resourceParametersObject);
+ }
+
+ return;
+ }
+
+
+
+ @SuppressWarnings("unchecked")
+ public String doTPResourcesAllocation(DelegateExecution execution, String uuiRequest) {
+ Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class);
+ if (uuiObject == null) {
+ return uuiRequest;
+ }
+ Map<String, Object> serviceObject =
+ (Map<String, Object>) uuiObject.getOrDefault("service", Collections.emptyMap());
+ Map<String, Object> serviceParametersObject =
+ (Map<String, Object>) serviceObject.getOrDefault("parameters", Collections.emptyMap());
+ Map<String, Object> serviceRequestInputs =
+ (Map<String, Object>) serviceParametersObject.getOrDefault("requestInputs", Collections.emptyMap());
+
+ if (!isNeedAllocateCrossTPResources(serviceRequestInputs)) {
+ return uuiRequest;
+ }
+
+ allocateCrossTPResources(execution, serviceRequestInputs);
+ return getJsonString(uuiObject);
+ }
+
+ @SuppressWarnings("unchecked")
+ private boolean isNeedAllocateCrossTPResources(Map<String, Object> serviceRequestInputs) {
+ if (serviceRequestInputs.containsKey("CallSource")) {
+ String callSource = (String) serviceRequestInputs.get("CallSource");
+ if ("ExternalAPI".equalsIgnoreCase(callSource)) {
+ return false;
+ }
+ }
+ for (String input : serviceRequestInputs.keySet()) {
+ if (input.toLowerCase().contains("sotnconnectivity")) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ private void allocateCrossTPResources(DelegateExecution execution, Map<String, Object> serviceRequestInputs) {
+
+ Map<String, Object> crossTPs = this.getTPsfromAAI();
+
+ if (crossTPs == null || crossTPs.isEmpty()) {
+ serviceRequestInputs.put("local-access-provider-id", "");
+ serviceRequestInputs.put("local-access-client-id", "");
+ serviceRequestInputs.put("local-access-topology-id", "");
+ serviceRequestInputs.put("local-access-node-id", "");
+ serviceRequestInputs.put("local-access-ltp-id", "");
+ serviceRequestInputs.put("remote-access-provider-id", "");
+ serviceRequestInputs.put("remote-access-client-id", "");
+ serviceRequestInputs.put("remote-access-topology-id", "");
+ serviceRequestInputs.put("remote-access-node-id", "");
+ serviceRequestInputs.put("remote-access-ltp-id", "");
+ } else {
+ serviceRequestInputs.put("local-access-provider-id", crossTPs.get("local-access-provider-id"));
+ serviceRequestInputs.put("local-access-client-id", crossTPs.get("local-access-client-id"));
+ serviceRequestInputs.put("local-access-topology-id", crossTPs.get("local-access-topology-id"));
+ serviceRequestInputs.put("local-access-node-id", crossTPs.get("local-access-node-id"));
+ serviceRequestInputs.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id"));
+ serviceRequestInputs.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id"));
+ serviceRequestInputs.put("remote-access-client-id", crossTPs.get("remote-client-id"));
+ serviceRequestInputs.put("remote-access-topology-id", crossTPs.get("remote-topology-id"));
+ serviceRequestInputs.put("remote-access-node-id", crossTPs.get("remote-node-id"));
+ serviceRequestInputs.put("remote-access-ltp-id", crossTPs.get("remote-ltp-id"));
+ }
+
+ return;
+ }
+
+ // This method returns Local and remote TPs information from AAI
+ public Map getTPsfromAAI() {
+ Map<String, Object> tpInfo = new HashMap<>();
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.LOGICAL_LINK);
+ AAIResourcesClient client = new AAIResourcesClient();
+ Optional<LogicalLinks> result = client.get(LogicalLinks.class, uri);
+
+ if (result.isPresent()) {
+ LogicalLinks links = result.get();
+ boolean isRemoteLink = false;
+
+ links.getLogicalLink();
+
+ for (LogicalLink link : links.getLogicalLink()) {
+ AAIResultWrapper wrapper = new AAIResultWrapper(link);
+ Optional<Relationships> optRelationships = wrapper.getRelationships();
+ List<AAIResourceUri> pInterfaces = new ArrayList<>();
+ if (optRelationships.isPresent()) {
+ Relationships relationships = optRelationships.get();
+ if (!relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty()) {
+ isRemoteLink = true;
+ }
+ pInterfaces.addAll(relationships.getRelatedAAIUris(AAIObjectType.P_INTERFACE));
+ }
+
+ if (isRemoteLink) {
+ // find remote p interface
+ AAIResourceUri localTP = null;
+ AAIResourceUri remoteTP = null;
+
+ AAIResourceUri pInterface0 = pInterfaces.get(0);
+
+ if (isRemotePInterface(client, pInterface0)) {
+ remoteTP = pInterfaces.get(0);
+ localTP = pInterfaces.get(1);
+ } else {
+ localTP = pInterfaces.get(0);
+ remoteTP = pInterfaces.get(1);
+ }
+
+ if (localTP != null && remoteTP != null) {
+ // give local tp
+ String tpUrl = localTP.build().toString();
+ PInterface intfLocal = client.get(PInterface.class, localTP).get();
+ tpInfo.put("local-access-node-id", tpUrl.split("/")[6]);
+
+ String[] networkRef = intfLocal.getNetworkRef().split("/");
+ if (networkRef.length == 6) {
+ tpInfo.put("local-access-provider-id", networkRef[1]);
+ tpInfo.put("local-access-client-id", networkRef[3]);
+ tpInfo.put("local-access-topology-id", networkRef[5]);
+ }
+ String ltpIdStr = tpUrl.substring(tpUrl.lastIndexOf("/") + 1);
+ if (ltpIdStr.contains("-")) {
+ tpInfo.put("local-access-ltp-id", ltpIdStr.substring(ltpIdStr.lastIndexOf("-") + 1));
+ }
+
+ // give remote tp
+ tpUrl = remoteTP.build().toString();
+ PInterface intfRemote = client.get(PInterface.class, remoteTP).get();
+ tpInfo.put("remote-access-node-id", tpUrl.split("/")[6]);
+
+ String[] networkRefRemote = intfRemote.getNetworkRef().split("/");
+
+ if (networkRefRemote.length == 6) {
+ tpInfo.put("remote-access-provider-id", networkRefRemote[1]);
+ tpInfo.put("remote-access-client-id", networkRefRemote[3]);
+ tpInfo.put("remote-access-topology-id", networkRefRemote[5]);
+ }
+ String ltpIdStrR = tpUrl.substring(tpUrl.lastIndexOf("/") + 1);
+ if (ltpIdStrR.contains("-")) {
+ tpInfo.put("remote-access-ltp-id", ltpIdStrR.substring(ltpIdStr.lastIndexOf("-") + 1));
+ }
+ return tpInfo;
+ }
+ }
+ }
+ }
+ return tpInfo;
+ }
+
+ // this method check if pInterface is remote
+ private boolean isRemotePInterface(AAIResourcesClient client, AAIResourceUri uri) {
+
+ String uriString = uri.build().toString();
+
+ if (uriString != null) {
+ // get the pnfname
+ String[] token = uriString.split("/");
+ AAIResourceUri parent = AAIUriFactory.createResourceUri(AAIObjectType.PNF, token[4]);
+
+ AAIResultWrapper wrapper = client.get(parent);
+ Optional<Relationships> optRelationships = wrapper.getRelationships();
+ if (optRelationships.isPresent()) {
+ Relationships relationships = optRelationships.get();
+
+ return !relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty();
+ }
+ }
+
+ return false;
+ }
+
+ 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");
+ }
+
+ @SuppressWarnings("unchecked")
+ private String preProcessSOTNService(ServiceDecomposition serviceDecomposition, String uuiRequest) {
+ Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class);
+ if (uuiObject == null) {
+ return uuiRequest;
+ }
+ Map<String, Object> serviceObject =
+ (Map<String, Object>) uuiObject.getOrDefault("service", Collections.emptyMap());
+ Map<String, Object> serviceParametersObject =
+ (Map<String, Object>) serviceObject.getOrDefault("parameters", Collections.emptyMap());
+ Map<String, Object> serviceRequestInputs =
+ (Map<String, Object>) serviceParametersObject.getOrDefault("requestInputs", Collections.emptyMap());
+ List<Object> resources =
+ (List<Object>) serviceParametersObject.getOrDefault("resources", Collections.emptyList());
+ // 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<String, Object> 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<String, Object> resourceObject = (Map<String, Object>) resource;
+ Map<String, Object> resourceParametersObject = (Map<String, Object>) resourceObject.get("parameters");
+ Map<String, Object> resourceRequestInputs =
+ (Map<String, Object>) resourceParametersObject.get("requestInputs");
+ for (Entry<String, Object> 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<String, Object> vpnRequestInputs = getVPNResourceRequestInputs(resources);
+ // here we put client signal to vpn resource inputs
+ if (null != vpnRequestInputs) {
+ vpnRequestInputs.put("src-client-signal", srcClientSignal);
+ vpnRequestInputs.put("dst-client-signal", dstClientSignal);
+ }
+
+
+ // Now we need to query terminal points from SP resourcemgr system.
+ List<Object> locationTerminalPointList = queryTerminalPointsFromServiceProviderSystem(srcLocation, dstLocation);
+ Map<String, Object> tpInfoMap = (Map<String, Object>) 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<String, Object>) 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<Object> queryTerminalPointsFromServiceProviderSystem(String srcLocation, String dstLocation) {
+ Map<String, String> locationSrc = new HashMap<>();
+ locationSrc.put("location", srcLocation);
+ Map<String, String> locationDst = new HashMap<>();
+ locationDst.put("location", dstLocation);
+ List<Map<String, String>> locations = new ArrayList<>();
+ locations.add(locationSrc);
+ locations.add(locationDst);
+ List<Object> 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;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Map<String, Object> getVPNResourceRequestInputs(List<Object> resources) {
+ for (Object resource : resources) {
+ Map<String, Object> resourceObject = (Map<String, Object>) resource;
+ Map<String, Object> resourceParametersObject = (Map<String, Object>) resourceObject.get("parameters");
+ Map<String, Object> resourceRequestInputs =
+ (Map<String, Object>) resourceParametersObject.get("requestInputs");
+ for (Entry<String, Object> 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);
+
+ }
@SuppressWarnings("unchecked")
private String doSOTNServiceHoming(ServiceDecomposition serviceDecomposition, String uuiRequest) {
@@ -624,15 +625,15 @@ public class ServicePluginFactory {
if (uuiObject == null) {
return uuiRequest;
}
- Map<String, Object> serviceObject = (Map<String, Object>) uuiObject
- .getOrDefault("service", Collections.emptyMap());
- Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject
- .getOrDefault("parameters", Collections.emptyMap());
- Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject
- .getOrDefault("requestInputs", Collections.emptyMap());
+ Map<String, Object> serviceObject =
+ (Map<String, Object>) uuiObject.getOrDefault("service", Collections.emptyMap());
+ Map<String, Object> serviceParametersObject =
+ (Map<String, Object>) serviceObject.getOrDefault("parameters", Collections.emptyMap());
+ Map<String, Object> serviceRequestInputs =
+ (Map<String, Object>) serviceParametersObject.getOrDefault("requestInputs", Collections.emptyMap());
Map<String, Object> oofQueryObject = new HashMap<>();
- List<Object> resources = (List<Object>) serviceParametersObject
- .getOrDefault("resources", Collections.emptyList());
+ List<Object> resources =
+ (List<Object>) serviceParametersObject.getOrDefault("resources", Collections.emptyList());
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"));
@@ -660,147 +661,144 @@ public class ServicePluginFactory {
return getJsonString(uuiObject);
}
- private Map<String, Object> getReturnRoute(List<Object> returnList){
- Map<String, Object> returnRoute = new HashMap<>();
- for(Object returnVpn :returnList){
- Map<String, Object> returnVpnInfo = (Map<String, Object>) 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<String, Object> getResourceParams(Execution execution, String resourceCustomizationUuid,
- String serviceParameters) {
- List<String> resourceList = jsonUtil.StringArrayToList(execution,
- JsonUtils.getJsonValue(serviceParameters, "resources"));
- // Get the right location str for resource. default is an empty array.
- String resourceInputsFromUui = "";
- for (String resource : resourceList) {
- String resCusUuid = JsonUtils.getJsonValue(resource, "resourceCustomizationUuid");
- if (resourceCustomizationUuid.equals(resCusUuid)) {
- String resourceParameters = JsonUtils.getJsonValue(resource, "parameters");
- resourceInputsFromUui = JsonUtils.getJsonValue(resourceParameters, "requestInputs");
- }
- }
- Map<String, Object> resourceInputsFromUuiMap = getJsonObject(resourceInputsFromUui, Map.class);
- return resourceInputsFromUuiMap;
- }
-
- private static <T> T getJsonObject(String jsonstr, Class<T> type) {
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
- try {
- return mapper.readValue(jsonstr, type);
- } catch (IOException e) {
- logger.error("{} {} fail to unMarshal json", MessageEnum.RA_NS_EXC.toString(),
- ErrorCode.BusinessProcesssError.getValue(), 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);
- }
- 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);
- httpGet.addHeader("X-FromAppId", "MSO");
- httpGet.addHeader("Accept","application/json");
- method = httpGet;
- } else if ("DELETE".equals(methodType.toUpperCase())) {
- HttpDelete httpDelete = new HttpDelete(msbUrl);
- httpDelete.setConfig(requestConfig);
- method = httpDelete;
- }
-
- httpResponse = client.execute(method);
- String responseContent = null;
- if (null != httpResponse && httpResponse.getEntity() != null) {
- try {
- responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
- } catch (ParseException e) {
- logger.debug("ParseException in sendrequest", e);
- } catch (IOException e) {
- logger.debug("IOException in sendrequest", e);
- }
- }
- 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) {
-
- }
- }
- }
- }
+ private Map<String, Object> getReturnRoute(List<Object> returnList) {
+ Map<String, Object> returnRoute = new HashMap<>();
+ for (Object returnVpn : returnList) {
+ Map<String, Object> returnVpnInfo = (Map<String, Object>) 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<String, Object> getResourceParams(Execution execution, String resourceCustomizationUuid,
+ String serviceParameters) {
+ List<String> resourceList =
+ jsonUtil.StringArrayToList(execution, JsonUtils.getJsonValue(serviceParameters, "resources"));
+ // Get the right location str for resource. default is an empty array.
+ String resourceInputsFromUui = "";
+ for (String resource : resourceList) {
+ String resCusUuid = JsonUtils.getJsonValue(resource, "resourceCustomizationUuid");
+ if (resourceCustomizationUuid.equals(resCusUuid)) {
+ String resourceParameters = JsonUtils.getJsonValue(resource, "parameters");
+ resourceInputsFromUui = JsonUtils.getJsonValue(resourceParameters, "requestInputs");
+ }
+ }
+ Map<String, Object> resourceInputsFromUuiMap = getJsonObject(resourceInputsFromUui, Map.class);
+ return resourceInputsFromUuiMap;
+ }
+
+ private static <T> T getJsonObject(String jsonstr, Class<T> type) {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
+ try {
+ return mapper.readValue(jsonstr, type);
+ } catch (IOException e) {
+ logger.error("{} {} fail to unMarshal json", MessageEnum.RA_NS_EXC.toString(),
+ ErrorCode.BusinessProcesssError.getValue(), 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);
+ }
+ 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);
+ httpGet.addHeader("X-FromAppId", "MSO");
+ httpGet.addHeader("Accept", "application/json");
+ method = httpGet;
+ } else if ("DELETE".equals(methodType.toUpperCase())) {
+ HttpDelete httpDelete = new HttpDelete(msbUrl);
+ httpDelete.setConfig(requestConfig);
+ method = httpDelete;
+ }
+
+ httpResponse = client.execute(method);
+ String responseContent = null;
+ if (null != httpResponse && httpResponse.getEntity() != null) {
+ try {
+ responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
+ } catch (ParseException e) {
+ logger.debug("ParseException in sendrequest", e);
+ } catch (IOException e) {
+ logger.debug("IOException in sendrequest", e);
+ }
+ }
+ 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/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
index 4c9bb4259e..5451f9ff57 100644
--- 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
@@ -27,7 +27,6 @@ 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;
@@ -52,7 +51,6 @@ 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;
@@ -69,30 +67,31 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
private static final String TOPOLOGY_PROPERTIES = "topology.properties";
public static final String ONAP_IP = "ONAP_IP";
- private static final String POST_BODY_TEMPLATE = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://org.onap.so/requestsdb\"><soapenv:Header/><soapenv:Body>\n"+
- " <ns:updateResourceOperationStatus>\n"+
- " <errorCode>$errorCode</errorCode>\n"+
- " <jobId>$jobId</jobId>\n"+
- " <operType>$operType</operType>\n"+
- " <operationId>$operationId</operationId>\n"+
- " <progress>$progress</progress>\n"+
- " <resourceTemplateUUID>$resourceTemplateUUID</resourceTemplateUUID>\n"+
- " <serviceId>$serviceId</serviceId>\n"+
- " <status>$status</status>\n"+
- " <statusDescription>$statusDescription</statusDescription>\n"+
- " </ns:updateResourceOperationStatus></soapenv:Body></soapenv:Envelope>";
-
- private static final String GET_BODY_TEMPLATE = " <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://org.onap.so/requestsdb\"><soapenv:Header/><soapenv:Body>\n" +
- " <ns:getResourceOperationStatus>\n" +
- " <operationId>$operationId</operationId>\n" +
- " <resourceTemplateUUID>$resourceTemplateUUID</resourceTemplateUUID>\n" +
- " <serviceId>$serviceId</serviceId>\n" +
- " </ns:getResourceOperationStatus></soapenv:Body></soapenv:Envelope>";
+ private static final String POST_BODY_TEMPLATE =
+ "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://org.onap.so/requestsdb\"><soapenv:Header/><soapenv:Body>\n"
+ + " <ns:updateResourceOperationStatus>\n"
+ + " <errorCode>$errorCode</errorCode>\n" + " <jobId>$jobId</jobId>\n"
+ + " <operType>$operType</operType>\n"
+ + " <operationId>$operationId</operationId>\n"
+ + " <progress>$progress</progress>\n"
+ + " <resourceTemplateUUID>$resourceTemplateUUID</resourceTemplateUUID>\n"
+ + " <serviceId>$serviceId</serviceId>\n"
+ + " <status>$status</status>\n"
+ + " <statusDescription>$statusDescription</statusDescription>\n"
+ + " </ns:updateResourceOperationStatus></soapenv:Body></soapenv:Envelope>";
+
+ private static final String GET_BODY_TEMPLATE =
+ " <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://org.onap.so/requestsdb\"><soapenv:Header/><soapenv:Body>\n"
+ + " <ns:getResourceOperationStatus>\n"
+ + " <operationId>$operationId</operationId>\n"
+ + " <resourceTemplateUUID>$resourceTemplateUUID</resourceTemplateUUID>\n"
+ + " <serviceId>$serviceId</serviceId>\n"
+ + " </ns:getResourceOperationStatus></soapenv:Body></soapenv:Envelope>";
private void updateResOperStatus(ResourceOperationStatus resourceOperationStatus) throws RouteException {
logger.info("AbstractSdncOperationTask.updateResOperStatus begin!");
- String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint");
+ String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint");
HttpPost httpPost = new HttpPost(requestsdbEndPoint);
httpPost.addHeader("Authorization", "Basic YnBlbDpwYXNzd29yZDEk");
httpPost.addHeader("Content-type", "application/soap+xml");
@@ -119,12 +118,13 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
String result = null;
String errorMsg;
- try(CloseableHttpClient httpClient = HttpClients.createDefault()) {
+ 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());
+ if (closeableHttpResponse.getStatusLine().getStatusCode() != 200) {
+ logger.info("exception: fail for status code = {}",
+ closeableHttpResponse.getStatusLine().getStatusCode());
throw new RouteException(result, "SERVICE_GET_ERR");
}
@@ -171,9 +171,10 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
return getBody;
}
- private ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId, String resourceTemplateUUID) throws RouteException {
+ 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");
+ String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint");
HttpPost httpPost = new HttpPost(requestsdbEndPoint);
httpPost.addHeader("Authorization", "Basic YnBlbDpwYXNzd29yZDEk");
httpPost.addHeader("Content-type", "application/soap+xml");
@@ -224,7 +225,8 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
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!");
+ updateProgress(execution, RequestsDbConstant.Status.ERROR, null, "100",
+ "sendRestrequestAndHandleResponse finished!");
}
logger.info("AbstractSdncOperationTask.execute end!");
@@ -247,15 +249,11 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
return inputs;
}
- public abstract void sendRestrequestAndHandleResponse(DelegateExecution execution,
- Map<String, String> inputs,
- GenericResourceApi genericResourceApiClient) throws Exception;
+ public abstract void sendRestrequestAndHandleResponse(DelegateExecution execution, Map<String, String> inputs,
+ GenericResourceApi genericResourceApiClient) throws Exception;
- public void updateProgress(DelegateExecution execution,
- String status,
- String errorCode,
- String progress,
- String statusDescription) {
+ 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;
@@ -265,7 +263,8 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
resourceTemplateId = StringUtils.isBlank(resourceTemplateId) ? "" : resourceTemplateUUID;
resourceTemplateUUID = StringUtils.isBlank(resourceTemplateUUID) ? resourceTemplateId : resourceTemplateUUID;
try {
- ResourceOperationStatus resourceOperationStatus = getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID);
+ ResourceOperationStatus resourceOperationStatus =
+ getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID);
if (!StringUtils.isBlank(status)) {
resourceOperationStatus.setStatus(status);
}
@@ -284,8 +283,8 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
logger.info("exception: AbstractSdncOperationTask.updateProgress fail!");
logger.error("exception: AbstractSdncOperationTask.updateProgress fail:", exception);
logger.error("{} {} {} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(),
- " updateProgress catch exception: ", this.getTaskName(),
- ErrorCode.UnknownError.getValue(), exception.getClass().toString());
+ " updateProgress catch exception: ", this.getTaskName(), ErrorCode.UnknownError.getValue(),
+ exception.getClass().toString());
}
}
@@ -293,11 +292,11 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
protected boolean isSend2SdncDirectly() {
logger.info("AbstractSdncOperationTask.isSend2SdncDirectly begin!");
String sdncHost = UrnPropertiesReader.getVariable("sdnc.host");
- if (!StringUtils.isBlank(sdncHost)) {
- logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = true.");
- return true;
- }
-
+ if (!StringUtils.isBlank(sdncHost)) {
+ logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = true.");
+ return true;
+ }
+
logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = false.");
return false;
}
@@ -305,7 +304,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
protected String getSdncIp() {
logger.info("AbstractSdncOperationTask.getSdncIp begin.");
String sdncIp = null;
- sdncIp = UrnPropertiesReader.getVariable("sdnc-ip");
+ sdncIp = UrnPropertiesReader.getVariable("sdnc-ip");
String returnIp = StringUtils.isBlank(sdncIp) || !isIp(sdncIp) ? null : sdncIp;
logger.info("AbstractSdncOperationTask.getSdncIp: sdncIp = {}", returnIp);
return returnIp;
@@ -340,7 +339,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
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);
@@ -353,6 +352,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
}
public String getProcessKey(DelegateExecution execution) {
- return execution.getProcessEngineServices().getRepositoryService().getProcessDefinition(execution.getProcessDefinitionId()).getKey();
+ 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
index a5c609dc2a..4d58439fda 100644
--- 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
@@ -23,7 +23,6 @@
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;
@@ -49,29 +48,30 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask
private static final String URL = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation";
@Override
- public void sendRestrequestAndHandleResponse(DelegateExecution execution,
- Map<String, String> inputs,
- GenericResourceApi genericResourceApiClient) throws Exception {
+ public void sendRestrequestAndHandleResponse(DelegateExecution execution, Map<String, String> inputs,
+ GenericResourceApi genericResourceApiClient) throws Exception {
logger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse begin!");
- updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "40", "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);
+ 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!");
+ updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED,
+ "execute finished!");
logger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse end!");
}
- private void send2SdncDirectly(String defaulAuth,
- RpcNetworkTopologyOperationInputEntity inputEntity) throws RouteException {
+ private void send2SdncDirectly(String defaulAuth, RpcNetworkTopologyOperationInputEntity inputEntity)
+ throws RouteException {
logger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly begin!");
String url = "http://" + getSdncIp() + ":" + getSdncPort() + URL;
HttpPost httpPost = new HttpPost(url);
@@ -84,7 +84,8 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask
logger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly end!");
}
- private void saveOutput(DelegateExecution execution, RpcNetworkTopologyOperationOutputEntity output) throws RouteException {
+ private void saveOutput(DelegateExecution execution, RpcNetworkTopologyOperationOutputEntity output)
+ throws RouteException {
logger.info("SdncNetworkTopologyOperationTask.saveOutput begin!");
String responseCode = output.getOutput().getResponseCode();
if (!"200".equals(responseCode)) {
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
index 2fd550dbb8..4fb6817a39 100644
--- 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
@@ -24,7 +24,6 @@ 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;
@@ -50,9 +49,8 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask
private static final String URL = "/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation";
@Override
- public void sendRestrequestAndHandleResponse(DelegateExecution execution,
- Map<String, String> inputs,
- GenericResourceApi genericResourceApiClient) throws Exception {
+ public void sendRestrequestAndHandleResponse(DelegateExecution execution, Map<String, String> inputs,
+ GenericResourceApi genericResourceApiClient) throws Exception {
logger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse begin!");
updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!");
ServiceRpcInputEntityBuilder builder = new ServiceRpcInputEntityBuilder();
@@ -60,10 +58,10 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask
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);
+ outputEntity = genericResourceApiClient.postServiceTopologyOperation(HeaderUtil.DefaulAuth, inputEntity)
+ .execute().body();
+ updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!");
+ saveOutput(execution, outputEntity);
} else {
send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity);
}
@@ -71,8 +69,8 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask
}
- private void send2SdncDirectly(String defaulAuth,
- RpcServiceTopologyOperationInputEntity inputEntity) throws RouteException {
+ private void send2SdncDirectly(String defaulAuth, RpcServiceTopologyOperationInputEntity inputEntity)
+ throws RouteException {
logger.info("SdncServiceTopologyOperationTask.send2SdncDirectly begin!");
String url = getSdncHost() + URL;
HttpPost httpPost = new HttpPost(url);
@@ -85,7 +83,8 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask
logger.info("SdncServiceTopologyOperationTask.send2SdncDirectly end!");
}
- private void saveOutput(DelegateExecution execution, RpcServiceTopologyOperationOutputEntity output) throws Exception {
+ private void saveOutput(DelegateExecution execution, RpcServiceTopologyOperationOutputEntity output)
+ throws Exception {
logger.info("SdncServiceTopologyOperationTask.saveOutput begin!");
String responseCode = output.getOutput().getResponseCode();
if (!"200".equals(responseCode)) {
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
index f54d6692d6..001d8fb6c0 100644
--- 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
@@ -23,7 +23,6 @@
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;
@@ -46,33 +45,32 @@ public class SdncUnderlayVpnOperationClient {
private static Logger logger = LoggerFactory.getLogger(SdncUnderlayVpnOperationClient.class);
- public boolean excute(String msbIp,
- int msbPort,
- Map<String, String> inputs,
- String iServiceID,
- String iOperationID,
- String resourceTemplateUUID_i){
- ResourceOperationStatusId id = new ResourceOperationStatusId(iServiceID, iOperationID, resourceTemplateUUID_i);
+ public boolean excute(String msbIp, int msbPort, Map<String, String> 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<String, String> inputs, GenericResourceApi genericResourceApiClient){
+ public boolean sendRestrequestAndHandleResponse(ResourceOperationStatusId id, Map<String, String> 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;
+ // RpcNetworkTopologyOperationOutputEntity networkRpcOutputEntiy = null;
try {
- genericResourceApiClient.postNetworkTopologyOperation(HeaderUtil.DefaulAuth ,body).execute().body();
+ 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());
+ 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!");
+ updateProgress(id, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED,
+ "execute finished!");
return true;
}
@@ -88,13 +86,11 @@ public class SdncUnderlayVpnOperationClient {
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);
+ 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);
}
@@ -107,7 +103,7 @@ public class SdncUnderlayVpnOperationClient {
if (!StringUtils.isBlank(statusDescription)) {
resourceOperationStatus.setStatusDescription(statusDescription);
}
- //rosRepo.save(resourceOperationStatus);
+ // rosRepo.save(resourceOperationStatus);
}
private void saveOutput() {
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
index 8bc9dce966..5b7f3bb432 100644
--- 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
@@ -41,8 +41,13 @@ public class SdncUnderlayVpnPreprocessTask extends BaseTask {
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));
+ 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
index a837782a2c..ca9269242c 100644
--- 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
@@ -34,15 +34,15 @@ public interface GenericResourceApi {
@POST("/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation")
Call<ResponseBody> postNetworkTopologyOperation(@Header("Authorization") String authorization,
- @Body RequestBody input);
+ @Body RequestBody input);
@POST("/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation")
- Call<RpcNetworkTopologyOperationOutputEntity> postNetworkTopologyOperation(@Header("Authorization") String authorization,
- @Body RpcNetworkTopologyOperationInputEntity input);
+ Call<RpcNetworkTopologyOperationOutputEntity> postNetworkTopologyOperation(
+ @Header("Authorization") String authorization, @Body RpcNetworkTopologyOperationInputEntity input);
@POST("/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation")
- Call<RpcServiceTopologyOperationOutputEntity> postServiceTopologyOperation(@Header("Authorization") String authorization,
- @Body RpcServiceTopologyOperationInputEntity input);
+ Call<RpcServiceTopologyOperationOutputEntity> 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
index 696be02809..3da5b0de70 100644
--- 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
@@ -36,8 +36,7 @@ public class HeaderUtil {
private static String base64Encode(String str) {
String base64 = str;
try {
- base64 = Base64.getEncoder()
- .encodeToString(str.getBytes("utf-8"));
+ 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
index 961b846ace..21b14c35f9 100644
--- 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
@@ -24,7 +24,6 @@ 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;
@@ -35,205 +34,206 @@ import org.onap.so.requestsdb.RequestsDbConstant;
public abstract class AbstractBuilder<I, O> {
- 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;
+ 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<ParamEntity> getParamEntities(Map<String, String> inputs) {
- List<ParamEntity> 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");
- }
+ protected List<ParamEntity> getParamEntities(Map<String, String> inputs) {
+ List<ParamEntity> 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
index 547df2bb3a..4a2194ed3d 100644
--- 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
@@ -22,7 +22,6 @@ 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;
@@ -35,44 +34,53 @@ import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNet
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<Map<String, String>, RpcNetworkTopologyOperationInputEntity> {
+public class NetworkRpcInputEntityBuilder
+ extends AbstractBuilder<Map<String, String>, RpcNetworkTopologyOperationInputEntity> {
@Override
public RpcNetworkTopologyOperationInputEntity build(DelegateExecution execution, Map<String, String> inputs) {
- RpcNetworkTopologyOperationInputEntity rpcNetworkTopologyOperationInputEntity = new RpcNetworkTopologyOperationInputEntity();
- NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity = getNetworkTopologyOperationInputEntity(execution, inputs);
+ RpcNetworkTopologyOperationInputEntity rpcNetworkTopologyOperationInputEntity =
+ new RpcNetworkTopologyOperationInputEntity();
+ NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity =
+ getNetworkTopologyOperationInputEntity(execution, inputs);
rpcNetworkTopologyOperationInputEntity.setInput(networkTopologyOperationInputEntity);
return rpcNetworkTopologyOperationInputEntity;
}
- private void loadNetwrokRequestInputEntity(Map<String, String> inputs, NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) {
+ private void loadNetwrokRequestInputEntity(Map<String, String> inputs,
+ NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) {
NetworkRequestInputEntity networkRequestInputEntity = new NetworkRequestInputEntity();
- NetworkInputParametersEntity networkInputParametersEntity = new NetworkInputParametersEntity();
+ NetworkInputParametersEntity networkInputParametersEntity = new NetworkInputParametersEntity();
List<ParamEntity> paramEntityList = getParamEntities(inputs);
networkInputParametersEntity.setParamList(paramEntityList);
- networkRequestInputEntity.setNetworkInputPaarameters(networkInputParametersEntity);
+ networkRequestInputEntity.setNetworkInputPaarameters(networkInputParametersEntity);
networkTopologyOperationInputEntity.setNetworkRequestInput(networkRequestInputEntity);
}
- private void loadRequestInformationEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) {
+ private void loadRequestInformationEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity,
+ DelegateExecution execution) {
RequestInformationEntity requestInformationEntity = getRequestInformationEntity(execution);
networkTopologyOperationInputEntity.setRequestInformation(requestInformationEntity);
}
- private void loadSdncRequestHeaderEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) {
+ 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) {
+ private void loadServiceInformation(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity,
+ DelegateExecution execution) {
ServiceInformationEntity serviceInformationEntity = getServiceInformationEntity(execution);
networkTopologyOperationInputEntity.setServiceInformation(serviceInformationEntity);
}
- private NetworkTopologyOperationInputEntity getNetworkTopologyOperationInputEntity(DelegateExecution execution, Map<String, String> inputs) {
- NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity = new NetworkTopologyOperationInputEntity();
+ private NetworkTopologyOperationInputEntity getNetworkTopologyOperationInputEntity(DelegateExecution execution,
+ Map<String, String> inputs) {
+ NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity =
+ new NetworkTopologyOperationInputEntity();
loadSdncRequestHeaderEntity(networkTopologyOperationInputEntity, execution);
loadRequestInformationEntity(networkTopologyOperationInputEntity, execution);
loadServiceInformation(networkTopologyOperationInputEntity, execution);
@@ -81,7 +89,8 @@ public class NetworkRpcInputEntityBuilder extends AbstractBuilder<Map<String, St
return networkTopologyOperationInputEntity;
}
- private void loadNetworkInformationEntity(DelegateExecution execution, NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) {
+ private void loadNetworkInformationEntity(DelegateExecution execution,
+ NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) {
NetworkInformationEntity networkInformationEntity = new NetworkInformationEntity();
OnapModelInformationEntity onapModelInformationEntity = getOnapNetworkModelInformationEntity(execution);
networkInformationEntity.setOnapModelInformation(onapModelInformationEntity);
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
index 466652edff..944802372b 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -30,20 +29,26 @@ import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.Servic
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<Map<String, String>, RpcServiceTopologyOperationInputEntity> {
+public class ServiceRpcInputEntityBuilder
+ extends AbstractBuilder<Map<String, String>, RpcServiceTopologyOperationInputEntity> {
@Override
- public RpcServiceTopologyOperationInputEntity build(DelegateExecution execution, Map<String, String> inputs) throws Exception {
- RpcServiceTopologyOperationInputEntity rpcServiceTopologyOperationInputEntity = new RpcServiceTopologyOperationInputEntity();
- ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity = new ServiceTopologyOperationInputEntity();
+ public RpcServiceTopologyOperationInputEntity build(DelegateExecution execution, Map<String, String> 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);
+ rpcServiceTopologyOperationInputEntity
+ .setServiceTopologyOperationInputEntity(serviceTopologyOperationInputEntity);
return rpcServiceTopologyOperationInputEntity;
}
- private void loadServiceRequestInputEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) {
+ private void loadServiceRequestInputEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity,
+ DelegateExecution execution) {
ServiceRequestInputEntity serviceRequestInputEntity = getServiceRequestInputEntity(execution);
serviceTopologyOperationInputEntity.setServiceRequestInput(serviceRequestInputEntity);
}
@@ -54,17 +59,20 @@ public class ServiceRpcInputEntityBuilder extends AbstractBuilder<Map<String, St
return serviceRequestInputEntity;
}
- private void loadServiceInformation(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) {
+ private void loadServiceInformation(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity,
+ DelegateExecution execution) {
ServiceInformationEntity serviceInformationEntity = getServiceInformationEntity(execution);
serviceTopologyOperationInputEntity.setServiceInformation(serviceInformationEntity);
}
- private void loadRequestInformationEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) {
+ private void loadRequestInformationEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity,
+ DelegateExecution execution) {
RequestInformationEntity requestInformationEntity = getRequestInformationEntity(execution);
serviceTopologyOperationInputEntity.setRequestInformation(requestInformationEntity);
}
- private void loadSdncRequestHeaderEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) {
+ private void loadSdncRequestHeaderEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity,
+ DelegateExecution execution) {
SdncRequestHeaderEntity sdncRequestHeaderEntity = new SdncRequestHeaderEntity();
sdncRequestHeaderEntity.setSvcRequestId(getRequestId(execution));
sdncRequestHeaderEntity.setSvcAction(getSvcAction(execution));
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
index 0863917f21..847aa72469 100644
--- 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
@@ -21,13 +21,12 @@
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")
+ @JsonProperty("GENERIC-RESOURCE-API:param")
private List<ParamEntity> paramList;
-
+
public List<ParamEntity> getParamList() {
return paramList;
}
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
index af448942cc..238a4f32c0 100644
--- 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
@@ -23,7 +23,7 @@ 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")
+ @JsonProperty("GENERIC-RESOURCE-API:request-id")
private String requestId;
@JsonProperty("GENERIC-RESOURCE-API:request-action")
@@ -40,7 +40,7 @@ public class RequestInformationEntity {
@JsonProperty("GENERIC-RESOURCE-API:order-version")
private String orerVersion;
-
+
public String getRequestId() {
return requestId;
}
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
index 4e58a61750..76494f5585 100644
--- 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
@@ -23,9 +23,9 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity;
import com.fasterxml.jackson.annotation.JsonProperty;
public class RpcNetworkTopologyOperationInputEntity {
- @JsonProperty("GENERIC-RESOURCE-API:input")
+ @JsonProperty("GENERIC-RESOURCE-API:input")
private NetworkTopologyOperationInputEntity input = null;
-
+
public NetworkTopologyOperationInputEntity getInput() {
return 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
index 915a8a5e39..c93b3f2ad9 100644
--- 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
@@ -23,9 +23,9 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity;
import com.fasterxml.jackson.annotation.JsonProperty;
public class RpcNetworkTopologyOperationOutputEntity {
- @JsonProperty("GENERIC-RESOURCE-API:output")
+ @JsonProperty("GENERIC-RESOURCE-API:output")
private NetworkTopologyOperationOutputEntity output;
-
+
public NetworkTopologyOperationOutputEntity getOutput() {
return 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
index 145759e190..dbca00ae24 100644
--- 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
@@ -23,14 +23,15 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity;
import com.fasterxml.jackson.annotation.JsonProperty;
public class RpcServiceTopologyOperationInputEntity {
- @JsonProperty("GENERIC-RESOURCE-API:input")
+ @JsonProperty("GENERIC-RESOURCE-API:input")
private ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity;
-
+
public ServiceTopologyOperationInputEntity getServiceTopologyOperationInputEntity() {
return serviceTopologyOperationInputEntity;
}
- public void setServiceTopologyOperationInputEntity(ServiceTopologyOperationInputEntity 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/ServiceInputParametersEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java
index c1ba7dc614..5c199bd413 100644
--- 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
@@ -21,13 +21,12 @@
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")
+ @JsonProperty("GENERIC-RESOURCE-API:param")
private List<ParamEntity> paramList;
-
+
public List<ParamEntity> getParamList() {
return paramList;
}
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
index 0f77e41120..03d9b37522 100644
--- 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
@@ -19,14 +19,14 @@
*/
package org.onap.so.bpmn;
-import org.junit.runner.RunWith;
+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
+ // 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
index 57d842f8b5..7f86709432 100644
--- 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
@@ -19,14 +19,14 @@
*/
package org.onap.so.bpmn;
-import org.junit.runner.RunWith;
+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"})
+@SuiteClasses({"**/tasks/*Test.class", "**/infrastructure/aai/*Test.class"})
public class AllTasksTestsTestSuite {
- // the class remains empty,
- // used only as a holder for the above annotations
+ // 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
index ddcc6fe875..7123567247 100644
--- 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
@@ -23,19 +23,16 @@
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",
- "!**/infrastructure/scripts/*Test.class",
- "**/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.class",
- "**/infrastructure/scripts/DoUpdateNetworkInstanceTest.class",
- "**/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.class",
- "**/*Test.class"})
+@SuiteClasses({"!**/service/*Test.class", "!**/subprocess/*Test.class", "!**/process/*Test.class",
+ "!**/tasks/*Test.class", "!**/infrastructure/aai/*Test.class", "!**/infrastructure/scripts/*Test.class",
+ "**/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.class",
+ "**/infrastructure/scripts/DoUpdateNetworkInstanceTest.class",
+ "**/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.class", "**/*Test.class"})
public class AllTestsTestSuite {
- // the class remains empty,
- // used only as a holder for the above annotations
+ // 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
index f69521fd76..1c4074cae1 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -38,35 +37,31 @@ import com.openpojo.reflection.filters.FilterPackageInfo;
public class BeansTest {
- private PojoClassFilter filterTestClasses = new FilterTestClasses();
-
- private PojoClassFilter enumFilter = new FilterEnum();
-
+ 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())
- @Test
- public void pojoStructure() {
- test("org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity");
- }
+ .build();
- 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());
+ }
- 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/");
- }
- }
+ 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
index ad9e210452..c2af155d51 100644
--- 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
@@ -31,22 +31,19 @@ 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);
- }
+ @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
index 2e588b7078..289d97108f 100644
--- 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
@@ -28,10 +28,8 @@ 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;
@@ -48,150 +46,157 @@ 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));
-
-
- 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<String, String> 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<GenericVnf> 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(RuntimeException.class).when(aaiResourcesClient).get(isA(AAIResourceUri.class));
-
- Optional<GenericVnf> actualVnf = aaiCreateResources.getVnfInstance(vnfId);
-
- AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
-
- verify(aaiResourcesClient, times(1)).get(vnfURI);
- assertEquals(actualVnf, Optional.empty());
- }
+
+ 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));
+
+
+ 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<String, String> 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<GenericVnf> 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(RuntimeException.class).when(aaiResourcesClient).get(isA(AAIResourceUri.class));
+
+ Optional<GenericVnf> 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
index a540a6d2cc..1aca331a17 100644
--- 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
@@ -26,7 +26,6 @@ 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;
@@ -38,47 +37,47 @@ 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(RuntimeException.class).when(aaiResourcesClient).delete(isA(AAIResourceUri.class));
-
- aaiDeleteServiceInstance.execute(execution);
- }
+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(RuntimeException.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
index b68b787904..90576c9566 100644
--- 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
@@ -26,91 +26,91 @@ import org.junit.Test;
public class AAIServiceInstanceTest {
- AAIServiceInstance test = new AAIServiceInstance.AAIServiceInstanceBuilder()
- .setServiceInstanceName("serviceInstanceName").setServiceType("serviceType").setServiceRole("serviceRole")
- .setOrchestrationStatus("orchestrationStatus").setModelInvariantUuid("modelInvariantUuid")
- .setModelVersionId("modelVersionId").setEnvironmentContext("environmentContext")
- .setWorkloadContext("workloadContext").createAAIServiceInstance();
-
- @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");
- }
+ AAIServiceInstance test = new AAIServiceInstance.AAIServiceInstanceBuilder()
+ .setServiceInstanceName("serviceInstanceName").setServiceType("serviceType").setServiceRole("serviceRole")
+ .setOrchestrationStatus("orchestrationStatus").setModelInvariantUuid("modelInvariantUuid")
+ .setModelVersionId("modelVersionId").setEnvironmentContext("environmentContext")
+ .setWorkloadContext("workloadContext").createAAIServiceInstance();
+
+ @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
index ebcce191e9..9030fa8328 100644
--- 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
@@ -22,7 +22,6 @@ 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;
@@ -34,25 +33,25 @@ 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));
- }
-
+ @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/delegate/CancelDmaapSubscriptionTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
index b0ff82e3aa..c67b44e44a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.junit.Test;
-
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
@@ -37,7 +36,8 @@ public class CancelDmaapSubscriptionTest {
DmaapClientTestImpl dmaapClientTest = new DmaapClientTestImpl();
delegate.setDmaapClient(dmaapClientTest);
DelegateExecution delegateExecution = mock(DelegateExecution.class);
- when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID))).thenReturn("testPnfCorrelationId");
+ when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID)))
+ .thenReturn("testPnfCorrelationId");
when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey");
dmaapClientTest.registerForUpdate("testPnfCorrelationId", () -> {
});
@@ -46,4 +46,4 @@ public class CancelDmaapSubscriptionTest {
// then
assertThat(dmaapClientTest.haveRegisteredConsumer()).isFalse();
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegateTest.java
index 6a0aaf776e..4206d796f6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegateTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegateTest.java
@@ -29,7 +29,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.PnfManagementTestImpl
import static org.onap.so.bpmn.infrastructure.pnf.delegate.PnfManagementTestImpl.ID_WITH_ENTRY;
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.PNF_CORRELATION_ID;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.junit.Before;
@@ -46,9 +45,9 @@ public class CheckAaiForPnfCorrelationIdDelegateTest {
public static class ConnectionOkTests {
private CheckAaiForPnfCorrelationIdDelegate delegate;
-
+
@Rule
- public ExpectedException expectedException = ExpectedException.none();
+ public ExpectedException expectedException = ExpectedException.none();
@Before
public void setUp() {
@@ -94,9 +93,9 @@ public class CheckAaiForPnfCorrelationIdDelegateTest {
public static class NoConnectionTests {
private CheckAaiForPnfCorrelationIdDelegate delegate;
-
+
@Rule
- public ExpectedException expectedException = ExpectedException.none();
+ public ExpectedException expectedException = ExpectedException.none();
@Before
public void setUp() {
@@ -116,4 +115,4 @@ public class CheckAaiForPnfCorrelationIdDelegateTest {
verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class));
}
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegateTest.java
index 571f64335f..5000ca017c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegateTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegateTest.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * Foundation. ================================================================================ Licensed under the
+ * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
+ * obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and limitations under the
+ * License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.pnf.delegate;
@@ -30,7 +25,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_INSTANCE_NAME;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_MODEL_INFO;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SKIP_POST_INSTANTIATION_CONFIGURATION;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -52,7 +46,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {CatalogDbClient.class, ExceptionBuilder.class, ConfigCheckerDelegate.class,
- ProcessEngineConfiguration.class})
+ ProcessEngineConfiguration.class})
public class ConfigCheckerDelegateTest {
private static String TEST_PROCESS_KEY = "processKey1";
@@ -64,14 +58,11 @@ public class ConfigCheckerDelegateTest {
/**
* Service model info json.
*/
- private static String TEST_SERVICE_MODEL_INFO = "{\n"
- + " \"modelType\":\"service\",\n"
- + " \"modelInvariantUuid\":\"539b7a2f-9524-4dbf-9eee-f2e05521df3f\",\n"
- + " \"modelInvariantId\":\"539b7a2f-9524-4dbf-9eee-f2e05521df3f\",\n"
- + " \"modelUuid\":\"f2daaac6-5017-4e1e-96c8-6a27dfbe1421\",\n"
- + " \"modelName\":\"PNF_demo_resource\",\n"
- + " \"modelVersion\":\"1.0\"\n"
- + " }";
+ private static String TEST_SERVICE_MODEL_INFO = "{\n" + " \"modelType\":\"service\",\n"
+ + " \"modelInvariantUuid\":\"539b7a2f-9524-4dbf-9eee-f2e05521df3f\",\n"
+ + " \"modelInvariantId\":\"539b7a2f-9524-4dbf-9eee-f2e05521df3f\",\n"
+ + " \"modelUuid\":\"f2daaac6-5017-4e1e-96c8-6a27dfbe1421\",\n"
+ + " \"modelName\":\"PNF_demo_resource\",\n" + " \"modelVersion\":\"1.0\"\n" + " }";
/**
* Testing model UUID, should be the same as specified in the TEST_SERVICE_MODEL_INFO.
@@ -94,7 +85,7 @@ public class ConfigCheckerDelegateTest {
List<PnfResourceCustomization> pnfResourceCustomizations = new ArrayList<>();
pnfResourceCustomizations.add(buildPnfResourceCustomization());
given(catalogDbClient.getPnfResourceCustomizationByModelUuid(TEST_MODEL_UUID))
- .willReturn(pnfResourceCustomizations);
+ .willReturn(pnfResourceCustomizations);
execution.setVariable("testProcessKey", TEST_PROCESS_KEY);
execution.setVariable(SERVICE_MODEL_INFO, TEST_SERVICE_MODEL_INFO);
}
@@ -128,12 +119,12 @@ public class ConfigCheckerDelegateTest {
@Test
public void testExecution_EmptyPnfResourceCustomization_exceptionThrown() {
given(catalogDbClient.getPnfResourceCustomizationByModelUuid("f2daaac6-5017-4e1e-96c8-6a27dfbe1421"))
- .willReturn(Collections.EMPTY_LIST);
+ .willReturn(Collections.EMPTY_LIST);
assertThatThrownBy(() -> configCheckerDelegate.execute(execution)).isInstanceOf(BpmnError.class);
assertThat(execution.getVariable("WorkflowExceptionErrorMessage")).asString()
- .contains("Unable to find the PNF resource customizations of model service UUID")
- .contains("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
+ .contains("Unable to find the PNF resource customizations of model service UUID")
+ .contains("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
assertThat(execution.getVariable("WorkflowException")).isInstanceOf(WorkflowException.class);
}
@@ -142,7 +133,7 @@ public class ConfigCheckerDelegateTest {
execution.removeVariable("serviceModelInfo");
assertThatThrownBy(() -> configCheckerDelegate.execute(execution)).isInstanceOf(BpmnError.class);
assertThat(execution.getVariable("WorkflowExceptionErrorMessage")).asString()
- .contains("Unable to find parameter serviceModelInfo");
+ .contains("Unable to find parameter serviceModelInfo");
assertThat(execution.getVariable("WorkflowException")).isInstanceOf(WorkflowException.class);
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java
index 986edfeecf..c90235b103 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java
@@ -27,7 +27,6 @@ import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
-
import java.util.UUID;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.junit.Test;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java
index c743ee7018..85a9a5c166 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java
@@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
-
import java.io.IOException;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java
index 8a1cdfa4c0..597d111e2c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.assertj.core.api.Assertions.assertThat;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Test;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
index eb9f657d4f..446c73dda1 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
@@ -27,7 +27,6 @@ import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InOrder;
-
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
@@ -74,7 +73,8 @@ public class InformDmaapClientTest {
private DelegateExecution mockDelegateExecution() {
DelegateExecution delegateExecution = mock(DelegateExecution.class);
- when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID))).thenReturn("testPnfCorrelationId");
+ when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID)))
+ .thenReturn("testPnfCorrelationId");
when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey");
ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class);
when(delegateExecution.getProcessEngineServices()).thenReturn(processEngineServices);
@@ -85,4 +85,4 @@ public class InformDmaapClientTest {
when(messageCorrelationBuilder.processInstanceBusinessKey(any())).thenReturn(messageCorrelationBuilder);
return delegateExecution;
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
index 001815b206..6c8716cbd7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
@@ -24,7 +24,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID;
-
import java.util.UUID;
import org.apache.commons.lang3.StringUtils;
import org.camunda.bpm.engine.delegate.BpmnError;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java
index 3a9d6d0055..8577d9555b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate;
import org.onap.aai.domain.yang.Pnf;
import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
-
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@@ -51,8 +50,7 @@ public class PnfManagementTestImpl implements PnfManagement {
}
@Override
- public void createRelation(String serviceInstanceId, String pnfName) {
- }
+ public void createRelation(String serviceInstanceId, String pnfName) {}
public Map<String, Pnf> getCreated() {
return created;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegateTest.java
index 8d817e5bca..110ee2146c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegateTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegateTest.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * Foundation. ================================================================================ Licensed under the
+ * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
+ * obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and limitations under the
+ * License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.pnf.delegate;
@@ -32,7 +27,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_CUSTOMIZATION_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_INSTANCE_NAME;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID;
-
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
@@ -72,7 +66,7 @@ public class PrepareConfigAssignDelegateTest {
private DelegateExecution execution = new DelegateExecutionFake();
@Before
- public void setUp(){
+ public void setUp() {
execution.setVariable("testProcessKey", TEST_PROCESS_KEY);
execution.setVariable(PNF_CORRELATION_ID, TEST_PNF_CORRELATION_ID);
execution.setVariable(MODEL_UUID, TEST_MODEL_UUID);
@@ -118,8 +112,8 @@ public class PrepareConfigAssignDelegateTest {
try {
ObjectMapper mapper = new ObjectMapper();
JsonNode tree = mapper.readTree(requestObject);
- ConfigAssignRequestPnf configAssignRequestPnf = mapper
- .treeToValue(tree.at("/config-assign-request"), ConfigAssignRequestPnf.class);
+ ConfigAssignRequestPnf configAssignRequestPnf =
+ mapper.treeToValue(tree.at("/config-assign-request"), ConfigAssignRequestPnf.class);
assertThat(configAssignRequestPnf.getResolutionKey()).matches(TEST_PNF_CORRELATION_ID);
ConfigAssignPropertiesForPnf properties = configAssignRequestPnf.getConfigAssignPropertiesForPnf();
@@ -133,4 +127,4 @@ public class PrepareConfigAssignDelegateTest {
fail("Check request body is json message" + e.getMessage());
}
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegateTest.java
index 0964d2146b..8d19d9e563 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegateTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegateTest.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * Foundation. ================================================================================ Licensed under the
+ * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
+ * obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and limitations under the
+ * License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.pnf.delegate;
@@ -34,7 +29,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_CUSTOMIZATION_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_INSTANCE_NAME;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID;
-
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
@@ -119,7 +113,7 @@ public class PrepareConfigDeployDelegateTest {
}
@Test
- public void testExecution_failedAaiConnection_exceptionThrown(){
+ public void testExecution_failedAaiConnection_exceptionThrown() {
try {
/**
* Mock the IOException from AAI.
@@ -128,13 +122,14 @@ public class PrepareConfigDeployDelegateTest {
} catch (IOException e) {
e.printStackTrace();
}
- assertThatThrownBy(()->prepareConfigDeployDelegate.execute(execution)).isInstanceOf(BpmnError.class);
- assertThat(execution.getVariable("WorkflowExceptionErrorMessage")).asString().contains("Unable to fetch from AAI");
+ assertThatThrownBy(() -> prepareConfigDeployDelegate.execute(execution)).isInstanceOf(BpmnError.class);
+ assertThat(execution.getVariable("WorkflowExceptionErrorMessage")).asString()
+ .contains("Unable to fetch from AAI");
assertThat(execution.getVariable("WorkflowException")).isInstanceOf(WorkflowException.class);
}
@Test
- public void testExecution_aaiEntryNotExist_exceptionThrown(){
+ public void testExecution_aaiEntryNotExist_exceptionThrown() {
try {
/**
* Mock the AAI without PNF.
@@ -143,8 +138,9 @@ public class PrepareConfigDeployDelegateTest {
} catch (IOException e) {
e.printStackTrace();
}
- assertThatThrownBy(()->prepareConfigDeployDelegate.execute(execution)).isInstanceOf(BpmnError.class);
- assertThat(execution.getVariable("WorkflowExceptionErrorMessage")).asString().contains("AAI entry for PNF: " + TEST_PNF_CORRELATION_ID + " does not exist");
+ assertThatThrownBy(() -> prepareConfigDeployDelegate.execute(execution)).isInstanceOf(BpmnError.class);
+ assertThat(execution.getVariable("WorkflowExceptionErrorMessage")).asString()
+ .contains("AAI entry for PNF: " + TEST_PNF_CORRELATION_ID + " does not exist");
assertThat(execution.getVariable("WorkflowException")).isInstanceOf(WorkflowException.class);
}
@@ -167,12 +163,11 @@ public class PrepareConfigDeployDelegateTest {
try {
ObjectMapper mapper = new ObjectMapper();
JsonNode tree = mapper.readTree(requestObject);
- ConfigDeployRequestPnf configDeployRequestPnf = mapper
- .treeToValue(tree.at("/config-deploy-request"), ConfigDeployRequestPnf.class);
+ ConfigDeployRequestPnf configDeployRequestPnf =
+ mapper.treeToValue(tree.at("/config-deploy-request"), ConfigDeployRequestPnf.class);
assertThat(configDeployRequestPnf.getResolutionKey()).matches(TEST_PNF_CORRELATION_ID);
- ConfigDeployPropertiesForPnf properties = configDeployRequestPnf
- .getConfigDeployPropertiesForPnf();
+ ConfigDeployPropertiesForPnf properties = configDeployRequestPnf.getConfigDeployPropertiesForPnf();
assertThat(properties.getServiceInstanceId()).matches(TEST_SERVICE_INSTANCE_ID);
assertThat(properties.getPnfName()).matches(TEST_PNF_CORRELATION_ID);
assertThat(properties.getPnfId()).matches(TEST_PNF_UUID);
@@ -185,4 +180,4 @@ public class PrepareConfigDeployDelegateTest {
fail("Check request body is json message" + e.getMessage());
}
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java
index 17a6ee09d8..8741208d26 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java
@@ -23,7 +23,6 @@
package org.onap.so.bpmn.infrastructure.pnf.dmaap;
import static org.assertj.core.api.Assertions.assertThat;
-
import java.util.List;
import org.junit.Test;
@@ -41,12 +40,12 @@ public class JsonUtilForPnfCorrelationIdTest {
@Test
public void parseJsonSuccessful() {
- List<String> expectedResult = JsonUtilForPnfCorrelationId
- .parseJsonToGelAllPnfCorrelationId(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID);
+ List<String> expectedResult =
+ JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID);
assertThat(expectedResult).containsExactly("corrTest1", "corrTest2");
- List<String> expectedResult2 = JsonUtilForPnfCorrelationId
- .parseJsonToGelAllPnfCorrelationId(JSON_WITH_ONE_PNF_CORRELATION_ID);
+ List<String> expectedResult2 =
+ JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(JSON_WITH_ONE_PNF_CORRELATION_ID);
assertThat(expectedResult2).containsExactly("corrTest3");
}
@@ -59,8 +58,8 @@ public class JsonUtilForPnfCorrelationIdTest {
@Test
public void parseJson_emptyListReturnedWhenNothingFound() {
- List<String> expectedResult = JsonUtilForPnfCorrelationId
- .parseJsonToGelAllPnfCorrelationId(JSON_WITH_NO_PNF_CORRELATION_ID);
+ List<String> expectedResult =
+ JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(JSON_WITH_NO_PNF_CORRELATION_ID);
assertThat(expectedResult).isEmpty();
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
index cbfe6c1512..ca3373e8cb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
@@ -30,14 +30,12 @@ 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.ScheduledThreadPoolExecutor;
-
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.ProtocolVersion;
@@ -53,6 +51,7 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.infrastructure.pnf.dmaap.PnfEventReadyDmaapClient.DmaapTopicListenerThread;
import org.springframework.core.env.Environment;
+
@RunWith(MockitoJUnitRunner.class)
public class PnfEventReadyDmaapClientTest {
@@ -83,8 +82,8 @@ public class PnfEventReadyDmaapClientTest {
@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);
+ when(env.getProperty(eq("pnf.dmaap.port"), eq(Integer.class))).thenReturn(PORT);
+ when(env.getProperty(eq("pnf.dmaap.host"))).thenReturn(HOST);
when(env.getProperty(eq("pnf.dmaap.protocol"))).thenReturn(PROTOCOL);
when(env.getProperty(eq("pnf.dmaap.uriPathPrefix"))).thenReturn(URI_PATH_PREFIX);
when(env.getProperty(eq("pnf.dmaap.topicName"))).thenReturn(EVENT_TOPIC_TEST);
@@ -102,56 +101,60 @@ public class PnfEventReadyDmaapClientTest {
/**
* Test run method, where the are following conditions:
- * <p> - DmaapThreadListener is running, flag is set to true
- * <p> - map is filled with one entry with the key that we get from response
- * <p> 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
+ * <p>
+ * - DmaapThreadListener is running, flag is set to true
+ * <p>
+ * - map is filled with one entry with the key that we get from response
+ * <p>
+ * 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 pnfCorrelationIdIsFoundInHttpResponse_notifyAboutPnfReady()
- throws IOException {
- when(httpClientMock.execute(any(HttpGet.class))).
- thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID, PNF_CORRELATION_ID)));
+ public void pnfCorrelationIdIsFoundInHttpResponse_notifyAboutPnfReady() throws IOException {
+ when(httpClientMock.execute(any(HttpGet.class)))
+ .thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID, PNF_CORRELATION_ID)));
testedObjectInnerClassThread.run();
ArgumentCaptor<HttpGet> captor1 = ArgumentCaptor.forClass(HttpGet.class);
- verify(httpClientMock).execute(captor1.capture());
-
- assertEquals(captor1.getValue().getURI().getHost(),HOST);
- assertEquals(captor1.getValue().getURI().getPort(),PORT);
- assertEquals(captor1.getValue().getURI().getScheme(),PROTOCOL);
- assertEquals(captor1.getValue().getURI().getPath(),"/" + URI_PATH_PREFIX + "/" + EVENT_TOPIC_TEST + "/" + CONSUMER_GROUP + "/" + CONSUMER_ID + "");
-
- //verify(threadMockToNotifyCamundaFlow).run();
+ verify(httpClientMock).execute(captor1.capture());
+
+ assertEquals(captor1.getValue().getURI().getHost(), HOST);
+ assertEquals(captor1.getValue().getURI().getPort(), PORT);
+ assertEquals(captor1.getValue().getURI().getScheme(), PROTOCOL);
+ assertEquals(captor1.getValue().getURI().getPath(),
+ "/" + URI_PATH_PREFIX + "/" + EVENT_TOPIC_TEST + "/" + CONSUMER_GROUP + "/" + CONSUMER_ID + "");
+
+ // verify(threadMockToNotifyCamundaFlow).run();
verify(executorMock).shutdown();
}
/**
* Test run method, where the are following conditions:
- * <p> - DmaapThreadListener is running, flag is set to true
- * <p> - map is filled with one entry with the pnfCorrelationId that does not match to pnfCorrelationId
- * taken from http response. run method should not do anything with the map not run any thread to notify camunda
- * process
+ * <p>
+ * - DmaapThreadListener is running, flag is set to true
+ * <p>
+ * - map is filled with one entry with the pnfCorrelationId that does not match to pnfCorrelationId taken from http
+ * response. run method should not do anything with the map not run any thread to notify camunda process
*/
@Test
- public void pnfCorrelationIdIsFoundInHttpResponse_NotFoundInMap()
- throws IOException {
- when(httpClientMock.execute(any(HttpGet.class))).
- thenReturn(createResponse(
- String.format(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID, PNF_CORRELATION_ID_NOT_FOUND_IN_MAP)));
+ public void pnfCorrelationIdIsFoundInHttpResponse_NotFoundInMap() throws IOException {
+ when(httpClientMock.execute(any(HttpGet.class))).thenReturn(createResponse(
+ String.format(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID, PNF_CORRELATION_ID_NOT_FOUND_IN_MAP)));
testedObjectInnerClassThread.run();
verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock);
}
/**
* Test run method, where the are following conditions:
- * <p> - DmaapThreadListener is running, flag is set to true
- * <p> - map is filled with one entry with the pnfCorrelationId 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
+ * <p>
+ * - DmaapThreadListener is running, flag is set to true
+ * <p>
+ * - map is filled with one entry with the pnfCorrelationId 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 pnfCorrelationIdIsNotFoundInHttpResponse() throws IOException {
- when(httpClientMock.execute(any(HttpGet.class))).
- thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_PNF_CORRELATION_ID));
+ when(httpClientMock.execute(any(HttpGet.class)))
+ .thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_PNF_CORRELATION_ID));
testedObjectInnerClassThread.run();
verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock);
}
@@ -167,8 +170,7 @@ public class PnfEventReadyDmaapClientTest {
executorField.set(testedObject, executorMock);
executorField.setAccessible(false);
- Field pnfCorrelationToThreadMapField = testedObject.getClass()
- .getDeclaredField("pnfCorrelationIdToThreadMap");
+ Field pnfCorrelationToThreadMapField = testedObject.getClass().getDeclaredField("pnfCorrelationIdToThreadMap");
pnfCorrelationToThreadMapField.setAccessible(true);
Map<String, Runnable> pnfCorrelationToThreadMap = new ConcurrentHashMap<>();
pnfCorrelationToThreadMap.put(PNF_CORRELATION_ID, threadMockToNotifyCamundaFlow);
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
index 239361d306..61a4654668 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -30,16 +29,12 @@ 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";
+ 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);
- }
+ @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/service/ServicePluginFactoryTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java
index 6e22123996..0b4050beec 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java
@@ -20,7 +20,6 @@
package org.onap.so.bpmn.infrastructure.workflow.service;
import static org.mockito.Mockito.doReturn;
-
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -38,80 +37,53 @@ public class ServicePluginFactoryTest {
@Spy
ServicePluginFactory servicePluginFactory;
- String uuiRequest = "{"
- + " \"service\":{"
- + " \"name\":\"ONAP_223531\","
- + " \"description\":\"ONAP_1546\","
- + " \"serviceInvariantUuid\":\"4a09419a-c9fd-4a53-b1bd-b49603169ca1\","
- + " \"serviceUuid\":\"1bd0eae6-2dcc-4461-9ae6-56d641f369d6\","
- + " \"globalSubscriberId\":\"test_custormer\","
- + " \"serviceType\":\"example-service-type\","
- + " \"parameters\":{"
- + " \"locationConstraints\":["
- + " ],"
- + " \"resources\":["
- + " {"
- + " \"resourceName\":\"vEPC_ONAP01\","
- + " \"resourceInvariantUuid\":\"36ebe421-283a-4ee8-92f1-d09e7c44b911\","
- + " \"resourceUuid\":\"27a0e235-b67a-4ea4-a0cf-25761afed111\","
- + " \"resourceCustomizationUuid\":\"47a0e235-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\","
- + " \"CallSource\":\"NOT-ExternalAPI\","
- + " \"sotnconnectivity\":\"\""
- + " }"
- + " }"
- + " }"
- + "}";
+ String uuiRequest = "{" + " \"service\":{" + " \"name\":\"ONAP_223531\","
+ + " \"description\":\"ONAP_1546\","
+ + " \"serviceInvariantUuid\":\"4a09419a-c9fd-4a53-b1bd-b49603169ca1\","
+ + " \"serviceUuid\":\"1bd0eae6-2dcc-4461-9ae6-56d641f369d6\","
+ + " \"globalSubscriberId\":\"test_custormer\"," + " \"serviceType\":\"example-service-type\","
+ + " \"parameters\":{" + " \"locationConstraints\":[" + " ],"
+ + " \"resources\":[" + " {"
+ + " \"resourceName\":\"vEPC_ONAP01\","
+ + " \"resourceInvariantUuid\":\"36ebe421-283a-4ee8-92f1-d09e7c44b911\","
+ + " \"resourceUuid\":\"27a0e235-b67a-4ea4-a0cf-25761afed111\","
+ + " \"resourceCustomizationUuid\":\"47a0e235-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\","
+ + " \"CallSource\":\"NOT-ExternalAPI\"," + " \"sotnconnectivity\":\"\""
+ + " }" + " }" + " }" + "}";
@Test
@@ -123,16 +95,14 @@ public class ServicePluginFactoryTest {
@Test
public void doProcessSiteLocation_uuiObjectNull() {
String faultyJsonInput = "site_address,sotncondition_clientsignal";
- String result = servicePluginFactory.doProcessSiteLocation(
- serviceDecomposition, faultyJsonInput);
+ String result = servicePluginFactory.doProcessSiteLocation(serviceDecomposition, faultyJsonInput);
Assert.assertEquals(result, faultyJsonInput);
}
@Test
public void doProcessSiteLocation_isSiteLocationLocal() {
String jsonWithOnlyNeededValues = "{\"site_address\":\"\",\"sotncondition_clientsignal\":\"\"}";
- String result = servicePluginFactory.doProcessSiteLocation(
- serviceDecomposition, jsonWithOnlyNeededValues);
+ String result = servicePluginFactory.doProcessSiteLocation(serviceDecomposition, jsonWithOnlyNeededValues);
Assert.assertEquals(result, jsonWithOnlyNeededValues);
}
@@ -153,7 +123,7 @@ public class ServicePluginFactoryTest {
@Test
public void doTPResourcesAllocation_isNeedAllocateCrossTPResources() {
- //doReturn(null).when(servicePluginFactory).getTPsfromAAI();
+ // doReturn(null).when(servicePluginFactory).getTPsfromAAI();
String jsonWithOnlyNeededValues = "{\"site_address\":\"\",\"sotncondition_clientsignal\":\"\"}";
String result = servicePluginFactory.doTPResourcesAllocation(null, jsonWithOnlyNeededValues);
Assert.assertEquals(result, jsonWithOnlyNeededValues);
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
index ca8ec22088..f523e7ab1d 100644
--- 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
@@ -20,15 +20,14 @@
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);
+ 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
index 4ac131f873..6f884cb126 100644
--- 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
@@ -20,13 +20,11 @@
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.ProcessEngine;
import org.camunda.bpm.engine.ProcessEngineServices;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -52,10 +50,10 @@ public class AbstractBuilderTest {
DelegateExecution delegateExecution = new DelegateExecution() {
private String operType;
- private String resourceType;
- private String requestId;
+ private String resourceType;
+ private String requestId;
- @Override
+ @Override
public String getProcessInstanceId() {
return null;
}
@@ -207,14 +205,14 @@ public class AbstractBuilderTest {
@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;
+ 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
@@ -254,13 +252,13 @@ public class AbstractBuilderTest {
@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;
- }
+ 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
@@ -328,27 +326,27 @@ public class AbstractBuilderTest {
}
- @Override
- public ProcessEngine getProcessEngine(){
- // TODO Auto-generated method stub
- return null;
- }
+ @Override
+ public ProcessEngine getProcessEngine() {
+ // TODO Auto-generated method stub
+ return null;
+ }
- @Override
- public void setProcessBusinessKey(String arg0){
- // TODO Auto-generated method stub
+ @Override
+ public void setProcessBusinessKey(String arg0) {
+ // TODO Auto-generated method stub
- }
+ }
};
@Test
public void requestActionGetIntValueTest() {
- assertEquals(0, RequestAction.CREATE_NETWORK_INSTANCE.getIntValue());
+ assertEquals(0, RequestAction.CREATE_NETWORK_INSTANCE.getIntValue());
}
@Test
public void svcActionGetIntValueTest() {
- assertEquals(0, SvcAction.RESERVE.getIntValue());
+ assertEquals(0, SvcAction.RESERVE.getIntValue());
}
@Test
@@ -358,81 +356,93 @@ public class AbstractBuilderTest {
@Test
public void getRequestActionBlankOperationTypeTest() throws Exception {
- assertEquals(AbstractBuilder.RequestAction.CREATE_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
+ 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));
+ 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));
+ 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));
+ 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));
+ 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));
+ 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));
+ 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));
+ 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));
+ 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));
+ 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));
+ 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));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, "bad");
+ assertEquals(AbstractBuilder.RequestAction.CREATE_NETWORK_INSTANCE.getName(),
+ abstractBuilder.getRequestAction(delegateExecution));
}
@Test
@@ -442,95 +452,95 @@ public class AbstractBuilderTest {
@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));
+ 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));
+ 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));
+ 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));
+ 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));
+ 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));
+ 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));
+ 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));
+ 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));
+ 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));
+ 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));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, "bad");
+ assertEquals(AbstractBuilder.SvcAction.CREATE.getName(), abstractBuilder.getSvcAction(delegateExecution));
}
@Test
public void getRequestIdBlankNotOnExecutionTest() {
- abstractBuilder.getRequestId(delegateExecution);
+ abstractBuilder.getRequestId(delegateExecution);
}
@Test
public void getRequestIdBlankOnExecutionTest() {
- String expected = "requestId";
- delegateExecution.setVariable("msoRequestId", expected);
- assertEquals(expected, abstractBuilder.getRequestId(delegateExecution));
+ 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));
+ String expected = "requestId";
+ abstractBuilder.requestId = expected;
+ assertEquals(expected, abstractBuilder.getRequestId(delegateExecution));
}
@Test
@@ -545,8 +555,8 @@ public class AbstractBuilderTest {
@Test
public void getParamEntitiesTest() throws Exception {
- Map<String, String> inputs = new HashMap<>();
- inputs.put("foo", "bar");
+ Map<String, String> inputs = new HashMap<>();
+ inputs.put("foo", "bar");
List<ParamEntity> list = abstractBuilder.getParamEntities(inputs);
assertEquals(1, list.size());
assertEquals("foo", list.get(0).getName());
@@ -555,14 +565,14 @@ public class AbstractBuilderTest {
@Test
public void getParamEntitiesNullInputsTest() {
- List<ParamEntity> list = abstractBuilder.getParamEntities(null);
- assertEquals(0, list.size());
+ List<ParamEntity> list = abstractBuilder.getParamEntities(null);
+ assertEquals(0, list.size());
}
@Test
public void getParamEntitiesEmptyInputsTest() {
- List<ParamEntity> list = abstractBuilder.getParamEntities(new HashMap<>());
- assertEquals(0, list.size());
+ List<ParamEntity> list = abstractBuilder.getParamEntities(new HashMap<>());
+ assertEquals(0, list.size());
}
@Test
@@ -580,4 +590,4 @@ public class AbstractBuilderTest {
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
index 4e39c7b4e3..ed16f5d197 100644
--- 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
@@ -23,7 +23,6 @@ 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.ProcessEngine;
import org.camunda.bpm.engine.ProcessEngineServices;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -35,14 +34,14 @@ import org.camunda.bpm.model.bpmn.instance.FlowElement;
import org.junit.Test;
public class NetworkRpcInputEntityBuilderTest {
- NetworkRpcInputEntityBuilder networRpcInputEntityBuilder = new NetworkRpcInputEntityBuilder();
+ NetworkRpcInputEntityBuilder networRpcInputEntityBuilder = new NetworkRpcInputEntityBuilder();
- DelegateExecution delegateExecution = new DelegateExecution() {
+ DelegateExecution delegateExecution = new DelegateExecution() {
private String operType;
- private String resourceType;
- private String requestId;
+ private String resourceType;
+ private String requestId;
- @Override
+ @Override
public String getProcessInstanceId() {
return null;
}
@@ -194,14 +193,14 @@ public class NetworkRpcInputEntityBuilderTest {
@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;
+ 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
@@ -241,13 +240,13 @@ public class NetworkRpcInputEntityBuilderTest {
@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;
- }
+ 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
@@ -315,22 +314,22 @@ public class NetworkRpcInputEntityBuilderTest {
}
- @Override
- public ProcessEngine getProcessEngine(){
- // TODO Auto-generated method stub
- return null;
- }
+ @Override
+ public ProcessEngine getProcessEngine() {
+ // TODO Auto-generated method stub
+ return null;
+ }
- @Override
- public void setProcessBusinessKey(String arg0){
- // TODO Auto-generated method stub
+ @Override
+ public void setProcessBusinessKey(String arg0) {
+ // TODO Auto-generated method stub
- }
+ }
};
- @Test
- public void buildTest() {
- networRpcInputEntityBuilder.build(delegateExecution, null);
- }
+ @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
index 556ff67fad..3d1b1de8c0 100644
--- 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
@@ -23,7 +23,6 @@ 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.ProcessEngine;
import org.camunda.bpm.engine.ProcessEngineServices;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -35,14 +34,14 @@ import org.camunda.bpm.model.bpmn.instance.FlowElement;
import org.junit.Test;
public class ServiceRpcInputEntityBuilderTest {
- ServiceRpcInputEntityBuilder serviceRpcInputEntityBuilder = new ServiceRpcInputEntityBuilder();
+ ServiceRpcInputEntityBuilder serviceRpcInputEntityBuilder = new ServiceRpcInputEntityBuilder();
- DelegateExecution delegateExecution = new DelegateExecution() {
+ DelegateExecution delegateExecution = new DelegateExecution() {
private String operType;
- private String resourceType;
- private String requestId;
+ private String resourceType;
+ private String requestId;
- @Override
+ @Override
public String getProcessInstanceId() {
return null;
}
@@ -194,14 +193,14 @@ public class ServiceRpcInputEntityBuilderTest {
@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;
+ 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
@@ -241,13 +240,13 @@ public class ServiceRpcInputEntityBuilderTest {
@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;
- }
+ 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
@@ -315,22 +314,22 @@ public class ServiceRpcInputEntityBuilderTest {
}
- @Override
- public ProcessEngine getProcessEngine(){
- // TODO Auto-generated method stub
- return null;
- }
+ @Override
+ public ProcessEngine getProcessEngine() {
+ // TODO Auto-generated method stub
+ return null;
+ }
- @Override
- public void setProcessBusinessKey(String arg0){
- // TODO Auto-generated method stub
+ @Override
+ public void setProcessBusinessKey(String arg0) {
+ // TODO Auto-generated method stub
- }
+ }
};
- @Test
- public void buildTest() throws Exception {
- serviceRpcInputEntityBuilder.build(delegateExecution, null);
- }
+ @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
index c8949cee0f..70dfd6bd57 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -36,41 +35,34 @@ 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);
- }
+ @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-flows/src/test/java/org/onap/so/AllBPMNTestSuites.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/AllBPMNTestSuites.java
index 4f98ee4f1b..b1bf830a7a 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/AllBPMNTestSuites.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/AllBPMNTestSuites.java
@@ -1,21 +1,16 @@
/*
*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * Foundation. ================================================================================ Licensed under the
+ * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
+ * obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and limitations under the
+ * License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
*/
package org.onap.so;
@@ -27,6 +22,6 @@ import org.junit.runner.RunWith;
@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
+ // the class remains empty,
+ // used only as a holder for the above annotations
}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/BaseBPMNTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/BaseBPMNTest.java
index 648c9887c2..983fcc2a5c 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/BaseBPMNTest.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/BaseBPMNTest.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * Foundation. ================================================================================ Licensed under the
+ * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
+ * obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and limitations under the
+ * License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
*/
package org.onap.so;
@@ -63,7 +58,7 @@ public abstract class BaseBPMNTest {
protected int wireMockPort;
@After
- public void shutDown(){
+ public void shutDown() {
wireMockServer.resetAll();
}
}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java
index 963d989eb7..3fd39c4953 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java
@@ -36,30 +36,25 @@ public class EmbeddedMariaDbConfig {
@Bean
MariaDB4jSpringService mariaDB4jSpringService() {
- MariaDB4jSpringService service = new MariaDB4jSpringService();
-
-
- service.getConfiguration().addArg("--lower_case_table_names=1");
+ 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
+ @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();
+ return DataSourceBuilder.create().username(datasourceUsername).password(datasourcePassword)
+ .url(config.getURL(databaseName)).driverClassName(datasourceDriver).build();
}
}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java
index bf4a015e36..9521e68e16 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * Foundation. ================================================================================ Licensed under the
+ * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
+ * obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and limitations under the
+ * License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
*/
package org.onap.so;
@@ -60,50 +55,48 @@ public class GrpcNettyServer extends BluePrintProcessingServiceImplBase {
@PostConstruct
public void start() throws IOException {
- final BluePrintProcessingServiceImplBase blueprintPrcessorImpl =
- new BluePrintProcessingServiceImplBase() {
- @Override
- public StreamObserver<ExecutionServiceInput> process(
+ final BluePrintProcessingServiceImplBase blueprintPrcessorImpl = new BluePrintProcessingServiceImplBase() {
+ @Override
+ public StreamObserver<ExecutionServiceInput> process(
StreamObserver<ExecutionServiceOutput> responseObserver) {
- responseObserverRef.set(responseObserver);
+ responseObserverRef.set(responseObserver);
- StreamObserver<ExecutionServiceInput> requestObserver = new StreamObserver<ExecutionServiceInput>() {
- @Override
- public void onNext(ExecutionServiceInput message) {
- detailedMessages.add(message);
- logger.info("Message received: {}", message);
- ExecutionServiceOutput executionServiceOutput = ExecutionServiceOutput.newBuilder()
+ StreamObserver<ExecutionServiceInput> requestObserver = new StreamObserver<ExecutionServiceInput>() {
+ @Override
+ public void onNext(ExecutionServiceInput message) {
+ detailedMessages.add(message);
+ logger.info("Message received: {}", message);
+ ExecutionServiceOutput executionServiceOutput = ExecutionServiceOutput.newBuilder()
.setActionIdentifiers(message.getActionIdentifiers())
- .setStatus(Status.newBuilder().setEventType(
- EventType.EVENT_COMPONENT_EXECUTED).build()).build();
-
- responseObserverRef.get().onNext(executionServiceOutput);
- logger.info("Message sent: {}", executionServiceOutput);
- }
-
- @Override
- public void onError(Throwable t) {
- responseObserverRef.get().onError(t);
- }
-
- @Override
- public void onCompleted() {
- allRequestsDelivered.countDown();
- responseObserverRef.get().onCompleted();
- }
- };
-
- return requestObserver;
- }
- };
- grpcCleanup.register(
- ServerBuilder.forPort(Integer.valueOf(port)).directExecutor().addService(blueprintPrcessorImpl).build()
- .start());
+ .setStatus(Status.newBuilder().setEventType(EventType.EVENT_COMPONENT_EXECUTED).build())
+ .build();
+
+ responseObserverRef.get().onNext(executionServiceOutput);
+ logger.info("Message sent: {}", executionServiceOutput);
+ }
+
+ @Override
+ public void onError(Throwable t) {
+ responseObserverRef.get().onError(t);
+ }
+
+ @Override
+ public void onCompleted() {
+ allRequestsDelivered.countDown();
+ responseObserverRef.get().onCompleted();
+ }
+ };
+
+ return requestObserver;
+ }
+ };
+ grpcCleanup.register(ServerBuilder.forPort(Integer.valueOf(port)).directExecutor()
+ .addService(blueprintPrcessorImpl).build().start());
}
- public List<ExecutionServiceInput> getDetailedMessages(){
+ public List<ExecutionServiceInput> getDetailedMessages() {
return this.detailedMessages;
}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java
index 64311d85da..e9855619c9 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java
@@ -30,12 +30,12 @@ import org.springframework.context.annotation.Profile;
@SpringBootApplication
@Profile("test")
-@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {
- @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
+@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class,
+ excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.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");
- }
+ 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-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
index 2b1dc384a1..abab08bdf3 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
@@ -1,21 +1,16 @@
/*
*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * Foundation. ================================================================================ Licensed under the
+ * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
+ * obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and limitations under the
+ * License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.process;
@@ -29,7 +24,6 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
import static org.assertj.core.api.Assertions.fail;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
-
import com.google.protobuf.Struct;
import com.google.protobuf.Value;
import java.io.IOException;
@@ -77,14 +71,13 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
variables.put("bpmnRequest", requestObject);
/**
- * This variable indicates that the flow was invoked asynchronously.
- * It's injected by {@link WorkflowProcessor}.
+ * This variable indicates that the flow was invoked asynchronously. It's injected by {@link WorkflowProcessor}.
*/
variables.put("isAsyncProcess", "true");
/**
- * Temporary solution to add pnfCorrelationId to context.
- * this value is getting from the request to SO api handler and then convert to CamudaInput
+ * Temporary solution to add pnfCorrelationId to context. this value is getting from the request to SO api
+ * handler and then convert to CamudaInput
*/
variables.put("pnfCorrelationId", "PNFDemo");
@@ -112,12 +105,12 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
mockAai();
mockDmaapForPnf();
- ProcessInstance pi = runtimeService
- .startProcessInstanceByKey(TEST_PROCESSINSTANCE_KEY, testBusinessKey, variables);
+ ProcessInstance pi =
+ runtimeService.startProcessInstanceByKey(TEST_PROCESSINSTANCE_KEY, testBusinessKey, variables);
assertThat(pi).isNotNull();
Execution execution = runtimeService.createExecutionQuery().processDefinitionKey("CreateAndActivatePnfResource")
- .activityId("WaitForDmaapPnfReadyNotification").singleResult();
+ .activityId("WaitForDmaapPnfReadyNotification").singleResult();
if (!execution.isSuspended() && !execution.isEnded()) {
try {
@@ -127,25 +120,11 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
}
}
- assertThat(pi).isStarted().hasPassedInOrder(
- "createVCPE_startEvent",
- "preProcessRequest_ScriptTask",
- "sendSyncAckResponse_ScriptTask",
- "ScriptTask_0cdtchu",
- "DecomposeService",
- "ScriptTask_0lpv2da",
- "ScriptTask_1y241p8",
- "CallActivity_1vc4jeh",
- "ScriptTask_1y5lvl7",
- "GeneratePnfUuid",
- "Task_14l19kv",
- "Pnf_Con",
- "setPONR_ScriptTask",
- "postProcessAndCompletionRequest_ScriptTask",
- "callCompleteMsoProcess_CallActivity",
- "ScriptTask_2",
- "CreateVCPE_EndEvent"
- );
+ assertThat(pi).isStarted().hasPassedInOrder("createVCPE_startEvent", "preProcessRequest_ScriptTask",
+ "sendSyncAckResponse_ScriptTask", "ScriptTask_0cdtchu", "DecomposeService", "ScriptTask_0lpv2da",
+ "ScriptTask_1y241p8", "CallActivity_1vc4jeh", "ScriptTask_1y5lvl7", "GeneratePnfUuid", "Task_14l19kv",
+ "Pnf_Con", "setPONR_ScriptTask", "postProcessAndCompletionRequest_ScriptTask",
+ "callCompleteMsoProcess_CallActivity", "ScriptTask_2", "CreateVCPE_EndEvent");
assertThat(pi).isEnded();
@@ -154,7 +133,7 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
try {
checkConfigAssign(detailedMessages.get(0));
checkConfigDeploy(detailedMessages.get(1));
- } catch(Exception e){
+ } catch (Exception e) {
e.printStackTrace();
fail("ConfigAssign/deploy request exception", e);
}
@@ -164,7 +143,8 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
/**
- * the fields of actionIdentifiers should match the one in the response/createVcpeResCustServiceSimplifiedTest_catalogdb.json.
+ * the fields of actionIdentifiers should match the one in the
+ * response/createVcpeResCustServiceSimplifiedTest_catalogdb.json.
*/
assertThat(actionIdentifiers.getBlueprintName()).matches("test_configuration_restconf");
assertThat(actionIdentifiers.getBlueprintVersion()).matches("1.0.0");
@@ -182,15 +162,18 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
Struct propertiesStruct = requeststruct.getFieldsOrThrow("config-assign-properties").getStructValue();
assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).matches("PNFDemo");
- assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()).matches("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
- assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()).matches("68dc9a92-214c-11e7-93ae-92361f002680");
+ assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue())
+ .matches("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue())
+ .matches("68dc9a92-214c-11e7-93ae-92361f002680");
}
private void checkConfigDeploy(ExecutionServiceInput executionServiceInput) {
ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
/**
- * the fields of actionIdentifiers should match the one in the response/createVcpeResCustServiceSimplifiedTest_catalogdb.json.
+ * the fields of actionIdentifiers should match the one in the
+ * response/createVcpeResCustServiceSimplifiedTest_catalogdb.json.
*/
assertThat(actionIdentifiers.getBlueprintName()).matches("test_configuration_restconf");
assertThat(actionIdentifiers.getBlueprintVersion()).matches("1.0.0");
@@ -208,8 +191,10 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
Struct propertiesStruct = requeststruct.getFieldsOrThrow("config-deploy-properties").getStructValue();
assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).matches("PNFDemo");
- assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()).matches("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
- assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()).matches("68dc9a92-214c-11e7-93ae-92361f002680");
+ assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue())
+ .matches("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue())
+ .matches("68dc9a92-214c-11e7-93ae-92361f002680");
/**
* IP addresses match the OAM ip addresses from AAI.
@@ -229,51 +214,42 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
* Get the events from PNF topic
*/
wireMockServer
- .stubFor(get(urlPathMatching("/events/pnfReady/consumerGroup.*")).willReturn(okJson(pnfResponse)));
+ .stubFor(get(urlPathMatching("/events/pnfReady/consumerGroup.*")).willReturn(okJson(pnfResponse)));
}
private void mockAai() {
- String aaiResponse = "{\n"
- + " \"results\": [\n"
- + " {\n"
- + " \"resource-type\": \"service-instance\",\n"
- + " \"resource-link\": \"https://localhost:8443/aai/v15/business/customers/customer/ADemoCustomerInCiti/service-subscriptions/service-subscription/vCPE/service-instances/service-instance/key3\"\n"
- + " }\n"
- + " ]\n"
- + "}";
-
- String aaiPnfEntry = "{ \n"
- + " \"pnf-name\":\"PNFDemo\",\n"
- + " \"pnf-id\":\"testtest\",\n"
- + " \"in-maint\":true,\n"
- + " \"resource-version\":\"1541720264047\",\n"
- + " \"ipaddress-v4-oam\":\"1.1.1.1\",\n"
- + " \"ipaddress-v6-oam\":\"::/128\"\n"
- + "}";
+ String aaiResponse = "{\n" + " \"results\": [\n" + " {\n"
+ + " \"resource-type\": \"service-instance\",\n"
+ + " \"resource-link\": \"https://localhost:8443/aai/v15/business/customers/customer/ADemoCustomerInCiti/service-subscriptions/service-subscription/vCPE/service-instances/service-instance/key3\"\n"
+ + " }\n" + " ]\n" + "}";
+
+ String aaiPnfEntry = "{ \n" + " \"pnf-name\":\"PNFDemo\",\n" + " \"pnf-id\":\"testtest\",\n"
+ + " \"in-maint\":true,\n" + " \"resource-version\":\"1541720264047\",\n"
+ + " \"ipaddress-v4-oam\":\"1.1.1.1\",\n" + " \"ipaddress-v6-oam\":\"::/128\"\n" + "}";
/**
* Get the AAI entry for globalCustomerId as specified in the request file.
*/
wireMockServer.stubFor(
- get(urlPathMatching("/aai/v15/business/customers/customer/ADemoCustomerInCiti.*")).willReturn(ok()));
+ get(urlPathMatching("/aai/v15/business/customers/customer/ADemoCustomerInCiti.*")).willReturn(ok()));
/**
- * PUT the service to AAI with globalCustomerId, service type as specified in the request file.
- * Service instance id is generated during runtime, REGEX is used to represent the information.
+ * PUT the service to AAI with globalCustomerId, service type as specified in the request file. Service instance
+ * id is generated during runtime, REGEX is used to represent the information.
*/
wireMockServer.stubFor(put(urlPathMatching(
- "/aai/v15/business/customers/customer/ADemoCustomerInCiti/service-subscriptions/service-subscription/vCPE/service-instances/service-instance/.*")));
+ "/aai/v15/business/customers/customer/ADemoCustomerInCiti/service-subscriptions/service-subscription/vCPE/service-instances/service-instance/.*")));
wireMockServer.stubFor(get(urlPathMatching(
- "/aai/v15/business/customers/customer/ADemoCustomerInCiti/service-subscriptions/service-subscription/vCPE/service-instances/service-instance/.*"))
- .willReturn(okJson(aaiResponse)));
+ "/aai/v15/business/customers/customer/ADemoCustomerInCiti/service-subscriptions/service-subscription/vCPE/service-instances/service-instance/.*"))
+ .willReturn(okJson(aaiResponse)));
/**
* Get the service from AAI
*/
wireMockServer.stubFor(get(urlPathMatching("/aai/v15/nodes/service-instances/service-instance/.*"))
- .willReturn(okJson(aaiResponse)));
+ .willReturn(okJson(aaiResponse)));
/**
* Put the project as specified in the request file to AAI.
@@ -283,8 +259,8 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
/**
* GET the project as specified in the request file to AAI.
*/
- wireMockServer
- .stubFor(get(urlPathMatching("/aai/v15/business/projects/project/Project-Demonstration")).willReturn(ok()));
+ wireMockServer.stubFor(
+ get(urlPathMatching("/aai/v15/business/projects/project/Project-Demonstration")).willReturn(ok()));
/**
* PUT the PNF correlation ID to AAI.
@@ -299,8 +275,8 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
/**
* Put the PNF relationship
*/
- wireMockServer.stubFor(
- put(urlEqualTo("/aai/v15/business/projects/project/Project-Demonstration/relationship-list/relationship")));
+ wireMockServer.stubFor(put(
+ urlEqualTo("/aai/v15/business/projects/project/Project-Demonstration/relationship-list/relationship")));
}
/**
@@ -308,29 +284,29 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
*/
private void mockCatalogDb() {
- String catalogdbClientResponse = FileUtil
- .readResourceFile("response/" + getClass().getSimpleName() + "_catalogdb.json");
+ String catalogdbClientResponse =
+ FileUtil.readResourceFile("response/" + getClass().getSimpleName() + "_catalogdb.json");
/**
* Return valid json for the model UUID in the request file.
*/
wireMockServer
- .stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelUuid=f2daaac6-5017-4e1e-96c8-6a27dfbe1421"))
- .willReturn(okJson(responseObject)));
+ .stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelUuid=f2daaac6-5017-4e1e-96c8-6a27dfbe1421"))
+ .willReturn(okJson(responseObject)));
/**
* Return valid json for the service model InvariantUUID as specified in the request file.
*/
wireMockServer.stubFor(
- get(urlEqualTo("/v2/serviceResources?serviceModelInvariantUuid=539b7a2f-9524-4dbf-9eee-f2e05521df3f"))
- .willReturn(okJson(responseObject)));
+ get(urlEqualTo("/v2/serviceResources?serviceModelInvariantUuid=539b7a2f-9524-4dbf-9eee-f2e05521df3f"))
+ .willReturn(okJson(responseObject)));
/**
* Return valid spring data rest json for the service model UUID as specified in the request file.
*/
wireMockServer.stubFor(get(urlEqualTo(
- "/pnfResourceCustomization/search/findPnfResourceCustomizationByModelUuid?SERVICE_MODEL_UUID=f2daaac6-5017-4e1e-96c8-6a27dfbe1421"))
- .willReturn(okJson(catalogdbClientResponse)));
+ "/pnfResourceCustomization/search/findPnfResourceCustomizationByModelUuid?SERVICE_MODEL_UUID=f2daaac6-5017-4e1e-96c8-6a27dfbe1421"))
+ .willReturn(okJson(catalogdbClientResponse)));
}
private void mockRequestDb() {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
index 55f898742c..513ff74180 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
@@ -54,7 +54,7 @@ public class HomingV2 {
// Default solution is SNIRO. OOF gets called only if specified.
private boolean isOof(BuildingBlockExecution execution) {
for (Map<String, Object> params : execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters()
- .getUserParams()) {
+ .getUserParams()) {
if (params.containsKey(HOMINGSOLUTION) && params.get(HOMINGSOLUTION).equals("oof")) {
return true;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java
index f65dde1af5..2524fc7892 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java
@@ -65,19 +65,16 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.springframework.web.util.UriUtils;
-
import java.time.Duration;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
/**
- * The oof homing building block obtains licensing and homing solutions for a given
- * resource or set of resources.
+ * The oof homing building block obtains licensing and homing solutions for a given resource or set of resources.
*
*/
@Component("OofHoming")
@@ -109,14 +106,13 @@ public class OofHomingV2 {
private static final int INTERNAL = 500;
/**
- * Generates the request payload then sends to Oof to perform homing and
- * licensing for the provided demands
+ * Generates the request payload then sends to Oof to perform homing and licensing for the provided demands
*
* @param execution
*/
- public void callOof(BuildingBlockExecution execution){
+ public void callOof(BuildingBlockExecution execution) {
logger.trace("Started Sniro Homing Call Sniro");
- try{
+ try {
GeneralBuildingBlock bb = execution.getGeneralBuildingBlock();
RequestContext requestContext = bb.getRequestContext();
@@ -127,13 +123,13 @@ public class OofHomingV2 {
Customer customer = bb.getCustomer();
String timeout = execution.getVariable("timeout");
- if(isBlank(timeout)){
+ if (isBlank(timeout)) {
timeout = env.getProperty("oof.timeout", "PT30M");
}
OofRequest request = new OofRequest();
- RequestInfo requestInfo = (RequestInfo)buildRequestInfo(requestId, timeout);
+ RequestInfo requestInfo = (RequestInfo) buildRequestInfo(requestId, timeout);
request.setRequestInformation(requestInfo);
ServiceInfo serviceInfo = buildServiceInfo(serviceInstance);
@@ -151,71 +147,74 @@ public class OofHomingV2 {
licenseInfo.put("licenseDemands", licenseDemands);
request.setLicenseInformation(licenseInfo.toString());
- if(placementDemands.size() > 0 || licenseDemands.length() > 0){
+ if (placementDemands.size() > 0 || licenseDemands.length() > 0) {
client.postDemands(request);
- }else{
+ } else {
logger.debug(SERVICE_MISSING_DATA + " resources eligible for homing or licensing");
- throw new BpmnError(UNPROCESSABLE, 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
+ // Variables for ReceiveWorkflowMessage subflow
execution.setVariable("asyncCorrelator", requestId);
execution.setVariable("asyncMessageType", "OofResponse");
execution.setVariable("asyncTimeout", timeout);
logger.trace("Completed Oof Homing Call Oof");
- }catch(BpmnError e){
+ } catch (BpmnError e) {
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
- }catch(BadResponseException e){
+ } catch (BadResponseException e) {
exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
- }catch(Exception e){
- exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while preparing oof request: " + e.getMessage());
+ } catch (Exception e) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
+ "Internal Error - occurred while preparing oof request: " + e.getMessage());
}
}
/**
- * Validates, processes, and sets the homing and licensing solutions that are returned by
- * Oof
+ * Validates, processes, and sets the homing and licensing solutions that are returned by Oof
*
* @param execution
* @param asyncResponse
*/
- public void processSolution(BuildingBlockExecution execution, String asyncResponse){
+ public void processSolution(BuildingBlockExecution execution, String asyncResponse) {
logger.trace("Started Oof Homing Process Solution");
- try{
+ try {
oofValidator.validateSolution(asyncResponse);
- ServiceInstance serviceInstance = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0);
+ ServiceInstance serviceInstance = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription()
+ .getServiceInstances().get(0);
logger.debug("Processing Oof asyncronous response");
JSONObject response = new JSONObject(asyncResponse);
- if(response.has(SOLUTIONS)){
+ if (response.has(SOLUTIONS)) {
JSONObject allSolutions = response.getJSONObject(SOLUTIONS);
- if(allSolutions.has("placementSolutions")){
+ if (allSolutions.has("placementSolutions")) {
JSONArray placementSolutions = allSolutions.getJSONArray("placementSolutions");
- for(int i = 0; i < placementSolutions.length(); i++){
+ for (int i = 0; i < placementSolutions.length(); i++) {
JSONArray placements = placementSolutions.getJSONArray(i);
processPlacementSolution(serviceInstance, placements, i);
}
}
- if(allSolutions.has("licenseSolutions")){
+ if (allSolutions.has("licenseSolutions")) {
JSONArray licenseSolutions = allSolutions.getJSONArray("licenseSolutions");
- if(licenseSolutions.length() > 0){
+ if (licenseSolutions.length() > 0) {
processLicenseSolution(serviceInstance, licenseSolutions);
}
}
- }else{
+ } else {
throw new BpmnError(UNPROCESSABLE, "Oof response does not contain: " + SOLUTIONS);
}
execution.setVariable("generalBuildingBlock", execution.getGeneralBuildingBlock());
logger.trace("Completed Oof Homing Process Solution");
- }catch(BpmnError e){
+ } catch (BpmnError e) {
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
- }catch(BadResponseException e){
+ } catch (BadResponseException e) {
exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
- }catch(Exception e){
- exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while processing Oof asynchronous response: " + e.getMessage());
+ } catch (Exception e) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
+ "Internal Error - occurred while processing Oof asynchronous response: " + e.getMessage());
}
}
@@ -224,12 +223,13 @@ public class OofHomingV2 {
*
* @throws Exception
*/
- private RequestInfo buildRequestInfo(String requestId, String timeout) throws Exception{
+ private RequestInfo buildRequestInfo(String requestId, String timeout) throws Exception {
logger.trace("Building request information");
RequestInfo requestInfo = new RequestInfo();
- if(requestId != null){
+ if (requestId != null) {
String host = env.getProperty("mso.workflow.message.endpoint");
- String callbackUrl = host + "/" + UriUtils.encodePathSegment("OofResponse", "UTF-8") + "/" + UriUtils.encodePathSegment(requestId, "UTF-8");
+ String callbackUrl = host + "/" + UriUtils.encodePathSegment("OofResponse", "UTF-8") + "/"
+ + UriUtils.encodePathSegment(requestId, "UTF-8");
Duration d = Duration.parse(timeout);
long timeoutSeconds = d.getSeconds();
@@ -240,7 +240,7 @@ public class OofHomingV2 {
requestInfo.setSourceId("mso");
requestInfo.setRequestType("create");
requestInfo.setTimeout(timeoutSeconds);
- } else{
+ } else {
throw new BpmnError(UNPROCESSABLE, "Request Context does not contain: requestId");
}
return requestInfo;
@@ -250,17 +250,17 @@ public class OofHomingV2 {
* Builds the request information section for the homing/licensing request
*
*/
- private ServiceInfo buildServiceInfo(ServiceInstance serviceInstance){
+ private ServiceInfo buildServiceInfo(ServiceInstance serviceInstance) {
logger.trace("Building service information");
ServiceInfo info = new ServiceInfo();
ModelInfoServiceInstance modelInfo = serviceInstance.getModelInfoServiceInstance();
- if(isNotBlank(modelInfo.getModelInvariantUuid()) && isNotBlank(modelInfo.getModelUuid())){
+ if (isNotBlank(modelInfo.getModelInvariantUuid()) && isNotBlank(modelInfo.getModelUuid())) {
info.setServiceInstanceId(serviceInstance.getServiceInstanceId());
- if(modelInfo.getServiceType() != null && modelInfo.getServiceType().length() > 0){ //temp solution
+ if (modelInfo.getServiceType() != null && modelInfo.getServiceType().length() > 0) { // temp solution
info.setServiceName(modelInfo.getServiceType());
}
info.setModelInfo(buildModelInfo(serviceInstance.getModelInfoServiceInstance()));
- }else{
+ } else {
throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + MODEL_VERSION_ID + ", " + MODEL_INVARIANT_ID);
}
return info;
@@ -270,32 +270,32 @@ public class OofHomingV2 {
* Builds initial section of placement info for the homing/licensing request
*
*/
- private PlacementInfo buildPlacementInfo(Customer customer, RequestParameters requestParams){
+ private PlacementInfo buildPlacementInfo(Customer customer, RequestParameters requestParams) {
PlacementInfo placementInfo = new PlacementInfo();
- if(customer != null){
+ if (customer != null) {
logger.debug("Adding subscriber to placement information");
SubscriberInfo subscriberInfo = new SubscriberInfo();
subscriberInfo.setGlobalSubscriberId(customer.getGlobalCustomerId());
subscriberInfo.setSubscriberName(customer.getSubscriberName());
subscriberInfo.setSubscriberCommonSiteId(customer.getSubscriberCommonSiteId());
placementInfo.setSubscriberInfo(subscriberInfo);
- if(requestParams != null){
+ if (requestParams != null) {
logger.debug("Adding request parameters to placement information");
OofRequestParameters oofRequestParams = new OofRequestParameters();
- for (Map requestParam : requestParams.getUserParams()){
- if (requestParam.containsKey("customerLatitude")){
+ for (Map requestParam : requestParams.getUserParams()) {
+ if (requestParam.containsKey("customerLatitude")) {
oofRequestParams.setCustomerLatitude(requestParam.get("customerLatitude").toString());
}
- if (requestParam.containsKey("customerLongitude")){
+ if (requestParam.containsKey("customerLongitude")) {
oofRequestParams.setCustomerLongitude(requestParam.get("customerLongitude").toString());
}
- if (requestParam.containsKey("customerName")){
+ if (requestParam.containsKey("customerName")) {
oofRequestParams.setCustomerName(requestParam.get("customerName").toString());
}
}
placementInfo.setRequestParameters(oofRequestParams);
}
- }else{
+ } else {
throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + "customer");
}
return placementInfo;
@@ -306,33 +306,33 @@ public class OofHomingV2 {
* Builds the placement demand list for the homing/licensing request
*
*/
- private ArrayList<PlacementDemand> buildPlacementDemands(ServiceInstance serviceInstance){
+ private ArrayList<PlacementDemand> buildPlacementDemands(ServiceInstance serviceInstance) {
logger.trace("Building placement information demands");
ArrayList<PlacementDemand> placementDemands = new ArrayList();
List<AllottedResource> allottedResourceList = serviceInstance.getAllottedResources();
- if(!allottedResourceList.isEmpty()){
+ if (!allottedResourceList.isEmpty()) {
logger.debug("Adding allotted resources to placement demands list");
- for(AllottedResource ar : allottedResourceList){
- if(isBlank(ar.getId())){
+ for (AllottedResource ar : allottedResourceList) {
+ if (isBlank(ar.getId())) {
ar.setId(UUID.randomUUID().toString());
}
PlacementDemand demand = buildDemand(ar.getId(), ar.getModelInfoAllottedResource());
- //addCandidates(ar, demand);
+ // addCandidates(ar, demand);
placementDemands.add(demand);
}
}
List<VpnBondingLink> vpnBondingLinkList = serviceInstance.getVpnBondingLinks();
- if(!vpnBondingLinkList.isEmpty()){
+ if (!vpnBondingLinkList.isEmpty()) {
logger.debug("Adding vpn bonding links to placement demands list");
- for(VpnBondingLink vbl:vpnBondingLinkList){
+ for (VpnBondingLink vbl : vpnBondingLinkList) {
List<ServiceProxy> serviceProxyList = vbl.getServiceProxies();
- for(ServiceProxy sp : serviceProxyList){
- if(isBlank(sp.getId())){
+ for (ServiceProxy sp : serviceProxyList) {
+ if (isBlank(sp.getId())) {
sp.setId(UUID.randomUUID().toString());
}
PlacementDemand demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy());
- //addCandidates(sp, demand);
+ // addCandidates(sp, demand);
placementDemands.add(demand);
}
}
@@ -344,13 +344,13 @@ public class OofHomingV2 {
* Builds the license demand list for the homing/licensing request
*
*/
- private JSONArray buildLicenseDemands(ServiceInstance serviceInstance){
+ private JSONArray buildLicenseDemands(ServiceInstance serviceInstance) {
logger.trace("Building license information");
JSONArray licenseDemands = new JSONArray();
List<GenericVnf> vnfList = serviceInstance.getVnfs();
- if(!vnfList.isEmpty()){
+ if (!vnfList.isEmpty()) {
logger.debug("Adding vnfs to license demands list");
- for(GenericVnf vnf : vnfList){
+ for (GenericVnf vnf : vnfList) {
JSONObject demand = buildLicenseDemand(vnf.getVnfId(), vnf.getModelInfoGenericVnf());
licenseDemands.put(demand);
}
@@ -362,14 +362,14 @@ public class OofHomingV2 {
* Builds a single license demand object
*
*/
- private JSONObject buildLicenseDemand(String id, ModelInfoMetadata metadata){
+ private JSONObject buildLicenseDemand(String id, ModelInfoMetadata metadata) {
logger.debug("Building demand for service or resource: " + id);
JSONObject demand = new JSONObject();
- if(isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())){
+ 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{
+ } else {
throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + "modelInstanceName");
}
return demand;
@@ -379,14 +379,14 @@ public class OofHomingV2 {
* Builds a single demand object
*
*/
- private PlacementDemand buildDemand(String id, ModelInfoMetadata metadata){
+ private PlacementDemand buildDemand(String id, ModelInfoMetadata metadata) {
logger.debug("Building demand for service or resource: " + id);
PlacementDemand placementDemand = new PlacementDemand();
- if(isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())){
+ if (isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())) {
placementDemand.setServiceResourceId(id);
placementDemand.setResourceModuleName(metadata.getModelInstanceName());
placementDemand.setResourceModelInfo((ResourceModelInfo) buildModelInfo(metadata));
- }else{
+ } else {
throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + "modelInstanceName");
}
return placementDemand;
@@ -396,18 +396,18 @@ public class OofHomingV2 {
* Builds the resource model info section
*
*/
- private ModelInfo buildModelInfo(ModelInfoMetadata metadata){
+ private ModelInfo buildModelInfo(ModelInfoMetadata metadata) {
ModelInfo modelInfo = new ModelInfo();
String invariantUuid = metadata.getModelInvariantUuid();
String modelUuid = metadata.getModelUuid();
- if(isNotBlank(invariantUuid) && isNotBlank(modelUuid)){
+ if (isNotBlank(invariantUuid) && isNotBlank(modelUuid)) {
modelInfo.setModelInvariantId(invariantUuid);
modelInfo.setModelVersionId(modelUuid);
modelInfo.setModelName(metadata.getModelName());
modelInfo.setModelVersion(metadata.getModelVersion());
- }else if(isNotBlank(invariantUuid)){
+ } else if (isNotBlank(invariantUuid)) {
throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + MODEL_VERSION_ID);
- }else{
+ } else {
throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + MODEL_INVARIANT_ID);
}
return modelInfo;
@@ -417,30 +417,30 @@ public class OofHomingV2 {
* Adds required, excluded, and existing candidates to a demand
*
*/
- private void addCandidates(SolutionCandidates candidates, JSONObject demand){
+ private void addCandidates(SolutionCandidates candidates, JSONObject demand) {
List<Candidate> required = candidates.getRequiredCandidates();
List<Candidate> excluded = candidates.getExcludedCandidates();
- if(!required.isEmpty()){
+ if (!required.isEmpty()) {
demand.put("requiredCandidates", required);
}
- if(!excluded.isEmpty()){
+ if (!excluded.isEmpty()) {
demand.put("excludedCandidates", excluded);
}
- //TODO support existing candidates
+ // TODO support existing candidates
}
/**
* Processes the license solutions and sets to the corresponding generic vnf
*
*/
- private void processLicenseSolution(ServiceInstance serviceInstance, JSONArray licenseSolutions){
+ private void processLicenseSolution(ServiceInstance serviceInstance, JSONArray licenseSolutions) {
List<GenericVnf> vnfs = serviceInstance.getVnfs();
logger.debug("Processing the license solution");
- for(int i = 0; i < licenseSolutions.length(); i++){
+ 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())){
+ for (GenericVnf vnf : vnfs) {
+ if (licenseSolution.getString(SERVICE_RESOURCE_ID).equals(vnf.getVnfId())) {
License license = new License();
JSONArray entitlementPools = licenseSolution.getJSONArray("entitlementPoolUUID");
List<String> entitlementPoolsList = jsonUtils.StringArrayToList(entitlementPools);
@@ -456,47 +456,48 @@ public class OofHomingV2 {
}
/**
- * Processes a placement solution list then correlates and sets each placement solution
- * to its corresponding resource
+ * 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){
+ private void processPlacementSolution(ServiceInstance serviceInstance, JSONArray placements, int i) {
List<VpnBondingLink> links = serviceInstance.getVpnBondingLinks();
List<AllottedResource> allottes = serviceInstance.getAllottedResources();
List<GenericVnf> vnfs = serviceInstance.getVnfs();
- logger.debug("Processing placement solution " + i+1);
- for(int p = 0; p < placements.length(); p++){
+ logger.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){
+ for (VpnBondingLink vbl : links) {
List<ServiceProxy> proxies = vbl.getServiceProxies();
- for(ServiceProxy sp:proxies){
- if(placement.getString(SERVICE_RESOURCE_ID).equals(sp.getId())){
- if(i > 0){
- if(p % 2 == 0){
+ 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{
+ 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())){
+ 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())){
+ 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));
@@ -512,7 +513,7 @@ public class OofHomingV2 {
* Creates and sets necessary pojos with placement solution data for a given demand
*
*/
- private ServiceInstance setSolution(SolutionInfo solutionInfo, JSONObject placement){
+ private ServiceInstance setSolution(SolutionInfo solutionInfo, JSONObject placement) {
logger.debug("Mapping placement solution");
String invalidMessage = "Oof Response contains invalid: ";
@@ -528,45 +529,45 @@ public class OofHomingV2 {
ServiceInstance si = new ServiceInstance();
CloudRegion cloud = setCloud(assignmentsMap);
- if(type.equals("service")){
- if(identifierType.equals(CandidateType.SERVICE_INSTANCE_ID.toString())){
+ 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")){
+ if (assignmentsMap.containsKey("vnfHostName")) {
logger.debug("Resources has been homed to a vnf");
GenericVnf vnf = setVnf(assignmentsMap);
vnf.setCloudRegion(cloud);
si.getVnfs().add(vnf);
- }else if(assignmentsMap.containsKey("primaryPnfName")){
+ } else if (assignmentsMap.containsKey("primaryPnfName")) {
logger.debug("Resources has been homed to a pnf");
Pnf priPnf = setPnf(assignmentsMap, "primary");
priPnf.setCloudRegion(cloud);
si.getPnfs().add(priPnf);
- if(assignmentsMap.containsKey("secondaryPnfName")){
+ if (assignmentsMap.containsKey("secondaryPnfName")) {
Pnf secPnf = setPnf(assignmentsMap, "secondary");
secPnf.setCloudRegion(cloud);
si.getPnfs().add(secPnf);
}
}
- }else{
+ } else {
logger.debug(invalidMessage + IDENTIFIER_TYPE);
throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_TYPE);
}
- }else if(type.equals("cloud")){
- if(identifierType.equals(CandidateType.CLOUD_REGION_ID.toString())){
+ } else if (type.equals("cloud")) {
+ if (identifierType.equals(CandidateType.CLOUD_REGION_ID.toString())) {
logger.debug("Resources has been homed to a cloud region");
cloud.setLcpCloudRegionId(identifierValue);
solutionInfo.setHomed(false);
solutionInfo.setTargetedCloudRegion(cloud);
si.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
- }else{
+ } else {
logger.debug(invalidMessage + IDENTIFIER_TYPE);
throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_TYPE);
}
- }else{
+ } else {
logger.debug(invalidMessage + INVENTORY_TYPE);
throw new BpmnError(UNPROCESSABLE, invalidMessage + INVENTORY_TYPE);
}
@@ -578,7 +579,7 @@ public class OofHomingV2 {
* Sets the cloud data to a cloud region object
*
*/
- private CloudRegion setCloud(Map<String, String> assignmentsMap){
+ private CloudRegion setCloud(Map<String, String> assignmentsMap) {
CloudRegion cloud = new CloudRegion();
cloud.setCloudOwner(assignmentsMap.get("cloudOwner"));
cloud.setCloudRegionVersion(assignmentsMap.get("aicVersion"));
@@ -590,7 +591,7 @@ public class OofHomingV2 {
* Sets the vnf data to a generic vnf object
*
*/
- private GenericVnf setVnf(Map<String, String> assignmentsMap){
+ private GenericVnf setVnf(Map<String, String> assignmentsMap) {
GenericVnf vnf = new GenericVnf();
vnf.setOrchestrationStatus(OrchestrationStatus.CREATED);
vnf.setVnfName(assignmentsMap.get("vnfHostName"));
@@ -602,7 +603,7 @@ public class OofHomingV2 {
* Sets the pnf data to a pnf object
*
*/
- private Pnf setPnf(Map<String, String> assignmentsMap, String role){
+ private Pnf setPnf(Map<String, String> assignmentsMap, String role) {
Pnf pnf = new Pnf();
pnf.setRole(role);
pnf.setOrchestrationStatus(OrchestrationStatus.CREATED);
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
index 2e7184b9ff..29037980cc 100644
--- 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
@@ -23,13 +23,11 @@
package org.onap.so.bpmn.buildingblock;
import static org.apache.commons.lang3.StringUtils.*;
-
import java.time.Duration;
import java.util.ArrayList;
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;
@@ -56,10 +54,8 @@ 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.Demand;
import org.onap.so.client.sniro.beans.LicenseInfo;
import org.onap.so.client.sniro.beans.ModelInfo;
@@ -78,8 +74,7 @@ import org.springframework.web.util.UriUtils;
/**
- * The sniro homing building block obtains licensing and homing solutions for a given
- * resource or set of resources.
+ * The sniro homing building block obtains licensing and homing solutions for a given resource or set of resources.
*
* @author cb645j
*
@@ -87,514 +82,521 @@ import org.springframework.web.util.UriUtils;
@Component("SniroHoming")
public class SniroHomingV2 {
- private static final Logger logger = LoggerFactory.getLogger(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 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){
- logger.debug("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();
-
- RequestInfo requestInfo = buildRequestInfo(requestId, timeout);
- request.setRequestInformation(requestInfo);
-
- ServiceInfo serviceInfo = buildServiceInfo(serviceInstance);
- request.setServiceInformation(serviceInfo);
-
- PlacementInfo placementInfo = buildPlacementInfo(customer, requestParams);
-
- List<Demand> placementDemands = buildPlacementDemands(serviceInstance);
- placementInfo.setDemands(placementDemands);
- request.setPlacementInformation(placementInfo);
-
- LicenseInfo licenseInfo = new LicenseInfo();
-
- List<Demand> licenseDemands = buildLicenseDemands(serviceInstance);
- licenseInfo.setDemands(licenseDemands);
- request.setLicenseInformation(licenseInfo);
-
- if(placementDemands.size() > 0 || licenseDemands.size() > 0){
- client.postDemands(request);
- }else{
- logger.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);
-
- logger.trace("Completed Sniro Homing Call Sniro");
- }catch(BpmnError e){
- logger.error("Exception occurred", e);
- exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
- }catch(BadResponseException e){
- logger.error("Exception occurred", e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
- }catch(Exception e){
- logger.error("Exception occurred", 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){
- logger.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);
-
- logger.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());
-
- logger.trace("Completed Sniro Homing Process Solution");
- }catch(BpmnError e){
- logger.error("Exception occurred", e);
- exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
- }catch(BadResponseException e){
- logger.error("Exception occurred", e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
- }catch(Exception e){
- logger.error("Exception occurred", 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 RequestInfo buildRequestInfo(String requestId, String timeout) throws Exception{
- logger.trace("Building request information");
- RequestInfo requestInfo = new RequestInfo();
- 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);
-
- requestInfo.setTransactionId(requestId);
- requestInfo.setRequestId(requestId);
- requestInfo.setCallbackUrl(callbackUrl);
- requestInfo.setRequestType("create");
- requestInfo.setTimeout(d.getSeconds());
-
- } else{
- throw new BpmnError(UNPROCESSABLE, "Request Context does not contain: requestId");
- }
- return requestInfo;
- }
-
- /**
- * Builds the request information section for the homing/licensing request
- *
- */
- private ServiceInfo buildServiceInfo(ServiceInstance serviceInstance){
- logger.trace("Building service information");
- ServiceInfo info = new ServiceInfo();
- ModelInfoServiceInstance modelInfo = serviceInstance.getModelInfoServiceInstance();
- if(isNotBlank(modelInfo.getModelInvariantUuid()) && isNotBlank(modelInfo.getModelUuid())){
- info.setServiceInstanceId(serviceInstance.getServiceInstanceId());
- if(modelInfo.getServiceType() != null && modelInfo.getServiceType().length() > 0){ //temp solution
- info.setServiceName(modelInfo.getServiceType());
- }
- if(modelInfo.getServiceRole() != null){
- info.setServiceRole(modelInfo.getServiceRole());
- }
- info.setModelInfo(buildModelInfo(modelInfo));
- }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 PlacementInfo buildPlacementInfo(Customer customer, RequestParameters requestParams){
- PlacementInfo placementInfo = new PlacementInfo();
- if(customer != null){
- logger.debug("Adding subscriber to placement information");
- SubscriberInfo subscriber = new SubscriberInfo();
- subscriber.setGlobalSubscriberId(customer.getGlobalCustomerId());
- subscriber.setSubscriberName(customer.getSubscriberName());
- subscriber.setSubscriberCommonSiteId(customer.getSubscriberCommonSiteId());
- placementInfo.setSubscriberInfo(subscriber);
- if(requestParams != null){
- logger.debug("Adding request parameters to placement information");
- placementInfo.setRequestParameters(requestParams.toJsonString());
- }
- }else{
- throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + "customer");
- }
- return placementInfo;
-
- }
-
- /**
- * Builds the placement demand list for the homing/licensing request
- *
- */
- private List<Demand> buildPlacementDemands(ServiceInstance serviceInstance){
- logger.trace("Building placement information demands");
- List<Demand> placementDemands = new ArrayList<Demand>();
-
- List<AllottedResource> allottedResourceList = serviceInstance.getAllottedResources();
- if(!allottedResourceList.isEmpty()){
- logger.debug("Adding allotted resources to placement demands list");
- for(AllottedResource ar : allottedResourceList){
- if(isBlank(ar.getId())){
- ar.setId(UUID.randomUUID().toString());
- }
- Demand demand = buildDemand(ar.getId(), ar.getModelInfoAllottedResource());
- addCandidates(ar, demand);
- placementDemands.add(demand);
- }
- }
- List<VpnBondingLink> vpnBondingLinkList = serviceInstance.getVpnBondingLinks();
- if(!vpnBondingLinkList.isEmpty()){
- logger.debug("Adding vpn bonding links to placement demands list");
- for(VpnBondingLink vbl:vpnBondingLinkList){
- List<ServiceProxy> serviceProxyList = vbl.getServiceProxies();
- for(ServiceProxy sp : serviceProxyList){
- if(isBlank(sp.getId())){
- sp.setId(UUID.randomUUID().toString());
- }
- Demand demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy());
- addCandidates(sp, demand);
- placementDemands.add(demand);
- }
- }
- }
- return placementDemands;
- }
-
- /**
- * Builds the license demand list for the homing/licensing request
- *
- */
- private List<Demand> buildLicenseDemands(ServiceInstance serviceInstance){
- logger.trace("Building license information");
- List<Demand> licenseDemands = new ArrayList<Demand>();
- List<GenericVnf> vnfList = serviceInstance.getVnfs();
- if(!vnfList.isEmpty()){
- logger.debug("Adding vnfs to license demands list");
- for(GenericVnf vnf : vnfList){
- Demand demand = buildDemand(vnf.getVnfId(), vnf.getModelInfoGenericVnf());
- licenseDemands.add(demand);
- }
- }
- return licenseDemands;
- }
-
- /**
- * Builds a single demand object
- *
- */
- private Demand buildDemand(String id, ModelInfoMetadata metadata){
- logger.debug("Building demand for service or resource: " + id);
- Demand demand = new Demand();
- if(isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())){
- demand.setServiceResourceId(id);
- demand.setResourceModuleName(metadata.getModelInstanceName());
- demand.setModelInfo(buildModelInfo(metadata));
- }else{
- throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + "modelInstanceName");
- }
- return demand;
- }
-
- /**
- * Builds the resource model info section
- *
- */
- private ModelInfo buildModelInfo(ModelInfoMetadata metadata){
- ModelInfo object = new ModelInfo();
- String invariantUuid = metadata.getModelInvariantUuid();
- String modelUuid = metadata.getModelUuid();
- if(isNotBlank(invariantUuid) && isNotBlank(modelUuid)){
- object.setModelInvariantId(invariantUuid);
- object.setModelVersionId(modelUuid);
- object.setModelName(metadata.getModelName());
- object.setModelVersion(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, Demand demand){
- List<Candidate> required = candidates.getRequiredCandidates();
- List<Candidate> excluded = candidates.getExcludedCandidates();
- if(!required.isEmpty()){
- List<org.onap.so.client.sniro.beans.Candidate> cans = new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
- for(Candidate c:required){
- org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
- can.setIdentifierType(c.getIdentifierType());
- can.setIdentifiers(c.getIdentifiers());
- can.setCloudOwner(c.getCloudOwner());
- cans.add(can);
- }
- demand.setRequiredCandidates(cans);
- }
- if(!excluded.isEmpty()){
- List<org.onap.so.client.sniro.beans.Candidate> cans = new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
- for(Candidate c:excluded){
- org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
- can.setIdentifierType(c.getIdentifierType());
- can.setIdentifiers(c.getIdentifiers());
- can.setCloudOwner(c.getCloudOwner());
- cans.add(can);
- }
- demand.setExcludedCandidates(cans);
- }
- //TODO support existing candidates
- }
-
- /**
- * Processes the license solutions and sets to the corresponding generic vnf
- *
- */
- private void processLicenseSolution(ServiceInstance serviceInstance, JSONArray licenseSolutions){
- List<GenericVnf> vnfs = serviceInstance.getVnfs();
-
- logger.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<String> entitlementPoolsList = jsonUtils.StringArrayToList(entitlementPools);
- license.setEntitlementPoolUuids(entitlementPoolsList);
- JSONArray licenseKeys = licenseSolution.getJSONArray("licenseKeyGroupUUID");
- List<String> 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<VpnBondingLink> links = serviceInstance.getVpnBondingLinks();
- List<AllottedResource> allottes = serviceInstance.getAllottedResources();
- List<GenericVnf> vnfs = serviceInstance.getVnfs();
-
- logger.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<ServiceProxy> 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){
- logger.debug("Mapping placement solution");
- String invalidMessage = "Sniro Managers Response contains invalid: ";
-
- JSONObject solution = placement.getJSONObject("solution");
- String identifierType = solution.getString(IDENTIFIER_TYPE);
- List<String> identifiersList = jsonUtils.StringArrayToList(solution.getJSONArray("identifiers").toString());
- String identifierValue = identifiersList.get(0);
-
- JSONArray assignments = placement.getJSONArray("assignmentInfo");
- Map<String, String> assignmentsMap = jsonUtils.entryArrayToMap(assignments.toString(), "key", "value");
- solutionInfo.setRehome(Boolean.parseBoolean(assignmentsMap.get("isRehome")));
-
- ServiceInstance si = new ServiceInstance();
- CloudRegion cloud = setCloud(assignmentsMap);
- 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")){
- logger.debug("Resources has been homed to a vnf");
- GenericVnf vnf = setVnf(assignmentsMap);
- vnf.setCloudRegion(cloud);
- si.getVnfs().add(vnf);
-
- }else if(assignmentsMap.containsKey("primaryPnfName")){
- logger.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 if(identifierType.equals(CandidateType.CLOUD_REGION_ID.toString())){
- logger.debug("Resources has been homed to a cloud region");
- cloud.setLcpCloudRegionId(identifierValue);
- solutionInfo.setHomed(false);
- solutionInfo.setTargetedCloudRegion(cloud);
- si.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
- }else{
- logger.debug(invalidMessage + IDENTIFIER_TYPE);
- throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_TYPE);
- }
- si.setSolutionInfo(solutionInfo);
- return si;
- }
-
- /**
- * Sets the cloud data to a cloud region object
- *
- */
- private CloudRegion setCloud(Map<String, String> 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<String, String> 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<String, String> assignmentsMap, String role){
- Pnf pnf = new Pnf();
- pnf.setRole(role);
- pnf.setOrchestrationStatus(OrchestrationStatus.CREATED);
- pnf.setPnfName(assignmentsMap.get(role + "PnfName"));
- return pnf;
- }
+ private static final Logger logger = LoggerFactory.getLogger(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 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) {
+ logger.debug("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();
+
+ RequestInfo requestInfo = buildRequestInfo(requestId, timeout);
+ request.setRequestInformation(requestInfo);
+
+ ServiceInfo serviceInfo = buildServiceInfo(serviceInstance);
+ request.setServiceInformation(serviceInfo);
+
+ PlacementInfo placementInfo = buildPlacementInfo(customer, requestParams);
+
+ List<Demand> placementDemands = buildPlacementDemands(serviceInstance);
+ placementInfo.setDemands(placementDemands);
+ request.setPlacementInformation(placementInfo);
+
+ LicenseInfo licenseInfo = new LicenseInfo();
+
+ List<Demand> licenseDemands = buildLicenseDemands(serviceInstance);
+ licenseInfo.setDemands(licenseDemands);
+ request.setLicenseInformation(licenseInfo);
+
+ if (placementDemands.size() > 0 || licenseDemands.size() > 0) {
+ client.postDemands(request);
+ } else {
+ logger.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);
+
+ logger.trace("Completed Sniro Homing Call Sniro");
+ } catch (BpmnError e) {
+ logger.error("Exception occurred", e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
+ } catch (BadResponseException e) {
+ logger.error("Exception occurred", e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
+ } catch (Exception e) {
+ logger.error("Exception occurred", 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) {
+ logger.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);
+
+ logger.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());
+
+ logger.trace("Completed Sniro Homing Process Solution");
+ } catch (BpmnError e) {
+ logger.error("Exception occurred", e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
+ } catch (BadResponseException e) {
+ logger.error("Exception occurred", e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
+ } catch (Exception e) {
+ logger.error("Exception occurred", 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 RequestInfo buildRequestInfo(String requestId, String timeout) throws Exception {
+ logger.trace("Building request information");
+ RequestInfo requestInfo = new RequestInfo();
+ 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);
+
+ requestInfo.setTransactionId(requestId);
+ requestInfo.setRequestId(requestId);
+ requestInfo.setCallbackUrl(callbackUrl);
+ requestInfo.setRequestType("create");
+ requestInfo.setTimeout(d.getSeconds());
+
+ } else {
+ throw new BpmnError(UNPROCESSABLE, "Request Context does not contain: requestId");
+ }
+ return requestInfo;
+ }
+
+ /**
+ * Builds the request information section for the homing/licensing request
+ *
+ */
+ private ServiceInfo buildServiceInfo(ServiceInstance serviceInstance) {
+ logger.trace("Building service information");
+ ServiceInfo info = new ServiceInfo();
+ ModelInfoServiceInstance modelInfo = serviceInstance.getModelInfoServiceInstance();
+ if (isNotBlank(modelInfo.getModelInvariantUuid()) && isNotBlank(modelInfo.getModelUuid())) {
+ info.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ if (modelInfo.getServiceType() != null && modelInfo.getServiceType().length() > 0) { // temp solution
+ info.setServiceName(modelInfo.getServiceType());
+ }
+ if (modelInfo.getServiceRole() != null) {
+ info.setServiceRole(modelInfo.getServiceRole());
+ }
+ info.setModelInfo(buildModelInfo(modelInfo));
+ } 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 PlacementInfo buildPlacementInfo(Customer customer, RequestParameters requestParams) {
+ PlacementInfo placementInfo = new PlacementInfo();
+ if (customer != null) {
+ logger.debug("Adding subscriber to placement information");
+ SubscriberInfo subscriber = new SubscriberInfo();
+ subscriber.setGlobalSubscriberId(customer.getGlobalCustomerId());
+ subscriber.setSubscriberName(customer.getSubscriberName());
+ subscriber.setSubscriberCommonSiteId(customer.getSubscriberCommonSiteId());
+ placementInfo.setSubscriberInfo(subscriber);
+ if (requestParams != null) {
+ logger.debug("Adding request parameters to placement information");
+ placementInfo.setRequestParameters(requestParams.toJsonString());
+ }
+ } else {
+ throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + "customer");
+ }
+ return placementInfo;
+
+ }
+
+ /**
+ * Builds the placement demand list for the homing/licensing request
+ *
+ */
+ private List<Demand> buildPlacementDemands(ServiceInstance serviceInstance) {
+ logger.trace("Building placement information demands");
+ List<Demand> placementDemands = new ArrayList<Demand>();
+
+ List<AllottedResource> allottedResourceList = serviceInstance.getAllottedResources();
+ if (!allottedResourceList.isEmpty()) {
+ logger.debug("Adding allotted resources to placement demands list");
+ for (AllottedResource ar : allottedResourceList) {
+ if (isBlank(ar.getId())) {
+ ar.setId(UUID.randomUUID().toString());
+ }
+ Demand demand = buildDemand(ar.getId(), ar.getModelInfoAllottedResource());
+ addCandidates(ar, demand);
+ placementDemands.add(demand);
+ }
+ }
+ List<VpnBondingLink> vpnBondingLinkList = serviceInstance.getVpnBondingLinks();
+ if (!vpnBondingLinkList.isEmpty()) {
+ logger.debug("Adding vpn bonding links to placement demands list");
+ for (VpnBondingLink vbl : vpnBondingLinkList) {
+ List<ServiceProxy> serviceProxyList = vbl.getServiceProxies();
+ for (ServiceProxy sp : serviceProxyList) {
+ if (isBlank(sp.getId())) {
+ sp.setId(UUID.randomUUID().toString());
+ }
+ Demand demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy());
+ addCandidates(sp, demand);
+ placementDemands.add(demand);
+ }
+ }
+ }
+ return placementDemands;
+ }
+
+ /**
+ * Builds the license demand list for the homing/licensing request
+ *
+ */
+ private List<Demand> buildLicenseDemands(ServiceInstance serviceInstance) {
+ logger.trace("Building license information");
+ List<Demand> licenseDemands = new ArrayList<Demand>();
+ List<GenericVnf> vnfList = serviceInstance.getVnfs();
+ if (!vnfList.isEmpty()) {
+ logger.debug("Adding vnfs to license demands list");
+ for (GenericVnf vnf : vnfList) {
+ Demand demand = buildDemand(vnf.getVnfId(), vnf.getModelInfoGenericVnf());
+ licenseDemands.add(demand);
+ }
+ }
+ return licenseDemands;
+ }
+
+ /**
+ * Builds a single demand object
+ *
+ */
+ private Demand buildDemand(String id, ModelInfoMetadata metadata) {
+ logger.debug("Building demand for service or resource: " + id);
+ Demand demand = new Demand();
+ if (isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())) {
+ demand.setServiceResourceId(id);
+ demand.setResourceModuleName(metadata.getModelInstanceName());
+ demand.setModelInfo(buildModelInfo(metadata));
+ } else {
+ throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + "modelInstanceName");
+ }
+ return demand;
+ }
+
+ /**
+ * Builds the resource model info section
+ *
+ */
+ private ModelInfo buildModelInfo(ModelInfoMetadata metadata) {
+ ModelInfo object = new ModelInfo();
+ String invariantUuid = metadata.getModelInvariantUuid();
+ String modelUuid = metadata.getModelUuid();
+ if (isNotBlank(invariantUuid) && isNotBlank(modelUuid)) {
+ object.setModelInvariantId(invariantUuid);
+ object.setModelVersionId(modelUuid);
+ object.setModelName(metadata.getModelName());
+ object.setModelVersion(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, Demand demand) {
+ List<Candidate> required = candidates.getRequiredCandidates();
+ List<Candidate> excluded = candidates.getExcludedCandidates();
+ if (!required.isEmpty()) {
+ List<org.onap.so.client.sniro.beans.Candidate> cans =
+ new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
+ for (Candidate c : required) {
+ org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
+ can.setIdentifierType(c.getIdentifierType());
+ can.setIdentifiers(c.getIdentifiers());
+ can.setCloudOwner(c.getCloudOwner());
+ cans.add(can);
+ }
+ demand.setRequiredCandidates(cans);
+ }
+ if (!excluded.isEmpty()) {
+ List<org.onap.so.client.sniro.beans.Candidate> cans =
+ new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
+ for (Candidate c : excluded) {
+ org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
+ can.setIdentifierType(c.getIdentifierType());
+ can.setIdentifiers(c.getIdentifiers());
+ can.setCloudOwner(c.getCloudOwner());
+ cans.add(can);
+ }
+ demand.setExcludedCandidates(cans);
+ }
+ // TODO support existing candidates
+ }
+
+ /**
+ * Processes the license solutions and sets to the corresponding generic vnf
+ *
+ */
+ private void processLicenseSolution(ServiceInstance serviceInstance, JSONArray licenseSolutions) {
+ List<GenericVnf> vnfs = serviceInstance.getVnfs();
+
+ logger.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<String> entitlementPoolsList = jsonUtils.StringArrayToList(entitlementPools);
+ license.setEntitlementPoolUuids(entitlementPoolsList);
+ JSONArray licenseKeys = licenseSolution.getJSONArray("licenseKeyGroupUUID");
+ List<String> 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<VpnBondingLink> links = serviceInstance.getVpnBondingLinks();
+ List<AllottedResource> allottes = serviceInstance.getAllottedResources();
+ List<GenericVnf> vnfs = serviceInstance.getVnfs();
+
+ logger.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<ServiceProxy> 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) {
+ logger.debug("Mapping placement solution");
+ String invalidMessage = "Sniro Managers Response contains invalid: ";
+
+ JSONObject solution = placement.getJSONObject("solution");
+ String identifierType = solution.getString(IDENTIFIER_TYPE);
+ List<String> identifiersList = jsonUtils.StringArrayToList(solution.getJSONArray("identifiers").toString());
+ String identifierValue = identifiersList.get(0);
+
+ JSONArray assignments = placement.getJSONArray("assignmentInfo");
+ Map<String, String> assignmentsMap = jsonUtils.entryArrayToMap(assignments.toString(), "key", "value");
+ solutionInfo.setRehome(Boolean.parseBoolean(assignmentsMap.get("isRehome")));
+
+ ServiceInstance si = new ServiceInstance();
+ CloudRegion cloud = setCloud(assignmentsMap);
+ 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")) {
+ logger.debug("Resources has been homed to a vnf");
+ GenericVnf vnf = setVnf(assignmentsMap);
+ vnf.setCloudRegion(cloud);
+ si.getVnfs().add(vnf);
+
+ } else if (assignmentsMap.containsKey("primaryPnfName")) {
+ logger.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 if (identifierType.equals(CandidateType.CLOUD_REGION_ID.toString())) {
+ logger.debug("Resources has been homed to a cloud region");
+ cloud.setLcpCloudRegionId(identifierValue);
+ solutionInfo.setHomed(false);
+ solutionInfo.setTargetedCloudRegion(cloud);
+ si.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ } else {
+ logger.debug(invalidMessage + IDENTIFIER_TYPE);
+ throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_TYPE);
+ }
+ si.setSolutionInfo(solutionInfo);
+ return si;
+ }
+
+ /**
+ * Sets the cloud data to a cloud region object
+ *
+ */
+ private CloudRegion setCloud(Map<String, String> 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<String, String> 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<String, String> 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
index bdb46e8d2b..7b518dcc86 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -33,24 +32,25 @@ import org.springframework.stereotype.Component;
@Component
public class AAICommonTasks {
-
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
-
- public Optional<String> getServiceType(BuildingBlockExecution execution) {
- try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, 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();
- }
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ public Optional<String> getServiceType(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, 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
index 279957ca1e..4d4b7c9ad2 100644
--- 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
@@ -29,7 +29,6 @@ import java.util.TreeSet;
import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
@@ -74,493 +73,524 @@ import org.springframework.stereotype.Component;
@Component
public class AAICreateTasks {
- private static final Logger logger = LoggerFactory.getLogger(AAICreateTasks.class);
- private static final String networkTypeProvider = "PROVIDER";
- private static String NETWORK_COLLECTION_NAME = "networkCollectionName";
- private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
- private static String HEAT_STACK_ID = "heatStackId";
- private static String NETWORK_POLICY_FQDN_PARAM = "network-policy-fqdn";
- @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;
- @Autowired
- private AAIConfigurationResources aaiConfigurationResources;
- @Autowired
- private AAIInstanceGroupResources aaiInstanceGroupResources;
- @Autowired
- private Environment env;
-
- public void createServiceInstance(BuildingBlockExecution execution) {
- try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, 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);
+ private static final Logger logger = LoggerFactory.getLogger(AAICreateTasks.class);
+ private static final String networkTypeProvider = "PROVIDER";
+ private static String NETWORK_COLLECTION_NAME = "networkCollectionName";
+ private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
+ private static String HEAT_STACK_ID = "heatStackId";
+ private static String NETWORK_POLICY_FQDN_PARAM = "network-policy-fqdn";
+ @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;
+ @Autowired
+ private AAIConfigurationResources aaiConfigurationResources;
+ @Autowired
+ private AAIInstanceGroupResources aaiInstanceGroupResources;
+ @Autowired
+ private Environment env;
+
+ public void createServiceInstance(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, 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);
Customer customer = execution.getGeneralBuildingBlock().getCustomer();
if (null == customer) {
- String errorMessage = "Exception in creating ServiceSubscription. Customer not present for ServiceInstanceID: "
- + serviceInstance.getServiceInstanceId();
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorMessage, "BPMN",
- ErrorCode.UnknownError.getValue(), errorMessage);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, errorMessage);
+ String errorMessage =
+ "Exception in creating ServiceSubscription. Customer not present for ServiceInstanceID: "
+ + serviceInstance.getServiceInstanceId();
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorMessage, "BPMN",
+ ErrorCode.UnknownError.getValue(), errorMessage);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, errorMessage);
}
aaiSIResources.createServiceSubscription(customer);
} catch (BpmnError ex) {
throw ex;
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
- catch (Exception ex) {
+ }
+
+ public void createProject(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ Project project = serviceInstance.getProject();
+ if (project != null) {
+ if (project.getProjectName() == null || "".equals(project.getProjectName())) {
+ logger.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);
+ 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.";
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue(), 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)";
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg,
+ "BPMN", ErrorCode.UnknownError.getValue(), msg);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ } else {
+ aaiSIResources.createOwningEntityandConnectServiceInstance(owningEntity, serviceInstance);
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
- public void createProject(BuildingBlockExecution execution) {
- try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- Project project = serviceInstance.getProject();
- if(project != null) {
- if (project.getProjectName() == null || "".equals(project.getProjectName())) {
- logger.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);
- 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.";
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue(), 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)";
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue(), 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);
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- execution.setVariable("callHoming", Boolean.TRUE.equals(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);
- Platform platform = vnf.getPlatform();
- if(platform != null) {
- if (platform.getPlatformName() == null || "".equals(platform.getPlatformName())) {
- logger.debug("PlatformName is null in input. Skipping create platform...");
- } else {
- List<String> platforms = splitCDL(platform.getPlatformName());
- platforms.stream().forEach(platformName -> aaiVnfResources.createPlatformandConnectVnf(new Platform(platformName),vnf));
- }
- }
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
-
- }
-
- public List<String> splitCDL(String str){
- return Stream.of(str.split(","))
- .map(String::trim)
- .map (elem -> new String(elem))
- .collect(Collectors.toList());
- }
-
- public void createLineOfBusiness(BuildingBlockExecution execution) {
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- LineOfBusiness lineOfBusiness = vnf.getLineOfBusiness();
- if(lineOfBusiness != null) {
- if (lineOfBusiness.getLineOfBusinessName() == null || "".equals(lineOfBusiness.getLineOfBusinessName())) {
- logger.info("lineOfBusiness is null in input. Skipping create lineOfBusiness...");
- } else {
- List<String> lineOfBussinesses = splitCDL(lineOfBusiness.getLineOfBusinessName());
- lineOfBussinesses.stream().forEach(lobName -> aaiVnfResources.createLineOfBusinessandConnectVnf(new LineOfBusiness(lobName),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);
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, 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);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- int moduleIndex = 0;
- if (vfModule.getModelInfoVfModule() != null && !Boolean.TRUE.equals(vfModule.getModelInfoVfModule().getIsBaseBoolean())) {
- moduleIndex = this.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, vfModule);
- }
- vfModule.setModuleIndex(moduleIndex);
- 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);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- VolumeGroup volumeGroup = null;
- try{
- volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- } catch (BBObjectNotFoundException e){
- logger.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);
- L3Network l3network = extractPojosForBB.extractByKey(execution, 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);
- 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);
- 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);
- 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);
- 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 connectVnfToCloudRegion(BuildingBlockExecution execution) {
- try {
- boolean cloudRegionsToSkip = false;
- String[] cloudRegions = env.getProperty("mso.bpmn.cloudRegionIdsToSkipAddingVnfEdgesTo", String[].class);
- if (cloudRegions != null){
- cloudRegionsToSkip = Arrays.stream(cloudRegions).anyMatch(execution.getGeneralBuildingBlock().getCloudRegion().getLcpCloudRegionId()::equals);
- }
- if(!cloudRegionsToSkip) {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVnfResources.connectVnfToCloudRegion(vnf, 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 connectVnfToTenant(BuildingBlockExecution execution) {
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVnfResources.connectVnfToTenant(vnf, 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);
- L3Network l3network = extractPojosForBB.extractByKey(execution, 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);
- L3Network l3network = extractPojosForBB.extractByKey(execution, 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);
- }
- }
-
- public void createConfiguration(BuildingBlockExecution execution){
- try{
- Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
- aaiConfigurationResources.createConfiguration(configuration);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void createInstanceGroupVnf(BuildingBlockExecution execution){
- try{
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
- aaiInstanceGroupResources.createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void createNetworkPolicies(BuildingBlockExecution execution) {
- try{
- String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST);
- if (fqdns != null && !fqdns.isEmpty()) {
- String fqdnList[] = fqdns.split(",");
- int fqdnCount = fqdnList.length;
- if (fqdnCount > 0) {
- for (int i=0; i < fqdnCount; i++) {
- String fqdn = fqdnList[i];
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
- uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn);
- Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy = aaiNetworkResources.getNetworkPolicy(uri);
- if(!oNetPolicy.isPresent()) {
- logger.debug("This network policy FQDN is not in AAI yet: {}", fqdn);
- String networkPolicyId = UUID.randomUUID().toString();
- logger.debug("Adding network-policy with network-policy-id {}", networkPolicyId);
- NetworkPolicy networkPolicy = new NetworkPolicy();
- networkPolicy.setNetworkPolicyId(networkPolicyId);
- networkPolicy.setNetworkPolicyFqdn(fqdn);
- networkPolicy.setHeatStackId(execution.getVariable(HEAT_STACK_ID));
-
- aaiNetworkResources.createNetworkPolicy(networkPolicy);
- }
- }
- }
- }
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- /**
- * Groups existing vf modules by the model uuid of our new vf module and returns the lowest unused index
- *
- * if we have a module type A, and there are 3 instances of those,
- * and then module type B has 2 instances, if we are adding a new module type A,
- * the vf-module-index should be 3 assuming contiguous indices (not 5, or 2)
- *
- */
- protected int getLowestUnusedVfModuleIndexFromAAIVnfResponse(GenericVnf genericVnf, VfModule newVfModule) {
-
- String newVfModuleModelInvariantUUID = null;
- if (newVfModule.getModelInfoVfModule() != null) {
- newVfModuleModelInvariantUUID = newVfModule.getModelInfoVfModule().getModelInvariantUUID();
- }
-
-
- if (genericVnf != null && genericVnf.getVfModules() != null && !genericVnf.getVfModules().isEmpty()) {
- List<VfModule> modules = genericVnf.getVfModules().stream().filter(item -> !item.getVfModuleId().equals(newVfModule.getVfModuleId())).collect(Collectors.toList());
- TreeSet<Integer> moduleIndices = new TreeSet<>();
- int nullIndexFound = 0;
- for (VfModule vfModule : modules) {
- if (vfModule.getModelInfoVfModule() != null) {
- if (vfModule.getModelInfoVfModule().getModelInvariantUUID().equals(newVfModuleModelInvariantUUID)) {
- if (vfModule.getModuleIndex() != null) {
- moduleIndices.add(vfModule.getModuleIndex());
- } else {
- nullIndexFound++;
- logger.warn("Found null index for vf-module-id {} and model-invariant-uuid {}", vfModule.getVfModuleId(), vfModule.getModelInfoVfModule().getModelInvariantUUID());
- }
- }
- }
- }
-
- return calculateUnusedIndex(moduleIndices, nullIndexFound);
- } else {
- return 0;
- }
- }
-
- protected int calculateUnusedIndex(TreeSet<Integer> moduleIndices, int nullIndexFound) {
- //pad array with nulls
- Integer[] temp = new Integer[moduleIndices.size() + nullIndexFound];
- Integer[] array = moduleIndices.toArray(temp);
- int result = 0;
- //when a null is found skip that potential value
- //effectively creates something like, [0,1,3,null,null] -> [0,1,null(2),3,null(4)]
- for (int i=0; i < array.length; i++, result++) {
- if (Integer.valueOf(result) != array[i]) {
- if (nullIndexFound > 0) {
- nullIndexFound--;
- i--;
- } else {
- break;
- }
- }
- }
-
- return result;
- }
+ public void createVnf(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ execution.setVariable("callHoming", Boolean.TRUE.equals(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);
+ Platform platform = vnf.getPlatform();
+ if (platform != null) {
+ if (platform.getPlatformName() == null || "".equals(platform.getPlatformName())) {
+ logger.debug("PlatformName is null in input. Skipping create platform...");
+ } else {
+ List<String> platforms = splitCDL(platform.getPlatformName());
+ platforms.stream().forEach(platformName -> aaiVnfResources
+ .createPlatformandConnectVnf(new Platform(platformName), vnf));
+ }
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+
+ }
+
+ public List<String> splitCDL(String str) {
+ return Stream.of(str.split(",")).map(String::trim).map(elem -> new String(elem)).collect(Collectors.toList());
+ }
+
+ public void createLineOfBusiness(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ LineOfBusiness lineOfBusiness = vnf.getLineOfBusiness();
+ if (lineOfBusiness != null) {
+ if (lineOfBusiness.getLineOfBusinessName() == null
+ || "".equals(lineOfBusiness.getLineOfBusinessName())) {
+ logger.info("lineOfBusiness is null in input. Skipping create lineOfBusiness...");
+ } else {
+ List<String> lineOfBussinesses = splitCDL(lineOfBusiness.getLineOfBusinessName());
+ lineOfBussinesses.stream().forEach(lobName -> aaiVnfResources
+ .createLineOfBusinessandConnectVnf(new LineOfBusiness(lobName), 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);
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, 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);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ int moduleIndex = 0;
+ if (vfModule.getModelInfoVfModule() != null
+ && !Boolean.TRUE.equals(vfModule.getModelInfoVfModule().getIsBaseBoolean())) {
+ moduleIndex = this.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, vfModule);
+ }
+ vfModule.setModuleIndex(moduleIndex);
+ 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);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ VolumeGroup volumeGroup = null;
+ try {
+ volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+ } catch (BBObjectNotFoundException e) {
+ logger.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);
+ L3Network l3network = extractPojosForBB.extractByKey(execution, 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);
+ 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);
+ 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);
+ 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);
+ 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 connectVnfToCloudRegion(BuildingBlockExecution execution) {
+ try {
+ boolean cloudRegionsToSkip = false;
+ String[] cloudRegions = env.getProperty("mso.bpmn.cloudRegionIdsToSkipAddingVnfEdgesTo", String[].class);
+ if (cloudRegions != null) {
+ cloudRegionsToSkip = Arrays.stream(cloudRegions)
+ .anyMatch(execution.getGeneralBuildingBlock().getCloudRegion().getLcpCloudRegionId()::equals);
+ }
+ if (!cloudRegionsToSkip) {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVnfResources.connectVnfToCloudRegion(vnf, 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 connectVnfToTenant(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVnfResources.connectVnfToTenant(vnf, 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);
+ L3Network l3network = extractPojosForBB.extractByKey(execution, 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);
+ L3Network l3network = extractPojosForBB.extractByKey(execution, 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);
+ }
+ }
+
+ public void createConfiguration(BuildingBlockExecution execution) {
+ try {
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
+ aaiConfigurationResources.createConfiguration(configuration);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void createInstanceGroupVnf(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
+ aaiInstanceGroupResources.createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void createNetworkPolicies(BuildingBlockExecution execution) {
+ try {
+ String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST);
+ if (fqdns != null && !fqdns.isEmpty()) {
+ String fqdnList[] = fqdns.split(",");
+ int fqdnCount = fqdnList.length;
+ if (fqdnCount > 0) {
+ for (int i = 0; i < fqdnCount; i++) {
+ String fqdn = fqdnList[i];
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+ uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn);
+ Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy =
+ aaiNetworkResources.getNetworkPolicy(uri);
+ if (!oNetPolicy.isPresent()) {
+ logger.debug("This network policy FQDN is not in AAI yet: {}", fqdn);
+ String networkPolicyId = UUID.randomUUID().toString();
+ logger.debug("Adding network-policy with network-policy-id {}", networkPolicyId);
+ NetworkPolicy networkPolicy = new NetworkPolicy();
+ networkPolicy.setNetworkPolicyId(networkPolicyId);
+ networkPolicy.setNetworkPolicyFqdn(fqdn);
+ networkPolicy.setHeatStackId(execution.getVariable(HEAT_STACK_ID));
+
+ aaiNetworkResources.createNetworkPolicy(networkPolicy);
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * Groups existing vf modules by the model uuid of our new vf module and returns the lowest unused index
+ *
+ * if we have a module type A, and there are 3 instances of those, and then module type B has 2 instances, if we are
+ * adding a new module type A, the vf-module-index should be 3 assuming contiguous indices (not 5, or 2)
+ *
+ */
+ protected int getLowestUnusedVfModuleIndexFromAAIVnfResponse(GenericVnf genericVnf, VfModule newVfModule) {
+
+ String newVfModuleModelInvariantUUID = null;
+ if (newVfModule.getModelInfoVfModule() != null) {
+ newVfModuleModelInvariantUUID = newVfModule.getModelInfoVfModule().getModelInvariantUUID();
+ }
+
+
+ if (genericVnf != null && genericVnf.getVfModules() != null && !genericVnf.getVfModules().isEmpty()) {
+ List<VfModule> modules = genericVnf.getVfModules().stream()
+ .filter(item -> !item.getVfModuleId().equals(newVfModule.getVfModuleId()))
+ .collect(Collectors.toList());
+ TreeSet<Integer> moduleIndices = new TreeSet<>();
+ int nullIndexFound = 0;
+ for (VfModule vfModule : modules) {
+ if (vfModule.getModelInfoVfModule() != null) {
+ if (vfModule.getModelInfoVfModule().getModelInvariantUUID().equals(newVfModuleModelInvariantUUID)) {
+ if (vfModule.getModuleIndex() != null) {
+ moduleIndices.add(vfModule.getModuleIndex());
+ } else {
+ nullIndexFound++;
+ logger.warn("Found null index for vf-module-id {} and model-invariant-uuid {}",
+ vfModule.getVfModuleId(), vfModule.getModelInfoVfModule().getModelInvariantUUID());
+ }
+ }
+ }
+ }
+
+ return calculateUnusedIndex(moduleIndices, nullIndexFound);
+ } else {
+ return 0;
+ }
+ }
+
+ protected int calculateUnusedIndex(TreeSet<Integer> moduleIndices, int nullIndexFound) {
+ // pad array with nulls
+ Integer[] temp = new Integer[moduleIndices.size() + nullIndexFound];
+ Integer[] array = moduleIndices.toArray(temp);
+ int result = 0;
+ // when a null is found skip that potential value
+ // effectively creates something like, [0,1,3,null,null] -> [0,1,null(2),3,null(4)]
+ for (int i = 0; i < array.length; i++, result++) {
+ if (Integer.valueOf(result) != array[i]) {
+ if (nullIndexFound > 0) {
+ nullIndexFound--;
+ i--;
+ } else {
+ break;
+ }
+ }
+ }
+
+ return result;
+ }
}
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
index 095fd7f86d..28186528e4 100644
--- 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
@@ -25,7 +25,6 @@ package org.onap.so.bpmn.infrastructure.aai.tasks;
import java.util.List;
import java.util.Optional;
-
import org.onap.aai.domain.yang.NetworkPolicies;
import org.onap.aai.domain.yang.NetworkPolicy;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -57,151 +56,151 @@ import org.springframework.stereotype.Component;
@Component
public class AAIDeleteTasks {
- private static final Logger logger = LoggerFactory.getLogger(AAIDeleteTasks.class);
-
- private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
- private static String NETWORK_POLICY_FQDN_PARAM = "network-policy-fqdn";
-
- @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;
- @Autowired
- private AAIConfigurationResources aaiConfigurationResources;
- @Autowired
- private AAIInstanceGroupResources aaiInstanceGroupResources;
-
- public void deleteVfModule(BuildingBlockExecution execution) throws Exception {
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, 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.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);
- 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);
- 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);
- 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);
- 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);
- CloudRegion cloudRegion = execution.getGeneralBuildingBlock().getCloudRegion();
- aaiVolumeGroupResources.deleteVolumeGroup(volumeGroup, cloudRegion);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
- public void deleteConfiguration(BuildingBlockExecution execution) {
- try {
- Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
- aaiConfigurationResources.deleteConfiguration(configuration);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void deleteInstanceGroupVnf(BuildingBlockExecution execution) {
- try {
- InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
- aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void deleteNetworkPolicies(BuildingBlockExecution execution) {
- try{
- String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST);
- if (fqdns != null && !fqdns.isEmpty()) {
- String fqdnList[] = fqdns.split(",");
- int fqdnCount = fqdnList.length;
- if (fqdnCount > 0) {
- for (int i=0; i < fqdnCount; i++) {
- String fqdn = fqdnList[i];
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
- uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn);
- Optional<NetworkPolicies> oNetPolicies = aaiNetworkResources.getNetworkPolicies(uri);
- if(oNetPolicies.isPresent()) {
- NetworkPolicies networkPolicies = oNetPolicies.get();
- List<NetworkPolicy> networkPolicyList = networkPolicies.getNetworkPolicy();
- if (networkPolicyList != null && !networkPolicyList.isEmpty()) {
- NetworkPolicy networkPolicy = networkPolicyList.get(0);
- String networkPolicyId = networkPolicy.getNetworkPolicyId();
- logger.debug("Deleting network-policy with network-policy-id {}", networkPolicyId);
- aaiNetworkResources.deleteNetworkPolicy(networkPolicyId);
- }
- }
- }
- }
- }
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(AAIDeleteTasks.class);
+
+ private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
+ private static String NETWORK_POLICY_FQDN_PARAM = "network-policy-fqdn";
+
+ @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;
+ @Autowired
+ private AAIConfigurationResources aaiConfigurationResources;
+ @Autowired
+ private AAIInstanceGroupResources aaiInstanceGroupResources;
+
+ public void deleteVfModule(BuildingBlockExecution execution) throws Exception {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, 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.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);
+ 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);
+ 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);
+ 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);
+ 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);
+ CloudRegion cloudRegion = execution.getGeneralBuildingBlock().getCloudRegion();
+ aaiVolumeGroupResources.deleteVolumeGroup(volumeGroup, cloudRegion);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void deleteConfiguration(BuildingBlockExecution execution) {
+ try {
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
+ aaiConfigurationResources.deleteConfiguration(configuration);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void deleteInstanceGroupVnf(BuildingBlockExecution execution) {
+ try {
+ InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
+ aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void deleteNetworkPolicies(BuildingBlockExecution execution) {
+ try {
+ String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST);
+ if (fqdns != null && !fqdns.isEmpty()) {
+ String fqdnList[] = fqdns.split(",");
+ int fqdnCount = fqdnList.length;
+ if (fqdnCount > 0) {
+ for (int i = 0; i < fqdnCount; i++) {
+ String fqdn = fqdnList[i];
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+ uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn);
+ Optional<NetworkPolicies> oNetPolicies = aaiNetworkResources.getNetworkPolicies(uri);
+ if (oNetPolicies.isPresent()) {
+ NetworkPolicies networkPolicies = oNetPolicies.get();
+ List<NetworkPolicy> networkPolicyList = networkPolicies.getNetworkPolicy();
+ if (networkPolicyList != null && !networkPolicyList.isEmpty()) {
+ NetworkPolicy networkPolicy = networkPolicyList.get(0);
+ String networkPolicyId = networkPolicy.getNetworkPolicyId();
+ logger.debug("Deleting network-policy with network-policy-id {}", networkPolicyId);
+ aaiNetworkResources.deleteNetworkPolicy(networkPolicyId);
+ }
+ }
+ }
+ }
+ }
+ } 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
index 177e09d5a1..12aade71bc 100644
--- 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
@@ -35,83 +35,83 @@ import org.springframework.stereotype.Component;
@Component
public class AAIFlagTasks {
- private static final Logger logger = LoggerFactory.getLogger(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);
- 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);
+ private static final Logger logger = LoggerFactory.getLogger(AAIFlagTasks.class);
- GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
+ @Autowired
+ private AAIVnfResources aaiVnfResources;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
- copiedGenericVnf.setInMaint(inMaint);
- genericVnf.setInMaint(inMaint);
+ public void checkVnfInMaintFlag(BuildingBlockExecution execution) {
+ boolean inMaint = false;
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, 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");
+ }
+ }
- aaiVnfResources.updateObjectVnf(copiedGenericVnf);
- } catch(Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void checkVnfClosedLoopDisabledFlag(BuildingBlockExecution execution) {
- boolean isClosedLoopDisabled = false;
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- String vnfId = vnf.getVnfId();
- isClosedLoopDisabled = aaiVnfResources.checkVnfClosedLoopDisabledFlag(vnfId);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- if (isClosedLoopDisabled) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VNF Close Loop Disabled in A&AI");
- }
- }
-
- public void modifyVnfClosedLoopDisabledFlag(BuildingBlockExecution execution, boolean closedLoopDisabled) {
- try {
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ public void modifyVnfInMaintFlag(BuildingBlockExecution execution, boolean inMaint) {
+ try {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
- copiedGenericVnf.setClosedLoopDisabled(closedLoopDisabled);
- genericVnf.setClosedLoopDisabled(closedLoopDisabled);
+ GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
- aaiVnfResources.updateObjectVnf(copiedGenericVnf);
- } catch(Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void checkVnfPserversLockedFlag(BuildingBlockExecution execution) {
- boolean inPserversLocked = false;
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- String vnfId = vnf.getVnfId();
- inPserversLocked = aaiVnfResources.checkVnfPserversLockedFlag(vnfId);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- if (inPserversLocked) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VNF PServers in Locked in A&AI");
- }
- }
+ copiedGenericVnf.setInMaint(inMaint);
+ genericVnf.setInMaint(inMaint);
+
+ aaiVnfResources.updateObjectVnf(copiedGenericVnf);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void checkVnfClosedLoopDisabledFlag(BuildingBlockExecution execution) {
+ boolean isClosedLoopDisabled = false;
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ String vnfId = vnf.getVnfId();
+ isClosedLoopDisabled = aaiVnfResources.checkVnfClosedLoopDisabledFlag(vnfId);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ if (isClosedLoopDisabled) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VNF Close Loop Disabled in A&AI");
+ }
+ }
+
+ public void modifyVnfClosedLoopDisabledFlag(BuildingBlockExecution execution, boolean closedLoopDisabled) {
+ try {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+
+ GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
+ copiedGenericVnf.setClosedLoopDisabled(closedLoopDisabled);
+ genericVnf.setClosedLoopDisabled(closedLoopDisabled);
+
+ aaiVnfResources.updateObjectVnf(copiedGenericVnf);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void checkVnfPserversLockedFlag(BuildingBlockExecution execution) {
+ boolean inPserversLocked = false;
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ String vnfId = vnf.getVnfId();
+ inPserversLocked = aaiVnfResources.checkVnfPserversLockedFlag(vnfId);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ if (inPserversLocked) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VNF PServers in Locked in A&AI");
+ }
+ }
}
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
index e0e139e290..7668c6b00f 100644
--- 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
@@ -25,7 +25,6 @@ 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;
@@ -52,197 +51,209 @@ import org.springframework.stereotype.Component;
@Component
public class AAIQueryTasks {
- private static final Logger logger = LoggerFactory.getLogger(AAIQueryTasks.class);
- 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 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 {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
- Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
- if (!networkRelationships.isPresent()) {
- throw (new Exception(ERROR_MSG));
- }
- List<AAIResourceUri> netBindingsUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.VPN_BINDING);
-
- List<org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding> mappedVpnBindings = new ArrayList<>();
- if(netBindingsUriList != null && !netBindingsUriList.isEmpty()) {
- for(AAIResourceUri netBindingUri : netBindingsUriList) {
- Optional<VpnBinding> 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 {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
- CreateNetworkRequest createNetworkRequest = execution.getVariable("createNetworkRequest");
-
- Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
- if (!networkRelationships.isPresent()) {
- throw (new Exception(ERROR_MSG));
- }
- List<AAIResourceUri> netBindingsUriList = networkRelationships.get()
- .getRelatedAAIUris(AAIObjectType.VPN_BINDING);
- List<org.onap.so.openstack.beans.RouteTarget> routeTargets = new ArrayList<>();
- for (AAIResourceUri netBindingUri : netBindingsUriList) {
- logger.info("Get Route Targests");
- Optional<VpnBinding> oVpnBinding = aaiNetworkResources.getVpnBinding(netBindingUri);
- if (oVpnBinding.isPresent()) {
- VpnBinding vpnBinding = oVpnBinding.get();
- RouteTargets rts = vpnBinding.getRouteTargets();
- if (rts != null) {
- List<org.onap.aai.domain.yang.RouteTarget> rtList = rts.getRouteTarget();
- if (!rtList.isEmpty()) {
- PropertyMap<org.onap.aai.domain.yang.RouteTarget, org.onap.so.openstack.beans.RouteTarget> personMap = new PropertyMap<org.onap.aai.domain.yang.RouteTarget, org.onap.so.openstack.beans.RouteTarget>() {
- @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);
- AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
- Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
- if (!networkRelationships.isPresent()) {
- throw (new Exception(ERROR_MSG));
- }
- List<AAIResourceUri> netPoliciesUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.NETWORK_POLICY);
-
- if(!netPoliciesUriList.isEmpty()) {
- for(AAIResourceUri netPolicyUri : netPoliciesUriList) {
- Optional<NetworkPolicy> 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);
- AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
- Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
- if (!networkRelationships.isPresent()) {
- throw (new Exception(ERROR_MSG));
- }
- List<AAIResourceUri> routeTableUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.ROUTE_TABLE_REFERENCE);
-
- if(!routeTableUriList.isEmpty()) {
- for(AAIResourceUri routeTableUri : routeTableUriList) {
- Optional<RouteTableReference> 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<org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget> mapRouteTargets(List<org.onap.aai.domain.yang.RouteTarget> routeTargets) {
- List<org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget> 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;
- }
-
- public void querySubnet(BuildingBlockExecution execution) {
- try {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
- Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
- if (!networkRelationships.isPresent()) {
- throw (new Exception(ERROR_MSG));
- }
- List<AAIResourceUri> subnetsUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.SUBNET);
-
- if(!subnetsUriList.isEmpty()) {
- for(AAIResourceUri subnetUri : subnetsUriList) {
- Optional<Subnet> oSubnet = aaiNetworkResources.getSubnet(subnetUri);
- if(oSubnet.isPresent()) {
- l3network.getSubnets().add(modelMapper.map(oSubnet.get(), org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet.class));
- }
- }
- }
- } catch(Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(AAIQueryTasks.class);
+ 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 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 {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
+ Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
+ if (!networkRelationships.isPresent()) {
+ throw (new Exception(ERROR_MSG));
+ }
+ List<AAIResourceUri> netBindingsUriList =
+ networkRelationships.get().getRelatedAAIUris(AAIObjectType.VPN_BINDING);
+
+ List<org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding> mappedVpnBindings = new ArrayList<>();
+ if (netBindingsUriList != null && !netBindingsUriList.isEmpty()) {
+ for (AAIResourceUri netBindingUri : netBindingsUriList) {
+ Optional<VpnBinding> 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 {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
+ CreateNetworkRequest createNetworkRequest = execution.getVariable("createNetworkRequest");
+
+ Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
+ if (!networkRelationships.isPresent()) {
+ throw (new Exception(ERROR_MSG));
+ }
+ List<AAIResourceUri> netBindingsUriList =
+ networkRelationships.get().getRelatedAAIUris(AAIObjectType.VPN_BINDING);
+ List<org.onap.so.openstack.beans.RouteTarget> routeTargets = new ArrayList<>();
+ for (AAIResourceUri netBindingUri : netBindingsUriList) {
+ logger.info("Get Route Targests");
+ Optional<VpnBinding> oVpnBinding = aaiNetworkResources.getVpnBinding(netBindingUri);
+ if (oVpnBinding.isPresent()) {
+ VpnBinding vpnBinding = oVpnBinding.get();
+ RouteTargets rts = vpnBinding.getRouteTargets();
+ if (rts != null) {
+ List<org.onap.aai.domain.yang.RouteTarget> rtList = rts.getRouteTarget();
+ if (!rtList.isEmpty()) {
+ PropertyMap<org.onap.aai.domain.yang.RouteTarget, org.onap.so.openstack.beans.RouteTarget> personMap =
+ new PropertyMap<org.onap.aai.domain.yang.RouteTarget, org.onap.so.openstack.beans.RouteTarget>() {
+ @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);
+ AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
+ Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
+ if (!networkRelationships.isPresent()) {
+ throw (new Exception(ERROR_MSG));
+ }
+ List<AAIResourceUri> netPoliciesUriList =
+ networkRelationships.get().getRelatedAAIUris(AAIObjectType.NETWORK_POLICY);
+
+ if (!netPoliciesUriList.isEmpty()) {
+ for (AAIResourceUri netPolicyUri : netPoliciesUriList) {
+ Optional<NetworkPolicy> 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);
+ AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
+ Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
+ if (!networkRelationships.isPresent()) {
+ throw (new Exception(ERROR_MSG));
+ }
+ List<AAIResourceUri> routeTableUriList =
+ networkRelationships.get().getRelatedAAIUris(AAIObjectType.ROUTE_TABLE_REFERENCE);
+
+ if (!routeTableUriList.isEmpty()) {
+ for (AAIResourceUri routeTableUri : routeTableUriList) {
+ Optional<RouteTableReference> 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<org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget> mapRouteTargets(
+ List<org.onap.aai.domain.yang.RouteTarget> routeTargets) {
+ List<org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget> 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;
+ }
+
+ public void querySubnet(BuildingBlockExecution execution) {
+ try {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
+ Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
+ if (!networkRelationships.isPresent()) {
+ throw (new Exception(ERROR_MSG));
+ }
+ List<AAIResourceUri> subnetsUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.SUBNET);
+
+ if (!subnetsUriList.isEmpty()) {
+ for (AAIResourceUri subnetUri : subnetsUriList) {
+ Optional<Subnet> oSubnet = aaiNetworkResources.getSubnet(subnetUri);
+ if (oSubnet.isPresent()) {
+ l3network.getSubnets().add(modelMapper.map(oSubnet.get(),
+ org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet.class));
+ }
+ }
+ }
+ } 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/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index 82b61c17b5..3304d1b113 100644
--- 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
@@ -24,7 +24,6 @@ package org.onap.so.bpmn.infrastructure.aai.tasks;
import java.util.List;
import java.util.Map;
-
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -57,507 +56,526 @@ import org.springframework.stereotype.Component;
@Component
public class AAIUpdateTasks {
- private static final Logger logger = LoggerFactory.getLogger(AAIUpdateTasks.class);
- private static final String ALACARTE = "aLaCarte";
- private static final String MULTI_STAGE_DESIGN_OFF = "false";
- private static final String MULTI_STAGE_DESIGN_ON = "true";
- @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;
- @Autowired
- private AAIConfigurationResources aaiConfigurationResources;
-
- public void updateOrchestrationStatusAssignedService(BuildingBlockExecution execution) {
- try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, 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);
- 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);
- 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);
- 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);
- 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);
- 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);
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
-
- aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateHeatStackIdVolumeGroup(BuildingBlockExecution execution) {
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- String heatStackId = execution.getVariable("heatStackId");
- if (heatStackId == null) {
- heatStackId = "";
- }
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- volumeGroup.setHeatStackId(heatStackId);
-
- aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateOrchestrationStatusAssignedVfModule(BuildingBlockExecution execution) {
- try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- vfModule.setHeatStackId("");
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, 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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.PENDING_ACTIVATION);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModule(BuildingBlockExecution execution) {
- try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- vfModule.setHeatStackId("");
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- String multiStageDesign = MULTI_STAGE_DESIGN_OFF;
- if (vnf.getModelInfoGenericVnf() != null) {
- multiStageDesign = vnf.getModelInfoGenericVnf().getMultiStageDesign();
- }
- boolean aLaCarte = (boolean) execution.getVariable(ALACARTE);
- if (aLaCarte && multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.PENDING_ACTIVATION);
- }
- else {
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.ASSIGNED);
- }
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) {
- try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, 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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, 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) {
- updateNetwork(execution, OrchestrationStatus.ASSIGNED);
- }
-
- /**
- * BPMN access method to update status of L3Network to Active in AAI
- * @param execution
- * @throws BBObjectNotFoundException
- */
- public void updateOrchestrationStatusActiveNetwork(BuildingBlockExecution execution) {
- updateNetwork(execution, OrchestrationStatus.ACTIVE);
- }
-
- /**
- * BPMN access method to update status of L3Network to Created in AAI
- * @param execution
- * @throws BBObjectNotFoundException
- */
- public void updateOrchestrationStatusCreatedNetwork(BuildingBlockExecution execution) {
- updateNetwork(execution, OrchestrationStatus.CREATED);
- }
-
- protected void updateNetwork(BuildingBlockExecution execution, OrchestrationStatus status) {
- try {
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- updateNetworkAAI(l3Network, status);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- protected void updateNetworkAAI(L3Network l3Network, OrchestrationStatus status) {
- L3Network copiedl3Network = l3Network.shallowCopyId();
-
- copiedl3Network.setOrchestrationStatus(status);
- l3Network.setOrchestrationStatus(status);
- aaiNetworkResources.updateNetwork(copiedl3Network);
-
- List<Subnet> subnets = l3Network.getSubnets();
- if (subnets != null){
- for (Subnet subnet : subnets){
- Subnet copiedSubnet = subnet.shallowCopyId();
- copiedSubnet.setOrchestrationStatus(status);
- aaiNetworkResources.updateSubnet(copiedl3Network, copiedSubnet);
- }
- }
- }
-
- /**
- * 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);
- 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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE);
- execution.setVariable("aaiActivateVfModuleRollback", true);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateHeatStackIdVfModule(BuildingBlockExecution execution) {
- try {
- String heatStackId = execution.getVariable("heatStackId");
- if (heatStackId == null) {
- heatStackId = "";
- }
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- vfModule.setHeatStackId(heatStackId);
- aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- /**
- * BPMN access method to update L3Network after it was created in cloud
- * @param execution
- * @throws Exception
- */
- public void updateNetworkCreated(BuildingBlockExecution execution) throws Exception {
- execution.setVariable("aaiNetworkActivateRollback", false);
- L3Network l3network = extractPojosForBB.extractByKey(execution, 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);
-
- Map<String, String> subnetMap = response.getSubnetMap();
- List<Subnet> subnets = l3network.getSubnets();
- if (subnets != null && subnetMap != null){
- for (Subnet subnet: subnets){
- Subnet copiedSubnet = subnet.shallowCopyId();
- copiedSubnet.setNeutronSubnetId(subnetMap.get(copiedSubnet.getSubnetId()));
- copiedSubnet.setOrchestrationStatus(OrchestrationStatus.CREATED);
- aaiNetworkResources.updateSubnet(copiedl3network, copiedSubnet);
- }
- }
-
- execution.setVariable("aaiNetworkActivateRollback", true);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- /**
- * BPMN access method to update L3Network after it was updated in cloud
- * @param execution
- * @throws Exception
- */
- public void updateNetworkUpdated(BuildingBlockExecution execution) throws Exception {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- L3Network copiedl3network = l3network.shallowCopyId();
- UpdateNetworkResponse response = execution.getVariable("updateNetworkResponse");
- try {
- copiedl3network.setNeutronNetworkId(response.getNeutronNetworkId());
- aaiNetworkResources.updateNetwork(copiedl3network);
-
- Map<String, String> subnetMap = response.getSubnetMap();
- List<Subnet> subnets = l3network.getSubnets();
- if (subnets != null && subnetMap != null){
- for (Subnet subnet: subnets){
- Subnet copiedSubnet = subnet.shallowCopyId();
- copiedSubnet.setNeutronSubnetId(subnetMap.get(copiedSubnet.getSubnetId()));
- copiedSubnet.setOrchestrationStatus(OrchestrationStatus.CREATED);
- aaiNetworkResources.updateSubnet(copiedl3network, copiedSubnet);
- }
- }
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateObjectNetwork(BuildingBlockExecution execution) {
- try {
- L3Network l3network = extractPojosForBB.extractByKey(execution, 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);
- 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);
- 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);
- vfModule.setHeatStackId("");
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, 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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVfModuleResources.changeAssignVfModule(vfModule, vnf);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
- public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) {
- try {
- Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
- aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateOrchestrationStatusDeactivateFabricConfiguration(BuildingBlockExecution execution) {
- try {
- Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
- aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateIpv4OamAddressVnf(BuildingBlockExecution execution) {
- try {
- String ipv4OamAddress = execution.getVariable("oamManagementV4Address");
- if (ipv4OamAddress != null) {
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
-
- genericVnf.setIpv4OamAddress(ipv4OamAddress);
- copiedGenericVnf.setIpv4OamAddress(ipv4OamAddress);
-
- aaiVnfResources.updateObjectVnf(copiedGenericVnf);
- }
- } catch(Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateManagementV6AddressVnf(BuildingBlockExecution execution) {
- try {
- String managementV6Address = execution.getVariable("oamManagementV6Address");
- if (managementV6Address != null) {
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
-
- genericVnf.setManagementV6Address(managementV6Address);
- copiedGenericVnf.setManagementV6Address(managementV6Address);
-
- aaiVnfResources.updateObjectVnf(copiedGenericVnf);
- }
- } catch(Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateContrailServiceInstanceFqdnVfModule(BuildingBlockExecution execution) {
- try {
- String contrailServiceInstanceFqdn = execution.getVariable("contrailServiceInstanceFqdn");
- if (contrailServiceInstanceFqdn != null) {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- vfModule.setContrailServiceInstanceFqdn(contrailServiceInstanceFqdn);
- aaiVfModuleResources.updateContrailServiceInstanceFqdnVfModule(vfModule, vnf);
- }
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateOrchestrationStatusConfigAssignedVnf(BuildingBlockExecution execution) {
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGASSIGNED);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateOrchestrationStausConfigDeployConfigureVnf(BuildingBlockExecution execution){
- try{
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURE);
-
- }catch(Exception ex){
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
-
- }
-
- public void updateOrchestrationStausConfigDeployConfiguredVnf(BuildingBlockExecution execution){
- try{
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURED);
-
- }catch(Exception ex){
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
-
- }
+ private static final Logger logger = LoggerFactory.getLogger(AAIUpdateTasks.class);
+ private static final String ALACARTE = "aLaCarte";
+ private static final String MULTI_STAGE_DESIGN_OFF = "false";
+ private static final String MULTI_STAGE_DESIGN_ON = "true";
+ @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;
+ @Autowired
+ private AAIConfigurationResources aaiConfigurationResources;
+
+ public void updateOrchestrationStatusAssignedService(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+
+ aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
+ OrchestrationStatus.CREATED);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateHeatStackIdVolumeGroup(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ String heatStackId = execution.getVariable("heatStackId");
+ if (heatStackId == null) {
+ heatStackId = "";
+ }
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ volumeGroup.setHeatStackId(heatStackId);
+
+ aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusAssignedVfModule(BuildingBlockExecution execution) {
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ vfModule.setHeatStackId("");
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, 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);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf,
+ OrchestrationStatus.PENDING_ACTIVATION);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusAssignedOrPendingActivationVfModule(BuildingBlockExecution execution) {
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ vfModule.setHeatStackId("");
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ String multiStageDesign = MULTI_STAGE_DESIGN_OFF;
+ if (vnf.getModelInfoGenericVnf() != null) {
+ multiStageDesign = vnf.getModelInfoGenericVnf().getMultiStageDesign();
+ }
+ boolean aLaCarte = (boolean) execution.getVariable(ALACARTE);
+ if (aLaCarte && multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
+ aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf,
+ OrchestrationStatus.PENDING_ACTIVATION);
+ } else {
+ aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED);
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) {
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, 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);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, 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) {
+ updateNetwork(execution, OrchestrationStatus.ASSIGNED);
+ }
+
+ /**
+ * BPMN access method to update status of L3Network to Active in AAI
+ *
+ * @param execution
+ * @throws BBObjectNotFoundException
+ */
+ public void updateOrchestrationStatusActiveNetwork(BuildingBlockExecution execution) {
+ updateNetwork(execution, OrchestrationStatus.ACTIVE);
+ }
+
+ /**
+ * BPMN access method to update status of L3Network to Created in AAI
+ *
+ * @param execution
+ * @throws BBObjectNotFoundException
+ */
+ public void updateOrchestrationStatusCreatedNetwork(BuildingBlockExecution execution) {
+ updateNetwork(execution, OrchestrationStatus.CREATED);
+ }
+
+ protected void updateNetwork(BuildingBlockExecution execution, OrchestrationStatus status) {
+ try {
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ updateNetworkAAI(l3Network, status);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ protected void updateNetworkAAI(L3Network l3Network, OrchestrationStatus status) {
+ L3Network copiedl3Network = l3Network.shallowCopyId();
+
+ copiedl3Network.setOrchestrationStatus(status);
+ l3Network.setOrchestrationStatus(status);
+ aaiNetworkResources.updateNetwork(copiedl3Network);
+
+ List<Subnet> subnets = l3Network.getSubnets();
+ if (subnets != null) {
+ for (Subnet subnet : subnets) {
+ Subnet copiedSubnet = subnet.shallowCopyId();
+ copiedSubnet.setOrchestrationStatus(status);
+ aaiNetworkResources.updateSubnet(copiedl3Network, copiedSubnet);
+ }
+ }
+ }
+
+ /**
+ * 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);
+ 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);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE);
+ execution.setVariable("aaiActivateVfModuleRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateHeatStackIdVfModule(BuildingBlockExecution execution) {
+ try {
+ String heatStackId = execution.getVariable("heatStackId");
+ if (heatStackId == null) {
+ heatStackId = "";
+ }
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ vfModule.setHeatStackId(heatStackId);
+ aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to update L3Network after it was created in cloud
+ *
+ * @param execution
+ * @throws Exception
+ */
+ public void updateNetworkCreated(BuildingBlockExecution execution) throws Exception {
+ execution.setVariable("aaiNetworkActivateRollback", false);
+ L3Network l3network = extractPojosForBB.extractByKey(execution, 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);
+
+ Map<String, String> subnetMap = response.getSubnetMap();
+ List<Subnet> subnets = l3network.getSubnets();
+ if (subnets != null && subnetMap != null) {
+ for (Subnet subnet : subnets) {
+ Subnet copiedSubnet = subnet.shallowCopyId();
+ copiedSubnet.setNeutronSubnetId(subnetMap.get(copiedSubnet.getSubnetId()));
+ copiedSubnet.setOrchestrationStatus(OrchestrationStatus.CREATED);
+ aaiNetworkResources.updateSubnet(copiedl3network, copiedSubnet);
+ }
+ }
+
+ execution.setVariable("aaiNetworkActivateRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to update L3Network after it was updated in cloud
+ *
+ * @param execution
+ * @throws Exception
+ */
+ public void updateNetworkUpdated(BuildingBlockExecution execution) throws Exception {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ L3Network copiedl3network = l3network.shallowCopyId();
+ UpdateNetworkResponse response = execution.getVariable("updateNetworkResponse");
+ try {
+ copiedl3network.setNeutronNetworkId(response.getNeutronNetworkId());
+ aaiNetworkResources.updateNetwork(copiedl3network);
+
+ Map<String, String> subnetMap = response.getSubnetMap();
+ List<Subnet> subnets = l3network.getSubnets();
+ if (subnets != null && subnetMap != null) {
+ for (Subnet subnet : subnets) {
+ Subnet copiedSubnet = subnet.shallowCopyId();
+ copiedSubnet.setNeutronSubnetId(subnetMap.get(copiedSubnet.getSubnetId()));
+ copiedSubnet.setOrchestrationStatus(OrchestrationStatus.CREATED);
+ aaiNetworkResources.updateSubnet(copiedl3network, copiedSubnet);
+ }
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateObjectNetwork(BuildingBlockExecution execution) {
+ try {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, 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);
+ 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);
+ 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);
+ vfModule.setHeatStackId("");
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, 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);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVfModuleResources.changeAssignVfModule(vfModule, vnf);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) {
+ try {
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
+ aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusDeactivateFabricConfiguration(BuildingBlockExecution execution) {
+ try {
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
+ aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration,
+ OrchestrationStatus.ASSIGNED);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateIpv4OamAddressVnf(BuildingBlockExecution execution) {
+ try {
+ String ipv4OamAddress = execution.getVariable("oamManagementV4Address");
+ if (ipv4OamAddress != null) {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
+
+ genericVnf.setIpv4OamAddress(ipv4OamAddress);
+ copiedGenericVnf.setIpv4OamAddress(ipv4OamAddress);
+
+ aaiVnfResources.updateObjectVnf(copiedGenericVnf);
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateManagementV6AddressVnf(BuildingBlockExecution execution) {
+ try {
+ String managementV6Address = execution.getVariable("oamManagementV6Address");
+ if (managementV6Address != null) {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
+
+ genericVnf.setManagementV6Address(managementV6Address);
+ copiedGenericVnf.setManagementV6Address(managementV6Address);
+
+ aaiVnfResources.updateObjectVnf(copiedGenericVnf);
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateContrailServiceInstanceFqdnVfModule(BuildingBlockExecution execution) {
+ try {
+ String contrailServiceInstanceFqdn = execution.getVariable("contrailServiceInstanceFqdn");
+ if (contrailServiceInstanceFqdn != null) {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ vfModule.setContrailServiceInstanceFqdn(contrailServiceInstanceFqdn);
+ aaiVfModuleResources.updateContrailServiceInstanceFqdnVfModule(vfModule, vnf);
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusConfigAssignedVnf(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGASSIGNED);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStausConfigDeployConfigureVnf(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURE);
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+
+ }
+
+ public void updateOrchestrationStausConfigDeployConfiguredVnf(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURED);
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
index 821dfc18b0..05d4f56fdc 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
@@ -25,7 +25,6 @@ package org.onap.so.bpmn.infrastructure.activity;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
@@ -44,106 +43,107 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-
import com.fasterxml.jackson.databind.ObjectMapper;
@Component("ExecuteActivity")
public class ExecuteActivity implements JavaDelegate {
- private static final Logger logger = LoggerFactory.getLogger(ExecuteActivity.class);
- private static final String G_BPMN_REQUEST = "bpmnRequest";
- private static final String VNF_TYPE = "vnfType";
- private static final String G_ACTION = "requestAction";
- private static final String G_REQUEST_ID = "mso-request-id";
- private static final String VNF_ID = "vnfId";
- private static final String SERVICE_INSTANCE_ID = "serviceInstanceId";
-
- private static final String SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE = "implementation";
- private static final String ACTIVITY_PREFIX = "activity:";
-
- private ObjectMapper mapper = new ObjectMapper();
-
- @Autowired
- private RuntimeService runtimeService;
- @Autowired
- private ExceptionBuilder exceptionBuilder;
-
- @Override
- public void execute(DelegateExecution execution) throws Exception {
- final String requestId = (String) execution.getVariable(G_REQUEST_ID);
-
- try {
- final String implementationString = execution.getBpmnModelElementInstance().getAttributeValue(SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE);
- logger.debug("activity implementation String: {}", implementationString);
- if (!implementationString.startsWith(ACTIVITY_PREFIX)) {
- buildAndThrowException(execution, "Implementation attribute has a wrong format");
- }
- String activityName = implementationString.replaceFirst(ACTIVITY_PREFIX, "");
- logger.info("activityName is: {}", activityName);
-
- BuildingBlock buildingBlock = buildBuildingBlock(activityName);
- ExecuteBuildingBlock executeBuildingBlock = buildExecuteBuildingBlock(execution, requestId, buildingBlock);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("buildingBlock", executeBuildingBlock);
- variables.put("mso-request-id", requestId);
- variables.put("retryCount", 1);
- variables.put("aLaCarte", true);
-
- ProcessInstanceWithVariables buildingBlockResult = runtimeService.createProcessInstanceByKey("ExecuteBuildingBlock").setVariables(variables).executeWithVariablesInReturn();
- VariableMap variableMap = buildingBlockResult.getVariables();
-
- WorkflowException workflowException = (WorkflowException) variableMap.get("WorklfowException");
- if (workflowException != null) {
- logger.error("Workflow exception is: {}", workflowException.getErrorMessage());
- }
- execution.setVariable("WorkflowException", workflowException);
- }
- catch (Exception e) {
- buildAndThrowException(execution, e.getMessage());
- }
- }
-
- protected BuildingBlock buildBuildingBlock(String activityName) {
- BuildingBlock buildingBlock = new BuildingBlock();
- buildingBlock.setBpmnFlowName(activityName);
- buildingBlock.setMsoId(UUID.randomUUID().toString());
- buildingBlock.setKey("");
- buildingBlock.setIsVirtualLink(false);
- buildingBlock.setVirtualLinkKey("");
- return buildingBlock;
- }
-
- protected ExecuteBuildingBlock buildExecuteBuildingBlock(DelegateExecution execution, String requestId,
- BuildingBlock buildingBlock) throws Exception {
- ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
- String bpmnRequest = (String) execution.getVariable(G_BPMN_REQUEST);
- ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
- RequestDetails requestDetails = sIRequest.getRequestDetails();
- executeBuildingBlock.setaLaCarte(true);
- executeBuildingBlock.setRequestAction((String) execution.getVariable(G_ACTION));
- executeBuildingBlock.setResourceId((String) execution.getVariable(VNF_ID));
- executeBuildingBlock.setVnfType((String) execution.getVariable(VNF_TYPE));
- WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
- workflowResourceIds.setServiceInstanceId((String) execution.getVariable(SERVICE_INSTANCE_ID));
- workflowResourceIds.setVnfId((String) execution.getVariable(VNF_ID));
- executeBuildingBlock.setWorkflowResourceIds(workflowResourceIds);
- executeBuildingBlock.setRequestId(requestId);
- executeBuildingBlock.setBuildingBlock(buildingBlock);
- executeBuildingBlock.setRequestDetails(requestDetails);
- return executeBuildingBlock;
- }
-
- protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue(), msg, ex);
- execution.setVariable("ExecuteActivityErrorMessage", msg);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
- }
-
- protected void buildAndThrowException(DelegateExecution execution, String msg) {
- logger.error(msg);
- execution.setVariable("ExecuteActuvityErrorMessage", msg);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
- }
+ private static final Logger logger = LoggerFactory.getLogger(ExecuteActivity.class);
+ private static final String G_BPMN_REQUEST = "bpmnRequest";
+ private static final String VNF_TYPE = "vnfType";
+ private static final String G_ACTION = "requestAction";
+ private static final String G_REQUEST_ID = "mso-request-id";
+ private static final String VNF_ID = "vnfId";
+ private static final String SERVICE_INSTANCE_ID = "serviceInstanceId";
+
+ private static final String SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE = "implementation";
+ private static final String ACTIVITY_PREFIX = "activity:";
+
+ private ObjectMapper mapper = new ObjectMapper();
+
+ @Autowired
+ private RuntimeService runtimeService;
+ @Autowired
+ private ExceptionBuilder exceptionBuilder;
+
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+ final String requestId = (String) execution.getVariable(G_REQUEST_ID);
+
+ try {
+ final String implementationString =
+ execution.getBpmnModelElementInstance().getAttributeValue(SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE);
+ logger.debug("activity implementation String: {}", implementationString);
+ if (!implementationString.startsWith(ACTIVITY_PREFIX)) {
+ buildAndThrowException(execution, "Implementation attribute has a wrong format");
+ }
+ String activityName = implementationString.replaceFirst(ACTIVITY_PREFIX, "");
+ logger.info("activityName is: {}", activityName);
+
+ BuildingBlock buildingBlock = buildBuildingBlock(activityName);
+ ExecuteBuildingBlock executeBuildingBlock = buildExecuteBuildingBlock(execution, requestId, buildingBlock);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("buildingBlock", executeBuildingBlock);
+ variables.put("mso-request-id", requestId);
+ variables.put("retryCount", 1);
+ variables.put("aLaCarte", true);
+
+ ProcessInstanceWithVariables buildingBlockResult =
+ runtimeService.createProcessInstanceByKey("ExecuteBuildingBlock").setVariables(variables)
+ .executeWithVariablesInReturn();
+ VariableMap variableMap = buildingBlockResult.getVariables();
+
+ WorkflowException workflowException = (WorkflowException) variableMap.get("WorklfowException");
+ if (workflowException != null) {
+ logger.error("Workflow exception is: {}", workflowException.getErrorMessage());
+ }
+ execution.setVariable("WorkflowException", workflowException);
+ } catch (Exception e) {
+ buildAndThrowException(execution, e.getMessage());
+ }
+ }
+
+ protected BuildingBlock buildBuildingBlock(String activityName) {
+ BuildingBlock buildingBlock = new BuildingBlock();
+ buildingBlock.setBpmnFlowName(activityName);
+ buildingBlock.setMsoId(UUID.randomUUID().toString());
+ buildingBlock.setKey("");
+ buildingBlock.setIsVirtualLink(false);
+ buildingBlock.setVirtualLinkKey("");
+ return buildingBlock;
+ }
+
+ protected ExecuteBuildingBlock buildExecuteBuildingBlock(DelegateExecution execution, String requestId,
+ BuildingBlock buildingBlock) throws Exception {
+ ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
+ String bpmnRequest = (String) execution.getVariable(G_BPMN_REQUEST);
+ ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
+ RequestDetails requestDetails = sIRequest.getRequestDetails();
+ executeBuildingBlock.setaLaCarte(true);
+ executeBuildingBlock.setRequestAction((String) execution.getVariable(G_ACTION));
+ executeBuildingBlock.setResourceId((String) execution.getVariable(VNF_ID));
+ executeBuildingBlock.setVnfType((String) execution.getVariable(VNF_TYPE));
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId((String) execution.getVariable(SERVICE_INSTANCE_ID));
+ workflowResourceIds.setVnfId((String) execution.getVariable(VNF_ID));
+ executeBuildingBlock.setWorkflowResourceIds(workflowResourceIds);
+ executeBuildingBlock.setRequestId(requestId);
+ executeBuildingBlock.setBuildingBlock(buildingBlock);
+ executeBuildingBlock.setRequestDetails(requestDetails);
+ return executeBuildingBlock;
+ }
+
+ protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue(), msg, ex);
+ execution.setVariable("ExecuteActivityErrorMessage", msg);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+
+ protected void buildAndThrowException(DelegateExecution execution, String msg) {
+ logger.error(msg);
+ execution.setVariable("ExecuteActuvityErrorMessage", msg);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
}
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
index 67d2864204..0ec28d901c 100644
--- 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
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.infrastructure.adapter.network.tasks;
import java.util.Map;
-
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -38,68 +37,74 @@ import org.springframework.stereotype.Component;
@Component
public class NetworkAdapterCreateTasks {
-
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private NetworkAdapterObjectMapper networkAdapterObjectMapper;
- @Autowired
- private NetworkAdapterResources networkAdapterResources;
-
- public void createNetwork(BuildingBlockExecution execution) {
- execution.setVariable("networkAdapterCreateRollback", false);
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
-
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
-
- Map<String, String> userInput = gBBInput.getUserInput();
- String cloudRegionPo = execution.getVariable("cloudRegionPo");
-
- CreateNetworkRequest createNetworkRequest = networkAdapterObjectMapper.createNetworkRequestMapper(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, userInput, cloudRegionPo, gBBInput.getCustomer());
-
- execution.setVariable("networkAdapterRequest", createNetworkRequest);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void processResponseFromOpenstack(BuildingBlockExecution execution) {
- try {
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
-
- CreateNetworkResponse createNetworkResponse = execution.getVariable("createNetworkResponse");
- if(createNetworkResponse != null) {
- l3Network.setHeatStackId(createNetworkResponse.getNetworkStackId());
- if (createNetworkResponse.getNetworkCreated()){
- //setting rollback TRUE only if network was actually created (not a silent success OP)
- execution.setVariable("networkAdapterCreateRollback", true);
- }
- } else {
- throw new Exception("No response was sent back from NetworkAdapterRestV1 subflow.");
- }
- } 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);
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- CreateNetworkResponse createNetworkResponse = execution.getVariable("createNetworkResponse");
-
- Map<String, String> 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);
- }
- }
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private NetworkAdapterObjectMapper networkAdapterObjectMapper;
+ @Autowired
+ private NetworkAdapterResources networkAdapterResources;
+
+ public void createNetwork(BuildingBlockExecution execution) {
+ execution.setVariable("networkAdapterCreateRollback", false);
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+
+ Map<String, String> userInput = gBBInput.getUserInput();
+ String cloudRegionPo = execution.getVariable("cloudRegionPo");
+
+ CreateNetworkRequest createNetworkRequest = networkAdapterObjectMapper.createNetworkRequestMapper(
+ gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance,
+ l3Network, userInput, cloudRegionPo, gBBInput.getCustomer());
+
+ execution.setVariable("networkAdapterRequest", createNetworkRequest);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void processResponseFromOpenstack(BuildingBlockExecution execution) {
+ try {
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+
+ CreateNetworkResponse createNetworkResponse = execution.getVariable("createNetworkResponse");
+ if (createNetworkResponse != null) {
+ l3Network.setHeatStackId(createNetworkResponse.getNetworkStackId());
+ if (createNetworkResponse.getNetworkCreated()) {
+ // setting rollback TRUE only if network was actually created (not a silent success OP)
+ execution.setVariable("networkAdapterCreateRollback", true);
+ }
+ } else {
+ throw new Exception("No response was sent back from NetworkAdapterRestV1 subflow.");
+ }
+ } 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);
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ CreateNetworkResponse createNetworkResponse = execution.getVariable("createNetworkResponse");
+
+ Map<String, String> 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
index 7e0c5f6da4..7a7d681762 100644
--- 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
@@ -34,26 +34,28 @@ import org.springframework.stereotype.Component;
@Component
public class NetworkAdapterDeleteTasks {
-
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private NetworkAdapterObjectMapper networkAdapterObjectMapper;
- @Autowired
- private ExceptionBuilder exceptionUtil;
-
- public void deleteNetwork(BuildingBlockExecution execution) {
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
-
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
-
- DeleteNetworkRequest deleteNetworkRequest = networkAdapterObjectMapper.deleteNetworkRequestMapper(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, l3Network);
-
- execution.setVariable("networkAdapterRequest", deleteNetworkRequest);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private NetworkAdapterObjectMapper networkAdapterObjectMapper;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ public void deleteNetwork(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+
+ DeleteNetworkRequest deleteNetworkRequest = networkAdapterObjectMapper.deleteNetworkRequestMapper(
+ gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, l3Network);
+
+ execution.setVariable("networkAdapterRequest", deleteNetworkRequest);
+ } 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/NetworkAdapterRestV1.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
index 4861257833..859db11037 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
@@ -22,12 +22,10 @@ package org.onap.so.bpmn.infrastructure.adapter.network.tasks;
import java.io.StringReader;
import java.util.Optional;
-
import javax.ws.rs.core.Response;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.adapters.nwrest.CreateNetworkError;
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
@@ -48,111 +46,119 @@ import org.springframework.stereotype.Component;
@Component
public class NetworkAdapterRestV1 {
- private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterRestV1.class);
-
- private static final String NETWORK_REQUEST = "networkAdapterRequest";
- private static final String NETWORK_MESSAGE = "NetworkAResponse_MESSAGE";
- private static final String NETWORK_SYNC_CODE = "NETWORKREST_networkAdapterStatusCode";
- private static final String NETWORK_SYNC_RESPONSE = "NETWORKREST_networkAdapterResponse";
- private static final String NETWORK_CORRELATOR = "NetworkAResponse_CORRELATOR";
-
- @Autowired
- private ExceptionBuilder exceptionBuilder;
+ private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterRestV1.class);
+
+ private static final String NETWORK_REQUEST = "networkAdapterRequest";
+ private static final String NETWORK_MESSAGE = "NetworkAResponse_MESSAGE";
+ private static final String NETWORK_SYNC_CODE = "NETWORKREST_networkAdapterStatusCode";
+ private static final String NETWORK_SYNC_RESPONSE = "NETWORKREST_networkAdapterResponse";
+ private static final String NETWORK_CORRELATOR = "NetworkAResponse_CORRELATOR";
+
+ @Autowired
+ private ExceptionBuilder exceptionBuilder;
+
+ @Autowired
+ private NetworkAdapterResources networkAdapterResources;
+
+ public void callNetworkAdapter(DelegateExecution execution) {
+ try {
+ Object networkAdapterRequest = execution.getVariable(NETWORK_REQUEST);
+ if (networkAdapterRequest != null) {
+ Optional<Response> response = Optional.empty();
+ if (networkAdapterRequest instanceof CreateNetworkRequest) {
+ CreateNetworkRequest createNetworkRequest = (CreateNetworkRequest) networkAdapterRequest;
+ execution.setVariable(NETWORK_CORRELATOR, createNetworkRequest.getMessageId());
+ response = networkAdapterResources.createNetworkAsync(createNetworkRequest);
+ } else if (networkAdapterRequest instanceof DeleteNetworkRequest) {
+ DeleteNetworkRequest deleteNetworkRequest = (DeleteNetworkRequest) networkAdapterRequest;
+ execution.setVariable(NETWORK_CORRELATOR, deleteNetworkRequest.getMessageId());
+ response = networkAdapterResources.deleteNetworkAsync(deleteNetworkRequest);
+ } else if (networkAdapterRequest instanceof UpdateNetworkRequest) {
+ UpdateNetworkRequest updateNetworkRequest = (UpdateNetworkRequest) networkAdapterRequest;
+ execution.setVariable(NETWORK_CORRELATOR, updateNetworkRequest.getMessageId());
+ response = networkAdapterResources.updateNetworkAsync(updateNetworkRequest);
+ }
+ if (response.isPresent()) {
+ String statusCode = Integer.toString(response.get().getStatus());
+ String responseString = "";
+ if (response.get().getEntity() != null) {
+ responseString = (String) response.get().getEntity();
+ }
+ execution.setVariable(NETWORK_SYNC_CODE, statusCode);
+ execution.setVariable(NETWORK_SYNC_RESPONSE, responseString);
+ } else {
+ throw new Exception("No Ack response from Openstack Adapter");
+ }
+ } else {
+ throw new Exception("No Network Request was created. networkAdapterRequest was null.");
+ }
+ } catch (Exception ex) {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void processCallback(DelegateExecution execution) {
+ try {
+ Object networkAdapterRequest = execution.getVariable(NETWORK_REQUEST);
+ String callback = (String) execution.getVariable(NETWORK_MESSAGE);
+ String logCallbackMessage = "Callback from OpenstackAdapter: " + callback;
+ logger.debug(logCallbackMessage);
+ if (networkAdapterRequest != null) {
+ if (networkAdapterRequest instanceof CreateNetworkRequest) {
+ if (callback.contains("createNetworkError")) {
+ CreateNetworkError createNetworkError =
+ (CreateNetworkError) unmarshalXml(callback, CreateNetworkError.class);
+ throw new Exception(createNetworkError.getMessage());
+ } else {
+ CreateNetworkResponse createNetworkResponse =
+ (CreateNetworkResponse) unmarshalXml(callback, CreateNetworkResponse.class);
+ execution.setVariable("createNetworkResponse", createNetworkResponse);
+ }
+ } else if (networkAdapterRequest instanceof DeleteNetworkRequest) {
+ if (callback.contains("deleteNetworkError")) {
+ DeleteNetworkError deleteNetworkError =
+ (DeleteNetworkError) unmarshalXml(callback, DeleteNetworkError.class);
+ throw new Exception(deleteNetworkError.getMessage());
+ } else {
+ DeleteNetworkResponse deleteNetworkResponse =
+ (DeleteNetworkResponse) unmarshalXml(callback, DeleteNetworkResponse.class);
+ execution.setVariable("deleteNetworkResponse", deleteNetworkResponse);
+ }
+ } else if (networkAdapterRequest instanceof UpdateNetworkRequest) {
+ if (callback.contains("updateNetworkError")) {
+ UpdateNetworkError updateNetworkError =
+ (UpdateNetworkError) unmarshalXml(callback, UpdateNetworkError.class);
+ throw new Exception(updateNetworkError.getMessage());
+ } else {
+ UpdateNetworkResponse updateNetworkResponse =
+ (UpdateNetworkResponse) unmarshalXml(callback, UpdateNetworkResponse.class);
+ execution.setVariable("updateNetworkResponse", updateNetworkResponse);
+ }
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error in Openstack Adapter callback", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage());
+ }
+ }
+
+ protected <T> Object unmarshalXml(String xmlString, Class<T> resultClass) throws JAXBException {
+ StringReader reader = new StringReader(xmlString);
+ JAXBContext context = JAXBContext.newInstance(resultClass);
+ Unmarshaller unmarshaller = context.createUnmarshaller();
+ return unmarshaller.unmarshal(reader);
+ }
+
+ public void handleTimeOutException(DelegateExecution execution) {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
+ "Error timed out waiting on Openstack Async-Response");
+ }
- @Autowired
- private NetworkAdapterResources networkAdapterResources;
-
- public void callNetworkAdapter (DelegateExecution execution) {
- try {
- Object networkAdapterRequest = execution.getVariable(NETWORK_REQUEST);
- if (networkAdapterRequest != null) {
- Optional<Response> response = Optional.empty();
- if (networkAdapterRequest instanceof CreateNetworkRequest) {
- CreateNetworkRequest createNetworkRequest = (CreateNetworkRequest) networkAdapterRequest;
- execution.setVariable(NETWORK_CORRELATOR, createNetworkRequest.getMessageId());
- response = networkAdapterResources.createNetworkAsync(createNetworkRequest);
- } else if (networkAdapterRequest instanceof DeleteNetworkRequest) {
- DeleteNetworkRequest deleteNetworkRequest = (DeleteNetworkRequest) networkAdapterRequest;
- execution.setVariable(NETWORK_CORRELATOR, deleteNetworkRequest.getMessageId());
- response = networkAdapterResources.deleteNetworkAsync(deleteNetworkRequest);
- } else if (networkAdapterRequest instanceof UpdateNetworkRequest) {
- UpdateNetworkRequest updateNetworkRequest = (UpdateNetworkRequest) networkAdapterRequest;
- execution.setVariable(NETWORK_CORRELATOR, updateNetworkRequest.getMessageId());
- response = networkAdapterResources.updateNetworkAsync(updateNetworkRequest);
- }
- if(response.isPresent()) {
- String statusCode = Integer.toString(response.get().getStatus());
- String responseString = "";
- if(response.get().getEntity() != null) {
- responseString = (String) response.get().getEntity();
- }
- execution.setVariable(NETWORK_SYNC_CODE, statusCode);
- execution.setVariable(NETWORK_SYNC_RESPONSE, responseString);
- } else {
- throw new Exception("No Ack response from Openstack Adapter");
- }
- } else {
- throw new Exception("No Network Request was created. networkAdapterRequest was null.");
- }
- } catch (Exception ex) {
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void processCallback (DelegateExecution execution) {
- try {
- Object networkAdapterRequest = execution.getVariable(NETWORK_REQUEST);
- String callback = (String) execution.getVariable(NETWORK_MESSAGE);
- String logCallbackMessage = "Callback from OpenstackAdapter: " + callback;
- logger.debug(logCallbackMessage);
- if (networkAdapterRequest != null) {
- if (networkAdapterRequest instanceof CreateNetworkRequest) {
- if(callback.contains("createNetworkError")) {
- CreateNetworkError createNetworkError = (CreateNetworkError) unmarshalXml(callback, CreateNetworkError.class);
- throw new Exception(createNetworkError.getMessage());
- } else {
- CreateNetworkResponse createNetworkResponse = (CreateNetworkResponse) unmarshalXml(callback, CreateNetworkResponse.class);
- execution.setVariable("createNetworkResponse", createNetworkResponse);
- }
- } else if (networkAdapterRequest instanceof DeleteNetworkRequest) {
- if(callback.contains("deleteNetworkError")) {
- DeleteNetworkError deleteNetworkError = (DeleteNetworkError) unmarshalXml(callback, DeleteNetworkError.class);
- throw new Exception(deleteNetworkError.getMessage());
- } else {
- DeleteNetworkResponse deleteNetworkResponse = (DeleteNetworkResponse) unmarshalXml(callback, DeleteNetworkResponse.class);
- execution.setVariable("deleteNetworkResponse", deleteNetworkResponse);
- }
- } else if (networkAdapterRequest instanceof UpdateNetworkRequest) {
- if (callback.contains("updateNetworkError")) {
- UpdateNetworkError updateNetworkError = (UpdateNetworkError) unmarshalXml(callback, UpdateNetworkError.class);
- throw new Exception(updateNetworkError.getMessage());
- } else {
- UpdateNetworkResponse updateNetworkResponse = (UpdateNetworkResponse) unmarshalXml(callback, UpdateNetworkResponse.class);
- execution.setVariable("updateNetworkResponse", updateNetworkResponse);
- }
- }
- }
- } catch (Exception e) {
- logger.error("Error in Openstack Adapter callback", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage());
- }
- }
-
- protected <T> Object unmarshalXml(String xmlString, Class<T> resultClass) throws JAXBException {
- StringReader reader = new StringReader(xmlString);
- JAXBContext context = JAXBContext.newInstance(resultClass);
- Unmarshaller unmarshaller = context.createUnmarshaller();
- return unmarshaller.unmarshal(reader);
- }
-
- public void handleTimeOutException (DelegateExecution execution) {
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error timed out waiting on Openstack Async-Response");
- }
-
- public void handleSyncError (DelegateExecution execution) {
- String statusCode = (String) execution.getVariable(NETWORK_SYNC_CODE);
- String responseString = (String) execution.getVariable(NETWORK_SYNC_RESPONSE);
- String errorMessage = "Error with Openstack Adapter Sync Request: StatusCode = " + statusCode + " Response = " + responseString;
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage);
- }
+ public void handleSyncError(DelegateExecution execution) {
+ String statusCode = (String) execution.getVariable(NETWORK_SYNC_CODE);
+ String responseString = (String) execution.getVariable(NETWORK_SYNC_RESPONSE);
+ String errorMessage = "Error with Openstack Adapter Sync Request: StatusCode = " + statusCode + " Response = "
+ + responseString;
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage);
+ }
}
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
index 9eeba0445b..77898dd5cc 100644
--- 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
@@ -40,37 +40,40 @@ import org.springframework.stereotype.Component;
@Component
public class NetworkAdapterUpdateTasks {
- private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterUpdateTasks.class);
-
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private NetworkAdapterObjectMapper networkAdapterObjectMapper;
- @Autowired
- private ExceptionBuilder exceptionUtil;
-
- public void updateNetwork(BuildingBlockExecution execution) {
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
-
- UpdateNetworkRequest updateNetworkRequest = networkAdapterObjectMapper.createNetworkUpdateRequestMapper(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, gBBInput.getUserInput(), gBBInput.getCustomer());
- execution.setVariable("networkAdapterRequest", updateNetworkRequest);
-
- } catch(Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void processResponseFromOpenstack(BuildingBlockExecution execution) {
- try {
- UpdateNetworkResponse updateNetworkResponse = execution.getVariable("updateNetworkResponse");
- if(updateNetworkResponse == null) {
- throw new Exception("No response was sent back from NetworkAdapterRestV1 subflow.");
- }
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterUpdateTasks.class);
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private NetworkAdapterObjectMapper networkAdapterObjectMapper;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ public void updateNetwork(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+
+ UpdateNetworkRequest updateNetworkRequest = networkAdapterObjectMapper.createNetworkUpdateRequestMapper(
+ gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance,
+ l3Network, gBBInput.getUserInput(), gBBInput.getCustomer());
+ execution.setVariable("networkAdapterRequest", updateNetworkRequest);
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void processResponseFromOpenstack(BuildingBlockExecution execution) {
+ try {
+ UpdateNetworkResponse updateNetworkResponse = execution.getVariable("updateNetworkResponse");
+ if (updateNetworkResponse == null) {
+ throw new Exception("No response was sent back from NetworkAdapterRestV1 subflow.");
+ }
+ } 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
index ae9e6e7488..849465e787 100644
--- 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
@@ -47,72 +47,79 @@ import static org.apache.commons.lang3.StringUtils.*;
@Component
public class VnfAdapterCreateTasks {
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterCreateTasks.class);
- private static final String VNFREST_REQUEST = "VNFREST_Request";
+ private static final Logger logger = LoggerFactory.getLogger(VnfAdapterCreateTasks.class);
+ private static final String VNFREST_REQUEST = "VNFREST_Request";
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private VnfAdapterVolumeGroupResources vnfAdapterVolumeGroupResources;
- @Autowired
- private VnfAdapterVfModuleResources vnfAdapterVfModuleResources;
+ @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();
+ public void createVolumeGroupRequest(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ ServiceInstance serviceInstance =
+ gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0);
- ServiceInstance serviceInstance = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+ VfModule vfModule;
+ String sdncVfModuleQueryResponse = null;
+ try {
+ vfModule = extractPojosForBB.extractByKey(execution, 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
+ }
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- VfModule vfModule;
- String sdncVfModuleQueryResponse = null;
- try {
- vfModule = extractPojosForBB.extractByKey(execution, 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);
+ }
+ }
- 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();
- 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);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VolumeGroup volumeGroup = null;
+ try {
+ volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+ } catch (BBObjectNotFoundException bbException) {
+ }
+ 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());
- ServiceInstance serviceInstance = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- VolumeGroup volumeGroup = null;
- try {
- volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- } catch(BBObjectNotFoundException bbException) {
- }
- 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,
+ volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+ execution.setVariable(VNFREST_REQUEST, createVfModuleRequest.toXmlString());
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
- CreateVfModuleRequest createVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup, 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
index a96e2702cd..116dc30d63 100644
--- 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
@@ -42,46 +42,50 @@ import org.springframework.stereotype.Component;
@Component
public class VnfAdapterDeleteTasks {
- private static final Logger logger = LoggerFactory.getLogger(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);
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
-
- DeleteVolumeGroupRequest deleteVolumeGroupRequest = vnfAdapterVolumeGroupResources.deleteVolumeGroupRequest(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, volumeGroup);
- execution.setVariable(VNFREST_REQUEST, deleteVolumeGroupRequest.toXmlString());
- execution.setVariable("deleteVolumeGroupRequest", "true");
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(VnfAdapterDeleteTasks.class);
+ private static final String VNFREST_REQUEST = "VNFREST_Request";
- public void deleteVfModule(BuildingBlockExecution execution) {
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
-
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, 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);
- }
- }
+ @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);
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+
+ DeleteVolumeGroupRequest deleteVolumeGroupRequest = vnfAdapterVolumeGroupResources.deleteVolumeGroupRequest(
+ gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, volumeGroup);
+ execution.setVariable(VNFREST_REQUEST, deleteVolumeGroupRequest.toXmlString());
+ execution.setVariable("deleteVolumeGroupRequest", "true");
+ } 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);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, 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
index e854efd414..bfa76c5053 100644
--- 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
@@ -45,7 +45,6 @@ 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;
@@ -59,96 +58,100 @@ import java.util.Map;
@Component
public class VnfAdapterImpl {
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterImpl.class);
- private static final String CONTRAIL_SERVICE_INSTANCE_FQDN = "contrailServiceInstanceFqdn";
- private static final String OAM_MANAGEMENT_V4_ADDRESS = "oamManagementV4Address";
- private static final String OAM_MANAGEMENT_V6_ADDRESS = "oamManagementV6Address";
- private static final String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
-
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
-
- @Autowired
- private ExceptionBuilder exceptionUtil;
+ private static final Logger logger = LoggerFactory.getLogger(VnfAdapterImpl.class);
+ private static final String CONTRAIL_SERVICE_INSTANCE_FQDN = "contrailServiceInstanceFqdn";
+ private static final String OAM_MANAGEMENT_V4_ADDRESS = "oamManagementV4Address";
+ private static final String OAM_MANAGEMENT_V6_ADDRESS = "oamManagementV6Address";
+ private static final String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
+
+ @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.setVariable("mso-request-id", gBBInput.getRequestContext().getMsoRequestId());
+ execution.setVariable("mso-service-instance-id", serviceInstance.getServiceInstanceId());
+ execution.setVariable("heatStackId", null);
+ execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, null);
+ execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, null);
+ execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, null);
+ execution.setVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST, null);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
- public void preProcessVnfAdapter(BuildingBlockExecution execution) {
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- execution.setVariable("mso-request-id", gBBInput.getRequestContext().getMsoRequestId());
- execution.setVariable("mso-service-instance-id", serviceInstance.getServiceInstanceId());
- execution.setVariable("heatStackId", null);
- execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, null);
- execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, null);
- execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, null);
- execution.setVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST, null);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void postProcessVnfAdapter(BuildingBlockExecution execution) {
- try {
- String vnfAdapterResponse = execution.getVariable("vnfAdapterRestV1Response");
- if (!StringUtils.isEmpty( vnfAdapterResponse)) {
+ public void postProcessVnfAdapter(BuildingBlockExecution execution) {
+ try {
+ String vnfAdapterResponse = execution.getVariable("vnfAdapterRestV1Response");
+ if (!StringUtils.isEmpty(vnfAdapterResponse)) {
Object vnfRestResponse = unMarshal(vnfAdapterResponse);
- if(vnfRestResponse instanceof CreateVfModuleResponse) {
+ if (vnfRestResponse instanceof CreateVfModuleResponse) {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
String heatStackId = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleStackId();
- if(!StringUtils.isEmpty(heatStackId)) {
- vfModule.setHeatStackId(heatStackId);
+ if (!StringUtils.isEmpty(heatStackId)) {
+ vfModule.setHeatStackId(heatStackId);
execution.setVariable("heatStackId", heatStackId);
}
- Map<String,String> vfModuleOutputs = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleOutputs();
+ Map<String, String> vfModuleOutputs =
+ ((CreateVfModuleResponse) vnfRestResponse).getVfModuleOutputs();
if (vfModuleOutputs != null) {
- processVfModuleOutputs(execution, vfModuleOutputs);
+ processVfModuleOutputs(execution, vfModuleOutputs);
}
- } else if(vnfRestResponse instanceof DeleteVfModuleResponse) {
+ } else if (vnfRestResponse instanceof DeleteVfModuleResponse) {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
Boolean vfModuleDelete = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleDeleted();
- if(null!= vfModuleDelete && vfModuleDelete) {
+ if (null != vfModuleDelete && vfModuleDelete) {
vfModule.setHeatStackId(null);
execution.setVariable("heatStackId", null);
- Map<String,String> vfModuleOutputs = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleOutputs();
+ Map<String, String> vfModuleOutputs =
+ ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleOutputs();
if (vfModuleOutputs != null) {
- processVfModuleOutputs(execution, vfModuleOutputs);
- if (execution.getVariable(OAM_MANAGEMENT_V4_ADDRESS) != null) {
- genericVnf.setIpv4OamAddress("");
- execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, "");
- }
- if (execution.getVariable(OAM_MANAGEMENT_V6_ADDRESS) != null) {
- genericVnf.setManagementV6Address("");
- execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, "");
- }
- if (execution.getVariable(CONTRAIL_SERVICE_INSTANCE_FQDN) != null) {
- vfModule.setContrailServiceInstanceFqdn("");
- execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, "");
- }
+ processVfModuleOutputs(execution, vfModuleOutputs);
+ if (execution.getVariable(OAM_MANAGEMENT_V4_ADDRESS) != null) {
+ genericVnf.setIpv4OamAddress("");
+ execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, "");
+ }
+ if (execution.getVariable(OAM_MANAGEMENT_V6_ADDRESS) != null) {
+ genericVnf.setManagementV6Address("");
+ execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, "");
+ }
+ if (execution.getVariable(CONTRAIL_SERVICE_INSTANCE_FQDN) != null) {
+ vfModule.setContrailServiceInstanceFqdn("");
+ execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, "");
+ }
}
}
- } else if(vnfRestResponse instanceof CreateVolumeGroupResponse) {
+ } else if (vnfRestResponse instanceof CreateVolumeGroupResponse) {
VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
String heatStackId = ((CreateVolumeGroupResponse) vnfRestResponse).getVolumeGroupStackId();
- if(!StringUtils.isEmpty(heatStackId)) {
+ if (!StringUtils.isEmpty(heatStackId)) {
volumeGroup.setHeatStackId(heatStackId);
execution.setVariable("heatStackId", heatStackId);
- }else{
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "HeatStackId is missing from create VolumeGroup Vnf Adapter response.");
- }
- } else if(vnfRestResponse instanceof DeleteVolumeGroupResponse) {
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- Boolean volumeGroupDelete = ((DeleteVolumeGroupResponse) vnfRestResponse).getVolumeGroupDeleted();
- if(null!= volumeGroupDelete && volumeGroupDelete) {
- volumeGroup.setHeatStackId(null);
- execution.setVariable("heatStackId", null);
- }
+ } else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
+ "HeatStackId is missing from create VolumeGroup Vnf Adapter response.");
+ }
+ } else if (vnfRestResponse instanceof DeleteVolumeGroupResponse) {
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+ Boolean volumeGroupDelete = ((DeleteVolumeGroupResponse) vnfRestResponse).getVolumeGroupDeleted();
+ if (null != volumeGroupDelete && volumeGroupDelete) {
+ volumeGroup.setHeatStackId(null);
+ execution.setVariable("heatStackId", null);
+ }
}
}
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
private Object unMarshal(String input) throws MarshallerException {
try {
@@ -160,61 +163,60 @@ public class VnfAdapterImpl {
XMLReader xmlReader = spf.newSAXParser().getXMLReader();
JAXBContext jaxbContext = JAXBContext.newInstance(CreateVfModuleResponse.class,
- CreateVolumeGroupResponse.class,DeleteVfModuleResponse.class,DeleteVolumeGroupResponse.class);
+ CreateVolumeGroupResponse.class, DeleteVfModuleResponse.class, DeleteVolumeGroupResponse.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) {
- logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), ErrorCode.SchemaError.getValue(),
- e.getMessage(), e);
- throw new MarshallerException("Error parsing VNF Adapter response. " + e.getMessage(), ErrorCode.SchemaError.getValue(), e);
+ logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), ErrorCode.SchemaError.getValue(),
+ e.getMessage(), e);
+ throw new MarshallerException("Error parsing VNF Adapter response. " + e.getMessage(),
+ ErrorCode.SchemaError.getValue(), e);
}
}
-
- private void processVfModuleOutputs(BuildingBlockExecution execution, Map<String,String> vfModuleOutputs) {
- if (vfModuleOutputs == null) {
- return;
- }
- try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- List<String> contrailNetworkPolicyFqdnList = new ArrayList<String>();
- Iterator<String> keys = vfModuleOutputs.keySet().iterator();
- while (keys.hasNext()) {
- String key = keys.next();
- if (key.equals("contrail-service-instance-fqdn")) {
- String contrailServiceInstanceFqdn = vfModuleOutputs.get(key);
- logger.debug("Obtained contrailServiceInstanceFqdn: {}", contrailServiceInstanceFqdn);
- vfModule.setContrailServiceInstanceFqdn(contrailServiceInstanceFqdn);
- execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, contrailServiceInstanceFqdn);
- }
- else if (key.endsWith("contrail_network_policy_fqdn")) {
- String contrailNetworkPolicyFqdn = vfModuleOutputs.get(key);
- logger.debug("Obtained contrailNetworkPolicyFqdn: {}", contrailNetworkPolicyFqdn);
- contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn);
- }
- else if (key.equals("oam_management_v4_address")) {
- String oamManagementV4Address = vfModuleOutputs.get(key);
- logger.debug("Obtained oamManagementV4Address: {}", oamManagementV4Address);
- genericVnf.setIpv4OamAddress(oamManagementV4Address);
- execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, oamManagementV4Address);
- }
- else if (key.equals("oam_management_v6_address")) {
- String oamManagementV6Address = vfModuleOutputs.get(key);
- logger.debug("Obtained oamManagementV6Address: {}", oamManagementV6Address);
- genericVnf.setManagementV6Address(oamManagementV6Address);
- execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, oamManagementV6Address);
- }
-
- if (!contrailNetworkPolicyFqdnList.isEmpty()) {
- execution.setVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST, String.join(",", contrailNetworkPolicyFqdnList));
- }
- }
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
-
+
+ private void processVfModuleOutputs(BuildingBlockExecution execution, Map<String, String> vfModuleOutputs) {
+ if (vfModuleOutputs == null) {
+ return;
+ }
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ List<String> contrailNetworkPolicyFqdnList = new ArrayList<String>();
+ Iterator<String> keys = vfModuleOutputs.keySet().iterator();
+ while (keys.hasNext()) {
+ String key = keys.next();
+ if (key.equals("contrail-service-instance-fqdn")) {
+ String contrailServiceInstanceFqdn = vfModuleOutputs.get(key);
+ logger.debug("Obtained contrailServiceInstanceFqdn: {}", contrailServiceInstanceFqdn);
+ vfModule.setContrailServiceInstanceFqdn(contrailServiceInstanceFqdn);
+ execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, contrailServiceInstanceFqdn);
+ } else if (key.endsWith("contrail_network_policy_fqdn")) {
+ String contrailNetworkPolicyFqdn = vfModuleOutputs.get(key);
+ logger.debug("Obtained contrailNetworkPolicyFqdn: {}", contrailNetworkPolicyFqdn);
+ contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn);
+ } else if (key.equals("oam_management_v4_address")) {
+ String oamManagementV4Address = vfModuleOutputs.get(key);
+ logger.debug("Obtained oamManagementV4Address: {}", oamManagementV4Address);
+ genericVnf.setIpv4OamAddress(oamManagementV4Address);
+ execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, oamManagementV4Address);
+ } else if (key.equals("oam_management_v6_address")) {
+ String oamManagementV6Address = vfModuleOutputs.get(key);
+ logger.debug("Obtained oamManagementV6Address: {}", oamManagementV6Address);
+ genericVnf.setManagementV6Address(oamManagementV6Address);
+ execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, oamManagementV6Address);
+ }
+
+ if (!contrailNetworkPolicyFqdnList.isEmpty()) {
+ execution.setVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST,
+ String.join(",", contrailNetworkPolicyFqdnList));
+ }
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
index 976b1bc8df..01519fab6e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
@@ -30,34 +30,34 @@ import org.onap.vnfmadapter.v1.model.OperationStatusRetrievalStatusEnum;
*/
public class Constants {
- public static final String CREATE_VNF_REQUEST_PARAM_NAME = "createVnfRequest";
- public static final String CREATE_VNF_RESPONSE_PARAM_NAME = "createVnfResponse";
- public static final String INPUT_PARAMETER = "inputParameter";
- public static final String DELETE_VNF_RESPONSE_PARAM_NAME = "deleteVnfResponse";
- public static final String DELETE_VNF_NODE_STATUS = "deleteVnfNodeStatus";
- public static final String CREATE_VNF_NODE_STATUS = "createVnfNodeStatus";
- public static final String VNF_ASSIGNED = "Assigned";
- public static final String VNF_CREATED = "Created";
+ public static final String CREATE_VNF_REQUEST_PARAM_NAME = "createVnfRequest";
+ public static final String CREATE_VNF_RESPONSE_PARAM_NAME = "createVnfResponse";
+ public static final String INPUT_PARAMETER = "inputParameter";
+ public static final String DELETE_VNF_RESPONSE_PARAM_NAME = "deleteVnfResponse";
+ public static final String DELETE_VNF_NODE_STATUS = "deleteVnfNodeStatus";
+ public static final String CREATE_VNF_NODE_STATUS = "createVnfNodeStatus";
+ public static final String VNF_ASSIGNED = "Assigned";
+ public static final String VNF_CREATED = "Created";
- public static final String DOT = ".";
- public static final String UNDERSCORE = "_";
- public static final String SPACE = "\\s+";
+ public static final String DOT = ".";
+ public static final String UNDERSCORE = "_";
+ public static final String SPACE = "\\s+";
- public static final String VNFM_ADAPTER_DEFAULT_URL = "http://so-vnfm-adapter.onap:9092/so/vnfm-adapter/v1/";
- public static final String VNFM_ADAPTER_DEFAULT_AUTH = "Basic dm5mbTpwYXNzd29yZDEk";
+ public static final String VNFM_ADAPTER_DEFAULT_URL = "http://so-vnfm-adapter.onap:9092/so/vnfm-adapter/v1/";
+ public static final String VNFM_ADAPTER_DEFAULT_AUTH = "Basic dm5mbTpwYXNzd29yZDEk";
- public static final String FORWARD_SLASH = "/";
- public static final String PRELOAD_VNFS_URL = "/restconf/config/VNF-API:preload-vnfs/vnf-preload-list/";
+ public static final String FORWARD_SLASH = "/";
+ public static final String PRELOAD_VNFS_URL = "/restconf/config/VNF-API:preload-vnfs/vnf-preload-list/";
- public static final Set<OperationStateEnum> OPERATION_FINISHED_STATES =
- newHashSet(OperationStateEnum.COMPLETED, OperationStateEnum.FAILED, OperationStateEnum.ROLLED_BACK);
+ public static final Set<OperationStateEnum> OPERATION_FINISHED_STATES =
+ newHashSet(OperationStateEnum.COMPLETED, OperationStateEnum.FAILED, OperationStateEnum.ROLLED_BACK);
- public static final Set<OperationStatusRetrievalStatusEnum> OPERATION_RETRIEVAL_STATES = newHashSet(
- OperationStatusRetrievalStatusEnum.STATUS_FOUND, OperationStatusRetrievalStatusEnum.WAITING_FOR_STATUS);
+ public static final Set<OperationStatusRetrievalStatusEnum> OPERATION_RETRIEVAL_STATES = newHashSet(
+ OperationStatusRetrievalStatusEnum.STATUS_FOUND, OperationStatusRetrievalStatusEnum.WAITING_FOR_STATUS);
- public static final String OPERATION_STATUS_PARAM_NAME = "operationStatus";
+ public static final String OPERATION_STATUS_PARAM_NAME = "operationStatus";
- private Constants() {}
+ private Constants() {}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/EtsiVnfDeleteTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/EtsiVnfDeleteTask.java
index 857c5cb6fe..f29f842709 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/EtsiVnfDeleteTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/EtsiVnfDeleteTask.java
@@ -39,46 +39,46 @@ import com.google.common.base.Optional;
@Component
public class EtsiVnfDeleteTask {
- private static final Logger LOGGER = LoggerFactory.getLogger(EtsiVnfDeleteTask.class);
- private final ExtractPojosForBB extractPojosForBB;
- private final ExceptionBuilder exceptionUtil;
- private final VnfmAdapterServiceProvider vnfmAdapterServiceProvider;
+ private static final Logger LOGGER = LoggerFactory.getLogger(EtsiVnfDeleteTask.class);
+ private final ExtractPojosForBB extractPojosForBB;
+ private final ExceptionBuilder exceptionUtil;
+ private final VnfmAdapterServiceProvider vnfmAdapterServiceProvider;
- @Autowired
- public EtsiVnfDeleteTask(final ExceptionBuilder exceptionUtil, final ExtractPojosForBB extractPojosForBB,
- final VnfmAdapterServiceProvider vnfmAdapterServiceProvider) {
- this.exceptionUtil = exceptionUtil;
- this.extractPojosForBB = extractPojosForBB;
- this.vnfmAdapterServiceProvider = vnfmAdapterServiceProvider;
- }
+ @Autowired
+ public EtsiVnfDeleteTask(final ExceptionBuilder exceptionUtil, final ExtractPojosForBB extractPojosForBB,
+ final VnfmAdapterServiceProvider vnfmAdapterServiceProvider) {
+ this.exceptionUtil = exceptionUtil;
+ this.extractPojosForBB = extractPojosForBB;
+ this.vnfmAdapterServiceProvider = vnfmAdapterServiceProvider;
+ }
- /**
- * Invoke VNFM adapter to delete the VNF
- *
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- */
- public void invokeVnfmAdapter(final BuildingBlockExecution execution) {
- try {
- LOGGER.debug("Executing invokeVnfmAdapter ...");
- final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
+ /**
+ * Invoke VNFM adapter to delete the VNF
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void invokeVnfmAdapter(final BuildingBlockExecution execution) {
+ try {
+ LOGGER.debug("Executing invokeVnfmAdapter ...");
+ final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
- final Optional<DeleteVnfResponse> response = vnfmAdapterServiceProvider.invokeDeleteRequest(vnf.getVnfId());
+ final Optional<DeleteVnfResponse> response = vnfmAdapterServiceProvider.invokeDeleteRequest(vnf.getVnfId());
- if (!response.isPresent()) {
- final String errorMessage = "Unexpected error while processing delete request";
- LOGGER.error(errorMessage);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1211, errorMessage);
- }
+ if (!response.isPresent()) {
+ final String errorMessage = "Unexpected error while processing delete request";
+ LOGGER.error(errorMessage);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1211, errorMessage);
+ }
- final DeleteVnfResponse vnfResponse = response.get();
+ final DeleteVnfResponse vnfResponse = response.get();
- LOGGER.debug("Vnf delete response: {}", vnfResponse);
- execution.setVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME, vnfResponse);
+ LOGGER.debug("Vnf delete response: {}", vnfResponse);
+ execution.setVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME, vnfResponse);
- LOGGER.debug("Finished executing invokeVnfmAdapter ...");
- } catch (final Exception exception) {
- LOGGER.error("Unable to invoke delete request", exception);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1212, exception);
+ LOGGER.debug("Finished executing invokeVnfmAdapter ...");
+ } catch (final Exception exception) {
+ LOGGER.error("Unable to invoke delete request", exception);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1212, exception);
+ }
}
- }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java
index ebb9d521c3..661fdb258b 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java
@@ -21,7 +21,6 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.INPUT_PARAMETER;
import static org.onap.so.bpmn.servicedecomposition.entities.ResourceKey.GENERIC_VNF_ID;
-
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter;
import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParametersProvider;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
index 9e0c26ba20..4645680fc2 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
@@ -39,64 +39,65 @@ import com.google.common.base.Optional;
*
*/
@Component
-public class MonitorVnfmCreateJobTask extends MonitorVnfmJobTask{
+public class MonitorVnfmCreateJobTask extends MonitorVnfmJobTask {
- private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmCreateJobTask.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmCreateJobTask.class);
- @Autowired
- public MonitorVnfmCreateJobTask(final VnfmAdapterServiceProvider vnfmAdapterServiceProvider,
- final ExceptionBuilder exceptionUtil) {
- super(vnfmAdapterServiceProvider, exceptionUtil);
- }
-
- /**
- * Get the current operation status of instantiation job
- *
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- */
- public void getCurrentOperationStatus(final BuildingBlockExecution execution) {
- LOGGER.debug("Executing getCurrentOperationStatus ...");
- final CreateVnfResponse vnfInstantiateResponse = execution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME);
- execution.setVariable(OPERATION_STATUS_PARAM_NAME, getOperationStatus(execution, vnfInstantiateResponse.getJobId()));
- LOGGER.debug("Finished executing getCurrentOperationStatus ...");
- }
+ @Autowired
+ public MonitorVnfmCreateJobTask(final VnfmAdapterServiceProvider vnfmAdapterServiceProvider,
+ final ExceptionBuilder exceptionUtil) {
+ super(vnfmAdapterServiceProvider, exceptionUtil);
+ }
- /**
- * Log and throw exception on timeout for job status
- *
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- */
- public void timeOutLogFailue(final BuildingBlockExecution execution) {
- final String message = "Instantiation operation time out";
- LOGGER.error(message);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1205, message);
- }
+ /**
+ * Get the current operation status of instantiation job
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void getCurrentOperationStatus(final BuildingBlockExecution execution) {
+ LOGGER.debug("Executing getCurrentOperationStatus ...");
+ final CreateVnfResponse vnfInstantiateResponse = execution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME);
+ execution.setVariable(OPERATION_STATUS_PARAM_NAME,
+ getOperationStatus(execution, vnfInstantiateResponse.getJobId()));
+ LOGGER.debug("Finished executing getCurrentOperationStatus ...");
+ }
- /**
- * Check the final status of instantiation throw exception if not completed successfully
- *
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- */
- public void checkIfOperationWasSuccessful(final BuildingBlockExecution execution) {
- LOGGER.debug("Executing checkIfOperationWasSuccessful ...");
- final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
- final CreateVnfResponse vnfInstantiateResponse = execution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME);
- if (operationStatusOption == null || !operationStatusOption.isPresent()) {
- final String message = "Unable to instantiate jobId: "
- + (vnfInstantiateResponse != null ? vnfInstantiateResponse.getJobId() : "null")
- + "Unable to retrieve OperationStatus";
- LOGGER.error(message);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1206, message);
- } else if (operationStatusOption != null && operationStatusOption.isPresent()) {
- final OperationStateEnum operationStatus = operationStatusOption.get();
- if (operationStatus != OperationStateEnum.COMPLETED) {
- final String message = "Unable to instantiate jobId: "
- + (vnfInstantiateResponse != null ? vnfInstantiateResponse.getJobId() : "null") + " OperationStatus: "
- + operationStatus;
+ /**
+ * Log and throw exception on timeout for job status
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void timeOutLogFailue(final BuildingBlockExecution execution) {
+ final String message = "Instantiation operation time out";
LOGGER.error(message);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1207, message);
- }
- LOGGER.debug("Successfully completed instatiation of job {}", vnfInstantiateResponse);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1205, message);
+ }
+
+ /**
+ * Check the final status of instantiation throw exception if not completed successfully
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void checkIfOperationWasSuccessful(final BuildingBlockExecution execution) {
+ LOGGER.debug("Executing checkIfOperationWasSuccessful ...");
+ final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
+ final CreateVnfResponse vnfInstantiateResponse = execution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME);
+ if (operationStatusOption == null || !operationStatusOption.isPresent()) {
+ final String message = "Unable to instantiate jobId: "
+ + (vnfInstantiateResponse != null ? vnfInstantiateResponse.getJobId() : "null")
+ + "Unable to retrieve OperationStatus";
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1206, message);
+ } else if (operationStatusOption != null && operationStatusOption.isPresent()) {
+ final OperationStateEnum operationStatus = operationStatusOption.get();
+ if (operationStatus != OperationStateEnum.COMPLETED) {
+ final String message = "Unable to instantiate jobId: "
+ + (vnfInstantiateResponse != null ? vnfInstantiateResponse.getJobId() : "null")
+ + " OperationStatus: " + operationStatus;
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1207, message);
+ }
+ LOGGER.debug("Successfully completed instatiation of job {}", vnfInstantiateResponse);
+ }
}
- }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java
index e13d1e4dda..e91f362d53 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java
@@ -42,61 +42,62 @@ import com.google.common.base.Optional;
@Component
public class MonitorVnfmDeleteJobTask extends MonitorVnfmJobTask {
- private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmDeleteJobTask.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmDeleteJobTask.class);
- @Autowired
- public MonitorVnfmDeleteJobTask(final VnfmAdapterServiceProvider vnfmAdapterServiceProvider,
- final ExceptionBuilder exceptionUtil) {
- super(vnfmAdapterServiceProvider, exceptionUtil);
- }
-
- /**
- * Get the current operation status of Delete job
- *
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- */
- public void getCurrentOperationStatus(final BuildingBlockExecution execution) {
- LOGGER.debug("Executing getCurrentOperationStatus ...");
- final DeleteVnfResponse deleteVnfResponse = execution.getVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME);
- execution.setVariable(OPERATION_STATUS_PARAM_NAME, getOperationStatus(execution, deleteVnfResponse.getJobId()));
- LOGGER.debug("Finished executing getCurrentOperationStatus ...");
- }
+ @Autowired
+ public MonitorVnfmDeleteJobTask(final VnfmAdapterServiceProvider vnfmAdapterServiceProvider,
+ final ExceptionBuilder exceptionUtil) {
+ super(vnfmAdapterServiceProvider, exceptionUtil);
+ }
- /**
- * Log and throw exception on timeout for job status
- *
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- */
- public void timeOutLogFailue(final BuildingBlockExecution execution) {
- final String message = "Delete operation time out";
- LOGGER.error(message);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1213, message);
- }
+ /**
+ * Get the current operation status of Delete job
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void getCurrentOperationStatus(final BuildingBlockExecution execution) {
+ LOGGER.debug("Executing getCurrentOperationStatus ...");
+ final DeleteVnfResponse deleteVnfResponse = execution.getVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME);
+ execution.setVariable(OPERATION_STATUS_PARAM_NAME, getOperationStatus(execution, deleteVnfResponse.getJobId()));
+ LOGGER.debug("Finished executing getCurrentOperationStatus ...");
+ }
- /**
- * Check the final status of delete throw exception if not completed successfully
- *
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- */
- public void checkIfOperationWasSuccessful(final BuildingBlockExecution execution) {
- LOGGER.debug("Executing checkIfOperationWasSuccessful ...");
- final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
- final DeleteVnfResponse deleteVnfResponse = execution.getVariable(DELETE_VNF_RESPONSE_PARAM_NAME);
- if (operationStatusOption == null || !operationStatusOption.isPresent()) {
- final String message = "Unable to delete jobId: "
- + (deleteVnfResponse != null ? deleteVnfResponse.getJobId() : "null") + "Unable to retrieve OperationStatus";
- LOGGER.error(message);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1214, message);
- } else if (operationStatusOption != null && operationStatusOption.isPresent()) {
- final OperationStateEnum operationStatus = operationStatusOption.get();
- if (operationStatus != OperationStateEnum.COMPLETED) {
- final String message =
- "Unable to Delete jobId: " + (deleteVnfResponse != null ? deleteVnfResponse.getJobId() : "null")
- + " OperationStatus: " + operationStatus;
+ /**
+ * Log and throw exception on timeout for job status
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void timeOutLogFailue(final BuildingBlockExecution execution) {
+ final String message = "Delete operation time out";
LOGGER.error(message);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1215, message);
- }
- LOGGER.debug("Successfully completed Deletion of job {}", deleteVnfResponse);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1213, message);
+ }
+
+ /**
+ * Check the final status of delete throw exception if not completed successfully
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void checkIfOperationWasSuccessful(final BuildingBlockExecution execution) {
+ LOGGER.debug("Executing checkIfOperationWasSuccessful ...");
+ final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
+ final DeleteVnfResponse deleteVnfResponse = execution.getVariable(DELETE_VNF_RESPONSE_PARAM_NAME);
+ if (operationStatusOption == null || !operationStatusOption.isPresent()) {
+ final String message =
+ "Unable to delete jobId: " + (deleteVnfResponse != null ? deleteVnfResponse.getJobId() : "null")
+ + "Unable to retrieve OperationStatus";
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1214, message);
+ } else if (operationStatusOption != null && operationStatusOption.isPresent()) {
+ final OperationStateEnum operationStatus = operationStatusOption.get();
+ if (operationStatus != OperationStateEnum.COMPLETED) {
+ final String message =
+ "Unable to Delete jobId: " + (deleteVnfResponse != null ? deleteVnfResponse.getJobId() : "null")
+ + " OperationStatus: " + operationStatus;
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1215, message);
+ }
+ LOGGER.debug("Successfully completed Deletion of job {}", deleteVnfResponse);
+ }
}
- }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmJobTask.java
index e3992428cb..395018fb38 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmJobTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmJobTask.java
@@ -41,64 +41,65 @@ import com.google.common.base.Optional;
@Component
public class MonitorVnfmJobTask {
- private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmJobTask.class);
- protected final ExceptionBuilder exceptionUtil;
- protected final VnfmAdapterServiceProvider vnfmAdapterServiceProvider;
+ private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmJobTask.class);
+ protected final ExceptionBuilder exceptionUtil;
+ protected final VnfmAdapterServiceProvider vnfmAdapterServiceProvider;
- @Autowired
- public MonitorVnfmJobTask(final VnfmAdapterServiceProvider vnfmAdapterServiceProvider,
- final ExceptionBuilder exceptionUtil) {
- this.vnfmAdapterServiceProvider = vnfmAdapterServiceProvider;
- this.exceptionUtil = exceptionUtil;
- }
+ @Autowired
+ public MonitorVnfmJobTask(final VnfmAdapterServiceProvider vnfmAdapterServiceProvider,
+ final ExceptionBuilder exceptionUtil) {
+ this.vnfmAdapterServiceProvider = vnfmAdapterServiceProvider;
+ this.exceptionUtil = exceptionUtil;
+ }
- /**
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- * @return boolean to indicate whether job has competed or not
- */
- public boolean hasOperationFinished(final BuildingBlockExecution execution) {
- LOGGER.debug("Executing hasOperationFinished ...");
+ /**
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ * @return boolean to indicate whether job has competed or not
+ */
+ public boolean hasOperationFinished(final BuildingBlockExecution execution) {
+ LOGGER.debug("Executing hasOperationFinished ...");
- final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
- if (operationStatusOption != null && operationStatusOption.isPresent()) {
- return OPERATION_FINISHED_STATES.contains(operationStatusOption.get());
+ final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
+ if (operationStatusOption != null && operationStatusOption.isPresent()) {
+ return OPERATION_FINISHED_STATES.contains(operationStatusOption.get());
+ }
+ LOGGER.debug("OperationStatus is not present yet... ");
+ LOGGER.debug("Finished executing hasOperationFinished ...");
+ return false;
}
- LOGGER.debug("OperationStatus is not present yet... ");
- LOGGER.debug("Finished executing hasOperationFinished ...");
- return false;
- }
- /**
- * This method calls the Vnfm adapter and gets the Operation status of the job
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- * @param jobId unique job id
- * @return Operation State
- */
- protected Optional<OperationStateEnum> getOperationStatus(final BuildingBlockExecution execution,
- final String jobId) {
+ /**
+ * This method calls the Vnfm adapter and gets the Operation status of the job
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ * @param jobId unique job id
+ * @return Operation State
+ */
+ protected Optional<OperationStateEnum> getOperationStatus(final BuildingBlockExecution execution,
+ final String jobId) {
- final Optional<QueryJobResponse> instantiateOperationJobStatus =
- vnfmAdapterServiceProvider.getInstantiateOperationJobStatus(jobId);
+ final Optional<QueryJobResponse> instantiateOperationJobStatus =
+ vnfmAdapterServiceProvider.getInstantiateOperationJobStatus(jobId);
- if (instantiateOperationJobStatus.isPresent()) {
- final QueryJobResponse queryJobResponse = instantiateOperationJobStatus.get();
+ if (instantiateOperationJobStatus.isPresent()) {
+ final QueryJobResponse queryJobResponse = instantiateOperationJobStatus.get();
- if (!OPERATION_RETRIEVAL_STATES.contains(queryJobResponse.getOperationStatusRetrievalStatus())) {
- final String message =
- "Recevied invalid operation reterivel state: " + queryJobResponse.getOperationStatusRetrievalStatus();
- LOGGER.error(message);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1203, message);
- }
- if (queryJobResponse.getOperationState() != null) {
- final OperationStateEnum operationStatus = queryJobResponse.getOperationState();
- LOGGER.debug("Operation {} with {} and operation retrieval status : {}", queryJobResponse.getId(),
- operationStatus, queryJobResponse.getOperationStatusRetrievalStatus());
- return Optional.of(queryJobResponse.getOperationState());
- }
+ if (!OPERATION_RETRIEVAL_STATES.contains(queryJobResponse.getOperationStatusRetrievalStatus())) {
+ final String message = "Recevied invalid operation reterivel state: "
+ + queryJobResponse.getOperationStatusRetrievalStatus();
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1203, message);
+ }
+ if (queryJobResponse.getOperationState() != null) {
+ final OperationStateEnum operationStatus = queryJobResponse.getOperationState();
+ LOGGER.debug("Operation {} with {} and operation retrieval status : {}", queryJobResponse.getId(),
+ operationStatus, queryJobResponse.getOperationStatusRetrievalStatus());
+ return Optional.of(queryJobResponse.getOperationState());
+ }
- LOGGER.debug("Operation {} without operationStatus and operation retrieval status :{}", queryJobResponse.getId(),
- queryJobResponse.getOperationStatusRetrievalStatus());
+ LOGGER.debug("Operation {} without operationStatus and operation retrieval status :{}",
+ queryJobResponse.getId(), queryJobResponse.getOperationStatusRetrievalStatus());
+ }
+ return Optional.absent();
}
- return Optional.absent();
- }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java
index 22a5d28e52..65b05e21f5 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java
@@ -42,44 +42,44 @@ import org.springframework.stereotype.Component;
@Component
public class MonitorVnfmNodeTask {
- private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmNodeTask.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmNodeTask.class);
- private final ExtractPojosForBB extractPojosForBB;
- private final ExceptionBuilder exceptionUtil;
+ private final ExtractPojosForBB extractPojosForBB;
+ private final ExceptionBuilder exceptionUtil;
- @Autowired
- public MonitorVnfmNodeTask(final ExtractPojosForBB extractPojosForBB, final ExceptionBuilder exceptionUtil) {
- this.exceptionUtil = exceptionUtil;
- this.extractPojosForBB = extractPojosForBB;
- }
+ @Autowired
+ public MonitorVnfmNodeTask(final ExtractPojosForBB extractPojosForBB, final ExceptionBuilder exceptionUtil) {
+ this.exceptionUtil = exceptionUtil;
+ this.extractPojosForBB = extractPojosForBB;
+ }
- /**
- * Check the final status of vnf in A&AI
- *
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- */
- public void getNodeStatus(final BuildingBlockExecution execution) {
- try {
- LOGGER.debug("Executing getNodeStatus ...");
- final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
- String orchestrationStatus = vnf.getOrchestrationStatus();
- LOGGER.debug("Orchestration Status in AAI {}", orchestrationStatus);
- execution.setVariable(CREATE_VNF_NODE_STATUS, VNF_CREATED.equalsIgnoreCase(orchestrationStatus));
- execution.setVariable(DELETE_VNF_NODE_STATUS, VNF_ASSIGNED.equalsIgnoreCase(orchestrationStatus));
- } catch (final Exception exception) {
- LOGGER.error("Unable to get vnf from AAI", exception);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1220, exception);
+ /**
+ * Check the final status of vnf in A&AI
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void getNodeStatus(final BuildingBlockExecution execution) {
+ try {
+ LOGGER.debug("Executing getNodeStatus ...");
+ final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
+ String orchestrationStatus = vnf.getOrchestrationStatus();
+ LOGGER.debug("Orchestration Status in AAI {}", orchestrationStatus);
+ execution.setVariable(CREATE_VNF_NODE_STATUS, VNF_CREATED.equalsIgnoreCase(orchestrationStatus));
+ execution.setVariable(DELETE_VNF_NODE_STATUS, VNF_ASSIGNED.equalsIgnoreCase(orchestrationStatus));
+ } catch (final Exception exception) {
+ LOGGER.error("Unable to get vnf from AAI", exception);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1220, exception);
+ }
}
- }
- /**
- * Log and throw exception on timeout for job status
- *
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- */
- public void timeOutLogFailue(final BuildingBlockExecution execution) {
- final String message = "Node operation time out";
- LOGGER.error(message);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1221, message);
- }
+ /**
+ * Log and throw exception on timeout for job status
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void timeOutLogFailue(final BuildingBlockExecution execution) {
+ final String message = "Node operation time out";
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1221, message);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java
index 4e15474e46..9ff2835480 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java
@@ -27,7 +27,6 @@ import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.INPUT
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.SPACE;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.UNDERSCORE;
import static org.onap.so.bpmn.servicedecomposition.entities.ResourceKey.GENERIC_VNF_ID;
-
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter;
import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.NullInputParameter;
@@ -44,12 +43,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-
import com.google.common.base.Optional;
/**
- * This class is executed from EtsiVnfInstantiateBB building block and it sends the create request
- * to the VNFM adapter
+ * This class is executed from EtsiVnfInstantiateBB building block and it sends the create request to the VNFM adapter
*
* @author waqas.ikram@est.tech
*/
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java
index 1046b6bf26..f5bae2c82a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
-
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.onap.so.configuration.rest.HttpHeadersProvider;
import org.onap.so.rest.service.HttpRestServiceProvider;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java
index 1e785074f3..d1b270bc1e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java
@@ -34,10 +34,10 @@ import com.google.common.base.Optional;
*/
public interface VnfmAdapterServiceProvider {
- Optional<CreateVnfResponse> invokeCreateInstantiationRequest(final String vnfId, final CreateVnfRequest request);
+ Optional<CreateVnfResponse> invokeCreateInstantiationRequest(final String vnfId, final CreateVnfRequest request);
- Optional<DeleteVnfResponse> invokeDeleteRequest(final String vnfId);
+ Optional<DeleteVnfResponse> invokeDeleteRequest(final String vnfId);
- Optional<QueryJobResponse> getInstantiateOperationJobStatus(final String jobId);
+ Optional<QueryJobResponse> getInstantiateOperationJobStatus(final String jobId);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
index e8f4c08f38..f193967a32 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
@@ -41,111 +41,111 @@ import com.google.common.base.Optional;
@Service
public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvider {
- private static final Logger LOGGER = LoggerFactory.getLogger(VnfmAdapterServiceProviderImpl.class);
-
- private final VnfmAdapterUrlProvider urlProvider;
- private final HttpRestServiceProvider httpServiceProvider;
-
- @Autowired
- public VnfmAdapterServiceProviderImpl(final VnfmAdapterUrlProvider urlProvider,
- final HttpRestServiceProvider httpServiceProvider) {
- this.urlProvider = urlProvider;
- this.httpServiceProvider = httpServiceProvider;
- }
-
- @Override
- public Optional<CreateVnfResponse> invokeCreateInstantiationRequest(final String vnfId,
- final CreateVnfRequest request) {
- try {
- final String url = urlProvider.getCreateInstantiateUrl(vnfId);
-
- final ResponseEntity<CreateVnfResponse> response =
- httpServiceProvider.postHttpRequest(request, url, CreateVnfResponse.class);
-
- final HttpStatus httpStatus = response.getStatusCode();
- if (!(httpStatus.equals(HttpStatus.ACCEPTED)) && !(httpStatus.equals(HttpStatus.OK))) {
- LOGGER.error("Unable to invoke HTTP POST using URL: {}, Response Code: {}", url, httpStatus.value());
- return Optional.absent();
- }
-
- if (!response.hasBody()) {
- LOGGER.error("Received response without body: {}", response);
- return Optional.absent();
- }
-
- final CreateVnfResponse createVnfResponse = response.getBody();
-
- if (createVnfResponse.getJobId() == null || createVnfResponse.getJobId().isEmpty()) {
- LOGGER.error("Received invalid instantiation response: {}", response);
- return Optional.absent();
- }
-
- return Optional.of(createVnfResponse);
- } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) {
- LOGGER.error("Unexpected error while processing create and instantiation request", httpInvocationException);
- return Optional.absent();
+ private static final Logger LOGGER = LoggerFactory.getLogger(VnfmAdapterServiceProviderImpl.class);
+
+ private final VnfmAdapterUrlProvider urlProvider;
+ private final HttpRestServiceProvider httpServiceProvider;
+
+ @Autowired
+ public VnfmAdapterServiceProviderImpl(final VnfmAdapterUrlProvider urlProvider,
+ final HttpRestServiceProvider httpServiceProvider) {
+ this.urlProvider = urlProvider;
+ this.httpServiceProvider = httpServiceProvider;
}
- }
+ @Override
+ public Optional<CreateVnfResponse> invokeCreateInstantiationRequest(final String vnfId,
+ final CreateVnfRequest request) {
+ try {
+ final String url = urlProvider.getCreateInstantiateUrl(vnfId);
- @Override
- public Optional<DeleteVnfResponse> invokeDeleteRequest(final String vnfId) {
- try {
- final String url = urlProvider.getDeleteUrl(vnfId);
- LOGGER.debug("Will send request to vnfm adapter using url: {}", url);
+ final ResponseEntity<CreateVnfResponse> response =
+ httpServiceProvider.postHttpRequest(request, url, CreateVnfResponse.class);
- final ResponseEntity<DeleteVnfResponse> response =
- httpServiceProvider.deleteHttpRequest(url, DeleteVnfResponse.class);
+ final HttpStatus httpStatus = response.getStatusCode();
+ if (!(httpStatus.equals(HttpStatus.ACCEPTED)) && !(httpStatus.equals(HttpStatus.OK))) {
+ LOGGER.error("Unable to invoke HTTP POST using URL: {}, Response Code: {}", url, httpStatus.value());
+ return Optional.absent();
+ }
- LOGGER.debug("Response received: ", response);
+ if (!response.hasBody()) {
+ LOGGER.error("Received response without body: {}", response);
+ return Optional.absent();
+ }
- final HttpStatus httpStatus = response.getStatusCode();
+ final CreateVnfResponse createVnfResponse = response.getBody();
- if (!(httpStatus.equals(HttpStatus.ACCEPTED)) && !(httpStatus.equals(HttpStatus.OK))) {
- LOGGER.error("Unable to invoke HTTP DELETE using URL: {}, Response Code: {}", url, httpStatus.value());
- return Optional.absent();
- }
+ if (createVnfResponse.getJobId() == null || createVnfResponse.getJobId().isEmpty()) {
+ LOGGER.error("Received invalid instantiation response: {}", response);
+ return Optional.absent();
+ }
- if (!response.hasBody()) {
- LOGGER.error("Received response without body: {}", response);
- return Optional.absent();
- }
- final DeleteVnfResponse deleteVnfResponse = response.getBody();
+ return Optional.of(createVnfResponse);
+ } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) {
+ LOGGER.error("Unexpected error while processing create and instantiation request", httpInvocationException);
+ return Optional.absent();
+ }
- if (deleteVnfResponse.getJobId() == null || deleteVnfResponse.getJobId().isEmpty()) {
- LOGGER.error("Received invalid delete response: {}", response);
- return Optional.absent();
- }
- return Optional.of(deleteVnfResponse);
- } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) {
- LOGGER.error("Unexpected error while processing delete request", httpInvocationException);
- return Optional.absent();
}
- }
-
- @Override
- public Optional<QueryJobResponse> getInstantiateOperationJobStatus(final String jobId) {
- try {
- final String url = urlProvider.getJobStatusUrl(jobId);
-
- final ResponseEntity<QueryJobResponse> response =
- httpServiceProvider.getHttpResponse(url, QueryJobResponse.class);
-
- final HttpStatus httpStatus = response.getStatusCode();
-
- if (!(httpStatus.equals(HttpStatus.ACCEPTED)) && !(httpStatus.equals(HttpStatus.OK))) {
- LOGGER.error("Unable to invoke HTTP GET using URL: {}, Response Code: ", url, httpStatus.value());
- return Optional.absent();
- }
-
- if (!response.hasBody()) {
- LOGGER.error("Received response without body: {}", response);
- return Optional.absent();
- }
- return Optional.of(response.getBody());
- } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) {
- LOGGER.error("Unexpected error while processing job request", httpInvocationException);
- return Optional.absent();
+
+ @Override
+ public Optional<DeleteVnfResponse> invokeDeleteRequest(final String vnfId) {
+ try {
+ final String url = urlProvider.getDeleteUrl(vnfId);
+ LOGGER.debug("Will send request to vnfm adapter using url: {}", url);
+
+ final ResponseEntity<DeleteVnfResponse> response =
+ httpServiceProvider.deleteHttpRequest(url, DeleteVnfResponse.class);
+
+ LOGGER.debug("Response received: ", response);
+
+ final HttpStatus httpStatus = response.getStatusCode();
+
+ if (!(httpStatus.equals(HttpStatus.ACCEPTED)) && !(httpStatus.equals(HttpStatus.OK))) {
+ LOGGER.error("Unable to invoke HTTP DELETE using URL: {}, Response Code: {}", url, httpStatus.value());
+ return Optional.absent();
+ }
+
+ if (!response.hasBody()) {
+ LOGGER.error("Received response without body: {}", response);
+ return Optional.absent();
+ }
+ final DeleteVnfResponse deleteVnfResponse = response.getBody();
+
+ if (deleteVnfResponse.getJobId() == null || deleteVnfResponse.getJobId().isEmpty()) {
+ LOGGER.error("Received invalid delete response: {}", response);
+ return Optional.absent();
+ }
+ return Optional.of(deleteVnfResponse);
+ } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) {
+ LOGGER.error("Unexpected error while processing delete request", httpInvocationException);
+ return Optional.absent();
+ }
+ }
+
+ @Override
+ public Optional<QueryJobResponse> getInstantiateOperationJobStatus(final String jobId) {
+ try {
+ final String url = urlProvider.getJobStatusUrl(jobId);
+
+ final ResponseEntity<QueryJobResponse> response =
+ httpServiceProvider.getHttpResponse(url, QueryJobResponse.class);
+
+ final HttpStatus httpStatus = response.getStatusCode();
+
+ if (!(httpStatus.equals(HttpStatus.ACCEPTED)) && !(httpStatus.equals(HttpStatus.OK))) {
+ LOGGER.error("Unable to invoke HTTP GET using URL: {}, Response Code: ", url, httpStatus.value());
+ return Optional.absent();
+ }
+
+ if (!response.hasBody()) {
+ LOGGER.error("Received response without body: {}", response);
+ return Optional.absent();
+ }
+ return Optional.of(response.getBody());
+ } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) {
+ LOGGER.error("Unexpected error while processing job request", httpInvocationException);
+ return Optional.absent();
+ }
}
- }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java
index 97a7197373..cacba5c5fd 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java
@@ -35,34 +35,32 @@ import org.springframework.web.util.UriComponentsBuilder;
@Service
public class VnfmAdapterUrlProvider {
- private final URI baseUri;
+ private final URI baseUri;
- @Autowired
- public VnfmAdapterUrlProvider(final VnfmBasicHttpConfigProvider etsiVnfmAdapter) {
- this.baseUri = UriComponentsBuilder.fromHttpUrl(etsiVnfmAdapter.getUrl()).build().toUri();
- }
+ @Autowired
+ public VnfmAdapterUrlProvider(final VnfmBasicHttpConfigProvider etsiVnfmAdapter) {
+ this.baseUri = UriComponentsBuilder.fromHttpUrl(etsiVnfmAdapter.getUrl()).build().toUri();
+ }
- /**
- * Get VNFM create and instantiate URL
- *
- * @param vnfId The identifier of the VNF. This must be the vnf-id of an existing generic-vnf in
- * AAI.
- * @return VNFM create and instantiate URL
- */
- public String getCreateInstantiateUrl(final String vnfId) {
- return UriComponentsBuilder.fromUri(baseUri).pathSegment("vnfs").pathSegment(vnfId).build().toString();
- }
+ /**
+ * Get VNFM create and instantiate URL
+ *
+ * @param vnfId The identifier of the VNF. This must be the vnf-id of an existing generic-vnf in AAI.
+ * @return VNFM create and instantiate URL
+ */
+ public String getCreateInstantiateUrl(final String vnfId) {
+ return UriComponentsBuilder.fromUri(baseUri).pathSegment("vnfs").pathSegment(vnfId).build().toString();
+ }
- /**
- * Get VNFM delete URL
- *
- * @param vnfId The identifier of the VNF. This must be the vnf-id of an existing generic-vnf in
- * AAI.
- * @return VNFM delete URL
- */
- public String getDeleteUrl(final String vnfId) {
- return UriComponentsBuilder.fromUri(baseUri).pathSegment("vnfs").pathSegment(vnfId).build().toString();
- }
+ /**
+ * Get VNFM delete URL
+ *
+ * @param vnfId The identifier of the VNF. This must be the vnf-id of an existing generic-vnf in AAI.
+ * @return VNFM delete URL
+ */
+ public String getDeleteUrl(final String vnfId) {
+ return UriComponentsBuilder.fromUri(baseUri).pathSegment("vnfs").pathSegment(vnfId).build().toString();
+ }
/**
* Get job status URL
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmBasicHttpConfigProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmBasicHttpConfigProvider.java
index c9b1ad1ce1..8bb5302ce9 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmBasicHttpConfigProvider.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmBasicHttpConfigProvider.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNFM_ADAPTER_DEFAULT_AUTH;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNFM_ADAPTER_DEFAULT_URL;
-
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java
index 5ade3240a0..d01d494c58 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java
@@ -24,7 +24,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import org.onap.vnfmadapter.v1.model.ExternalVirtualLink;
/**
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImpl.java
index 6027e78d8b..bf4f16b355 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImpl.java
@@ -21,14 +21,12 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.FORWARD_SLASH;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.PRELOAD_VNFS_URL;
-
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
-
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
import org.onap.so.client.sdnc.SDNCClient;
@@ -37,12 +35,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jayway.jsonpath.JsonPath;
-
import net.minidev.json.JSONArray;
/**
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java
index 11e93e733d..0d45dad6fe 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java
@@ -20,7 +20,6 @@
package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils;
import java.util.Objects;
-
import com.fasterxml.jackson.annotation.JsonProperty;
/**
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
index 75c66345a0..ef882b4694 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
@@ -46,139 +46,138 @@ import org.springframework.stereotype.Component;
@Component
public class AppcRunTasks {
- private static final Logger logger = LoggerFactory.getLogger(AppcRunTasks.class);
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private CatalogDbClient catalogDbClient;
- @Autowired
- private ApplicationControllerAction appCClient;
-
- public void preProcessActivity(BuildingBlockExecution execution) {
- 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);
- execution.setVariable("actionStop", Action.Stop);
- execution.setVariable("actionStart", Action.Start);
- execution.setVariable("actionHealthCheck", Action.HealthCheck);
- execution.setVariable("actionDistributeTraffic", Action.DistributeTraffic);
- execution.setVariable("actionDistributeTrafficCheck", Action.DistributeTrafficCheck);
- execution.setVariable("rollbackVnfStop", false);
- execution.setVariable("rollbackVnfLock", false);
- execution.setVariable("rollbackQuiesceTraffic", false);
- }
-
- public void runAppcCommand(BuildingBlockExecution execution, Action action) {
- logger.trace("Start runAppcCommand ");
- String appcCode = "1002";
- String appcMessage = "";
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- GenericVnf vnf = null;
- try {
- vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- } catch (BBObjectNotFoundException e) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "No valid VNF exists");
- }
- String vnfId = null;
- String vnfName = null;
- String vnfType = null;
- String vnfHostIpAddress = null;
+ private static final Logger logger = LoggerFactory.getLogger(AppcRunTasks.class);
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+ @Autowired
+ private ApplicationControllerAction appCClient;
- if (vnf != null) {
- vnfId = vnf.getVnfId();
- vnfName = vnf.getVnfName();
- vnfType = vnf.getVnfType();
- vnfHostIpAddress = vnf.getIpv4OamAddress();
+ public void preProcessActivity(BuildingBlockExecution execution) {
+ 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);
+ execution.setVariable("actionStop", Action.Stop);
+ execution.setVariable("actionStart", Action.Start);
+ execution.setVariable("actionHealthCheck", Action.HealthCheck);
+ execution.setVariable("actionDistributeTraffic", Action.DistributeTraffic);
+ execution.setVariable("actionDistributeTrafficCheck", Action.DistributeTrafficCheck);
+ execution.setVariable("rollbackVnfStop", false);
+ execution.setVariable("rollbackVnfLock", false);
+ execution.setVariable("rollbackQuiesceTraffic", false);
+ }
+
+ public void runAppcCommand(BuildingBlockExecution execution, Action action) {
+ logger.trace("Start runAppcCommand ");
+ String appcCode = "1002";
+ String appcMessage = "";
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ GenericVnf vnf = null;
+ try {
+ vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ } catch (BBObjectNotFoundException e) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "No valid VNF exists");
+ }
+ String vnfId = null;
+ String vnfName = null;
+ String vnfType = null;
+ String vnfHostIpAddress = null;
+
+ if (vnf != null) {
+ vnfId = vnf.getVnfId();
+ vnfName = vnf.getVnfName();
+ vnfType = vnf.getVnfType();
+ vnfHostIpAddress = vnf.getIpv4OamAddress();
+ }
+ String msoRequestId = gBBInput.getRequestContext().getMsoRequestId();
+
+ String aicIdentity = execution.getVariable("aicIdentity");
+ String vmIdList = execution.getVariable("vmIdList");
+ String vserverIdList = execution.getVariable("vserverIdList");
+ String identityUrl = execution.getVariable("identityUrl");
+
+ ControllerSelectionReference controllerSelectionReference = catalogDbClient
+ .getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, action.toString());
+ String controllerType = controllerSelectionReference.getControllerName();
+
+ String vfModuleId = null;
+ VfModule vfModule = null;
+ try {
+ vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ } catch (BBObjectNotFoundException e) {
+ }
+ if (vfModule != null) {
+ vfModuleId = vfModule.getVfModuleId();
+ }
+
+ HashMap<String, String> payloadInfo = buildPayloadInfo(vnfName, aicIdentity, vnfHostIpAddress, vmIdList,
+ vserverIdList, identityUrl, vfModuleId);
+ Optional<String> payload = null;
+ RequestParameters requestParameters = gBBInput.getRequestContext().getRequestParameters();
+ if (requestParameters != null) {
+ String pay = requestParameters.getPayload();
+ if (pay != null) {
+ payload = Optional.of(pay);
+ }
+ }
+ logger.debug("Running APP-C action: {}", action.toString());
+ logger.debug("VNFID: {}", vnfId);
+ appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+ appcCode = appCClient.getErrorCode();
+ appcMessage = appCClient.getErrorMessage();
+ mapRollbackVariables(execution, action, appcCode);
+ } catch (Exception e) {
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
+ "Caught exception in runAppcCommand", "BPMN", ErrorCode.UnknownError.getValue(), "APPC Error", e);
+ appcMessage = e.getMessage();
+ }
+
+ logger.error("Error Message: {}", appcMessage);
+ logger.error("ERROR CODE: {}", appcCode);
+ logger.trace("End of runAppCommand ");
+ if (appcCode != null && !appcCode.equals("0")) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
+ }
+ }
+
+ protected void mapRollbackVariables(BuildingBlockExecution execution, Action action, String appcCode) {
+ if (appcCode.equals("0") && action != null) {
+ if (action.equals(Action.Lock)) {
+ execution.setVariable("rollbackVnfLock", true);
+ } else if (action.equals(Action.Unlock)) {
+ execution.setVariable("rollbackVnfLock", false);
+ } else if (action.equals(Action.Start)) {
+ execution.setVariable("rollbackVnfStop", false);
+ } else if (action.equals(Action.Stop)) {
+ execution.setVariable("rollbackVnfStop", true);
+ } else if (action.equals(Action.QuiesceTraffic)) {
+ execution.setVariable("rollbackQuiesceTraffic", true);
+ } else if (action.equals(Action.ResumeTraffic)) {
+ execution.setVariable("rollbackQuiesceTraffic", false);
+ }
}
- String msoRequestId = gBBInput.getRequestContext().getMsoRequestId();
+ }
- String aicIdentity = execution.getVariable("aicIdentity");
- String vmIdList = execution.getVariable("vmIdList");
- String vserverIdList = execution.getVariable("vserverIdList");
- String identityUrl = execution.getVariable("identityUrl");
-
- ControllerSelectionReference controllerSelectionReference = catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, action.toString());
- String controllerType = controllerSelectionReference.getControllerName();
-
- String vfModuleId = null;
- VfModule vfModule = null;
- try {
- vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- } catch (BBObjectNotFoundException e) {
- }
- if (vfModule != null) {
- vfModuleId = vfModule.getVfModuleId();
- }
-
- HashMap<String, String> payloadInfo = buildPayloadInfo(vnfName, aicIdentity, vnfHostIpAddress, vmIdList, vserverIdList,
- identityUrl, vfModuleId);
- Optional<String> payload = null;
- RequestParameters requestParameters = gBBInput.getRequestContext().getRequestParameters();
- if(requestParameters != null){
- String pay = requestParameters.getPayload();
- if (pay != null) {
- payload = Optional.of(pay);
- }
- }
- logger.debug("Running APP-C action: {}", action.toString());
- logger.debug("VNFID: {}", vnfId);
- appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
- appcCode = appCClient.getErrorCode();
- appcMessage = appCClient.getErrorMessage();
- mapRollbackVariables(execution, action, appcCode);
- }
- catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
- "Caught exception in runAppcCommand", "BPMN",
- ErrorCode.UnknownError.getValue(), "APPC Error", e);
- appcMessage = e.getMessage();
- }
-
- logger.error("Error Message: {}", appcMessage);
- logger.error("ERROR CODE: {}", appcCode);
- logger.trace("End of runAppCommand ");
- if (appcCode != null && !appcCode.equals("0")) {
- exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
- }
- }
-
- protected void mapRollbackVariables(BuildingBlockExecution execution, Action action, String appcCode) {
- if (appcCode.equals("0") && action != null) {
- if (action.equals(Action.Lock)) {
- execution.setVariable("rollbackVnfLock", true);
- } else if (action.equals(Action.Unlock)) {
- execution.setVariable("rollbackVnfLock", false);
- } else if (action.equals(Action.Start)) {
- execution.setVariable("rollbackVnfStop", false);
- } else if (action.equals(Action.Stop)) {
- execution.setVariable("rollbackVnfStop", true);
- } else if (action.equals(Action.QuiesceTraffic)) {
- execution.setVariable("rollbackQuiesceTraffic", true);
- } else if (action.equals(Action.ResumeTraffic)) {
- execution.setVariable("rollbackQuiesceTraffic", false);
- }
- }
- }
-
- private HashMap<String,String> buildPayloadInfo(String vnfName, String aicIdentity, String vnfHostIpAddress,
- String vmIdList, String vserverIdList, String identityUrl, String vfModuleId) {
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- 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);
- return payloadInfo;
- }
+ private HashMap<String, String> buildPayloadInfo(String vnfName, String aicIdentity, String vnfHostIpAddress,
+ String vmIdList, String vserverIdList, String identityUrl, String vfModuleId) {
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ 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);
+ return payloadInfo;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java
index f6e07c8303..a223259d4d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java
@@ -39,45 +39,46 @@ import org.springframework.stereotype.Component;
@Component
public class AuditTasks {
- private static final Logger logger = LoggerFactory.getLogger(AuditTasks.class);
+ private static final Logger logger = LoggerFactory.getLogger(AuditTasks.class);
- @Autowired
- private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private Environment env;
+ @Autowired
+ private Environment env;
- public void isAuditNeeded(BuildingBlockExecution execution) {
- try {
- logger.debug("auditInventoryNeeded Value: {}", env.getProperty("mso.infra.auditInventory"));
- execution.setVariable("auditInventoryNeeded", Boolean.parseBoolean(env.getProperty("mso.infra.auditInventory")));
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ public void isAuditNeeded(BuildingBlockExecution execution) {
+ try {
+ logger.debug("auditInventoryNeeded Value: {}", env.getProperty("mso.infra.auditInventory"));
+ execution.setVariable("auditInventoryNeeded",
+ Boolean.parseBoolean(env.getProperty("mso.infra.auditInventory")));
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
- public void setupAuditVariable(BuildingBlockExecution execution) {
- try {
- execution.setVariable("auditInventory",createAuditInventory(execution));
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ public void setupAuditVariable(BuildingBlockExecution execution) {
+ try {
+ execution.setVariable("auditInventory", createAuditInventory(execution));
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
- private AuditInventory createAuditInventory(BuildingBlockExecution execution) throws BBObjectNotFoundException {
- AuditInventory auditInventory = new AuditInventory();
+ private AuditInventory createAuditInventory(BuildingBlockExecution execution) throws BBObjectNotFoundException {
+ AuditInventory auditInventory = new AuditInventory();
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
- auditInventory.setCloudOwner(cloudRegion.getCloudOwner());
- auditInventory.setCloudRegion(cloudRegion.getLcpCloudRegionId());
- auditInventory.setTenantId(cloudRegion.getTenantId());
- auditInventory.setHeatStackName(vfModule.getVfModuleName());
- return auditInventory;
- }
+ auditInventory.setCloudOwner(cloudRegion.getCloudOwner());
+ auditInventory.setCloudRegion(cloudRegion.getLcpCloudRegionId());
+ auditInventory.setTenantId(cloudRegion.getTenantId());
+ auditInventory.setHeatStackName(vfModule.getVfModuleName());
+ return auditInventory;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java
index f2fb37e182..9ed77d47ea 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java
@@ -32,24 +32,24 @@ import org.springframework.stereotype.Component;
public class ActivateVfModule {
private static final Logger logger = LoggerFactory.getLogger(ActivateVfModule.class);
-
- protected static final String VF_MODULE_TIMER_DURATION_PATH = "mso.workflow.vfModuleActivate.timer.duration";
- protected static final String DEFAULT_TIMER_DURATION = "PT180S";
-
- @Autowired
- private ExceptionBuilder exceptionUtil;
-
- @Autowired
+
+ protected static final String VF_MODULE_TIMER_DURATION_PATH = "mso.workflow.vfModuleActivate.timer.duration";
+ protected static final String DEFAULT_TIMER_DURATION = "PT180S";
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ @Autowired
private Environment environment;
- public void setTimerDuration(BuildingBlockExecution execution) {
- try {
- String waitDuration = this.environment.getProperty(VF_MODULE_TIMER_DURATION_PATH, DEFAULT_TIMER_DURATION);
- logger.debug("Sleeping before proceeding with SDNC activate. Timer duration: {}", waitDuration);
- execution.setVariable("vfModuleActivateTimerDuration", waitDuration);
- } catch (Exception e) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e);
- }
- }
+ public void setTimerDuration(BuildingBlockExecution execution) {
+ try {
+ String waitDuration = this.environment.getProperty(VF_MODULE_TIMER_DURATION_PATH, DEFAULT_TIMER_DURATION);
+ logger.debug("Sleeping before proceeding with SDNC activate. Timer duration: {}", waitDuration);
+ execution.setVariable("vfModuleActivateTimerDuration", waitDuration);
+ } catch (Exception e) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, 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
index c3106d6e49..164480d7c7 100644
--- 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
@@ -34,28 +34,29 @@ import org.springframework.stereotype.Component;
@Component
public class AssignNetwork {
- private static final Logger logger = LoggerFactory.getLogger(AssignNetwork.class);
+ private static final Logger logger = LoggerFactory.getLogger(AssignNetwork.class);
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
-
- /**
- * 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);
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
- if (!OrchestrationStatus.PRECREATED.equals(l3network.getOrchestrationStatus())){
- networkFound = true;
- logger.debug("network found in NOT PRECREATED status");
- }
- } catch (Exception ex) {
- // return false if no network present
- }
- return networkFound;
- }
+ /**
+ * 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);
+
+ if (!OrchestrationStatus.PRECREATED.equals(l3network.getOrchestrationStatus())) {
+ networkFound = true;
+ logger.debug("network found in NOT PRECREATED status");
+ }
+ } catch (Exception ex) {
+ // return false if no network present
+ }
+ return networkFound;
+ }
}
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
index df3f5465e6..ab8818f682 100644
--- 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
@@ -37,65 +37,69 @@ import org.springframework.stereotype.Component;
@Component
public class AssignNetworkBBUtils {
- private static final Logger logger = LoggerFactory.getLogger(AssignNetworkBBUtils.class);
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private AAINetworkResources aaiNetworkResources;
- @Autowired
- private SDNCNetworkResources sdncNetworkResources;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
+ private static final Logger logger = LoggerFactory.getLogger(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";
- logger.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);
- }
+ /**
+ * 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";
+ logger.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
index 0aa3142996..1b06fe114f 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -37,35 +36,36 @@ 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);
- List<InstanceGroup> 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, AAIEdgeLabel.BELONGS_TO);
- }
- else if(ModelInfoInstanceGroup.TYPE_L3_NETWORK.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) {
- aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf, AAIEdgeLabel.USES);
- }
- }
- }
- catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+
+ @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);
+ List<InstanceGroup> 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, AAIEdgeLabel.BELONGS_TO);
+ } else if (ModelInfoInstanceGroup.TYPE_L3_NETWORK
+ .equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) {
+ aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf, AAIEdgeLabel.USES);
+ }
+ }
+ } 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/CloudSiteCatalogUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtils.java
index 752c39a0a6..c1482d1463 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtils.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtils.java
@@ -22,7 +22,6 @@
package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import java.util.Optional;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -35,45 +34,49 @@ import org.springframework.stereotype.Component;
@Component
public class CloudSiteCatalogUtils {
- private static final Logger logger = LoggerFactory.getLogger(CloudSiteCatalogUtils.class);
- @Autowired
- private ExceptionBuilder exceptionUtil;
-
- @Autowired
- private CatalogDbClient catalogDbClient;
-
-
- public void getIdentityUrlFromCloudSite(DelegateExecution execution) {
- String cloudRegionId = (String) execution.getVariable("lcpCloudRegionId");
-
- if (cloudRegionId != null) {
- Optional<CloudSite> cloudSite = getCloudSite(cloudRegionId);
- if (!cloudSite.isPresent()) {
- logger.debug("Cloud Region with cloudRegionId {} not found in Catalog DB", cloudRegionId);
- exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Cloud Region with cloudRegionId " + cloudRegionId + " not found in Catalog DB");
- }
-
- if (cloudSite.get().getIdentityService() == null) {
- logger.debug("No identityService found for Cloud Region with cloudRegionId {} in Catalog DB", cloudRegionId);
- exceptionUtil.buildAndThrowWorkflowException(execution, 404, "No identityService found for Cloud Region with cloudRegionId " + cloudRegionId + " in Catalog DB");
- }
- String identityUrl = cloudSite.get().getIdentityService().getIdentityUrl();
-
- logger.debug("identityUrl from Catalog DB is: {}", identityUrl);
- execution.setVariable("identityUrl", identityUrl);
- }
- }
-
- protected Optional<CloudSite> getCloudSite(String id) {
- if (id == null) {
- return Optional.empty();
- }
- CloudSite cloudSite = catalogDbClient.getCloudSite(id);
+ private static final Logger logger = LoggerFactory.getLogger(CloudSiteCatalogUtils.class);
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+
+
+ public void getIdentityUrlFromCloudSite(DelegateExecution execution) {
+ String cloudRegionId = (String) execution.getVariable("lcpCloudRegionId");
+
+ if (cloudRegionId != null) {
+ Optional<CloudSite> cloudSite = getCloudSite(cloudRegionId);
+ if (!cloudSite.isPresent()) {
+ logger.debug("Cloud Region with cloudRegionId {} not found in Catalog DB", cloudRegionId);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 404,
+ "Cloud Region with cloudRegionId " + cloudRegionId + " not found in Catalog DB");
+ }
+
+ if (cloudSite.get().getIdentityService() == null) {
+ logger.debug("No identityService found for Cloud Region with cloudRegionId {} in Catalog DB",
+ cloudRegionId);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 404,
+ "No identityService found for Cloud Region with cloudRegionId " + cloudRegionId
+ + " in Catalog DB");
+ }
+ String identityUrl = cloudSite.get().getIdentityService().getIdentityUrl();
+
+ logger.debug("identityUrl from Catalog DB is: {}", identityUrl);
+ execution.setVariable("identityUrl", identityUrl);
+ }
+ }
+
+ protected Optional<CloudSite> getCloudSite(String id) {
+ if (id == null) {
+ return Optional.empty();
+ }
+ CloudSite cloudSite = catalogDbClient.getCloudSite(id);
- if (cloudSite != null) {
- return Optional.of(cloudSite);
- } else {
- return(Optional.of(catalogDbClient.getCloudSiteByClliAndAicVersion(id,"2.5")));
- }
- }
+ if (cloudSite != null) {
+ return Optional.of(cloudSite);
+ } else {
+ return (Optional.of(catalogDbClient.getCloudSiteByClliAndAicVersion(id, "2.5")));
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
index 242135adb8..8a24330093 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import java.util.Map;
import java.util.UUID;
-
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -57,8 +56,8 @@ public class ConfigAssignVnf {
private ExtractPojosForBB extractPojosForBB;
/**
- * Getting the vnf data, blueprint name, blueprint version etc and setting them
- * in execution object and calling the subprocess.
+ * Getting the vnf data, blueprint name, blueprint version etc and setting them in execution object and calling the
+ * subprocess.
*
* @param execution
*/
@@ -66,7 +65,8 @@ public class ConfigAssignVnf {
logger.info("Start preProcessAbstractCDSProcessing ");
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
Map<String, Object> userParams = execution.getGeneralBuildingBlock().getRequestContext().getUserParams();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
index 1bc7c0f574..359f19285f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
@@ -1,27 +1,21 @@
/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2019 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=========================================================
-*/
+ * ============LICENSE_START======================================================= ONAP : SO
+ * ================================================================================ Copyright 2019 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.infrastructure.flowspecific.tasks;
import java.util.UUID;
-
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.infrastructure.aai.tasks.AAIUpdateTasks;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -45,86 +39,90 @@ import org.springframework.stereotype.Component;
*/
@Component
public class ConfigDeployVnf {
- private static final Logger logger = LoggerFactory.getLogger(ConfigDeployVnf.class);
- private final static String ORIGINATOR_ID = "SO";
- private final static String ACTION_NAME = "config-deploy";
- private final static String MODE = "async";
-
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private AAIUpdateTasks aaiUpdateTask;
-
- /**
- * Update vnf orch status to configure in AAI
- *
- * @param execution
- */
- public void updateAAIConfigure(BuildingBlockExecution execution) {
- aaiUpdateTask.updateOrchestrationStausConfigDeployConfigureVnf(execution);
-
- }
- /**
- * Getting the vnf object and set in execution object
- *
- * @param execution
- *
- *
- */
- public void preProcessAbstractCDSProcessing(BuildingBlockExecution execution) {
-
-
- logger.info("Start preProcessAbstractCDSProcessing");
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
-
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
-
- ConfigDeployPropertiesForVnf configDeployPropertiesForVnf = new ConfigDeployPropertiesForVnf();
- configDeployPropertiesForVnf.setServiceInstanceId(serviceInstance.getServiceInstanceId());
- configDeployPropertiesForVnf.setServiceModelUuid(serviceInstance.getModelInfoServiceInstance().getModelUuid());
- configDeployPropertiesForVnf.setVnfCustomizationUuid(vnf.getModelInfoGenericVnf().getModelCustomizationUuid());
- configDeployPropertiesForVnf.setVnfId(vnf.getVnfId());
- configDeployPropertiesForVnf.setVnfName(vnf.getVnfName());
-
- ConfigDeployRequestVnf configDeployRequestVnf = new ConfigDeployRequestVnf();
-
- configDeployRequestVnf.setResolutionKey(vnf.getVnfName());
- configDeployRequestVnf.setConfigDeployPropertiesForVnf(configDeployPropertiesForVnf);
-
- String blueprintName = vnf.getBlueprintName();
- String blueprintVersion = vnf.getBlueprintVersion();
- AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean();
-
- abstractCDSPropertiesBean.setBlueprintName(blueprintName);
- abstractCDSPropertiesBean.setBlueprintVersion(blueprintVersion);
- abstractCDSPropertiesBean.setRequestObject(configDeployRequestVnf.toString());
-
-
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
-
- abstractCDSPropertiesBean.setOriginatorId( ORIGINATOR_ID);
- abstractCDSPropertiesBean.setRequestId(gBBInput.getRequestContext().getMsoRequestId());
- abstractCDSPropertiesBean.setSubRequestId(UUID.randomUUID().toString());
- abstractCDSPropertiesBean.setActionName(ACTION_NAME);
- abstractCDSPropertiesBean.setMode(MODE);
-
- execution.setVariable("executionObject", abstractCDSPropertiesBean);
-
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- /**
- * Update vnf orch status to configured in AAI
- *
- * @param execution
- */
- public void updateAAIConfigured(BuildingBlockExecution execution) {
- aaiUpdateTask.updateOrchestrationStausConfigDeployConfiguredVnf(execution);
-
- }
-} \ No newline at end of file
+ private static final Logger logger = LoggerFactory.getLogger(ConfigDeployVnf.class);
+ private final static String ORIGINATOR_ID = "SO";
+ private final static String ACTION_NAME = "config-deploy";
+ private final static String MODE = "async";
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private AAIUpdateTasks aaiUpdateTask;
+
+ /**
+ * Update vnf orch status to configure in AAI
+ *
+ * @param execution
+ */
+ public void updateAAIConfigure(BuildingBlockExecution execution) {
+ aaiUpdateTask.updateOrchestrationStausConfigDeployConfigureVnf(execution);
+
+ }
+
+ /**
+ * Getting the vnf object and set in execution object
+ *
+ * @param execution
+ *
+ *
+ */
+ public void preProcessAbstractCDSProcessing(BuildingBlockExecution execution) {
+
+
+ logger.info("Start preProcessAbstractCDSProcessing");
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+
+ ConfigDeployPropertiesForVnf configDeployPropertiesForVnf = new ConfigDeployPropertiesForVnf();
+ configDeployPropertiesForVnf.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ configDeployPropertiesForVnf
+ .setServiceModelUuid(serviceInstance.getModelInfoServiceInstance().getModelUuid());
+ configDeployPropertiesForVnf
+ .setVnfCustomizationUuid(vnf.getModelInfoGenericVnf().getModelCustomizationUuid());
+ configDeployPropertiesForVnf.setVnfId(vnf.getVnfId());
+ configDeployPropertiesForVnf.setVnfName(vnf.getVnfName());
+
+ ConfigDeployRequestVnf configDeployRequestVnf = new ConfigDeployRequestVnf();
+
+ configDeployRequestVnf.setResolutionKey(vnf.getVnfName());
+ configDeployRequestVnf.setConfigDeployPropertiesForVnf(configDeployPropertiesForVnf);
+
+ String blueprintName = vnf.getBlueprintName();
+ String blueprintVersion = vnf.getBlueprintVersion();
+ AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean();
+
+ abstractCDSPropertiesBean.setBlueprintName(blueprintName);
+ abstractCDSPropertiesBean.setBlueprintVersion(blueprintVersion);
+ abstractCDSPropertiesBean.setRequestObject(configDeployRequestVnf.toString());
+
+
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ abstractCDSPropertiesBean.setOriginatorId(ORIGINATOR_ID);
+ abstractCDSPropertiesBean.setRequestId(gBBInput.getRequestContext().getMsoRequestId());
+ abstractCDSPropertiesBean.setSubRequestId(UUID.randomUUID().toString());
+ abstractCDSPropertiesBean.setActionName(ACTION_NAME);
+ abstractCDSPropertiesBean.setMode(MODE);
+
+ execution.setVariable("executionObject", abstractCDSPropertiesBean);
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * Update vnf orch status to configured in AAI
+ *
+ * @param execution
+ */
+ public void updateAAIConfigured(BuildingBlockExecution execution) {
+ aaiUpdateTask.updateOrchestrationStausConfigDeployConfiguredVnf(execution);
+
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java
index 4cd0321578..1925d8b69f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java
@@ -25,7 +25,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-
import org.onap.appc.client.lcm.model.Action;
import org.onap.so.bpmn.appc.payload.beans.ConfigScaleOutPayload;
import org.onap.so.bpmn.appc.payload.beans.RequestParametersConfigScaleOut;
@@ -45,124 +44,124 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jayway.jsonpath.JsonPath;
@Component
public class ConfigurationScaleOut {
- private static final Logger logger = LoggerFactory.getLogger(ConfigurationScaleOut.class);
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private CatalogDbClient catalogDbClient;
- @Autowired
- private ApplicationControllerAction appCClient;
- private static final String ACTION = "action";
- private static final String MSO_REQUEST_ID = "msoRequestId";
- private static final String VNF_ID = "vnfId";
- private static final String VNF_NAME = "vnfName";
- private static final String VFMODULE_ID = "vfModuleId";
- private static final String CONTROLLER_TYPE = "controllerType";
- private static final String PAYLOAD = "payload";
-
- public void setParamsForConfigurationScaleOut(BuildingBlockExecution execution) {
-
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
-
- try {
- List<Map<String, String>> jsonPathForCfgParams = gBBInput.getRequestContext().getConfigurationParameters();
- String key = null;
- String paramValue = null;
- ObjectMapper mapper = new ObjectMapper();
- String configScaleOutPayloadString = null;
- ControllerSelectionReference controllerSelectionReference;
- ConfigScaleOutPayload configPayload = new ConfigScaleOutPayload();
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- String vnfId = vnf.getVnfId();
- String vnfName = vnf.getVnfName();
- String vnfType = vnf.getVnfType();
- String actionCategory = Action.ConfigScaleOut.toString();
- controllerSelectionReference = catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, actionCategory);
- String controllerName = controllerSelectionReference.getControllerName();
-
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- String sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId());
-
- Map<String, String> paramsMap = new HashMap<>();
- RequestParametersConfigScaleOut requestParameters = new RequestParametersConfigScaleOut();
- String configScaleOutParam = null;
- if (jsonPathForCfgParams != null) {
- for (Map<String, String> param : jsonPathForCfgParams) {
- for (Map.Entry<String,String> entry : param.entrySet()) {
- key = entry.getKey();
- paramValue = entry.getValue();
- try{
- configScaleOutParam = JsonPath.parse(sdncVfModuleQueryResponse).read(paramValue);
- }catch(ClassCastException e){
- configScaleOutParam = null;
- logger.warn("Incorrect JSON path. Path points to object rather than value causing: ", e);
- }
- paramsMap.put(key, configScaleOutParam);
- }
- }
- }
- requestParameters.setVfModuleId(vfModule.getVfModuleId());
- requestParameters.setVnfHostIpAddress(vnf.getIpv4OamAddress());
- configPayload.setConfigurationParameters(paramsMap);
- configPayload.setRequestParameters(requestParameters);
- configScaleOutPayloadString = mapper.writeValueAsString(configPayload);
-
- execution.setVariable(ACTION, actionCategory);
- execution.setVariable(MSO_REQUEST_ID, gBBInput.getRequestContext().getMsoRequestId());
- execution.setVariable(VNF_ID, vnfId);
- execution.setVariable(VNF_NAME, vnfName);
- execution.setVariable(VFMODULE_ID, vfModule.getVfModuleId());
- execution.setVariable(CONTROLLER_TYPE, controllerName);
- execution.setVariable(PAYLOAD, configScaleOutPayloadString);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void callAppcClient(BuildingBlockExecution execution) {
- logger.trace("Start runAppcCommand ");
- String appcCode = "1002";
- String appcMessage = "";
- try{
- Action commandAction = Action.valueOf(execution.getVariable(ACTION));
- String msoRequestId = execution.getVariable(MSO_REQUEST_ID);
- String vnfId = execution.getVariable(VNF_ID);
- Optional<String> payloadString = null;
- if(execution.getVariable(PAYLOAD) != null){
- String pay = execution.getVariable(PAYLOAD);
- payloadString = Optional.of(pay);
- }
- String controllerType = execution.getVariable(CONTROLLER_TYPE);
- HashMap<String, String> payloadInfo = new HashMap<>();
- payloadInfo.put(VNF_NAME, execution.getVariable(VNF_NAME));
- payloadInfo.put(VFMODULE_ID,execution.getVariable(VFMODULE_ID));
- logger.debug("Running APP-C action: {}", commandAction.toString());
- logger.debug("VNFID: {}", vnfId);
- //PayloadInfo contains extra information that adds on to payload before making request to appc
- appCClient.runAppCCommand(commandAction, msoRequestId, vnfId, payloadString, payloadInfo, controllerType);
- appcCode = appCClient.getErrorCode();
- appcMessage = appCClient.getErrorMessage();
-
- } catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
- "Caught exception in runAppcCommand in ConfigurationScaleOut", "BPMN",
- ErrorCode.UnknownError.getValue(), "APPC Error", e);
- appcMessage = e.getMessage();
- }
- logger.error("Error Message: " + appcMessage);
- logger.error("ERROR CODE: " + appcCode);
- logger.trace("End of runAppCommand ");
- if (appcCode != null && !appcCode.equals("0")) {
- exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(ConfigurationScaleOut.class);
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+ @Autowired
+ private ApplicationControllerAction appCClient;
+ private static final String ACTION = "action";
+ private static final String MSO_REQUEST_ID = "msoRequestId";
+ private static final String VNF_ID = "vnfId";
+ private static final String VNF_NAME = "vnfName";
+ private static final String VFMODULE_ID = "vfModuleId";
+ private static final String CONTROLLER_TYPE = "controllerType";
+ private static final String PAYLOAD = "payload";
+
+ public void setParamsForConfigurationScaleOut(BuildingBlockExecution execution) {
+
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ try {
+ List<Map<String, String>> jsonPathForCfgParams = gBBInput.getRequestContext().getConfigurationParameters();
+ String key = null;
+ String paramValue = null;
+ ObjectMapper mapper = new ObjectMapper();
+ String configScaleOutPayloadString = null;
+ ControllerSelectionReference controllerSelectionReference;
+ ConfigScaleOutPayload configPayload = new ConfigScaleOutPayload();
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ String vnfId = vnf.getVnfId();
+ String vnfName = vnf.getVnfName();
+ String vnfType = vnf.getVnfType();
+ String actionCategory = Action.ConfigScaleOut.toString();
+ controllerSelectionReference =
+ catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, actionCategory);
+ String controllerName = controllerSelectionReference.getControllerName();
+
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ String sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId());
+
+ Map<String, String> paramsMap = new HashMap<>();
+ RequestParametersConfigScaleOut requestParameters = new RequestParametersConfigScaleOut();
+ String configScaleOutParam = null;
+ if (jsonPathForCfgParams != null) {
+ for (Map<String, String> param : jsonPathForCfgParams) {
+ for (Map.Entry<String, String> entry : param.entrySet()) {
+ key = entry.getKey();
+ paramValue = entry.getValue();
+ try {
+ configScaleOutParam = JsonPath.parse(sdncVfModuleQueryResponse).read(paramValue);
+ } catch (ClassCastException e) {
+ configScaleOutParam = null;
+ logger.warn("Incorrect JSON path. Path points to object rather than value causing: ", e);
+ }
+ paramsMap.put(key, configScaleOutParam);
+ }
+ }
+ }
+ requestParameters.setVfModuleId(vfModule.getVfModuleId());
+ requestParameters.setVnfHostIpAddress(vnf.getIpv4OamAddress());
+ configPayload.setConfigurationParameters(paramsMap);
+ configPayload.setRequestParameters(requestParameters);
+ configScaleOutPayloadString = mapper.writeValueAsString(configPayload);
+
+ execution.setVariable(ACTION, actionCategory);
+ execution.setVariable(MSO_REQUEST_ID, gBBInput.getRequestContext().getMsoRequestId());
+ execution.setVariable(VNF_ID, vnfId);
+ execution.setVariable(VNF_NAME, vnfName);
+ execution.setVariable(VFMODULE_ID, vfModule.getVfModuleId());
+ execution.setVariable(CONTROLLER_TYPE, controllerName);
+ execution.setVariable(PAYLOAD, configScaleOutPayloadString);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void callAppcClient(BuildingBlockExecution execution) {
+ logger.trace("Start runAppcCommand ");
+ String appcCode = "1002";
+ String appcMessage = "";
+ try {
+ Action commandAction = Action.valueOf(execution.getVariable(ACTION));
+ String msoRequestId = execution.getVariable(MSO_REQUEST_ID);
+ String vnfId = execution.getVariable(VNF_ID);
+ Optional<String> payloadString = null;
+ if (execution.getVariable(PAYLOAD) != null) {
+ String pay = execution.getVariable(PAYLOAD);
+ payloadString = Optional.of(pay);
+ }
+ String controllerType = execution.getVariable(CONTROLLER_TYPE);
+ HashMap<String, String> payloadInfo = new HashMap<>();
+ payloadInfo.put(VNF_NAME, execution.getVariable(VNF_NAME));
+ payloadInfo.put(VFMODULE_ID, execution.getVariable(VFMODULE_ID));
+ logger.debug("Running APP-C action: {}", commandAction.toString());
+ logger.debug("VNFID: {}", vnfId);
+ // PayloadInfo contains extra information that adds on to payload before making request to appc
+ appCClient.runAppCCommand(commandAction, msoRequestId, vnfId, payloadString, payloadInfo, controllerType);
+ appcCode = appCClient.getErrorCode();
+ appcMessage = appCClient.getErrorMessage();
+
+ } catch (Exception e) {
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
+ "Caught exception in runAppcCommand in ConfigurationScaleOut", "BPMN",
+ ErrorCode.UnknownError.getValue(), "APPC Error", e);
+ appcMessage = e.getMessage();
+ }
+ logger.error("Error Message: " + appcMessage);
+ logger.error("ERROR CODE: " + appcCode);
+ logger.trace("End of runAppCommand ");
+ if (appcCode != null && !appcCode.equals("0")) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
+ }
+ }
}
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
index 8cad8f93ec..c2d9c6e7bb 100644
--- 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
@@ -22,7 +22,6 @@
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;
@@ -40,32 +39,35 @@ import org.springframework.stereotype.Component;
@Component
public class CreateNetwork {
- private static final Logger logger = LoggerFactory.getLogger(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);
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- Map<String, String> 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);
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(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);
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ Map<String, String> 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
index 5665302b2a..4eaec381e9 100644
--- 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
@@ -36,94 +36,107 @@ import org.springframework.stereotype.Component;
@Component
public class CreateNetworkCollection {
- private static final Logger logger = LoggerFactory.getLogger(CreateNetworkCollection.class);
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private AAINetworkResources aaiNetworkResources;
+ private static final Logger logger = LoggerFactory.getLogger(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);
- 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);
- 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 Instance Group to Cloud Region
- * @param execution
- * @throws Exception
- */
- public void connectInstanceGroupToCloudRegion(BuildingBlockExecution execution) throws Exception {
- execution.setVariable("connectInstanceGroupToCloudRegionRollback", false);
- try{
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- Collection networkCollection = serviceInstance.getCollection();
- aaiNetworkResources.connectInstanceGroupToCloudRegion(networkCollection.getInstanceGroup(), execution.getGeneralBuildingBlock().getCloudRegion());
- execution.setVariable("connectInstanceGroupToCloudRegionRollback", 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);
- Collection networkCollection = serviceInstance.getCollection();
- aaiNetworkResources.connectNetworkCollectionToServiceInstance(networkCollection, serviceInstance);
- execution.setVariable("connectCollectionToServiceInstanceRollback", true);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ 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);
+ 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);
+ 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 Instance Group to Cloud Region
+ *
+ * @param execution
+ * @throws Exception
+ */
+ public void connectInstanceGroupToCloudRegion(BuildingBlockExecution execution) throws Exception {
+ execution.setVariable("connectInstanceGroupToCloudRegionRollback", false);
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ Collection networkCollection = serviceInstance.getCollection();
+ aaiNetworkResources.connectInstanceGroupToCloudRegion(networkCollection.getInstanceGroup(),
+ execution.getGeneralBuildingBlock().getCloudRegion());
+ execution.setVariable("connectInstanceGroupToCloudRegionRollback", 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);
+ 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/GenericVnfHealthCheck.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
index f0db5eda2e..98b602eca1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
@@ -44,98 +44,97 @@ import org.springframework.stereotype.Component;
@Component
public class GenericVnfHealthCheck {
- private static final Logger logger = LoggerFactory.getLogger(GenericVnfHealthCheck.class);
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private CatalogDbClient catalogDbClient;
- @Autowired
- private ApplicationControllerAction appCClient;
-
- public void setParamsForGenericVnfHealthCheck(BuildingBlockExecution execution) {
-
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ private static final Logger logger = LoggerFactory.getLogger(GenericVnfHealthCheck.class);
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+ @Autowired
+ private ApplicationControllerAction appCClient;
- try {
- ControllerSelectionReference controllerSelectionReference;
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- String vnfId = vnf.getVnfId();
- String vnfName = vnf.getVnfName();
- String vnfType = vnf.getVnfType();
- String oamIpAddress = vnf.getIpv4OamAddress();
- String actionCategory = Action.HealthCheck.toString();
- controllerSelectionReference = catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, actionCategory);
- String controllerName = controllerSelectionReference.getControllerName();
-
- execution.setVariable("vnfId", vnfId);
- execution.setVariable("vnfName", vnfName);
- execution.setVariable("oamIpAddress", oamIpAddress);
- execution.setVariable("vnfHostIpAddress", oamIpAddress);
- execution.setVariable("msoRequestId", gBBInput.getRequestContext().getMsoRequestId());
- execution.setVariable("action", actionCategory);
- execution.setVariable("controllerType", controllerName);
-
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void callAppcClient(BuildingBlockExecution execution) {
- logger.trace("Start runAppcCommand ");
- String appcCode = "1002";
- String appcMessage = "";
- try {
- Action action = null;
- action = Action.valueOf(execution.getVariable("action"));
- String msoRequestId = execution.getVariable("msoRequestId");
- String vnfId = execution.getVariable("vnfId");
- Optional<String> payload = null;
- if(execution.getVariable("payload") != null){
- String pay = execution.getVariable("payload");
- payload = Optional.of(pay);
- }
- String controllerType = execution.getVariable("controllerType");
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- payloadInfo.put("vnfName", execution.getVariable("vnfName"));
- payloadInfo.put("vfModuleId",execution.getVariable("vfModuleId"));
- payloadInfo.put("oamIpAddress",execution.getVariable("oamIpAddress"));
- payloadInfo.put("vnfHostIpAddress",execution.getVariable("vnfHostIpAddress"));
-
- logger.debug("Running APP-C action: {}", action.toString());
- logger.debug("VNFID: {}", vnfId);
- //PayloadInfo contains extra information that adds on to payload before making request to appc
- appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
- appcCode = appCClient.getErrorCode();
- appcMessage = appCClient.getErrorMessage();
+ public void setParamsForGenericVnfHealthCheck(BuildingBlockExecution execution) {
+
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ try {
+ ControllerSelectionReference controllerSelectionReference;
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ String vnfId = vnf.getVnfId();
+ String vnfName = vnf.getVnfName();
+ String vnfType = vnf.getVnfType();
+ String oamIpAddress = vnf.getIpv4OamAddress();
+ String actionCategory = Action.HealthCheck.toString();
+ controllerSelectionReference =
+ catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, actionCategory);
+ String controllerName = controllerSelectionReference.getControllerName();
+
+ execution.setVariable("vnfId", vnfId);
+ execution.setVariable("vnfName", vnfName);
+ execution.setVariable("oamIpAddress", oamIpAddress);
+ execution.setVariable("vnfHostIpAddress", oamIpAddress);
+ execution.setVariable("msoRequestId", gBBInput.getRequestContext().getMsoRequestId());
+ execution.setVariable("action", actionCategory);
+ execution.setVariable("controllerType", controllerName);
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void callAppcClient(BuildingBlockExecution execution) {
+ logger.trace("Start runAppcCommand ");
+ String appcCode = "1002";
+ String appcMessage = "";
+ try {
+ Action action = null;
+ action = Action.valueOf(execution.getVariable("action"));
+ String msoRequestId = execution.getVariable("msoRequestId");
+ String vnfId = execution.getVariable("vnfId");
+ Optional<String> payload = null;
+ if (execution.getVariable("payload") != null) {
+ String pay = execution.getVariable("payload");
+ payload = Optional.of(pay);
+ }
+ String controllerType = execution.getVariable("controllerType");
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", execution.getVariable("vnfName"));
+ payloadInfo.put("vfModuleId", execution.getVariable("vfModuleId"));
+ payloadInfo.put("oamIpAddress", execution.getVariable("oamIpAddress"));
+ payloadInfo.put("vnfHostIpAddress", execution.getVariable("vnfHostIpAddress"));
+
+ logger.debug("Running APP-C action: {}", action.toString());
+ logger.debug("VNFID: {}", vnfId);
+ // PayloadInfo contains extra information that adds on to payload before making request to appc
+ appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+ appcCode = appCClient.getErrorCode();
+ appcMessage = appCClient.getErrorMessage();
} catch (BpmnError ex) {
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Caught exception in GenericVnfHealthCheck", "BPMN", ErrorCode.UnknownError.getValue(), ex);
- appcMessage = ex.getMessage();
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Caught exception in GenericVnfHealthCheck", "BPMN", ErrorCode.UnknownError.getValue(), ex);
+ appcMessage = ex.getMessage();
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
+ } catch (Exception e) {
+ if (e instanceof java.util.concurrent.TimeoutException) {
+ appcMessage = "Request to APPC timed out. ";
+ logger.error("{} {} {} {} {}", MessageEnum.RA_CONNECTION_EXCEPTION.toString(),
+ "Caught timedOut exception in runAppcCommand in GenericVnfHealthCheck", "BPMN",
+ ErrorCode.UnknownError.getValue(), "APPC Error", e);
+ throw e;
+ } else {
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
+ "Caught exception in runAppcCommand in GenericVnfHealthCheck", "BPMN",
+ ErrorCode.UnknownError.getValue(), "APPC Error", e);
+ appcMessage = e.getMessage();
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
+ }
+ }
+ logger.error("Error Message: " + appcMessage);
+ logger.error("ERROR CODE: " + appcCode);
+ logger.trace("End of runAppCommand ");
+ if (appcCode != null && !appcCode.equals("0")) {
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
- } catch (Exception e) {
- if (e instanceof java.util.concurrent.TimeoutException )
- {
- appcMessage = "Request to APPC timed out. ";
- logger.error("{} {} {} {} {}", MessageEnum.RA_CONNECTION_EXCEPTION.toString(),
- "Caught timedOut exception in runAppcCommand in GenericVnfHealthCheck", "BPMN",
- ErrorCode.UnknownError.getValue(), "APPC Error", e);
- throw e;
- }
- else {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
- "Caught exception in runAppcCommand in GenericVnfHealthCheck", "BPMN",
- ErrorCode.UnknownError.getValue(), "APPC Error", e);
- appcMessage = e.getMessage();
- exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
- }
- }
- logger.error("Error Message: " + appcMessage);
- logger.error("ERROR CODE: " + appcCode);
- logger.trace("End of runAppCommand ");
- if (appcCode != null && !appcCode.equals("0")) {
- exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
- }
- }
+ }
+ }
}
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
index 217a60b60a..7ab53cb506 100644
--- 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
@@ -22,53 +22,56 @@ 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.springframework.stereotype.Component;
@Component
-public class NetworkBBUtils {
-
- 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<org.onap.aai.domain.yang.L3Network> l3network, String relatedToValue) {
- boolean isRelatedToExists = false;
- if (l3network.isPresent()) {
- List<org.onap.aai.domain.yang.Relationship> 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;
- }
-
-
+public class NetworkBBUtils {
+
+ 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<org.onap.aai.domain.yang.L3Network> l3network,
+ String relatedToValue) {
+ boolean isRelatedToExists = false;
+ if (l3network.isPresent()) {
+ List<org.onap.aai.domain.yang.Relationship> 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
index 596b280916..0f545b9145 100644
--- 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
@@ -21,6 +21,5 @@
package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
public enum SourceSystem {
- PO,
- SDNC
+ 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
index 9a7d695c01..27415190cc 100644
--- 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
@@ -23,7 +23,6 @@
package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import java.util.Optional;
-
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
@@ -39,80 +38,83 @@ import org.springframework.stereotype.Component;
@Component
public class UnassignNetworkBB {
- private static final Logger logger = LoggerFactory.getLogger(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;
-
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
-
- @Autowired
- private AAINetworkResources aaiNetworkResources;
-
- /**
- * 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 {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
- Optional<org.onap.aai.domain.yang.L3Network> network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
- if (networkBBUtils.isRelationshipRelatedToExists(network, 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);
- }
-
-
+ private static final Logger logger = LoggerFactory.getLogger(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;
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ @Autowired
+ private AAINetworkResources aaiNetworkResources;
+
+ /**
+ * 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 {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
+ Optional<org.onap.aai.domain.yang.L3Network> network =
+ aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
+ if (networkBBUtils.isRelationshipRelatedToExists(network, 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
index afa9b439db..e51774c12c 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -37,27 +36,27 @@ 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);
- List<InstanceGroup> 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);
- }
- }
+ @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);
+ List<InstanceGroup> 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/manualhandling/tasks/ManualHandlingTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
index 9214635602..b906b8a662 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
@@ -2,7 +2,6 @@ package org.onap.so.bpmn.infrastructure.manualhandling.tasks;
import java.util.Map;
import java.util.HashMap;
-
import org.camunda.bpm.engine.TaskService;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateTask;
@@ -20,185 +19,188 @@ import org.springframework.stereotype.Component;
@Component
public class ManualHandlingTasks {
- private static final Logger logger = LoggerFactory.getLogger(ManualHandlingTasks.class);
-
- private static final String TASK_TYPE_PAUSE = "pause";
- private static final String TASK_TYPE_FALLOUT = "fallout";
-
- @Autowired
- private ExceptionBuilder exceptionUtil;
-
- @Autowired
- private RequestsDbClient requestDbclient;
-
- public void setFalloutTaskVariables (DelegateTask task) {
-
- DelegateExecution execution = task.getExecution();
- try {
- String taskId = task.getId();
- logger.debug("taskId is: " + taskId);
- String type = TASK_TYPE_FALLOUT;
- String nfRole = (String) execution.getVariable("vnfType");
- String subscriptionServiceType = (String) execution.getVariable("serviceType");
- String originalRequestId = (String) execution.getVariable("msoRequestId");
- String originalRequestorId = (String) execution.getVariable("requestorId");
- String description = "";
- String timeout = "";
- String errorSource = (String) execution.getVariable("failedActivity");
- String errorCode = (String) execution.getVariable("errorCode");
- String errorMessage = (String) execution.getVariable("errorText");
- String buildingBlockName = (String) execution.getVariable("currentActivity");
- String buildingBlockStep = (String) execution.getVariable("workStep");
- String validResponses = (String) execution.getVariable("validResponses");
-
- Map<String, String> taskVariables = new HashMap<String, String>();
- 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);
- taskVariables.put("tmeout", timeout);
- taskVariables.put("description", description);
- TaskService taskService = execution.getProcessEngineServices().getTaskService();
-
- taskService.setVariables(taskId, taskVariables);
- logger.debug("successfully created fallout task: "+ taskId);
- } catch (BpmnError e) {
- logger.debug("BPMN exception: " + e.getMessage());
- throw e;
- } catch (Exception ex){
- String msg = "Exception in setFalloutTaskVariables " + ex.getMessage();
- logger.debug(msg);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
- }
- }
-
- public void setPauseTaskVariables (DelegateTask task) {
-
- DelegateExecution execution = task.getExecution();
-
- try {
- String taskId = task.getId();
- logger.debug("taskId is: " + taskId);
- String type = TASK_TYPE_PAUSE;
- String nfRole = (String) execution.getVariable("vnfType");
- String subscriptionServiceType = (String) execution.getVariable("serviceType");
- String originalRequestId = (String) execution.getVariable("msoRequestId");
- String originalRequestorId = (String) execution.getVariable("requestorId");
- String description = (String) execution.getVariable("description");
- String timeout = (String) execution.getVariable("taskTimeout");
- String errorSource = "";
- String errorCode = "";
- String errorMessage = "";
- String buildingBlockName = "";
- String buildingBlockStep = "";
- String validResponses = (String) execution.getVariable("validResponses");
-
- Map<String, String> taskVariables = new HashMap<String, String>();
- taskVariables.put("type", type);
- taskVariables.put("nfRole", nfRole);
- taskVariables.put("description", description);
- taskVariables.put("timeout", timeout);
- 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);
- logger.debug("successfully created pause task: "+ taskId);
- } catch (BpmnError e) {
- logger.debug("BPMN exception: " + e.getMessage());
- throw e;
- } catch (Exception ex){
- String msg = "Exception in setPauseTaskVariables " + ex.getMessage();
- logger.debug(msg);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
- }
-
- }
-
- public void completeTask (DelegateTask task) {
-
- DelegateExecution execution = task.getExecution();
-
- try {
-
- String taskId = task.getId();
- logger.debug("taskId is: " + taskId);
- TaskService taskService = execution.getProcessEngineServices().getTaskService();
-
- Map<String, Object> taskVariables = taskService.getVariables(taskId);
- String responseValue = (String) taskVariables.get("responseValue");
-
- logger.debug("Received responseValue on completion: "+ responseValue);
- // Have to set the first letter of the response to upper case
- String responseValueUppercaseStart = responseValue.substring(0, 1).toUpperCase() + responseValue.substring(1);
- logger.debug("ResponseValue to taskListener: "+ responseValueUppercaseStart);
- execution.setVariable("responseValueTask", responseValueUppercaseStart);
-
- } catch (BpmnError e) {
- logger.debug("BPMN exception: " + e.getMessage());
- throw e;
- } catch (Exception ex){
- String msg = "Exception in completeManualTask " + ex.getMessage();
- logger.debug(msg);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
- }
-
- }
-
- public void createExternalTicket (DelegateExecution execution) {
-
- try {
- ExternalTicket ticket = new ExternalTicket();
-
- ticket.setRequestId((String) execution.getVariable("msoRequestId"));
- ticket.setCurrentActivity((String) execution.getVariable("currentActivity"));
- ticket.setNfRole((String) execution.getVariable("vnfType"));
- ticket.setDescription((String) execution.getVariable("description"));
- ticket.setSubscriptionServiceType((String) execution.getVariable("serviceType"));
- ticket.setRequestorId((String) execution.getVariable("requestorId"));
- ticket.setTimeout((String) execution.getVariable("taskTimeout"));
- ticket.setErrorSource((String) execution.getVariable("failedActivity"));
- ticket.setErrorCode((String) execution.getVariable("errorCode"));
- ticket.setErrorMessage((String) execution.getVariable("errorText"));
- ticket.setWorkStep((String) execution.getVariable("workStep"));
-
- ticket.createTicket();
- } catch (BpmnError e) {
- String msg = "BPMN error in createAOTSTicket " + e.getMessage();
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", ErrorCode.UnknownError.getValue());
- } catch (Exception ex){
- String msg = "Exception in createExternalTicket " + ex.getMessage();
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", ErrorCode.UnknownError.getValue());
- }
-
- }
-
- public void updateRequestDbStatus(DelegateExecution execution, String status) {
- try {
- String requestId = (String) execution.getVariable("msoRequestId");
- InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
-
- request.setRequestStatus(status);
- request.setLastModifiedBy("ManualHandling");
-
- requestDbclient.updateInfraActiveRequests(request);
- } catch (Exception e) {
- logger.error("Unable to save the updated request status to the DB",e);
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(ManualHandlingTasks.class);
+
+ private static final String TASK_TYPE_PAUSE = "pause";
+ private static final String TASK_TYPE_FALLOUT = "fallout";
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ @Autowired
+ private RequestsDbClient requestDbclient;
+
+ public void setFalloutTaskVariables(DelegateTask task) {
+
+ DelegateExecution execution = task.getExecution();
+ try {
+ String taskId = task.getId();
+ logger.debug("taskId is: " + taskId);
+ String type = TASK_TYPE_FALLOUT;
+ String nfRole = (String) execution.getVariable("vnfType");
+ String subscriptionServiceType = (String) execution.getVariable("serviceType");
+ String originalRequestId = (String) execution.getVariable("msoRequestId");
+ String originalRequestorId = (String) execution.getVariable("requestorId");
+ String description = "";
+ String timeout = "";
+ String errorSource = (String) execution.getVariable("failedActivity");
+ String errorCode = (String) execution.getVariable("errorCode");
+ String errorMessage = (String) execution.getVariable("errorText");
+ String buildingBlockName = (String) execution.getVariable("currentActivity");
+ String buildingBlockStep = (String) execution.getVariable("workStep");
+ String validResponses = (String) execution.getVariable("validResponses");
+
+ Map<String, String> taskVariables = new HashMap<String, String>();
+ 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);
+ taskVariables.put("tmeout", timeout);
+ taskVariables.put("description", description);
+ TaskService taskService = execution.getProcessEngineServices().getTaskService();
+
+ taskService.setVariables(taskId, taskVariables);
+ logger.debug("successfully created fallout task: " + taskId);
+ } catch (BpmnError e) {
+ logger.debug("BPMN exception: " + e.getMessage());
+ throw e;
+ } catch (Exception ex) {
+ String msg = "Exception in setFalloutTaskVariables " + ex.getMessage();
+ logger.debug(msg);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+ }
+
+ public void setPauseTaskVariables(DelegateTask task) {
+
+ DelegateExecution execution = task.getExecution();
+
+ try {
+ String taskId = task.getId();
+ logger.debug("taskId is: " + taskId);
+ String type = TASK_TYPE_PAUSE;
+ String nfRole = (String) execution.getVariable("vnfType");
+ String subscriptionServiceType = (String) execution.getVariable("serviceType");
+ String originalRequestId = (String) execution.getVariable("msoRequestId");
+ String originalRequestorId = (String) execution.getVariable("requestorId");
+ String description = (String) execution.getVariable("description");
+ String timeout = (String) execution.getVariable("taskTimeout");
+ String errorSource = "";
+ String errorCode = "";
+ String errorMessage = "";
+ String buildingBlockName = "";
+ String buildingBlockStep = "";
+ String validResponses = (String) execution.getVariable("validResponses");
+
+ Map<String, String> taskVariables = new HashMap<String, String>();
+ taskVariables.put("type", type);
+ taskVariables.put("nfRole", nfRole);
+ taskVariables.put("description", description);
+ taskVariables.put("timeout", timeout);
+ 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);
+ logger.debug("successfully created pause task: " + taskId);
+ } catch (BpmnError e) {
+ logger.debug("BPMN exception: " + e.getMessage());
+ throw e;
+ } catch (Exception ex) {
+ String msg = "Exception in setPauseTaskVariables " + ex.getMessage();
+ logger.debug(msg);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+
+ }
+
+ public void completeTask(DelegateTask task) {
+
+ DelegateExecution execution = task.getExecution();
+
+ try {
+
+ String taskId = task.getId();
+ logger.debug("taskId is: " + taskId);
+ TaskService taskService = execution.getProcessEngineServices().getTaskService();
+
+ Map<String, Object> taskVariables = taskService.getVariables(taskId);
+ String responseValue = (String) taskVariables.get("responseValue");
+
+ logger.debug("Received responseValue on completion: " + responseValue);
+ // Have to set the first letter of the response to upper case
+ String responseValueUppercaseStart =
+ responseValue.substring(0, 1).toUpperCase() + responseValue.substring(1);
+ logger.debug("ResponseValue to taskListener: " + responseValueUppercaseStart);
+ execution.setVariable("responseValueTask", responseValueUppercaseStart);
+
+ } catch (BpmnError e) {
+ logger.debug("BPMN exception: " + e.getMessage());
+ throw e;
+ } catch (Exception ex) {
+ String msg = "Exception in completeManualTask " + ex.getMessage();
+ logger.debug(msg);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+
+ }
+
+ public void createExternalTicket(DelegateExecution execution) {
+
+ try {
+ ExternalTicket ticket = new ExternalTicket();
+
+ ticket.setRequestId((String) execution.getVariable("msoRequestId"));
+ ticket.setCurrentActivity((String) execution.getVariable("currentActivity"));
+ ticket.setNfRole((String) execution.getVariable("vnfType"));
+ ticket.setDescription((String) execution.getVariable("description"));
+ ticket.setSubscriptionServiceType((String) execution.getVariable("serviceType"));
+ ticket.setRequestorId((String) execution.getVariable("requestorId"));
+ ticket.setTimeout((String) execution.getVariable("taskTimeout"));
+ ticket.setErrorSource((String) execution.getVariable("failedActivity"));
+ ticket.setErrorCode((String) execution.getVariable("errorCode"));
+ ticket.setErrorMessage((String) execution.getVariable("errorText"));
+ ticket.setWorkStep((String) execution.getVariable("workStep"));
+
+ ticket.createTicket();
+ } catch (BpmnError e) {
+ String msg = "BPMN error in createAOTSTicket " + e.getMessage();
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
+ } catch (Exception ex) {
+ String msg = "Exception in createExternalTicket " + ex.getMessage();
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
+ }
+
+ }
+
+ public void updateRequestDbStatus(DelegateExecution execution, String status) {
+ try {
+ String requestId = (String) execution.getVariable("msoRequestId");
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+
+ request.setRequestStatus(status);
+ request.setLastModifiedBy("ManualHandling");
+
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception e) {
+ logger.error("Unable to save the updated request status to the DB", e);
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java
index 119716a58d..d248ad5443 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java
@@ -32,25 +32,26 @@ import org.springframework.stereotype.Component;
@Component
public class NamingServiceCreateTasks {
-
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
-
- @Autowired
- private NamingServiceResources namingServiceResources;
-
- public void createInstanceGroupName(BuildingBlockExecution execution) throws Exception {
- InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
- String policyInstanceName = execution.getVariable("policyInstanceName");
- String nfNamingCode = execution.getVariable("nfNamingCode");
- String generatedInstanceGroupName = "";
- try {
- generatedInstanceGroupName = namingServiceResources.generateInstanceGroupName(instanceGroup, policyInstanceName, nfNamingCode);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- instanceGroup.setInstanceGroupName(generatedInstanceGroupName);
- }
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ @Autowired
+ private NamingServiceResources namingServiceResources;
+
+ public void createInstanceGroupName(BuildingBlockExecution execution) throws Exception {
+ InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
+ String policyInstanceName = execution.getVariable("policyInstanceName");
+ String nfNamingCode = execution.getVariable("nfNamingCode");
+ String generatedInstanceGroupName = "";
+ try {
+ generatedInstanceGroupName =
+ namingServiceResources.generateInstanceGroupName(instanceGroup, policyInstanceName, nfNamingCode);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ instanceGroup.setInstanceGroupName(generatedInstanceGroupName);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java
index c998e4aa75..9a8c9df8b5 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java
@@ -32,22 +32,22 @@ import org.springframework.stereotype.Component;
@Component
public class NamingServiceDeleteTasks {
-
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
-
- @Autowired
- private NamingServiceResources namingServiceResources;
-
- public void deleteInstanceGroupName(BuildingBlockExecution execution) throws Exception {
- InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
-
- try {
- namingServiceResources.deleteInstanceGroupName(instanceGroup);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ @Autowired
+ private NamingServiceResources namingServiceResources;
+
+ public void deleteInstanceGroupName(BuildingBlockExecution execution) throws Exception {
+ InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
+
+ try {
+ namingServiceResources.deleteInstanceGroupName(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/exceptions/SDNCErrorResponseException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/exceptions/SDNCErrorResponseException.java
index e0f88a20a5..d76d860b3b 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/exceptions/SDNCErrorResponseException.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/exceptions/SDNCErrorResponseException.java
@@ -2,12 +2,12 @@ package org.onap.so.bpmn.infrastructure.sdnc.exceptions;
public class SDNCErrorResponseException extends Exception {
- /**
- *
- */
- private static final long serialVersionUID = 7807799223298140702L;
-
- public SDNCErrorResponseException(String message) {
- super(message);
- }
+ /**
+ *
+ */
+ private static final long serialVersionUID = 7807799223298140702L;
+
+ public SDNCErrorResponseException(String message) {
+ super(message);
+ }
}
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
index 31f4b33e0c..7a0008d5a2 100644
--- 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
@@ -50,80 +50,85 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCActivateTasks {
- private static final Logger logger = LoggerFactory.getLogger(SDNCActivateTasks.class);
- @Autowired
- private SDNCVnfResources sdncVnfResources;
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private SDNCNetworkResources sdncNetworkResources;
- @Autowired
- private SDNCVfModuleResources sdncVfModuleResources;
+ private static final Logger logger = LoggerFactory.getLogger(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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- Customer customer = gBBInput.getCustomer();
- GenericResourceApiVnfOperationInformation req = sdncVnfResources.activateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.VNF);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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 {
- try{
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- Customer customer = gBBInput.getCustomer();
- RequestContext requestContext = gBBInput.getRequestContext();
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.activateNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.NETWORK);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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);
- vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- Customer customer = gBBInput.getCustomer();
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer,
- cloudRegion, requestContext);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.VFMODULE);
- execution.setVariable("SDNCRequest", sdncRequest);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ public void activateVnf(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ Customer customer = gBBInput.getCustomer();
+ GenericResourceApiVnfOperationInformation req =
+ sdncVnfResources.activateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VNF);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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 {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ Customer customer = gBBInput.getCustomer();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.activateNetwork(l3network,
+ serviceInstance, customer, requestContext, cloudRegion);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.NETWORK);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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);
+ vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ Customer customer = gBBInput.getCustomer();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.activateVfModule(vfModule, vnf,
+ serviceInstance, customer, cloudRegion, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VFMODULE);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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
index cbb1f34ae5..d3878f06b7 100644
--- 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
@@ -53,99 +53,108 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCAssignTasks {
- private static final Logger logger = LoggerFactory.getLogger(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;
+ private static final Logger logger = LoggerFactory.getLogger(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);
- Customer customer = gBBInput.getCustomer();
- GenericResourceApiServiceOperationInformation req = sdncSIResources.assignServiceInstance(serviceInstance, customer, requestContext);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.SERVICE);
- execution.setVariable("SDNCRequest", sdncRequest);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ public void assignServiceInstance(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ Customer customer = gBBInput.getCustomer();
+ GenericResourceApiServiceOperationInformation req =
+ sdncSIResources.assignServiceInstance(serviceInstance, customer, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.SERVICE);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- Customer customer = gBBInput.getCustomer();
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiVnfOperationInformation req = sdncVnfResources.assignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext, Boolean.TRUE.equals(vnf.isCallHoming()));
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.VNF);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ Customer customer = gBBInput.getCustomer();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ GenericResourceApiVnfOperationInformation req = sdncVnfResources.assignVnf(vnf, serviceInstance, customer,
+ cloudRegion, requestContext, Boolean.TRUE.equals(vnf.isCallHoming()));
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VNF);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- VolumeGroup volumeGroup = null;
- try{
- volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- } catch (BBObjectNotFoundException e){
- logger.info("No volume group was found.");
- }
- Customer customer = gBBInput.getCustomer();
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.VFMODULE);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ VolumeGroup volumeGroup = null;
+ try {
+ volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+ } catch (BBObjectNotFoundException e) {
+ logger.info("No volume group was found.");
+ }
+ Customer customer = gBBInput.getCustomer();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.assignVfModule(vfModule,
+ volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VFMODULE);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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);
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- Customer customer = gBBInput.getCustomer();
- RequestContext requestContext = gBBInput.getRequestContext();
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.assignNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.NETWORK);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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);
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ Customer customer = gBBInput.getCustomer();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.assignNetwork(l3network,
+ serviceInstance, customer, requestContext, cloudRegion);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.NETWORK);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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
index 59e46e1667..50cf0fb074 100644
--- 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
@@ -47,79 +47,87 @@ 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);
- GenericResourceApiServiceOperationInformation req = sdncServiceInstanceResources.changeModelServiceInstance(serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext());
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.SERVICE);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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);
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- GenericResourceApiVnfOperationInformation req = sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, gBBInput.getCustomer(), gBBInput.getCloudRegion(), gBBInput.getRequestContext());
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.VNF);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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);
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.changeAssignNetwork(network, serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext(), gBBInput.getCloudRegion());
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.NETWORK);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- Customer customer = gBBInput.getCustomer();
- GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.changeAssignVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.VFMODULE);
- execution.setVariable("SDNCRequest", sdncRequest);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ @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);
+ GenericResourceApiServiceOperationInformation req = sdncServiceInstanceResources
+ .changeModelServiceInstance(serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext());
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.SERVICE);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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);
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericResourceApiVnfOperationInformation req = sdncVnfResources.changeModelVnf(genericVnf, serviceInstance,
+ gBBInput.getCustomer(), gBBInput.getCloudRegion(), gBBInput.getRequestContext());
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VNF);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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);
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.changeAssignNetwork(network,
+ serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext(), gBBInput.getCloudRegion());
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.NETWORK);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ Customer customer = gBBInput.getCustomer();
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.changeAssignVfModule(vfModule,
+ vnf, serviceInstance, customer, cloudRegion, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VFMODULE);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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
index 8202a14fa3..3a1528946d 100644
--- 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
@@ -51,106 +51,115 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCDeactivateTasks {
- private static final Logger logger = LoggerFactory.getLogger(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;
+ private static final Logger logger = LoggerFactory.getLogger(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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- Customer customer = gBBInput.getCustomer();
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer,
- cloudRegion, requestContext);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.VFMODULE);
- execution.setVariable("SDNCRequest", sdncRequest); } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ public void deactivateVfModule(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ Customer customer = gBBInput.getCustomer();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.deactivateVfModule(vfModule, vnf,
+ serviceInstance, customer, cloudRegion, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VFMODULE);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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);
- vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- Customer customer = gBBInput.getCustomer();
- GenericResourceApiVnfOperationInformation req = sdncVnfResources.deactivateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.VNF);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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);
+ vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ Customer customer = gBBInput.getCustomer();
+ GenericResourceApiVnfOperationInformation req =
+ sdncVnfResources.deactivateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VNF);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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);
- Customer customer = gBBInput.getCustomer();
- GenericResourceApiServiceOperationInformation req = sdncSIResources.deactivateServiceInstance(serviceInstance, customer, requestContext);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.SERVICE);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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);
+ Customer customer = gBBInput.getCustomer();
+ GenericResourceApiServiceOperationInformation req =
+ sdncSIResources.deactivateServiceInstance(serviceInstance, customer, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.SERVICE);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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) {
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- Customer customer = gBBInput.getCustomer();
- RequestContext requestContext = gBBInput.getRequestContext();
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.deactivateNetwork(l3Network, serviceInstance, customer,
- requestContext, cloudRegion);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.NETWORK);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ Customer customer = gBBInput.getCustomer();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.deactivateNetwork(l3Network,
+ serviceInstance, customer, requestContext, cloudRegion);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.NETWORK);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
index 941eb7a004..7ae6117c61 100644
--- 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
@@ -39,77 +39,79 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCQueryTasks {
- private static final Logger logger = LoggerFactory.getLogger(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 {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
-
- String selfLink = "restconf/config/GENERIC-RESOURCE-API:services/service/"
- + serviceInstance.getServiceInstanceId() + "/service-data/vnfs/vnf/"
- + genericVnf.getVnfId() + "/vnf-data/vnf-topology/";
- try {
- if(genericVnf.getSelflink() == null) {
- genericVnf.setSelflink(selfLink);
- }
- String response = sdncVnfResources.queryVnf(genericVnf);
- execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), response);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(SDNCQueryTasks.class);
+ @Autowired
+ private SDNCVnfResources sdncVnfResources;
+ @Autowired
+ private SDNCVfModuleResources sdncVfModuleResources;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
-
- public void queryVfModule(BuildingBlockExecution execution) throws Exception {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- String selfLink = "restconf/config/GENERIC-RESOURCE-API:services/service/"
- + serviceInstance.getServiceInstanceId() + "/service-data/vnfs/vnf/"
- + genericVnf.getVnfId() + "/vnf-data/vf-modules/vf-module/"
- + vfModule.getVfModuleId() + "/vf-module-data/vf-module-topology/";
- try {
- if(vfModule.getSelflink() == null || (vfModule.getSelflink() != null && vfModule.getSelflink().isEmpty())) {
- vfModule.setSelflink(selfLink);
- }
- 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);
- 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);
- }
- }
+ public void queryVnf(BuildingBlockExecution execution) throws Exception {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+
+ String selfLink =
+ "restconf/config/GENERIC-RESOURCE-API:services/service/" + serviceInstance.getServiceInstanceId()
+ + "/service-data/vnfs/vnf/" + genericVnf.getVnfId() + "/vnf-data/vnf-topology/";
+ try {
+ if (genericVnf.getSelflink() == null) {
+ genericVnf.setSelflink(selfLink);
+ }
+ 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 {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ String selfLink = "restconf/config/GENERIC-RESOURCE-API:services/service/"
+ + serviceInstance.getServiceInstanceId() + "/service-data/vnfs/vnf/" + genericVnf.getVnfId()
+ + "/vnf-data/vf-modules/vf-module/" + vfModule.getVfModuleId() + "/vf-module-data/vf-module-topology/";
+ try {
+ if (vfModule.getSelflink() == null
+ || (vfModule.getSelflink() != null && vfModule.getSelflink().isEmpty())) {
+ vfModule.setSelflink(selfLink);
+ }
+ 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);
+ 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/SDNCRequestTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
index 24f642ae72..f32ffd72c3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
@@ -21,12 +21,10 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
import java.io.StringReader;
-
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathFactory;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.infrastructure.sdnc.exceptions.SDNCErrorResponseException;
import org.onap.so.client.exception.BadResponseException;
@@ -41,93 +39,95 @@ import org.springframework.stereotype.Component;
import org.springframework.web.client.HttpClientErrorException;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
-
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.PathNotFoundException;
-
+
@Component
public class SDNCRequestTasks {
-
- private static final Logger logger = LoggerFactory.getLogger(SDNCRequestTasks.class);
-
- private static final String SDNC_REQUEST = "SDNCRequest";
- private static final String MESSAGE = "_MESSAGE";
- private static final String CORRELATOR = "_CORRELATOR";
- protected static final String IS_CALLBACK_COMPLETED = "isCallbackCompleted";
- protected static final String SDNC_SUCCESS = "200";
-
- @Autowired
- private ExceptionBuilder exceptionBuilder;
-
- @Autowired
- private SDNCClient sdncClient;
-
- public void createCorrelationVariables (DelegateExecution execution) {
- SDNCRequest request = (SDNCRequest)execution.getVariable(SDNC_REQUEST);
- execution.setVariable(request.getCorrelationName()+CORRELATOR, request.getCorrelationValue());
- execution.setVariable("sdncTimeout", request.getTimeOut());
- }
-
- public void callSDNC (DelegateExecution execution) {
- SDNCRequest request = (SDNCRequest)execution.getVariable(SDNC_REQUEST);
- try {
- String response = sdncClient.post(request.getSDNCPayload(),request.getTopology());
- String finalMessageIndicator = JsonPath.read(response, "$.output.ack-final-indicator");
- execution.setVariable("isSDNCCompleted", convertIndicatorToBoolean(finalMessageIndicator));
- } catch(PathNotFoundException e) {
- logger.error("Error Parsing SDNC Response. Could not find read final ack indicator from JSON.", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,"Recieved invalid response from SDNC, unable to read message content.");
- } catch (MapperException e) {
- logger.error("Failed to map SDNC object to JSON prior to POST.", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,"Failed to map SDNC object to JSON prior to POST.");
- } catch (BadResponseException e) {
- logger.error("Did not receive a successful response from SDNC.", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getLocalizedMessage());
- } catch (HttpClientErrorException e){
- logger.error("HttpClientErrorException: 404 Not Found, Failed to contact SDNC", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "SDNC cannot be contacted.");
- }
- }
-
- public void processCallback (DelegateExecution execution) {
- try {
- SDNCRequest request = (SDNCRequest)execution.getVariable(SDNC_REQUEST);
- String asyncRequest = (String) execution.getVariable(request.getCorrelationName()+MESSAGE);
-
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance ();
- DocumentBuilder db = dbf.newDocumentBuilder();
- Document doc = db.parse(new InputSource(new StringReader(asyncRequest)));
-
- String finalMessageIndicator = getXmlElement(doc, "/input/ack-final-indicator");
- boolean isCallbackCompleted = convertIndicatorToBoolean(finalMessageIndicator);
- execution.setVariable(IS_CALLBACK_COMPLETED, isCallbackCompleted);
- if(isCallbackCompleted) {
- String responseCode = getXmlElement(doc, "/input/response-code");
- String responseMessage = getXmlElement(doc, "/input/response-message");
- if(!SDNC_SUCCESS.equalsIgnoreCase(responseCode)) {
- throw new SDNCErrorResponseException(responseMessage);
- }
- }
- } catch (SDNCErrorResponseException e) {
- logger.error("SDNC error response - " + e.getMessage());
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage());
- } catch (Exception e) {
- logger.error("Error procesing SDNC callback", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error procesing SDNC callback");
- }
- }
-
- public void handleTimeOutException (DelegateExecution execution) {
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error timed out waiting on SDNC Async-Response");
- }
-
- protected boolean convertIndicatorToBoolean(String finalMessageIndicator) {
- return "Y".equals(finalMessageIndicator);
- }
-
- protected String getXmlElement(Document doc, String exp) throws Exception {
- XPath xPath = XPathFactory.newInstance().newXPath();
- return xPath.evaluate(exp, doc);
- }
-
+
+ private static final Logger logger = LoggerFactory.getLogger(SDNCRequestTasks.class);
+
+ private static final String SDNC_REQUEST = "SDNCRequest";
+ private static final String MESSAGE = "_MESSAGE";
+ private static final String CORRELATOR = "_CORRELATOR";
+ protected static final String IS_CALLBACK_COMPLETED = "isCallbackCompleted";
+ protected static final String SDNC_SUCCESS = "200";
+
+ @Autowired
+ private ExceptionBuilder exceptionBuilder;
+
+ @Autowired
+ private SDNCClient sdncClient;
+
+ public void createCorrelationVariables(DelegateExecution execution) {
+ SDNCRequest request = (SDNCRequest) execution.getVariable(SDNC_REQUEST);
+ execution.setVariable(request.getCorrelationName() + CORRELATOR, request.getCorrelationValue());
+ execution.setVariable("sdncTimeout", request.getTimeOut());
+ }
+
+ public void callSDNC(DelegateExecution execution) {
+ SDNCRequest request = (SDNCRequest) execution.getVariable(SDNC_REQUEST);
+ try {
+ String response = sdncClient.post(request.getSDNCPayload(), request.getTopology());
+ String finalMessageIndicator = JsonPath.read(response, "$.output.ack-final-indicator");
+ execution.setVariable("isSDNCCompleted", convertIndicatorToBoolean(finalMessageIndicator));
+ } catch (PathNotFoundException e) {
+ logger.error("Error Parsing SDNC Response. Could not find read final ack indicator from JSON.", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
+ "Recieved invalid response from SDNC, unable to read message content.");
+ } catch (MapperException e) {
+ logger.error("Failed to map SDNC object to JSON prior to POST.", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
+ "Failed to map SDNC object to JSON prior to POST.");
+ } catch (BadResponseException e) {
+ logger.error("Did not receive a successful response from SDNC.", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getLocalizedMessage());
+ } catch (HttpClientErrorException e) {
+ logger.error("HttpClientErrorException: 404 Not Found, Failed to contact SDNC", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "SDNC cannot be contacted.");
+ }
+ }
+
+ public void processCallback(DelegateExecution execution) {
+ try {
+ SDNCRequest request = (SDNCRequest) execution.getVariable(SDNC_REQUEST);
+ String asyncRequest = (String) execution.getVariable(request.getCorrelationName() + MESSAGE);
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ Document doc = db.parse(new InputSource(new StringReader(asyncRequest)));
+
+ String finalMessageIndicator = getXmlElement(doc, "/input/ack-final-indicator");
+ boolean isCallbackCompleted = convertIndicatorToBoolean(finalMessageIndicator);
+ execution.setVariable(IS_CALLBACK_COMPLETED, isCallbackCompleted);
+ if (isCallbackCompleted) {
+ String responseCode = getXmlElement(doc, "/input/response-code");
+ String responseMessage = getXmlElement(doc, "/input/response-message");
+ if (!SDNC_SUCCESS.equalsIgnoreCase(responseCode)) {
+ throw new SDNCErrorResponseException(responseMessage);
+ }
+ }
+ } catch (SDNCErrorResponseException e) {
+ logger.error("SDNC error response - " + e.getMessage());
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage());
+ } catch (Exception e) {
+ logger.error("Error procesing SDNC callback", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error procesing SDNC callback");
+ }
+ }
+
+ public void handleTimeOutException(DelegateExecution execution) {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
+ "Error timed out waiting on SDNC Async-Response");
+ }
+
+ protected boolean convertIndicatorToBoolean(String finalMessageIndicator) {
+ return "Y".equals(finalMessageIndicator);
+ }
+
+ protected String getXmlElement(Document doc, String exp) throws Exception {
+ XPath xPath = XPathFactory.newInstance().newXPath();
+ return xPath.evaluate(exp, doc);
+ }
+
}
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
index 340872593f..e9848d1646 100644
--- 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
@@ -51,85 +51,94 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCUnassignTasks {
- private static final Logger logger = LoggerFactory.getLogger(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;
+ private static final Logger logger = LoggerFactory.getLogger(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);
- RequestContext requestContext = gBBInput.getRequestContext();
- Customer customer = gBBInput.getCustomer();
- GenericResourceApiServiceOperationInformation req = sdncSIResources.unassignServiceInstance(serviceInstance, customer, requestContext);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.SERVICE);
- execution.setVariable("SDNCRequest", sdncRequest);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void unassignVfModule(BuildingBlockExecution execution) {
- try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.VFMODULE);
- execution.setVariable("SDNCRequest", sdncRequest); } 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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- RequestContext requestContext = gBBInput.getRequestContext();
- Customer customer = gBBInput.getCustomer();
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiVnfOperationInformation req = sdncVnfResources.unassignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.VNF);
- execution.setVariable("SDNCRequest", sdncRequest);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ public void unassignServiceInstance(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ RequestContext requestContext = gBBInput.getRequestContext();
+ Customer customer = gBBInput.getCustomer();
+ GenericResourceApiServiceOperationInformation req =
+ sdncSIResources.unassignServiceInstance(serviceInstance, customer, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.SERVICE);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
- public void unassignNetwork(BuildingBlockExecution execution) throws Exception {
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- Customer customer = gBBInput.getCustomer();
- RequestContext requestContext = gBBInput.getRequestContext();
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- String cloudRegionSdnc = execution.getVariable("cloudRegionSdnc");
- cloudRegion.setLcpCloudRegionId(cloudRegionSdnc);
- GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.NETWORK);
- execution.setVariable("SDNCRequest", sdncRequest);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ public void unassignVfModule(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericResourceApiVfModuleOperationInformation req =
+ sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VFMODULE);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ RequestContext requestContext = gBBInput.getRequestContext();
+ Customer customer = gBBInput.getCustomer();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ GenericResourceApiVnfOperationInformation req =
+ sdncVnfResources.unassignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VNF);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void unassignNetwork(BuildingBlockExecution execution) throws Exception {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ Customer customer = gBBInput.getCustomer();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ String cloudRegionSdnc = execution.getVariable("cloudRegionSdnc");
+ cloudRegion.setLcpCloudRegionId(cloudRegionSdnc);
+ GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.unassignNetwork(network,
+ serviceInstance, customer, requestContext, cloudRegion);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.NETWORK);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java
index 3763fca34f..47855eaa6e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.validations;
import java.util.Optional;
import java.util.regex.Pattern;
-
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.validation.PreBuildingBlockValidator;
import org.onap.so.bpmn.common.validation.Skip;
@@ -37,34 +36,35 @@ import org.springframework.stereotype.Component;
@Skip
public class CloudRegionOrchestrationValidator implements PreBuildingBlockValidator {
- private static Logger logger = LoggerFactory.getLogger(CloudRegionOrchestrationValidator.class);
- private final Pattern pattern = Pattern.compile("(?:Activate|Assign|Create|Deactivate|Delete|Unassign|Update)(?:Network|Vnf|VfModule|VolumeGroup|FabricConfiguration)BB");
-
- @Autowired
- private ExceptionBuilder exceptionBuilder;
+ private static Logger logger = LoggerFactory.getLogger(CloudRegionOrchestrationValidator.class);
+ private final Pattern pattern = Pattern.compile(
+ "(?:Activate|Assign|Create|Deactivate|Delete|Unassign|Update)(?:Network|Vnf|VfModule|VolumeGroup|FabricConfiguration)BB");
+
+ @Autowired
+ private ExceptionBuilder exceptionBuilder;
+
+ @Override
+ public boolean shouldRunFor(String bbName) {
+ return pattern.matcher(bbName).find();
+ }
- @Override
- public boolean shouldRunFor(String bbName) {
- return pattern.matcher(bbName).find();
- }
-
- @Override
- public Optional<String> validate(BuildingBlockExecution execution) {
- String msg = null;
- try {
- CloudRegion cloudRegion = execution.getGeneralBuildingBlock().getCloudRegion();
- if (Boolean.TRUE.equals(cloudRegion.getOrchestrationDisabled())) {
- msg = String.format("Error: The request has failed due to orchestration currently disabled for the target cloud region %s for cloud owner %s",
- cloudRegion.getLcpCloudRegionId(), cloudRegion.getCloudOwner());
- logger.error(msg);
- return Optional.ofNullable(msg);
- }
- }
- catch(Exception e) {
- logger.error("failed to validate", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e);
- }
- return Optional.empty();
- }
+ @Override
+ public Optional<String> validate(BuildingBlockExecution execution) {
+ String msg = null;
+ try {
+ CloudRegion cloudRegion = execution.getGeneralBuildingBlock().getCloudRegion();
+ if (Boolean.TRUE.equals(cloudRegion.getOrchestrationDisabled())) {
+ msg = String.format(
+ "Error: The request has failed due to orchestration currently disabled for the target cloud region %s for cloud owner %s",
+ cloudRegion.getLcpCloudRegionId(), cloudRegion.getCloudOwner());
+ logger.error(msg);
+ return Optional.ofNullable(msg);
+ }
+ } catch (Exception e) {
+ logger.error("failed to validate", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e);
+ }
+ return Optional.empty();
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java
index ec2ccdf202..e809ecd0ae 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java
@@ -22,7 +22,6 @@ 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.BuildingBlockExecution;
@@ -40,41 +39,39 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 FlowCompletionTasks {
- private static final Logger logger = LoggerFactory.getLogger(FlowCompletionTasks.class);
+ private static final Logger logger = LoggerFactory.getLogger(FlowCompletionTasks.class);
+
+ @Autowired
+ private RequestsDbClient requestDbclient;
+
+ public void updateRequestDbStatus(BuildingBlockExecution execution) {
+ try {
+ String requestId = execution.getGeneralBuildingBlock().getRequestContext().getMsoRequestId();
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+
+ WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
+ if (workflowException == null) {
+ request.setStatusMessage("RequestCompletedSuccessfully");
+ request.setRequestStatus("COMPLETE");
+
+ } else {
+ request.setStatusMessage(workflowException.getErrorMessage());
+ request.setRequestStatus("FAILED");
+ }
+ request.setProgress(100L);
+ request.setLastModifiedBy("CamundaBPMN");
+
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception e) {
+ logger.error("Unable to save the updated request status to the DB", e);
+ }
+ }
+
- @Autowired
- private RequestsDbClient requestDbclient;
-
- public void updateRequestDbStatus(BuildingBlockExecution execution) {
- try {
- String requestId = execution.getGeneralBuildingBlock().getRequestContext().getMsoRequestId();
- InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
-
- WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
- if (workflowException == null) {
- request.setStatusMessage("RequestCompletedSuccessfully");
- request.setRequestStatus("COMPLETE");
-
- }
- else {
- request.setStatusMessage(workflowException.getErrorMessage());
- request.setRequestStatus("FAILED");
- }
- request.setProgress(100L);
- request.setLastModifiedBy("CamundaBPMN");
-
- requestDbclient.updateInfraActiveRequests(request);
- } catch (Exception e) {
- logger.error("Unable to save the updated request status to the DB",e);
- }
- }
-
-
}
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
index bbfc01921c..4fcacb3c42 100644
--- 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
@@ -42,124 +42,158 @@ import org.springframework.stereotype.Component;
@Component
public class OrchestrationStatusValidator {
- private static final Logger logger = LoggerFactory.getLogger(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";
- private static final String ALACARTE = "aLaCarte";
- private static final String MULTI_STAGE_DESIGN_OFF = "false";
- private static final String MULTI_STAGE_DESIGN_ON = "true";
-
-
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private ExceptionBuilder exceptionBuilder;
- @Autowired
- private CatalogDbClient catalogDbClient;
-
- public void validateOrchestrationStatus(BuildingBlockExecution execution) {
- try {
- OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult = execution.getVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT);
-
- execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, null);
-
- boolean aLaCarte = (boolean) execution.getVariable(ALACARTE);
-
- String buildingBlockFlowName = execution.getFlowToBeCalled();
-
- 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);
- orchestrationStatus = serviceInstance.getOrchestrationStatus();
- break;
- case VNF:
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, 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);
- orchestrationStatus = vfModule.getOrchestrationStatus();
- break;
- case VOLUME_GROUP:
- org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- orchestrationStatus = volumeGroup.getOrchestrationStatus();
- break;
- case NETWORK:
- org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network = extractPojosForBB.extractByKey(execution, 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);
- 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);
- orchestrationStatus = configuration.getOrchestrationStatus();
- break;
- case INSTANCE_GROUP:
- org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
- orchestrationStatus = instanceGroup.getOrchestrationStatus();
- break;
- case NO_VALIDATE:
- //short circuit and exit method
- execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, OrchestrationStatusValidationDirective.VALIDATION_SKIPPED);
- return;
- 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(aLaCarte && ResourceType.VF_MODULE.equals(buildingBlockDetail.getResourceType()) && OrchestrationAction.CREATE.equals(buildingBlockDetail.getTargetAction()) &&
- OrchestrationStatus.PENDING_ACTIVATION.equals(orchestrationStatus)) {
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- orchestrationStatusStateTransitionDirective = processPossibleSecondStageofVfModuleCreate(execution, previousOrchestrationStatusValidationResult,
- genericVnf, orchestrationStatusStateTransitionDirective);
- }
-
- 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(BBObjectNotFoundException ex){
- if(execution.getFlowToBeCalled().contains("Unassign")){
- execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- }else{
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }catch (Exception e) {
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e);
- }
- }
-
- private OrchestrationStatusStateTransitionDirective processPossibleSecondStageofVfModuleCreate(BuildingBlockExecution execution, OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult,
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf, OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective) {
- if (previousOrchestrationStatusValidationResult != null && previousOrchestrationStatusValidationResult.equals(OrchestrationStatusValidationDirective.SILENT_SUCCESS)) {
- String multiStageDesign = MULTI_STAGE_DESIGN_OFF;
- if (genericVnf.getModelInfoGenericVnf() != null) {
- multiStageDesign = genericVnf.getModelInfoGenericVnf().getMultiStageDesign();
- }
- if (multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
- }
- }
- return orchestrationStatusStateTransitionDirective;
- }
+ private static final Logger logger = LoggerFactory.getLogger(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";
+ private static final String ALACARTE = "aLaCarte";
+ private static final String MULTI_STAGE_DESIGN_OFF = "false";
+ private static final String MULTI_STAGE_DESIGN_ON = "true";
+
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private ExceptionBuilder exceptionBuilder;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+
+ public void validateOrchestrationStatus(BuildingBlockExecution execution) {
+ try {
+ OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult =
+ execution.getVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT);
+
+ execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, null);
+
+ boolean aLaCarte = (boolean) execution.getVariable(ALACARTE);
+
+ String buildingBlockFlowName = execution.getFlowToBeCalled();
+
+ 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);
+ orchestrationStatus = serviceInstance.getOrchestrationStatus();
+ break;
+ case VNF:
+ org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf =
+ extractPojosForBB.extractByKey(execution, 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);
+ orchestrationStatus = vfModule.getOrchestrationStatus();
+ break;
+ case VOLUME_GROUP:
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup =
+ extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+ orchestrationStatus = volumeGroup.getOrchestrationStatus();
+ break;
+ case NETWORK:
+ org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network =
+ extractPojosForBB.extractByKey(execution, 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);
+ 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);
+ orchestrationStatus = configuration.getOrchestrationStatus();
+ break;
+ case INSTANCE_GROUP:
+ org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup instanceGroup =
+ extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
+ orchestrationStatus = instanceGroup.getOrchestrationStatus();
+ break;
+ case NO_VALIDATE:
+ // short circuit and exit method
+ execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT,
+ OrchestrationStatusValidationDirective.VALIDATION_SKIPPED);
+ return;
+ 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 (aLaCarte && ResourceType.VF_MODULE.equals(buildingBlockDetail.getResourceType())
+ && OrchestrationAction.CREATE.equals(buildingBlockDetail.getTargetAction())
+ && OrchestrationStatus.PENDING_ACTIVATION.equals(orchestrationStatus)) {
+ org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf =
+ extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ orchestrationStatusStateTransitionDirective = processPossibleSecondStageofVfModuleCreate(execution,
+ previousOrchestrationStatusValidationResult, genericVnf,
+ orchestrationStatusStateTransitionDirective);
+ }
+
+ 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 (BBObjectNotFoundException ex) {
+ if (execution.getFlowToBeCalled().contains("Unassign")) {
+ execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT,
+ OrchestrationStatusValidationDirective.SILENT_SUCCESS);
+ } else {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ } catch (Exception e) {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e);
+ }
+ }
+
+ private OrchestrationStatusStateTransitionDirective processPossibleSecondStageofVfModuleCreate(
+ BuildingBlockExecution execution,
+ OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult,
+ org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf,
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective) {
+ if (previousOrchestrationStatusValidationResult != null && previousOrchestrationStatusValidationResult
+ .equals(OrchestrationStatusValidationDirective.SILENT_SUCCESS)) {
+ String multiStageDesign = MULTI_STAGE_DESIGN_OFF;
+ if (genericVnf.getModelInfoGenericVnf() != null) {
+ multiStageDesign = genericVnf.getModelInfoGenericVnf().getMultiStageDesign();
+ }
+ if (multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
+ orchestrationStatusStateTransitionDirective
+ .setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
+ }
+ }
+ return orchestrationStatusStateTransitionDirective;
+ }
}
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
index 03559afb33..447f8994db 100644
--- 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
@@ -22,67 +22,82 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
public class Resource {
- private String resourceId;
- private WorkflowType resourceType;
- private boolean generated;
- private boolean baseVfModule;
- private String virtualLinkKey;
- private String vnfCustomizationId;
- private String vfModuleCustomizationId;
- private String cvnfModuleCustomizationId;
-
- 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;
- }
- public String getVirtualLinkKey() {
- return virtualLinkKey;
- }
- public void setVirtualLinkKey(String virtualLinkKey) {
- this.virtualLinkKey = virtualLinkKey;
- }
- public String getVnfCustomizationId() {
- return vnfCustomizationId;
- }
- public void setVnfCustomizationId(String vnfCustomizationId) {
- this.vnfCustomizationId = vnfCustomizationId;
- }
- public String getVfModuleCustomizationId() {
- return vfModuleCustomizationId;
- }
- public void setVfModuleCustomizationId(String vfModuleCustomizationId) {
- this.vfModuleCustomizationId = vfModuleCustomizationId;
- }
- public String getCvnfModuleCustomizationId() {
- return cvnfModuleCustomizationId;
- }
- public void setCvnfModuleCustomizationId(String cvnfModuleCustomizationId) {
- this.cvnfModuleCustomizationId = cvnfModuleCustomizationId;
- }
+ private String resourceId;
+ private WorkflowType resourceType;
+ private boolean generated;
+ private boolean baseVfModule;
+ private String virtualLinkKey;
+ private String vnfCustomizationId;
+ private String vfModuleCustomizationId;
+ private String cvnfModuleCustomizationId;
+
+ 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;
+ }
+
+ public String getVirtualLinkKey() {
+ return virtualLinkKey;
+ }
+
+ public void setVirtualLinkKey(String virtualLinkKey) {
+ this.virtualLinkKey = virtualLinkKey;
+ }
+
+ public String getVnfCustomizationId() {
+ return vnfCustomizationId;
+ }
+
+ public void setVnfCustomizationId(String vnfCustomizationId) {
+ this.vnfCustomizationId = vnfCustomizationId;
+ }
+
+ public String getVfModuleCustomizationId() {
+ return vfModuleCustomizationId;
+ }
+
+ public void setVfModuleCustomizationId(String vfModuleCustomizationId) {
+ this.vfModuleCustomizationId = vfModuleCustomizationId;
+ }
+
+ public String getCvnfModuleCustomizationId() {
+ return cvnfModuleCustomizationId;
+ }
+
+ public void setCvnfModuleCustomizationId(String cvnfModuleCustomizationId) {
+ this.cvnfModuleCustomizationId = cvnfModuleCustomizationId;
+ }
}
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
index 7562bd964e..2fc301f9d7 100644
--- 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
@@ -33,7 +33,6 @@ 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.slf4j.LoggerFactory;
@@ -82,1184 +81,1306 @@ import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
-
import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class WorkflowAction {
- private static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage";
- private static final String SERVICE_INSTANCES = "serviceInstances";
- private static final String VF_MODULES = "vfModules";
- private static final String WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI = "WorkflowAction was unable to verify if the instance name already exist in AAI.";
- 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 CONFIGURATION = "Configuration";
- 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|instanceGroups";
- private static final String HOMINGSOLUTION = "Homing_Solution";
- private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
- private static final String G_SERVICE_TYPE = "serviceType";
- private static final String SERVICE_TYPE_TRANSPORT = "TRANSPORT";
- private static final Logger logger = LoggerFactory.getLogger(WorkflowAction.class);
-
- @Autowired
- protected BBInputSetup bbInputSetup;
- @Autowired
- protected BBInputSetupUtils bbInputSetupUtils;
- @Autowired
- private ExceptionBuilder exceptionBuilder;
- @Autowired
- private CatalogDbClient catalogDbClient;
- @Autowired
- private AAIConfigurationResources aaiConfigurationResources;
- @Autowired
- private WorkflowActionExtractResourcesAAI workflowActionUtils;
+ private static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage";
+ private static final String SERVICE_INSTANCES = "serviceInstances";
+ private static final String VF_MODULES = "vfModules";
+ private static final String WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI =
+ "WorkflowAction was unable to verify if the instance name already exist in AAI.";
+ 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 CONFIGURATION = "Configuration";
+ 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|instanceGroups";
+ private static final String HOMINGSOLUTION = "Homing_Solution";
+ private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
+ private static final String G_SERVICE_TYPE = "serviceType";
+ private static final String SERVICE_TYPE_TRANSPORT = "TRANSPORT";
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowAction.class);
+
+ @Autowired
+ protected BBInputSetup bbInputSetup;
+ @Autowired
+ protected BBInputSetupUtils bbInputSetupUtils;
+ @Autowired
+ private ExceptionBuilder exceptionBuilder;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+ @Autowired
+ private AAIConfigurationResources aaiConfigurationResources;
+ @Autowired
+ private WorkflowActionExtractResourcesAAI workflowActionUtils;
+
+ @Autowired
+ private Environment environment;
+ private String defaultCloudOwner = "org.onap.so.cloud-owner";
+
+ 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);
+ String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
+ final String serviceType = Optional.ofNullable((String) execution.getVariable(G_SERVICE_TYPE)).orElse("");
+
+ List<OrchestrationFlow> orchFlows = (List<OrchestrationFlow>) execution.getVariable(G_ORCHESTRATION_FLOW);
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
+ WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
+ List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
+ List<Resource> 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();
+ String cloudOwner = "";
+ try {
+ cloudOwner = requestDetails.getCloudConfiguration().getCloudOwner();
+ } catch (Exception ex) {
+ cloudOwner = environment.getProperty(defaultCloudOwner);
+ }
+ boolean suppressRollback = false;
+ try {
+ suppressRollback = requestDetails.getRequestInfo().getSuppressRollback();
+ } catch (Exception ex) {
+ suppressRollback = false;
+ }
+ execution.setVariable("suppressRollback", suppressRollback);
+ Resource resource = extractResourceIdAndTypeFromUri(uri);
+ WorkflowType resourceType = resource.getResourceType();
+ execution.setVariable("resourceName", resourceType.toString());
+ String resourceId = "";
+ if (resource.isGenerated()) {
+ resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType,
+ sIRequest.getRequestDetails().getRequestInfo().getInstanceName(), sIRequest.getRequestDetails(),
+ workflowResourceIds);
+ } else {
+ resourceId = resource.getResourceId();
+ }
+ if ((serviceInstanceId == null || serviceInstanceId.equals("")) && resourceType == WorkflowType.SERVICE) {
+ serviceInstanceId = resourceId;
+ }
+ execution.setVariable("resourceId", resourceId);
+ execution.setVariable("resourceType", resourceType);
+
+ if (aLaCarte) {
+ if (orchFlows == null || orchFlows.isEmpty()) {
+ orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte,
+ cloudOwner, serviceType);
+ }
+ String key = "";
+ ModelInfo modelInfo = sIRequest.getRequestDetails().getModelInfo();
+ if (modelInfo != null) {
+ if (modelInfo.getModelType().equals(ModelType.service)) {
+ key = modelInfo.getModelVersionId();
+ } else {
+ key = modelInfo.getModelCustomizationId();
+ }
+ }
+ boolean isConfiguration = isConfiguration(orchFlows);
+ Resource resourceKey = new Resource(resourceType, key, aLaCarte);
+ if (isConfiguration && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
+ List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks(sIRequest, orchFlows,
+ requestId, resourceKey, apiVersion, resourceId, requestAction, aLaCarte, vnfType,
+ workflowResourceIds, requestDetails, execution);
+ flowsToExecute.addAll(configBuildingBlocks);
+ }
+ orchFlows = orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION))
+ .collect(Collectors.toList());
+ for (OrchestrationFlow orchFlow : orchFlows) {
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion,
+ resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false,
+ null, 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<Map<String, Object>> userParams =
+ sIRequest.getRequestDetails().getRequestParameters().getUserParams();
+ for (Map<String, Object> 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<Map<String, Object>> userParams =
+ sIRequest.getRequestDetails().getRequestParameters().getUserParams();
+ for (Map<String, Object> 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")
+ || requestAction.equalsIgnoreCase("activate" + FABRIC_CONFIGURATION))) {
+ // 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 if (resourceType == WorkflowType.VNF && (requestAction.equalsIgnoreCase("replaceInstance")
+ || (requestAction.equalsIgnoreCase("recreateInstance")))) {
+ traverseAAIVnf(execution, resourceCounter, workflowResourceIds.getServiceInstanceId(),
+ workflowResourceIds.getVnfId(), aaiResourceIds);
+ } 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() + " ";
+ }
+ logger.info("Found {}", foundObjects);
+
+ if (orchFlows == null || orchFlows.isEmpty()) {
+ orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte,
+ cloudOwner, serviceType);
+ }
+ 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()) {
+ logger.info("Sorting for Vlan Tagging");
+ flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction);
+ }
+ // By default, enable homing at VNF level for CREATEINSTANCE and ASSIGNINSTANCE
+ if (resourceType == WorkflowType.SERVICE
+ && (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE))
+ && !resourceCounter.stream().filter(x -> WorkflowType.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, serviceInstanceId);
+ } else {
+ updateResourceIdsFromAAITraversal(flowsToExecute, resourceCounter, aaiResourceIds,
+ serviceInstanceId);
+ }
+ }
+
+ // If the user set "Homing_Solution" to "none", disable homing, else if "Homing_Solution" is specified,
+ // enable it.
+ if (sIRequest.getRequestDetails().getRequestParameters() != null
+ && sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
+ List<Map<String, Object>> userParams =
+ sIRequest.getRequestDetails().getRequestParameters().getUserParams();
+ for (Map<String, Object> params : userParams) {
+ if (params.containsKey(HOMINGSOLUTION)) {
+ if (params.get(HOMINGSOLUTION).equals("none")) {
+ execution.setVariable("homing", false);
+ } else {
+ execution.setVariable("homing", true);
+ }
+ }
+ }
+ }
+
+ if (flowsToExecute.isEmpty()) {
+ throw new IllegalStateException("Macro did not come up with a valid execution path.");
+ }
+ List<String> flowNames = new ArrayList<>();
+ logger.info("List of BuildingBlocks to execute:");
+ for (ExecuteBuildingBlock ebb : flowsToExecute) {
+ logger.info(ebb.getBuildingBlock().getBpmnFlowName());
+ flowNames.add(ebb.getBuildingBlock().getBpmnFlowName());
+ }
+ execution.setVariable("flowNames", flowNames);
+ execution.setVariable(G_CURRENT_SEQUENCE, 0);
+ execution.setVariable("retryCount", 0);
+ execution.setVariable("isRollback", false);
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("isRollbackComplete", false);
+
+ } catch (Exception ex) {
+ buildAndThrowException(execution, "Exception in create execution list " + ex.getMessage(), ex);
+ }
+ }
+
+ protected <T> List<T> getRelatedResourcesInVfModule(String vnfId, String vfModuleId, Class<T> resultClass,
+ AAIObjectType type) {
+ List<T> vnfcs = new ArrayList<>();
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
+ AAIResultWrapper vfModuleResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri);
+ Optional<Relationships> relationshipsOp = vfModuleResultsWrapper.getRelationships();
+ if (!relationshipsOp.isPresent()) {
+ logger.debug("No relationships were found for vfModule in AAI");
+ } else {
+ Relationships relationships = relationshipsOp.get();
+ List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(type);
+ for (AAIResultWrapper vnfcResultWrapper : vnfcResultWrappers) {
+ Optional<T> vnfcOp = vnfcResultWrapper.asBean(resultClass);
+ if (vnfcOp.isPresent()) {
+ vnfcs.add(vnfcOp.get());
+ }
+ }
+ }
+ return vnfcs;
+ }
+
+ protected <T> List<T> getRelatedResourcesInVnfc(Vnfc vnfc, Class<T> resultClass, AAIObjectType type) {
+
+ List<T> configurations = new ArrayList<>();
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfc.getVnfcName());
+ AAIResultWrapper vnfcResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri);
+ Optional<Relationships> relationshipsOp = vnfcResultsWrapper.getRelationships();
+ if (!relationshipsOp.isPresent()) {
+ logger.debug("No relationships were found for VNFC in AAI");
+ } else {
+ Relationships relationships = relationshipsOp.get();
+ List<AAIResultWrapper> configurationResultWrappers =
+ this.getResultWrappersFromRelationships(relationships, type);
+ for (AAIResultWrapper configurationResultWrapper : configurationResultWrappers) {
+ Optional<T> configurationOp = configurationResultWrapper.asBean(resultClass);
+ if (configurationOp.isPresent()) {
+ configurations.add(configurationOp.get());
+ }
+ }
+ }
+ return configurations;
+ }
+
+ protected List<AAIResultWrapper> getResultWrappersFromRelationships(Relationships relationships,
+ AAIObjectType type) {
+ return relationships.getByType(type);
+ }
- @Autowired
- private Environment environment;
- private String defaultCloudOwner = "org.onap.so.cloud-owner";
+ protected boolean isConfiguration(List<OrchestrationFlow> orchFlows) {
+ for (OrchestrationFlow flow : orchFlows) {
+ if (flow.getFlowName().contains("Configuration")) {
+ return true;
+ }
+ }
+ return false;
+ }
- public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) {
- this.bbInputSetupUtils = bbInputSetupUtils;
- }
+ protected List<ExecuteBuildingBlock> getConfigBuildingBlocks(ServiceInstancesRequest sIRequest,
+ List<OrchestrationFlow> orchFlows, String requestId, Resource resourceKey, String apiVersion,
+ String resourceId, String requestAction, boolean aLaCarte, String vnfType,
+ WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, DelegateExecution execution) {
- public void setBbInputSetup(BBInputSetup bbInputSetup) {
- this.bbInputSetup = bbInputSetup;
- }
+ List<ExecuteBuildingBlock> flowsToExecuteConfigs = new ArrayList<>();
+ List<OrchestrationFlow> result = new ArrayList<>(orchFlows);
+ result = orchFlows.stream().filter(item -> item.getFlowName().contains(FABRIC_CONFIGURATION))
+ .collect(Collectors.toList());
+ String vnfId = workflowResourceIds.getVnfId();
+ String vfModuleId = workflowResourceIds.getVfModuleId();
- 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);
- String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
- final String serviceType = Optional.ofNullable((String) execution.getVariable(G_SERVICE_TYPE)).orElse("");
+ String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId();
+ String vfModuleCustomizationUUID =
+ bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId();
- List<OrchestrationFlow> orchFlows = (List<OrchestrationFlow>) execution.getVariable(G_ORCHESTRATION_FLOW);
- List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
- WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
- List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
- List<Resource> resourceCounter = new ArrayList<>();
- execution.setVariable("sentSyncResponse", false);
- execution.setVariable("homing", false);
- execution.setVariable("calledHoming", false);
+ List<org.onap.aai.domain.yang.Vnfc> vnfcs = getRelatedResourcesInVfModule(vnfId, vfModuleId,
+ org.onap.aai.domain.yang.Vnfc.class, AAIObjectType.VNFC);
+ for (org.onap.aai.domain.yang.Vnfc vnfc : vnfcs) {
+ List<org.onap.aai.domain.yang.Configuration> configurations = getRelatedResourcesInVnfc(vnfc,
+ org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION);
+ if (configurations.size() > 1) {
+ String multipleRelationshipsError =
+ "Multiple relationships exist from VNFC " + vnfc.getVnfcName() + " to Configurations";
+ buildAndThrowException(execution, multipleRelationshipsError,
+ new Exception(multipleRelationshipsError));
+ }
+ for (org.onap.aai.domain.yang.Configuration configuration : configurations) {
+ workflowResourceIds.setConfigurationId(configuration.getConfigurationId());
+ for (OrchestrationFlow orchFlow : result) {
+ resourceKey.setVfModuleCustomizationId(vfModuleCustomizationUUID);
+ resourceKey.setCvnfModuleCustomizationId(vnfc.getModelCustomizationId());
+ resourceKey.setVnfCustomizationId(vnfCustomizationUUID);
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion,
+ resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false,
+ null, true);
+ String vnfcName = getVnfcNameForConfiguration(configuration);
+ if (vnfcName == null || vnfcName.isEmpty()) {
+ buildAndThrowException(execution, "Exception in create execution list "
+ + ": VnfcName does not exist or is null while there is a configuration for the vfModule",
+ new Exception("Vnfc and Configuration do not match"));
+ }
+ ebb.getConfigurationResourceKeys().setVnfcName(vnfcName);
+ flowsToExecuteConfigs.add(ebb);
+ }
+ }
+ }
+ return flowsToExecuteConfigs;
+ }
- try {
- ObjectMapper mapper = new ObjectMapper();
- execution.setVariable(G_ISTOPLEVELFLOW, true);
- ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
- RequestDetails requestDetails = sIRequest.getRequestDetails();
- String cloudOwner = "";
- try{
- cloudOwner = requestDetails.getCloudConfiguration().getCloudOwner();
- } catch (Exception ex) {
- cloudOwner = environment.getProperty(defaultCloudOwner);
- }
- boolean suppressRollback = false;
- try{
- suppressRollback = requestDetails.getRequestInfo().getSuppressRollback();
- } catch (Exception ex) {
- suppressRollback = false;
- }
- execution.setVariable("suppressRollback", suppressRollback);
- Resource resource = extractResourceIdAndTypeFromUri(uri);
- WorkflowType resourceType = resource.getResourceType();
- execution.setVariable("resourceName", resourceType.toString());
- String resourceId = "";
- if (resource.isGenerated()) {
- resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType,
- sIRequest.getRequestDetails().getRequestInfo().getInstanceName(), sIRequest.getRequestDetails(),
- workflowResourceIds);
- } else {
- resourceId = resource.getResourceId();
- }
- if((serviceInstanceId == null || serviceInstanceId.equals("")) && resourceType == WorkflowType.SERVICE){
- serviceInstanceId = resourceId;
- }
- execution.setVariable("resourceId", resourceId);
- execution.setVariable("resourceType", resourceType);
+ protected String getVnfcNameForConfiguration(org.onap.aai.domain.yang.Configuration configuration) {
+ AAIResultWrapper wrapper = new AAIResultWrapper(configuration);
+ Optional<Relationships> relationshipsOp = wrapper.getRelationships();
+ if (!relationshipsOp.isPresent()) {
+ logger.debug("No relationships were found for Configuration in AAI");
+ return null;
+ } else {
+ Relationships relationships = relationshipsOp.get();
+ List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(AAIObjectType.VNFC);
+ if (vnfcResultWrappers.size() > 1 || vnfcResultWrappers.isEmpty()) {
+ logger.debug("Too many vnfcs or no vnfc found that are related to configuration");
+ }
+ Optional<Vnfc> vnfcOp = vnfcResultWrappers.get(0).asBean(Vnfc.class);
+ if (vnfcOp.isPresent()) {
+ return vnfcOp.get().getVnfcName();
+ } else {
+ return null;
+ }
+ }
+ }
- if (aLaCarte) {
- if (orchFlows == null || orchFlows.isEmpty()) {
- orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, cloudOwner, serviceType);
- }
- String key = "";
- ModelInfo modelInfo = sIRequest.getRequestDetails().getModelInfo();
- if(modelInfo != null) {
- if(modelInfo.getModelType().equals(ModelType.service)) {
- key = modelInfo.getModelVersionId();
- } else {
- key = modelInfo.getModelCustomizationId();
- }
- }
- boolean isConfiguration = isConfiguration(orchFlows);
- Resource resourceKey = new Resource(resourceType, key, aLaCarte);
- if(isConfiguration && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
- List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks(sIRequest, orchFlows, requestId, resourceKey, apiVersion, resourceId, requestAction, aLaCarte, vnfType,
- workflowResourceIds, requestDetails, execution);
- flowsToExecute.addAll(configBuildingBlocks);
- }
- orchFlows = orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION)).collect(Collectors.toList());
- for (OrchestrationFlow orchFlow : orchFlows) {
- ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, 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<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters()
- .getUserParams();
- for (Map<String, Object> 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.
+ protected List<Resource> sortVfModulesByBaseFirst(List<Resource> vfModuleResources) {
+ int count = 0;
+ for (Resource resource : vfModuleResources) {
+ if (resource.isBaseVfModule()) {
+ Collections.swap(vfModuleResources, 0, count);
+ break;
+ }
+ count++;
+ }
+ return vfModuleResources;
+ }
- if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
- List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters()
- .getUserParams();
- for (Map<String, Object> 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")
- || requestAction.equalsIgnoreCase("activate" + FABRIC_CONFIGURATION))) {
- // 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 if (resourceType == WorkflowType.VNF && (requestAction.equalsIgnoreCase("replaceInstance") || (requestAction.equalsIgnoreCase("recreateInstance")))) {
- traverseAAIVnf(execution, resourceCounter, workflowResourceIds.getServiceInstanceId(), workflowResourceIds.getVnfId(), aaiResourceIds);
- } 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() + " ";
- }
- logger.info("Found {}", foundObjects);
+ protected List<Resource> sortVfModulesByBaseLast(List<Resource> vfModuleResources) {
+ int count = 0;
+ for (Resource resource : vfModuleResources) {
+ if (resource.isBaseVfModule()) {
+ Collections.swap(vfModuleResources, vfModuleResources.size() - 1, count);
+ break;
+ }
+ count++;
+ }
+ return vfModuleResources;
+ }
- if (orchFlows == null || orchFlows.isEmpty()) {
- orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, cloudOwner, serviceType);
- }
- 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()) {
- logger.info("Sorting for Vlan Tagging");
- flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction);
- }
- // By default, enable homing at VNF level for CREATEINSTANCE and ASSIGNINSTANCE
- if (resourceType == WorkflowType.SERVICE
- && (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE))
- && !resourceCounter.stream().filter(x -> WorkflowType.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, serviceInstanceId);
- }else{
- updateResourceIdsFromAAITraversal(flowsToExecute, resourceCounter, aaiResourceIds, serviceInstanceId);
- }
- }
+ private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute,
+ List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds, String serviceInstanceId) {
+ for (Pair<WorkflowType, String> pair : aaiResourceIds) {
+ logger.debug(pair.getValue0() + ", " + pair.getValue1());
+ }
- // If the user set "Homing_Solution" to "none", disable homing, else if "Homing_Solution" is specified, enable it.
- if (sIRequest.getRequestDetails().getRequestParameters() != null &&
- sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
- List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams();
- for (Map<String, Object> params : userParams) {
- if (params.containsKey(HOMINGSOLUTION)) {
- if (params.get(HOMINGSOLUTION).equals("none")) {
- execution.setVariable("homing", false);
- } else {
- execution.setVariable("homing", true);
- }
- }
- }
- }
+ Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> {
+ List<Resource> 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), null, serviceInstanceId);
+ }
+ });
+ }
- if (flowsToExecute.isEmpty()) {
- throw new IllegalStateException("Macro did not come up with a valid execution path.");
- }
- List<String> flowNames = new ArrayList<>();
- logger.info("List of BuildingBlocks to execute:");
- for (ExecuteBuildingBlock ebb : flowsToExecute) {
- logger.info(ebb.getBuildingBlock().getBpmnFlowName());
- flowNames.add(ebb.getBuildingBlock().getBpmnFlowName());
- }
- execution.setVariable("flowNames", flowNames);
- execution.setVariable(G_CURRENT_SEQUENCE, 0);
- execution.setVariable("retryCount", 0);
- execution.setVariable("isRollback", false);
- execution.setVariable("flowsToExecute", flowsToExecute);
- execution.setVariable("isRollbackComplete", false);
+ private String retrieveAAIResourceId(List<Pair<WorkflowType, String>> aaiResourceIds, WorkflowType resource) {
+ String id = null;
+ for (int i = 0; i < aaiResourceIds.size(); i++) {
+ if (aaiResourceIds.get(i).getValue0() == resource) {
+ id = aaiResourceIds.get(i).getValue1();
+ aaiResourceIds.remove(i);
+ break;
+ }
+ }
+ return id;
+ }
- } catch (Exception ex) {
- buildAndThrowException(execution, "Exception in create execution list " + ex.getMessage(), ex);
- }
- }
-
- protected <T> List<T> getRelatedResourcesInVfModule(String vnfId, String vfModuleId, Class<T> resultClass, AAIObjectType type) {
- List<T> vnfcs = new ArrayList<>();
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
- AAIResultWrapper vfModuleResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri);
- Optional<Relationships> relationshipsOp = vfModuleResultsWrapper.getRelationships();
- if (!relationshipsOp.isPresent()) {
- logger.debug("No relationships were found for vfModule in AAI");
- } else {
- Relationships relationships = relationshipsOp.get();
- List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(type);
- for(AAIResultWrapper vnfcResultWrapper : vnfcResultWrappers) {
- Optional<T> vnfcOp = vnfcResultWrapper.asBean(resultClass);
- if(vnfcOp.isPresent()) {
- vnfcs.add(vnfcOp.get());
- }
- }
- }
- return vnfcs;
- }
-
- protected <T> List<T> getRelatedResourcesInVnfc(Vnfc vnfc, Class<T> resultClass, AAIObjectType type) {
-
- List<T> configurations = new ArrayList<>();
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfc.getVnfcName());
- AAIResultWrapper vnfcResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri);
- Optional<Relationships> relationshipsOp = vnfcResultsWrapper.getRelationships();
- if (!relationshipsOp.isPresent()) {
- logger.debug("No relationships were found for VNFC in AAI");
- } else {
- Relationships relationships = relationshipsOp.get();
- List<AAIResultWrapper> configurationResultWrappers = this.getResultWrappersFromRelationships(relationships, type);
- for(AAIResultWrapper configurationResultWrapper : configurationResultWrappers) {
- Optional<T> configurationOp = configurationResultWrapper.asBean(resultClass);
- if(configurationOp.isPresent()) {
- configurations.add(configurationOp.get());
- }
- }
- }
- return configurations;
- }
-
- protected List<AAIResultWrapper> getResultWrappersFromRelationships(Relationships relationships, AAIObjectType type){
- return relationships.getByType(type);
- }
-
- protected boolean isConfiguration(List<OrchestrationFlow> orchFlows) {
- for(OrchestrationFlow flow : orchFlows) {
- if(flow.getFlowName().contains("Configuration")) {
- return true;
- }
- }
- return false;
- }
+ private void generateResourceIds(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceCounter,
+ String serviceInstanceId) {
+ Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> {
+ List<Resource> resources =
+ resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList());
+ for (int i = 0; i < resources.size(); i++) {
+ Resource resource = resourceCounter.stream().filter(x -> type.equals(x.getResourceType()))
+ .collect(Collectors.toList()).get(i);
+ updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null,
+ resource.getVirtualLinkKey(), serviceInstanceId);
+ }
+ });
+ }
- protected List<ExecuteBuildingBlock> getConfigBuildingBlocks(ServiceInstancesRequest sIRequest, List<OrchestrationFlow> orchFlows, String requestId, Resource resourceKey,
- String apiVersion, String resourceId, String requestAction, boolean aLaCarte, String vnfType,
- WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, DelegateExecution execution) {
-
- List<ExecuteBuildingBlock> flowsToExecuteConfigs = new ArrayList<>();
- List<OrchestrationFlow> result = new ArrayList<>(orchFlows);
- result = orchFlows.stream().filter(item -> item.getFlowName().contains(FABRIC_CONFIGURATION)).collect(Collectors.toList());
- String vnfId = workflowResourceIds.getVnfId();
- String vfModuleId = workflowResourceIds.getVfModuleId();
-
- String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId();
- String vfModuleCustomizationUUID = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId();
+ protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource,
+ String key, String id, String virtualLinkKey, String serviceInstanceId) {
+ 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();
+ workflowResourceIds.setServiceInstanceId(serviceInstanceId);
+ 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);
+ } else if (resource == WorkflowType.CONFIGURATION) {
+ workflowResourceIds.setConfigurationId(resourceId);
+ }
+ ebb.setWorkflowResourceIds(workflowResourceIds);
+ }
+ if (virtualLinkKey != null && ebb.getBuildingBlock().getIsVirtualLink()
+ && virtualLinkKey.equalsIgnoreCase(ebb.getBuildingBlock().getVirtualLinkKey())) {
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId(serviceInstanceId);
+ workflowResourceIds.setNetworkId(resourceId);
+ ebb.setWorkflowResourceIds(workflowResourceIds);
+ }
+ }
+ }
- List<org.onap.aai.domain.yang.Vnfc> vnfcs = getRelatedResourcesInVfModule(vnfId, vfModuleId, org.onap.aai.domain.yang.Vnfc.class, AAIObjectType.VNFC);
- for(org.onap.aai.domain.yang.Vnfc vnfc : vnfcs) {
- List<org.onap.aai.domain.yang.Configuration> configurations = getRelatedResourcesInVnfc(vnfc, org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION);
- if (configurations.size() > 1){
- String multipleRelationshipsError = "Multiple relationships exist from VNFC "+vnfc.getVnfcName()+" to Configurations";
- buildAndThrowException(execution, multipleRelationshipsError, new Exception(multipleRelationshipsError));
- }
- for(org.onap.aai.domain.yang.Configuration configuration : configurations) {
- workflowResourceIds.setConfigurationId(configuration.getConfigurationId());
- for(OrchestrationFlow orchFlow : result) {
- resourceKey.setVfModuleCustomizationId(vfModuleCustomizationUUID);
- resourceKey.setCvnfModuleCustomizationId(vnfc.getModelCustomizationId());
- resourceKey.setVnfCustomizationId(vnfCustomizationUUID);
- ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, true);
- String vnfcName = getVnfcNameForConfiguration(configuration);
- if(vnfcName == null || vnfcName.isEmpty()) {
- buildAndThrowException(execution, "Exception in create execution list " + ": VnfcName does not exist or is null while there is a configuration for the vfModule", new Exception("Vnfc and Configuration do not match"));
- }
- ebb.getConfigurationResourceKeys().setVnfcName(vnfcName);
- flowsToExecuteConfigs.add(ebb);
- }
- }
- }
- return flowsToExecuteConfigs;
- }
-
- protected String getVnfcNameForConfiguration(org.onap.aai.domain.yang.Configuration configuration) {
- AAIResultWrapper wrapper = new AAIResultWrapper(configuration);
- Optional<Relationships> relationshipsOp = wrapper.getRelationships();
- if (!relationshipsOp.isPresent()) {
- logger.debug("No relationships were found for Configuration in AAI");
- return null;
- } else {
- Relationships relationships = relationshipsOp.get();
- List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(AAIObjectType.VNFC);
- if(vnfcResultWrappers.size() > 1 || vnfcResultWrappers.isEmpty()) {
- logger.debug("Too many vnfcs or no vnfc found that are related to configuration");
- }
- Optional<Vnfc> vnfcOp = vnfcResultWrappers.get(0).asBean(Vnfc.class);
- if(vnfcOp.isPresent()) {
- return vnfcOp.get().getVnfcName();
- } else {
- return null;
- }
- }
- }
+ 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()) != null) {
+ 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 List<Resource> sortVfModulesByBaseFirst(List<Resource> vfModuleResources) {
- int count = 0;
- for(Resource resource : vfModuleResources){
- if(resource.isBaseVfModule()){
- Collections.swap(vfModuleResources, 0, count);
- break;
- }
- count++;
- }
- return vfModuleResources;
- }
-
- protected List<Resource> sortVfModulesByBaseLast(List<Resource> vfModuleResources) {
- int count = 0;
- for(Resource resource : vfModuleResources){
- if(resource.isBaseVfModule()){
- Collections.swap(vfModuleResources, vfModuleResources.size()-1, count);
- break;
- }
- count++;
- }
- return vfModuleResources;
- }
+ protected void traverseCatalogDbService(DelegateExecution execution, ServiceInstancesRequest sIRequest,
+ List<Resource> 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<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations();
+ if (customizations.isEmpty()) {
+ logger.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));
+ logger.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;
+ org.onap.so.db.catalog.beans.InstanceGroup instanceGroup =
+ collectionResourceCustomization.getCollectionResource().getInstanceGroup();
+ CollectionResourceInstanceGroupCustomization collectionInstCust = null;
+ if (!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) {
+ for (CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup
+ .getCollectionInstanceGroupCustomizations()) {
+ if (collectionInstanceGroupTemp.getModelCustomizationUUID()
+ .equalsIgnoreCase(collectionResourceCustomization
+ .getModelCustomizationUUID())) {
+ collectionInstCust = collectionInstanceGroupTemp;
+ break;
+ }
+ }
+ if (collectionInstCust != null
+ && collectionInstCust.getSubInterfaceNetworkQuantity() != null) {
+ minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity();
+ }
+ }
+ logger.debug("minNetworks: {}", minNetworks);
+ CollectionNetworkResourceCustomization collectionNetworkResourceCust = null;
+ for (CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup
+ .getCollectionNetworkResourceCustomizations()) {
+ if (collectionNetworkTemp.getNetworkResourceCustomization()
+ .getModelCustomizationUUID().equalsIgnoreCase(
+ collectionResourceCustomization.getModelCustomizationUUID())) {
+ collectionNetworkResourceCust = collectionNetworkTemp;
+ break;
+ }
+ }
+ for (int i = 0; i < minNetworks; i++) {
+ if (collectionNetworkResourceCust != null && collectionInstCust != null) {
+ Resource resource = new Resource(WorkflowType.VIRTUAL_LINK,
+ collectionNetworkResourceCust.getModelCustomizationUUID(), false);
+ resource.setVirtualLinkKey(Integer.toString(i));
+ resourceCounter.add(resource);
+ }
+ }
+ } else {
+ logger.debug(
+ "Instance Group tosca node type does not contain NetworkCollection: {}",
+ toscaNodeType);
+ }
+ } else {
+ logger.debug("No Instance Group found for network collection.");
+ }
+ } else {
+ logger.debug("No Network Collection found. collectionResource is null");
+ }
+ } else {
+ logger.debug("No Network Collection Customization found");
+ }
+ }
+ if (resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
+ .collect(Collectors.toList()).isEmpty()) {
+ if (service.getNetworkCustomizations() == null) {
+ logger.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");
+ }
+ }
+ }
- private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute,
- List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds, String serviceInstanceId) {
- for(Pair<WorkflowType,String> pair : aaiResourceIds){
- logger.debug(pair.getValue0() + ", " + pair.getValue1());
- }
-
- Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> {
- List<Resource> 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), null, serviceInstanceId);
- }
- });
- }
+ protected void traverseAAIService(DelegateExecution execution, List<Resource> resourceCounter, String resourceId,
+ List<Pair<WorkflowType, String>> 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, String>(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, String>(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, String>(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, String>(WorkflowType.NETWORK, network.getNetworkId()));
+ resourceCounter.add(new Resource(WorkflowType.NETWORK, network.getNetworkId(), false));
+ }
+ }
+ if (serviceInstanceMSO.getCollection() != null) {
+ logger.debug("found networkcollection");
+ aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.NETWORKCOLLECTION,
+ serviceInstanceMSO.getCollection().getId()));
+ resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,
+ serviceInstanceMSO.getCollection().getId(), false));
+ }
+ if (serviceInstanceMSO.getConfigurations() != null) {
+ for (Configuration config : serviceInstanceMSO.getConfigurations()) {
+ Optional<org.onap.aai.domain.yang.Configuration> aaiConfig =
+ aaiConfigurationResources.getConfiguration(config.getConfigurationId());
+ if (aaiConfig.isPresent() && aaiConfig.get().getRelationshipList() != null) {
+ for (Relationship relationship : aaiConfig.get().getRelationshipList().getRelationship()) {
+ if (relationship.getRelatedTo().contains("vnfc")) {
+ aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION,
+ config.getConfigurationId()));
+ resourceCounter.add(
+ new Resource(WorkflowType.CONFIGURATION, config.getConfigurationId(), false));
+ break;
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
+ buildAndThrowException(execution,
+ "Could not find existing Service Instance or related Instances to execute the request on.");
+ }
+ }
- private String retrieveAAIResourceId(List<Pair<WorkflowType, String>> aaiResourceIds, WorkflowType resource){
- String id = null;
- for(int i = 0; i<aaiResourceIds.size();i++){
- if(aaiResourceIds.get(i).getValue0() == resource){
- id = aaiResourceIds.get(i).getValue1();
- aaiResourceIds.remove(i);
- break;
- }
- }
- return id;
- }
- private void generateResourceIds(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceCounter, String serviceInstanceId) {
- Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> {
- List<Resource> resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList());
- for(int i = 0; i < resources.size(); i++){
- Resource resource = resourceCounter.stream().filter(x -> type.equals(x.getResourceType()))
- .collect(Collectors.toList()).get(i);
- updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null, resource.getVirtualLinkKey(),serviceInstanceId);
- }
- });
- }
-
- protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource, String key, String id, String virtualLinkKey, String serviceInstanceId){
- 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();
- workflowResourceIds.setServiceInstanceId(serviceInstanceId);
- 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);
- }else if(resource == WorkflowType.CONFIGURATION){
- workflowResourceIds.setConfigurationId(resourceId);
- }
- ebb.setWorkflowResourceIds(workflowResourceIds);
- }
- if(virtualLinkKey != null && ebb.getBuildingBlock().getIsVirtualLink()
- && virtualLinkKey.equalsIgnoreCase(ebb.getBuildingBlock().getVirtualLinkKey())) {
- WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
- workflowResourceIds.setServiceInstanceId(serviceInstanceId);
- workflowResourceIds.setNetworkId(resourceId);
- ebb.setWorkflowResourceIds(workflowResourceIds);
- }
- }
- }
+ private void traverseAAIVnf(DelegateExecution execution, List<Resource> resourceCounter, String serviceId,
+ String vnfId, List<Pair<WorkflowType, String>> aaiResourceIds) {
+ try {
+ ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceId);
+ 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()) {
+ if (vnf.getVnfId().equals(vnfId)) {
+ aaiResourceIds.add(new Pair<WorkflowType, String>(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, String>(WorkflowType.VFMODULE,
+ vfModule.getVfModuleId()));
+ resourceCounter
+ .add(new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false));
+ findConfigurationsInsideVfModule(execution, vnf.getVnfId(), vfModule.getVfModuleId(),
+ resourceCounter, aaiResourceIds);
+ }
+ }
+ if (vnf.getVolumeGroups() != null) {
+ for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf
+ .getVolumeGroups()) {
+ aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VOLUMEGROUP,
+ volumeGroup.getVolumeGroupId()));
+ resourceCounter.add(
+ new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false));
+ }
+ }
+ break;
+ }
+ }
+ }
+ } catch (Exception ex) {
+ buildAndThrowException(execution,
+ "Could not find existing Vnf or related Instances to execute the request on.");
+ }
+ }
- 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()) != null) {
- 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<Resource> 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<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations();
- if(customizations.isEmpty()) {
- logger.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));
- logger.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;
- org.onap.so.db.catalog.beans.InstanceGroup instanceGroup = collectionResourceCustomization.getCollectionResource().getInstanceGroup();
- CollectionResourceInstanceGroupCustomization collectionInstCust = null;
- if(!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) {
- for(CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup.getCollectionInstanceGroupCustomizations()) {
- if(collectionInstanceGroupTemp.getModelCustomizationUUID().equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) {
- collectionInstCust = collectionInstanceGroupTemp;
- break;
- }
- }
- if(collectionInstCust != null && collectionInstCust.getSubInterfaceNetworkQuantity() != null) {
- minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity();
- }
- }
- logger.debug("minNetworks: {}" , minNetworks);
- CollectionNetworkResourceCustomization collectionNetworkResourceCust = null;
- for(CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup.getCollectionNetworkResourceCustomizations()) {
- if(collectionNetworkTemp.getNetworkResourceCustomization().getModelCustomizationUUID().equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) {
- collectionNetworkResourceCust = collectionNetworkTemp;
- break;
- }
- }
- for (int i = 0; i < minNetworks; i++) {
- if(collectionNetworkResourceCust != null && collectionInstCust != null) {
- Resource resource = new Resource(WorkflowType.VIRTUAL_LINK,collectionNetworkResourceCust.getModelCustomizationUUID(),false);
- resource.setVirtualLinkKey(Integer.toString(i));
- resourceCounter.add(resource);
- }
- }
- } else {
- logger.debug("Instance Group tosca node type does not contain NetworkCollection: {}" , toscaNodeType);
- }
- }else{
- logger.debug("No Instance Group found for network collection.");
- }
- }else{
- logger.debug("No Network Collection found. collectionResource is null");
- }
- } else {
- logger.debug("No Network Collection Customization found");
- }
- }
- if (resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()).collect(Collectors.toList()).isEmpty()) {
- if (service.getNetworkCustomizations() == null) {
- logger.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");
- }
- }
- }
+ private void findConfigurationsInsideVfModule(DelegateExecution execution, String vnfId, String vfModuleId,
+ List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds) {
+ try {
+ org.onap.aai.domain.yang.VfModule aaiVfModule = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId);
+ AAIResultWrapper vfModuleWrapper = new AAIResultWrapper(
+ new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiVfModule));
+ Optional<Relationships> relationshipsOp;
+ relationshipsOp = vfModuleWrapper.getRelationships();
+ if (relationshipsOp.isPresent()) {
+ relationshipsOp = workflowActionUtils.extractRelationshipsVnfc(relationshipsOp.get());
+ if (relationshipsOp.isPresent()) {
+ Optional<Configuration> config =
+ workflowActionUtils.extractRelationshipsConfiguration(relationshipsOp.get());
+ if (config.isPresent()) {
+ aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION,
+ config.get().getConfigurationId()));
+ resourceCounter.add(
+ new Resource(WorkflowType.CONFIGURATION, config.get().getConfigurationId(), false));
+ }
+ }
+ }
+ } catch (Exception ex) {
+ buildAndThrowException(execution, "Failed to find Configuration object from the vfModule.");
+ }
+ }
- protected void traverseAAIService(DelegateExecution execution, List<Resource> resourceCounter, String resourceId, List<Pair<WorkflowType, String>> 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, String>(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, String>(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, String>(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, String>(WorkflowType.NETWORK, network.getNetworkId()));
- resourceCounter.add(new Resource(WorkflowType.NETWORK,network.getNetworkId(),false));
- }
- }
- if (serviceInstanceMSO.getCollection() != null) {
- logger.debug("found networkcollection");
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.NETWORKCOLLECTION, serviceInstanceMSO.getCollection().getId()));
- resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,serviceInstanceMSO.getCollection().getId(),false));
- }
- if (serviceInstanceMSO.getConfigurations() !=null) {
- for(Configuration config : serviceInstanceMSO.getConfigurations()){
- Optional<org.onap.aai.domain.yang.Configuration> aaiConfig = aaiConfigurationResources.getConfiguration(config.getConfigurationId());
- if(aaiConfig.isPresent() && aaiConfig.get().getRelationshipList()!=null){
- for(Relationship relationship : aaiConfig.get().getRelationshipList().getRelationship()){
- if(relationship.getRelatedTo().contains("vnfc")){
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION, config.getConfigurationId()));
- resourceCounter.add(new Resource(WorkflowType.CONFIGURATION,config.getConfigurationId(),false));
- break;
- }
- }
- }
- }
- }
- } 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<Resource> resourceCounter,
+ ServiceInstancesRequest sIRequest, String requestAction) throws IOException {
+ boolean foundRelated = false;
+ boolean foundVfModuleOrVG = false;
+ String vnfCustomizationUUID = "";
+ String vfModuleCustomizationUUID = "";
+ if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
+ List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams();
+ for (Map<String, Object> 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.getModelInfo() != null && vnf.getModelInfo().getModelCustomizationUuid() != null) {
+ vnfCustomizationUUID = vnf.getModelInfo().getModelCustomizationUuid();
+ }
+ if (vnf.getVfModules() != null) {
+ for (VfModules vfModule : vnf.getVfModules()) {
+ VfModuleCustomization vfModuleCustomization =
+ catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(
+ vfModule.getModelInfo().getModelCustomizationUuid());
+ if (vfModuleCustomization != null) {
- private void traverseAAIVnf(DelegateExecution execution, List<Resource> resourceCounter, String serviceId, String vnfId,
- List<Pair<WorkflowType, String>> aaiResourceIds) {
- try{
- ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceId);
- 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()) {
- if(vnf.getVnfId().equals(vnfId)){
- aaiResourceIds.add(new Pair<WorkflowType, String>(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, String>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
- resourceCounter.add(new Resource(WorkflowType.VFMODULE,vfModule.getVfModuleId(),false));
- findConfigurationsInsideVfModule(execution, vnf.getVnfId(), vfModule.getVfModuleId(), resourceCounter, aaiResourceIds);
- }
- }
- if (vnf.getVolumeGroups() != null) {
- for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf
- .getVolumeGroups()) {
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId()));
- resourceCounter.add(new Resource(WorkflowType.VOLUMEGROUP,volumeGroup.getVolumeGroupId(),false));
- }
- }
- break;
- }
- }
- }
- } catch (Exception ex) {
- buildAndThrowException(execution,
- "Could not find existing Vnf or related Instances to execute the request on.");
- }
- }
+ if (vfModuleCustomization.getVfModule() != null
+ && vfModuleCustomization.getVfModule().getVolumeHeatTemplate() != null
+ && vfModuleCustomization.getVolumeHeatEnv() != null) {
+ resourceCounter.add(new Resource(WorkflowType.VOLUMEGROUP,
+ vfModuleCustomization.getModelCustomizationUUID(), false));
+ foundRelated = true;
+ foundVfModuleOrVG = true;
+ }
- private void findConfigurationsInsideVfModule(DelegateExecution execution, String vnfId, String vfModuleId, List<Resource> resourceCounter,
- List<Pair<WorkflowType, String>> aaiResourceIds) {
- try{
- org.onap.aai.domain.yang.VfModule aaiVfModule = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId);
- AAIResultWrapper vfModuleWrapper = new AAIResultWrapper(
- new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiVfModule));
- Optional<Relationships> relationshipsOp;
- relationshipsOp = vfModuleWrapper.getRelationships();
- if(relationshipsOp.isPresent()) {
- relationshipsOp = workflowActionUtils.extractRelationshipsVnfc(relationshipsOp.get());
- if(relationshipsOp.isPresent()){
- Optional<Configuration> config = workflowActionUtils.extractRelationshipsConfiguration(relationshipsOp.get());
- if(config.isPresent()){
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION, config.get().getConfigurationId()));
- resourceCounter.add(new Resource(WorkflowType.CONFIGURATION, config.get().getConfigurationId(), false));
- }
- }
- }
- }catch (Exception ex){
- buildAndThrowException(execution,
- "Failed to find Configuration object from the vfModule.");
- }
- }
-
- protected boolean traverseUserParamsService(DelegateExecution execution, List<Resource> resourceCounter,
- ServiceInstancesRequest sIRequest, String requestAction)
- throws IOException {
- boolean foundRelated = false;
- boolean foundVfModuleOrVG = false;
- String vnfCustomizationUUID = "";
- String vfModuleCustomizationUUID = "";
- if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
- List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams();
- for (Map<String, Object> 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.getModelInfo()!=null && vnf.getModelInfo().getModelCustomizationUuid()!=null){
- vnfCustomizationUUID = vnf.getModelInfo().getModelCustomizationUuid();
- }
- 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().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 (vfModule.getModelInfo() != null
+ && vfModule.getModelInfo().getModelCustomizationUuid() != null) {
+ vfModuleCustomizationUUID =
+ vfModule.getModelInfo().getModelCustomizationUuid();
+ }
+ if (!vnfCustomizationUUID.equals("")
+ && !vfModuleCustomizationUUID.equals("")) {
+ List<CvnfcConfigurationCustomization> configs =
+ traverseCatalogDbForConfiguration(
+ validate.getModelInfo().getModelVersionId(),
+ vnfCustomizationUUID, vfModuleCustomizationUUID);
+ for (CvnfcConfigurationCustomization config : configs) {
+ Resource configResource = new Resource(WorkflowType.CONFIGURATION,
+ config.getConfigurationResource().getModelUUID(), false);
+ resource.setVnfCustomizationId(
+ vnf.getModelInfo().getModelCustomizationId());
+ resource.setVfModuleCustomizationId(
+ vfModule.getModelInfo().getModelCustomizationId());
+ resourceCounter.add(configResource);
+ }
+ }
+ }
+ 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;
+ }
- if(vfModuleCustomization.getVfModule() != null && vfModuleCustomization.getVfModule().getVolumeHeatTemplate() != null && vfModuleCustomization.getVolumeHeatEnv() != null) {
- resourceCounter.add(new Resource(WorkflowType.VOLUMEGROUP,vfModuleCustomization.getModelCustomizationUUID(),false));
- foundRelated = true;
- foundVfModuleOrVG = true;
- }
+ protected List<CvnfcConfigurationCustomization> traverseCatalogDbForConfiguration(String serviceModelUUID,
+ String vnfCustomizationUUID, String vfModuleCustomizationUUID) {
+ List<CvnfcConfigurationCustomization> configurations = new ArrayList<>();
+ try {
+ List<CvnfcCustomization> cvnfcCustomizations = catalogDbClient.getCvnfcCustomization(serviceModelUUID,
+ vnfCustomizationUUID, vfModuleCustomizationUUID);
+ for (CvnfcCustomization cvnfc : cvnfcCustomizations) {
+ for (CvnfcConfigurationCustomization customization : cvnfc.getCvnfcConfigurationCustomization()) {
+ if (customization.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)) {
+ configurations.add(customization);
+ }
+ }
+ }
+ logger.debug("found {} fabric configuration(s)", configurations.size());
+ return configurations;
+ } catch (Exception ex) {
+ logger.error("Error in finding configurations", ex);
+ return configurations;
+ }
+ }
- 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(vfModule.getModelInfo()!=null && vfModule.getModelInfo().getModelCustomizationUuid()!=null){
- vfModuleCustomizationUUID = vfModule.getModelInfo().getModelCustomizationUuid();
- }
- if(!vnfCustomizationUUID.equals("")&&!vfModuleCustomizationUUID.equals("")){
- List<CvnfcConfigurationCustomization> configs = traverseCatalogDbForConfiguration(validate.getModelInfo().getModelVersionId(),vnfCustomizationUUID,vfModuleCustomizationUUID);
- for(CvnfcConfigurationCustomization config : configs){
- Resource configResource = new Resource(WorkflowType.CONFIGURATION,config.getConfigurationResource().getModelUUID(),false);
- resource.setVnfCustomizationId(vnf.getModelInfo().getModelCustomizationId());
- resource.setVfModuleCustomizationId(vfModule.getModelInfo().getModelCustomizationId());
- resourceCounter.add(configResource);
- }
- }
- }
- 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 List<CvnfcConfigurationCustomization> traverseCatalogDbForConfiguration(String serviceModelUUID, String vnfCustomizationUUID, String vfModuleCustomizationUUID) {
- List<CvnfcConfigurationCustomization> configurations = new ArrayList<>();
- try{
- List<CvnfcCustomization> cvnfcCustomizations = catalogDbClient.getCvnfcCustomization(serviceModelUUID,vnfCustomizationUUID, vfModuleCustomizationUUID);
- for(CvnfcCustomization cvnfc : cvnfcCustomizations){
- for(CvnfcConfigurationCustomization customization : cvnfc.getCvnfcConfigurationCustomization()){
- if(customization.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)){
- configurations.add(customization);
- }
- }
- }
- logger.debug("found {} fabric configuration(s)" , configurations.size() );
- return configurations;
- } catch (Exception ex){
- logger.error("Error in finding configurations", ex);
- return configurations;
- }
- }
+ 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"));
+ workflowResourceIds.setInstanceGroupId((String) execution.getVariable("instanceGroupId"));
+ return workflowResourceIds;
+ }
- 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 Resource extractResourceIdAndTypeFromUri(String uri) {
+ Pattern patt = Pattern.compile(
+ "[vV]\\d+.*?(?:(?:/(?<type>" + supportedTypes + ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?)?$");
+ Matcher m = patt.matcher(uri);
+ Boolean generated = false;
- 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"));
- workflowResourceIds.setInstanceGroupId((String) execution.getVariable("instanceGroupId"));
- return workflowResourceIds;
- }
+ if (m.find()) {
+ logger.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(SERVICE_INSTANCES) && (id == null || id.equals("assign"))) {
+ id = UUID.randomUUID().toString();
+ generated = true;
+ } else if (type.equals(VF_MODULES) && id.equals("scaleOut")) {
+ 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 Resource extractResourceIdAndTypeFromUri(String uri) {
- Pattern patt = Pattern.compile(
- "[vV]\\d+.*?(?:(?:/(?<type>" + supportedTypes + ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?)?$");
- Matcher m = patt.matcher(uri);
- Boolean generated = false;
+ 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<ServiceInstance> serviceInstanceAAI =
+ bbInputSetupUtils.getAAIServiceInstanceByName(globalCustomerId, serviceType, instanceName);
+ if (serviceInstanceAAI.isPresent()) {
+ return serviceInstanceAAI.get().getServiceInstanceId();
+ }
+ }
+ } else if ("NETWORK".equalsIgnoreCase(type.toString())) {
+ Optional<L3Network> network = bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance(
+ workflowResourceIds.getServiceInstanceId(), instanceName);
+ if (network.isPresent()) {
+ return network.get().getNetworkId();
+ }
+ } else if ("VNF".equalsIgnoreCase(type.toString())) {
+ Optional<GenericVnf> 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> 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<VolumeGroup> volumeGroupFromVfModule =
+ bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnf.getVnfId(),
+ vfModule.getVfModuleId(), instanceName);
+ if (volumeGroupFromVfModule.isPresent()) {
+ return volumeGroupFromVfModule.get().getVolumeGroupId();
+ }
+ }
+ }
+ }
+ return generatedResourceId;
+ } catch (Exception ex) {
+ logger.error(WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI, ex);
+ throw new IllegalStateException(
+ WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI);
+ }
+ }
- if (m.find()) {
- logger.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(SERVICE_INSTANCES) && (id == null || id.equals("assign"))) {
- id = UUID.randomUUID().toString();
- generated = true;
- }else if (type.equals(VF_MODULES) && id.equals("scaleOut")) {
- 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 convertTypeFromPlural(String type) {
+ if (!type.matches(supportedTypes)) {
+ return type;
+ } else {
+ if (type.equals(SERVICE_INSTANCES)) {
+ return SERVICE;
+ } else {
+ return type.substring(0, 1).toUpperCase() + type.substring(1, type.length() - 1);
+ }
+ }
+ }
- 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<ServiceInstance> serviceInstanceAAI = bbInputSetupUtils
- .getAAIServiceInstanceByName(globalCustomerId, serviceType, instanceName);
- if (serviceInstanceAAI.isPresent()) {
- return serviceInstanceAAI.get().getServiceInstanceId();
- }
- }
- } else if ("NETWORK".equalsIgnoreCase(type.toString())) {
- Optional<L3Network> network = bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance(
- workflowResourceIds.getServiceInstanceId(), instanceName);
- if (network.isPresent()) {
- return network.get().getNetworkId();
- }
- } else if ("VNF".equalsIgnoreCase(type.toString())) {
- Optional<GenericVnf> 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> 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<VolumeGroup> volumeGroupFromVfModule = bbInputSetupUtils
- .getRelatedVolumeGroupByNameFromVfModule(vnf.getVnfId(), vfModule.getVfModuleId(), instanceName);
- if (volumeGroupFromVfModule.isPresent()) {
- return volumeGroupFromVfModule.get().getVolumeGroupId();
- }
- }
- }
- }
- return generatedResourceId;
- } catch (Exception ex) {
- logger.error(WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI, ex);
- throw new IllegalStateException(
- WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI);
- }
- }
+ protected List<ExecuteBuildingBlock> sortExecutionPathByObjectForVlanTagging(List<ExecuteBuildingBlock> orchFlows,
+ String requestAction) {
+ List<ExecuteBuildingBlock> sortedOrchFlows = new ArrayList<>();
+ if (requestAction.equals(CREATEINSTANCE)) {
+ for (ExecuteBuildingBlock ebb : orchFlows) {
+ if (ebb.getBuildingBlock().getBpmnFlowName().equals("AssignNetworkBB")) {
+ String key = ebb.getBuildingBlock().getKey();
+ boolean isVirtualLink = Boolean.TRUE.equals(ebb.getBuildingBlock().getIsVirtualLink());
+ String virtualLinkKey = ebb.getBuildingBlock().getVirtualLinkKey();
+ sortedOrchFlows.add(ebb);
+ for (ExecuteBuildingBlock ebb2 : orchFlows) {
+ if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
+ && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) {
+ sortedOrchFlows.add(ebb2);
+ break;
+ }
+ if (isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
+ && ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) {
+ sortedOrchFlows.add(ebb2);
+ break;
+ }
+ }
+ for (ExecuteBuildingBlock ebb2 : orchFlows) {
+ if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")
+ && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) {
+ sortedOrchFlows.add(ebb2);
+ break;
+ }
+ if (isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")
+ && ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) {
+ 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 String convertTypeFromPlural(String type) {
- if (!type.matches(supportedTypes)) {
- return type;
- } else {
- if (type.equals(SERVICE_INSTANCES)) {
- return SERVICE;
- } else {
- return type.substring(0, 1).toUpperCase() + type.substring(1, type.length() - 1);
- }
- }
- }
+ protected List<ExecuteBuildingBlock> buildExecuteBuildingBlockList(List<OrchestrationFlow> orchFlows,
+ List<Resource> resourceCounter, String requestId, String apiVersion, String resourceId,
+ WorkflowType resourceType, String requestAction, boolean aLaCarte, String vnfType,
+ WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails) {
+ List<ExecuteBuildingBlock> 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),
+ apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds,
+ requestDetails, false, null, 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),
+ apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds,
+ requestDetails, false, null, 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),
+ apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds,
+ requestDetails, false, null, false));
+ }
+ for (int i = 0; i < resourceCounter.stream()
+ .filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType()).collect(Collectors.toList())
+ .size(); i++) {
+ Resource resource =
+ resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType())
+ .collect(Collectors.toList()).get(i);
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true,
+ resource.getVirtualLinkKey(), false));
+ }
+ } else if (orchFlow.getFlowName().contains(VFMODULE)) {
+ List<Resource> vfModuleResourcesSorted = null;
+ if (requestAction.equals("createInstance") || requestAction.equals("assignInstance")
+ || requestAction.equals("activateInstance")) {
+ vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream()
+ .filter(x -> WorkflowType.VFMODULE == x.getResourceType()).collect(Collectors.toList()));
+ } else {
+ vfModuleResourcesSorted = sortVfModulesByBaseLast(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),
+ apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds,
+ requestDetails, false, null, 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),
+ apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds,
+ requestDetails, false, null, 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),
+ apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds,
+ requestDetails, false, null, false));
+ }
+ } else if (orchFlow.getFlowName().contains(CONFIGURATION)) {
+ for (int i = 0; i < resourceCounter.stream()
+ .filter(x -> WorkflowType.CONFIGURATION == x.getResourceType()).collect(Collectors.toList())
+ .size(); i++) {
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId,
+ resourceCounter.stream().filter(x -> WorkflowType.CONFIGURATION == x.getResourceType())
+ .collect(Collectors.toList()).get(i),
+ apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds,
+ requestDetails, false, null, true));
+ }
+ } else {
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
+ }
+ }
+ return flowsToExecute;
+ }
- protected List<ExecuteBuildingBlock> sortExecutionPathByObjectForVlanTagging(List<ExecuteBuildingBlock> orchFlows,
- String requestAction) {
- List<ExecuteBuildingBlock> sortedOrchFlows = new ArrayList<>();
- if (requestAction.equals(CREATEINSTANCE)) {
- for (ExecuteBuildingBlock ebb : orchFlows) {
- if (ebb.getBuildingBlock().getBpmnFlowName().equals("AssignNetworkBB")) {
- String key = ebb.getBuildingBlock().getKey();
- boolean isVirtualLink = Boolean.TRUE.equals(ebb.getBuildingBlock().getIsVirtualLink());
- String virtualLinkKey = ebb.getBuildingBlock().getVirtualLinkKey();
- sortedOrchFlows.add(ebb);
- for (ExecuteBuildingBlock ebb2 : orchFlows) {
- if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
- && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) {
- sortedOrchFlows.add(ebb2);
- break;
- }
- if(isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
- && ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) {
- sortedOrchFlows.add(ebb2);
- break;
- }
- }
- for (ExecuteBuildingBlock ebb2 : orchFlows) {
- if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")
- && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) {
- sortedOrchFlows.add(ebb2);
- break;
- }
- if(isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")
- && ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) {
- 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 ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId,
+ Resource resource, String apiVersion, String resourceId, String requestAction, boolean aLaCarte,
+ String vnfType, WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails,
+ boolean isVirtualLink, String virtualLinkKey, boolean isConfiguration) {
+ ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
+ BuildingBlock buildingBlock = new BuildingBlock();
+ buildingBlock.setBpmnFlowName(orchFlow.getFlowName());
+ buildingBlock.setMsoId(UUID.randomUUID().toString());
+ if (resource == null) {
+ buildingBlock.setKey("");
+ } else {
+ buildingBlock.setKey(resource.getResourceId());
+ }
+ buildingBlock.setIsVirtualLink(isVirtualLink);
+ buildingBlock.setVirtualLinkKey(virtualLinkKey);
+ 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);
+ if (resource != null && (isConfiguration || resource.getResourceType().equals(WorkflowType.CONFIGURATION))) {
+ ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
+ if (resource != null) {
+ configurationResourceKeys.setCvnfcCustomizationUUID(resource.getCvnfModuleCustomizationId());
+ configurationResourceKeys.setVfModuleCustomizationUUID(resource.getVfModuleCustomizationId());
+ configurationResourceKeys.setVnfResourceCustomizationUUID(resource.getVnfCustomizationId());
+ }
+ executeBuildingBlock.setConfigurationResourceKeys(configurationResourceKeys);
+ }
+ return executeBuildingBlock;
+ }
- protected List<ExecuteBuildingBlock> buildExecuteBuildingBlockList(List<OrchestrationFlow> orchFlows,
- List<Resource> resourceCounter, String requestId, String apiVersion, String resourceId, WorkflowType resourceType,
- String requestAction, boolean aLaCarte, String vnfType,
- WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails) {
- List<ExecuteBuildingBlock> 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), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, 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), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, 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), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
- }
- for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
- Resource resource = resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType())
- .collect(Collectors.toList()).get(i);
- flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true, resource.getVirtualLinkKey(), false));
- }
- } else if (orchFlow.getFlowName().contains(VFMODULE)) {
- List<Resource> vfModuleResourcesSorted = null;
- if(requestAction.equals("createInstance")||requestAction.equals("assignInstance")||requestAction.equals("activateInstance")){
- vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType())
- .collect(Collectors.toList()));
- }else{
- vfModuleResourcesSorted = sortVfModulesByBaseLast(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), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, 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), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, 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), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
- }
- } else if (orchFlow.getFlowName().contains(CONFIGURATION)) {
- for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.CONFIGURATION == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
- flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.CONFIGURATION == x.getResourceType())
- .collect(Collectors.toList()).get(i), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, true));
- }
- }else {
- flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
- }
- }
- return flowsToExecute;
- }
+ protected List<OrchestrationFlow> queryNorthBoundRequestCatalogDb(DelegateExecution execution, String requestAction,
+ WorkflowType resourceName, boolean aLaCarte, String cloudOwner) {
+ return this.queryNorthBoundRequestCatalogDb(execution, requestAction, resourceName, aLaCarte, cloudOwner, "");
+ }
- protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId, Resource resource,
- String apiVersion, String resourceId, String requestAction, boolean aLaCarte, String vnfType,
- WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean isVirtualLink, String virtualLinkKey, boolean isConfiguration) {
- ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
- BuildingBlock buildingBlock = new BuildingBlock();
- buildingBlock.setBpmnFlowName(orchFlow.getFlowName());
- buildingBlock.setMsoId(UUID.randomUUID().toString());
- if(resource == null){
- buildingBlock.setKey("");
- }else{
- buildingBlock.setKey(resource.getResourceId());
- }
- buildingBlock.setIsVirtualLink(isVirtualLink);
- buildingBlock.setVirtualLinkKey(virtualLinkKey);
- 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);
- if(resource != null && (isConfiguration || resource.getResourceType().equals(WorkflowType.CONFIGURATION))){
- ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
- if (resource != null){
- configurationResourceKeys.setCvnfcCustomizationUUID(resource.getCvnfModuleCustomizationId());
- configurationResourceKeys.setVfModuleCustomizationUUID(resource.getVfModuleCustomizationId());
- configurationResourceKeys.setVnfResourceCustomizationUUID(resource.getVnfCustomizationId());
- }
- executeBuildingBlock.setConfigurationResourceKeys(configurationResourceKeys);
- }
- return executeBuildingBlock;
- }
+ protected List<OrchestrationFlow> queryNorthBoundRequestCatalogDb(DelegateExecution execution, String requestAction,
+ WorkflowType resourceName, boolean aLaCarte, String cloudOwner, String serviceType) {
+ List<OrchestrationFlow> listToExecute = new ArrayList<>();
+ NorthBoundRequest northBoundRequest = null;
+ if (serviceType.equalsIgnoreCase(SERVICE_TYPE_TRANSPORT)) {
+ northBoundRequest =
+ catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwnerAndServiceType(
+ requestAction, resourceName.toString(), aLaCarte, cloudOwner, serviceType);
+ } else {
+ northBoundRequest = catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(
+ requestAction, resourceName.toString(), aLaCarte, cloudOwner);
+ }
+ 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<OrchestrationFlow> flows = northBoundRequest.getOrchestrationFlowList();
+ if (flows == null)
+ flows = new ArrayList<>();
+ for (OrchestrationFlow flow : flows) {
+ if (!flow.getFlowName().contains("BB")) {
+ List<OrchestrationFlow> macroQueryFlows =
+ catalogDbClient.getOrchestrationFlowByAction(flow.getFlowName());
+ for (OrchestrationFlow macroFlow : macroQueryFlows) {
+ listToExecute.add(macroFlow);
+ }
+ } else {
+ listToExecute.add(flow);
+ }
+ }
+ }
+ return listToExecute;
+ }
- protected List<OrchestrationFlow> queryNorthBoundRequestCatalogDb(DelegateExecution execution, String requestAction,
- WorkflowType resourceName, boolean aLaCarte, String cloudOwner) {
- return this.queryNorthBoundRequestCatalogDb(execution, requestAction, resourceName, aLaCarte, cloudOwner, "");
- }
-
- protected List<OrchestrationFlow> queryNorthBoundRequestCatalogDb(DelegateExecution execution, String requestAction,
- WorkflowType resourceName, boolean aLaCarte, String cloudOwner, String serviceType) {
- List<OrchestrationFlow> listToExecute = new ArrayList<>();
- NorthBoundRequest northBoundRequest = null;
- if (serviceType.equalsIgnoreCase(SERVICE_TYPE_TRANSPORT)) {
- northBoundRequest = catalogDbClient
- .getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwnerAndServiceType(requestAction,
- resourceName.toString(), aLaCarte, cloudOwner, serviceType);
- } else {
- northBoundRequest = catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(
- requestAction, resourceName.toString(), aLaCarte, cloudOwner);
- }
- 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<OrchestrationFlow> flows = northBoundRequest.getOrchestrationFlowList();
- if (flows == null)
- flows = new ArrayList<>();
- for (OrchestrationFlow flow : flows) {
- if (!flow.getFlowName().contains("BB")) {
- List<OrchestrationFlow> 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) {
+ logger.error(msg, ex);
+ execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
- protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
- logger.error(msg, ex);
- execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
- }
+ protected void buildAndThrowException(DelegateExecution execution, String msg) {
+ logger.error(msg);
+ execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
- protected void buildAndThrowException(DelegateExecution execution, String msg) {
- logger.error(msg);
- execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
- }
-
- public void handleRuntimeException (DelegateExecution execution){
- StringBuilder wfeExpMsg = new StringBuilder("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();
- logger.error(runtimeErrorMessage);
- execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, runtimeErrorMessage);
- } catch (Exception e){
- logger.error("Runtime error", e);
- //if runtime message was mulformed
- runtimeErrorMessage = "Runtime error";
- }
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, runtimeErrorMessage);
- }
+ public void handleRuntimeException(DelegateExecution execution) {
+ StringBuilder wfeExpMsg = new StringBuilder("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();
+ logger.error(runtimeErrorMessage);
+ execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, runtimeErrorMessage);
+ } catch (Exception e) {
+ logger.error("Runtime error", 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/WorkflowActionBBFailure.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
index 1812e50328..4fc4d85b97 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
import java.util.Optional;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.core.WorkflowException;
@@ -36,113 +35,115 @@ import org.springframework.stereotype.Component;
@Component
public class WorkflowActionBBFailure {
- private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBFailure.class);
- @Autowired
- private RequestsDbClient requestDbclient;
- @Autowired
- private WorkflowAction workflowAction;
-
- protected void updateRequestErrorStatusMessage(DelegateExecution execution) {
- try {
- String requestId = (String) execution.getVariable("mso-request-id");
- InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
- String errorMsg = "";
- Optional<String> errorMsgOp = retrieveErrorMessage(execution);
- if(errorMsgOp.isPresent()){
- errorMsg = errorMsgOp.get();
- }else{
- errorMsg = "Failed to determine error message";
- }
- request.setStatusMessage(errorMsg);
- requestDbclient.updateInfraActiveRequests(request);
- } catch (Exception e) {
- logger.error("Failed to update Request db with the status message after retry or rollback has been initialized.",e);
- }
- }
-
- public void updateRequestStatusToFailed(DelegateExecution execution) {
- try {
- String requestId = (String) execution.getVariable("mso-request-id");
- InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
- String rollbackErrorMsg = "";
- String errorMsg = "";
- Boolean rollbackCompletedSuccessfully = (Boolean) execution.getVariable("isRollbackComplete");
- Boolean isRollbackFailure = (Boolean) execution.getVariable("isRollback");
- ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock");
- if(rollbackCompletedSuccessfully==null)
- rollbackCompletedSuccessfully = false;
-
- if(isRollbackFailure==null)
- isRollbackFailure = false;
-
- if(rollbackCompletedSuccessfully){
- rollbackErrorMsg = "Rollback has been completed successfully.";
- request.setRollbackStatusMessage(rollbackErrorMsg);
- execution.setVariable("RollbackErrorMessage", rollbackErrorMsg);
- }else if(isRollbackFailure){
- Optional<String> rollbackErrorMsgOp = retrieveErrorMessage(execution);
- if(rollbackErrorMsgOp.isPresent()){
- rollbackErrorMsg = rollbackErrorMsgOp.get();
- }else{
- rollbackErrorMsg = "Failed to determine rollback error message.";
- }
- request.setRollbackStatusMessage(rollbackErrorMsg);
- execution.setVariable("RollbackErrorMessage", rollbackErrorMsg);
- }else{
- Optional<String> errorMsgOp = retrieveErrorMessage(execution);
- if(errorMsgOp.isPresent()){
- errorMsg = errorMsgOp.get();
- }else{
- errorMsg = "Failed to determine error message";
- }
- request.setStatusMessage(errorMsg);
- execution.setVariable("ErrorMessage", errorMsg);
- }
- if(ebb!=null && ebb.getBuildingBlock()!=null){
- String flowStatus = "";
- if(rollbackCompletedSuccessfully){
- flowStatus = "All Rollback flows have completed successfully";
- }else{
- flowStatus = ebb.getBuildingBlock().getBpmnFlowName() + " has failed.";
- }
- request.setFlowStatus(flowStatus);
- execution.setVariable("flowStatus", flowStatus);
- }
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBFailure.class);
+ @Autowired
+ private RequestsDbClient requestDbclient;
+ @Autowired
+ private WorkflowAction workflowAction;
+
+ protected void updateRequestErrorStatusMessage(DelegateExecution execution) {
+ try {
+ String requestId = (String) execution.getVariable("mso-request-id");
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ String errorMsg = "";
+ Optional<String> errorMsgOp = retrieveErrorMessage(execution);
+ if (errorMsgOp.isPresent()) {
+ errorMsg = errorMsgOp.get();
+ } else {
+ errorMsg = "Failed to determine error message";
+ }
+ request.setStatusMessage(errorMsg);
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception e) {
+ logger.error(
+ "Failed to update Request db with the status message after retry or rollback has been initialized.",
+ e);
+ }
+ }
+
+ public void updateRequestStatusToFailed(DelegateExecution execution) {
+ try {
+ String requestId = (String) execution.getVariable("mso-request-id");
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ String rollbackErrorMsg = "";
+ String errorMsg = "";
+ Boolean rollbackCompletedSuccessfully = (Boolean) execution.getVariable("isRollbackComplete");
+ Boolean isRollbackFailure = (Boolean) execution.getVariable("isRollback");
+ ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock");
+ if (rollbackCompletedSuccessfully == null)
+ rollbackCompletedSuccessfully = false;
+
+ if (isRollbackFailure == null)
+ isRollbackFailure = false;
+
+ if (rollbackCompletedSuccessfully) {
+ rollbackErrorMsg = "Rollback has been completed successfully.";
+ request.setRollbackStatusMessage(rollbackErrorMsg);
+ execution.setVariable("RollbackErrorMessage", rollbackErrorMsg);
+ } else if (isRollbackFailure) {
+ Optional<String> rollbackErrorMsgOp = retrieveErrorMessage(execution);
+ if (rollbackErrorMsgOp.isPresent()) {
+ rollbackErrorMsg = rollbackErrorMsgOp.get();
+ } else {
+ rollbackErrorMsg = "Failed to determine rollback error message.";
+ }
+ request.setRollbackStatusMessage(rollbackErrorMsg);
+ execution.setVariable("RollbackErrorMessage", rollbackErrorMsg);
+ } else {
+ Optional<String> errorMsgOp = retrieveErrorMessage(execution);
+ if (errorMsgOp.isPresent()) {
+ errorMsg = errorMsgOp.get();
+ } else {
+ errorMsg = "Failed to determine error message";
+ }
+ request.setStatusMessage(errorMsg);
+ execution.setVariable("ErrorMessage", errorMsg);
+ }
+ if (ebb != null && ebb.getBuildingBlock() != null) {
+ String flowStatus = "";
+ if (rollbackCompletedSuccessfully) {
+ flowStatus = "All Rollback flows have completed successfully";
+ } else {
+ flowStatus = ebb.getBuildingBlock().getBpmnFlowName() + " has failed.";
+ }
+ request.setFlowStatus(flowStatus);
+ execution.setVariable("flowStatus", flowStatus);
+ }
+
+ request.setProgress(Long.valueOf(100));
+ request.setRequestStatus("FAILED");
+ request.setLastModifiedBy("CamundaBPMN");
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception e) {
+ workflowAction.buildAndThrowException(execution, "Error Updating Request Database", e);
+ }
+ }
+
+ private Optional<String> retrieveErrorMessage(DelegateExecution execution) {
+ String errorMsg = "";
+ try {
+ WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
+ if (exception != null && (exception.getErrorMessage() != null || !exception.getErrorMessage().equals(""))) {
+ errorMsg = exception.getErrorMessage();
+ }
+ if (errorMsg == null || errorMsg.equals("")) {
+ errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage");
+ }
+ return Optional.of(errorMsg);
+ } catch (Exception ex) {
+ logger.error("Failed to extract workflow exception from execution.", ex);
+ }
+ return Optional.empty();
+ }
- request.setProgress(Long.valueOf(100));
- request.setRequestStatus("FAILED");
- request.setLastModifiedBy("CamundaBPMN");
- requestDbclient.updateInfraActiveRequests(request);
- } catch (Exception e) {
- workflowAction.buildAndThrowException(execution, "Error Updating Request Database", e);
- }
- }
-
- private Optional<String> retrieveErrorMessage (DelegateExecution execution){
- String errorMsg = "";
- try {
- WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
- if(exception != null && (exception.getErrorMessage()!=null || !exception.getErrorMessage().equals(""))){
- errorMsg = exception.getErrorMessage();
- }
- if(errorMsg == null || errorMsg.equals("")){
- errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage");
- }
- return Optional.of(errorMsg);
- } catch (Exception ex) {
- logger.error("Failed to extract workflow exception from execution.",ex);
- }
- return Optional.empty();
- }
-
- public void updateRequestStatusToFailedWithRollback(DelegateExecution execution) {
- execution.setVariable("isRollbackComplete", true);
- updateRequestStatusToFailed(execution);
- }
+ public void updateRequestStatusToFailedWithRollback(DelegateExecution execution) {
+ execution.setVariable("isRollbackComplete", true);
+ updateRequestStatusToFailed(execution);
+ }
- public void abortCallErrorHandling(DelegateExecution execution) {
- String msg = "Flow has failed. Rainy day handler has decided to abort the process.";
- logger.error(msg);
- throw new BpmnError(msg);
- }
+ public void abortCallErrorHandling(DelegateExecution execution) {
+ String msg = "Flow has failed. Rainy day handler has decided to abort the process.";
+ logger.error(msg);
+ throw new BpmnError(msg);
+ }
}
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
index a327f0670a..4514d24c54 100644
--- 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
@@ -24,9 +24,7 @@ import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
-
import javax.persistence.EntityNotFoundException;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.aai.domain.yang.Vnfc;
import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse;
@@ -49,382 +47,394 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
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 String RETRY_COUNT = "retryCount";
- private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
- private static final String ASSIGN_FABRIC_CONFIGURATION_BB = "AssignFabricConfigurationBB";
- private static final String ACTIVATE_FABRIC_CONFIGURATION_BB = "ActivateFabricConfigurationBB";
- protected String maxRetries = "mso.rainyDay.maxRetries";
- private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class);
+ 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 String RETRY_COUNT = "retryCount";
+ private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
+ private static final String ASSIGN_FABRIC_CONFIGURATION_BB = "AssignFabricConfigurationBB";
+ private static final String ACTIVATE_FABRIC_CONFIGURATION_BB = "ActivateFabricConfigurationBB";
+ protected String maxRetries = "mso.rainyDay.maxRetries";
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class);
+
+ @Autowired
+ private RequestsDbClient requestDbclient;
+ @Autowired
+ private WorkflowAction workflowAction;
+ @Autowired
+ private WorkflowActionBBFailure workflowActionBBFailure;
+ @Autowired
+ private Environment environment;
+ @Autowired
+ private BBInputSetupUtils bbInputSetupUtils;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+
+ public void selectBB(DelegateExecution execution) {
+ List<ExecuteBuildingBlock> flowsToExecute =
+ (List<ExecuteBuildingBlock>) 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 updateFlowStatistics(DelegateExecution execution) {
+ try {
+ int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ if (currentSequence > 1) {
+ InfraActiveRequests request = this.getUpdatedRequest(execution, currentSequence);
+ requestDbclient.updateInfraActiveRequests(request);
+ }
+ } catch (Exception ex) {
+ logger.warn(
+ "Bpmn Flow Statistics was unable to update Request Db with the new completion percentage. Competion percentage may be invalid.");
+ }
+ }
+
+ protected InfraActiveRequests getUpdatedRequest(DelegateExecution execution, int currentSequence) {
+ List<ExecuteBuildingBlock> flowsToExecute =
+ (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ ExecuteBuildingBlock completedBB = flowsToExecute.get(currentSequence - 2);
+ ExecuteBuildingBlock nextBB = flowsToExecute.get(currentSequence - 1);
+ int completedBBs = currentSequence - 1;
+ int totalBBs = flowsToExecute.size();
+ int remainingBBs = totalBBs - completedBBs;
+ String statusMessage = this.getStatusMessage(completedBB.getBuildingBlock().getBpmnFlowName(),
+ nextBB.getBuildingBlock().getBpmnFlowName(), completedBBs, remainingBBs);
+ Long percentProgress = this.getPercentProgress(completedBBs, totalBBs);
+ request.setFlowStatus(statusMessage);
+ request.setProgress(percentProgress);
+ request.setLastModifiedBy("CamundaBPMN");
+ return request;
+ }
+
+ protected Long getPercentProgress(int completedBBs, int totalBBs) {
+ double ratio = (completedBBs / (totalBBs * 1.0));
+ int percentProgress = (int) (ratio * 95);
+ return new Long(percentProgress + 5);
+ }
+
+ protected String getStatusMessage(String completedBB, String nextBB, int completedBBs, int remainingBBs) {
+ return "Execution of " + completedBB + " has completed successfully, next invoking " + nextBB
+ + " (Execution Path progress: BBs completed = " + completedBBs + "; BBs remaining = " + remainingBBs
+ + ").";
+ }
+
+ 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);
+ logger.info("Successfully sent sync ack.");
+ updateInstanceId(execution);
+ }
+
+ 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 =
+ "<aetgt:WorkflowException xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\"><aetgt:ErrorMessage>"
+ + errorMsg
+ + "</aetgt:ErrorMessage><aetgt:ErrorCode>7000</aetgt:ErrorCode></aetgt:WorkflowException>";
+ 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) {
+ logger.error(" Sending Sync Error Activity Failed. {}", ex.getMessage(), ex);
+ }
+ }
+
+ public void updateRequestStatusToComplete(DelegateExecution execution) {
+ try {
+ final String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ final String action = (String) execution.getVariable(G_ACTION);
+ final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
+ final String resourceName = (String) execution.getVariable("resourceName");
+ String macroAction = "";
+ if (aLaCarte) {
+ macroAction = "ALaCarte-" + resourceName + "-" + action + " request was executed correctly.";
+ } else {
+ macroAction = "Macro-" + resourceName + "-" + action + " request was executed correctly.";
+ }
+ execution.setVariable("finalStatusMessage", macroAction);
+ Timestamp endTime = new Timestamp(System.currentTimeMillis());
+ request.setEndTime(endTime);
+ request.setFlowStatus("Successfully completed all Building Blocks");
+ request.setStatusMessage(macroAction);
+ request.setProgress(Long.valueOf(100));
+ request.setRequestStatus("COMPLETE");
+ request.setLastModifiedBy("CamundaBPMN");
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception ex) {
+ workflowAction.buildAndThrowException(execution, "Error Updating Request Database", ex);
+ }
+ }
+
+ public void checkRetryStatus(DelegateExecution execution) {
+ String handlingCode = (String) execution.getVariable("handlingCode");
+ String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ String retryDuration = (String) execution.getVariable("RetryDuration");
+ int retryCount = (int) execution.getVariable(RETRY_COUNT);
+ int envMaxRetries;
+ try {
+ envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries));
+ } catch (Exception ex) {
+ logger.error("Could not read maxRetries from config file. Setting max to 5 retries");
+ envMaxRetries = 5;
+ }
+ int nextCount = retryCount + 1;
+ if (handlingCode.equals("Retry")) {
+ workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
+ try {
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ request.setRetryStatusMessage(
+ "Retry " + nextCount + "/" + envMaxRetries + " will be started in " + retryDuration);
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception ex) {
+ logger.warn("Failed to update Request Db Infra Active Requests with Retry Status", ex);
+ }
+ if (retryCount < envMaxRetries) {
+ int currSequence = (int) execution.getVariable("gCurrentSequence");
+ execution.setVariable("gCurrentSequence", currSequence - 1);
+ execution.setVariable(RETRY_COUNT, nextCount);
+ } else {
+ workflowAction.buildAndThrowException(execution,
+ "Exceeded maximum retries. Ending flow with status Abort");
+ }
+ } else {
+ execution.setVariable(RETRY_COUNT, 0);
+ }
+ }
+
+ /**
+ * Rollback will only handle Create/Activate/Assign Macro flows. Execute layer will rollback the flow its currently
+ * working on.
+ */
+ public void rollbackExecutionPath(DelegateExecution execution) {
+ if (!(boolean) execution.getVariable("isRollback")) {
+ List<ExecuteBuildingBlock> flowsToExecute =
+ (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ List<ExecuteBuildingBlock> rollbackFlows = new ArrayList();
+ int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ int listSize = flowsToExecute.size();
+ for (int i = listSize - 1; i >= 0; i--) {
+ if (i > currentSequence - 1) {
+ flowsToExecute.remove(i);
+ } else {
+ String flowName = flowsToExecute.get(i).getBuildingBlock().getBpmnFlowName();
+ if (flowName.contains("Assign")) {
+ flowName = "Unassign" + flowName.substring(6, 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());
+ } else {
+ continue;
+ }
+ flowsToExecute.get(i).getBuildingBlock().setBpmnFlowName(flowName);
+ rollbackFlows.add(flowsToExecute.get(i));
+ }
+ }
- @Autowired
- private RequestsDbClient requestDbclient;
- @Autowired
- private WorkflowAction workflowAction;
- @Autowired
- private WorkflowActionBBFailure workflowActionBBFailure;
- @Autowired
- private Environment environment;
- @Autowired
- private BBInputSetupUtils bbInputSetupUtils;
- @Autowired
- private CatalogDbClient catalogDbClient;
-
- public void selectBB(DelegateExecution execution) {
- List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) 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 updateFlowStatistics(DelegateExecution execution) {
- try{
- int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
- if(currentSequence > 1) {
- InfraActiveRequests request = this.getUpdatedRequest(execution, currentSequence);
- requestDbclient.updateInfraActiveRequests(request);
- }
- }catch (Exception ex){
- logger.warn("Bpmn Flow Statistics was unable to update Request Db with the new completion percentage. Competion percentage may be invalid.");
- }
- }
+ String handlingCode = (String) execution.getVariable("handlingCode");
+ List<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>();
+ rollbackFlowsFiltered.addAll(rollbackFlows);
+ if (handlingCode.equals("RollbackToAssigned") || handlingCode.equals("RollbackToCreated")) {
+ for (int i = 0; i < rollbackFlows.size(); i++) {
+ if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign")) {
+ rollbackFlowsFiltered.remove(rollbackFlows.get(i));
+ } else if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Delete")
+ && handlingCode.equals("RollbackToCreated")) {
+ rollbackFlowsFiltered.remove(rollbackFlows.get(i));
+ }
+ }
+ }
- protected InfraActiveRequests getUpdatedRequest(DelegateExecution execution, int currentSequence) {
- List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution
- .getVariable("flowsToExecute");
- String requestId = (String) execution.getVariable(G_REQUEST_ID);
- InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
- ExecuteBuildingBlock completedBB = flowsToExecute.get(currentSequence - 2);
- ExecuteBuildingBlock nextBB = flowsToExecute.get(currentSequence - 1);
- int completedBBs = currentSequence - 1;
- int totalBBs = flowsToExecute.size();
- int remainingBBs = totalBBs - completedBBs;
- String statusMessage = this.getStatusMessage(completedBB.getBuildingBlock().getBpmnFlowName(),
- nextBB.getBuildingBlock().getBpmnFlowName(), completedBBs, remainingBBs);
- Long percentProgress = this.getPercentProgress(completedBBs, totalBBs);
- request.setFlowStatus(statusMessage);
- request.setProgress(percentProgress);
- request.setLastModifiedBy("CamundaBPMN");
- return request;
- }
-
- protected Long getPercentProgress(int completedBBs, int totalBBs) {
- double ratio = (completedBBs / (totalBBs * 1.0));
- int percentProgress = (int) (ratio * 95);
- return new Long(percentProgress + 5);
- }
-
- protected String getStatusMessage(String completedBB, String nextBB, int completedBBs, int remainingBBs) {
- return "Execution of " + completedBB + " has completed successfully, next invoking " + nextBB
- + " (Execution Path progress: BBs completed = " + completedBBs + "; BBs remaining = " + remainingBBs
- + ").";
- }
+ workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
- 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);
- logger.info("Successfully sent sync ack.");
- updateInstanceId(execution);
- }
+ if (rollbackFlows.isEmpty())
+ execution.setVariable("isRollbackNeeded", false);
+ else
+ execution.setVariable("isRollbackNeeded", true);
+ execution.setVariable("flowsToExecute", rollbackFlowsFiltered);
+ execution.setVariable("handlingCode", "PreformingRollback");
+ execution.setVariable("isRollback", true);
+ execution.setVariable("gCurrentSequence", 0);
+ execution.setVariable(RETRY_COUNT, 0);
+ } else {
+ workflowAction.buildAndThrowException(execution,
+ "Rollback has already been called. Cannot rollback a request that is currently in the rollback state.");
+ }
+ }
- 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 = "<aetgt:WorkflowException xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\"><aetgt:ErrorMessage>"
- + errorMsg
- + "</aetgt:ErrorMessage><aetgt:ErrorCode>7000</aetgt:ErrorCode></aetgt:WorkflowException>";
- 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) {
- logger.error(" Sending Sync Error Activity Failed. {}" , ex.getMessage(), ex);
- }
- }
+ protected void updateInstanceId(DelegateExecution execution) {
+ try {
+ String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ String resourceId = (String) execution.getVariable("resourceId");
+ WorkflowType resourceType = (WorkflowType) execution.getVariable("resourceType");
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ if (resourceType == WorkflowType.SERVICE) {
+ request.setServiceInstanceId(resourceId);
+ } else if (resourceType == WorkflowType.VNF) {
+ request.setVnfId(resourceId);
+ } else if (resourceType == WorkflowType.VFMODULE) {
+ request.setVfModuleId(resourceId);
+ } else if (resourceType == WorkflowType.VOLUMEGROUP) {
+ request.setVolumeGroupId(resourceId);
+ } else if (resourceType == WorkflowType.NETWORK) {
+ request.setNetworkId(resourceId);
+ } else if (resourceType == WorkflowType.CONFIGURATION) {
+ request.setConfigurationId(resourceId);
+ } else if (resourceType == WorkflowType.INSTANCE_GROUP) {
+ request.setInstanceGroupId(resourceId);
+ }
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception ex) {
+ workflowAction.buildAndThrowException(execution, "Failed to update Request db with instanceId");
+ }
+ }
- public void updateRequestStatusToComplete(DelegateExecution execution) {
- try{
- final String requestId = (String) execution.getVariable(G_REQUEST_ID);
- InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
- final String action = (String) execution.getVariable(G_ACTION);
- final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
- final String resourceName = (String) execution.getVariable("resourceName");
- String macroAction = "";
- if (aLaCarte) {
- macroAction = "ALaCarte-" + resourceName + "-" + action + " request was executed correctly.";
- } else {
- macroAction = "Macro-" + resourceName + "-" + action + " request was executed correctly.";
- }
- execution.setVariable("finalStatusMessage", macroAction);
- Timestamp endTime = new Timestamp(System.currentTimeMillis());
- request.setEndTime(endTime);
- request.setFlowStatus("Successfully completed all Building Blocks");
- request.setStatusMessage(macroAction);
- request.setProgress(Long.valueOf(100));
- request.setRequestStatus("COMPLETE");
- request.setLastModifiedBy("CamundaBPMN");
- requestDbclient.updateInfraActiveRequests(request);
- }catch (Exception ex) {
- workflowAction.buildAndThrowException(execution, "Error Updating Request Database", ex);
- }
- }
+ public void postProcessingExecuteBB(DelegateExecution execution) {
+ List<ExecuteBuildingBlock> flowsToExecute =
+ (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ String handlingCode = (String) execution.getVariable("handlingCode");
+ final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
+ int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1);
+ String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName();
+ if (bbFlowName.equalsIgnoreCase("ActivateVfModuleBB") && aLaCarte && handlingCode.equalsIgnoreCase("Success")) {
+ postProcessingExecuteBBActivateVfModule(execution, ebb, flowsToExecute);
+ }
+ }
- public void checkRetryStatus(DelegateExecution execution) {
- String handlingCode = (String) execution.getVariable("handlingCode");
- String requestId = (String) execution.getVariable(G_REQUEST_ID);
- String retryDuration = (String) execution.getVariable("RetryDuration");
- int retryCount = (int) execution.getVariable(RETRY_COUNT);
- int envMaxRetries;
- try{
- envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries));
- } catch (Exception ex) {
- logger.error("Could not read maxRetries from config file. Setting max to 5 retries");
- envMaxRetries = 5;
- }
- int nextCount = retryCount +1;
- if (handlingCode.equals("Retry")){
- workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
- try{
- InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
- request.setRetryStatusMessage("Retry " + nextCount + "/" + envMaxRetries + " will be started in " + retryDuration);
- requestDbclient.updateInfraActiveRequests(request);
- } catch(Exception ex){
- logger.warn("Failed to update Request Db Infra Active Requests with Retry Status",ex);
- }
- if(retryCount<envMaxRetries){
- int currSequence = (int) execution.getVariable("gCurrentSequence");
- execution.setVariable("gCurrentSequence", currSequence-1);
- execution.setVariable(RETRY_COUNT, nextCount);
- }else{
- workflowAction.buildAndThrowException(execution, "Exceeded maximum retries. Ending flow with status Abort");
- }
- }else{
- execution.setVariable(RETRY_COUNT, 0);
- }
- }
+ protected void postProcessingExecuteBBActivateVfModule(DelegateExecution execution, ExecuteBuildingBlock ebb,
+ List<ExecuteBuildingBlock> flowsToExecute) {
+ try {
+ String serviceInstanceId = ebb.getWorkflowResourceIds().getServiceInstanceId();
+ String vnfId = ebb.getWorkflowResourceIds().getVnfId();
+ String vfModuleId = ebb.getResourceId();
+ ebb.getWorkflowResourceIds().setVfModuleId(vfModuleId);
+ String serviceModelUUID =
+ bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId).getModelVersionId();
+ String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId();
+ String vfModuleCustomizationUUID =
+ bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId();
+ List<Vnfc> vnfcs =
+ workflowAction.getRelatedResourcesInVfModule(vnfId, vfModuleId, Vnfc.class, AAIObjectType.VNFC);
+ logger.debug("Vnfc Size: {}", vnfcs.size());
+ for (Vnfc vnfc : vnfcs) {
+ String modelCustomizationId = vnfc.getModelCustomizationId();
+ logger.debug("Processing Vnfc: {}", modelCustomizationId);
+ CvnfcConfigurationCustomization fabricConfig = catalogDbClient.getCvnfcCustomization(serviceModelUUID,
+ vnfCustomizationUUID, vfModuleCustomizationUUID, modelCustomizationId);
+ if (fabricConfig != null && fabricConfig.getConfigurationResource() != null
+ && fabricConfig.getConfigurationResource().getToscaNodeType() != null
+ && fabricConfig.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)) {
+ String configurationId = UUID.randomUUID().toString();
+ ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
+ configurationResourceKeys.setCvnfcCustomizationUUID(modelCustomizationId);
+ configurationResourceKeys.setVfModuleCustomizationUUID(vfModuleCustomizationUUID);
+ configurationResourceKeys.setVnfResourceCustomizationUUID(vnfCustomizationUUID);
+ configurationResourceKeys.setVnfcName(vnfc.getVnfcName());
+ ExecuteBuildingBlock assignConfigBB = getExecuteBBForConfig(ASSIGN_FABRIC_CONFIGURATION_BB, ebb,
+ configurationId, configurationResourceKeys);
+ ExecuteBuildingBlock activateConfigBB = getExecuteBBForConfig(ACTIVATE_FABRIC_CONFIGURATION_BB, ebb,
+ configurationId, configurationResourceKeys);
+ flowsToExecute.add(assignConfigBB);
+ flowsToExecute.add(activateConfigBB);
+ flowsToExecute.stream()
+ .forEach(executeBB -> logger.info("Flows to Execute After Post Processing: {}",
+ executeBB.getBuildingBlock().getBpmnFlowName()));
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("completed", false);
+ } else {
+ logger.debug("No cvnfcCustomization found for customizationId: " + modelCustomizationId);
+ }
+ }
+ } catch (EntityNotFoundException e) {
+ logger.debug(e.getMessage() + " Will not be running Fabric Config Building Blocks");
+ } catch (Exception e) {
+ String errorMessage = "Error occurred in post processing of Vf Module create";
+ execution.setVariable("handlingCode", "RollbackToCreated");
+ execution.setVariable("WorkflowActionErrorMessage", errorMessage);
+ logger.error(errorMessage, e);
+ }
+ }
- /**
- * Rollback will only handle Create/Activate/Assign Macro flows. Execute
- * layer will rollback the flow its currently working on.
- */
- public void rollbackExecutionPath(DelegateExecution execution) {
- if(!(boolean)execution.getVariable("isRollback")){
- List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution
- .getVariable("flowsToExecute");
- List<ExecuteBuildingBlock> rollbackFlows = new ArrayList();
- int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
- int listSize = flowsToExecute.size();
- for (int i = listSize - 1; i >= 0; i--) {
- if (i > currentSequence - 1) {
- flowsToExecute.remove(i);
- } else {
- String flowName = flowsToExecute.get(i).getBuildingBlock().getBpmnFlowName();
- if (flowName.contains("Assign")) {
- flowName = "Unassign" + flowName.substring(6, 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());
- }else{
- continue;
- }
- flowsToExecute.get(i).getBuildingBlock().setBpmnFlowName(flowName);
- rollbackFlows.add(flowsToExecute.get(i));
- }
- }
-
- String handlingCode = (String) execution.getVariable("handlingCode");
- List<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>();
- rollbackFlowsFiltered.addAll(rollbackFlows);
- if(handlingCode.equals("RollbackToAssigned") || handlingCode.equals("RollbackToCreated")){
- for(int i = 0; i<rollbackFlows.size(); i++){
- if(rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign")){
- rollbackFlowsFiltered.remove(rollbackFlows.get(i));
- } else if(rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Delete") && handlingCode.equals("RollbackToCreated")) {
- rollbackFlowsFiltered.remove(rollbackFlows.get(i));
- }
- }
- }
-
- workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
-
- if (rollbackFlows.isEmpty())
- execution.setVariable("isRollbackNeeded", false);
- else
- execution.setVariable("isRollbackNeeded", true);
- execution.setVariable("flowsToExecute", rollbackFlowsFiltered);
- execution.setVariable("handlingCode", "PreformingRollback");
- execution.setVariable("isRollback", true);
- execution.setVariable("gCurrentSequence", 0);
- execution.setVariable(RETRY_COUNT, 0);
- }else{
- workflowAction.buildAndThrowException(execution, "Rollback has already been called. Cannot rollback a request that is currently in the rollback state.");
- }
- }
-
- protected void updateInstanceId(DelegateExecution execution){
- try{
- String requestId = (String) execution.getVariable(G_REQUEST_ID);
- String resourceId = (String) execution.getVariable("resourceId");
- WorkflowType resourceType = (WorkflowType) execution.getVariable("resourceType");
- InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
- if(resourceType == WorkflowType.SERVICE){
- request.setServiceInstanceId(resourceId);
- }else if(resourceType == WorkflowType.VNF){
- request.setVnfId(resourceId);
- }else if(resourceType == WorkflowType.VFMODULE){
- request.setVfModuleId(resourceId);
- }else if(resourceType == WorkflowType.VOLUMEGROUP){
- request.setVolumeGroupId(resourceId);
- }else if(resourceType == WorkflowType.NETWORK){
- request.setNetworkId(resourceId);
- }else if(resourceType == WorkflowType.CONFIGURATION){
- request.setConfigurationId(resourceId);
- }else if(resourceType == WorkflowType.INSTANCE_GROUP){
- request.setInstanceGroupId(resourceId);
- }
- requestDbclient.updateInfraActiveRequests(request);
- }catch(Exception ex){
- workflowAction.buildAndThrowException(execution, "Failed to update Request db with instanceId");
- }
- }
-
- public void postProcessingExecuteBB(DelegateExecution execution) {
- List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution
- .getVariable("flowsToExecute");
- String handlingCode = (String) execution.getVariable("handlingCode");
- final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
- int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
- ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1);
- String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName();
- if(bbFlowName.equalsIgnoreCase("ActivateVfModuleBB") && aLaCarte && handlingCode.equalsIgnoreCase("Success")) {
- postProcessingExecuteBBActivateVfModule(execution, ebb, flowsToExecute);
- }
- }
-
- protected void postProcessingExecuteBBActivateVfModule(DelegateExecution execution,
- ExecuteBuildingBlock ebb, List<ExecuteBuildingBlock> flowsToExecute) {
- try {
- String serviceInstanceId = ebb.getWorkflowResourceIds().getServiceInstanceId();
- String vnfId = ebb.getWorkflowResourceIds().getVnfId();
- String vfModuleId = ebb.getResourceId();
- ebb.getWorkflowResourceIds().setVfModuleId(vfModuleId);
- String serviceModelUUID = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId).getModelVersionId();
- String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId();
- String vfModuleCustomizationUUID = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId();
- List<Vnfc> vnfcs = workflowAction.getRelatedResourcesInVfModule(vnfId, vfModuleId, Vnfc.class, AAIObjectType.VNFC);
- logger.debug("Vnfc Size: {}", vnfcs.size());
- for(Vnfc vnfc : vnfcs) {
- String modelCustomizationId = vnfc.getModelCustomizationId();
- logger.debug("Processing Vnfc: {}", modelCustomizationId);
- CvnfcConfigurationCustomization fabricConfig =
- catalogDbClient.getCvnfcCustomization(serviceModelUUID,vnfCustomizationUUID,
- vfModuleCustomizationUUID, modelCustomizationId);
- if(fabricConfig != null && fabricConfig.getConfigurationResource() != null
- && fabricConfig.getConfigurationResource().getToscaNodeType() != null
- && fabricConfig.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)) {
- String configurationId = UUID.randomUUID().toString();
- ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
- configurationResourceKeys.setCvnfcCustomizationUUID(modelCustomizationId);
- configurationResourceKeys.setVfModuleCustomizationUUID(vfModuleCustomizationUUID);
- configurationResourceKeys.setVnfResourceCustomizationUUID(vnfCustomizationUUID);
- configurationResourceKeys.setVnfcName(vnfc.getVnfcName());
- ExecuteBuildingBlock assignConfigBB = getExecuteBBForConfig(ASSIGN_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys);
- ExecuteBuildingBlock activateConfigBB = getExecuteBBForConfig(ACTIVATE_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys);
- flowsToExecute.add(assignConfigBB);
- flowsToExecute.add(activateConfigBB);
- flowsToExecute.stream().forEach(executeBB -> logger.info("Flows to Execute After Post Processing: {}", executeBB.getBuildingBlock().getBpmnFlowName()));
- execution.setVariable("flowsToExecute", flowsToExecute);
- execution.setVariable("completed", false);
- } else {
- logger.debug("No cvnfcCustomization found for customizationId: " + modelCustomizationId);
- }
- }
- } catch (EntityNotFoundException e) {
- logger.debug(e.getMessage() + " Will not be running Fabric Config Building Blocks");
- } catch (Exception e) {
- String errorMessage = "Error occurred in post processing of Vf Module create";
- execution.setVariable("handlingCode", "RollbackToCreated");
- execution.setVariable("WorkflowActionErrorMessage", errorMessage);
- logger.error(errorMessage, e);
- }
- }
-
- protected ExecuteBuildingBlock getExecuteBBForConfig(String bbName, ExecuteBuildingBlock ebb, String configurationId, ConfigurationResourceKeys configurationResourceKeys) {
- ExecuteBuildingBlock configBB = new ExecuteBuildingBlock();
- BuildingBlock buildingBlock = new BuildingBlock();
- buildingBlock.setBpmnFlowName(bbName);
- buildingBlock.setMsoId(UUID.randomUUID().toString());
- configBB.setaLaCarte(ebb.isaLaCarte());
- configBB.setApiVersion(ebb.getApiVersion());
- configBB.setRequestAction(ebb.getRequestAction());
- configBB.setVnfType(ebb.getVnfType());
- configBB.setRequestId(ebb.getRequestId());
- configBB.setRequestDetails(ebb.getRequestDetails());
- configBB.setBuildingBlock(buildingBlock);
- WorkflowResourceIds workflowResourceIds = ebb.getWorkflowResourceIds();
- workflowResourceIds.setConfigurationId(configurationId);
- configBB.setWorkflowResourceIds(workflowResourceIds);
- configBB.setConfigurationResourceKeys(configurationResourceKeys);
- return configBB;
- }
+ protected ExecuteBuildingBlock getExecuteBBForConfig(String bbName, ExecuteBuildingBlock ebb,
+ String configurationId, ConfigurationResourceKeys configurationResourceKeys) {
+ ExecuteBuildingBlock configBB = new ExecuteBuildingBlock();
+ BuildingBlock buildingBlock = new BuildingBlock();
+ buildingBlock.setBpmnFlowName(bbName);
+ buildingBlock.setMsoId(UUID.randomUUID().toString());
+ configBB.setaLaCarte(ebb.isaLaCarte());
+ configBB.setApiVersion(ebb.getApiVersion());
+ configBB.setRequestAction(ebb.getRequestAction());
+ configBB.setVnfType(ebb.getVnfType());
+ configBB.setRequestId(ebb.getRequestId());
+ configBB.setRequestDetails(ebb.getRequestDetails());
+ configBB.setBuildingBlock(buildingBlock);
+ WorkflowResourceIds workflowResourceIds = ebb.getWorkflowResourceIds();
+ workflowResourceIds.setConfigurationId(configurationId);
+ configBB.setWorkflowResourceIds(workflowResourceIds);
+ configBB.setConfigurationResourceKeys(configurationResourceKeys);
+ return configBB;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java
index 2b0f8bf946..99ae2e7495 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
import java.util.List;
import java.util.Optional;
-
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
@@ -33,26 +32,26 @@ import org.springframework.stereotype.Component;
@Component
public class WorkflowActionExtractResourcesAAI {
- private static final Logger logger = LoggerFactory.getLogger(WorkflowActionExtractResourcesAAI.class);
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowActionExtractResourcesAAI.class);
- public Optional<Configuration> extractRelationshipsConfiguration(Relationships relationships) {
- List<AAIResultWrapper> configurations = relationships.getByType(AAIObjectType.CONFIGURATION);
- for(AAIResultWrapper configWrapper : configurations) {
- Optional<Configuration> config = configWrapper.asBean(Configuration.class);
- if(config.isPresent()){
- return config;
- }
- }
- return Optional.empty();
- }
+ public Optional<Configuration> extractRelationshipsConfiguration(Relationships relationships) {
+ List<AAIResultWrapper> configurations = relationships.getByType(AAIObjectType.CONFIGURATION);
+ for (AAIResultWrapper configWrapper : configurations) {
+ Optional<Configuration> config = configWrapper.asBean(Configuration.class);
+ if (config.isPresent()) {
+ return config;
+ }
+ }
+ return Optional.empty();
+ }
- public Optional<Relationships> extractRelationshipsVnfc(Relationships relationships) {
- List<AAIResultWrapper> vnfcs = relationships.getByType(AAIObjectType.VNFC);
- for(AAIResultWrapper vnfcWrapper : vnfcs){
- if(vnfcWrapper.getRelationships().isPresent()){
- return vnfcWrapper.getRelationships();
- }
- }
- return Optional.empty();
- }
+ public Optional<Relationships> extractRelationshipsVnfc(Relationships relationships) {
+ List<AAIResultWrapper> vnfcs = relationships.getByType(AAIObjectType.VNFC);
+ for (AAIResultWrapper vnfcWrapper : vnfcs) {
+ if (vnfcWrapper.getRelationships().isPresent()) {
+ return vnfcWrapper.getRelationships();
+ }
+ }
+ return Optional.empty();
+ }
}
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
index 304b4000bd..af8f93b92b 100644
--- 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
@@ -22,33 +22,27 @@ 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"),
- INSTANCE_GROUP("InstanceGroup");
-
- 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;
- }
+ SERVICE("Service"), VNF("Vnf"), VFMODULE("VfModule"), VOLUMEGROUP("VolumeGroup"), NETWORK("Network"), VIRTUAL_LINK(
+ "VirtualLink"), NETWORKCOLLECTION(
+ "NetworkCollection"), CONFIGURATION("Configuration"), INSTANCE_GROUP("InstanceGroup");
+
+ 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
index c0f7b21a9e..adfeb5ac6a 100644
--- 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
@@ -23,7 +23,6 @@
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;
@@ -39,38 +38,37 @@ import org.springframework.stereotype.Component;
@Component
public class SDNOHealthCheckTasks {
- private static final Logger logger = LoggerFactory.getLogger(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<ResourceKey, String> lookupMap = execution.getLookupMap();
- for (Map.Entry<ResourceKey, String> entry : lookupMap.entrySet()) {
- if (entry.getKey().equals(ResourceKey.GENERIC_VNF_ID)) {
- vnf = extractPojosForBB.extractByKey(execution, entry.getKey());
- }
- }
-
- response = sdnoHealthCheckResources.healthCheck(vnf, requestContext);
- }
- catch (Exception ex) {
- logger.error("Exception occurred", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex.getMessage());
- }
-
- if (!response) {
- logger.error("SDNO Health Check failed");
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "SDNO Health Check failed");
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(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<ResourceKey, String> lookupMap = execution.getLookupMap();
+ for (Map.Entry<ResourceKey, String> entry : lookupMap.entrySet()) {
+ if (entry.getKey().equals(ResourceKey.GENERIC_VNF_ID)) {
+ vnf = extractPojosForBB.extractByKey(execution, entry.getKey());
+ }
+ }
+
+ response = sdnoHealthCheckResources.healthCheck(vnf, requestContext);
+ } catch (Exception ex) {
+ logger.error("Exception occurred", ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex.getMessage());
+ }
+
+ if (!response) {
+ logger.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
index 518da1fa5f..06f6550d51 100644
--- 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
@@ -25,7 +25,6 @@ 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;
@@ -36,277 +35,287 @@ 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<ServiceInstance, org.onap.aai.domain.yang.ServiceInstance>(){
- @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);
+ 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<ServiceInstance, org.onap.aai.domain.yang.ServiceInstance>() {
+ @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<GenericVnf, org.onap.aai.domain.yang.GenericVnf>() {
+ @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.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<GenericVnf, org.onap.aai.domain.yang.GenericVnf>(){
- @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<VfModule, org.onap.aai.domain.yang.VfModule>(){
- @Override
- protected void configure() {
- map().setModelCustomizationId(source.getModelInfoVfModule().getModelCustomizationUUID());
- map().setModelInvariantId(source.getModelInfoVfModule().getModelInvariantUUID());
- map().setModelVersionId(source.getModelInfoVfModule().getModelUUID());
- map().setPersonaModelVersion(source.getModelInfoVfModule().getModelInvariantUUID());
- map().setIsBaseVfModule(source.getModelInfoVfModule().getIsBaseBoolean());
-
- }
- });
- }
-
- 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<VolumeGroup, org.onap.aai.domain.yang.VolumeGroup>(){
- @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<L3Network, org.onap.aai.domain.yang.L3Network>(){
- @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<InstanceGroup, org.onap.aai.domain.yang.InstanceGroup>(){
- @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);
- }
-
- private Converter<List<Subnet>, org.onap.aai.domain.yang.Subnets> convertSubnets = new Converter<List<Subnet>, org.onap.aai.domain.yang.Subnets>() {
- public org.onap.aai.domain.yang.Subnets convert(MappingContext<List<Subnet>, org.onap.aai.domain.yang.Subnets> context) {
- return mapToAAISubNets(context.getSource());
+ 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<VfModule, org.onap.aai.domain.yang.VfModule>() {
+ @Override
+ protected void configure() {
+ map().setModelCustomizationId(source.getModelInfoVfModule().getModelCustomizationUUID());
+ map().setModelInvariantId(source.getModelInfoVfModule().getModelInvariantUUID());
+ map().setModelVersionId(source.getModelInfoVfModule().getModelUUID());
+ map().setPersonaModelVersion(source.getModelInfoVfModule().getModelInvariantUUID());
+ map().setIsBaseVfModule(source.getModelInfoVfModule().getIsBaseBoolean());
+
+ }
+ });
}
- };
- private Converter<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments> convertCtagAssignments = new Converter<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments>() {
- public org.onap.aai.domain.yang.CtagAssignments convert(MappingContext<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments> context) {
- return mapToAAICtagAssignmentList(context.getSource());
+ 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<VolumeGroup, org.onap.aai.domain.yang.VolumeGroup>() {
+ @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<L3Network, org.onap.aai.domain.yang.L3Network>() {
+ @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);
+ }
- private Converter<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments> convertSegmentationAssignments = new Converter<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments>() {
- public org.onap.aai.domain.yang.SegmentationAssignments convert(MappingContext<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments> context) {
- return mapToAAISegmentationAssignmentList(context.getSource());
+ 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<InstanceGroup, org.onap.aai.domain.yang.InstanceGroup>() {
+ @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());
+ }
+ });
}
- };
-
- public org.onap.aai.domain.yang.Subnets mapToAAISubNets(List<Subnet> 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<CtagAssignment> 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<SegmentationAssignment> 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<Configuration, org.onap.aai.domain.yang.Configuration>(){
- @Override
- protected void configure() {
- map().setModelCustomizationId(source.getModelInfoConfiguration().getModelCustomizationId());
- map().setModelVersionId(source.getModelInfoConfiguration().getModelVersionId());
- map().setModelInvariantId(source.getModelInfoConfiguration().getModelInvariantId());
- map().setConfigurationType(source.getModelInfoConfiguration().getConfigurationType());
- map().setConfigurationSubType(source.getModelInfoConfiguration().getConfigurationRole());
- map().setConfigPolicyName(source.getModelInfoConfiguration().getPolicyName());
- }
- });
- }
- 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<Collection, org.onap.aai.domain.yang.Collection>(){
- @Override
- protected void configure() {
- map().setModelInvariantId(source.getModelInfoCollection().getModelInvariantUUID());
- map().setModelVersionId(source.getModelInfoCollection().getModelVersionId());
- map().setCollectionCustomizationId(source.getModelInfoCollection().getModelCustomizationUUID());
- map().setCollectionFunction(source.getModelInfoCollection().getCollectionFunction());
- map().setCollectionRole(source.getModelInfoCollection().getCollectionRole());
- map().setCollectionType(source.getModelInfoCollection().getCollectionType());
- map().setCollectionName(source.getName());
- }
- });
- }
- return modelMapper.map(networkCollection, org.onap.aai.domain.yang.Collection.class);
- }
+ 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);
+ }
+
+ private Converter<List<Subnet>, org.onap.aai.domain.yang.Subnets> convertSubnets =
+ new Converter<List<Subnet>, org.onap.aai.domain.yang.Subnets>() {
+ public org.onap.aai.domain.yang.Subnets convert(
+ MappingContext<List<Subnet>, org.onap.aai.domain.yang.Subnets> context) {
+ return mapToAAISubNets(context.getSource());
+ }
+ };
+
+ private Converter<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments> convertCtagAssignments =
+ new Converter<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments>() {
+ public org.onap.aai.domain.yang.CtagAssignments convert(
+ MappingContext<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments> context) {
+ return mapToAAICtagAssignmentList(context.getSource());
+ }
+ };
+
+ private Converter<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments> convertSegmentationAssignments =
+ new Converter<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments>() {
+ public org.onap.aai.domain.yang.SegmentationAssignments convert(
+ MappingContext<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments> context) {
+ return mapToAAISegmentationAssignmentList(context.getSource());
+ }
+ };
+
+ public org.onap.aai.domain.yang.Subnets mapToAAISubNets(List<Subnet> 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<CtagAssignment> 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<SegmentationAssignment> 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<Configuration, org.onap.aai.domain.yang.Configuration>() {
+ @Override
+ protected void configure() {
+ map().setModelCustomizationId(source.getModelInfoConfiguration().getModelCustomizationId());
+ map().setModelVersionId(source.getModelInfoConfiguration().getModelVersionId());
+ map().setModelInvariantId(source.getModelInfoConfiguration().getModelInvariantId());
+ map().setConfigurationType(source.getModelInfoConfiguration().getConfigurationType());
+ map().setConfigurationSubType(source.getModelInfoConfiguration().getConfigurationRole());
+ map().setConfigPolicyName(source.getModelInfoConfiguration().getPolicyName());
+ }
+ });
+ }
+ 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<Collection, org.onap.aai.domain.yang.Collection>() {
+ @Override
+ protected void configure() {
+ map().setModelInvariantId(source.getModelInfoCollection().getModelInvariantUUID());
+ map().setModelVersionId(source.getModelInfoCollection().getModelVersionId());
+ map().setCollectionCustomizationId(source.getModelInfoCollection().getModelCustomizationUUID());
+ map().setCollectionFunction(source.getModelInfoCollection().getCollectionFunction());
+ map().setCollectionRole(source.getModelInfoCollection().getCollectionRole());
+ map().setCollectionType(source.getModelInfoCollection().getCollectionType());
+ 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);
- }
- }
-
- public org.onap.aai.domain.yang.Subnet mapSubnet (Subnet subnet){
- return modelMapper.map(subnet,org.onap.aai.domain.yang.Subnet.class);
- }
-
- public org.onap.aai.domain.yang.NetworkPolicy mapNetworkPolicy (NetworkPolicy networkPolicy){
- return modelMapper.map(networkPolicy,org.onap.aai.domain.yang.NetworkPolicy.class);
- }
+ 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);
+ }
+ }
+
+ public org.onap.aai.domain.yang.Subnet mapSubnet(Subnet subnet) {
+ return modelMapper.map(subnet, org.onap.aai.domain.yang.Subnet.class);
+ }
+
+ public org.onap.aai.domain.yang.NetworkPolicy mapNetworkPolicy(NetworkPolicy networkPolicy) {
+ return modelMapper.map(networkPolicy, org.onap.aai.domain.yang.NetworkPolicy.class);
+ }
}
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
index 350a6ae8d6..62d0c230fb 100644
--- 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
@@ -21,7 +21,6 @@
package org.onap.so.client.adapter.network;
import javax.ws.rs.core.Response;
-
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
@@ -33,25 +32,25 @@ import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
public interface NetworkAdapterClient {
- CreateNetworkResponse createNetwork(CreateNetworkRequest req) throws NetworkAdapterClientException;
+ CreateNetworkResponse createNetwork(CreateNetworkRequest req) throws NetworkAdapterClientException;
+
+ DeleteNetworkResponse deleteNetwork(String aaiNetworkId, DeleteNetworkRequest req)
+ throws NetworkAdapterClientException;
- DeleteNetworkResponse deleteNetwork(String aaiNetworkId, DeleteNetworkRequest req)
- throws NetworkAdapterClientException;
+ RollbackNetworkResponse rollbackNetwork(String aaiNetworkId, RollbackNetworkRequest 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;
- 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;
- UpdateNetworkResponse updateNetwork(String aaiNetworkId, UpdateNetworkRequest req)
- throws NetworkAdapterClientException;
+ Response createNetworkAsync(CreateNetworkRequest req) throws NetworkAdapterClientException;
- Response createNetworkAsync(CreateNetworkRequest req) throws NetworkAdapterClientException;
+ Response deleteNetworkAsync(String aaiNetworkId, DeleteNetworkRequest req) throws NetworkAdapterClientException;
- Response deleteNetworkAsync(String aaiNetworkId, DeleteNetworkRequest req) throws NetworkAdapterClientException;
+ Response rollbackNetworkAsync(String aaiNetworkId, RollbackNetworkRequest req) throws NetworkAdapterClientException;
- Response rollbackNetworkAsync(String aaiNetworkId, RollbackNetworkRequest req) throws NetworkAdapterClientException;
-
- Response updateNetworkAsync(String aaiNetworkId, UpdateNetworkRequest req) throws NetworkAdapterClientException;
+ Response updateNetworkAsync(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
index 0492477cf6..2712f1e6f7 100644
--- 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
@@ -23,13 +23,13 @@ package org.onap.so.client.adapter.network;
public class NetworkAdapterClientException extends Exception {
- /**
- *
- */
- private static final long serialVersionUID = 8040736661096488110L;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 8040736661096488110L;
- public NetworkAdapterClientException(String message) {
- super(message);
- }
+ 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
index e8a5723e19..8668306f13 100644
--- 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
@@ -24,7 +24,6 @@ import javax.ws.rs.InternalServerErrorException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
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;
@@ -40,120 +39,126 @@ 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 Response createNetworkAsync(CreateNetworkRequest req) throws NetworkAdapterClientException{
- try {
- return new AdapterRestClient(this.props, this.getUri("").build()).post(req);
- } 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 Response deleteNetworkAsync(String aaiNetworkId, DeleteNetworkRequest req) throws NetworkAdapterClientException {
- try {
- return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req);
- } 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 Response rollbackNetworkAsync(String aaiNetworkId, RollbackNetworkRequest req) throws NetworkAdapterClientException {
- try {
- return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req);
- } 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());
- }
- }
-
- @Override
- public Response updateNetworkAsync(String aaiNetworkId, UpdateNetworkRequest req) throws NetworkAdapterClientException{
- try {
- return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).put(req);
- } catch (InternalServerErrorException e) {
- throw new NetworkAdapterClientException(e.getMessage());
- }
- }
-
- protected UriBuilder getUri(String path) {
- return UriBuilder.fromPath(path);
- }
+ 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 Response createNetworkAsync(CreateNetworkRequest req) throws NetworkAdapterClientException {
+ try {
+ return new AdapterRestClient(this.props, this.getUri("").build()).post(req);
+ } 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 Response deleteNetworkAsync(String aaiNetworkId, DeleteNetworkRequest req)
+ throws NetworkAdapterClientException {
+ try {
+ return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req);
+ } 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 Response rollbackNetworkAsync(String aaiNetworkId, RollbackNetworkRequest req)
+ throws NetworkAdapterClientException {
+ try {
+ return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req);
+ } 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());
+ }
+ }
+
+ @Override
+ public Response updateNetworkAsync(String aaiNetworkId, UpdateNetworkRequest req)
+ throws NetworkAdapterClientException {
+ try {
+ return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).put(req);
+ } 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
index 9888dd3be2..d35f810d2d 100644
--- 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
@@ -22,32 +22,32 @@ 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";
- }
+ 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
index 8c774d8677..4fee1f909b 100644
--- 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
@@ -27,7 +27,6 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
-
import org.apache.commons.lang3.StringUtils;
import org.modelmapper.ModelMapper;
import org.modelmapper.PropertyMap;
@@ -61,329 +60,353 @@ import org.springframework.web.util.UriUtils;
@Component
public class NetworkAdapterObjectMapper {
- private static final ModelMapper modelMapper = new ModelMapper();
- private static String FORWARD_SLASH = "/";
- private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterObjectMapper.class);
-
- public CreateNetworkRequest createNetworkRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map<String, String> 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);
- String networkTechnology = l3Network.getModelInfoNetwork().getNetworkTechnology();
- if(networkTechnology == null) {
- networkTechnology = l3Network.getNetworkTechnology();
- logger.warn("NetworkTechnology was null in CatalogDB. Using field from AAI: " + networkTechnology);
- }
- if (networkTechnology != null) {
- createNetworkRequest.setNetworkTechnology(networkTechnology.toUpperCase());
- if (createNetworkRequest.getNetworkTechnology().contains("CONTRAIL")) {
- createNetworkRequest.setContrailRequest(true);
- }
- }
-
- //build and set Contrail Network
- ContrailNetwork contrailNetwork = buildContrailNetwork(l3Network, customer);
- createNetworkRequest.setContrailNetwork(contrailNetwork);
-
- //set Network Parameters from VID request, add "shared" and "external" to this map
- createNetworkRequest.setNetworkParams(addSharedAndExternal(userInput, l3Network));
-
- createNetworkRequest = setFlowFlags(createNetworkRequest, orchestrationContext);
-
- createNetworkRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance));
-
- String messageId = getRandomUuid();
- createNetworkRequest.setMessageId(messageId);
- 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());
- if (!StringUtils.isEmpty(l3Network.getHeatStackId())){
- deleteNetworkRequest.setNetworkStackId(l3Network.getHeatStackId());
- }
- else {
- deleteNetworkRequest.setNetworkStackId(l3Network.getNetworkName());
- }
- deleteNetworkRequest.setNetworkType(l3Network.getNetworkType());
- deleteNetworkRequest.setSkipAAI(true);
- deleteNetworkRequest.setTenantId(cloudRegion.getTenantId());
-
- deleteNetworkRequest.setNotificationUrl(createCallbackUrl("NetworkAResponse", messageId));
-
- 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<String, String> 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<String, String> 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(addSharedAndExternal(userInput, l3Network));
- 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) throws UnsupportedEncodingException{
- request.setSkipAAI(true);
- String messageId = requestContext.getMsoRequestId();
- request.setMessageId(messageId);
- //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<org.onap.so.openstack.beans.Subnet>
- */
- private List<Subnet> buildOpenstackSubnetList(L3Network l3Network){
-
- List<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet> subnets = l3Network.getSubnets();
- List<org.onap.so.openstack.beans.Subnet> subnetList = new ArrayList<org.onap.so.openstack.beans.Subnet>();
- //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<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet, org.onap.so.openstack.beans.Subnet> personMap = new PropertyMap<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet, org.onap.so.openstack.beans.Subnet>() {
- 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());
- map(source.getSubnetSequence(), destination.getSubnetSequence());
- }
- };
- 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<org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute> hostRouteList = subnet.getHostRoutes();
- List<org.onap.so.openstack.beans.HostRoute> 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);
- }
- if (subnet.getDhcpStart() != null && !subnet.getDhcpStart().equals("")) {
- org.onap.so.openstack.beans.Pool openstackAllocationPool = new org.onap.so.openstack.beans.Pool();
- openstackAllocationPool.setStart(subnet.getDhcpStart());
- openstackAllocationPool.setEnd(subnet.getDhcpEnd());
- List<org.onap.so.openstack.beans.Pool> allocationPools = new ArrayList<>();
- allocationPools.add(openstackAllocationPool);
- openstackSubnet.setAllocationPools(allocationPools);
- }
- 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<Integer> vlans = new ArrayList<Integer>();
- List<org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment> 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(Optional.ofNullable(l3Network.isIsExternalNetwork()).orElse(false).toString());
- contrailNetwork.setShared(Optional.ofNullable(l3Network.isIsSharedNetwork()).orElse(false).toString());
- 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<String> buildPolicyFqdns(List<NetworkPolicy> networkPolicies) {
- List<String> policyFqdns = new ArrayList<>();
- for(NetworkPolicy networkPolicy : networkPolicies) {
- policyFqdns.add(networkPolicy.getNetworkPolicyFqdn());
- }
- return policyFqdns;
- }
-
- private List<String> buildRouteTableFqdns(List<RouteTableReference> contrailNetworkRouteTableReferences) {
- List<String> routeTableFqdns = new ArrayList<>();
- for(RouteTableReference routeTableReference : contrailNetworkRouteTableReferences) {
- routeTableFqdns.add(routeTableReference.getRouteTableReferenceFqdn());
- }
- return routeTableFqdns;
- }
-
- private List<RouteTarget> buildRouteTargets(List<VpnBinding> vpnBindings) {
- if(modelMapper.getTypeMap(org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget.class, RouteTarget.class) == null) {
- modelMapper.addMappings(new PropertyMap<org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget, RouteTarget>() {
- @Override
- protected void configure() {
- map().setRouteTarget(source.getGlobalRouteTarget());
- map().setRouteTargetRole(source.getRouteTargetRole());
- }
- });
- }
-
- List<RouteTarget> 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);
- createNetworkRequest.setBackout(Boolean.TRUE.equals(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);
- updateNetworkRequest.setBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled()));
- //NetworkTechnology(NetworkTechnology.NEUTRON); NOOP - default
- }
-
- private Map<String, String> addSharedAndExternal(Map<String, String> userInput, L3Network l3Network) {
- if (userInput == null)
- userInput = new HashMap<String, String>();
- if (!userInput.containsKey("shared")) {
- userInput.put("shared", Optional.ofNullable(l3Network.isIsSharedNetwork()).orElse(false).toString());
- }
- if (!userInput.containsKey("external")) {
- userInput.put("external", Optional.ofNullable(l3Network.isIsExternalNetwork()).orElse(false).toString());
- }
- return userInput;
- }
+ private static final ModelMapper modelMapper = new ModelMapper();
+ private static String FORWARD_SLASH = "/";
+ private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterObjectMapper.class);
+
+ public CreateNetworkRequest createNetworkRequestMapper(RequestContext requestContext, CloudRegion cloudRegion,
+ OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network,
+ Map<String, String> 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);
+ String networkTechnology = l3Network.getModelInfoNetwork().getNetworkTechnology();
+ if (networkTechnology == null) {
+ networkTechnology = l3Network.getNetworkTechnology();
+ logger.warn("NetworkTechnology was null in CatalogDB. Using field from AAI: " + networkTechnology);
+ }
+ if (networkTechnology != null) {
+ createNetworkRequest.setNetworkTechnology(networkTechnology.toUpperCase());
+ if (createNetworkRequest.getNetworkTechnology().contains("CONTRAIL")) {
+ createNetworkRequest.setContrailRequest(true);
+ }
+ }
+
+ // build and set Contrail Network
+ ContrailNetwork contrailNetwork = buildContrailNetwork(l3Network, customer);
+ createNetworkRequest.setContrailNetwork(contrailNetwork);
+
+ // set Network Parameters from VID request, add "shared" and "external" to this map
+ createNetworkRequest.setNetworkParams(addSharedAndExternal(userInput, l3Network));
+
+ createNetworkRequest = setFlowFlags(createNetworkRequest, orchestrationContext);
+
+ createNetworkRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance));
+
+ String messageId = getRandomUuid();
+ createNetworkRequest.setMessageId(messageId);
+ 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());
+ if (!StringUtils.isEmpty(l3Network.getHeatStackId())) {
+ deleteNetworkRequest.setNetworkStackId(l3Network.getHeatStackId());
+ } else {
+ deleteNetworkRequest.setNetworkStackId(l3Network.getNetworkName());
+ }
+ deleteNetworkRequest.setNetworkType(l3Network.getNetworkType());
+ deleteNetworkRequest.setSkipAAI(true);
+ deleteNetworkRequest.setTenantId(cloudRegion.getTenantId());
+
+ deleteNetworkRequest.setNotificationUrl(createCallbackUrl("NetworkAResponse", messageId));
+
+ 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<String, String> 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<String, String> 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(addSharedAndExternal(userInput, l3Network));
+ 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) throws UnsupportedEncodingException {
+ request.setSkipAAI(true);
+ String messageId = requestContext.getMsoRequestId();
+ request.setMessageId(messageId);
+ // 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<org.onap.so.openstack.beans.Subnet>
+ */
+ private List<Subnet> buildOpenstackSubnetList(L3Network l3Network) {
+
+ List<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet> subnets = l3Network.getSubnets();
+ List<org.onap.so.openstack.beans.Subnet> subnetList = new ArrayList<org.onap.so.openstack.beans.Subnet>();
+ // 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<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet, org.onap.so.openstack.beans.Subnet> personMap =
+ new PropertyMap<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet, org.onap.so.openstack.beans.Subnet>() {
+ 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());
+ map(source.getSubnetSequence(), destination.getSubnetSequence());
+ }
+ };
+ 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<org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute> hostRouteList = subnet.getHostRoutes();
+ List<org.onap.so.openstack.beans.HostRoute> 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);
+ }
+ if (subnet.getDhcpStart() != null && !subnet.getDhcpStart().equals("")) {
+ org.onap.so.openstack.beans.Pool openstackAllocationPool = new org.onap.so.openstack.beans.Pool();
+ openstackAllocationPool.setStart(subnet.getDhcpStart());
+ openstackAllocationPool.setEnd(subnet.getDhcpEnd());
+ List<org.onap.so.openstack.beans.Pool> allocationPools = new ArrayList<>();
+ allocationPools.add(openstackAllocationPool);
+ openstackSubnet.setAllocationPools(allocationPools);
+ }
+ 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<Integer> vlans = new ArrayList<Integer>();
+ List<org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment> 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(Optional.ofNullable(l3Network.isIsExternalNetwork()).orElse(false).toString());
+ contrailNetwork.setShared(Optional.ofNullable(l3Network.isIsSharedNetwork()).orElse(false).toString());
+ 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<String> buildPolicyFqdns(List<NetworkPolicy> networkPolicies) {
+ List<String> policyFqdns = new ArrayList<>();
+ for (NetworkPolicy networkPolicy : networkPolicies) {
+ policyFqdns.add(networkPolicy.getNetworkPolicyFqdn());
+ }
+ return policyFqdns;
+ }
+
+ private List<String> buildRouteTableFqdns(List<RouteTableReference> contrailNetworkRouteTableReferences) {
+ List<String> routeTableFqdns = new ArrayList<>();
+ for (RouteTableReference routeTableReference : contrailNetworkRouteTableReferences) {
+ routeTableFqdns.add(routeTableReference.getRouteTableReferenceFqdn());
+ }
+ return routeTableFqdns;
+ }
+
+ private List<RouteTarget> buildRouteTargets(List<VpnBinding> vpnBindings) {
+ if (modelMapper.getTypeMap(org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget.class,
+ RouteTarget.class) == null) {
+ modelMapper.addMappings(
+ new PropertyMap<org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget, RouteTarget>() {
+ @Override
+ protected void configure() {
+ map().setRouteTarget(source.getGlobalRouteTarget());
+ map().setRouteTargetRole(source.getRouteTargetRole());
+ }
+ });
+ }
+
+ List<RouteTarget> 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);
+ createNetworkRequest.setBackout(Boolean.TRUE.equals(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);
+ updateNetworkRequest.setBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled()));
+ // NetworkTechnology(NetworkTechnology.NEUTRON); NOOP - default
+ }
+
+ private Map<String, String> addSharedAndExternal(Map<String, String> userInput, L3Network l3Network) {
+ if (userInput == null)
+ userInput = new HashMap<String, String>();
+ if (!userInput.containsKey("shared")) {
+ userInput.put("shared", Optional.ofNullable(l3Network.isIsSharedNetwork()).orElse(false).toString());
+ }
+ if (!userInput.containsKey("external")) {
+ userInput.put("external", Optional.ofNullable(l3Network.isIsExternalNetwork()).orElse(false).toString());
+ }
+ return userInput;
+ }
}
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
index 13739faec2..2ab337037b 100644
--- 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
@@ -32,18 +32,18 @@ import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse;
public interface VnfAdapterClient {
- CreateVfModuleResponse createVfModule(String aaiVnfId, CreateVfModuleRequest req) throws VnfAdapterClientException;
+ CreateVfModuleResponse createVfModule(String aaiVnfId, CreateVfModuleRequest req) throws VnfAdapterClientException;
- RollbackVfModuleResponse rollbackVfModule(String aaiVnfId, String aaiVfModuleId, RollbackVfModuleRequest req)
- throws VnfAdapterClientException;
+ RollbackVfModuleResponse rollbackVfModule(String aaiVnfId, String aaiVfModuleId, RollbackVfModuleRequest req)
+ throws VnfAdapterClientException;
- DeleteVfModuleResponse deleteVfModule(String aaiVnfId, String aaiVfModuleId, DeleteVfModuleRequest req)
- throws VnfAdapterClientException;
+ DeleteVfModuleResponse deleteVfModule(String aaiVnfId, String aaiVfModuleId, DeleteVfModuleRequest req)
+ throws VnfAdapterClientException;
- UpdateVfModuleResponse updateVfModule(String aaiVnfId, String aaiVfModuleId, UpdateVfModuleRequest 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;
+ 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
index b4ad9ef055..9e58fa349b 100644
--- 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
@@ -22,13 +22,13 @@ package org.onap.so.client.adapter.vnf;
public class VnfAdapterClientException extends Exception {
- /**
- *
- */
- private static final long serialVersionUID = -7154784472485852602L;
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7154784472485852602L;
- public VnfAdapterClientException(String message) {
- super(message);
- }
+ 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
index 7b9a8c5312..e24e86285c 100644
--- 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
@@ -23,7 +23,6 @@ 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;
@@ -39,96 +38,96 @@ 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);
- }
+ 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
index 8302375c7e..51b1525a28 100644
--- 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
@@ -22,7 +22,6 @@ 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;
@@ -30,25 +29,26 @@ 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";
- }
+ 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
index 0626efbd03..f4e4ce8cb1 100644
--- 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
@@ -31,18 +31,18 @@ import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse;
public interface VnfVolumeAdapterClient {
- CreateVolumeGroupResponse createVNFVolumes(CreateVolumeGroupRequest req) throws VnfAdapterClientException;
+ CreateVolumeGroupResponse createVNFVolumes(CreateVolumeGroupRequest req) throws VnfAdapterClientException;
- DeleteVolumeGroupResponse deleteVNFVolumes(String aaiVolumeGroupId, DeleteVolumeGroupRequest req)
- throws VnfAdapterClientException;
+ DeleteVolumeGroupResponse deleteVNFVolumes(String aaiVolumeGroupId, DeleteVolumeGroupRequest req)
+ throws VnfAdapterClientException;
- RollbackVolumeGroupResponse rollbackVNFVolumes(String aaiVolumeGroupId, RollbackVolumeGroupRequest req)
- throws VnfAdapterClientException;
+ RollbackVolumeGroupResponse rollbackVNFVolumes(String aaiVolumeGroupId, RollbackVolumeGroupRequest req)
+ throws VnfAdapterClientException;
- UpdateVolumeGroupResponse updateVNFVolumes(String aaiVolumeGroupId, UpdateVolumeGroupRequest 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;
+ 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
index 0e0fd3bb5d..2af4d5f1fa 100644
--- 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
@@ -23,7 +23,6 @@ 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;
@@ -40,81 +39,81 @@ import org.springframework.stereotype.Component;
@Component
public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
- private final VnfVolumeAdapterRestProperties props;
+ private final VnfVolumeAdapterRestProperties props;
- public VnfVolumeAdapterClientImpl() {
- this.props = new VnfVolumeAdapterRestProperties();
- }
+ 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 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 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 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 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());
- }
- }
+ @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 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 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);
- }
+ 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
index 80d064249b..1f774f5be7 100644
--- 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
@@ -22,36 +22,36 @@ 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";
- }
+ 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/AttributeNameValue.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java
index e93e216ea3..6daed56675 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java
@@ -51,10 +51,7 @@ public class AttributeNameValue implements Serializable {
@Override
public String toString() {
- return new StringBuilder().append("{\"attribute_name\": \"")
- .append(attributeName.toString())
- .append("\", \"attribute_value\": \"")
- .append(attributeValue.toString())
- .append("\"}").toString();
+ return new StringBuilder().append("{\"attribute_name\": \"").append(attributeName.toString())
+ .append("\", \"attribute_value\": \"").append(attributeValue.toString()).append("\"}").toString();
}
}
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
index 2559087619..a78870afc4 100644
--- 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
@@ -26,9 +26,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-
import javax.annotation.PostConstruct;
-
import org.apache.commons.lang3.StringUtils;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam;
@@ -46,7 +44,6 @@ 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 com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonMappingException;
@@ -54,129 +51,143 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class VnfAdapterObjectMapper {
- private ObjectMapper mapper = new ObjectMapper();
-
- @PostConstruct
- public void init () {
- mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
- }
-
- 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(Boolean.TRUE.equals(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());
- if (!StringUtils.isEmpty(volumeGroup.getHeatStackId())){
- deleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
- } else
- {
- deleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getVolumeGroupName());
- }
-
- deleteVolumeGroupRequest.setSkipAAI(true);
- deleteVolumeGroupRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance));
-
- String messageId = getRandomUuid();
- deleteVolumeGroupRequest.setMessageId(messageId);
- deleteVolumeGroupRequest.setNotificationUrl(createCallbackUrl("VNFAResponse", messageId));
-
- return deleteVolumeGroupRequest;
- }
-
- public Map<String, Object> createVolumeGroupParams(RequestContext requestContext,GenericVnf genericVnf, VolumeGroup volumeGroup, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException {
- Map<String, Object> volumeGroupParams = new HashMap<>();
- final String USER_PARAM_NAME_KEY = "name";
+ private ObjectMapper mapper = new ObjectMapper();
+
+ @PostConstruct
+ public void init() {
+ mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ }
+
+ 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(Boolean.TRUE.equals(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());
+ if (!StringUtils.isEmpty(volumeGroup.getHeatStackId())) {
+ deleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
+ } else {
+ deleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getVolumeGroupName());
+ }
+
+ deleteVolumeGroupRequest.setSkipAAI(true);
+ deleteVolumeGroupRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance));
+
+ String messageId = getRandomUuid();
+ deleteVolumeGroupRequest.setMessageId(messageId);
+ deleteVolumeGroupRequest.setNotificationUrl(createCallbackUrl("VNFAResponse", messageId));
+
+ return deleteVolumeGroupRequest;
+ }
+
+ public Map<String, Object> createVolumeGroupParams(RequestContext requestContext, GenericVnf genericVnf,
+ VolumeGroup volumeGroup, String sdncVfModuleQueryResponse)
+ throws JsonParseException, JsonMappingException, IOException {
+ Map<String, Object> 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) {
- GenericResourceApiVfModuleTopology vfModuleTop = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfModuleTopology.class);
- GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = vfModuleTop.getVfModuleTopology();
- buildParamsMapFromSdncParams(volumeGroupParams, vfModuleTopology.getVfModuleParameters());
- }
-
- if(null != requestContext.getRequestParameters() && null != requestContext.getRequestParameters().getUserParams()) {
+ // sdncVfModuleQueryResponse will not be available in aLaCarte case
+ if (sdncVfModuleQueryResponse != null) {
+ GenericResourceApiVfModuleTopology vfModuleTop =
+ mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfModuleTopology.class);
+ GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = vfModuleTop.getVfModuleTopology();
+ buildParamsMapFromSdncParams(volumeGroupParams, vfModuleTopology.getVfModuleParameters());
+ }
+
+ if (null != requestContext.getRequestParameters()
+ && null != requestContext.getRequestParameters().getUserParams()) {
List<Map<String, Object>> userParams = requestContext.getRequestParameters().getUserParams();
for (Map<String, Object> 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));
+ 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<String,Object> volumeGroupParams, GenericResourceApiParam sdncParameters) {
- if (sdncParameters != null) {
- List<GenericResourceApiParamParam> 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);
- }
-
-} \ No newline at end of file
+ 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<String, Object> volumeGroupParams,
+ GenericResourceApiParam sdncParameters) {
+ if (sdncParameters != null) {
+ List<GenericResourceApiParamParam> 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
index 6b2d64f170..269484eadf 100644
--- 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
@@ -22,7 +22,6 @@ 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;
@@ -30,25 +29,25 @@ import org.springframework.web.util.UriUtils;
@Component("VnfAdapterObjectMapperUtils")
public class VnfAdapterObjectMapperUtils {
- public String getRandomUuid() {
- return UUID.randomUUID().toString();
- }
+ 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);
- }
- }
+ 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");
- }
+ return endpoint + "/" + UriUtils.encodePathSegment(messageType, "UTF-8") + "/"
+ + UriUtils.encodePathSegment(correlator, "UTF-8");
+ }
- protected String getProperty(String key) {
+ protected String getProperty(String key) {
- return UrnPropertiesReader.getVariable(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
index dc113e5abc..94e95687db 100644
--- 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
@@ -21,7 +21,6 @@
package org.onap.so.client.adapter.vnf.mapper;
import static java.util.Arrays.asList;
-
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
@@ -33,9 +32,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-
import javax.annotation.PostConstruct;
-
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang3.StringUtils;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParam;
@@ -82,7 +79,6 @@ import org.onap.so.jsonpath.JsonPathUtil;
import org.onap.so.openstack.utils.MsoMulticloudUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
@@ -93,120 +89,128 @@ import com.google.common.base.Joiner;
@Component
public class VnfAdapterVfModuleObjectMapper {
- @Autowired
- protected VnfAdapterObjectMapperUtils vnfAdapterObjectMapperUtils;
- private static List<String> 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 = "_";
-
- @PostConstruct
- public void init () {
- mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
- }
-
- public CreateVfModuleRequest createVfModuleRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
- VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException {
- CreateVfModuleRequest createVfModuleRequest = new CreateVfModuleRequest();
-
- createVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
- createVfModuleRequest.setCloudOwner(cloudRegion.getCloudOwner());
- createVfModuleRequest.setTenantId(cloudRegion.getTenantId());
- createVfModuleRequest.setVfModuleId(vfModule.getVfModuleId());
- createVfModuleRequest.setVfModuleName(vfModule.getVfModuleName());
- createVfModuleRequest.setVnfId(genericVnf.getVnfId());
- createVfModuleRequest.setVnfType(genericVnf.getVnfType());
- createVfModuleRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion());
- createVfModuleRequest.setVfModuleType(vfModule.getModelInfoVfModule().getModelName());
- createVfModuleRequest.setModelCustomizationUuid(vfModule.getModelInfoVfModule().getModelCustomizationUUID());
- if (volumeGroup != null) {
- createVfModuleRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId());
- createVfModuleRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
- }
- VfModule baseVfModule = getBaseVfModule(genericVnf);
- if (baseVfModule != null) {
- createVfModuleRequest.setBaseVfModuleId(baseVfModule.getVfModuleId());
- createVfModuleRequest.setBaseVfModuleStackId(baseVfModule.getHeatStackId());
- }
- createVfModuleRequest.setVfModuleParams(buildVfModuleParamsMap(requestContext, serviceInstance, genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse));
-
- createVfModuleRequest.setSkipAAI(true);
- createVfModuleRequest.setBackout(Boolean.TRUE.equals(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<String,Object> buildVfModuleParamsMap(RequestContext requestContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
- VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException {
-
-
- GenericResourceApiVnfTopology vnfTop= mapper.readValue(sdncVnfQueryResponse, GenericResourceApiVnfTopology.class);
- GenericResourceApiVfModuleTopology vfModuleTop = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfModuleTopology.class);
- GenericResourceApiVnftopologyVnfTopology vnfTopology = vnfTop.getVnfTopology();
- GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = vfModuleTop.getVfModuleTopology();
- Map<String,Object> paramsMap = new HashMap<>();
-
- if( vfModuleTopology.getSdncGeneratedCloudResources()) {
- buildParamsMapFromVfModuleSdncResponse(paramsMap, vfModuleTopology, true);
- buildParamsMapFromVnfSdncResponse(paramsMap, vnfTopology, null, true);
- }
- else {
- Map<String,String> networkRoleMap = buildNetworkRoleMap(vfModuleTopology);
- buildParamsMapFromVfModuleSdncResponse(paramsMap, vfModuleTopology, false);
- buildParamsMapFromVnfSdncResponse(paramsMap, vnfTopology, networkRoleMap, false);
- }
-
- // build the sdnc_directives from paramsMap
- buildDirectivesParamFromMap(paramsMap, MsoMulticloudUtils.SDNC_DIRECTIVES, paramsMap);
- buildDirectivesParamFromMap(paramsMap, MsoMulticloudUtils.USER_DIRECTIVES, requestContext.getUserParams());
-
- buildMandatoryParamsMap(paramsMap, serviceInstance, genericVnf, vfModule);
-
- // Parameters received from the request should overwrite any parameters received from SDNC
- paramsMap.putAll(requestContext.getUserParams());
-
- if (vfModule.getCloudParams() != null) {
- paramsMap.putAll(vfModule.getCloudParams());
- }
- return paramsMap;
- }
-
- private void buildDirectivesParamFromMap(Map<String, Object> paramsMap, String directive, Map<String, Object> srcMap) {
+ @Autowired
+ protected VnfAdapterObjectMapperUtils vnfAdapterObjectMapperUtils;
+ private static List<String> 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 = "_";
+
+ @PostConstruct
+ public void init() {
+ mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ }
+
+ public CreateVfModuleRequest createVfModuleRequestMapper(RequestContext requestContext, CloudRegion cloudRegion,
+ OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
+ VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse)
+ throws JsonParseException, JsonMappingException, IOException {
+ CreateVfModuleRequest createVfModuleRequest = new CreateVfModuleRequest();
+
+ createVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+ createVfModuleRequest.setCloudOwner(cloudRegion.getCloudOwner());
+ createVfModuleRequest.setTenantId(cloudRegion.getTenantId());
+ createVfModuleRequest.setVfModuleId(vfModule.getVfModuleId());
+ createVfModuleRequest.setVfModuleName(vfModule.getVfModuleName());
+ createVfModuleRequest.setVnfId(genericVnf.getVnfId());
+ createVfModuleRequest.setVnfType(genericVnf.getVnfType());
+ createVfModuleRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion());
+ createVfModuleRequest.setVfModuleType(vfModule.getModelInfoVfModule().getModelName());
+ createVfModuleRequest.setModelCustomizationUuid(vfModule.getModelInfoVfModule().getModelCustomizationUUID());
+ if (volumeGroup != null) {
+ createVfModuleRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId());
+ createVfModuleRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
+ }
+ VfModule baseVfModule = getBaseVfModule(genericVnf);
+ if (baseVfModule != null) {
+ createVfModuleRequest.setBaseVfModuleId(baseVfModule.getVfModuleId());
+ createVfModuleRequest.setBaseVfModuleStackId(baseVfModule.getHeatStackId());
+ }
+ createVfModuleRequest.setVfModuleParams(buildVfModuleParamsMap(requestContext, serviceInstance, genericVnf,
+ vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse));
+
+ createVfModuleRequest.setSkipAAI(true);
+ createVfModuleRequest.setBackout(Boolean.TRUE.equals(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<String, Object> buildVfModuleParamsMap(RequestContext requestContext, ServiceInstance serviceInstance,
+ GenericVnf genericVnf, VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse)
+ throws JsonParseException, JsonMappingException, IOException {
+
+
+ GenericResourceApiVnfTopology vnfTop =
+ mapper.readValue(sdncVnfQueryResponse, GenericResourceApiVnfTopology.class);
+ GenericResourceApiVfModuleTopology vfModuleTop =
+ mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfModuleTopology.class);
+ GenericResourceApiVnftopologyVnfTopology vnfTopology = vnfTop.getVnfTopology();
+ GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = vfModuleTop.getVfModuleTopology();
+ Map<String, Object> paramsMap = new HashMap<>();
+
+ if (vfModuleTopology.getSdncGeneratedCloudResources()) {
+ buildParamsMapFromVfModuleSdncResponse(paramsMap, vfModuleTopology, true);
+ buildParamsMapFromVnfSdncResponse(paramsMap, vnfTopology, null, true);
+ } else {
+ Map<String, String> networkRoleMap = buildNetworkRoleMap(vfModuleTopology);
+ buildParamsMapFromVfModuleSdncResponse(paramsMap, vfModuleTopology, false);
+ buildParamsMapFromVnfSdncResponse(paramsMap, vnfTopology, networkRoleMap, false);
+ }
+
+ // build the sdnc_directives from paramsMap
+ buildDirectivesParamFromMap(paramsMap, MsoMulticloudUtils.SDNC_DIRECTIVES, paramsMap);
+ buildDirectivesParamFromMap(paramsMap, MsoMulticloudUtils.USER_DIRECTIVES, requestContext.getUserParams());
+
+ buildMandatoryParamsMap(paramsMap, serviceInstance, genericVnf, vfModule);
+
+ // Parameters received from the request should overwrite any parameters received from SDNC
+ paramsMap.putAll(requestContext.getUserParams());
+
+ if (vfModule.getCloudParams() != null) {
+ paramsMap.putAll(vfModule.getCloudParams());
+ }
+ return paramsMap;
+ }
+
+ private void buildDirectivesParamFromMap(Map<String, Object> paramsMap, String directive,
+ Map<String, Object> srcMap) {
StringBuilder directives = new StringBuilder();
if (srcMap.size() > 0) {
directives.append("{ \"attributes\": [ ");
int i = 0;
for (String attributeName : srcMap.keySet()) {
directives.append(new AttributeNameValue(attributeName, srcMap.get(attributeName).toString()));
- if (i < (srcMap.size()-1))
+ if (i < (srcMap.size() - 1))
directives.append(", ");
i++;
}
@@ -217,636 +221,679 @@ public class VnfAdapterVfModuleObjectMapper {
paramsMap.put(directive, directives.toString());
}
- private void buildMandatoryParamsMap(Map<String,Object> 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.putIfAbsent("environment_context", "");
- paramsMap.put("workload_context", serviceInstance.getModelInfoServiceInstance().getWorkloadContext());
- paramsMap.putIfAbsent("workload_context", "");
- Integer vfModuleIndex = vfModule.getModuleIndex();
- if (vfModuleIndex != null) {
- paramsMap.put("vf_module_index", vfModuleIndex.toString());
- }
- }
-
- private void buildParamsMapFromVnfSdncResponse(Map<String,Object> paramsMap, GenericResourceApiVnftopologyVnfTopology vnfTopology, Map<String,String> 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<String,Object> paramsMap, GenericResourceApiVnfresourceassignmentsVnfResourceAssignments vnfResourceAssignments) {
- GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsAvailabilityZones availabilityZones = vnfResourceAssignments.getAvailabilityZones();
- if (availabilityZones != null) {
- List<String> 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<String,Object> paramsMap, GenericResourceApiVnfresourceassignmentsVnfResourceAssignments vnfResourceAssignments, Map<String,String> networkRoleMap) {
- GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworks vnfNetworks = vnfResourceAssignments.getVnfNetworks();
- if (vnfNetworks != null) {
- List<GenericResourceApiVnfNetworkData> 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<String,Object> paramsMap, GenericResourceApiVnfNetworkData vnfNetwork, String vnfNetworkKey) {
- String vnfNetworkString = convertToString(vnfNetwork);
- Optional<String> 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<String> 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<String,Object> 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<GenericResourceApiVmTopologyData> 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<GenericResourceApiVmNetworkData> 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);
-
- buildVlanInformation(paramsMap, network, key, networkKey);
-
- }
- }
- }
-
- buildParamsMapFromVfModuleForHeatTemplate(paramsMap, vm);
- }
- }
- }
- }
- }
- }
-
- protected void buildVlanInformation(Map<String, Object> paramsMap,
- GenericResourceApiVmNetworkData network, String key, String networkKey) {
-
- String networkString = convertToString(network);
- String vlanFilterKey = key + UNDERSCORE + networkKey + UNDERSCORE + "vlan_filter";
- String privateVlansKey = key + UNDERSCORE + networkKey + UNDERSCORE + "private_vlans";
- String publicVlansKey = key + UNDERSCORE + networkKey + UNDERSCORE + "public_vlans";
- String guestVlansKey = key + UNDERSCORE + networkKey + UNDERSCORE + "guest_vlans";
-
- if (network.getSegmentationId() != null) {
- paramsMap.put(vlanFilterKey, network.getSegmentationId());
- }
-
- List<String> privateVlans = jsonPath.locateResultList(networkString, "$.related-networks.related-network[?(@.vlan-tags.is-private == true)].vlan-tags.upper-tag-id");
- List<String> publicVlans = jsonPath.locateResultList(networkString, "$.related-networks.related-network[?(@.vlan-tags.is-private == false)].vlan-tags.upper-tag-id");
- List<String> concat = new ArrayList<>(privateVlans);
- concat.addAll(publicVlans);
- Collection<String> guestVlans = new HashSet<>(concat);
-
- if (!privateVlans.isEmpty()) {
- paramsMap.put(privateVlansKey, Joiner.on(",").join(privateVlans));
- }
- if (!publicVlans.isEmpty()) {
- paramsMap.put(publicVlansKey, Joiner.on(",").join(publicVlans));
- }
- if (!guestVlans.isEmpty()) {
- paramsMap.put(guestVlansKey, Joiner.on(",").join(guestVlans));
- }
- }
-
- private void buildVfModuleVmNames(Map<String,Object> paramsMap, GenericResourceApiVmTopologyData vm, String key) {
- String values = "";
- GenericResourceApiVmtopologydataVmNames vmNames = vm.getVmNames();
- if (vmNames != null) {
- List<String> 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<String,Object> paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) {
- GenericResourceApiVmnetworkdataFloatingIps floatingIps = network.getFloatingIps();
- if (floatingIps != null) {
- List<String> 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<String> 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<String,Object> paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) {
- GenericResourceApiVmnetworkdataInterfaceRoutePrefixes interfaceRoutePrefixes = network.getInterfaceRoutePrefixes();
- if (interfaceRoutePrefixes != null) {
- List<String> 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<String,Object> paramsMap, GenericResourceApiVmNetworkData network, String networkKey) {
- // SRIOV Parameters
- GenericResourceApiVmnetworkdataSriovParameters sriovParameters = network.getSriovParameters();
- if (sriovParameters != null) {
- GenericResourceApiVmnetworkdataSriovparametersHeatVlanFilters heatVlanFilters = sriovParameters.getHeatVlanFilters();
- if (heatVlanFilters != null) {
- List<String> 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<String,Object> paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) {
-
- GenericResourceApiVmnetworkdataNetworkInformationItems networkInformationItems = network.getNetworkInformationItems();
- StringBuilder sbIpv4Ips = new StringBuilder();
- StringBuilder sbIpv6Ips = new StringBuilder();
-
- if (networkInformationItems != null) {
- List<GenericResourceApiVmnetworkdataNetworkinformationitemsNetworkInformationItem> 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<String> 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<String,Object> paramsMap, GenericResourceApiVmTopologyData vm) {
- GenericResourceApiVmtopologydataVmNames vmNames = vm.getVmNames();
-
- if (vmNames != null) {
-
- List<GenericResourceApiVmtopologydataVmnamesVnfcNames> 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<String,Object> paramsMap, GenericResourceApiVmtopologydataVmnamesVnfcNames vnfcNames) {
-
- if (vnfcNames != null) {
- GenericResourceApiVnfcNetworkData vnfcNetworks = vnfcNames.getVnfcNetworks();
- if (vnfcNetworks != null) {
- List<GenericResourceApiVnfcnetworkdataVnfcNetworkData> 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<String,Object> paramsMap, GenericResourceApiVnfcnetworkdataVnfcNetworkData vnfcNetworkdata, int networkDataIdx) {
-
- String vmTypeKey = vnfcNetworkdata.getVnfcType();
- GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcPorts vnfcPorts = vnfcNetworkdata.getVnfcPorts();
- if (vnfcPorts != null) {
- List<GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcportsVnfcPort> 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<String,Object> paramsMap, String keyPrefix, GenericResourceApiSubInterfaceNetworkData vnicSubInterfaces) {
+ private void buildMandatoryParamsMap(Map<String, Object> 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.putIfAbsent("environment_context", "");
+ paramsMap.put("workload_context", serviceInstance.getModelInfoServiceInstance().getWorkloadContext());
+ paramsMap.putIfAbsent("workload_context", "");
+ Integer vfModuleIndex = vfModule.getModuleIndex();
+ if (vfModuleIndex != null) {
+ paramsMap.put("vf_module_index", vfModuleIndex.toString());
+ }
+ }
+
+ private void buildParamsMapFromVnfSdncResponse(Map<String, Object> paramsMap,
+ GenericResourceApiVnftopologyVnfTopology vnfTopology, Map<String, String> 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<String, Object> paramsMap,
+ GenericResourceApiVnfresourceassignmentsVnfResourceAssignments vnfResourceAssignments) {
+ GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsAvailabilityZones availabilityZones =
+ vnfResourceAssignments.getAvailabilityZones();
+ if (availabilityZones != null) {
+ List<String> 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<String, Object> paramsMap,
+ GenericResourceApiVnfresourceassignmentsVnfResourceAssignments vnfResourceAssignments,
+ Map<String, String> networkRoleMap) {
+ GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworks vnfNetworks =
+ vnfResourceAssignments.getVnfNetworks();
+ if (vnfNetworks != null) {
+ List<GenericResourceApiVnfNetworkData> 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<String, Object> paramsMap, GenericResourceApiVnfNetworkData vnfNetwork,
+ String vnfNetworkKey) {
+ String vnfNetworkString = convertToString(vnfNetwork);
+ Optional<String> 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<String> 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<String, Object> 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<GenericResourceApiVmTopologyData> 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<GenericResourceApiVmNetworkData> 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);
+
+ buildVlanInformation(paramsMap, network, key, networkKey);
+
+ }
+ }
+ }
+
+ buildParamsMapFromVfModuleForHeatTemplate(paramsMap, vm);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ protected void buildVlanInformation(Map<String, Object> paramsMap, GenericResourceApiVmNetworkData network,
+ String key, String networkKey) {
+
+ String networkString = convertToString(network);
+ String vlanFilterKey = key + UNDERSCORE + networkKey + UNDERSCORE + "vlan_filter";
+ String privateVlansKey = key + UNDERSCORE + networkKey + UNDERSCORE + "private_vlans";
+ String publicVlansKey = key + UNDERSCORE + networkKey + UNDERSCORE + "public_vlans";
+ String guestVlansKey = key + UNDERSCORE + networkKey + UNDERSCORE + "guest_vlans";
+
+ if (network.getSegmentationId() != null) {
+ paramsMap.put(vlanFilterKey, network.getSegmentationId());
+ }
+
+ List<String> privateVlans = jsonPath.locateResultList(networkString,
+ "$.related-networks.related-network[?(@.vlan-tags.is-private == true)].vlan-tags.upper-tag-id");
+ List<String> publicVlans = jsonPath.locateResultList(networkString,
+ "$.related-networks.related-network[?(@.vlan-tags.is-private == false)].vlan-tags.upper-tag-id");
+ List<String> concat = new ArrayList<>(privateVlans);
+ concat.addAll(publicVlans);
+ Collection<String> guestVlans = new HashSet<>(concat);
+
+ if (!privateVlans.isEmpty()) {
+ paramsMap.put(privateVlansKey, Joiner.on(",").join(privateVlans));
+ }
+ if (!publicVlans.isEmpty()) {
+ paramsMap.put(publicVlansKey, Joiner.on(",").join(publicVlans));
+ }
+ if (!guestVlans.isEmpty()) {
+ paramsMap.put(guestVlansKey, Joiner.on(",").join(guestVlans));
+ }
+ }
+
+ private void buildVfModuleVmNames(Map<String, Object> paramsMap, GenericResourceApiVmTopologyData vm, String key) {
+ String values = "";
+ GenericResourceApiVmtopologydataVmNames vmNames = vm.getVmNames();
+ if (vmNames != null) {
+ List<String> 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<String, Object> paramsMap, GenericResourceApiVmNetworkData network,
+ String key, String networkKey) {
+ GenericResourceApiVmnetworkdataFloatingIps floatingIps = network.getFloatingIps();
+ if (floatingIps != null) {
+ List<String> 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<String> 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<String, Object> paramsMap,
+ GenericResourceApiVmNetworkData network, String key, String networkKey) {
+ GenericResourceApiVmnetworkdataInterfaceRoutePrefixes interfaceRoutePrefixes =
+ network.getInterfaceRoutePrefixes();
+ if (interfaceRoutePrefixes != null) {
+ List<String> 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<String, Object> paramsMap, GenericResourceApiVmNetworkData network,
+ String networkKey) {
+ // SRIOV Parameters
+ GenericResourceApiVmnetworkdataSriovParameters sriovParameters = network.getSriovParameters();
+ if (sriovParameters != null) {
+ GenericResourceApiVmnetworkdataSriovparametersHeatVlanFilters heatVlanFilters =
+ sriovParameters.getHeatVlanFilters();
+ if (heatVlanFilters != null) {
+ List<String> 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<String, Object> paramsMap, GenericResourceApiVmNetworkData network,
+ String key, String networkKey) {
+
+ GenericResourceApiVmnetworkdataNetworkInformationItems networkInformationItems =
+ network.getNetworkInformationItems();
+ StringBuilder sbIpv4Ips = new StringBuilder();
+ StringBuilder sbIpv6Ips = new StringBuilder();
+
+ if (networkInformationItems != null) {
+ List<GenericResourceApiVmnetworkdataNetworkinformationitemsNetworkInformationItem> 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<String> 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<String, Object> paramsMap,
+ GenericResourceApiVmTopologyData vm) {
+ GenericResourceApiVmtopologydataVmNames vmNames = vm.getVmNames();
+
+ if (vmNames != null) {
+
+ List<GenericResourceApiVmtopologydataVmnamesVnfcNames> 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<String, Object> paramsMap,
+ GenericResourceApiVmtopologydataVmnamesVnfcNames vnfcNames) {
+
+ if (vnfcNames != null) {
+ GenericResourceApiVnfcNetworkData vnfcNetworks = vnfcNames.getVnfcNetworks();
+ if (vnfcNetworks != null) {
+ List<GenericResourceApiVnfcnetworkdataVnfcNetworkData> 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<String, Object> paramsMap,
+ GenericResourceApiVnfcnetworkdataVnfcNetworkData vnfcNetworkdata, int networkDataIdx) {
+
+ String vmTypeKey = vnfcNetworkdata.getVnfcType();
+ GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcPorts vnfcPorts = vnfcNetworkdata.getVnfcPorts();
+ if (vnfcPorts != null) {
+ List<GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcportsVnfcPort> 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<String, Object> paramsMap, String keyPrefix,
+ GenericResourceApiSubInterfaceNetworkData vnicSubInterfaces) {
+
+ List<GenericResourceApiSubinterfacenetworkdataSubInterfaceNetworkData> 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<String, Object> paramsMap, String keyPrefix, String vnicSubInterfaces) {
+
+ List<String> 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<String, Object> paramsMap, String keyPrefix, String vnicSubInterfaces) {
+
+ List<String> 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<String, Object> paramsMap, String keyPrefix, String vnicSubInterfaces) {
+
+ List<String> 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<String, Object> paramsMap, String keyPrefix,
+ String vnicSubInterfaces) {
+
+ List<String> 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<String, Object> paramsMap, String keyPrefix,
+ String vnicSubInterfaces) {
+
+ List<String> ipv6Ips = jsonPath.locateResultList(vnicSubInterfaces,
+ "$.sub-interface-network-data[*].network-information-items.network-information-item[?(@.ip-version == 'ipv6')].network-ips.network-ip[*]");
- List<GenericResourceApiSubinterfacenetworkdataSubInterfaceNetworkData> subInterfaceNetworkDataList = vnicSubInterfaces.getSubInterfaceNetworkData();
+ addPairToMap(paramsMap, keyPrefix, V6_IP, ipv6Ips);
- if ( (subInterfaceNetworkDataList != null) && !subInterfaceNetworkDataList.isEmpty() ) {
- addPairToMap(paramsMap, keyPrefix, SUB_INT_COUNT, String.valueOf(subInterfaceNetworkDataList.size()));
- }
+ for (int i = 0; i < ipv6Ips.size(); i++) {
+ addPairToMap(paramsMap, keyPrefix, V6_IP + UNDERSCORE + i, ipv6Ips.get(i));
+ }
}
- protected String createVnfcSubInterfaceKey(String vmTypeKey, int networkDataIdx, String networkRoleKey, int portIdx) {
+ /*
+ * Build floatingip_address for Heat Template Building Criteria :
+ * {vm-type}_subint_{network-role}_port_{index}_floating_ip -- for ipV4
+ */
+ protected void buildVfModuleFloatingIpV4HeatTemplate(Map<String, Object> paramsMap, String keyPrefix,
+ String vnicSubInterfaces) {
- return Joiner.on(UNDERSCORE).join(Arrays.asList(vmTypeKey, networkDataIdx, SUB_INT, networkRoleKey, PORT, portIdx));
- }
+ List<String> floatingV4 = jsonPath.locateResultList(vnicSubInterfaces,
+ "$.sub-interface-network-data[*].floating-ips.floating-ip-v4[*]");
- protected String createGlobalVnfcSubInterfaceKey(String vmTypeKey,String networkRoleKey, int portIdx) {
+ if (!floatingV4.isEmpty()) {
+ floatingV4 = Collections.singletonList(floatingV4.get(0));
+ }
+ addPairToMap(paramsMap, keyPrefix, FLOATING_IP, floatingV4);
- 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<String,Object> paramsMap, String keyPrefix, String vnicSubInterfaces) {
+ /*
+ * Build floatingip_address for Heat Template Building Criteria :
+ * {vm-type}_subint_{network-role}_port_{index}_floating_v6_ip -- for ipV6
+ */
+ protected void buildVfModuleFloatingIpV6HeatTemplate(Map<String, Object> paramsMap, String keyPrefix,
+ String vnicSubInterfaces) {
- List<String> vlanTagIds = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].vlan-tag-id");
+ List<String> floatingV6 = jsonPath.locateResultList(vnicSubInterfaces,
+ "$.sub-interface-network-data[*].floating-ips.floating-ip-v6[*]");
- 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<String,Object> paramsMap, String keyPrefix, String vnicSubInterfaces) {
+ if (!floatingV6.isEmpty()) {
+ floatingV6 = Collections.singletonList(floatingV6.get(0));
+ }
+ addPairToMap(paramsMap, keyPrefix, FLOATING_V6_IP, floatingV6);
+ }
- List<String> neworkNames = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].network-name");
+ protected void addPairToMap(Map<String, Object> paramsMap, String keyPrefix, String key, String value) {
- addPairToMap(paramsMap, keyPrefix, NET_NAMES, neworkNames);
- }
+ addPairToMap(paramsMap, keyPrefix, key, Collections.singletonList(value));
+ }
- /*
- * 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<String,Object> paramsMap, String keyPrefix, String vnicSubInterfaces) {
+ protected void addPairToMap(Map<String, Object> paramsMap, String keyPrefix, String key, List<String> value) {
- List<String> neworkIds = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].network-id");
+ if (!value.isEmpty()) {
+ paramsMap.put(keyPrefix + key, Joiner.on(",").join(value));
+ }
+ }
- 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<String,Object> paramsMap, String keyPrefix, String vnicSubInterfaces) {
-
- List<String> 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<String,Object> paramsMap, String keyPrefix, String vnicSubInterfaces) {
-
- List<String> 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<String,Object> paramsMap, String keyPrefix, String vnicSubInterfaces) {
-
- List<String> 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<String,Object> paramsMap, String keyPrefix, String vnicSubInterfaces) {
-
- List<String> 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<String, Object> paramsMap, String keyPrefix, String key, String value) {
-
- addPairToMap(paramsMap, keyPrefix, key, Collections.singletonList(value));
- }
-
- protected void addPairToMap(Map<String, Object> paramsMap, String keyPrefix, String key, List<String> value) {
-
- if (!value.isEmpty()) {
- paramsMap.put(keyPrefix + key, Joiner.on(",").join(value));
- }
- }
-
- private void buildParamsMapFromSdncParams(Map<String,Object> paramsMap, GenericResourceApiParam parametersData) {
- if (parametersData != null) {
- List<GenericResourceApiParamParam> 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<String,String> buildNetworkRoleMap(GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology) throws JsonParseException, JsonMappingException, IOException {
- Map<String, String> networkRoleMap = new HashMap<>();
- GenericResourceApiVfmoduleassignmentsVfModuleAssignments vfModuleAssignments = vfModuleTopology.getVfModuleAssignments();
- if (vfModuleAssignments != null) {
- GenericResourceApiVfmoduleassignmentsVfmoduleassignmentsVms vms = vfModuleAssignments.getVms();
- if (vms != null) {
- List<GenericResourceApiVmTopologyData> vmsList = vms.getVm();
- if (vmsList != null) {
- for (GenericResourceApiVmTopologyData vm : vmsList){
- GenericResourceApiVmtopologydataVmNetworks vmNetworks = vm.getVmNetworks();
- if (vmNetworks != null) {
- List<GenericResourceApiVmNetworkData> 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.setCloudOwner(cloudRegion.getCloudOwner());
- deleteVfModuleRequest.setTenantId(cloudRegion.getTenantId());
- deleteVfModuleRequest.setVnfId(genericVnf.getVnfId());
- deleteVfModuleRequest.setVfModuleId(vfModule.getVfModuleId());
- if (!StringUtils.isEmpty(vfModule.getHeatStackId())){
- deleteVfModuleRequest.setVfModuleStackId(vfModule.getHeatStackId());//DoDVfMod_heatStackId
- } else
- {
- deleteVfModuleRequest.setVfModuleStackId(vfModule.getVfModuleName());
- }
-
- deleteVfModuleRequest.setSkipAAI(true);
- setIdAndUrl(deleteVfModuleRequest);
- MsoRequest msoRequest = buildMsoRequest(requestContext, serviceInstance);
- deleteVfModuleRequest.setMsoRequest(msoRequest);
- return deleteVfModuleRequest;
- }
-
- protected void setIdAndUrl(DeleteVfModuleRequest deleteVfModuleRequest) throws UnsupportedEncodingException{
- String messageId = vnfAdapterObjectMapperUtils.getRandomUuid();
- deleteVfModuleRequest.setMessageId(messageId);
- deleteVfModuleRequest.setNotificationUrl(vnfAdapterObjectMapperUtils.createCallbackUrl("VNFAResponse", messageId));
- }
-
- private String convertToString(Object obj) {
- String json;
- try {
- json = mapper.writeValueAsString(obj);
- } catch (JsonProcessingException e) {
- json = "{}";
- }
-
- return json;
- }
-
- private VfModule getBaseVfModule(GenericVnf genericVnf) {
- List<VfModule> vfModules = genericVnf.getVfModules();
- VfModule baseVfModule = null;
- if (vfModules != null) {
- for(int i = 0; i < vfModules.size(); i++) {
- if (vfModules.get(i).getModelInfoVfModule().getIsBaseBoolean()) {
- baseVfModule = vfModules.get(i);
- break;
- }
- }
- }
- return baseVfModule;
- }
+ private void buildParamsMapFromSdncParams(Map<String, Object> paramsMap, GenericResourceApiParam parametersData) {
+ if (parametersData != null) {
+ List<GenericResourceApiParamParam> 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<String, String> buildNetworkRoleMap(GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology)
+ throws JsonParseException, JsonMappingException, IOException {
+ Map<String, String> networkRoleMap = new HashMap<>();
+ GenericResourceApiVfmoduleassignmentsVfModuleAssignments vfModuleAssignments =
+ vfModuleTopology.getVfModuleAssignments();
+ if (vfModuleAssignments != null) {
+ GenericResourceApiVfmoduleassignmentsVfmoduleassignmentsVms vms = vfModuleAssignments.getVms();
+ if (vms != null) {
+ List<GenericResourceApiVmTopologyData> vmsList = vms.getVm();
+ if (vmsList != null) {
+ for (GenericResourceApiVmTopologyData vm : vmsList) {
+ GenericResourceApiVmtopologydataVmNetworks vmNetworks = vm.getVmNetworks();
+ if (vmNetworks != null) {
+ List<GenericResourceApiVmNetworkData> 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.setCloudOwner(cloudRegion.getCloudOwner());
+ deleteVfModuleRequest.setTenantId(cloudRegion.getTenantId());
+ deleteVfModuleRequest.setVnfId(genericVnf.getVnfId());
+ deleteVfModuleRequest.setVfModuleId(vfModule.getVfModuleId());
+ if (!StringUtils.isEmpty(vfModule.getHeatStackId())) {
+ deleteVfModuleRequest.setVfModuleStackId(vfModule.getHeatStackId());// DoDVfMod_heatStackId
+ } else {
+ deleteVfModuleRequest.setVfModuleStackId(vfModule.getVfModuleName());
+ }
+
+ deleteVfModuleRequest.setSkipAAI(true);
+ setIdAndUrl(deleteVfModuleRequest);
+ MsoRequest msoRequest = buildMsoRequest(requestContext, serviceInstance);
+ deleteVfModuleRequest.setMsoRequest(msoRequest);
+ return deleteVfModuleRequest;
+ }
+
+ protected void setIdAndUrl(DeleteVfModuleRequest deleteVfModuleRequest) throws UnsupportedEncodingException {
+ String messageId = vnfAdapterObjectMapperUtils.getRandomUuid();
+ deleteVfModuleRequest.setMessageId(messageId);
+ deleteVfModuleRequest
+ .setNotificationUrl(vnfAdapterObjectMapperUtils.createCallbackUrl("VNFAResponse", messageId));
+ }
+
+ private String convertToString(Object obj) {
+ String json;
+ try {
+ json = mapper.writeValueAsString(obj);
+ } catch (JsonProcessingException e) {
+ json = "{}";
+ }
+
+ return json;
+ }
+
+ private VfModule getBaseVfModule(GenericVnf genericVnf) {
+ List<VfModule> vfModules = genericVnf.getVfModules();
+ VfModule baseVfModule = null;
+ if (vfModules != null) {
+ for (int i = 0; i < vfModules.size(); i++) {
+ if (vfModules.get(i).getModelInfoVfModule().getIsBaseBoolean()) {
+ baseVfModule = vfModules.get(i);
+ break;
+ }
+ }
+ }
+ return baseVfModule;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java
index 9613fbdcf1..593426a85f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java
@@ -25,7 +25,6 @@ package org.onap.so.client.namingservice;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-
import org.onap.namingservice.model.NameGenDeleteRequest;
import org.onap.namingservice.model.NameGenDeleteResponse;
import org.onap.namingservice.model.NameGenRequest;
@@ -47,53 +46,53 @@ import org.springframework.web.client.RestTemplate;
@Component
-public class NamingClient{
- private static final Logger logger = LoggerFactory.getLogger(NamingClient.class);
- private static final String ENDPOINT = "mso.naming.endpoint";
- private static final String AUTH = "mso.naming.auth";
-
- @Autowired
- private RestTemplate restTemplate;
- @Autowired
+public class NamingClient {
+ private static final Logger logger = LoggerFactory.getLogger(NamingClient.class);
+ private static final String ENDPOINT = "mso.naming.endpoint";
+ private static final String AUTH = "mso.naming.auth";
+
+ @Autowired
+ private RestTemplate restTemplate;
+ @Autowired
private Environment env;
- @Autowired
- private NamingClientResponseValidator namingClientResponseValidator;
-
- public String postNameGenRequest(NameGenRequest request) throws BadResponseException, IOException {
- String targetUrl = env.getProperty(ENDPOINT);
- HttpHeaders headers = setHeaders(env.getProperty(AUTH));
- logger.info("Sending postNameGenRequest to url: {}", targetUrl);
- HttpEntity<NameGenRequest> requestEntity = new HttpEntity<>(request, headers);
- ResponseEntity<NameGenResponse> response;
- try{
- response = restTemplate.postForEntity(targetUrl, requestEntity, NameGenResponse.class);
- }catch(HttpStatusCodeException e){
- throw new BadResponseException(namingClientResponseValidator.formatError(e));
- }
- return namingClientResponseValidator.validateNameGenResponse(response);
- }
+ @Autowired
+ private NamingClientResponseValidator namingClientResponseValidator;
+
+ public String postNameGenRequest(NameGenRequest request) throws BadResponseException, IOException {
+ String targetUrl = env.getProperty(ENDPOINT);
+ HttpHeaders headers = setHeaders(env.getProperty(AUTH));
+ logger.info("Sending postNameGenRequest to url: {}", targetUrl);
+ HttpEntity<NameGenRequest> requestEntity = new HttpEntity<>(request, headers);
+ ResponseEntity<NameGenResponse> response;
+ try {
+ response = restTemplate.postForEntity(targetUrl, requestEntity, NameGenResponse.class);
+ } catch (HttpStatusCodeException e) {
+ throw new BadResponseException(namingClientResponseValidator.formatError(e));
+ }
+ return namingClientResponseValidator.validateNameGenResponse(response);
+ }
- public String deleteNameGenRequest(NameGenDeleteRequest request) throws BadResponseException, IOException {
- String targetUrl = env.getProperty(ENDPOINT);
- HttpHeaders headers = setHeaders(env.getProperty(AUTH));
- logger.info("Sending deleteNameGenRequest to url: {}", targetUrl);
- HttpEntity<NameGenDeleteRequest> requestEntity = new HttpEntity<>(request, headers);
- ResponseEntity<NameGenDeleteResponse> response;
- try{
- response = restTemplate.exchange(targetUrl, HttpMethod.DELETE, requestEntity, NameGenDeleteResponse.class);
- }catch(HttpStatusCodeException e){
- throw new BadResponseException(namingClientResponseValidator.formatError(e));
- }
- return namingClientResponseValidator.validateNameGenDeleteResponse(response);
- }
+ public String deleteNameGenRequest(NameGenDeleteRequest request) throws BadResponseException, IOException {
+ String targetUrl = env.getProperty(ENDPOINT);
+ HttpHeaders headers = setHeaders(env.getProperty(AUTH));
+ logger.info("Sending deleteNameGenRequest to url: {}", targetUrl);
+ HttpEntity<NameGenDeleteRequest> requestEntity = new HttpEntity<>(request, headers);
+ ResponseEntity<NameGenDeleteResponse> response;
+ try {
+ response = restTemplate.exchange(targetUrl, HttpMethod.DELETE, requestEntity, NameGenDeleteResponse.class);
+ } catch (HttpStatusCodeException e) {
+ throw new BadResponseException(namingClientResponseValidator.formatError(e));
+ }
+ return namingClientResponseValidator.validateNameGenDeleteResponse(response);
+ }
- private HttpHeaders setHeaders(String auth) {
- HttpHeaders headers = new HttpHeaders();
- headers.setContentType(MediaType.APPLICATION_JSON);
- List<MediaType> acceptableMediaTypes = new ArrayList<>();
- acceptableMediaTypes.add(MediaType.APPLICATION_JSON);
- headers.setAccept(acceptableMediaTypes);
- headers.add(HttpHeaders.AUTHORIZATION, auth);
- return headers;
- }
+ private HttpHeaders setHeaders(String auth) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.setContentType(MediaType.APPLICATION_JSON);
+ List<MediaType> acceptableMediaTypes = new ArrayList<>();
+ acceptableMediaTypes.add(MediaType.APPLICATION_JSON);
+ headers.setAccept(acceptableMediaTypes);
+ headers.add(HttpHeaders.AUTHORIZATION, auth);
+ return headers;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java
index 8456f26239..717bb04099 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java
@@ -24,7 +24,6 @@ package org.onap.so.client.namingservice;
import java.io.IOException;
import java.util.List;
-
import org.apache.http.HttpStatus;
import org.onap.namingservice.model.NameGenDeleteResponse;
import org.onap.namingservice.model.NameGenResponse;
@@ -38,113 +37,113 @@ import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.HttpStatusCodeException;
-
import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class NamingClientResponseValidator {
- private static final Logger logger = LoggerFactory.getLogger(NamingClientResponseValidator.class);
- private static final String INSTANCE_GROUP_NAME = "instance-group-name";
- private static final String NO_RESPONSE_FROM_NAMING_SERVICE = "Error did not receive a response from Naming Service.";
- private static final String NULL_RESPONSE_FROM_NAMING_SERVICE = "Error received a null response from Naming Service.";
- private static final String NAMING_SERVICE_ERROR = "Error from Naming Service: %s";
-
- public String validateNameGenResponse(ResponseEntity<NameGenResponse> response) throws BadResponseException {
- if (response == null) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE,
- "BPMN", ErrorCode.UnknownError.getValue(),
- NO_RESPONSE_FROM_NAMING_SERVICE);
- throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE);
- }
-
+ private static final Logger logger = LoggerFactory.getLogger(NamingClientResponseValidator.class);
+ private static final String INSTANCE_GROUP_NAME = "instance-group-name";
+ private static final String NO_RESPONSE_FROM_NAMING_SERVICE =
+ "Error did not receive a response from Naming Service.";
+ private static final String NULL_RESPONSE_FROM_NAMING_SERVICE =
+ "Error received a null response from Naming Service.";
+ private static final String NAMING_SERVICE_ERROR = "Error from Naming Service: %s";
+
+ public String validateNameGenResponse(ResponseEntity<NameGenResponse> response) throws BadResponseException {
+ if (response == null) {
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE,
+ "BPMN", ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_NAMING_SERVICE);
+ throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE);
+ }
+
int responseCode = response.getStatusCodeValue();
String generatedName = "";
NameGenResponse responseBody = response.getBody();
if (responseBody == null) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE,
- "BPMN", ErrorCode.UnknownError.getValue(),
- NULL_RESPONSE_FROM_NAMING_SERVICE);
- throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE);
- }
-
- if (isHttpCodeSuccess(responseCode)) {
- logger.info("Successful Response from Naming Service");
- List<Respelement> respList = responseBody.getElements();
-
- if (respList != null) {
- for (int i=0; i < respList.size(); i++) {
- Respelement respElement = respList.get(i);
- if (respElement != null) {
- String resourceName = respElement.getResourceName();
- if (INSTANCE_GROUP_NAME.equals(resourceName)) {
- generatedName = respElement.getResourceValue();
- break;
- }
- }
- }
- }
- return generatedName;
- } else {
- NameGenResponseError error = responseBody.getError();
- String errorMessageString = NAMING_SERVICE_ERROR;
- if (error != null) {
- errorMessageString = error.getMessage();
- }
- String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
- ErrorCode.DataError.getValue(), errorMessage);
- throw new BadResponseException(errorMessage);
- }
- }
-
- public String validateNameGenDeleteResponse(ResponseEntity<NameGenDeleteResponse> response) throws BadResponseException {
- if (response == null) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE,
- "BPMN", ErrorCode.UnknownError.getValue(),
- NO_RESPONSE_FROM_NAMING_SERVICE);
- throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE);
- }
-
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+ NULL_RESPONSE_FROM_NAMING_SERVICE, "BPMN", ErrorCode.UnknownError.getValue(),
+ NULL_RESPONSE_FROM_NAMING_SERVICE);
+ throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE);
+ }
+
+ if (isHttpCodeSuccess(responseCode)) {
+ logger.info("Successful Response from Naming Service");
+ List<Respelement> respList = responseBody.getElements();
+
+ if (respList != null) {
+ for (int i = 0; i < respList.size(); i++) {
+ Respelement respElement = respList.get(i);
+ if (respElement != null) {
+ String resourceName = respElement.getResourceName();
+ if (INSTANCE_GROUP_NAME.equals(resourceName)) {
+ generatedName = respElement.getResourceValue();
+ break;
+ }
+ }
+ }
+ }
+ return generatedName;
+ } else {
+ NameGenResponseError error = responseBody.getError();
+ String errorMessageString = NAMING_SERVICE_ERROR;
+ if (error != null) {
+ errorMessageString = error.getMessage();
+ }
+ String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
+ ErrorCode.DataError.getValue(), errorMessage);
+ throw new BadResponseException(errorMessage);
+ }
+ }
+
+ public String validateNameGenDeleteResponse(ResponseEntity<NameGenDeleteResponse> response)
+ throws BadResponseException {
+ if (response == null) {
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE,
+ "BPMN", ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_NAMING_SERVICE);
+ throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE);
+ }
+
int responseCode = response.getStatusCodeValue();
String responseMessage = "";
NameGenDeleteResponse responseBody = response.getBody();
if (responseBody == null) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE,
- "BPMN", ErrorCode.UnknownError.getValue(),
- NULL_RESPONSE_FROM_NAMING_SERVICE);
- throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE);
- }
-
- if (isHttpCodeSuccess(responseCode)) {
- logger.info("Successful Response from Naming Service");
- return responseMessage;
- } else {
- String errorMessageString = NAMING_SERVICE_ERROR;
-
- String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
- ErrorCode.DataError.getValue(), errorMessage);
- throw new BadResponseException(errorMessage);
- }
- }
-
- private boolean isHttpCodeSuccess(int code) {
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+ NULL_RESPONSE_FROM_NAMING_SERVICE, "BPMN", ErrorCode.UnknownError.getValue(),
+ NULL_RESPONSE_FROM_NAMING_SERVICE);
+ throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE);
+ }
+
+ if (isHttpCodeSuccess(responseCode)) {
+ logger.info("Successful Response from Naming Service");
+ return responseMessage;
+ } else {
+ String errorMessageString = NAMING_SERVICE_ERROR;
+
+ String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
+ ErrorCode.DataError.getValue(), errorMessage);
+ throw new BadResponseException(errorMessage);
+ }
+ }
+
+ private boolean isHttpCodeSuccess(int code) {
return code >= HttpStatus.SC_OK && code < HttpStatus.SC_MULTIPLE_CHOICES || code == 0;
}
-
- protected String formatError(HttpStatusCodeException e) throws IOException {
- ObjectMapper mapper = new ObjectMapper();
- NameGenResponse errorResponse = mapper.readValue(e.getResponseBodyAsString(), NameGenResponse.class);
- NameGenResponseError error = errorResponse.getError();
-
- String errorMessageString = null;
- if (error != null) {
- errorMessageString = error.getMessage();
- }
- String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
- ErrorCode.DataError.getValue(), errorMessage);
- return errorMessage;
- }
+
+ protected String formatError(HttpStatusCodeException e) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ NameGenResponse errorResponse = mapper.readValue(e.getResponseBodyAsString(), NameGenResponse.class);
+ NameGenResponseError error = errorResponse.getError();
+
+ String errorMessageString = null;
+ if (error != null) {
+ errorMessageString = error.getMessage();
+ }
+ String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
+ ErrorCode.DataError.getValue(), errorMessage);
+ return errorMessage;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java
index ba9f170d71..a4e68f8100 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java
@@ -21,7 +21,6 @@
package org.onap.so.client.namingservice;
import java.util.List;
-
import org.onap.namingservice.model.Deleteelement;
import org.onap.namingservice.model.Element;
import org.onap.namingservice.model.NameGenDeleteRequest;
@@ -29,30 +28,34 @@ import org.onap.namingservice.model.NameGenRequest;
import org.springframework.stereotype.Component;
@Component
-public class NamingRequestObjectBuilder{
-
- public Element elementMapper(String instanceGroupId, String policyInstanceName, String namingType, String nfNamingCode, String instanceGroupName){
- Element element = new Element();
- element.put("external-key", instanceGroupId);
- element.put("policy-instance-name", policyInstanceName);
- element.put("naming-type", namingType);
- element.put("resource-name", instanceGroupName);
- element.put("nf-naming-code", nfNamingCode);
- return element;
- }
- public Deleteelement deleteElementMapper(String instanceGroupId){
- Deleteelement deleteElement = new Deleteelement();
- deleteElement.setExternalKey(instanceGroupId);
- return deleteElement;
- }
- public NameGenRequest nameGenRequestMapper(List<Element> elements){
- NameGenRequest nameGenRequest = new NameGenRequest();
- nameGenRequest.setElements(elements);
- return nameGenRequest;
- }
- public NameGenDeleteRequest nameGenDeleteRequestMapper(List<Deleteelement> deleteElements){
- NameGenDeleteRequest nameGenDeleteRequest = new NameGenDeleteRequest();
- nameGenDeleteRequest.setElements(deleteElements);
- return nameGenDeleteRequest;
- }
+public class NamingRequestObjectBuilder {
+
+ public Element elementMapper(String instanceGroupId, String policyInstanceName, String namingType,
+ String nfNamingCode, String instanceGroupName) {
+ Element element = new Element();
+ element.put("external-key", instanceGroupId);
+ element.put("policy-instance-name", policyInstanceName);
+ element.put("naming-type", namingType);
+ element.put("resource-name", instanceGroupName);
+ element.put("nf-naming-code", nfNamingCode);
+ return element;
+ }
+
+ public Deleteelement deleteElementMapper(String instanceGroupId) {
+ Deleteelement deleteElement = new Deleteelement();
+ deleteElement.setExternalKey(instanceGroupId);
+ return deleteElement;
+ }
+
+ public NameGenRequest nameGenRequestMapper(List<Element> elements) {
+ NameGenRequest nameGenRequest = new NameGenRequest();
+ nameGenRequest.setElements(elements);
+ return nameGenRequest;
+ }
+
+ public NameGenDeleteRequest nameGenDeleteRequestMapper(List<Deleteelement> deleteElements) {
+ NameGenDeleteRequest nameGenDeleteRequest = new NameGenDeleteRequest();
+ nameGenDeleteRequest.setElements(deleteElements);
+ return nameGenDeleteRequest;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java
index fa039c235c..e31285f044 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java
@@ -34,7 +34,6 @@ import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
-
import com.fasterxml.jackson.core.JsonProcessingException;
import java.util.LinkedHashMap;
@@ -54,15 +53,14 @@ public class OofClient {
/**
- * Makes a rest call to oof to perform homing and licensing for a
- * list of demands
+ * Makes a rest call to oof to perform homing and licensing for a list of demands
*
* @param homingRequest
* @return
* @throws JsonProcessingException
* @throws BpmnError
*/
- public void postDemands(OofRequest homingRequest) throws BadResponseException, JsonProcessingException{
+ public void postDemands(OofRequest homingRequest) throws BadResponseException, JsonProcessingException {
logger.trace("Started oof Client Post Demands");
String url = oofProperties.getHost() + oofProperties.getUri();
logger.debug("Post demands url: " + url);
@@ -79,7 +77,8 @@ public class OofClient {
baseClient.setTargetUrl(url);
baseClient.setHttpHeader(header);
- LinkedHashMap<?, ?> response = baseClient.post(homingRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {});
+ LinkedHashMap<?, ?> response =
+ baseClient.post(homingRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<?, ?>>() {});
validator.validateDemandsResponse(response);
logger.trace("Completed OOF Client Post Demands");
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java
index 252ff0d6a6..abbf52e38c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java
@@ -26,9 +26,7 @@ import org.onap.so.client.exception.BadResponseException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
-
import java.util.LinkedHashMap;
-
import static org.apache.commons.lang.StringUtils.isNotBlank;
@@ -44,55 +42,54 @@ public class OofValidator {
*/
public void validateDemandsResponse(LinkedHashMap<?, ?> response) throws BadResponseException {
logger.debug("Validating oofs synchronous response");
- if(!response.isEmpty()){
+ if (!response.isEmpty()) {
JSONObject jsonResponse = new JSONObject(response);
- if(jsonResponse.has("requestStatus")){
+ if (jsonResponse.has("requestStatus")) {
String status = jsonResponse.getString("requestStatus");
- if(status.equals("accepted")){
+ if (status.equals("accepted")) {
logger.debug("oofs synchronous response indicates accepted");
- }else{
+ } else {
String message = jsonResponse.getString("statusMessage");
- if(isNotBlank(message)){
+ if (isNotBlank(message)) {
logger.debug("oofs response indicates failed: " + message);
- }else{
+ } else {
logger.debug("oofs response indicates failed: no status message provided");
message = "error message not provided";
}
throw new BadResponseException("oofs synchronous response indicates failed: " + message);
}
- }else{
+ } else {
logger.debug("oofs synchronous response does not contain: request status");
throw new BadResponseException("oofs synchronous response does not contain: request status");
}
- }else{
+ } else {
logger.debug("oofs synchronous response is empty");
throw new BadResponseException("oofs synchronous response i is empty");
}
}
/**
- * Validates the asynchronous/callback response from oof which
- * contains the homing and licensing solutions
+ * Validates the asynchronous/callback response from oof which contains the homing and licensing solutions
*
* @throws BadResponseException
*/
- public void validateSolution(String response) throws BadResponseException{
+ public void validateSolution(String response) throws BadResponseException {
logger.debug("Validating oofs asynchronous callback response");
- if(isNotBlank(response)) {
+ if (isNotBlank(response)) {
JSONObject jsonResponse = new JSONObject(response);
- if(!jsonResponse.has("serviceException")){
+ if (!jsonResponse.has("serviceException")) {
logger.debug("oofs asynchronous response is valid");
- }else{
+ } else {
String message = jsonResponse.getJSONObject("serviceException").getString("text");
- if(isNotBlank(message)){
+ if (isNotBlank(message)) {
logger.debug("oofs response contains a service exception: " + message);
- }else{
+ } else {
logger.debug("oofs response contains a service exception: no service exception text provided");
message = "error message not provided";
}
throw new BadResponseException("oofs asynchronous response contains a service exception: " + message);
}
- }else{
+ } else {
logger.debug("oofs asynchronous response is empty");
throw new BadResponseException("oofs asynchronous response is empty");
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java
index f5fb87503a..433de22aba 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java
@@ -24,18 +24,11 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
-
import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "modelType",
- "modelInvariantId",
- "modelVersionId",
- "modelName",
- "modelVersion",
- "modelCustomizationName"
-})
+@JsonPropertyOrder({"modelType", "modelInvariantId", "modelVersionId", "modelName", "modelVersion",
+ "modelCustomizationName"})
@JsonRootName("modelInfo")
public class ModelInfo implements Serializable {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java
index 507eaeaf5e..84e29b6f2d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java
@@ -22,7 +22,6 @@ package org.onap.so.client.oof.beans;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
-
import java.util.Map;
@Configuration
@@ -38,25 +37,27 @@ public class OofProperties {
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<String, String> getHeaders() {
return headers;
}
+
public void setHeaders(Map<String, String> headers) {
this.headers = headers;
}
-
-
-
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java
index 58f0bfc9cc..e3c29fe04d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java
@@ -27,11 +27,10 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import java.io.Serializable;
-public class OofRequest implements Serializable{
+public class OofRequest implements Serializable {
private static final long serialVersionUID = -1541132882892163132L;
private static final Logger logger = LoggerFactory.getLogger(OofRequest.class);
@@ -53,38 +52,45 @@ public class OofRequest implements Serializable{
public RequestInfo getRequestInformation() {
return requestInformation;
}
+
public void setRequestInformation(RequestInfo requestInformation) {
this.requestInformation = requestInformation;
}
+
public ServiceInfo getServiceInformation() {
return serviceInformation;
}
+
public void setServiceInformation(ServiceInfo serviceInformation) {
this.serviceInformation = serviceInformation;
}
+
public PlacementInfo getPlacementInformation() {
return placementInformation;
}
+
public void setPlacementInformation(PlacementInfo placementInformation) {
this.placementInformation = placementInformation;
}
+
public String getLicenseInformation() {
return licenseInformation;
}
+
public void setLicenseInformation(String licenseInformation) {
this.licenseInformation = licenseInformation;
}
@JsonInclude(Include.NON_NULL)
- public String toJsonString(){
+ public String toJsonString() {
String json = "";
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_NULL);
ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter();
- try{
+ try {
json = ow.writeValueAsString(this);
- }catch (Exception e){
+ } catch (Exception e) {
logger.error("Unable to convert oofRequest to string", e);
}
return json.replaceAll("\\\\", "");
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java
index 621f5652a3..6c9e45c787 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java
@@ -24,15 +24,10 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
-
import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "customerLatitude",
- "customerLongitude",
- "customerName"
-})
+@JsonPropertyOrder({"customerLatitude", "customerLongitude", "customerName"})
@JsonRootName("requestParameters")
public class OofRequestParameters implements Serializable {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java
index 38728efcfb..73c100df6d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java
@@ -24,16 +24,10 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
-
import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "resourceModuleName",
- "serviceResourceId",
- "tenantId",
- "resourceModelInfo"
-})
+@JsonPropertyOrder({"resourceModuleName", "serviceResourceId", "tenantId", "resourceModelInfo"})
@JsonRootName("placementDemand")
public class PlacementDemand implements Serializable {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java
index 2a7dc9decb..0eb14d991a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java
@@ -28,11 +28,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "requestParameters",
- "subscriberInfo",
- "placementDemands"
-})
+@JsonPropertyOrder({"requestParameters", "subscriberInfo", "placementDemands"})
@JsonRootName("placementInfo")
public class PlacementInfo implements Serializable {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java
index 6831fe54e9..0132ed56e9 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java
@@ -28,16 +28,8 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "transactionId",
- "requestId",
- "callbackUrl",
- "sourceId",
- "requestType",
- "numSolutions",
- "optimizers",
- "timeout"
-})
+@JsonPropertyOrder({"transactionId", "requestId", "callbackUrl", "sourceId", "requestType", "numSolutions",
+ "optimizers", "timeout"})
@JsonRootName("requestInfo")
public class RequestInfo implements Serializable {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java
index fea7437a93..8d44c63571 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java
@@ -21,10 +21,9 @@
package org.onap.so.client.oof.beans;
import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.io.Serializable;
-public class Resource implements Serializable{
+public class Resource implements Serializable {
private static final long serialVersionUID = 5949861520571440421L;
@@ -34,19 +33,19 @@ public class Resource implements Serializable{
private String status;
- public String getServiceResourceId(){
+ public String getServiceResourceId() {
return serviceResourceId;
}
- public void setServiceResourceId(String serviceResourceId){
+ public void setServiceResourceId(String serviceResourceId) {
this.serviceResourceId = serviceResourceId;
}
- public String getStatus(){
+ public String getStatus() {
return status;
}
- public void setStatus(String status){
+ public void setStatus(String status) {
this.status = status;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java
index e9257bcb0c..9d0352525d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java
@@ -23,7 +23,6 @@ package org.onap.so.client.oof.beans;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
-
import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java
index 0cfffbbff6..db0e2acd60 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java
@@ -24,15 +24,10 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
-
import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "serviceInstanceId",
- "serviceName",
- "modelInfo"
-})
+@JsonPropertyOrder({"serviceInstanceId", "serviceName", "modelInfo"})
@JsonRootName("serviceInfo")
public class ServiceInfo implements Serializable {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java
index 3218975095..8fef4c45e7 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java
@@ -24,15 +24,10 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
-
import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "globalSubscriberId",
- "subscriberName",
- "subscriberCommonSiteId"
-})
+@JsonPropertyOrder({"globalSubscriberId", "subscriberName", "subscriberCommonSiteId"})
@JsonRootName("subscriberInfo")
public class SubscriberInfo implements Serializable {
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
index 4a9f01fa53..5df7518698 100644
--- 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
@@ -32,27 +32,29 @@ 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);
- }
+ @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
index f412720af7..746f136e96 100644
--- 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
@@ -21,9 +21,7 @@
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;
@@ -37,11 +35,11 @@ import org.springframework.stereotype.Component;
@Component
public class AAIConfigurationResources {
- @Autowired
- private InjectionHelper injectionHelper;
+ @Autowired
+ private InjectionHelper injectionHelper;
- @Autowired
- private AAIObjectMapper aaiObjectMapper;
+ @Autowired
+ private AAIObjectMapper aaiObjectMapper;
/**
* A&AI call to create configuration
@@ -49,14 +47,15 @@ public class AAIConfigurationResources {
* @param configuration
*/
public void createConfiguration(Configuration configuration) {
- AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ AAIResourceUri configurationURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
configuration.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
injectionHelper.getAaiClient().create(configurationURI, aaiConfiguration);
}
/**
- * method to get Configuration details from A&AI
+ * method to get Configuration details from A&AI
*
* @param configurationId
* @return
@@ -72,21 +71,24 @@ public class AAIConfigurationResources {
* @param configuration
*/
public void updateConfiguration(Configuration configuration) {
- AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ 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){
+ 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);
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
+ injectionHelper.getAaiClient().disconnect(configurationURI, serviceInstanceURI);
}
/**
@@ -96,8 +98,10 @@ public class AAIConfigurationResources {
* @param vnrConfigurationId
*/
public void connectVrfConfigurationToVnrConfiguration(String vrfConfigurationId, String vnrConfigurationId) {
- AAIResourceUri vnrConfigurationUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vnrConfigurationId);
- AAIResourceUri vrfConfigurationUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vrfConfigurationId);
+ AAIResourceUri vnrConfigurationUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vnrConfigurationId);
+ AAIResourceUri vrfConfigurationUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vrfConfigurationId);
injectionHelper.getAaiClient().connect(vrfConfigurationUri, vnrConfigurationUri);
}
@@ -121,11 +125,11 @@ public class AAIConfigurationResources {
*/
public void connectConfigurationToServiceInstance(String configurationId, String serviceInstanceId) {
AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
- AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
- serviceInstanceId);
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI);
}
-
+
/**
* A&AI call to add configuration relationship with service instance
*
@@ -133,10 +137,11 @@ public class AAIConfigurationResources {
* @param serviceInstanceId
* @param aaiLabel
*/
- public void connectConfigurationToServiceInstance(String configurationId, String serviceInstanceId, AAIEdgeLabel aaiLabel) {
+ public void connectConfigurationToServiceInstance(String configurationId, String serviceInstanceId,
+ AAIEdgeLabel aaiLabel) {
AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
- AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
- serviceInstanceId);
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI, aaiLabel);
}
@@ -165,22 +170,22 @@ public class AAIConfigurationResources {
injectionHelper.getAaiClient().connect(configurationURI, vpnBindingURI);
}
- public void connectConfigurationToVfModule(String configurationId, String vnfId, String vfModuleId){
- AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
- AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
- injectionHelper.getAaiClient().connect(configurationURI, vfModuleURI);
+ public void connectConfigurationToVfModule(String configurationId, String vnfId, String vfModuleId) {
+ AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
+ injectionHelper.getAaiClient().connect(configurationURI, vfModuleURI);
}
- public void connectConfigurationToVnfc(String configurationId, String vnfcName){
- AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
- AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName);
- injectionHelper.getAaiClient().connect(configurationURI, vnfcURI);
+ public void connectConfigurationToVnfc(String configurationId, String vnfcName) {
+ AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName);
+ injectionHelper.getAaiClient().connect(configurationURI, vnfcURI);
}
- public void connectConfigurationToL3Network(String configurationId, String networkId){
- AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
- AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId);
- injectionHelper.getAaiClient().connect(configurationURI, networkURI);
+ public void connectConfigurationToL3Network(String configurationId, String networkId) {
+ AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId);
+ injectionHelper.getAaiClient().connect(configurationURI, networkURI);
}
/**
@@ -192,30 +197,35 @@ public class AAIConfigurationResources {
AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
injectionHelper.getAaiClient().delete(aaiResourceUri);
}
+
/**
* method to delete Configuration details in A&AI
*
* @param configuration
*/
public void deleteConfiguration(Configuration configuration) {
- AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ AAIResourceUri aaiResourceUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
injectionHelper.getAaiClient().delete(aaiResourceUri);
}
/**
* Get Configuration from AAI using related Link
+ *
* @param relatedLink related link - URI
* @return AAI Configuration object
*/
- public Optional<org.onap.aai.domain.yang.Configuration> getConfigurationFromRelatedLink(String relatedLink){
- return injectionHelper.getAaiClient()
- .get(org.onap.aai.domain.yang.Configuration.class, AAIUriFactory.createResourceFromExistingURI(AAIObjectType.CONFIGURATION, UriBuilder.fromPath(relatedLink).build()));
+ public Optional<org.onap.aai.domain.yang.Configuration> getConfigurationFromRelatedLink(String relatedLink) {
+ return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Configuration.class, AAIUriFactory
+ .createResourceFromExistingURI(AAIObjectType.CONFIGURATION, UriBuilder.fromPath(relatedLink).build()));
}
- public void updateOrchestrationStatusConfiguration(Configuration configuration, OrchestrationStatus orchestrationStatus) {
- AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
- configuration.setOrchestrationStatus(orchestrationStatus);
- org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
- injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration);
- }
+ public void updateOrchestrationStatusConfiguration(Configuration configuration,
+ OrchestrationStatus orchestrationStatus) {
+ AAIResourceUri aaiResourceUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ configuration.setOrchestrationStatus(orchestrationStatus);
+ org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
+ injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration);
+ }
}
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
index c325dd75ee..c48593037a 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -36,45 +35,53 @@ import org.springframework.stereotype.Component;
@Component
public class AAIInstanceGroupResources {
- @Autowired
- private InjectionHelper injectionHelper;
-
- @Autowired
- private AAIObjectMapper aaiObjectMapper;
+ @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 void connectInstanceGroupToVnf(InstanceGroup instanceGroup, GenericVnf vnf, AAIEdgeLabel aaiLabel) {
+ AAIResourceUri instanceGroupUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ injectionHelper.getAaiClient().connect(instanceGroupUri, vnfURI, aaiLabel);
+ }
- 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 boolean exists(InstanceGroup instanceGroup) {
+ AAIResourceUri instanceGroupUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ return injectionHelper.getAaiClient().exists(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 void connectInstanceGroupToVnf(InstanceGroup instanceGroup, GenericVnf vnf, AAIEdgeLabel aaiLabel) {
- AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
- AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
- injectionHelper.getAaiClient().connect(instanceGroupUri, vnfURI, aaiLabel);
- }
-
- public boolean exists(InstanceGroup instanceGroup) {
- AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
- return injectionHelper.getAaiClient().exists(instanceGroupUri);
- }
-
- public void createInstanceGroupandConnectServiceInstance(InstanceGroup instanceGroup, ServiceInstance serviceInstance) {
- AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
- org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup);
- AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
- serviceInstance.getServiceInstanceId());
- injectionHelper.getAaiClient().createIfNotExists(instanceGroupUri, Optional.of(aaiInstanceGroup)).connect(instanceGroupUri, serviceInstanceURI);
- }
+ public void createInstanceGroupandConnectServiceInstance(InstanceGroup instanceGroup,
+ ServiceInstance serviceInstance) {
+ AAIResourceUri instanceGroupUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup);
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+ injectionHelper.getAaiClient().createIfNotExists(instanceGroupUri, Optional.of(aaiInstanceGroup))
+ .connect(instanceGroupUri, serviceInstanceURI);
+ }
}
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
index 7283c9967c..b936551549 100644
--- 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
@@ -21,7 +21,6 @@
package org.onap.so.client.orchestration;
import java.util.Optional;
-
import org.onap.aai.domain.yang.NetworkPolicies;
import org.onap.aai.domain.yang.NetworkPolicy;
import org.onap.aai.domain.yang.RouteTableReference;
@@ -46,147 +45,165 @@ 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 updateSubnet(L3Network network, Subnet subnet) {
- AAIResourceUri subnetURI = AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, network.getNetworkId(), subnet.getSubnetId());
- org.onap.aai.domain.yang.Subnet aaiSubnet = aaiObjectMapper.mapSubnet(subnet);
- injectionHelper.getAaiClient().update(subnetURI, aaiSubnet);
- }
-
- 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<VpnBinding> getVpnBinding(AAIResourceUri netBindingUri) {
- return injectionHelper.getAaiClient().get(netBindingUri.depth(Depth.TWO)).asBean(VpnBinding.class);
- }
-
- public Optional<NetworkPolicy> getNetworkPolicy(AAIResourceUri netPolicyUri) {
- return injectionHelper.getAaiClient().get(netPolicyUri).asBean(NetworkPolicy.class);
- }
-
- public Optional<NetworkPolicies> getNetworkPolicies(AAIResourceUri netPoliciesUri) {
- return injectionHelper.getAaiClient().get(netPoliciesUri).asBean(NetworkPolicies.class);
- }
-
- public Optional<org.onap.aai.domain.yang.Subnet> getSubnet(AAIResourceUri subnetUri) {
- return injectionHelper.getAaiClient().get(subnetUri).asBean(org.onap.aai.domain.yang.Subnet.class);
- }
-
- public Optional<RouteTableReference> getRouteTable(AAIResourceUri rTableUri) {
- return injectionHelper.getAaiClient().get(rTableUri).asBean(RouteTableReference.class);
- }
-
- public Optional<org.onap.aai.domain.yang.L3Network> 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(networkURI,cloudRegionURI);
- }
-
- 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 connectInstanceGroupToCloudRegion(InstanceGroup instanceGroup, CloudRegion cloudRegion) {
- AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
- cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
- AAIResourceUri instanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
- injectionHelper.getAaiClient().connect(instanceGroupURI, cloudRegionURI, AAIEdgeLabel.USES);
- }
-
- 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);
- }
-
- public void createNetworkPolicy(org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy networkPolicy) {
- NetworkPolicy aaiNetworkPolicy = aaiObjectMapper.mapNetworkPolicy(networkPolicy);
- String networkPolicyId = networkPolicy.getNetworkPolicyId();
- AAIResourceUri netUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId);
- injectionHelper.getAaiClient().create(netUri, aaiNetworkPolicy);
- }
-
- public void deleteNetworkPolicy(String networkPolicyId) {
- AAIResourceUri networkPolicyURI = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId);
- injectionHelper.getAaiClient().delete(networkPolicyURI);
- }
+
+ @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 updateSubnet(L3Network network, Subnet subnet) {
+ AAIResourceUri subnetURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, network.getNetworkId(), subnet.getSubnetId());
+ org.onap.aai.domain.yang.Subnet aaiSubnet = aaiObjectMapper.mapSubnet(subnet);
+ injectionHelper.getAaiClient().update(subnetURI, aaiSubnet);
+ }
+
+ 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<VpnBinding> getVpnBinding(AAIResourceUri netBindingUri) {
+ return injectionHelper.getAaiClient().get(netBindingUri.depth(Depth.TWO)).asBean(VpnBinding.class);
+ }
+
+ public Optional<NetworkPolicy> getNetworkPolicy(AAIResourceUri netPolicyUri) {
+ return injectionHelper.getAaiClient().get(netPolicyUri).asBean(NetworkPolicy.class);
+ }
+
+ public Optional<NetworkPolicies> getNetworkPolicies(AAIResourceUri netPoliciesUri) {
+ return injectionHelper.getAaiClient().get(netPoliciesUri).asBean(NetworkPolicies.class);
+ }
+
+ public Optional<org.onap.aai.domain.yang.Subnet> getSubnet(AAIResourceUri subnetUri) {
+ return injectionHelper.getAaiClient().get(subnetUri).asBean(org.onap.aai.domain.yang.Subnet.class);
+ }
+
+ public Optional<RouteTableReference> getRouteTable(AAIResourceUri rTableUri) {
+ return injectionHelper.getAaiClient().get(rTableUri).asBean(RouteTableReference.class);
+ }
+
+ public Optional<org.onap.aai.domain.yang.L3Network> 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(networkURI, cloudRegionURI);
+ }
+
+ 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 connectInstanceGroupToCloudRegion(InstanceGroup instanceGroup, CloudRegion cloudRegion) {
+ AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
+ cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
+ AAIResourceUri instanceGroupURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ injectionHelper.getAaiClient().connect(instanceGroupURI, cloudRegionURI, AAIEdgeLabel.USES);
+ }
+
+ 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);
+ }
+
+ public void createNetworkPolicy(org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy networkPolicy) {
+ NetworkPolicy aaiNetworkPolicy = aaiObjectMapper.mapNetworkPolicy(networkPolicy);
+ String networkPolicyId = networkPolicy.getNetworkPolicyId();
+ AAIResourceUri netUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId);
+ injectionHelper.getAaiClient().create(netUri, aaiNetworkPolicy);
+ }
+
+ public void deleteNetworkPolicy(String networkPolicyId) {
+ AAIResourceUri networkPolicyURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId);
+ injectionHelper.getAaiClient().delete(networkPolicyURI);
+ }
}
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
index 3032b66e6d..e391349d2c 100644
--- 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
@@ -23,7 +23,6 @@
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;
@@ -43,112 +42,120 @@ import org.springframework.stereotype.Component;
@Component
public class AAIServiceInstanceResources {
- private static final Logger logger = LoggerFactory.getLogger(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));
- }
+ private static final Logger logger = LoggerFactory.getLogger(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) {
+ 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));
+ 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_ENTITY)
+ .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);
}
- 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_ENTITY).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
index 5fa73c85ff..83fe31a116 100644
--- 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
@@ -23,7 +23,6 @@
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;
@@ -41,62 +40,73 @@ import org.springframework.stereotype.Component;
@Component
public class AAIVfModuleResources {
- private static final Logger logger = LoggerFactory.getLogger(AAIVfModuleResources.class);
-
- @Autowired
- private InjectionHelper injectionHelper;
-
- @Autowired
- private AAIObjectMapper aaiObjectMapper;
+ private static final Logger logger = LoggerFactory.getLogger(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 updateHeatStackIdVfModule(VfModule vfModule, GenericVnf vnf) {
+ AAIResourceUri vfModuleURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+ VfModule copiedVfModule = vfModule.shallowCopyId();
+
+ copiedVfModule.setHeatStackId(vfModule.getHeatStackId());
+ org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(copiedVfModule);
+ injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule);
+ }
- 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 updateContrailServiceInstanceFqdnVfModule(VfModule vfModule, GenericVnf vnf) {
+ AAIResourceUri vfModuleURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+ VfModule copiedVfModule = vfModule.shallowCopyId();
- public void updateOrchestrationStatusVfModule(VfModule vfModule, GenericVnf vnf, OrchestrationStatus orchestrationStatus) {
- AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
- VfModule copiedVfModule = vfModule.shallowCopyId();
+ copiedVfModule.setContrailServiceInstanceFqdn(vfModule.getContrailServiceInstanceFqdn());
+ org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(copiedVfModule);
+ injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule);
+ }
- vfModule.setOrchestrationStatus(orchestrationStatus);
- copiedVfModule.setOrchestrationStatus(orchestrationStatus);
- org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(copiedVfModule);
- injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule);
- }
-
- public void updateHeatStackIdVfModule(VfModule vfModule, GenericVnf vnf) {
- AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
- VfModule copiedVfModule = vfModule.shallowCopyId();
+ 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);
+ }
- copiedVfModule.setHeatStackId(vfModule.getHeatStackId());
- org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(copiedVfModule);
- injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule);
- }
-
- public void updateContrailServiceInstanceFqdnVfModule(VfModule vfModule, GenericVnf vnf) {
- AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
- VfModule copiedVfModule = vfModule.shallowCopyId();
-
- copiedVfModule.setContrailServiceInstanceFqdn(vfModule.getContrailServiceInstanceFqdn());
- 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);
- }
+ 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
index 48a1c1e558..fc61d862aa 100644
--- 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
@@ -24,7 +24,6 @@ package org.onap.so.client.orchestration;
import java.io.IOException;
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;
@@ -44,104 +43,114 @@ import org.springframework.stereotype.Component;
@Component
public class AAIVnfResources {
- private static final Logger logger = LoggerFactory.getLogger(AAIVnfResources.class);
-
- @Autowired
- private InjectionHelper injectionHelper;
-
- @Autowired
- private AAIObjectMapper aaiObjectMapper;
-
- private AAIValidatorImpl aaiValidatorImpl= new AAIValidatorImpl();
-
- 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<org.onap.aai.domain.yang.GenericVnf> 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();
- }
-
- public void connectVnfToCloudRegion(GenericVnf vnf, CloudRegion cloudRegion) {
- AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
- cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
- AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
- injectionHelper.getAaiClient().connect(vnfURI,cloudRegionURI);
- }
-
- public void connectVnfToTenant(GenericVnf vnf, CloudRegion cloudRegion) {
- AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT,
- cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId());
- AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
- injectionHelper.getAaiClient().connect(tenantURI, vnfURI);
- }
-
- public boolean checkVnfClosedLoopDisabledFlag(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.isIsClosedLoopDisabled();
- }
-
- public boolean checkVnfPserversLockedFlag (String vnfId) throws IOException {
- 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 aaiValidatorImpl.isPhysicalServerLocked(vnf.getVnfId());
-
- }
+ private static final Logger logger = LoggerFactory.getLogger(AAIVnfResources.class);
+
+ @Autowired
+ private InjectionHelper injectionHelper;
+
+ @Autowired
+ private AAIObjectMapper aaiObjectMapper;
+
+ private AAIValidatorImpl aaiValidatorImpl = new AAIValidatorImpl();
+
+ 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<org.onap.aai.domain.yang.GenericVnf> 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();
+ }
+
+ public void connectVnfToCloudRegion(GenericVnf vnf, CloudRegion cloudRegion) {
+ AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
+ cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
+ AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ injectionHelper.getAaiClient().connect(vnfURI, cloudRegionURI);
+ }
+
+ public void connectVnfToTenant(GenericVnf vnf, CloudRegion cloudRegion) {
+ AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(),
+ cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId());
+ AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ injectionHelper.getAaiClient().connect(tenantURI, vnfURI);
+ }
+
+ public boolean checkVnfClosedLoopDisabledFlag(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.isIsClosedLoopDisabled();
+ }
+
+ public boolean checkVnfPserversLockedFlag(String vnfId) throws IOException {
+ 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 aaiValidatorImpl.isPhysicalServerLocked(vnf.getVnfId());
+
+ }
}
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
index 7bb96ec2ed..c24d1483e2 100644
--- 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
@@ -38,51 +38,60 @@ import org.springframework.stereotype.Component;
@Component
public class AAIVolumeGroupResources {
- private static final Logger logger = LoggerFactory.getLogger(AAIVolumeGroupResources.class);
-
- @Autowired
- private InjectionHelper injectionHelper;
-
- @Autowired
- private AAIObjectMapper aaiObjectMapper;
+ private static final Logger logger = LoggerFactory.getLogger(AAIVolumeGroupResources.class);
- 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();
+ @Autowired
+ private InjectionHelper injectionHelper;
- 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);
- }
-
- public void updateHeatStackIdVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
- VolumeGroup copiedVolumeGroup = volumeGroup.shallowCopyId();
-
- copiedVolumeGroup.setHeatStackId(volumeGroup.getHeatStackId());
- injectionHelper.getAaiClient().update(uri, aaiObjectMapper.mapVolumeGroup(copiedVolumeGroup));
- }
+ @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);
+ }
+
+ public void updateHeatStackIdVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(),
+ cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+ VolumeGroup copiedVolumeGroup = volumeGroup.shallowCopyId();
+
+ copiedVolumeGroup.setHeatStackId(volumeGroup.getHeatStackId());
+ injectionHelper.getAaiClient().update(uri, aaiObjectMapper.mapVolumeGroup(copiedVolumeGroup));
+ }
}
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
index 092af30558..3ac61dff60 100644
--- 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
@@ -21,9 +21,7 @@
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;
@@ -38,65 +36,69 @@ import org.springframework.stereotype.Component;
@Component
public class AAIVpnBindingResources {
- @Autowired
- private InjectionHelper injectionHelper;
+ @Autowired
+ private InjectionHelper injectionHelper;
- @Autowired
- private AAIObjectMapper aaiObjectMapper;
+ @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 customer
+ */
+ public boolean existsCustomer(Customer customer) {
+ AAIResourceUri uriCustomer =
+ AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, customer.getGlobalCustomerId());
+ return injectionHelper.getAaiClient().exists(uriCustomer);
+ }
- /**
- * @param customerVpnId
- * @return
- */
- public Optional<VpnBindings> getVpnBindingByCustomerVpnId (String customerVpnId) {
- AAIResourceUri aaiVpnBindingsResourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VPN_BINDING)
- .queryParam("customer-vpn-id",customerVpnId);
- return injectionHelper.getAaiClient().get(VpnBindings.class,aaiVpnBindingsResourceUri);
+ /**
+ * @param customerVpnId
+ * @return
+ */
+ public Optional<VpnBindings> getVpnBindingByCustomerVpnId(String customerVpnId) {
+ AAIResourceUri aaiVpnBindingsResourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VPN_BINDING)
+ .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 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));
- }
+ /**
+ * @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<org.onap.aai.domain.yang.VpnBinding> getVpnBinding(String vpnId){
- return injectionHelper.getAaiClient()
- .get(org.onap.aai.domain.yang.VpnBinding.class, AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId));
- }
+ /**
+ * Retrieve VPN Binding from AAI using vpn-id
+ *
+ * @param vpnId - vpn-id required VPN Binding
+ * @return AAI VPN Binding
+ */
+ public Optional<org.onap.aai.domain.yang.VpnBinding> 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);
- }
+ /**
+ * @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/NamingServiceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java
index 2a25ec5ba1..06535bb765 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java
@@ -25,7 +25,6 @@ package org.onap.so.client.orchestration;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-
import org.onap.namingservice.model.Element;
import org.onap.namingservice.model.Deleteelement;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
@@ -39,26 +38,29 @@ import org.springframework.stereotype.Component;
@Component
public class NamingServiceResources {
- private static final Logger logger = LoggerFactory.getLogger(NamingServiceResources.class);
- private static final String NAMING_TYPE = "instanceGroup";
-
- @Autowired
- private NamingClient namingClient;
-
- @Autowired
- private NamingRequestObjectBuilder namingRequestObjectBuilder;
-
- public String generateInstanceGroupName(InstanceGroup instanceGroup, String policyInstanceName, String nfNamingCode) throws BadResponseException, IOException {
- Element element = namingRequestObjectBuilder.elementMapper(instanceGroup.getId(), policyInstanceName, NAMING_TYPE, nfNamingCode, instanceGroup.getInstanceGroupName());
- List<Element> elements = new ArrayList<Element>();
- elements.add(element);
- return(namingClient.postNameGenRequest(namingRequestObjectBuilder.nameGenRequestMapper(elements)));
- }
-
- public String deleteInstanceGroupName(InstanceGroup instanceGroup) throws BadResponseException, IOException {
- Deleteelement deleteElement = namingRequestObjectBuilder.deleteElementMapper(instanceGroup.getId());
- List<Deleteelement> deleteElements = new ArrayList<Deleteelement>();
- deleteElements.add(deleteElement);
- return(namingClient.deleteNameGenRequest(namingRequestObjectBuilder.nameGenDeleteRequestMapper(deleteElements)));
- }
+ private static final Logger logger = LoggerFactory.getLogger(NamingServiceResources.class);
+ private static final String NAMING_TYPE = "instanceGroup";
+
+ @Autowired
+ private NamingClient namingClient;
+
+ @Autowired
+ private NamingRequestObjectBuilder namingRequestObjectBuilder;
+
+ public String generateInstanceGroupName(InstanceGroup instanceGroup, String policyInstanceName, String nfNamingCode)
+ throws BadResponseException, IOException {
+ Element element = namingRequestObjectBuilder.elementMapper(instanceGroup.getId(), policyInstanceName,
+ NAMING_TYPE, nfNamingCode, instanceGroup.getInstanceGroupName());
+ List<Element> elements = new ArrayList<Element>();
+ elements.add(element);
+ return (namingClient.postNameGenRequest(namingRequestObjectBuilder.nameGenRequestMapper(elements)));
+ }
+
+ public String deleteInstanceGroupName(InstanceGroup instanceGroup) throws BadResponseException, IOException {
+ Deleteelement deleteElement = namingRequestObjectBuilder.deleteElementMapper(instanceGroup.getId());
+ List<Deleteelement> deleteElements = new ArrayList<Deleteelement>();
+ deleteElements.add(deleteElement);
+ return (namingClient
+ .deleteNameGenRequest(namingRequestObjectBuilder.nameGenDeleteRequestMapper(deleteElements)));
+ }
}
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
index 8f3445529e..b3efa71969 100644
--- 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
@@ -23,9 +23,7 @@ package org.onap.so.client.orchestration;
import java.io.UnsupportedEncodingException;
import java.util.Map;
import java.util.Optional;
-
import javax.ws.rs.core.Response;
-
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
@@ -48,66 +46,95 @@ import org.springframework.stereotype.Component;
@Component
public class NetworkAdapterResources {
-
- @Autowired
- private NetworkAdapterClientImpl networkAdapterClient;
-
- @Autowired
- private NetworkAdapterObjectMapper networkAdapterObjectMapper;
-
- public Optional<CreateNetworkResponse> createNetwork(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map<String, String> 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<RollbackNetworkResponse> rollbackCreateNetwork(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map<String, String> 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<UpdateNetworkResponse> updateNetwork(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map<String, String> 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<DeleteNetworkResponse> 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));
- }
-
- public Optional<Response> createNetworkAsync(CreateNetworkRequest createNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException {
-
- return Optional.of(networkAdapterClient.createNetworkAsync(createNetworkRequest));
- }
-
- public Optional<Response> deleteNetworkAsync(DeleteNetworkRequest deleteNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException {
-
- return Optional.of(networkAdapterClient.deleteNetworkAsync(deleteNetworkRequest.getNetworkId(), deleteNetworkRequest));
- }
-
- public Optional<Response> updateNetworkAsync(UpdateNetworkRequest updateNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException {
-
- return Optional.of(networkAdapterClient.updateNetworkAsync(updateNetworkRequest.getNetworkId(), updateNetworkRequest));
- }
-
- public Optional<RollbackNetworkResponse> rollbackCreateNetwork(String networkId, RollbackNetworkRequest rollbackNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException {
-
- return Optional.of(networkAdapterClient.rollbackNetwork(networkId, rollbackNetworkRequest));
- }
-
- public Optional<UpdateNetworkResponse> updateNetwork(UpdateNetworkRequest updateNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException {
-
- return Optional.of(networkAdapterClient.updateNetwork(updateNetworkRequest.getNetworkId(), updateNetworkRequest));
- }
-
- public Optional<DeleteNetworkResponse> deleteNetwork(DeleteNetworkRequest deleteNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException {
-
- return Optional.of(networkAdapterClient.deleteNetwork(deleteNetworkRequest.getNetworkId(), deleteNetworkRequest));
- }
+
+ @Autowired
+ private NetworkAdapterClientImpl networkAdapterClient;
+
+ @Autowired
+ private NetworkAdapterObjectMapper networkAdapterObjectMapper;
+
+ public Optional<CreateNetworkResponse> createNetwork(RequestContext requestContext, CloudRegion cloudRegion,
+ OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network,
+ Map<String, String> 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<RollbackNetworkResponse> rollbackCreateNetwork(RequestContext requestContext,
+ CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance,
+ L3Network l3Network, Map<String, String> 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<UpdateNetworkResponse> updateNetwork(RequestContext requestContext, CloudRegion cloudRegion,
+ OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network,
+ Map<String, String> 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<DeleteNetworkResponse> 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));
+ }
+
+ public Optional<Response> createNetworkAsync(CreateNetworkRequest createNetworkRequest)
+ throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ return Optional.of(networkAdapterClient.createNetworkAsync(createNetworkRequest));
+ }
+
+ public Optional<Response> deleteNetworkAsync(DeleteNetworkRequest deleteNetworkRequest)
+ throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ return Optional
+ .of(networkAdapterClient.deleteNetworkAsync(deleteNetworkRequest.getNetworkId(), deleteNetworkRequest));
+ }
+
+ public Optional<Response> updateNetworkAsync(UpdateNetworkRequest updateNetworkRequest)
+ throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ return Optional
+ .of(networkAdapterClient.updateNetworkAsync(updateNetworkRequest.getNetworkId(), updateNetworkRequest));
+ }
+
+ public Optional<RollbackNetworkResponse> rollbackCreateNetwork(String networkId,
+ RollbackNetworkRequest rollbackNetworkRequest)
+ throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ return Optional.of(networkAdapterClient.rollbackNetwork(networkId, rollbackNetworkRequest));
+ }
+
+ public Optional<UpdateNetworkResponse> updateNetwork(UpdateNetworkRequest updateNetworkRequest)
+ throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ return Optional
+ .of(networkAdapterClient.updateNetwork(updateNetworkRequest.getNetworkId(), updateNetworkRequest));
+ }
+
+ public Optional<DeleteNetworkResponse> deleteNetwork(DeleteNetworkRequest deleteNetworkRequest)
+ throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ return Optional
+ .of(networkAdapterClient.deleteNetwork(deleteNetworkRequest.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
index 9dc03ecb88..ca32130c23 100644
--- 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
@@ -34,90 +34,83 @@ 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 java.net.URI;
-
import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
@Component
public class SDNCConfigurationResources {
- @Autowired
- private GCTopologyOperationRequestMapper sdncRM;
+ @Autowired
+ private GCTopologyOperationRequestMapper sdncRM;
- /**
- * 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 GenericResourceApiGcTopologyOperationInformation assignVnrConfiguration(ServiceInstance serviceInstance,
- RequestContext requestContext,
- Customer customer,
- Configuration vnrConfiguration,
- GenericVnf voiceVnf, String sdncRequestId, URI callbackUri)
- throws MapperException, BadResponseException {
- return sdncRM.assignOrActivateVnrReqMapper(
- SDNCSvcAction.ASSIGN,
- GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE ,
- serviceInstance , requestContext, customer, vnrConfiguration,voiceVnf,sdncRequestId,callbackUri);
- }
+ /**
+ * 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 GenericResourceApiGcTopologyOperationInformation assignVnrConfiguration(ServiceInstance serviceInstance,
+ RequestContext requestContext, Customer customer, Configuration vnrConfiguration, GenericVnf voiceVnf,
+ String sdncRequestId, URI callbackUri) throws MapperException, BadResponseException {
+ return sdncRM.assignOrActivateVnrReqMapper(SDNCSvcAction.ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE, serviceInstance,
+ requestContext, customer, vnrConfiguration, voiceVnf, sdncRequestId, callbackUri);
+ }
- /**
- * SDNC Call to Activate VNR Configuration
- *
- * @param serviceInstance
- * @param requestContext
- * @param vnrConfiguration
- * @param voiceVnf
- * @return
- * @throws MapperException
- * @throws BadResponseException
- */
- public GenericResourceApiGcTopologyOperationInformation activateVnrConfiguration(ServiceInstance serviceInstance,
- RequestContext requestContext,
- Customer customer,
- Configuration vnrConfiguration,
- GenericVnf voiceVnf, String sdncRequestId, URI callbackUri)
- throws MapperException, BadResponseException {
- return sdncRM.assignOrActivateVnrReqMapper(
- SDNCSvcAction.ACTIVATE,
- GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE,
- serviceInstance , requestContext, customer, vnrConfiguration, voiceVnf,sdncRequestId,callbackUri);
- }
+ /**
+ * SDNC Call to Activate VNR Configuration
+ *
+ * @param serviceInstance
+ * @param requestContext
+ * @param vnrConfiguration
+ * @param voiceVnf
+ * @return
+ * @throws MapperException
+ * @throws BadResponseException
+ */
+ public GenericResourceApiGcTopologyOperationInformation activateVnrConfiguration(ServiceInstance serviceInstance,
+ RequestContext requestContext, Customer customer, Configuration vnrConfiguration, GenericVnf voiceVnf,
+ String sdncRequestId, URI callbackUri) throws MapperException, BadResponseException {
+ return sdncRM.assignOrActivateVnrReqMapper(SDNCSvcAction.ACTIVATE,
+ GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE, serviceInstance,
+ requestContext, customer, vnrConfiguration, voiceVnf, sdncRequestId, callbackUri);
+ }
- /**
- * method to unAssign Vnr Configuration in SDNC
- *
- * @param serviceInstance
- * @param requestContext
- * @param vnrConfiguration
- * @return
- * @throws BadResponseException
- * @throws MapperException
- */
- public GenericResourceApiGcTopologyOperationInformation unAssignVnrConfiguration(ServiceInstance serviceInstance, RequestContext requestContext,
- Configuration vnrConfiguration, String sdncRequestId, URI callbackUri) throws BadResponseException, MapperException {
- return sdncRM.deactivateOrUnassignVnrReqMapper
- (SDNCSvcAction.UNASSIGN,serviceInstance, requestContext, vnrConfiguration,sdncRequestId,callbackUri);
- }
+ /**
+ * method to unAssign Vnr Configuration in SDNC
+ *
+ * @param serviceInstance
+ * @param requestContext
+ * @param vnrConfiguration
+ * @return
+ * @throws BadResponseException
+ * @throws MapperException
+ */
+ public GenericResourceApiGcTopologyOperationInformation unAssignVnrConfiguration(ServiceInstance serviceInstance,
+ RequestContext requestContext, Configuration vnrConfiguration, String sdncRequestId, URI callbackUri)
+ throws BadResponseException, MapperException {
+ return sdncRM.deactivateOrUnassignVnrReqMapper(SDNCSvcAction.UNASSIGN, serviceInstance, requestContext,
+ vnrConfiguration, sdncRequestId, callbackUri);
+ }
- /***
- * Deactivate VNR SDNC Call
- * @param serviceInstance
- * @param requestContext
- * @param vnrConfiguration
- * @throws BadResponseException
- * @throws MapperException
- */
- public GenericResourceApiGcTopologyOperationInformation deactivateVnrConfiguration(ServiceInstance serviceInstance, RequestContext requestContext, Configuration vnrConfiguration, String sdncRequestId, URI callbackUri) throws BadResponseException, MapperException {
- return sdncRM.deactivateOrUnassignVnrReqMapper(
- SDNCSvcAction.DEACTIVATE,
- serviceInstance , requestContext, vnrConfiguration,sdncRequestId,callbackUri);
- }
+ /***
+ * Deactivate VNR SDNC Call
+ *
+ * @param serviceInstance
+ * @param requestContext
+ * @param vnrConfiguration
+ * @throws BadResponseException
+ * @throws MapperException
+ */
+ public GenericResourceApiGcTopologyOperationInformation deactivateVnrConfiguration(ServiceInstance serviceInstance,
+ RequestContext requestContext, Configuration vnrConfiguration, String sdncRequestId, URI callbackUri)
+ throws BadResponseException, MapperException {
+ return sdncRM.deactivateOrUnassignVnrReqMapper(SDNCSvcAction.DEACTIVATE, serviceInstance, requestContext,
+ vnrConfiguration, sdncRequestId, callbackUri);
+ }
}
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
index fb828c1981..54a9cabb57 100644
--- 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
@@ -39,64 +39,64 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCNetworkResources {
- private static final Logger logger = LoggerFactory.getLogger(SDNCNetworkResources.class);
+ private static final Logger logger = LoggerFactory.getLogger(SDNCNetworkResources.class);
- @Autowired
- private NetworkTopologyOperationRequestMapper sdncRM;
+ @Autowired
+ private NetworkTopologyOperationRequestMapper sdncRM;
- public GenericResourceApiNetworkOperationInformation assignNetwork(L3Network network,
- ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
- CloudRegion cloudRegion) {
- return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
- GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
- requestContext, cloudRegion);
- }
+ public GenericResourceApiNetworkOperationInformation assignNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ }
- public GenericResourceApiNetworkOperationInformation rollbackAssignNetwork(L3Network network,
- ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
- CloudRegion cloudRegion) {
- return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
- GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
- requestContext, cloudRegion);
- }
+ public GenericResourceApiNetworkOperationInformation rollbackAssignNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
+ GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ }
- public GenericResourceApiNetworkOperationInformation activateNetwork(L3Network network,
- ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
- CloudRegion cloudRegion) {
- return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE,
- GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
- requestContext, cloudRegion);
- }
+ public GenericResourceApiNetworkOperationInformation activateNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE,
+ GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ }
- public GenericResourceApiNetworkOperationInformation deactivateNetwork(L3Network network,
- ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
- CloudRegion cloudRegion) {
- return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
- GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
- requestContext, cloudRegion);
- }
+ public GenericResourceApiNetworkOperationInformation deactivateNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
+ GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ }
- public GenericResourceApiNetworkOperationInformation deleteNetwork(L3Network network,
- ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
- CloudRegion cloudRegion) {
- return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
- GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
- requestContext, cloudRegion);
- }
+ public GenericResourceApiNetworkOperationInformation deleteNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
+ GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ }
- public GenericResourceApiNetworkOperationInformation changeAssignNetwork(L3Network network,
- ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
- CloudRegion cloudRegion) {
- return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,
- GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
- requestContext, cloudRegion);
- }
+ public GenericResourceApiNetworkOperationInformation changeAssignNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ }
- public GenericResourceApiNetworkOperationInformation unassignNetwork(L3Network network,
- ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
- CloudRegion cloudRegion) {
- return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
- GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
- requestContext, cloudRegion);
- }
+ public GenericResourceApiNetworkOperationInformation unassignNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
+ GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ }
}
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
index a4c9b8fe05..960efea2f0 100644
--- 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
@@ -36,82 +36,81 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCServiceInstanceResources {
- @Autowired
- private ServiceTopologyOperationMapper sdncRM;
+ @Autowired
+ private ServiceTopologyOperationMapper sdncRM;
- /**
- * 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 GenericResourceApiServiceOperationInformation assignServiceInstance(ServiceInstance serviceInstance,
- Customer customer, RequestContext requestContext) {
- return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
- GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer,
- requestContext);
- }
+ /**
+ * 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 GenericResourceApiServiceOperationInformation assignServiceInstance(ServiceInstance serviceInstance,
+ Customer customer, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer,
+ requestContext);
+ }
- /**
- * 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 GenericResourceApiServiceOperationInformation deleteServiceInstance(ServiceInstance serviceInstance,
- Customer customer, RequestContext requestContext) {
- return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
- GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
- requestContext);
- }
+ /**
+ * 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 GenericResourceApiServiceOperationInformation deleteServiceInstance(ServiceInstance serviceInstance,
+ Customer customer, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
+ GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
+ requestContext);
+ }
- public GenericResourceApiServiceOperationInformation unassignServiceInstance(ServiceInstance serviceInstance,
- Customer customer, RequestContext requestContext) {
- return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
- GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
- requestContext);
- }
+ public GenericResourceApiServiceOperationInformation unassignServiceInstance(ServiceInstance serviceInstance,
+ Customer customer, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
+ GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
+ requestContext);
+ }
- /**
- * 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 GenericResourceApiServiceOperationInformation deactivateServiceInstance(ServiceInstance serviceInstance,
- Customer customer, RequestContext requestContext) {
- return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
- GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
- requestContext);
- }
+ /**
+ * 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 GenericResourceApiServiceOperationInformation deactivateServiceInstance(ServiceInstance serviceInstance,
+ Customer customer, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
+ GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
+ requestContext);
+ }
- /**
- * 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 GenericResourceApiServiceOperationInformation changeModelServiceInstance(ServiceInstance serviceInstance,
- Customer customer, RequestContext requestContext) {
- return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,
- GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer,
- requestContext);
- }
+ /**
+ * 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 GenericResourceApiServiceOperationInformation changeModelServiceInstance(ServiceInstance serviceInstance,
+ Customer customer, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer,
+ requestContext);
+ }
}
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
index 1e3d655298..60cad78f5d 100644
--- 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
@@ -43,50 +43,50 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCVfModuleResources {
- private static final Logger logger = LoggerFactory.getLogger(SDNCVfModuleResources.class);
+ private static final Logger logger = LoggerFactory.getLogger(SDNCVfModuleResources.class);
- @Autowired
- private VfModuleTopologyOperationRequestMapper sdncRM;
+ @Autowired
+ private VfModuleTopologyOperationRequestMapper sdncRM;
- @Autowired
- private SDNCClient sdncClient;
+ @Autowired
+ private SDNCClient sdncClient;
- public GenericResourceApiVfModuleOperationInformation assignVfModule(VfModule vfModule, VolumeGroup volumeGroup,
- GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion,
- RequestContext requestContext) throws MapperException {
- return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule,
- volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
- }
+ public GenericResourceApiVfModuleOperationInformation assignVfModule(VfModule vfModule, VolumeGroup volumeGroup,
+ GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion,
+ RequestContext requestContext) throws MapperException {
+ return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule,
+ volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ }
- public GenericResourceApiVfModuleOperationInformation unassignVfModule(VfModule vfModule, GenericVnf vnf,
- ServiceInstance serviceInstance) throws MapperException {
- return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null,
- vnf, serviceInstance, null, null, null, null);
- }
+ public GenericResourceApiVfModuleOperationInformation unassignVfModule(VfModule vfModule, GenericVnf vnf,
+ ServiceInstance serviceInstance) throws MapperException {
+ return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null,
+ vnf, serviceInstance, null, null, null, null);
+ }
- public GenericResourceApiVfModuleOperationInformation deactivateVfModule(VfModule vfModule, GenericVnf vnf,
- ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
- throws MapperException {
- return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, vfModule, null,
- vnf, serviceInstance, customer, cloudRegion, requestContext, null);
- }
+ public GenericResourceApiVfModuleOperationInformation deactivateVfModule(VfModule vfModule, GenericVnf vnf,
+ ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
+ throws MapperException {
+ return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, vfModule, null,
+ vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ }
- public String queryVfModule(VfModule vfModule) throws MapperException, BadResponseException {
- String objectPath = vfModule.getSelflink();
- return sdncClient.get(objectPath);
- }
+ public String queryVfModule(VfModule vfModule) throws MapperException, BadResponseException {
+ String objectPath = vfModule.getSelflink();
+ return sdncClient.get(objectPath);
+ }
- public GenericResourceApiVfModuleOperationInformation activateVfModule(VfModule vfModule, GenericVnf vnf,
- ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
- throws MapperException {
- return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE, vfModule, null,
- vnf, serviceInstance, customer, cloudRegion, requestContext, null);
- }
+ public GenericResourceApiVfModuleOperationInformation activateVfModule(VfModule vfModule, GenericVnf vnf,
+ ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
+ throws MapperException {
+ return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE, vfModule, null,
+ vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ }
- public GenericResourceApiVfModuleOperationInformation changeAssignVfModule(VfModule vfModule, GenericVnf vnf,
- ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
- throws MapperException {
- return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, vfModule,
- null, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
- }
+ public GenericResourceApiVfModuleOperationInformation changeAssignVfModule(VfModule vfModule, GenericVnf vnf,
+ ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
+ throws MapperException {
+ return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, vfModule,
+ null, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ }
}
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
index d8f2e47224..954cbc1b1d 100644
--- 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
@@ -42,54 +42,60 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCVnfResources {
- private static final Logger logger = LoggerFactory.getLogger(SDNCVnfResources.class);
+ private static final Logger logger = LoggerFactory.getLogger(SDNCVnfResources.class);
- @Autowired
- private VnfTopologyOperationRequestMapper sdncRM;
-
- @Autowired
- private SDNCClient sdncClient;
-
- public GenericResourceApiVnfOperationInformation assignVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
- CloudRegion cloudRegion, RequestContext requestContext, boolean homing) {
- return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
- SDNCSvcAction.ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext, homing);
- }
+ @Autowired
+ private VnfTopologyOperationRequestMapper sdncRM;
- public GenericResourceApiVnfOperationInformation activateVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
- CloudRegion cloudRegion, RequestContext requestContext) {
- return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
- SDNCSvcAction.ACTIVATE,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,cloudRegion, requestContext, false);
- }
+ @Autowired
+ private SDNCClient sdncClient;
-
- public GenericResourceApiVnfOperationInformation deactivateVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
- CloudRegion cloudRegion, RequestContext requestContext) {
- return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
- SDNCSvcAction.DEACTIVATE,GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer,cloudRegion, requestContext, false);
- }
+ public GenericResourceApiVnfOperationInformation assignVnf(GenericVnf vnf, ServiceInstance serviceInstance,
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing) {
+ return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
+ cloudRegion, requestContext, homing);
+ }
-
- public GenericResourceApiVnfOperationInformation unassignVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
- CloudRegion cloudRegion, RequestContext requestContext) {
- return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
- SDNCSvcAction.UNASSIGN,GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext, false);
- }
-
- public GenericResourceApiVnfOperationInformation deleteVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
- CloudRegion cloudRegion, RequestContext requestContext) {
- return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
- SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE,vnf, serviceInstance, customer, cloudRegion, requestContext, false);
- }
-
- public GenericResourceApiVnfOperationInformation changeModelVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
- CloudRegion cloudRegion, RequestContext requestContext) {
- return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
- SDNCSvcAction.CHANGE_ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext, false);
- }
-
- public String queryVnf(GenericVnf vnf) throws MapperException, BadResponseException {
- String queryPath = vnf.getSelflink();
- return sdncClient.get(queryPath);
- }
+ public GenericResourceApiVnfOperationInformation activateVnf(GenericVnf vnf, ServiceInstance serviceInstance,
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE,
+ GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
+ cloudRegion, requestContext, false);
+ }
+
+
+ public GenericResourceApiVnfOperationInformation deactivateVnf(GenericVnf vnf, ServiceInstance serviceInstance,
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
+ GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer,
+ cloudRegion, requestContext, false);
+ }
+
+
+ public GenericResourceApiVnfOperationInformation unassignVnf(GenericVnf vnf, ServiceInstance serviceInstance,
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
+ GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer,
+ cloudRegion, requestContext, false);
+ }
+
+ public GenericResourceApiVnfOperationInformation deleteVnf(GenericVnf vnf, ServiceInstance serviceInstance,
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
+ GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer,
+ cloudRegion, requestContext, false);
+ }
+
+ public GenericResourceApiVnfOperationInformation changeModelVnf(GenericVnf vnf, ServiceInstance serviceInstance,
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
+ cloudRegion, requestContext, false);
+ }
+
+ 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
index dac89a495d..e93b80c562 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -30,24 +29,23 @@ import org.springframework.stereotype.Component;
@Component
public class SDNOHealthCheckResources {
- @Autowired
- private InjectionHelper injectionHelper;
-
+ @Autowired
+ private InjectionHelper injectionHelper;
+
/**
* SDNO Call to Check Health Status
*
* @param vnf
- * @param requestContext *
+ * @param requestContext *
* @return healthCheckResult
- * @throws
- * @throws Exception
+ * @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);
+ String requestId = requestContext.getMsoRequestId();
+ String requestorId = requestContext.getRequestorId();
+ String vnfId = vnf.getVnfId();
+ UUID uuid = UUID.fromString(requestId);
- return injectionHelper.getSdnoValidator().healthDiagnostic(vnfId, uuid, requestorId);
- }
+ 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
index de59e6835e..939f53727d 100644
--- 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
@@ -23,7 +23,6 @@
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;
@@ -41,19 +40,23 @@ import org.springframework.stereotype.Component;
@Component
public class VnfAdapterVfModuleResources {
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterVfModuleResources.class);
-
- @Autowired
- private VnfAdapterVfModuleObjectMapper vnfAdapterVfModuleObjectMapper;
-
- public CreateVfModuleRequest createVfModuleRequest(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
- VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws IOException {
- return vnfAdapterVfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup, 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);
- }
+ private static final Logger logger = LoggerFactory.getLogger(VnfAdapterVfModuleResources.class);
+
+ @Autowired
+ private VnfAdapterVfModuleObjectMapper vnfAdapterVfModuleObjectMapper;
+
+ public CreateVfModuleRequest createVfModuleRequest(RequestContext requestContext, CloudRegion cloudRegion,
+ OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
+ VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse)
+ throws IOException {
+ return vnfAdapterVfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion,
+ orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup, 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
index 737e9eeb37..c97ca8e0ea 100644
--- 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
@@ -39,19 +39,24 @@ import org.springframework.stereotype.Component;
@Component
public class VnfAdapterVolumeGroupResources {
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterVolumeGroupResources.class);
+ private static final Logger logger = LoggerFactory.getLogger(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 DeleteVolumeGroupRequest deleteVolumeGroupRequest(RequestContext requestContext, CloudRegion cloudRegion, ServiceInstance serviceInstance, VolumeGroup volumeGroup) throws Exception {
- return vnfAdapterObjectMapper.deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup);
- }
+ @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 DeleteVolumeGroupRequest deleteVolumeGroupRequest(RequestContext requestContext, CloudRegion cloudRegion,
+ ServiceInstance serviceInstance, VolumeGroup volumeGroup) throws Exception {
+ return vnfAdapterObjectMapper.deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance,
+ volumeGroup);
+ }
}
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
index cae4a19f20..732bba8489 100644
--- 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
@@ -23,9 +23,7 @@
package org.onap.so.client.sdnc;
import java.util.LinkedHashMap;
-
import javax.ws.rs.core.UriBuilder;
-
import org.onap.so.bpmn.common.baseclient.BaseClient;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
@@ -41,65 +39,63 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCClient {
- private static final Logger logger = LoggerFactory.getLogger(SDNCClient.class);
+ private static final Logger logger = LoggerFactory.getLogger(SDNCClient.class);
+
+ @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() + "/";
+ BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
+
+ STOClient.setTargetUrl(targetUrl);
+ HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
+ STOClient.setHttpHeader(httpHeader);
+ LinkedHashMap<String, Object> output =
+ STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
+ return sdnCommonTasks.validateSDNResponse(output);
+ }
+
- @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() + "/";
- BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
+ public String post(Object request, String url) throws MapperException, BadResponseException {
+ String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
+ BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
+ STOClient.setTargetUrl(url);
+ HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
+ STOClient.setHttpHeader(httpHeader);
+ LinkedHashMap<String, Object> output =
+ STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
+ return sdnCommonTasks.validateSDNResponse(output);
+ }
- STOClient.setTargetUrl(targetUrl);
- HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
- STOClient.setHttpHeader(httpHeader);
- LinkedHashMap<String, Object> output = STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
- return sdnCommonTasks.validateSDNResponse(output);
- }
-
-
- public String post(Object request, String url) throws MapperException, BadResponseException {
- String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
- BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
- STOClient.setTargetUrl(url);
- HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
- STOClient.setHttpHeader(httpHeader);
- LinkedHashMap<String, Object> output = STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
- 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();
- BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
- STOClient.setTargetUrl(targetUrl);
- HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
- STOClient.setHttpHeader(httpHeader);
- LinkedHashMap<String, Object> output = STOClient.get(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
- return sdnCommonTasks.validateSDNGetResponse(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();
+ BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
+ STOClient.setTargetUrl(targetUrl);
+ HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
+ STOClient.setHttpHeader(httpHeader);
+ LinkedHashMap<String, Object> output =
+ STOClient.get(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
+ 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
index 418e70a09e..e21f64accd 100644
--- 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
@@ -25,7 +25,6 @@ package org.onap.so.client.sdnc;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
-
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpStatus;
import org.onap.so.client.exception.BadResponseException;
@@ -38,7 +37,6 @@ 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;
@@ -52,7 +50,8 @@ public class SdnCommonTasks {
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.";
+ private static final String COULD_NOT_CONVERT_SDNC_POJO_TO_JSON =
+ "ERROR: Could not convert SDNC pojo to json string.";
/***
*
@@ -67,8 +66,7 @@ public class SdnCommonTasks {
try {
jsonRequest = objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(request);
} catch (JsonProcessingException e) {
- logger.error("{} {} {} {} {}", MessageEnum.JAXB_EXCEPTION.toString(),
- COULD_NOT_CONVERT_SDNC_POJO_TO_JSON,
+ logger.error("{} {} {} {} {}", MessageEnum.JAXB_EXCEPTION.toString(), COULD_NOT_CONVERT_SDNC_POJO_TO_JSON,
"BPMN", ErrorCode.DataError.getValue(), e.getMessage());
throw new MapperException(COULD_NOT_CONVERT_SDNC_POJO_TO_JSON);
}
@@ -98,41 +96,41 @@ public class SdnCommonTasks {
* @return
* @throws BadResponseException
*/
- public String validateSDNResponse(LinkedHashMap<String, Object> output) throws BadResponseException {
- if (CollectionUtils.isEmpty(output)) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN",
- ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC);
- throw new BadResponseException(NO_RESPONSE_FROM_SDNC);
- }
- LinkedHashMap<String, Object> embeddedResponse =(LinkedHashMap<String, Object>) output.get("output");
+ public String validateSDNResponse(LinkedHashMap<String, Object> output) throws BadResponseException {
+ if (CollectionUtils.isEmpty(output)) {
+ logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN",
+ ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC);
+ throw new BadResponseException(NO_RESPONSE_FROM_SDNC);
+ }
+ LinkedHashMap<String, Object> embeddedResponse = (LinkedHashMap<String, Object>) output.get("output");
String responseCode = "";
String responseMessage = "";
if (embeddedResponse != null) {
- responseCode = (String) embeddedResponse.get(RESPONSE_CODE);
+ responseCode = (String) embeddedResponse.get(RESPONSE_CODE);
responseMessage = (String) embeddedResponse.get(RESPONSE_MESSAGE);
}
ObjectMapper objMapper = new ObjectMapper();
String jsonResponse;
- try {
- jsonResponse = objMapper.writeValueAsString(output);
- logger.debug(jsonResponse);
- } catch (JsonProcessingException e) {
- logger.warn("Could not convert SDNC Response to String", e);
- jsonResponse = "";
- }
- logger.info("ResponseCode: {} ResponseMessage: {}", responseCode, responseMessage);
- int code = StringUtils.isNotEmpty(responseCode) ? Integer.parseInt(responseCode) : 0;
- if (isHttpCodeSuccess(code)) {
- logger.info("Successful Response from SDNC");
- return jsonResponse;
- } else {
- String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage);
- logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), errorMessage, "BPMN",
- ErrorCode.DataError.getValue(), errorMessage);
- throw new BadResponseException(errorMessage);
- }
- }
-
+ try {
+ jsonResponse = objMapper.writeValueAsString(output);
+ logger.debug(jsonResponse);
+ } catch (JsonProcessingException e) {
+ logger.warn("Could not convert SDNC Response to String", e);
+ jsonResponse = "";
+ }
+ logger.info("ResponseCode: {} ResponseMessage: {}", responseCode, responseMessage);
+ int code = StringUtils.isNotEmpty(responseCode) ? Integer.parseInt(responseCode) : 0;
+ if (isHttpCodeSuccess(code)) {
+ logger.info("Successful Response from SDNC");
+ return jsonResponse;
+ } else {
+ String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage);
+ logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), errorMessage, "BPMN",
+ ErrorCode.DataError.getValue(), errorMessage);
+ throw new BadResponseException(errorMessage);
+ }
+ }
+
/***
*
* @param output
@@ -149,18 +147,16 @@ public class SdnCommonTasks {
logger.debug("Using object mapper");
String stringOutput = "";
try {
- stringOutput = objMapper.writeValueAsString(output);
- }
- catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), BAD_RESPONSE_FROM_SDNC,
- "BPMN", ErrorCode.UnknownError.getValue(),
- BAD_RESPONSE_FROM_SDNC);
+ stringOutput = objMapper.writeValueAsString(output);
+ } catch (Exception e) {
+ logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), BAD_RESPONSE_FROM_SDNC, "BPMN",
+ ErrorCode.UnknownError.getValue(), BAD_RESPONSE_FROM_SDNC);
throw new BadResponseException(BAD_RESPONSE_FROM_SDNC);
}
logger.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
index 08be73e3fd..15076fa45a 100644
--- 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
@@ -24,29 +24,34 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
-@ConfigurationProperties(prefix="sdnc")
+@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;
- }
+ 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/SDNCRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
index 3ee560f4f4..5910975051 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
@@ -23,72 +23,76 @@ package org.onap.so.client.sdnc.beans;
import java.io.Serializable;
import java.time.Duration;
import java.util.UUID;
-
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.EqualsBuilder;
-public class SDNCRequest implements Serializable{
-
- /**
- *
- */
- private static final long serialVersionUID = 4679678988657593282L;
- private String timeOut = "PT1H";
- private SDNCTopology topology;
- private String CorrelationValue = UUID.randomUUID().toString();
- private String CorrelationName = "SDNCCallback";
- private Object SDNCPayload;
-
-
- public String getTimeOut() {
- return timeOut;
- }
-
- public void setTimeOut(String timeOut) {
- this.timeOut = timeOut;
- }
-
- public SDNCTopology getTopology() {
- return topology;
- }
-
- public void setTopology(SDNCTopology topology) {
- this.topology = topology;
- }
-
- public String getCorrelationValue() {
- return CorrelationValue;
- }
- public void setCorrelationValue(String correlationValue) {
- CorrelationValue = correlationValue;
- }
- public String getCorrelationName() {
- return CorrelationName;
- }
- public void setCorrelationName(String correlationName) {
- CorrelationName = correlationName;
- }
- public Object getSDNCPayload() {
- return SDNCPayload;
- }
- public void setSDNCPayload(Object sDNCPayload) {
- SDNCPayload = sDNCPayload;
- }
-
- @Override
- public boolean equals(final Object other) {
- if (!(other instanceof SDNCRequest)) {
- return false;
- }
- SDNCRequest castOther = (SDNCRequest) other;
- return new EqualsBuilder().append(CorrelationValue, castOther.CorrelationValue)
- .append(CorrelationName, castOther.CorrelationName).isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(CorrelationValue).append(CorrelationName).toHashCode();
- }
+public class SDNCRequest implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 4679678988657593282L;
+ private String timeOut = "PT1H";
+ private SDNCTopology topology;
+ private String CorrelationValue = UUID.randomUUID().toString();
+ private String CorrelationName = "SDNCCallback";
+ private Object SDNCPayload;
+
+
+ public String getTimeOut() {
+ return timeOut;
+ }
+
+ public void setTimeOut(String timeOut) {
+ this.timeOut = timeOut;
+ }
+
+ public SDNCTopology getTopology() {
+ return topology;
+ }
+
+ public void setTopology(SDNCTopology topology) {
+ this.topology = topology;
+ }
+
+ public String getCorrelationValue() {
+ return CorrelationValue;
+ }
+
+ public void setCorrelationValue(String correlationValue) {
+ CorrelationValue = correlationValue;
+ }
+
+ public String getCorrelationName() {
+ return CorrelationName;
+ }
+
+ public void setCorrelationName(String correlationName) {
+ CorrelationName = correlationName;
+ }
+
+ public Object getSDNCPayload() {
+ return SDNCPayload;
+ }
+
+ public void setSDNCPayload(Object sDNCPayload) {
+ SDNCPayload = sDNCPayload;
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof SDNCRequest)) {
+ return false;
+ }
+ SDNCRequest castOther = (SDNCRequest) other;
+ return new EqualsBuilder().append(CorrelationValue, castOther.CorrelationValue)
+ .append(CorrelationName, castOther.CorrelationName).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(CorrelationValue).append(CorrelationName).toHashCode();
+ }
}
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
index 876c7e002f..1718de9fe0 100644
--- 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
@@ -23,33 +23,38 @@ package org.onap.so.client.sdnc.beans;
import org.onap.sdnc.northbound.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;
- }
+ 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
index ba9fedccac..b9b04bc7b7 100644
--- 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
@@ -22,23 +22,23 @@ 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;
- }
+ 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
index a709e80220..fb5f24694b 100644
--- 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
@@ -21,24 +21,21 @@
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;
- }
+
+ 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
index 7b86756afa..6af8c2f9c5 100644
--- 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
@@ -22,7 +22,6 @@ package org.onap.so.client.sdnc.mapper;
import java.net.URI;
import java.util.UUID;
-
import org.onap.sdnc.northbound.client.model.GenericResourceApiConfigurationinformationConfigurationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiGcrequestinputGcRequestInput;
@@ -42,27 +41,29 @@ import org.springframework.stereotype.Component;
@Component(value = "sdncGCTopologyOperationRequestMapper")
public class GCTopologyOperationRequestMapper {
- @Autowired
+ @Autowired
private GeneralTopologyObjectMapper generalTopologyObjectMapper;
public GenericResourceApiGcTopologyOperationInformation assignOrActivateVnrReqMapper(SDNCSvcAction svcAction,
- GenericResourceApiRequestActionEnumeration reqAction,
- ServiceInstance serviceInstance,
- RequestContext requestContext,
- Customer customer,
- Configuration vnrConfiguration,
- GenericVnf voiceVnf, String sdncReqId,URI callbackUri) {
+ GenericResourceApiRequestActionEnumeration reqAction, ServiceInstance serviceInstance,
+ RequestContext requestContext, Customer customer, Configuration vnrConfiguration, GenericVnf voiceVnf,
+ String sdncReqId, URI callbackUri) {
- String msoRequestId = UUID.randomUUID().toString();
- if (requestContext != null && requestContext.getMsoRequestId() != null) {
- msoRequestId = requestContext.getMsoRequestId();
- }
+ String msoRequestId = UUID.randomUUID().toString();
+ if (requestContext != null && requestContext.getMsoRequestId() != null) {
+ msoRequestId = requestContext.getMsoRequestId();
+ }
GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation();
- GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId,callbackUri.toString());
- GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, reqAction);
- GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, false);
- GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = generalTopologyObjectMapper.buildConfigurationInformation(vnrConfiguration,true);
- GenericResourceApiGcrequestinputGcRequestInput gcRequestInput = generalTopologyObjectMapper.buildGcRequestInformation(voiceVnf,null);
+ GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
+ generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId, callbackUri.toString());
+ GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper
+ .buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, 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);
@@ -75,21 +76,21 @@ public class GCTopologyOperationRequestMapper {
public GenericResourceApiGcTopologyOperationInformation deactivateOrUnassignVnrReqMapper(SDNCSvcAction svcAction,
- ServiceInstance serviceInstance,
- RequestContext requestContext,
- Configuration vnrConfiguration, String sdncReqId, URI callbackUri) {
+ ServiceInstance serviceInstance, RequestContext requestContext, Configuration vnrConfiguration,
+ String sdncReqId, URI callbackUri) {
- String msoRequestId = null;
- if (requestContext != null) {
- msoRequestId = requestContext.getMsoRequestId();
- }
- GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation();
+ String msoRequestId = null;
+ if (requestContext != null) {
+ msoRequestId = requestContext.getMsoRequestId();
+ }
+ GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation();
GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
- generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId,callbackUri.toString());
- GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper
- .buildGenericResourceApiRequestinformationRequestInformation(msoRequestId,
+ generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId, callbackUri.toString());
+ GenericResourceApiRequestinformationRequestInformation requestInformation =
+ generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId,
GenericResourceApiRequestActionEnumeration.DELETEGENERICCONFIGURATIONINSTANCE);
- GenericResourceApiServiceinformationServiceInformation serviceInformation = new GenericResourceApiServiceinformationServiceInformation();
+ GenericResourceApiServiceinformationServiceInformation serviceInformation =
+ new GenericResourceApiServiceinformationServiceInformation();
serviceInformation.setServiceInstanceId(serviceInstance.getServiceInstanceId());
GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation =
new GenericResourceApiConfigurationinformationConfigurationInformation();
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
index 756e5b068e..a9611cbde5 100644
--- 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
@@ -23,7 +23,6 @@ package org.onap.so.client.sdnc.mapper;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
import org.onap.sdnc.northbound.client.model.GenericResourceApiConfigurationinformationConfigurationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiGcrequestinputGcRequestInput;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkinformationNetworkInformation;
@@ -47,157 +46,183 @@ import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
-
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class GeneralTopologyObjectMapper {
-
- private static final Logger logger = LoggerFactory.getLogger(GeneralTopologyObjectMapper.class);
- private ObjectMapper mapper = new ObjectMapper();
-
- /*
- * Build GenericResourceApiRequestinformationRequestInformation
- */
- public GenericResourceApiRequestinformationRequestInformation buildGenericResourceApiRequestinformationRequestInformation(String msoReqId, GenericResourceApiRequestActionEnumeration requestAction){
-
- GenericResourceApiRequestinformationRequestInformation requestInformation = new GenericResourceApiRequestinformationRequestInformation();
- requestInformation.setRequestId(msoReqId);
- 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.setFromPreload(null);
- networkInformation.setNetworkId(network.getNetworkId());
- networkInformation.setNetworkType(network.getNetworkType());
- networkInformation.setNetworkTechnology(network.getNetworkTechnology());
- 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, RequestContext requestContext, boolean includeModelInformation) throws MapperException {
- GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation = new GenericResourceApiVfmoduleinformationVfModuleInformation();
- if (includeModelInformation) {
- if (vfModule.getModelInfoVfModule() == null) {
- throw new MapperException("VF Module model info is null for " + vfModule.getVfModuleId());
- }
- else {
- 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());
- if (requestContext != null && requestContext.getRequestParameters() != null) {
- vfModuleInformation.setFromPreload(requestContext.getRequestParameters().getUsePreload());
- }
- else {
- vfModuleInformation.setFromPreload(true);
- }
-
- return vfModuleInformation;
- }
-
-
- public GenericResourceApiSdncrequestheaderSdncRequestHeader buildSdncRequestHeader(SDNCSvcAction svcAction, String sdncReqId){
- return buildSdncRequestHeader(svcAction, sdncReqId, null);
- }
-
- public GenericResourceApiSdncrequestheaderSdncRequestHeader buildSdncRequestHeader(SDNCSvcAction svcAction, String sdncReqId, String callbackUrl){
- GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = new GenericResourceApiSdncrequestheaderSdncRequestHeader();
- sdncRequestHeader.setSvcAction(svcAction.getSdncApiAction());
- sdncRequestHeader.setSvcRequestId(sdncReqId);
- sdncRequestHeader.setSvcNotificationUrl(callbackUrl);
- return sdncRequestHeader;
- }
+
+ private static final Logger logger = LoggerFactory.getLogger(GeneralTopologyObjectMapper.class);
+ private ObjectMapper mapper = new ObjectMapper();
+
+ /*
+ * Build GenericResourceApiRequestinformationRequestInformation
+ */
+ public GenericResourceApiRequestinformationRequestInformation buildGenericResourceApiRequestinformationRequestInformation(
+ String msoReqId, GenericResourceApiRequestActionEnumeration requestAction) {
+
+ GenericResourceApiRequestinformationRequestInformation requestInformation =
+ new GenericResourceApiRequestinformationRequestInformation();
+ requestInformation.setRequestId(msoReqId);
+ 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.setFromPreload(null);
+ networkInformation.setNetworkId(network.getNetworkId());
+ networkInformation.setNetworkType(network.getNetworkType());
+ networkInformation.setNetworkTechnology(network.getNetworkTechnology());
+ 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, RequestContext requestContext,
+ boolean includeModelInformation) throws MapperException {
+ GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation =
+ new GenericResourceApiVfmoduleinformationVfModuleInformation();
+ if (includeModelInformation) {
+ if (vfModule.getModelInfoVfModule() == null) {
+ throw new MapperException("VF Module model info is null for " + vfModule.getVfModuleId());
+ } else {
+ 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());
+ if (requestContext != null && requestContext.getRequestParameters() != null) {
+ vfModuleInformation.setFromPreload(requestContext.getRequestParameters().getUsePreload());
+ } else {
+ vfModuleInformation.setFromPreload(true);
+ }
+
+ return vfModuleInformation;
+ }
+
+
+ public GenericResourceApiSdncrequestheaderSdncRequestHeader buildSdncRequestHeader(SDNCSvcAction svcAction,
+ String sdncReqId) {
+ return buildSdncRequestHeader(svcAction, sdncReqId, null);
+ }
+
+ public GenericResourceApiSdncrequestheaderSdncRequestHeader buildSdncRequestHeader(SDNCSvcAction svcAction,
+ String sdncReqId, String callbackUrl) {
+ GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
+ new GenericResourceApiSdncrequestheaderSdncRequestHeader();
+ sdncRequestHeader.setSvcAction(svcAction.getSdncApiAction());
+ sdncRequestHeader.setSvcRequestId(sdncReqId);
+ sdncRequestHeader.setSvcNotificationUrl(callbackUrl);
+ return sdncRequestHeader;
+ }
/**
- * Build ConfigurationInformation
+ * Build ConfigurationInformation
+ *
* @param configuration
* @param includeModelInformation
* @return
*/
- public GenericResourceApiConfigurationinformationConfigurationInformation buildConfigurationInformation(Configuration configuration, boolean includeModelInformation) {
- GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = new GenericResourceApiConfigurationinformationConfigurationInformation();
+ 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();
+ if (includeModelInformation) {
+ GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation =
+ new GenericResourceApiOnapmodelinformationOnapModelInformation();
onapModelInformation.setModelInvariantUuid(configuration.getModelInfoConfiguration().getModelInvariantId());
onapModelInformation.setModelUuid(configuration.getModelInfoConfiguration().getModelVersionId());
- onapModelInformation.setModelCustomizationUuid(configuration.getModelInfoConfiguration().getModelCustomizationId());
+ onapModelInformation
+ .setModelCustomizationUuid(configuration.getModelInfoConfiguration().getModelCustomizationId());
configurationInformation.setOnapModelInformation(onapModelInformation);
}
return configurationInformation;
@@ -205,35 +230,38 @@ public class GeneralTopologyObjectMapper {
/**
- * Build GcRequestInformation
+ * Build GcRequestInformation
+ *
* @param vnf
* @param genericResourceApiParam
* @return
*/
- public GenericResourceApiGcrequestinputGcRequestInput buildGcRequestInformation(GenericVnf vnf,GenericResourceApiParam genericResourceApiParam) {
- GenericResourceApiGcrequestinputGcRequestInput gcRequestInput = new GenericResourceApiGcrequestinputGcRequestInput();
+ public GenericResourceApiGcrequestinputGcRequestInput buildGcRequestInformation(GenericVnf vnf,
+ GenericResourceApiParam genericResourceApiParam) {
+ GenericResourceApiGcrequestinputGcRequestInput gcRequestInput =
+ new GenericResourceApiGcrequestinputGcRequestInput();
gcRequestInput.setVnfId(vnf.getVnfId());
- if(genericResourceApiParam != null) {
+ if (genericResourceApiParam != null) {
gcRequestInput.setInputParameters(genericResourceApiParam);
}
- return gcRequestInput;
- }
-
-
+ return gcRequestInput;
+ }
+
+
public String mapUserParamValue(Object value) {
- if (value == null) {
- return null;
- } else {
- if (value instanceof Map || value instanceof Set || value instanceof List) {
- try {
- return mapper.writeValueAsString(value);
- } catch (JsonProcessingException e) {
- logger.error("could not map value to string", e);
- throw new IllegalArgumentException(e);
- }
- } else {
- return value.toString();
- }
- }
+ if (value == null) {
+ return null;
+ } else {
+ if (value instanceof Map || value instanceof Set || value instanceof List) {
+ try {
+ return mapper.writeValueAsString(value);
+ } catch (JsonProcessingException e) {
+ logger.error("could not map value to string", e);
+ throw new IllegalArgumentException(e);
+ }
+ } else {
+ return value.toString();
+ }
+ }
}
}
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
index aef7e9e044..b1c95154c6 100644
--- 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
@@ -22,7 +22,6 @@ package org.onap.so.client.sdnc.mapper;
import java.util.Map;
import java.util.UUID;
-
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkinformationNetworkInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkrequestinputNetworkRequestInput;
@@ -48,59 +47,68 @@ import org.springframework.stereotype.Component;
*/
@Component
public class NetworkTopologyOperationRequestMapper {
-
- @Autowired
- private GeneralTopologyObjectMapper 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();
- String msoRequestId = UUID.randomUUID().toString();
- if (requestContext != null && requestContext.getMsoRequestId() != null) {
- msoRequestId = requestContext.getMsoRequestId();
- }
- GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
- GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, reqAction);
- GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
- GenericResourceApiNetworkinformationNetworkInformation networkInformation = generalTopologyObjectMapper.buildNetworkInformation(network);
- GenericResourceApiNetworkrequestinputNetworkRequestInput networkRequestInput = buildNetworkRequestInput(network, serviceInstance, cloudRegion);
+ @Autowired
+ private GeneralTopologyObjectMapper 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();
+ String msoRequestId = UUID.randomUUID().toString();
+ if (requestContext != null && requestContext.getMsoRequestId() != null) {
+ msoRequestId = requestContext.getMsoRequestId();
+ }
+ GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
+ generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
+ GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper
+ .buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, 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);
- req.setRequestInformation(requestInformation);
- req.setSdncRequestHeader(sdncRequestHeader);
- req.setServiceInformation(serviceInformation);
- req.setNetworkInformation(networkInformation);
+ if (requestContext != null && requestContext.getUserParams() != null) {
+ for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
+ GenericResourceApiParam networkInputParameters = new GenericResourceApiParam();
+ GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
+ paramItem.setName(entry.getKey());
+ paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
+ networkInputParameters.addParamItem(paramItem);
+ networkRequestInput.setNetworkInputParameters(networkInputParameters);
+ }
+ }
- if (requestContext != null && requestContext.getUserParams() != null) {
- for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
- GenericResourceApiParam networkInputParameters = new GenericResourceApiParam();
- GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
- paramItem.setName(entry.getKey());
- paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
- networkInputParameters.addParamItem(paramItem);
- networkRequestInput.setNetworkInputParameters(networkInputParameters);
- }
- }
+ req.setNetworkRequestInput(networkRequestInput);
+ return req;
+ }
- 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.setCloudOwner(cloudRegion.getCloudOwner());
- 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;
- }
+ /*
+ * Private helper to build GenericResourceApiNetworkrequestinputNetworkRequestInput
+ */
+ private GenericResourceApiNetworkrequestinputNetworkRequestInput buildNetworkRequestInput(L3Network network,
+ ServiceInstance serviceInstance, CloudRegion cloudRegion) {
+ GenericResourceApiNetworkrequestinputNetworkRequestInput networkRequestInput =
+ new GenericResourceApiNetworkrequestinputNetworkRequestInput();
+ networkRequestInput.setTenant(cloudRegion.getTenantId());
+ networkRequestInput.setCloudOwner(cloudRegion.getCloudOwner());
+ 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
index cdb4ab96aa..b5957b3009 100644
--- 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
@@ -22,7 +22,6 @@ package org.onap.so.client.sdnc.mapper;
import java.util.Map;
import java.util.UUID;
-
import org.onap.sdnc.northbound.client.model.GenericResourceApiParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
@@ -40,45 +39,51 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
-public class ServiceTopologyOperationMapper{
+public class ServiceTopologyOperationMapper {
+
+ @Autowired
+ public GeneralTopologyObjectMapper generalTopologyObjectMapper;
+
+ public GenericResourceApiServiceOperationInformation reqMapper(SDNCSvcOperation svcOperation,
+ SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration resourceAction,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext) {
+
+ String sdncReqId = UUID.randomUUID().toString();
+ String msoRequestId = UUID.randomUUID().toString();
+ if (requestContext != null && requestContext.getMsoRequestId() != null) {
+ msoRequestId = requestContext.getMsoRequestId();
+ }
+ GenericResourceApiServiceOperationInformation servOpInput = new GenericResourceApiServiceOperationInformation();
+ GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
+ generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
+ GenericResourceApiRequestinformationRequestInformation reqInfo = generalTopologyObjectMapper
+ .buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, resourceAction);
+ GenericResourceApiServiceinformationServiceInformation servInfo =
+ generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
+ GenericResourceApiServicerequestinputServiceRequestInput servReqInfo =
+ new GenericResourceApiServicerequestinputServiceRequestInput();
+
+ servReqInfo.setServiceInstanceName(serviceInstance.getServiceInstanceName());
- @Autowired
- public GeneralTopologyObjectMapper generalTopologyObjectMapper;
-
- public GenericResourceApiServiceOperationInformation reqMapper (SDNCSvcOperation svcOperation,
- SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration resourceAction,ServiceInstance serviceInstance, Customer customer, RequestContext requestContext) {
+ servOpInput.setSdncRequestHeader(sdncRequestHeader);
+ servOpInput.setRequestInformation(reqInfo);
+ servOpInput.setServiceInformation(servInfo);
+ servOpInput.setServiceRequestInput(servReqInfo);
- String sdncReqId = UUID.randomUUID().toString();
- String msoRequestId = UUID.randomUUID().toString();
- if (requestContext != null && requestContext.getMsoRequestId() != null) {
- msoRequestId = requestContext.getMsoRequestId();
- }
- GenericResourceApiServiceOperationInformation servOpInput = new GenericResourceApiServiceOperationInformation();
- GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
- GenericResourceApiRequestinformationRequestInformation reqInfo = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, resourceAction);
- GenericResourceApiServiceinformationServiceInformation servInfo = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
- GenericResourceApiServicerequestinputServiceRequestInput servReqInfo = new GenericResourceApiServicerequestinputServiceRequestInput();
-
- servReqInfo.setServiceInstanceName(serviceInstance.getServiceInstanceName());
-
- servOpInput.setSdncRequestHeader(sdncRequestHeader);
- servOpInput.setRequestInformation(reqInfo);
- servOpInput.setServiceInformation(servInfo);
- servOpInput.setServiceRequestInput(servReqInfo);
-
- if(requestContext != null && requestContext.getUserParams()!=null){
- for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
- GenericResourceApiServicerequestinputServiceRequestInput serviceRequestInput = new GenericResourceApiServicerequestinputServiceRequestInput();
- serviceRequestInput.setServiceInstanceName(serviceInstance.getServiceInstanceName());
- GenericResourceApiParam serviceInputParameters = new GenericResourceApiParam();
- GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
- paramItem.setName(entry.getKey());
- paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
- serviceInputParameters.addParamItem(paramItem );
- serviceRequestInput.serviceInputParameters(serviceInputParameters);
- servOpInput.setServiceRequestInput(serviceRequestInput );
- }
- }
- return servOpInput;
- }
+ if (requestContext != null && requestContext.getUserParams() != null) {
+ for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
+ GenericResourceApiServicerequestinputServiceRequestInput serviceRequestInput =
+ new GenericResourceApiServicerequestinputServiceRequestInput();
+ serviceRequestInput.setServiceInstanceName(serviceInstance.getServiceInstanceName());
+ GenericResourceApiParam serviceInputParameters = new GenericResourceApiParam();
+ GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
+ paramItem.setName(entry.getKey());
+ paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(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
index 86c718d165..6627625d62 100644
--- 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
@@ -24,7 +24,6 @@ package org.onap.so.client.sdnc.mapper;
import java.util.Map;
import java.util.UUID;
-
import org.onap.sdnc.northbound.client.model.GenericResourceApiParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
@@ -53,134 +52,146 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-
import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class VfModuleTopologyOperationRequestMapper {
- private static final Logger logger = LoggerFactory.getLogger(VfModuleTopologyOperationRequestMapper.class);
-
- @Autowired
- private GeneralTopologyObjectMapper generalTopologyObjectMapper;
-
- public GenericResourceApiVfModuleOperationInformation reqMapper(SDNCSvcOperation svcOperation,
- SDNCSvcAction svcAction, VfModule vfModule, VolumeGroup volumeGroup, GenericVnf vnf, ServiceInstance serviceInstance,
- Customer customer, CloudRegion cloudRegion, RequestContext requestContext, String sdncAssignResponse) throws MapperException {
- 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();
- String msoRequestId = UUID.randomUUID().toString();
- if (requestContext != null && requestContext.getMsoRequestId() != null) {
- msoRequestId = requestContext.getMsoRequestId();
- }
-
- GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId,
- requestAction);
- GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, includeModelInformation);
- GenericResourceApiVnfinformationVnfInformation vnfInformation = generalTopologyObjectMapper.buildVnfInformation(vnf, serviceInstance, includeModelInformation);
- GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation = generalTopologyObjectMapper.buildVfModuleInformation(vfModule, vnf, serviceInstance, requestContext, 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());
- vfModuleRequestInput.setCloudOwner(cloudRegion.getCloudOwner());
- }
- if (vfModule.getVfModuleName() != null && !vfModule.getVfModuleName().equals("")) {
- vfModuleRequestInput.setVfModuleName(vfModule.getVfModuleName());
- }
- GenericResourceApiParam vfModuleInputParameters = new GenericResourceApiParam();
-
- if (requestContext != null && requestContext.getUserParams() != null) {
- for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
- GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
- paramItem.setName(entry.getKey());
- paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
- vfModuleInputParameters.addParamItem(paramItem);
- }
- }
-
- if (vfModule.getCloudParams() != null) {
- for (Map.Entry<String, String> entry : vfModule.getCloudParams().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) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), e.getMessage(), "BPMN",
- ErrorCode.UnknownError.getValue(), e.getMessage());
- }
- }
- return objectPath;
- }
+ private static final Logger logger = LoggerFactory.getLogger(VfModuleTopologyOperationRequestMapper.class);
+
+ @Autowired
+ private GeneralTopologyObjectMapper generalTopologyObjectMapper;
+
+ public GenericResourceApiVfModuleOperationInformation reqMapper(SDNCSvcOperation svcOperation,
+ SDNCSvcAction svcAction, VfModule vfModule, VolumeGroup volumeGroup, GenericVnf vnf,
+ ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext,
+ String sdncAssignResponse) throws MapperException {
+ 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();
+ String msoRequestId = UUID.randomUUID().toString();
+ if (requestContext != null && requestContext.getMsoRequestId() != null) {
+ msoRequestId = requestContext.getMsoRequestId();
+ }
+
+ GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper
+ .buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, requestAction);
+ GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper
+ .buildServiceInformation(serviceInstance, requestContext, customer, includeModelInformation);
+ GenericResourceApiVnfinformationVnfInformation vnfInformation =
+ generalTopologyObjectMapper.buildVnfInformation(vnf, serviceInstance, includeModelInformation);
+ GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation = generalTopologyObjectMapper
+ .buildVfModuleInformation(vfModule, vnf, serviceInstance, requestContext, 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());
+ vfModuleRequestInput.setCloudOwner(cloudRegion.getCloudOwner());
+ }
+ if (vfModule.getVfModuleName() != null && !vfModule.getVfModuleName().equals("")) {
+ vfModuleRequestInput.setVfModuleName(vfModule.getVfModuleName());
+ }
+ GenericResourceApiParam vfModuleInputParameters = new GenericResourceApiParam();
+
+ if (requestContext != null && requestContext.getUserParams() != null) {
+ for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
+ GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
+ paramItem.setName(entry.getKey());
+ paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
+ vfModuleInputParameters.addParamItem(paramItem);
+ }
+ }
+
+ if (vfModule.getCloudParams() != null) {
+ for (Map.Entry<String, String> entry : vfModule.getCloudParams().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) {
+ logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), e.getMessage(), "BPMN",
+ ErrorCode.UnknownError.getValue(), 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
index 85e5b85529..f31bff988a 100644
--- 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
@@ -24,7 +24,6 @@ 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.sdnc.northbound.client.model.GenericResourceApiParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam;
@@ -52,93 +51,96 @@ import org.springframework.stereotype.Component;
@Component
public class VnfTopologyOperationRequestMapper {
- @Autowired
- private GeneralTopologyObjectMapper generalTopologyObjectMapper;
+ @Autowired
+ private GeneralTopologyObjectMapper 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();
+ String msoRequestId = UUID.randomUUID().toString();
+ if (requestContext != null && requestContext.getMsoRequestId() != null) {
+ msoRequestId = requestContext.getMsoRequestId();
+ }
+ GenericResourceApiVnfOperationInformation req = new GenericResourceApiVnfOperationInformation();
+ GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
+ generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
+ GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper
+ .buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, requestAction);
+ GenericResourceApiServiceinformationServiceInformation serviceInformation =
+ generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
+ GenericResourceApiVnfinformationVnfInformation vnfInformation =
+ generalTopologyObjectMapper.buildVnfInformation(vnf, serviceInstance, true);
+ GenericResourceApiVnfrequestinputVnfRequestInput vnfRequestInput =
+ new GenericResourceApiVnfrequestinputVnfRequestInput();
- 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();
- String msoRequestId = UUID.randomUUID().toString();
- if (requestContext != null && requestContext.getMsoRequestId() != null) {
- msoRequestId = requestContext.getMsoRequestId();
- }
- GenericResourceApiVnfOperationInformation req = new GenericResourceApiVnfOperationInformation();
- GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper
- .buildSdncRequestHeader(svcAction, sdncReqId);
- GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper
- .buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, 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());
+ vnfRequestInput.setCloudOwner(cloudRegion.getCloudOwner());
- vnfRequestInput.setTenant(cloudRegion.getTenantId());
- vnfRequestInput.setAicCloudRegion(cloudRegion.getLcpCloudRegionId());
- vnfRequestInput.setCloudOwner(cloudRegion.getCloudOwner());
-
- if (StringUtils.isNotBlank(vnf.getVnfName())) {
- vnfRequestInput.setVnfName(vnf.getVnfName());
- }
+ if (StringUtils.isNotBlank(vnf.getVnfName())) {
+ vnfRequestInput.setVnfName(vnf.getVnfName());
+ }
- req.setRequestInformation(requestInformation);
- req.setSdncRequestHeader(sdncRequestHeader);
- req.setServiceInformation(serviceInformation);
- req.setVnfInformation(vnfInformation);
+ req.setRequestInformation(requestInformation);
+ req.setSdncRequestHeader(sdncRequestHeader);
+ req.setServiceInformation(serviceInformation);
+ req.setVnfInformation(vnfInformation);
- GenericResourceApiParam vnfInputParameters = new GenericResourceApiParam();
- if (requestContext != null && requestContext.getUserParams() != null) {
- for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
- GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
- paramItem.setName(entry.getKey());
- paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
- vnfInputParameters.addParamItem(paramItem);
- vnfRequestInput.setVnfInputParameters(vnfInputParameters);
- }
- }
- if (vnf.getCloudParams() != null) {
- for (Map.Entry<String, String> 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<InstanceGroup> instanceGroups = vnf.getInstanceGroups();
- List<GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds> networkInstanceGroupIdList = new ArrayList<GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds>();
+ GenericResourceApiParam vnfInputParameters = new GenericResourceApiParam();
+ if (requestContext != null && requestContext.getUserParams() != null) {
+ for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
+ GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
+ paramItem.setName(entry.getKey());
+ paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
+ vnfInputParameters.addParamItem(paramItem);
+ vnfRequestInput.setVnfInputParameters(vnfInputParameters);
+ }
+ }
+ if (vnf.getCloudParams() != null) {
+ for (Map.Entry<String, String> 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<InstanceGroup> instanceGroups = vnf.getInstanceGroups();
+ List<GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds> networkInstanceGroupIdList =
+ new ArrayList<GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds>();
- for (InstanceGroup instanceGroup : instanceGroups) {
- if (ModelInfoInstanceGroup.TYPE_L3_NETWORK
- .equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) {
- GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds instanceGroupId = new GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds();
- instanceGroupId.setVnfNetworkInstanceGroupId(instanceGroup.getId());
- networkInstanceGroupIdList.add(instanceGroupId);
- }
- }
+ for (InstanceGroup instanceGroup : instanceGroups) {
+ if (ModelInfoInstanceGroup.TYPE_L3_NETWORK
+ .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;
- }
+ 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
index 5a48a757bc..f7aad558b2 100644
--- 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
@@ -23,7 +23,6 @@
package org.onap.so.client.sniro;
import java.util.LinkedHashMap;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.onap.so.bpmn.common.baseclient.BaseClient;
import org.onap.so.bpmn.core.UrnPropertiesReader;
@@ -38,82 +37,83 @@ import org.springframework.core.ParameterizedTypeReference;
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 Logger logger = LoggerFactory.getLogger(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{
- logger.trace("Started Sniro Client Post Demands");
- String url = managerProperties.getHost() + managerProperties.getUri().get("v2");
- logger.debug("Post demands url: {}", url);
- logger.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<String, LinkedHashMap<String, Object>> baseClient = new BaseClient<>();
-
- baseClient.setTargetUrl(url);
- baseClient.setHttpHeader(header);
-
- LinkedHashMap<String, Object> response = baseClient.post(homingRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
- validator.validateDemandsResponse(response);
- logger.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 {
- logger.trace("Started Sniro Client Post Release");
- String url = UrnPropertiesReader.getVariable("sniro.conductor.host") + UrnPropertiesReader.getVariable("sniro.conductor.uri");
- logger.debug("Post release url: {}", url);
- logger.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<String, LinkedHashMap<String, Object>> baseClient = new BaseClient<>();
-
- baseClient.setTargetUrl(url);
- baseClient.setHttpHeader(header);
-
- LinkedHashMap<String, Object> response = baseClient.post(releaseRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
- SniroValidator v = new SniroValidator();
- v.validateReleaseResponse(response);
- logger.trace("Completed Sniro Client Post Release");
- }
+ private static final Logger logger = LoggerFactory.getLogger(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 {
+ logger.trace("Started Sniro Client Post Demands");
+ String url = managerProperties.getHost() + managerProperties.getUri().get("v2");
+ logger.debug("Post demands url: {}", url);
+ logger.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<String, LinkedHashMap<String, Object>> baseClient = new BaseClient<>();
+
+ baseClient.setTargetUrl(url);
+ baseClient.setHttpHeader(header);
+
+ LinkedHashMap<String, Object> response = baseClient.post(homingRequest.toJsonString(),
+ new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
+ validator.validateDemandsResponse(response);
+ logger.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 {
+ logger.trace("Started Sniro Client Post Release");
+ String url = UrnPropertiesReader.getVariable("sniro.conductor.host")
+ + UrnPropertiesReader.getVariable("sniro.conductor.uri");
+ logger.debug("Post release url: {}", url);
+ logger.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<String, LinkedHashMap<String, Object>> baseClient = new BaseClient<>();
+
+ baseClient.setTargetUrl(url);
+ baseClient.setHttpHeader(header);
+
+ LinkedHashMap<String, Object> response = baseClient.post(releaseRequest.toJsonString(),
+ new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
+ SniroValidator v = new SniroValidator();
+ v.validateReleaseResponse(response);
+ logger.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
index dcccd319c6..a448082cfe 100644
--- 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
@@ -24,12 +24,9 @@ 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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -39,101 +36,103 @@ import org.springframework.stereotype.Component;
@Component
public class SniroValidator {
- private static final Logger logger = LoggerFactory.getLogger(SniroValidator.class);
-
- /**
- * Validates the synchronous homing response from sniro manager
- *
- * @throws BadResponseException
- */
- public void validateDemandsResponse(LinkedHashMap<String, Object> response) throws BadResponseException {
- logger.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")){
- logger.debug("Sniro Managers synchronous response indicates accepted");
- }else{
- String message = jsonResponse.getString("statusMessage");
- if(isNotBlank(message)){
- logger.debug("Sniro Managers response indicates failed: " + message);
- }else{
- logger.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{
- logger.debug("Sniro Managers synchronous response does not contain: request status");
- throw new BadResponseException("Sniro Managers synchronous response does not contain: request status");
- }
- }else{
- logger.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{
- logger.debug("Validating Sniro Managers asynchronous callback response");
- if(isNotBlank(response)) {
- JSONObject jsonResponse = new JSONObject(response);
- if(!jsonResponse.has("serviceException")){
- logger.debug("Sniro Managers asynchronous response is valid");
- }else{
- String message = jsonResponse.getJSONObject("serviceException").getString("text");
- if(isNotBlank(message)){
- logger.debug("Sniro Managers response contains a service exception: " + message);
- }else{
- logger.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{
- logger.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<String, Object> response) throws BadResponseException {
- logger.debug("Validating Sniro Conductors response");
- if(!response.isEmpty()){
- String status = (String) response.get("status");
- if(isNotBlank(status)){
- if(status.equals("success")){
- logger.debug("Sniro Conductors synchronous response indicates success");
- }else{
- String message = (String) response.get("message");
- if(isNotBlank(message)){
- logger.debug("Sniro Conductors response indicates failed: " + message);
- }else{
- logger.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{
- logger.debug("Sniro Managers Conductors response does not contain: status");
- throw new BadResponseException("Sniro Conductors synchronous response does not contain: status");
- }
- }else{
- logger.debug("Sniro Conductors response is empty");
- throw new BadResponseException("Sniro Conductors response is empty");
- }
-
- }
+ private static final Logger logger = LoggerFactory.getLogger(SniroValidator.class);
+
+ /**
+ * Validates the synchronous homing response from sniro manager
+ *
+ * @throws BadResponseException
+ */
+ public void validateDemandsResponse(LinkedHashMap<String, Object> response) throws BadResponseException {
+ logger.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")) {
+ logger.debug("Sniro Managers synchronous response indicates accepted");
+ } else {
+ String message = jsonResponse.getString("statusMessage");
+ if (isNotBlank(message)) {
+ logger.debug("Sniro Managers response indicates failed: " + message);
+ } else {
+ logger.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 {
+ logger.debug("Sniro Managers synchronous response does not contain: request status");
+ throw new BadResponseException("Sniro Managers synchronous response does not contain: request status");
+ }
+ } else {
+ logger.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 {
+ logger.debug("Validating Sniro Managers asynchronous callback response");
+ if (isNotBlank(response)) {
+ JSONObject jsonResponse = new JSONObject(response);
+ if (!jsonResponse.has("serviceException")) {
+ logger.debug("Sniro Managers asynchronous response is valid");
+ } else {
+ String message = jsonResponse.getJSONObject("serviceException").getString("text");
+ if (isNotBlank(message)) {
+ logger.debug("Sniro Managers response contains a service exception: " + message);
+ } else {
+ logger.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 {
+ logger.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<String, Object> response) throws BadResponseException {
+ logger.debug("Validating Sniro Conductors response");
+ if (!response.isEmpty()) {
+ String status = (String) response.get("status");
+ if (isNotBlank(status)) {
+ if (status.equals("success")) {
+ logger.debug("Sniro Conductors synchronous response indicates success");
+ } else {
+ String message = (String) response.get("message");
+ if (isNotBlank(message)) {
+ logger.debug("Sniro Conductors response indicates failed: " + message);
+ } else {
+ logger.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 {
+ logger.debug("Sniro Managers Conductors response does not contain: status");
+ throw new BadResponseException("Sniro Conductors synchronous response does not contain: status");
+ }
+ } else {
+ logger.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/Candidate.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
index 3b7e509752..cded23aad2 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
@@ -22,45 +22,43 @@ package org.onap.so.client.sniro.beans;
import java.io.Serializable;
import java.util.List;
-
import org.onap.so.bpmn.servicedecomposition.homingobjects.CandidateType;
-
import com.fasterxml.jackson.annotation.JsonProperty;
-public class Candidate implements Serializable{
+public class Candidate implements Serializable {
- private static final long serialVersionUID = -5474502255533410907L;
+ private static final long serialVersionUID = -5474502255533410907L;
- @JsonProperty("identifierType")
- private CandidateType identifierType;
- @JsonProperty("identifiers")
- private List<String> identifiers;
- @JsonProperty("cloudOwner")
- private String cloudOwner;
+ @JsonProperty("identifierType")
+ private CandidateType identifierType;
+ @JsonProperty("identifiers")
+ private List<String> identifiers;
+ @JsonProperty("cloudOwner")
+ private String cloudOwner;
- public CandidateType getIdentifierType(){
- return identifierType;
- }
+ public CandidateType getIdentifierType() {
+ return identifierType;
+ }
- public void setIdentifierType(CandidateType identifierType){
- this.identifierType = identifierType;
- }
+ public void setIdentifierType(CandidateType identifierType) {
+ this.identifierType = identifierType;
+ }
- public List<String> getIdentifiers(){
- return identifiers;
- }
+ public List<String> getIdentifiers() {
+ return identifiers;
+ }
- public void setIdentifiers(List<String> identifiers){
- this.identifiers = identifiers;
- }
+ public void setIdentifiers(List<String> identifiers) {
+ this.identifiers = identifiers;
+ }
- public String getCloudOwner(){
- return cloudOwner;
- }
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
- public void setCloudOwner(String cloudOwner){
- this.cloudOwner = cloudOwner;
- }
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
}
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
index 6e60bfa293..9ac8727a0f 100644
--- 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
@@ -21,7 +21,6 @@
package org.onap.so.client.sniro.beans;
import java.util.Map;
-
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@@ -29,33 +28,35 @@ import org.springframework.context.annotation.Configuration;
@ConfigurationProperties(prefix = "sniro.conductor")
public class ConductorProperties {
- private String host;
- private String uri;
-
- private Map<String, String> 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<String, String> getHeaders() {
- return headers;
- }
- public void setHeaders(Map<String, String> headers) {
- this.headers = headers;
- }
+ private String host;
+ private String uri;
+
+ private Map<String, String> 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<String, String> getHeaders() {
+ return headers;
+ }
+ public void setHeaders(Map<String, String> headers) {
+ this.headers = headers;
+ }
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java
index ed7875f286..19378cdbfa 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java
@@ -22,63 +22,62 @@ package org.onap.so.client.sniro.beans;
import java.io.Serializable;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
-public class Demand implements Serializable{
+public class Demand implements Serializable {
- private static final long serialVersionUID = 5676094538091859816L;
+ private static final long serialVersionUID = 5676094538091859816L;
- @JsonProperty("serviceResourceId")
- private String serviceResourceId;
- @JsonProperty("resourceModuleName")
- private String resourceModuleName;
- @JsonProperty("resourceModelInfo")
- private ModelInfo modelInfo;
- @JsonProperty("requiredCandidates")
- private List<Candidate> requiredCandidates;
- @JsonProperty("excludedCandidates")
- private List<Candidate> excludedCandidates;
+ @JsonProperty("serviceResourceId")
+ private String serviceResourceId;
+ @JsonProperty("resourceModuleName")
+ private String resourceModuleName;
+ @JsonProperty("resourceModelInfo")
+ private ModelInfo modelInfo;
+ @JsonProperty("requiredCandidates")
+ private List<Candidate> requiredCandidates;
+ @JsonProperty("excludedCandidates")
+ private List<Candidate> excludedCandidates;
- public List<Candidate> getRequiredCandidates(){
- return requiredCandidates;
- }
+ public List<Candidate> getRequiredCandidates() {
+ return requiredCandidates;
+ }
- public void setRequiredCandidates(List<Candidate> requiredCandidates){
- this.requiredCandidates = requiredCandidates;
- }
+ public void setRequiredCandidates(List<Candidate> requiredCandidates) {
+ this.requiredCandidates = requiredCandidates;
+ }
- public List<Candidate> getExcludedCandidates(){
- return excludedCandidates;
- }
+ public List<Candidate> getExcludedCandidates() {
+ return excludedCandidates;
+ }
- public void setExcludedCandidates(List<Candidate> excludedCandidates){
- this.excludedCandidates = excludedCandidates;
- }
+ public void setExcludedCandidates(List<Candidate> excludedCandidates) {
+ this.excludedCandidates = excludedCandidates;
+ }
- public String getServiceResourceId(){
- return serviceResourceId;
- }
+ public String getServiceResourceId() {
+ return serviceResourceId;
+ }
- public void setServiceResourceId(String serviceResourceId){
- this.serviceResourceId = serviceResourceId;
- }
+ public void setServiceResourceId(String serviceResourceId) {
+ this.serviceResourceId = serviceResourceId;
+ }
- public String getResourceModuleName(){
- return resourceModuleName;
- }
+ public String getResourceModuleName() {
+ return resourceModuleName;
+ }
- public void setResourceModuleName(String resourceModuleName){
- this.resourceModuleName = resourceModuleName;
- }
+ public void setResourceModuleName(String resourceModuleName) {
+ this.resourceModuleName = resourceModuleName;
+ }
- public ModelInfo getModelInfo(){
- return modelInfo;
- }
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
- public void setModelInfo(ModelInfo modelInfo){
- this.modelInfo = modelInfo;
- }
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java
index 209792b4d7..d71b4ec5fc 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java
@@ -23,23 +23,22 @@ package org.onap.so.client.sniro.beans;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
-public class LicenseInfo implements Serializable{
+public class LicenseInfo implements Serializable {
- private static final long serialVersionUID = 6878164369491185856L;
+ private static final long serialVersionUID = 6878164369491185856L;
- @JsonProperty("licenseDemands")
- private List<Demand> demands = new ArrayList<Demand>();
+ @JsonProperty("licenseDemands")
+ private List<Demand> demands = new ArrayList<Demand>();
- public List<Demand> getDemands(){
- return demands;
- }
+ public List<Demand> getDemands() {
+ return demands;
+ }
- public void setDemands(List<Demand> demands){
- this.demands = demands;
- }
+ public void setDemands(List<Demand> demands) {
+ this.demands = demands;
+ }
}
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
index 0070f2fe04..70b1a37b5e 100644
--- 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
@@ -21,7 +21,6 @@
package org.onap.so.client.sniro.beans;
import java.util.Map;
-
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@@ -29,30 +28,34 @@ import org.springframework.context.annotation.Configuration;
@ConfigurationProperties(prefix = "sniro.manager")
public class ManagerProperties {
- private String host;
- private Map<String, String> uri;
- private Map<String, String> headers;
-
-
- public String getHost() {
- return host;
- }
- public void setHost(String host) {
- this.host = host;
- }
- public Map<String, String> getUri() {
- return uri;
- }
- public void setUri(Map<String, String> uri) {
- this.uri = uri;
- }
- public Map<String, String> getHeaders() {
- return headers;
- }
- public void setHeaders(Map<String, String> headers) {
- this.headers = headers;
- }
+ private String host;
+ private Map<String, String> uri;
+ private Map<String, String> headers;
+
+
+ public String getHost() {
+ return host;
+ }
+
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ public Map<String, String> getUri() {
+ return uri;
+ }
+
+ public void setUri(Map<String, String> uri) {
+ this.uri = uri;
+ }
+
+ public Map<String, String> getHeaders() {
+ return headers;
+ }
+ public void setHeaders(Map<String, String> headers) {
+ this.headers = headers;
+ }
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java
index 34d746b8d2..6c1932e344 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java
@@ -21,62 +21,56 @@
package org.onap.so.client.sniro.beans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
-@JsonPropertyOrder({
- "modelName",
- "modelVersionId",
- "modelVersion",
- "modelInvariantId"
-})
+@JsonPropertyOrder({"modelName", "modelVersionId", "modelVersion", "modelInvariantId"})
@JsonRootName("modelInfo")
-public class ModelInfo implements Serializable{
+public class ModelInfo implements Serializable {
- private static final long serialVersionUID = 1488642558601651075L;
+ private static final long serialVersionUID = 1488642558601651075L;
- @JsonProperty("modelInvariantId")
- private String modelInvariantId;
- @JsonProperty("modelVersionId")
- private String modelVersionId;
- @JsonProperty("modelName")
- private String modelName;
- @JsonProperty("modelVersion")
- private String modelVersion;
+ @JsonProperty("modelInvariantId")
+ private String modelInvariantId;
+ @JsonProperty("modelVersionId")
+ private String modelVersionId;
+ @JsonProperty("modelName")
+ private String modelName;
+ @JsonProperty("modelVersion")
+ private String modelVersion;
- public String getModelInvariantId(){
- return modelInvariantId;
- }
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
- public void setModelInvariantId(String modelInvariantId){
- this.modelInvariantId = modelInvariantId;
- }
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
- public String getModelVersionId(){
- return modelVersionId;
- }
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
- public void setModelVersionId(String modelVersionId){
- this.modelVersionId = modelVersionId;
- }
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
- public String getModelName(){
- return modelName;
- }
+ public String getModelName() {
+ return modelName;
+ }
- public void setModelName(String modelName){
- this.modelName = modelName;
- }
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
- public String getModelVersion(){
- return modelVersion;
- }
+ public String getModelVersion() {
+ return modelVersion;
+ }
- public void setModelVersion(String modelVersion){
- this.modelVersion = modelVersion;
- }
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java
index 9ae2c72798..ae13903a22 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java
@@ -23,53 +23,48 @@ package org.onap.so.client.sniro.beans;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRawValue;
import com.fasterxml.jackson.annotation.JsonRootName;
-@JsonPropertyOrder({
- "subscriberInfo",
- "placementDemands",
- "requestParameters"
-})
+@JsonPropertyOrder({"subscriberInfo", "placementDemands", "requestParameters"})
@JsonRootName("placementInfo")
-public class PlacementInfo implements Serializable{
+public class PlacementInfo implements Serializable {
- private static final long serialVersionUID = -964488472247386556L;
+ private static final long serialVersionUID = -964488472247386556L;
- @JsonProperty("subscriberInfo")
- private SubscriberInfo subscriberInfo;
- @JsonProperty("placementDemands")
- private List<Demand> demands = new ArrayList<Demand>();
- @JsonRawValue
- @JsonProperty("requestParameters")
- private String requestParameters;
+ @JsonProperty("subscriberInfo")
+ private SubscriberInfo subscriberInfo;
+ @JsonProperty("placementDemands")
+ private List<Demand> demands = new ArrayList<Demand>();
+ @JsonRawValue
+ @JsonProperty("requestParameters")
+ private String requestParameters;
- public SubscriberInfo getSubscriberInfo(){
- return subscriberInfo;
- }
+ public SubscriberInfo getSubscriberInfo() {
+ return subscriberInfo;
+ }
- public void setSubscriberInfo(SubscriberInfo subscriberInfo){
- this.subscriberInfo = subscriberInfo;
- }
+ public void setSubscriberInfo(SubscriberInfo subscriberInfo) {
+ this.subscriberInfo = subscriberInfo;
+ }
- public List<Demand> getDemands(){
- return demands;
- }
+ public List<Demand> getDemands() {
+ return demands;
+ }
- public void setDemands(List<Demand> demands){
- this.demands = demands;
- }
+ public void setDemands(List<Demand> demands) {
+ this.demands = demands;
+ }
- public String getRequestParameters(){
- return requestParameters;
- }
+ public String getRequestParameters() {
+ return requestParameters;
+ }
- public void setRequestParameters(String requestParameters){
- this.requestParameters = requestParameters;
- }
+ public void setRequestParameters(String requestParameters) {
+ this.requestParameters = requestParameters;
+ }
}
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
index e92b5d1ca3..fc6aec7d14 100644
--- 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
@@ -21,77 +21,75 @@
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;
- @JsonProperty("callbackUrl")
- String callbackUrl;
- @JsonProperty("sourceId")
- String sourceId = "mso";
- @JsonProperty("requestType")
- String requestType;
- @JsonProperty("timeout")
- long timeout;
-
- 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;
- }
-
- public String getCallbackUrl(){
- return callbackUrl;
- }
-
- public void setCallbackUrl(String callbackUrl){
- this.callbackUrl = callbackUrl;
- }
-
- public String getSourceId(){
- return sourceId;
- }
-
- public void setSourceId(String sourceId){
- this.sourceId = sourceId;
- }
-
- public String getRequestType(){
- return requestType;
- }
-
- public void setRequestType(String requestType){
- this.requestType = requestType;
- }
-
- public long getTimeout(){
- return timeout;
- }
-
- public void setTimeout(long timeout){
- this.timeout = timeout;
- }
+public class RequestInfo implements Serializable {
+
+ private static final long serialVersionUID = -759180997599143791L;
+
+ @JsonProperty("transactionId")
+ String transactionId;
+ @JsonProperty("requestId")
+ String requestId;
+ @JsonProperty("callbackUrl")
+ String callbackUrl;
+ @JsonProperty("sourceId")
+ String sourceId = "mso";
+ @JsonProperty("requestType")
+ String requestType;
+ @JsonProperty("timeout")
+ long timeout;
+
+ 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;
+ }
+
+ public String getCallbackUrl() {
+ return callbackUrl;
+ }
+
+ public void setCallbackUrl(String callbackUrl) {
+ this.callbackUrl = callbackUrl;
+ }
+
+ public String getSourceId() {
+ return sourceId;
+ }
+
+ public void setSourceId(String sourceId) {
+ this.sourceId = sourceId;
+ }
+
+ public String getRequestType() {
+ return requestType;
+ }
+
+ public void setRequestType(String requestType) {
+ this.requestType = requestType;
+ }
+
+ public long getTimeout() {
+ return timeout;
+ }
+
+ public void setTimeout(long timeout) {
+ this.timeout = timeout;
+ }
}
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
index 8441a01072..b5d40a8e80 100644
--- 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
@@ -21,34 +21,33 @@
package org.onap.so.client.sniro.beans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
-public class Resource implements Serializable{
+public class Resource implements Serializable {
- private static final long serialVersionUID = 5949861520571440421L;
+ private static final long serialVersionUID = 5949861520571440421L;
- @JsonProperty("service-resource-id")
- private String serviceResourceId;
- @JsonProperty("status")
- private String status;
+ @JsonProperty("service-resource-id")
+ private String serviceResourceId;
+ @JsonProperty("status")
+ private String status;
- public String getServiceResourceId(){
- return serviceResourceId;
- }
+ public String getServiceResourceId() {
+ return serviceResourceId;
+ }
- public void setServiceResourceId(String serviceResourceId){
- this.serviceResourceId = serviceResourceId;
- }
+ public void setServiceResourceId(String serviceResourceId) {
+ this.serviceResourceId = serviceResourceId;
+ }
- public String getStatus(){
- return status;
- }
+ public String getStatus() {
+ return status;
+ }
- public void setStatus(String status){
- this.status = 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/ServiceInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java
index f035013cd5..8b6f234c1e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java
@@ -21,62 +21,56 @@
package org.onap.so.client.sniro.beans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
-@JsonPropertyOrder({
- "modelInfo",
- "serviceRole",
- "serviceInstanceId",
- "serviceName"
-})
+@JsonPropertyOrder({"modelInfo", "serviceRole", "serviceInstanceId", "serviceName"})
@JsonRootName("serviceInfo")
-public class ServiceInfo implements Serializable{
+public class ServiceInfo implements Serializable {
- private static final long serialVersionUID = -6866022419398548585L;
+ private static final long serialVersionUID = -6866022419398548585L;
- @JsonProperty("serviceInstanceId")
- private String serviceInstanceId;
- @JsonProperty("serviceName")
- private String serviceName;
- @JsonProperty("serviceRole")
- private String serviceRole;
- @JsonProperty("modelInfo")
- private ModelInfo modelInfo;
+ @JsonProperty("serviceInstanceId")
+ private String serviceInstanceId;
+ @JsonProperty("serviceName")
+ private String serviceName;
+ @JsonProperty("serviceRole")
+ private String serviceRole;
+ @JsonProperty("modelInfo")
+ private ModelInfo modelInfo;
- public String getServiceInstanceId(){
- return serviceInstanceId;
- }
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
- public void setServiceInstanceId(String serviceInstanceId){
- this.serviceInstanceId = serviceInstanceId;
- }
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
- public String getServiceName(){
- return serviceName;
- }
+ public String getServiceName() {
+ return serviceName;
+ }
- public void setServiceName(String serviceName){
- this.serviceName = serviceName;
- }
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
- public String getServiceRole(){
- return serviceRole;
- }
+ public String getServiceRole() {
+ return serviceRole;
+ }
- public void setServiceRole(String serviceRole){
- this.serviceRole = serviceRole;
- }
+ public void setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ }
- public ModelInfo getModelInfo(){
- return modelInfo;
- }
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
- public void setModelInfo(ModelInfo modelInfo){
- this.modelInfo = modelInfo;
- }
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
}
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
index 11417d646c..f632424c26 100644
--- 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
@@ -25,7 +25,6 @@ package org.onap.so.client.sniro.beans;
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.JsonInclude.Include;
@@ -35,32 +34,32 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class SniroConductorRequest implements Serializable{
+public class SniroConductorRequest implements Serializable {
- private static final long serialVersionUID = 1906052095861777655L;
- private static final Logger logger = LoggerFactory.getLogger(SniroConductorRequest.class);
+ private static final long serialVersionUID = 1906052095861777655L;
+ private static final Logger logger = LoggerFactory.getLogger(SniroConductorRequest.class);
- @JsonProperty("release-locks")
- private List<Resource> resources = new ArrayList<Resource>();
+ @JsonProperty("release-locks")
+ private List<Resource> resources = new ArrayList<Resource>();
- public List<Resource> getResources(){
- return resources;
- }
+ public List<Resource> 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){
- logger.error("Unable to convert SniroConductorRequest to string", e);
- }
- return json;
- }
+ @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) {
+ logger.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
index c1e376814f..4babbe5c39 100644
--- 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
@@ -23,7 +23,6 @@
package org.onap.so.client.sniro.beans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@@ -33,60 +32,67 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class SniroManagerRequest implements Serializable{
-
- private static final long serialVersionUID = -1541132882892163132L;
- private static final Logger logger = LoggerFactory.getLogger(SniroManagerRequest.class);
-
- @JsonProperty("requestInfo")
- private RequestInfo requestInformation;
- @JsonProperty("serviceInfo")
- private ServiceInfo serviceInformation;
- @JsonProperty("placementInfo")
- private PlacementInfo placementInformation;
- @JsonProperty("licenseInfo")
- private LicenseInfo licenseInformation;
-
-
- public RequestInfo getRequestInformation() {
- return requestInformation;
- }
- public void setRequestInformation(RequestInfo requestInformation) {
- this.requestInformation = requestInformation;
- }
- public ServiceInfo getServiceInformation() {
- return serviceInformation;
- }
- public void setServiceInformation(ServiceInfo serviceInformation) {
- this.serviceInformation = serviceInformation;
- }
- public PlacementInfo getPlacementInformation() {
- return placementInformation;
- }
- public void setPlacementInformation(PlacementInfo placementInformation) {
- this.placementInformation = placementInformation;
- }
- public LicenseInfo getLicenseInformation() {
- return licenseInformation;
- }
- public void setLicenseInformation(LicenseInfo 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){
- logger.error("Unable to convert SniroManagerRequest to string", e);
- }
- return json.replaceAll("\\\\", "");
- }
+public class SniroManagerRequest implements Serializable {
+
+ private static final long serialVersionUID = -1541132882892163132L;
+ private static final Logger logger = LoggerFactory.getLogger(SniroManagerRequest.class);
+
+ @JsonProperty("requestInfo")
+ private RequestInfo requestInformation;
+ @JsonProperty("serviceInfo")
+ private ServiceInfo serviceInformation;
+ @JsonProperty("placementInfo")
+ private PlacementInfo placementInformation;
+ @JsonProperty("licenseInfo")
+ private LicenseInfo licenseInformation;
+
+
+ public RequestInfo getRequestInformation() {
+ return requestInformation;
+ }
+
+ public void setRequestInformation(RequestInfo requestInformation) {
+ this.requestInformation = requestInformation;
+ }
+
+ public ServiceInfo getServiceInformation() {
+ return serviceInformation;
+ }
+
+ public void setServiceInformation(ServiceInfo serviceInformation) {
+ this.serviceInformation = serviceInformation;
+ }
+
+ public PlacementInfo getPlacementInformation() {
+ return placementInformation;
+ }
+
+ public void setPlacementInformation(PlacementInfo placementInformation) {
+ this.placementInformation = placementInformation;
+ }
+
+ public LicenseInfo getLicenseInformation() {
+ return licenseInformation;
+ }
+
+ public void setLicenseInformation(LicenseInfo 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) {
+ logger.error("Unable to convert SniroManagerRequest to string", e);
+ }
+ return json.replaceAll("\\\\", "");
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java
index b6b09cbf80..eaf8b6e379 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java
@@ -21,46 +21,45 @@
package org.onap.so.client.sniro.beans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRawValue;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("subscriberInfo")
-public class SubscriberInfo implements Serializable{
+public class SubscriberInfo implements Serializable {
- private static final long serialVersionUID = -6350949051379748872L;
+ private static final long serialVersionUID = -6350949051379748872L;
- @JsonProperty("globalSubscriberId")
- private String globalSubscriberId;
- @JsonProperty("subscriberName")
- private String subscriberName;
- @JsonProperty("subscriberCommonSiteId")
- private String subscriberCommonSiteId;
+ @JsonProperty("globalSubscriberId")
+ private String globalSubscriberId;
+ @JsonProperty("subscriberName")
+ private String subscriberName;
+ @JsonProperty("subscriberCommonSiteId")
+ private String subscriberCommonSiteId;
- public String getGlobalSubscriberId(){
- return globalSubscriberId;
- }
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
- public void setGlobalSubscriberId(String globalSubscriberId){
- this.globalSubscriberId = globalSubscriberId;
- }
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
- public String getSubscriberName(){
- return subscriberName;
- }
+ public String getSubscriberName() {
+ return subscriberName;
+ }
- public void setSubscriberName(String subscriberName){
- this.subscriberName = subscriberName;
- }
+ public void setSubscriberName(String subscriberName) {
+ this.subscriberName = subscriberName;
+ }
- public String getSubscriberCommonSiteId(){
- return subscriberCommonSiteId;
- }
+ public String getSubscriberCommonSiteId() {
+ return subscriberCommonSiteId;
+ }
- public void setSubscriberCommonSiteId(String subscriberCommonSiteId){
- this.subscriberCommonSiteId = subscriberCommonSiteId;
- }
+ public void setSubscriberCommonSiteId(String subscriberCommonSiteId) {
+ this.subscriberCommonSiteId = subscriberCommonSiteId;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/ticket/ExternalTicket.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/ticket/ExternalTicket.java
index 519afe6f2d..a78dffb4e0 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/ticket/ExternalTicket.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/ticket/ExternalTicket.java
@@ -1,155 +1,154 @@
package org.onap.so.client.ticket;
public class ExternalTicket {
- private String requestId;
- private String nfRole;
- private String currentActivity;
- private String description;
- private String subscriptionServiceType;
- private String requestorId;
- private String timeout;
- private String errorSource;
- private String errorCode;
- private String errorMessage;
- private String workStep;
+ private String requestId;
+ private String nfRole;
+ private String currentActivity;
+ private String description;
+ private String subscriptionServiceType;
+ private String requestorId;
+ private String timeout;
+ private String errorSource;
+ private String errorCode;
+ private String errorMessage;
+ private String workStep;
- public String getRequestId() {
- return requestId;
- }
+ public String getRequestId() {
+ return requestId;
+ }
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
- public String getNfRole() {
- return nfRole;
- }
+ public String getNfRole() {
+ return nfRole;
+ }
- public void setNfRole(String nfRole) {
- this.nfRole = nfRole;
- }
+ public void setNfRole(String nfRole) {
+ this.nfRole = nfRole;
+ }
- public String getCurrentActivity() {
- return currentActivity;
- }
+ public String getCurrentActivity() {
+ return currentActivity;
+ }
- public void setCurrentActivity(String currentActivity) {
- this.currentActivity = currentActivity;
- }
+ public void setCurrentActivity(String currentActivity) {
+ this.currentActivity = currentActivity;
+ }
- public String getDescription() {
- return description;
- }
+ public String getDescription() {
+ return description;
+ }
- public void setDescription(String description) {
- this.description = description;
- }
+ public void setDescription(String description) {
+ this.description = description;
+ }
- public String getSubscriptionServiceType() {
- return subscriptionServiceType;
- }
+ public String getSubscriptionServiceType() {
+ return subscriptionServiceType;
+ }
- public void setSubscriptionServiceType(String subscriptionServiceType) {
- this.subscriptionServiceType = subscriptionServiceType;
- }
+ public void setSubscriptionServiceType(String subscriptionServiceType) {
+ this.subscriptionServiceType = subscriptionServiceType;
+ }
- public String getRequestorId() {
- return requestorId;
- }
+ public String getRequestorId() {
+ return requestorId;
+ }
- public void setRequestorId(String requestorId) {
- this.requestorId = requestorId;
- }
+ public void setRequestorId(String requestorId) {
+ this.requestorId = requestorId;
+ }
- public String getTimeout() {
- return timeout;
- }
+ public String getTimeout() {
+ return timeout;
+ }
- public void setTimeout(String timeout) {
- this.timeout = timeout;
- }
+ public void setTimeout(String timeout) {
+ this.timeout = timeout;
+ }
- public String getErrorSource() {
- return errorSource;
- }
+ public String getErrorSource() {
+ return errorSource;
+ }
- public void setErrorSource(String errorSource) {
- this.errorSource = errorSource;
- }
+ public void setErrorSource(String errorSource) {
+ this.errorSource = errorSource;
+ }
- public String getErrorCode() {
- return errorCode;
- }
+ public String getErrorCode() {
+ return errorCode;
+ }
- public void setErrorCode(String errorCode) {
- this.errorCode = errorCode;
- }
+ public void setErrorCode(String errorCode) {
+ this.errorCode = errorCode;
+ }
- public String getErrorMessage() {
- return errorMessage;
- }
+ public String getErrorMessage() {
+ return errorMessage;
+ }
- public void setErrorMessage(String errorMessage) {
- this.errorMessage = errorMessage;
- }
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
- public String getWorkStep() {
- return workStep;
- }
+ public String getWorkStep() {
+ return workStep;
+ }
- public void setWorkStep(String workStep) {
- this.workStep = workStep;
- }
+ public void setWorkStep(String workStep) {
+ this.workStep = workStep;
+ }
- public void createTicket() throws Exception {
- //Replace with your ticket creation mechanism if any
- }
-
-
-
+ public void createTicket() throws Exception {
+ // Replace with your ticket creation mechanism if any
+ }
+
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/AllIntegrationTestSuites.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/AllIntegrationTestSuites.java
index 23fcddfe8a..c5cdae4425 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/AllIntegrationTestSuites.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/AllIntegrationTestSuites.java
@@ -21,12 +21,11 @@
package org.onap.so;
import org.junit.runner.RunWith;
-
import com.googlecode.junittoolbox.SuiteClasses;
import com.googlecode.junittoolbox.WildcardPatternSuite;
@RunWith(WildcardPatternSuite.class)
@SuiteClasses({"**/SniroHomingV2IT.class"})
-public class AllIntegrationTestSuites{
+public class AllIntegrationTestSuites {
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/BaseIntegrationTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/BaseIntegrationTest.java
index aefe4c64bf..3bb8fb70f2 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/BaseIntegrationTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/BaseIntegrationTest.java
@@ -21,7 +21,6 @@ package org.onap.so;
import java.io.IOException;
import java.io.InputStream;
-
import org.junit.Before;
import org.junit.runner.RunWith;
import org.onap.so.bpmn.buildingblock.SniroHomingV2;
@@ -40,7 +39,6 @@ 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.WireMockServer;
@RunWith(SpringRunner.class)
@@ -50,60 +48,60 @@ import com.github.tomakehurst.wiremock.WireMockServer;
@AutoConfigureWireMock(port = 0)
public abstract class BaseIntegrationTest extends TestDataSetup {
- @Value("${wiremock.server.port}")
- protected String wireMockPort;
+ @Value("${wiremock.server.port}")
+ protected String wireMockPort;
+
+ @SpyBean
+ protected SDNCClient SPY_sdncClient;
+
+ @SpyBean
+ protected SDNOHealthCheckResources MOCK_sdnoHealthCheckResources;
- @SpyBean
- protected SDNCClient SPY_sdncClient;
+ @SpyBean
+ protected SniroHomingV2 sniroHoming;
- @SpyBean
- protected SDNOHealthCheckResources MOCK_sdnoHealthCheckResources;
+ @SpyBean
+ protected SniroClient sniroClient;
- @SpyBean
- protected SniroHomingV2 sniroHoming;
+ @MockBean
+ protected ApplicationControllerAction appCClient;
- @SpyBean
- protected SniroClient sniroClient;
+ @MockBean
+ protected CatalogDbClient catalogDbClient;
- @MockBean
- protected ApplicationControllerAction appCClient;
+ @Autowired
+ protected WireMockServer wireMockServer;
- @MockBean
- protected CatalogDbClient catalogDbClient;
-
- @Autowired
- protected WireMockServer wireMockServer;
+ @Before
+ public void baseTestBefore() {
+ wireMockServer.resetAll();
+ }
- @Before
- public void baseTestBefore() {
- wireMockServer.resetAll();
- }
- public 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) {
- return "";
- }
- }
+ public 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) {
+ return "";
+ }
+ }
- private 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;
- }
+ private 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/EmbeddedMariaDbConfig.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java
index fb08e5e830..62d9ecee44 100644
--- 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
@@ -19,6 +19,7 @@
*/
package org.onap.so;
+
import ch.vorburger.exec.ManagedProcessException;
import ch.vorburger.mariadb4j.DBConfigurationBuilder;
import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
@@ -35,30 +36,25 @@ public class EmbeddedMariaDbConfig {
@Bean
MariaDB4jSpringService mariaDB4jSpringService() {
- MariaDB4jSpringService service = new MariaDB4jSpringService();
-
-
- service.getConfiguration().addArg("--lower_case_table_names=1");
+ 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
+ @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();
+ 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
index 366c9c11a9..24927b0d1c 100644
--- 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
@@ -34,51 +34,50 @@ import org.slf4j.LoggerFactory;
* </p>
*
* @author
- * @version ONAP Sep 15, 2017
+ * @version ONAP Sep 15, 2017
*/
public class FileUtil {
private static final Logger logger = LoggerFactory.getLogger(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;
- }
+
+ /**
+ * 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/IntegrationTestSuite.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/IntegrationTestSuite.java
index 0eddeb1649..50bbc1845f 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/IntegrationTestSuite.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/IntegrationTestSuite.java
@@ -21,7 +21,6 @@
package org.onap.so;
import org.junit.runner.RunWith;
-
import com.googlecode.junittoolbox.SuiteClasses;
import com.googlecode.junittoolbox.WildcardPatternSuite;
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
index 87153144c8..2e27b346ea 100644
--- 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
@@ -31,14 +31,14 @@ import org.springframework.context.annotation.Profile;
@SpringBootApplication
@Profile("test")
-@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {
- @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
+@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class,
+ excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.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");
-
-
- }
+ 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/UnitTestSuite.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/UnitTestSuite.java
index 82ad6582c5..890c81daeb 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/UnitTestSuite.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/UnitTestSuite.java
@@ -22,7 +22,6 @@ package org.onap.so;
import org.junit.runner.RunWith;
-
import com.googlecode.junittoolbox.SuiteClasses;
import com.googlecode.junittoolbox.WildcardPatternSuite;
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
index 6dc0b1861d..b40e43b959 100644
--- 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
@@ -58,96 +58,96 @@ import org.springframework.core.env.Environment;
@RunWith(MockitoJUnitRunner.Silent.class)
public abstract class BaseTaskTest extends TestDataSetup {
- @Mock
- protected AAIVolumeGroupResources aaiVolumeGroupResources;
+ @Mock
+ protected AAIVolumeGroupResources aaiVolumeGroupResources;
- @Mock
- protected AAIServiceInstanceResources aaiServiceInstanceResources;
+ @Mock
+ protected AAIServiceInstanceResources aaiServiceInstanceResources;
- @Mock
- protected AAIVnfResources aaiVnfResources;
+ @Mock
+ protected AAIVnfResources aaiVnfResources;
- @Mock
- protected AAIVfModuleResources aaiVfModuleResources;
+ @Mock
+ protected AAIVfModuleResources aaiVfModuleResources;
- @Mock
- protected AAIVpnBindingResources aaiVpnBindingResources;
+ @Mock
+ protected AAIVpnBindingResources aaiVpnBindingResources;
- @Mock
- protected AAINetworkResources aaiNetworkResources;
+ @Mock
+ protected AAINetworkResources aaiNetworkResources;
- @Mock
- protected AAICollectionResources aaiCollectionResources;
+ @Mock
+ protected AAICollectionResources aaiCollectionResources;
- @Mock
- protected NetworkAdapterResources networkAdapterResources;
+ @Mock
+ protected NetworkAdapterResources networkAdapterResources;
- @Mock
- protected VnfAdapterVolumeGroupResources vnfAdapterVolumeGroupResources;
+ @Mock
+ protected VnfAdapterVolumeGroupResources vnfAdapterVolumeGroupResources;
- @Mock
- protected VnfAdapterVfModuleResources vnfAdapterVfModuleResources;
+ @Mock
+ protected VnfAdapterVfModuleResources vnfAdapterVfModuleResources;
- @Mock
- protected SDNCVnfResources sdncVnfResources;
+ @Mock
+ protected SDNCVnfResources sdncVnfResources;
- @Mock
- protected SDNCNetworkResources sdncNetworkResources;
+ @Mock
+ protected SDNCNetworkResources sdncNetworkResources;
- @Mock
- protected SDNCVfModuleResources sdncVfModuleResources;
+ @Mock
+ protected SDNCVfModuleResources sdncVfModuleResources;
- @Mock
- protected SDNCServiceInstanceResources sdncServiceInstanceResources;
+ @Mock
+ protected SDNCServiceInstanceResources sdncServiceInstanceResources;
- @Mock
- protected AssignNetworkBBUtils assignNetworkBBUtils;
+ @Mock
+ protected AssignNetworkBBUtils assignNetworkBBUtils;
- @Mock
- protected NetworkAdapterObjectMapper networkAdapterObjectMapper;
+ @Mock
+ protected NetworkAdapterObjectMapper networkAdapterObjectMapper;
- @Mock
- protected AAIInstanceGroupResources aaiInstanceGroupResources;
-
- @Mock
- protected NamingServiceResources namingServiceResources;
+ @Mock
+ protected AAIInstanceGroupResources aaiInstanceGroupResources;
- @Mock
- protected ApplicationControllerAction appCClient;
+ @Mock
+ protected NamingServiceResources namingServiceResources;
- @Mock
- protected CatalogDbClient catalogDbClient;
+ @Mock
+ protected ApplicationControllerAction appCClient;
- @Mock
- protected RequestsDbClient requestsDbClient;
+ @Mock
+ protected CatalogDbClient catalogDbClient;
- @Mock
- protected BBInputSetupUtils bbSetupUtils;
+ @Mock
+ protected RequestsDbClient requestsDbClient;
- @Mock
- protected BBInputSetup bbInputSetup;
+ @Mock
+ protected BBInputSetupUtils bbSetupUtils;
- @Mock
- protected AAIConfigurationResources aaiConfigurationResources;
+ @Mock
+ protected BBInputSetup bbInputSetup;
- @Mock
- protected AAIObjectMapper MOCK_aaiObjectMapper;
+ @Mock
+ protected AAIConfigurationResources aaiConfigurationResources;
- @Mock
- protected InjectionHelper MOCK_injectionHelper;
+ @Mock
+ protected AAIObjectMapper MOCK_aaiObjectMapper;
- @Mock
- protected AAIResourcesClient MOCK_aaiResourcesClient;
+ @Mock
+ protected InjectionHelper MOCK_injectionHelper;
- @Mock
- protected ExtractPojosForBB extractPojosForBB;
+ @Mock
+ protected AAIResourcesClient MOCK_aaiResourcesClient;
- @Mock
- protected ExceptionBuilder exceptionUtil;
+ @Mock
+ protected ExtractPojosForBB extractPojosForBB;
- @Mock
- protected WorkflowActionExtractResourcesAAI workflowActionUtils;
-
- @Mock
- protected Environment env;
+ @Mock
+ protected ExceptionBuilder exceptionUtil;
+
+ @Mock
+ protected WorkflowActionExtractResourcesAAI workflowActionUtils;
+
+ @Mock
+ protected Environment env;
}
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
index a91ef66a29..95689e49cd 100644
--- 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
@@ -28,9 +28,7 @@ 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 java.io.IOException;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
@@ -56,154 +54,173 @@ import org.springframework.beans.factory.annotation.Autowired;
public class AAIFlagTasksTest extends BaseTaskTest {
- @InjectMocks
- private AAIFlagTasks aaiFlagTasks = new AAIFlagTasks();
-
- private GenericVnf genericVnf;
-
- @Before
- public void before() throws BBObjectNotFoundException {
- genericVnf = setGenericVnf();
- doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient();
- when(extractPojosForBB.extractByKey(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(RuntimeException.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(ArgumentMatchers.any(GenericVnf.class));
- aaiFlagTasks.modifyVnfInMaintFlag(execution, true);
- verify(aaiVnfResources, times(1)).updateObjectVnf(ArgumentMatchers.any(GenericVnf.class));
- }
-
- @Test
- public void modifyVnfInMaintFlagExceptionTest() {
-
- doThrow(new BpmnError("Unknown Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
- doThrow(RuntimeException.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));
- }
- }
-
- @Test
- public void checkVnfClosedLoopDisabledTestTrue() throws Exception {
- doThrow(new BpmnError("VNF Closed Loop Disabled in A&AI")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
- doReturn(false).when(aaiVnfResources).checkVnfClosedLoopDisabledFlag(isA(String.class));
- try {
- aaiFlagTasks.checkVnfClosedLoopDisabledFlag(execution);
- } catch (Exception e) {
- verify(aaiVnfResources, times(1)).checkVnfClosedLoopDisabledFlag(any(String.class));
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), eq("VNF Closed Loop Disabled in A&AI"));
- }
- }
-
- @Test
- public void checkVnfClosedLoopDisabledTestFalse() throws Exception {
- doReturn(false).when(aaiVnfResources).checkVnfClosedLoopDisabledFlag(isA(String.class));
- aaiFlagTasks.checkVnfClosedLoopDisabledFlag(execution);
- verify(exceptionUtil, times(0)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), any(int.class), any(String.class));
- }
-
- @Test
- public void checkVnfClosedLoopDisabledFlagExceptionTest() {
-
- doThrow(new BpmnError("Unknown Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
- doThrow(RuntimeException.class).when(aaiVnfResources).checkVnfClosedLoopDisabledFlag(isA(String.class));
- try {
- aaiFlagTasks.checkVnfClosedLoopDisabledFlag(execution);
- } catch (Exception e) {
- verify(aaiVnfResources, times(1)).checkVnfClosedLoopDisabledFlag(any(String.class));
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
- }
- }
-
- @Test
- public void modifyVnfClosedLoopDisabledFlagTest() throws Exception {
- doNothing().when(aaiVnfResources).updateObjectVnf(ArgumentMatchers.any(GenericVnf.class));
- aaiFlagTasks.modifyVnfClosedLoopDisabledFlag(execution, true);
- verify(aaiVnfResources, times(1)).updateObjectVnf(ArgumentMatchers.any(GenericVnf.class));
- }
-
- @Test
- public void modifyVnfClosedLoopDisabledFlagExceptionTest() {
-
- doThrow(new BpmnError("Unknown Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
- doThrow(RuntimeException.class).when(aaiVnfResources).updateObjectVnf(isA(GenericVnf.class));
- try {
- aaiFlagTasks.modifyVnfClosedLoopDisabledFlag(execution, true);
- } catch (Exception e) {
- verify(aaiVnfResources, times(1)).checkVnfClosedLoopDisabledFlag(any(String.class));
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
- }
- }
-
-
- @Test
- public void checkVnfPserversLockedFlagTestTrue() throws Exception {
- doThrow(new BpmnError("VNF PServers in Locked in A&AI")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
- doReturn(true).when(aaiVnfResources).checkVnfPserversLockedFlag(isA(String.class));
- try {
- aaiFlagTasks.checkVnfClosedLoopDisabledFlag(execution);
- } catch (Exception e) {
- verify(aaiVnfResources, times(1)).checkVnfPserversLockedFlag(any(String.class));
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), eq("VNF PServers in Locked in A&AI"));
- }
- }
-
- @Test
- public void checkVnfPserversLockedFlagTestFalse() throws Exception {
- doReturn(false).when(aaiVnfResources).checkVnfPserversLockedFlag(isA(String.class));
- aaiFlagTasks.checkVnfPserversLockedFlag(execution);
- verify(exceptionUtil, times(0)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), any(int.class), any(String.class));
- }
-
- @Test
- public void checkVnfPserversLockedFlagExceptionTest() throws IOException {
-
- doThrow(new BpmnError("Unknown Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
- doThrow(RuntimeException.class).when(aaiVnfResources).checkVnfClosedLoopDisabledFlag(isA(String.class));
- try {
- aaiFlagTasks.checkVnfPserversLockedFlag(execution);
- } catch (Exception e) {
- verify(aaiVnfResources, times(1)).checkVnfPserversLockedFlag(any(String.class));
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
- }
- }
+ @InjectMocks
+ private AAIFlagTasks aaiFlagTasks = new AAIFlagTasks();
+
+ private GenericVnf genericVnf;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ genericVnf = setGenericVnf();
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient();
+ when(extractPojosForBB.extractByKey(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(RuntimeException.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(ArgumentMatchers.any(GenericVnf.class));
+ aaiFlagTasks.modifyVnfInMaintFlag(execution, true);
+ verify(aaiVnfResources, times(1)).updateObjectVnf(ArgumentMatchers.any(GenericVnf.class));
+ }
+
+ @Test
+ public void modifyVnfInMaintFlagExceptionTest() {
+
+ doThrow(new BpmnError("Unknown Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doThrow(RuntimeException.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));
+ }
+ }
+
+ @Test
+ public void checkVnfClosedLoopDisabledTestTrue() throws Exception {
+ doThrow(new BpmnError("VNF Closed Loop Disabled in A&AI")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doReturn(false).when(aaiVnfResources).checkVnfClosedLoopDisabledFlag(isA(String.class));
+ try {
+ aaiFlagTasks.checkVnfClosedLoopDisabledFlag(execution);
+ } catch (Exception e) {
+ verify(aaiVnfResources, times(1)).checkVnfClosedLoopDisabledFlag(any(String.class));
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000),
+ eq("VNF Closed Loop Disabled in A&AI"));
+ }
+ }
+
+ @Test
+ public void checkVnfClosedLoopDisabledTestFalse() throws Exception {
+ doReturn(false).when(aaiVnfResources).checkVnfClosedLoopDisabledFlag(isA(String.class));
+ aaiFlagTasks.checkVnfClosedLoopDisabledFlag(execution);
+ verify(exceptionUtil, times(0)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class),
+ any(int.class), any(String.class));
+ }
+
+ @Test
+ public void checkVnfClosedLoopDisabledFlagExceptionTest() {
+
+ doThrow(new BpmnError("Unknown Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doThrow(RuntimeException.class).when(aaiVnfResources).checkVnfClosedLoopDisabledFlag(isA(String.class));
+ try {
+ aaiFlagTasks.checkVnfClosedLoopDisabledFlag(execution);
+ } catch (Exception e) {
+ verify(aaiVnfResources, times(1)).checkVnfClosedLoopDisabledFlag(any(String.class));
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000),
+ any(String.class));
+ }
+ }
+
+ @Test
+ public void modifyVnfClosedLoopDisabledFlagTest() throws Exception {
+ doNothing().when(aaiVnfResources).updateObjectVnf(ArgumentMatchers.any(GenericVnf.class));
+ aaiFlagTasks.modifyVnfClosedLoopDisabledFlag(execution, true);
+ verify(aaiVnfResources, times(1)).updateObjectVnf(ArgumentMatchers.any(GenericVnf.class));
+ }
+
+ @Test
+ public void modifyVnfClosedLoopDisabledFlagExceptionTest() {
+
+ doThrow(new BpmnError("Unknown Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doThrow(RuntimeException.class).when(aaiVnfResources).updateObjectVnf(isA(GenericVnf.class));
+ try {
+ aaiFlagTasks.modifyVnfClosedLoopDisabledFlag(execution, true);
+ } catch (Exception e) {
+ verify(aaiVnfResources, times(1)).checkVnfClosedLoopDisabledFlag(any(String.class));
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000),
+ any(String.class));
+ }
+ }
+
+
+ @Test
+ public void checkVnfPserversLockedFlagTestTrue() throws Exception {
+ doThrow(new BpmnError("VNF PServers in Locked in A&AI")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doReturn(true).when(aaiVnfResources).checkVnfPserversLockedFlag(isA(String.class));
+ try {
+ aaiFlagTasks.checkVnfClosedLoopDisabledFlag(execution);
+ } catch (Exception e) {
+ verify(aaiVnfResources, times(1)).checkVnfPserversLockedFlag(any(String.class));
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000),
+ eq("VNF PServers in Locked in A&AI"));
+ }
+ }
+
+ @Test
+ public void checkVnfPserversLockedFlagTestFalse() throws Exception {
+ doReturn(false).when(aaiVnfResources).checkVnfPserversLockedFlag(isA(String.class));
+ aaiFlagTasks.checkVnfPserversLockedFlag(execution);
+ verify(exceptionUtil, times(0)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class),
+ any(int.class), any(String.class));
+ }
+
+ @Test
+ public void checkVnfPserversLockedFlagExceptionTest() throws IOException {
+
+ doThrow(new BpmnError("Unknown Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doThrow(RuntimeException.class).when(aaiVnfResources).checkVnfClosedLoopDisabledFlag(isA(String.class));
+ try {
+ aaiFlagTasks.checkVnfPserversLockedFlag(execution);
+ } catch (Exception e) {
+ verify(aaiVnfResources, times(1)).checkVnfPserversLockedFlag(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
index 8bbb6c7f46..ff6426d351 100644
--- 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
@@ -21,14 +21,12 @@ 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.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl;
import org.junit.Before;
@@ -75,540 +73,543 @@ import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
-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<ResourceKey, String> 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<ResourceKey, String>();
- 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<String, String> buildUserInput() {
- Map<String, String> userInput = new HashMap<>();
- userInput.put("testUserInputKey", "testUserInputValue");
-
- return userInput;
- }
-
- public Map<String, String> setUserInput() {
- Map<String, String> 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<String,Object> dataMap = new HashMap<>();
- dataMap.put("vpnId","testVpnId");
- dataMap.put("vpnRegion","testVpnRegion");
- dataMap.put("vpnRt","testVpnRt");
- dataMap.put("vpnName","vpnName");
+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<ResourceKey, String> 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<ResourceKey, String>();
+ 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<String, String> buildUserInput() {
+ Map<String, String> userInput = new HashMap<>();
+ userInput.put("testUserInputKey", "testUserInputValue");
+
+ return userInput;
+ }
+
+ public Map<String, String> setUserInput() {
+ Map<String, String> 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<String, Object> 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<String,Object> userParams = new HashMap<>();
- userParams.put("vpnData",dataMap);
+ HashMap<String, Object> userParams = new HashMap<>();
+ userParams.put("vpnData", dataMap);
+
+ List<Map<String, Object>> userParamsList = new ArrayList<>();
+ userParamsList.add(userParams);
- List<Map<String,Object>> userParamsList = new ArrayList<>();
- userParamsList.add(userParams);
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setUserParams(userParamsList);
+ requestContext.setRequestParameters(requestParameters);
- RequestParameters requestParameters = new RequestParameters();
- requestParameters.setUserParams(userParamsList);
- requestContext.setRequestParameters(requestParameters);
+ return requestContext;
+ }
- return requestContext;
- }
+ public RequestContext setRequestContext() {
+ RequestContext requestContext = buildRequestContext();
- public RequestContext setRequestContext() {
- RequestContext requestContext = buildRequestContext();
+ gBBInput.setRequestContext(requestContext);
- gBBInput.setRequestContext(requestContext);
+ return requestContext;
+ }
- return requestContext;
- }
+ public CloudRegion buildCloudRegion() {
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setLcpCloudRegionId("testLcpCloudRegionId");
+ cloudRegion.setTenantId("testTenantId");
+ cloudRegion.setCloudOwner("testCloudOwner");
- public CloudRegion buildCloudRegion() {
- CloudRegion cloudRegion = new CloudRegion();
- cloudRegion.setLcpCloudRegionId("testLcpCloudRegionId");
- cloudRegion.setTenantId("testTenantId");
- cloudRegion.setCloudOwner("testCloudOwner");
+ return cloudRegion;
+ }
- return cloudRegion;
- }
+ public CloudRegion setCloudRegion() {
+ CloudRegion cloudRegion = buildCloudRegion();
- public CloudRegion setCloudRegion() {
- CloudRegion cloudRegion = buildCloudRegion();
+ gBBInput.setCloudRegion(cloudRegion);
- gBBInput.setCloudRegion(cloudRegion);
+ return cloudRegion;
+ }
- return cloudRegion;
- }
+ public OrchestrationContext buildOrchestrationContext() {
+ OrchestrationContext orchestrationContext = new OrchestrationContext();
- public OrchestrationContext buildOrchestrationContext() {
- OrchestrationContext orchestrationContext = new OrchestrationContext();
+ return orchestrationContext;
+ }
- return orchestrationContext;
- }
+ public OrchestrationContext setOrchestrationContext() {
+ OrchestrationContext orchestrationContext = buildOrchestrationContext();
- public OrchestrationContext setOrchestrationContext() {
- OrchestrationContext orchestrationContext = buildOrchestrationContext();
+ gBBInput.setOrchContext(orchestrationContext);
- gBBInput.setOrchContext(orchestrationContext);
+ return orchestrationContext;
+ }
- return orchestrationContext;
- }
+ public Collection buildCollection() {
+ collectionCounter++;
- public Collection buildCollection() {
- collectionCounter++;
+ Collection collection = new Collection();
+ collection.setId("testId" + collectionCounter);
+ collection.setInstanceGroup(buildInstanceGroup());
- Collection collection = new Collection();
- collection.setId("testId" + collectionCounter);
- collection.setInstanceGroup(buildInstanceGroup());
+ return collection;
+ }
- return collection;
- }
+ public Configuration buildConfiguration() {
+ configurationCounter++;
- public Configuration buildConfiguration() {
- configurationCounter++;
+ Configuration configuration = new Configuration();
+ configuration.setConfigurationId("testConfigurationId" + configurationCounter);
+ configuration.setConfigurationName("testConfigurationName" + 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);
- ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
- modelInfoConfiguration.setModelVersionId("testModelVersionId" + configurationCounter);
- modelInfoConfiguration.setModelInvariantId("testModelInvariantId" + configurationCounter);
- modelInfoConfiguration.setModelCustomizationId("testModelCustomizationId" + configurationCounter);
+ configuration.setModelInfoConfiguration(modelInfoConfiguration);
- configuration.setModelInfoConfiguration(modelInfoConfiguration);
+ return configuration;
+ }
- return configuration;
- }
+ public OwningEntity buildOwningEntity() {
+ owningEntityCounter++;
- public OwningEntity buildOwningEntity() {
- owningEntityCounter++;
+ OwningEntity owningEntity = new OwningEntity();
+ owningEntity.setOwningEntityId("testOwningEntityId" + owningEntityCounter);
+ owningEntity.setOwningEntityName("testOwningEntityName" + owningEntityCounter);
- OwningEntity owningEntity = new OwningEntity();
- owningEntity.setOwningEntityId("testOwningEntityId" + owningEntityCounter);
- owningEntity.setOwningEntityName("testOwningEntityName" + owningEntityCounter);
+ return owningEntity;
+ }
- return owningEntity;
- }
+ public Project buildProject() {
+ projectCounter++;
- public Project buildProject() {
- projectCounter++;
+ Project project = new Project();
+ project.setProjectName("testProjectName1 , testProjectName2 , testProjectName3" + projectCounter);
- Project project = new Project();
- project.setProjectName("testProjectName1 , testProjectName2 , testProjectName3" + projectCounter);
+ return project;
+ }
- return project;
- }
+ public ServiceSubscription buildServiceSubscription() {
+ serviceSubscriptionCounter++;
- public ServiceSubscription buildServiceSubscription() {
- serviceSubscriptionCounter++;
+ ServiceSubscription serviceSubscription = new ServiceSubscription();
+ serviceSubscription.setTempUbSubAccountId("testTempUbSubAccountId" + serviceSubscriptionCounter);
+ serviceSubscription.setServiceType("testServiceType" + serviceSubscriptionCounter);
- ServiceSubscription serviceSubscription = new ServiceSubscription();
- serviceSubscription.setTempUbSubAccountId("testTempUbSubAccountId" + serviceSubscriptionCounter);
- serviceSubscription.setServiceType("testServiceType" + serviceSubscriptionCounter);
+ return serviceSubscription;
+ }
- return serviceSubscription;
- }
+ public Customer buildCustomer() {
+ customerCounter++;
- public Customer buildCustomer() {
- customerCounter++;
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("testGlobalCustomerId" + customerCounter);
+ customer.setSubscriberType("testSubscriberType" + customerCounter);
- Customer customer = new Customer();
- customer.setGlobalCustomerId("testGlobalCustomerId" + customerCounter);
- customer.setSubscriberType("testSubscriberType" + customerCounter);
+ customer.setServiceSubscription(buildServiceSubscription());
- customer.setServiceSubscription(buildServiceSubscription());
+ return customer;
+ }
- return customer;
- }
+ public ServiceInstance buildServiceInstance() {
+ serviceInstanceCounter++;
- public ServiceInstance buildServiceInstance() {
- serviceInstanceCounter++;
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("testServiceInstanceId" + serviceInstanceCounter);
+ serviceInstance.setServiceInstanceName("testServiceInstanceName" + 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);
+ modelInfoServiceInstance.setServiceRole("testServiceRole" + serviceInstanceCounter);
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
- ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
- modelInfoServiceInstance.setModelInvariantUuid("testModelInvariantUUID" + serviceInstanceCounter);
- modelInfoServiceInstance.setModelUuid("testModelUUID" + serviceInstanceCounter);
- modelInfoServiceInstance.setModelVersion("testModelVersion" + serviceInstanceCounter);
- modelInfoServiceInstance.setModelName("testModelName" + serviceInstanceCounter);
- modelInfoServiceInstance.setServiceType("testServiceType" + serviceInstanceCounter);
- modelInfoServiceInstance.setServiceRole("testServiceRole" + serviceInstanceCounter);
- serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+ serviceInstance.setProject(buildProject());
- serviceInstance.setProject(buildProject());
+ serviceInstance.setOwningEntity(buildOwningEntity());
- serviceInstance.setOwningEntity(buildOwningEntity());
+ serviceInstance.setCollection(buildCollection());
- serviceInstance.setCollection(buildCollection());
+ serviceInstance.getConfigurations().add(buildConfiguration());
- serviceInstance.getConfigurations().add(buildConfiguration());
+ return serviceInstance;
+ }
- return serviceInstance;
- }
+ public ServiceInstance setServiceInstance() {
+ ServiceInstance serviceInstance = buildServiceInstance();
- 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());
- if(gBBInput.getCustomer() == null) {
- gBBInput.setCustomer(buildCustomer());
- }
- gBBInput.getCustomer().getServiceSubscription().getServiceInstances().add(serviceInstance);
- lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId());
+ return serviceInstance;
+ }
- return serviceInstance;
- }
+ public Customer setCustomer() {
+ if (gBBInput.getCustomer() != null)
+ return gBBInput.getCustomer();
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("testGlobalCustomerId");
+ customer.setSubscriberType("testSubscriberType");
- public Customer setCustomer() {
- if(gBBInput.getCustomer() != null) return gBBInput.getCustomer();
- Customer customer = new Customer();
- customer.setGlobalCustomerId("testGlobalCustomerId");
- customer.setSubscriberType("testSubscriberType");
+ customer.setServiceSubscription(buildServiceSubscription());
- customer.setServiceSubscription(buildServiceSubscription());
+ gBBInput.setCustomer(customer);
- gBBInput.setCustomer(customer);
+ return customer;
+ }
- return customer;
- }
+ public Collection setCollection() {
+ Collection collection = new Collection();
+ collection.setId("testId");
- public Collection setCollection() {
- Collection collection = new Collection();
- collection.setId("testId");
+ ServiceInstance serviceInstance = null;
- ServiceInstance serviceInstance = null;
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ } catch (BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
- try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- } catch(BBObjectNotFoundException e) {
- serviceInstance = setServiceInstance();
- }
+ serviceInstance.setCollection(collection);
- serviceInstance.setCollection(collection);
+ return collection;
+ }
- return collection;
- }
+ public InstanceGroup setInstanceGroup() {
+ InstanceGroup instanceGroup = new InstanceGroup();
+ instanceGroup.setId("testId");
+ instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction");
- public InstanceGroup setInstanceGroup() {
- InstanceGroup instanceGroup = new InstanceGroup();
- instanceGroup.setId("testId");
- instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction");
+ Collection collection = null;
- Collection collection = null;
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ collection = serviceInstance.getCollection();
- try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- collection = serviceInstance.getCollection();
+ if (collection == null) {
+ collection = setCollection();
+ }
+ } catch (BBObjectNotFoundException e) {
+ collection = setCollection();
+ }
- if (collection == null) {
- collection = setCollection();
- }
- } catch(BBObjectNotFoundException e) {
- collection = setCollection();
- }
+ collection.setInstanceGroup(instanceGroup);
- collection.setInstanceGroup(instanceGroup);
-
- return instanceGroup;
- }
+ return instanceGroup;
+ }
- public InstanceGroup setInstanceGroupVnf() {
- InstanceGroup instanceGroup = buildInstanceGroup();
+ public InstanceGroup setInstanceGroupVnf() {
+ InstanceGroup instanceGroup = buildInstanceGroup();
- ServiceInstance serviceInstance = null;
+ ServiceInstance serviceInstance = null;
- try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- } catch(BBObjectNotFoundException e) {
- serviceInstance = setServiceInstance();
- }
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ } catch (BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
- serviceInstance.getInstanceGroups().add(instanceGroup);
- lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, instanceGroup.getId());
+ serviceInstance.getInstanceGroups().add(instanceGroup);
+ lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, instanceGroup.getId());
- return instanceGroup;
- }
+ return instanceGroup;
+ }
- public VpnBinding buildVpnBinding() {
- vpnBindingCounter++;
+ public VpnBinding buildVpnBinding() {
+ vpnBindingCounter++;
- VpnBinding vpnBinding = new VpnBinding();
- vpnBinding.setVpnId("testVpnId" + vpnBindingCounter);
- vpnBinding.setVpnName("testVpnName" + vpnBindingCounter);
- vpnBinding.setCustomerVpnId("testCustomerVpnId" + vpnBindingCounter);
+ VpnBinding vpnBinding = new VpnBinding();
+ vpnBinding.setVpnId("testVpnId" + vpnBindingCounter);
+ vpnBinding.setVpnName("testVpnName" + vpnBindingCounter);
+ vpnBinding.setCustomerVpnId("testCustomerVpnId" + vpnBindingCounter);
- return vpnBinding;
- }
+ return vpnBinding;
+ }
- public VpnBinding setVpnBinding() {
- VpnBinding vpnBinding = buildVpnBinding();
+ public VpnBinding setVpnBinding() {
+ VpnBinding vpnBinding = buildVpnBinding();
- Customer customer = gBBInput.getCustomer();
+ Customer customer = gBBInput.getCustomer();
- if(customer == null){
- customer = buildCustomer();
- }
+ if (customer == null) {
+ customer = buildCustomer();
+ }
- customer.getVpnBindings().add(vpnBinding);
- lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId());
+ customer.getVpnBindings().add(vpnBinding);
+ lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId());
- return vpnBinding;
- }
+ return vpnBinding;
+ }
- public InstanceGroup buildInstanceGroup() {
- instanceGroupCounter++;
+ public InstanceGroup buildInstanceGroup() {
+ instanceGroupCounter++;
- InstanceGroup instanceGroup = new InstanceGroup();
- instanceGroup.setId("testId" + instanceGroupCounter);
- instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction" + instanceGroupCounter);
+ InstanceGroup instanceGroup = new InstanceGroup();
+ instanceGroup.setId("testId" + instanceGroupCounter);
+ instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction" + instanceGroupCounter);
- return instanceGroup;
- }
+ return instanceGroup;
+ }
- public L3Network buildL3Network() {
- l3NetworkCounter++;
+ public L3Network buildL3Network() {
+ l3NetworkCounter++;
- L3Network network = new L3Network();
- network.setNetworkId("testNetworkId" + l3NetworkCounter);
- network.setNetworkName("testNetworkName" + l3NetworkCounter);
- network.setNetworkType("testNetworkType" + 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);
+ 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;
- }
+ return network;
+ }
- public L3Network setL3Network() {
- L3Network network = buildL3Network();
+ public L3Network setL3Network() {
+ L3Network network = buildL3Network();
- ServiceInstance serviceInstance = null;
+ ServiceInstance serviceInstance = null;
- try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- } catch(BBObjectNotFoundException e) {
- serviceInstance = setServiceInstance();
- }
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ } catch (BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
- serviceInstance.getNetworks().add(network);
- lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId());
+ serviceInstance.getNetworks().add(network);
+ lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId());
- return network;
- }
+ return network;
+ }
- public GenericVnf buildGenericVnf() {
- genericVnfCounter++;
+ public GenericVnf buildGenericVnf() {
+ genericVnfCounter++;
- GenericVnf genericVnf = new GenericVnf();
- genericVnf.setVnfId("testVnfId" + genericVnfCounter);
- genericVnf.setVnfName("testVnfName" + genericVnfCounter);
- genericVnf.setVnfType("testVnfType" + genericVnfCounter);
- genericVnf.setIpv4OamAddress("10.222.22.2");
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId("testVnfId" + genericVnfCounter);
+ genericVnf.setVnfName("testVnfName" + genericVnfCounter);
+ genericVnf.setVnfType("testVnfType" + genericVnfCounter);
+ genericVnf.setIpv4OamAddress("10.222.22.2");
- Platform platform = new Platform();
- platform.setPlatformName(" testPlatformName, testPlatformName2 , testPlatformName3 , testPlatformName4");
- genericVnf.setPlatform(platform);
+ Platform platform = new Platform();
+ platform.setPlatformName(" testPlatformName, testPlatformName2 , testPlatformName3 , testPlatformName4");
+ genericVnf.setPlatform(platform);
- LineOfBusiness lob = new LineOfBusiness();
- lob.setLineOfBusinessName(" testLineOfBusinessName , testLineOfBusinessName2, testLineOfBusinessName3, testLineOfBusinessName4");
- genericVnf.setLineOfBusiness(lob);
+ LineOfBusiness lob = new LineOfBusiness();
+ lob.setLineOfBusinessName(
+ " testLineOfBusinessName , testLineOfBusinessName2, testLineOfBusinessName3, testLineOfBusinessName4");
+ 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("testInstanceName" + genericVnfCounter);
+ 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("testInstanceName" + genericVnfCounter);
- genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+ genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
- License license = new License();
- List<String> array = new ArrayList<String>();
- array.add("testPoolUuid");
- license.setEntitlementPoolUuids(array);
- genericVnf.setLicense(license);
+ License license = new License();
+ List<String> array = new ArrayList<String>();
+ array.add("testPoolUuid");
+ license.setEntitlementPoolUuids(array);
+ genericVnf.setLicense(license);
- return genericVnf;
- }
+ return genericVnf;
+ }
- public GenericVnf setGenericVnf() {
- GenericVnf genericVnf = buildGenericVnf();
+ public GenericVnf setGenericVnf() {
+ GenericVnf genericVnf = buildGenericVnf();
- ServiceInstance serviceInstance = null;
+ ServiceInstance serviceInstance = null;
- try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- } catch(BBObjectNotFoundException e) {
- serviceInstance = setServiceInstance();
- }
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ } catch (BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
- serviceInstance.getVnfs().add(genericVnf);
- lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId());
+ serviceInstance.getVnfs().add(genericVnf);
+ lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId());
- return genericVnf;
- }
+ return genericVnf;
+ }
- public VfModule buildVfModule() {
- vfModuleCounter++;
+ public VfModule buildVfModule() {
+ vfModuleCounter++;
- VfModule vfModule = new VfModule();
- vfModule.setVfModuleId("testVfModuleId" + vfModuleCounter);
- vfModule.setVfModuleName("testVfModuleName" + vfModuleCounter);
- vfModule.setModuleIndex(0);
- 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);
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("testVfModuleId" + vfModuleCounter);
+ vfModule.setVfModuleName("testVfModuleName" + vfModuleCounter);
+ vfModule.setModuleIndex(0);
+ 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;
- }
+ return vfModule;
+ }
- public VfModule setVfModule() {
- return setVfModule(true);
- }
-
- public VfModule setVfModule(boolean addToGenericVnf) {
- VfModule vfModule = buildVfModule();
+ public VfModule setVfModule() {
+ return setVfModule(true);
+ }
- GenericVnf genericVnf = null;
+ public VfModule setVfModule(boolean addToGenericVnf) {
+ VfModule vfModule = buildVfModule();
- try {
- genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- } catch(BBObjectNotFoundException e) {
- genericVnf = setGenericVnf();
- }
+ GenericVnf genericVnf = null;
- if (addToGenericVnf) {
- genericVnf.getVfModules().add(vfModule);
- }
- lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId());
+ try {
+ genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ } catch (BBObjectNotFoundException e) {
+ genericVnf = setGenericVnf();
+ }
- return vfModule;
- }
+ if (addToGenericVnf) {
+ genericVnf.getVfModules().add(vfModule);
+ }
+ lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId());
- public VolumeGroup buildVolumeGroup() {
- volumeGroupCounter++;
+ return vfModule;
+ }
- VolumeGroup volumeGroup = new VolumeGroup();
- volumeGroup.setVolumeGroupId("testVolumeGroupId" + volumeGroupCounter);
- volumeGroup.setVolumeGroupName("testVolumeGroupName" + volumeGroupCounter);
- volumeGroup.setHeatStackId("testHeatStackId" + volumeGroupCounter);
+ public VolumeGroup buildVolumeGroup() {
+ volumeGroupCounter++;
- return volumeGroup;
- }
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupId("testVolumeGroupId" + volumeGroupCounter);
+ volumeGroup.setVolumeGroupName("testVolumeGroupName" + volumeGroupCounter);
+ volumeGroup.setHeatStackId("testHeatStackId" + volumeGroupCounter);
- public VolumeGroup setVolumeGroup() {
- VolumeGroup volumeGroup = buildVolumeGroup();
+ return volumeGroup;
+ }
- GenericVnf genericVnf = null;
+ public VolumeGroup setVolumeGroup() {
+ VolumeGroup volumeGroup = buildVolumeGroup();
- try {
- genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- } catch(BBObjectNotFoundException e) {
- genericVnf = setGenericVnf();
- }
+ GenericVnf genericVnf = null;
- genericVnf.getVolumeGroups().add(volumeGroup);
- lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId());
+ try {
+ genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ } catch (BBObjectNotFoundException e) {
+ genericVnf = setGenericVnf();
+ }
- return volumeGroup;
- }
+ genericVnf.getVolumeGroups().add(volumeGroup);
+ lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId());
- public Pnf buildPnf() {
- pnfCounter++;
+ return volumeGroup;
+ }
- Pnf pnf = new Pnf();
- pnf.setPnfId("testPnfId" + pnfCounter);
- pnf.setPnfName("testPnfName" + pnfCounter);
+ public Pnf buildPnf() {
+ pnfCounter++;
- return pnf;
- }
+ Pnf pnf = new Pnf();
+ pnf.setPnfId("testPnfId" + pnfCounter);
+ pnf.setPnfName("testPnfName" + pnfCounter);
- public ServiceProxy buildServiceProxy() {
- serviceProxyCounter++;
+ return pnf;
+ }
+
+ public ServiceProxy buildServiceProxy() {
+ serviceProxyCounter++;
ServiceProxy serviceProxy = new ServiceProxy();
serviceProxy.setServiceInstance(buildServiceInstance());
@@ -623,115 +624,115 @@ public class TestDataSetup{
serviceProxy.getServiceInstance().getPnfs().add(secondaryPnf);
return serviceProxy;
- }
+ }
- public VpnBondingLink buildVpnBondingLink() {
- vpnBondingLinkCounter++;
+ public VpnBondingLink buildVpnBondingLink() {
+ vpnBondingLinkCounter++;
- VpnBondingLink vpnBondingLink = new VpnBondingLink();
- vpnBondingLink.setVpnBondingLinkId("testVpnBondingLinkId" + vpnBondingLinkCounter);
+ VpnBondingLink vpnBondingLink = new VpnBondingLink();
+ vpnBondingLink.setVpnBondingLinkId("testVpnBondingLinkId" + vpnBondingLinkCounter);
- Configuration vnrConfiguration = buildConfiguration();
- vnrConfiguration.setNetwork(buildL3Network());
- vpnBondingLink.setVnrConfiguration(vnrConfiguration);
+ Configuration vnrConfiguration = buildConfiguration();
+ vnrConfiguration.setNetwork(buildL3Network());
+ vpnBondingLink.setVnrConfiguration(vnrConfiguration);
- vpnBondingLink.setVrfConfiguration(buildConfiguration());
+ vpnBondingLink.setVrfConfiguration(buildConfiguration());
vpnBondingLink.setInfrastructureServiceProxy(buildServiceProxy());
vpnBondingLink.setTransportServiceProxy(buildServiceProxy());
- return vpnBondingLink;
- }
-
- public VpnBondingLink setVpnBondingLink() {
- VpnBondingLink vpnBondingLink = buildVpnBondingLink();
-
- ServiceInstance serviceInstance = null;
+ return vpnBondingLink;
+ }
- try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- } catch(BBObjectNotFoundException e) {
- serviceInstance = setServiceInstance();
- }
+ public VpnBondingLink setVpnBondingLink() {
+ VpnBondingLink vpnBondingLink = buildVpnBondingLink();
- serviceInstance.getVpnBondingLinks().add(vpnBondingLink);
- lookupKeyMap.put(ResourceKey.VPN_BONDING_LINK_ID, vpnBondingLink.getVpnBondingLinkId());
+ ServiceInstance serviceInstance = null;
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ } catch (BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
- return vpnBondingLink;
- }
+ serviceInstance.getVpnBondingLinks().add(vpnBondingLink);
+ lookupKeyMap.put(ResourceKey.VPN_BONDING_LINK_ID, vpnBondingLink.getVpnBondingLinkId());
- public Customer setAvpnCustomer() {
- Customer customer = buildCustomer();
- gBBInput.setCustomer(customer);
+ return vpnBondingLink;
+ }
- return customer;
- }
+ public Customer setAvpnCustomer() {
+ Customer customer = buildCustomer();
- public ServiceProxy setServiceProxy(String uniqueIdentifier, String type) {
- ServiceProxy serviceProxy = new ServiceProxy();
- serviceProxy.setId("testProxyId" + uniqueIdentifier);
- serviceProxy.setType(type);
+ gBBInput.setCustomer(customer);
- ModelInfoServiceProxy modelInfo = new ModelInfoServiceProxy();
- modelInfo.setModelInvariantUuid("testProxyModelInvariantUuid" + uniqueIdentifier);
- modelInfo.setModelName("testProxyModelName" + uniqueIdentifier);
- modelInfo.setModelUuid("testProxyModelUuid" + uniqueIdentifier);
- modelInfo.setModelVersion("testProxyModelVersion" + uniqueIdentifier);
- modelInfo.setModelInstanceName("testProxyInstanceName" + uniqueIdentifier);
+ return customer;
+ }
- 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("testAllottedModelInstanceName" + uniqueIdentifier);
-
- ar.setModelInfoAllottedResource(modelInfo);
+ public ServiceProxy setServiceProxy(String uniqueIdentifier, String type) {
+ ServiceProxy serviceProxy = new ServiceProxy();
+ serviceProxy.setId("testProxyId" + uniqueIdentifier);
+ serviceProxy.setType(type);
- return ar;
- }
+ ModelInfoServiceProxy modelInfo = new ModelInfoServiceProxy();
+ modelInfo.setModelInvariantUuid("testProxyModelInvariantUuid" + uniqueIdentifier);
+ modelInfo.setModelName("testProxyModelName" + uniqueIdentifier);
+ modelInfo.setModelUuid("testProxyModelUuid" + uniqueIdentifier);
+ modelInfo.setModelVersion("testProxyModelVersion" + uniqueIdentifier);
+ modelInfo.setModelInstanceName("testProxyInstanceName" + uniqueIdentifier);
- public Configuration setConfiguration () {
- Configuration config = new Configuration();
- config.setConfigurationId("testConfigurationId");
- List<Configuration> configurations = new ArrayList<>();
- configurations.add(config);
- ServiceInstance serviceInstance = new ServiceInstance();
- try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- } catch(BBObjectNotFoundException e) {
- serviceInstance = setServiceInstance();
- }
- lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "testConfigurationId");
- serviceInstance.setConfigurations(configurations);
- return config;
- }
+ serviceProxy.setModelInfoServiceProxy(modelInfo);
- public Subnet buildSubnet() {
+ 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("testAllottedModelInstanceName" + uniqueIdentifier);
+
+ ar.setModelInfoAllottedResource(modelInfo);
+
+ return ar;
+ }
+
+ public Configuration setConfiguration() {
+ Configuration config = new Configuration();
+ config.setConfigurationId("testConfigurationId");
+ List<Configuration> configurations = new ArrayList<>();
+ configurations.add(config);
+ ServiceInstance serviceInstance = new ServiceInstance();
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ } catch (BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
+ lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "testConfigurationId");
+ serviceInstance.setConfigurations(configurations);
+ return config;
+ }
+
+ public Subnet buildSubnet() {
Subnet subnet = new Subnet();
subnet.setSubnetId("testSubnetId");
subnet.setOrchestrationStatus(OrchestrationStatus.PENDING);
subnet.setNeutronSubnetId("testNeutronSubnetId");
- return subnet;
- }
-
- public NetworkPolicy buildNetworkPolicy() {
- NetworkPolicy networkPolicy = new NetworkPolicy();
- networkPolicy.setNetworkPolicyId("testNetworkPolicyId");
- networkPolicy.setNetworkPolicyFqdn("testNetworkPolicyFqdn");
- networkPolicy.setHeatStackId("testHeatStackId");
- return networkPolicy;
- }
+ return subnet;
+ }
+
+ public NetworkPolicy buildNetworkPolicy() {
+ NetworkPolicy networkPolicy = new NetworkPolicy();
+ networkPolicy.setNetworkPolicyId("testNetworkPolicyId");
+ networkPolicy.setNetworkPolicyFqdn("testNetworkPolicyFqdn");
+ networkPolicy.setHeatStackId("testHeatStackId");
+ return networkPolicy;
+ }
}
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
index 5c1caccc2d..b054cc17bb 100644
--- 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
@@ -30,12 +30,10 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.TreeSet;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Rule;
@@ -67,589 +65,631 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
-public class AAICreateTasksTest extends BaseTaskTest{
-
- @InjectMocks
- private AAICreateTasks aaiCreateTasks = new AAICreateTasks();
-
-
- private ServiceInstance serviceInstance;
- private L3Network network;
- private GenericVnf genericVnf;
- private VolumeGroup volumeGroup;
- private CloudRegion cloudRegion;
- private VfModule vfModule;
- private Customer customer;
- private Configuration configuration;
- private InstanceGroup instanceGroup;
-
- @Captor
- ArgumentCaptor<NetworkPolicy> networkPolicyCaptor;
-
- @Rule
- public final ExpectedException exception = ExpectedException.none();
-
- @Before
- public void before() throws BBObjectNotFoundException {
- customer = setCustomer();
- serviceInstance = setServiceInstance();
- network = setL3Network();
- genericVnf = setGenericVnf();
- volumeGroup = setVolumeGroup();
- cloudRegion = setCloudRegion();
- vfModule = setVfModule();
- configuration = setConfiguration();
- instanceGroup = setInstanceGroupVnf();
-
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID))).thenReturn(configuration);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID))).thenReturn(instanceGroup);
-
-
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
-
- }
-
- @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(RuntimeException.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(RuntimeException.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);
- ArgumentCaptor<Platform> platformCaptor = ArgumentCaptor.forClass(Platform.class);
- ArgumentCaptor<GenericVnf> genericVnf = ArgumentCaptor.forClass(GenericVnf.class);
- Mockito.verify(aaiVnfResources,times(4)).createPlatformandConnectVnf(platformCaptor.capture(),genericVnf.capture());
-
- List<Platform> capturedPlatforms = platformCaptor.getAllValues();
- assertTrue(capturedPlatforms.stream().anyMatch(item -> "testPlatformName".equals(item.getPlatformName())));
- assertTrue(capturedPlatforms.stream().anyMatch(item -> "testPlatformName2".equals(item.getPlatformName())));
- assertTrue(capturedPlatforms.stream().anyMatch(item -> "testPlatformName3".equals(item.getPlatformName())));
- assertTrue(capturedPlatforms.stream().anyMatch(item -> "testPlatformName4".equals(item.getPlatformName())));
- }
-
- @Test
- public void createLineOfBusinessTest() throws Exception {
- doNothing().when(aaiVnfResources).createLineOfBusinessandConnectVnf(genericVnf.getLineOfBusiness(), genericVnf);
- aaiCreateTasks.createLineOfBusiness(execution);
-
- ArgumentCaptor<LineOfBusiness> lobCaptor = ArgumentCaptor.forClass(LineOfBusiness.class);
- ArgumentCaptor<GenericVnf> genericVnf = ArgumentCaptor.forClass(GenericVnf.class);
- Mockito.verify(aaiVnfResources,times(4)).createLineOfBusinessandConnectVnf(lobCaptor.capture(),genericVnf.capture());
-
- List<LineOfBusiness> capturedLOB = lobCaptor.getAllValues();
- assertTrue(capturedLOB.stream().anyMatch(item -> "testLineOfBusinessName".equals(item.getLineOfBusinessName())));
- assertTrue(capturedLOB.stream().anyMatch(item -> "testLineOfBusinessName2".equals(item.getLineOfBusinessName())));
- assertTrue(capturedLOB.stream().anyMatch(item -> "testLineOfBusinessName3".equals(item.getLineOfBusinessName())));
- assertTrue(capturedLOB.stream().anyMatch(item -> "testLineOfBusinessName4".equals(item.getLineOfBusinessName())));
-
- }
-
- @Test
- public void splitCDL_Test() throws Exception {
- List<String> strings = aaiCreateTasks.splitCDL("Test");
- assertEquals(strings.get(0),"Test");
-
- List<String> strings2 = aaiCreateTasks.splitCDL("");
- assertEquals(strings2.get(0),"");
- }
-
- @Test
- public void createProjectExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
-
- lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "notfound");
- doThrow(RuntimeException.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(RuntimeException.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");
- doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID));
- doNothing().when(aaiVnfResources).createVnfandConnectServiceInstance(genericVnf, serviceInstance);
- aaiCreateTasks.createVnf(execution);
- verify(aaiVnfResources, times(1)).createVnfandConnectServiceInstance(genericVnf, serviceInstance);
- }
-
-
- @Test
- public void createVfModuleTest() throws Exception {
-
- VfModule newVfModule = setVfModule(false);
- newVfModule.setModuleIndex(null);
- newVfModule.getModelInfoVfModule().setModelInvariantUUID("testModelInvariantUUID1");
- doNothing().when(aaiVfModuleResources).createVfModule(newVfModule, genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(newVfModule);
-
- assertEquals(null, newVfModule.getModuleIndex());
- aaiCreateTasks.createVfModule(execution);
- assertEquals(1, newVfModule.getModuleIndex().intValue());
- verify(aaiVfModuleResources, times(1)).createVfModule(newVfModule, genericVnf);
- }
-
- @Test
- public void createServiceSubscriptionTest(){
- doNothing().when(aaiServiceInstanceResources).createServiceSubscription(customer);
- aaiCreateTasks.createServiceSubscription(execution);
- verify(aaiServiceInstanceResources, times(1)).createServiceSubscription(customer);
- }
-
- @Test
- public void createServiceSubscriptionTestExceptionHandling(){
+public class AAICreateTasksTest extends BaseTaskTest {
+
+ @InjectMocks
+ private AAICreateTasks aaiCreateTasks = new AAICreateTasks();
+
+
+ private ServiceInstance serviceInstance;
+ private L3Network network;
+ private GenericVnf genericVnf;
+ private VolumeGroup volumeGroup;
+ private CloudRegion cloudRegion;
+ private VfModule vfModule;
+ private Customer customer;
+ private Configuration configuration;
+ private InstanceGroup instanceGroup;
+
+ @Captor
+ ArgumentCaptor<NetworkPolicy> networkPolicyCaptor;
+
+ @Rule
+ public final ExpectedException exception = ExpectedException.none();
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ customer = setCustomer();
+ serviceInstance = setServiceInstance();
+ network = setL3Network();
+ genericVnf = setGenericVnf();
+ volumeGroup = setVolumeGroup();
+ cloudRegion = setCloudRegion();
+ vfModule = setVfModule();
+ configuration = setConfiguration();
+ instanceGroup = setInstanceGroupVnf();
+
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID)))
+ .thenReturn(volumeGroup);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID)))
+ .thenReturn(configuration);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID)))
+ .thenReturn(instanceGroup);
+
+
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+
+ }
+
+ @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(RuntimeException.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(RuntimeException.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);
+ ArgumentCaptor<Platform> platformCaptor = ArgumentCaptor.forClass(Platform.class);
+ ArgumentCaptor<GenericVnf> genericVnf = ArgumentCaptor.forClass(GenericVnf.class);
+ Mockito.verify(aaiVnfResources, times(4)).createPlatformandConnectVnf(platformCaptor.capture(),
+ genericVnf.capture());
+
+ List<Platform> capturedPlatforms = platformCaptor.getAllValues();
+ assertTrue(capturedPlatforms.stream().anyMatch(item -> "testPlatformName".equals(item.getPlatformName())));
+ assertTrue(capturedPlatforms.stream().anyMatch(item -> "testPlatformName2".equals(item.getPlatformName())));
+ assertTrue(capturedPlatforms.stream().anyMatch(item -> "testPlatformName3".equals(item.getPlatformName())));
+ assertTrue(capturedPlatforms.stream().anyMatch(item -> "testPlatformName4".equals(item.getPlatformName())));
+ }
+
+ @Test
+ public void createLineOfBusinessTest() throws Exception {
+ doNothing().when(aaiVnfResources).createLineOfBusinessandConnectVnf(genericVnf.getLineOfBusiness(), genericVnf);
+ aaiCreateTasks.createLineOfBusiness(execution);
+
+ ArgumentCaptor<LineOfBusiness> lobCaptor = ArgumentCaptor.forClass(LineOfBusiness.class);
+ ArgumentCaptor<GenericVnf> genericVnf = ArgumentCaptor.forClass(GenericVnf.class);
+ Mockito.verify(aaiVnfResources, times(4)).createLineOfBusinessandConnectVnf(lobCaptor.capture(),
+ genericVnf.capture());
+
+ List<LineOfBusiness> capturedLOB = lobCaptor.getAllValues();
+ assertTrue(
+ capturedLOB.stream().anyMatch(item -> "testLineOfBusinessName".equals(item.getLineOfBusinessName())));
+ assertTrue(
+ capturedLOB.stream().anyMatch(item -> "testLineOfBusinessName2".equals(item.getLineOfBusinessName())));
+ assertTrue(
+ capturedLOB.stream().anyMatch(item -> "testLineOfBusinessName3".equals(item.getLineOfBusinessName())));
+ assertTrue(
+ capturedLOB.stream().anyMatch(item -> "testLineOfBusinessName4".equals(item.getLineOfBusinessName())));
+
+ }
+
+ @Test
+ public void splitCDL_Test() throws Exception {
+ List<String> strings = aaiCreateTasks.splitCDL("Test");
+ assertEquals(strings.get(0), "Test");
+
+ List<String> strings2 = aaiCreateTasks.splitCDL("");
+ assertEquals(strings2.get(0), "");
+ }
+
+ @Test
+ public void createProjectExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "notfound");
+ doThrow(RuntimeException.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(RuntimeException.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");
+ doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),
+ ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID));
+ doNothing().when(aaiVnfResources).createVnfandConnectServiceInstance(genericVnf, serviceInstance);
+ aaiCreateTasks.createVnf(execution);
+ verify(aaiVnfResources, times(1)).createVnfandConnectServiceInstance(genericVnf, serviceInstance);
+ }
+
+
+ @Test
+ public void createVfModuleTest() throws Exception {
+
+ VfModule newVfModule = setVfModule(false);
+ newVfModule.setModuleIndex(null);
+ newVfModule.getModelInfoVfModule().setModelInvariantUUID("testModelInvariantUUID1");
+ doNothing().when(aaiVfModuleResources).createVfModule(newVfModule, genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID)))
+ .thenReturn(newVfModule);
+
+ assertEquals(null, newVfModule.getModuleIndex());
+ aaiCreateTasks.createVfModule(execution);
+ assertEquals(1, newVfModule.getModuleIndex().intValue());
+ verify(aaiVfModuleResources, times(1)).createVfModule(newVfModule, 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(RuntimeException.class).when(aaiServiceInstanceResources).createServiceSubscription(customer);
aaiCreateTasks.createServiceSubscription(execution);
}
@Test
- public void createServiceSubscriptionTestCustomerIsNull(){
+ public void createServiceSubscriptionTestCustomerIsNull() {
expectedException.expect(BpmnError.class);
gBBInput.setCustomer(null);
aaiCreateTasks.createServiceSubscription(execution);
}
- @Test
- public void createVfModuleExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
-
- doThrow(RuntimeException.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(RuntimeException.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(RuntimeException.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());
-
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(serviceInstance);
- //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());
- }
-
- @Test
- public void createConfigurationTest() throws Exception {
- gBBInput = execution.getGeneralBuildingBlock();
- doNothing().when(aaiConfigurationResources).createConfiguration(configuration);
- aaiCreateTasks.createConfiguration(execution);
- verify(aaiConfigurationResources, times(1)).createConfiguration(configuration);
- }
-
- @Test
- public void connectVnfToCloudRegionTest() throws Exception {
- gBBInput = execution.getGeneralBuildingBlock();
- doNothing().when(aaiVnfResources).connectVnfToCloudRegion(genericVnf, gBBInput.getCloudRegion());
- aaiCreateTasks.connectVnfToCloudRegion(execution);
- verify(aaiVnfResources, times(1)).connectVnfToCloudRegion(genericVnf, gBBInput.getCloudRegion());
- }
-
- @Test
- public void connectNoneToVnfToCloudRegionTest() throws Exception {
- String[] arr = new String[1];
- arr[0] = "test25Region2";
- doReturn(arr).when(env).getProperty("mso.bpmn.cloudRegionIdsToSkipAddingVnfEdgesTo", String[].class);
- gBBInput = execution.getGeneralBuildingBlock();
- gBBInput.getCloudRegion().setLcpCloudRegionId("test25Region2");
- doNothing().when(aaiVnfResources).connectVnfToCloudRegion(genericVnf, gBBInput.getCloudRegion());
- aaiCreateTasks.connectVnfToCloudRegion(execution);
- verify(aaiVnfResources, times(0)).connectVnfToCloudRegion(genericVnf, gBBInput.getCloudRegion());
- }
-
- @Test
- public void connectVnfTenantTest() throws Exception {
- gBBInput = execution.getGeneralBuildingBlock();
- doNothing().when(aaiVnfResources).connectVnfToTenant(genericVnf, gBBInput.getCloudRegion());
- aaiCreateTasks.connectVnfToTenant(execution);
- verify(aaiVnfResources, times(1)).connectVnfToTenant(genericVnf, gBBInput.getCloudRegion());
- }
-
- @Test
- public void createInstanceGroupVnfTest() throws Exception {
- doNothing().when(aaiInstanceGroupResources).createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance);
- aaiCreateTasks.createInstanceGroupVnf(execution);
- verify(aaiInstanceGroupResources, times(1)).createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance);
- }
-
- @Test
- public void createInstanceGroupVnfExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(aaiInstanceGroupResources).createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance);
- aaiCreateTasks.createInstanceGroupVnf(execution);
- }
-
- @Test
- public void createNetworkPolicyNeedToCreateAllTest() throws Exception {
- execution.setVariable("heatStackId", "testHeatStackId");
- execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123,ED456");
- Optional<NetworkPolicy> networkPolicy = Optional.empty();
- doReturn(networkPolicy).when(aaiNetworkResources).getNetworkPolicy(any(AAIResourceUri.class));
- doNothing().when(aaiNetworkResources).createNetworkPolicy(any(NetworkPolicy.class));
- aaiCreateTasks.createNetworkPolicies(execution);
- verify(aaiNetworkResources, times(2)).createNetworkPolicy(networkPolicyCaptor.capture());
- assertEquals("ABC123", networkPolicyCaptor.getAllValues().get(0).getNetworkPolicyFqdn());
- assertEquals("ED456", networkPolicyCaptor.getAllValues().get(1).getNetworkPolicyFqdn());
- assertEquals("testHeatStackId", networkPolicyCaptor.getAllValues().get(0).getHeatStackId());
- assertEquals("testHeatStackId", networkPolicyCaptor.getAllValues().get(1).getHeatStackId());
- }
-
- @Test
- public void createNetworkPolicyNeedToCreateNoneTest() throws Exception {
- execution.setVariable("heatStackId", "testHeatStackId");
- execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123");
- NetworkPolicy networkPolicy = new NetworkPolicy();
- doReturn(Optional.of(networkPolicy)).when(aaiNetworkResources).getNetworkPolicy(any(AAIResourceUri.class));
- doNothing().when(aaiNetworkResources).createNetworkPolicy(any(NetworkPolicy.class));
- aaiCreateTasks.createNetworkPolicies(execution);
- verify(aaiNetworkResources, times(0)).createNetworkPolicy(any(NetworkPolicy.class));
- }
-
- @Test
- public void createNetworkPolicyNoNetworkPoliciesTest() throws Exception {
- execution.setVariable("heatStackId", "testHeatStackId");
- aaiCreateTasks.createNetworkPolicies(execution);
- verify(aaiNetworkResources, times(0)).createNetworkPolicy(any(NetworkPolicy.class));
- }
-
- @Test
- public void createVfModuleGetLowestIndexTest() throws Exception {
- GenericVnf vnf = new GenericVnf();
- ModelInfoGenericVnf vnfInfo = new ModelInfoGenericVnf();
- vnf.setModelInfoGenericVnf(vnfInfo);
- vnfInfo.setModelInvariantUuid("my-uuid");
-
- ModelInfoVfModule infoA = new ModelInfoVfModule();
- infoA.setIsBaseBoolean(false);
- infoA.setModelInvariantUUID("A");
-
- ModelInfoVfModule infoB = new ModelInfoVfModule();
- infoB.setIsBaseBoolean(false);
- infoB.setModelInvariantUUID("B");
-
- ModelInfoVfModule infoC = new ModelInfoVfModule();
- infoC.setIsBaseBoolean(false);
- infoC.setModelInvariantUUID("C");
-
- VfModule newVfModuleA = new VfModule();
- newVfModuleA.setVfModuleId("a");
- VfModule newVfModuleB = new VfModule();
- newVfModuleB.setVfModuleId("b");
- VfModule newVfModuleC = new VfModule();
- newVfModuleC.setVfModuleId("c");
-
- VfModule vfModule = new VfModule();
- vnf.getVfModules().add(vfModule);
- vfModule.setVfModuleId("1");
-
- VfModule vfModule2 = new VfModule();
- vnf.getVfModules().add(vfModule2);
- vfModule2.setVfModuleId("2");
-
- VfModule vfModule3 = new VfModule();
- vnf.getVfModules().add(vfModule3);
- vfModule3.setVfModuleId("3");
-
- VfModule vfModule4 = new VfModule();
- vnf.getVfModules().add(vfModule4);
- vfModule4.setVfModuleId("4");
-
- VfModule vfModule5 = new VfModule();
- vnf.getVfModules().add(vfModule5);
- vfModule5.setVfModuleId("5");
-
- //modules are included in the vnf already
- vnf.getVfModules().add(newVfModuleA);
- vnf.getVfModules().add(newVfModuleB);
- vnf.getVfModules().add(newVfModuleC);
-
- //A
- newVfModuleA.setModelInfoVfModule(infoA);
- vfModule.setModelInfoVfModule(infoA);
- vfModule2.setModelInfoVfModule(infoA);
- vfModule3.setModelInfoVfModule(infoA);
-
- //B
-
- newVfModuleB.setModelInfoVfModule(infoB);
- vfModule4.setModelInfoVfModule(infoB);
- vfModule5.setModelInfoVfModule(infoB);
-
- //C
- newVfModuleC.setModelInfoVfModule(infoC);
-
-
- //A
- vfModule.setModuleIndex(2);
- vfModule2.setModuleIndex(0);
- vfModule3.setModuleIndex(3);
-
- //B
- vfModule4.setModuleIndex(null);
- vfModule5.setModuleIndex(1);
-
- assertEquals(1, aaiCreateTasks.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, newVfModuleA));
-
- assertEquals(2, aaiCreateTasks.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, newVfModuleB));
-
- assertEquals(0, aaiCreateTasks.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, newVfModuleC));
-
- }
-
- @Test
- public void calculateUnusedIndexTest() {
-
- TreeSet<Integer> a = new TreeSet<>(Arrays.asList(0,1,3));
- TreeSet<Integer> b = new TreeSet<>(Arrays.asList(0,1,8));
- TreeSet<Integer> c = new TreeSet<>(Arrays.asList(0,2,4));
- assertEquals(2, aaiCreateTasks.calculateUnusedIndex(a, 0));
- assertEquals(5, aaiCreateTasks.calculateUnusedIndex(a, 2));
-
- assertEquals(4, aaiCreateTasks.calculateUnusedIndex(b, 2));
- assertEquals(3, aaiCreateTasks.calculateUnusedIndex(b, 1));
-
- assertEquals(5, aaiCreateTasks.calculateUnusedIndex(c, 2));
- assertEquals(9, aaiCreateTasks.calculateUnusedIndex(c, 6));
- assertEquals(1, aaiCreateTasks.calculateUnusedIndex(c, 0));
-
- }
+ @Test
+ public void createVfModuleExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(RuntimeException.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(RuntimeException.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(RuntimeException.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());
+
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID)))
+ .thenReturn(serviceInstance);
+ // 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());
+ }
+
+ @Test
+ public void createConfigurationTest() throws Exception {
+ gBBInput = execution.getGeneralBuildingBlock();
+ doNothing().when(aaiConfigurationResources).createConfiguration(configuration);
+ aaiCreateTasks.createConfiguration(execution);
+ verify(aaiConfigurationResources, times(1)).createConfiguration(configuration);
+ }
+
+ @Test
+ public void connectVnfToCloudRegionTest() throws Exception {
+ gBBInput = execution.getGeneralBuildingBlock();
+ doNothing().when(aaiVnfResources).connectVnfToCloudRegion(genericVnf, gBBInput.getCloudRegion());
+ aaiCreateTasks.connectVnfToCloudRegion(execution);
+ verify(aaiVnfResources, times(1)).connectVnfToCloudRegion(genericVnf, gBBInput.getCloudRegion());
+ }
+
+ @Test
+ public void connectNoneToVnfToCloudRegionTest() throws Exception {
+ String[] arr = new String[1];
+ arr[0] = "test25Region2";
+ doReturn(arr).when(env).getProperty("mso.bpmn.cloudRegionIdsToSkipAddingVnfEdgesTo", String[].class);
+ gBBInput = execution.getGeneralBuildingBlock();
+ gBBInput.getCloudRegion().setLcpCloudRegionId("test25Region2");
+ doNothing().when(aaiVnfResources).connectVnfToCloudRegion(genericVnf, gBBInput.getCloudRegion());
+ aaiCreateTasks.connectVnfToCloudRegion(execution);
+ verify(aaiVnfResources, times(0)).connectVnfToCloudRegion(genericVnf, gBBInput.getCloudRegion());
+ }
+
+ @Test
+ public void connectVnfTenantTest() throws Exception {
+ gBBInput = execution.getGeneralBuildingBlock();
+ doNothing().when(aaiVnfResources).connectVnfToTenant(genericVnf, gBBInput.getCloudRegion());
+ aaiCreateTasks.connectVnfToTenant(execution);
+ verify(aaiVnfResources, times(1)).connectVnfToTenant(genericVnf, gBBInput.getCloudRegion());
+ }
+
+ @Test
+ public void createInstanceGroupVnfTest() throws Exception {
+ doNothing().when(aaiInstanceGroupResources).createInstanceGroupandConnectServiceInstance(instanceGroup,
+ serviceInstance);
+ aaiCreateTasks.createInstanceGroupVnf(execution);
+ verify(aaiInstanceGroupResources, times(1)).createInstanceGroupandConnectServiceInstance(instanceGroup,
+ serviceInstance);
+ }
+
+ @Test
+ public void createInstanceGroupVnfExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.class).when(aaiInstanceGroupResources)
+ .createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance);
+ aaiCreateTasks.createInstanceGroupVnf(execution);
+ }
+
+ @Test
+ public void createNetworkPolicyNeedToCreateAllTest() throws Exception {
+ execution.setVariable("heatStackId", "testHeatStackId");
+ execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123,ED456");
+ Optional<NetworkPolicy> networkPolicy = Optional.empty();
+ doReturn(networkPolicy).when(aaiNetworkResources).getNetworkPolicy(any(AAIResourceUri.class));
+ doNothing().when(aaiNetworkResources).createNetworkPolicy(any(NetworkPolicy.class));
+ aaiCreateTasks.createNetworkPolicies(execution);
+ verify(aaiNetworkResources, times(2)).createNetworkPolicy(networkPolicyCaptor.capture());
+ assertEquals("ABC123", networkPolicyCaptor.getAllValues().get(0).getNetworkPolicyFqdn());
+ assertEquals("ED456", networkPolicyCaptor.getAllValues().get(1).getNetworkPolicyFqdn());
+ assertEquals("testHeatStackId", networkPolicyCaptor.getAllValues().get(0).getHeatStackId());
+ assertEquals("testHeatStackId", networkPolicyCaptor.getAllValues().get(1).getHeatStackId());
+ }
+
+ @Test
+ public void createNetworkPolicyNeedToCreateNoneTest() throws Exception {
+ execution.setVariable("heatStackId", "testHeatStackId");
+ execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123");
+ NetworkPolicy networkPolicy = new NetworkPolicy();
+ doReturn(Optional.of(networkPolicy)).when(aaiNetworkResources).getNetworkPolicy(any(AAIResourceUri.class));
+ doNothing().when(aaiNetworkResources).createNetworkPolicy(any(NetworkPolicy.class));
+ aaiCreateTasks.createNetworkPolicies(execution);
+ verify(aaiNetworkResources, times(0)).createNetworkPolicy(any(NetworkPolicy.class));
+ }
+
+ @Test
+ public void createNetworkPolicyNoNetworkPoliciesTest() throws Exception {
+ execution.setVariable("heatStackId", "testHeatStackId");
+ aaiCreateTasks.createNetworkPolicies(execution);
+ verify(aaiNetworkResources, times(0)).createNetworkPolicy(any(NetworkPolicy.class));
+ }
+
+ @Test
+ public void createVfModuleGetLowestIndexTest() throws Exception {
+ GenericVnf vnf = new GenericVnf();
+ ModelInfoGenericVnf vnfInfo = new ModelInfoGenericVnf();
+ vnf.setModelInfoGenericVnf(vnfInfo);
+ vnfInfo.setModelInvariantUuid("my-uuid");
+
+ ModelInfoVfModule infoA = new ModelInfoVfModule();
+ infoA.setIsBaseBoolean(false);
+ infoA.setModelInvariantUUID("A");
+
+ ModelInfoVfModule infoB = new ModelInfoVfModule();
+ infoB.setIsBaseBoolean(false);
+ infoB.setModelInvariantUUID("B");
+
+ ModelInfoVfModule infoC = new ModelInfoVfModule();
+ infoC.setIsBaseBoolean(false);
+ infoC.setModelInvariantUUID("C");
+
+ VfModule newVfModuleA = new VfModule();
+ newVfModuleA.setVfModuleId("a");
+ VfModule newVfModuleB = new VfModule();
+ newVfModuleB.setVfModuleId("b");
+ VfModule newVfModuleC = new VfModule();
+ newVfModuleC.setVfModuleId("c");
+
+ VfModule vfModule = new VfModule();
+ vnf.getVfModules().add(vfModule);
+ vfModule.setVfModuleId("1");
+
+ VfModule vfModule2 = new VfModule();
+ vnf.getVfModules().add(vfModule2);
+ vfModule2.setVfModuleId("2");
+
+ VfModule vfModule3 = new VfModule();
+ vnf.getVfModules().add(vfModule3);
+ vfModule3.setVfModuleId("3");
+
+ VfModule vfModule4 = new VfModule();
+ vnf.getVfModules().add(vfModule4);
+ vfModule4.setVfModuleId("4");
+
+ VfModule vfModule5 = new VfModule();
+ vnf.getVfModules().add(vfModule5);
+ vfModule5.setVfModuleId("5");
+
+ // modules are included in the vnf already
+ vnf.getVfModules().add(newVfModuleA);
+ vnf.getVfModules().add(newVfModuleB);
+ vnf.getVfModules().add(newVfModuleC);
+
+ // A
+ newVfModuleA.setModelInfoVfModule(infoA);
+ vfModule.setModelInfoVfModule(infoA);
+ vfModule2.setModelInfoVfModule(infoA);
+ vfModule3.setModelInfoVfModule(infoA);
+
+ // B
+
+ newVfModuleB.setModelInfoVfModule(infoB);
+ vfModule4.setModelInfoVfModule(infoB);
+ vfModule5.setModelInfoVfModule(infoB);
+
+ // C
+ newVfModuleC.setModelInfoVfModule(infoC);
+
+
+ // A
+ vfModule.setModuleIndex(2);
+ vfModule2.setModuleIndex(0);
+ vfModule3.setModuleIndex(3);
+
+ // B
+ vfModule4.setModuleIndex(null);
+ vfModule5.setModuleIndex(1);
+
+ assertEquals(1, aaiCreateTasks.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, newVfModuleA));
+
+ assertEquals(2, aaiCreateTasks.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, newVfModuleB));
+
+ assertEquals(0, aaiCreateTasks.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, newVfModuleC));
+
+ }
+
+ @Test
+ public void calculateUnusedIndexTest() {
+
+ TreeSet<Integer> a = new TreeSet<>(Arrays.asList(0, 1, 3));
+ TreeSet<Integer> b = new TreeSet<>(Arrays.asList(0, 1, 8));
+ TreeSet<Integer> c = new TreeSet<>(Arrays.asList(0, 2, 4));
+ assertEquals(2, aaiCreateTasks.calculateUnusedIndex(a, 0));
+ assertEquals(5, aaiCreateTasks.calculateUnusedIndex(a, 2));
+
+ assertEquals(4, aaiCreateTasks.calculateUnusedIndex(b, 2));
+ assertEquals(3, aaiCreateTasks.calculateUnusedIndex(b, 1));
+
+ assertEquals(5, aaiCreateTasks.calculateUnusedIndex(c, 2));
+ assertEquals(9, aaiCreateTasks.calculateUnusedIndex(c, 6));
+ assertEquals(1, aaiCreateTasks.calculateUnusedIndex(c, 0));
+
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
index 826f888818..855d935ae1 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
@@ -29,11 +29,9 @@ 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 java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Optional;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
@@ -60,180 +58,191 @@ import org.onap.so.client.exception.BBObjectNotFoundException;
public class AAIDeleteTasksTest extends BaseTaskTest {
- private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
-
- @InjectMocks
- private AAIDeleteTasks aaiDeleteTasks = new AAIDeleteTasks();
-
- private L3Network network;
- private ServiceInstance serviceInstance;
- private GenericVnf genericVnf;
- private VfModule vfModule;
- private VolumeGroup volumeGroup;
- private CloudRegion cloudRegion;
- private Configuration configuration;
- private InstanceGroup instanceGroup;
-
- @Captor
- ArgumentCaptor<String> stringCaptor;
-
- @Before
- public void before() throws BBObjectNotFoundException {
- serviceInstance = setServiceInstance();
- genericVnf = setGenericVnf();
- vfModule = setVfModule();
- network = setL3Network();
- volumeGroup = setVolumeGroup();
- cloudRegion = setCloudRegion();
- configuration = setConfiguration();
- instanceGroup = setInstanceGroupVnf();
-
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID))).thenReturn(configuration);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID))).thenReturn(instanceGroup);
-
-
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- }
-
- @Test
- public void deleteVfModuleTest() throws Exception {
-
- doNothing().when(aaiVfModuleResources).deleteVfModule(vfModule, genericVnf);
-
- aaiDeleteTasks.deleteVfModule(execution);
- verify(aaiVfModuleResources, times(1)).deleteVfModule(vfModule, genericVnf);
- }
-
- @Test
- public void deleteVfModuleExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(aaiVfModuleResources).deleteVfModule(vfModule, genericVnf);
- aaiDeleteTasks.deleteVfModule(execution);
- }
-
- @Test
- public void deleteServiceInstanceTest() throws Exception {
- doNothing().when(aaiServiceInstanceResources).deleteServiceInstance(serviceInstance);
-
- aaiDeleteTasks.deleteServiceInstance(execution);
-
- verify(aaiServiceInstanceResources, times(1)).deleteServiceInstance(serviceInstance);
- }
-
- @Test
- public void deleteServiceInstanceExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
-
- doThrow(RuntimeException.class).when(aaiServiceInstanceResources).deleteServiceInstance(serviceInstance);
-
- aaiDeleteTasks.deleteServiceInstance(execution);
- }
-
- @Test
- public void deleteVnfTest() throws Exception {
- doNothing().when(aaiVnfResources).deleteVnf(genericVnf);
- aaiDeleteTasks.deleteVnf(execution);
- verify(aaiVnfResources, times(1)).deleteVnf(genericVnf);
- }
-
- @Test
- public void deleteVnfTestException() throws Exception {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(aaiVnfResources).deleteVnf(genericVnf);
-
- aaiDeleteTasks.deleteVnf(execution);
- verify(aaiVnfResources, times(1)).deleteVnf(genericVnf);
- }
-
- @Test
- public void deleteNetworkTest() throws Exception {
- doNothing().when(aaiNetworkResources).deleteNetwork(network);
- aaiDeleteTasks.deleteNetwork(execution);
- verify(aaiNetworkResources, times(1)).deleteNetwork(network);
- }
-
- @Test
- public void deleteCollectionTest() throws Exception {
- doNothing().when(aaiNetworkResources).deleteCollection(serviceInstance.getCollection());
- aaiDeleteTasks.deleteCollection(execution);
- verify(aaiNetworkResources, times(1)).deleteCollection(serviceInstance.getCollection());
- }
-
- @Test
- public void deleteInstanceGroupTest() throws Exception {
- doNothing().when(aaiNetworkResources).deleteNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup());
- aaiDeleteTasks.deleteInstanceGroup(execution);
- verify(aaiNetworkResources, times(1)).deleteNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup());
- }
-
- @Test
- public void deleteVolumeGroupTest() {
- doNothing().when(aaiVolumeGroupResources).deleteVolumeGroup(volumeGroup, cloudRegion);
-
- aaiDeleteTasks.deleteVolumeGroup(execution);
-
- verify(aaiVolumeGroupResources, times(1)).deleteVolumeGroup(volumeGroup, cloudRegion);
- }
-
- @Test
- public void deleteVolumeGroupExceptionTest() {
- expectedException.expect(BpmnError.class);
-
- doThrow(RuntimeException.class).when(aaiVolumeGroupResources).deleteVolumeGroup(volumeGroup, cloudRegion);
-
- aaiDeleteTasks.deleteVolumeGroup(execution);
- }
-
- @Test
- public void deleteConfigurationTest() throws Exception {
- gBBInput = execution.getGeneralBuildingBlock();
- doNothing().when(aaiConfigurationResources).deleteConfiguration(configuration);
- aaiDeleteTasks.deleteConfiguration(execution);
- verify(aaiConfigurationResources, times(1)).deleteConfiguration(configuration);
- }
-
- @Test
- public void deleteInstanceGroupVnfTest() throws Exception {
- doNothing().when(aaiInstanceGroupResources).deleteInstanceGroup(instanceGroup);
- aaiDeleteTasks.deleteInstanceGroupVnf(execution);
- verify(aaiInstanceGroupResources, times(1)).deleteInstanceGroup(instanceGroup);
- }
-
- @Test
- public void deleteNetworkPolicyNeedToDeleteAllTest() throws Exception {
- execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123,DEF456");
- final String content0 = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPoliciesForDelete0.json")));
- AAIResultWrapper aaiResultWrapper0 = new AAIResultWrapper(content0);
- NetworkPolicies networkPolicies0 = aaiResultWrapper0.asBean(NetworkPolicies.class).get();
- final String content1 = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPoliciesForDelete1.json")));
- AAIResultWrapper aaiResultWrapper1 = new AAIResultWrapper(content1);
- NetworkPolicies networkPolicies1 = aaiResultWrapper1.asBean(NetworkPolicies.class).get();
-
- doReturn(Optional.of(networkPolicies0),Optional.of(networkPolicies1)).when(aaiNetworkResources).getNetworkPolicies(any(AAIResourceUri.class));
- doNothing().when(aaiNetworkResources).deleteNetworkPolicy(any(String.class));
- aaiDeleteTasks.deleteNetworkPolicies(execution);
- verify(aaiNetworkResources, times(2)).deleteNetworkPolicy(stringCaptor.capture());
- assertEquals("testNetworkPolicyId0", stringCaptor.getAllValues().get(0));
- assertEquals("testNetworkPolicyId1", stringCaptor.getAllValues().get(1));
- }
-
- @Test
- public void deleteNetworkPolicyNeedToDeleteNoneTest() throws Exception {
- execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123");
- Optional<NetworkPolicies> networkPolicies = Optional.empty();
- doReturn(networkPolicies).when(aaiNetworkResources).getNetworkPolicies(any(AAIResourceUri.class));
- aaiDeleteTasks.deleteNetworkPolicies(execution);
- verify(aaiNetworkResources, times(0)).deleteNetworkPolicy(any(String.class));
- }
-
- @Test
- public void deleteNetworkPolicyNoNetworkPoliciesTest() throws Exception {
- aaiDeleteTasks.deleteNetworkPolicies(execution);
- verify(aaiNetworkResources, times(0)).deleteNetworkPolicy(any(String.class));
- }
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
+
+ @InjectMocks
+ private AAIDeleteTasks aaiDeleteTasks = new AAIDeleteTasks();
+
+ private L3Network network;
+ private ServiceInstance serviceInstance;
+ private GenericVnf genericVnf;
+ private VfModule vfModule;
+ private VolumeGroup volumeGroup;
+ private CloudRegion cloudRegion;
+ private Configuration configuration;
+ private InstanceGroup instanceGroup;
+
+ @Captor
+ ArgumentCaptor<String> stringCaptor;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ serviceInstance = setServiceInstance();
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+ network = setL3Network();
+ volumeGroup = setVolumeGroup();
+ cloudRegion = setCloudRegion();
+ configuration = setConfiguration();
+ instanceGroup = setInstanceGroupVnf();
+
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID)))
+ .thenReturn(volumeGroup);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID)))
+ .thenReturn(configuration);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID)))
+ .thenReturn(instanceGroup);
+
+
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ }
+
+ @Test
+ public void deleteVfModuleTest() throws Exception {
+
+ doNothing().when(aaiVfModuleResources).deleteVfModule(vfModule, genericVnf);
+
+ aaiDeleteTasks.deleteVfModule(execution);
+ verify(aaiVfModuleResources, times(1)).deleteVfModule(vfModule, genericVnf);
+ }
+
+ @Test
+ public void deleteVfModuleExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.class).when(aaiVfModuleResources).deleteVfModule(vfModule, genericVnf);
+ aaiDeleteTasks.deleteVfModule(execution);
+ }
+
+ @Test
+ public void deleteServiceInstanceTest() throws Exception {
+ doNothing().when(aaiServiceInstanceResources).deleteServiceInstance(serviceInstance);
+
+ aaiDeleteTasks.deleteServiceInstance(execution);
+
+ verify(aaiServiceInstanceResources, times(1)).deleteServiceInstance(serviceInstance);
+ }
+
+ @Test
+ public void deleteServiceInstanceExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(RuntimeException.class).when(aaiServiceInstanceResources).deleteServiceInstance(serviceInstance);
+
+ aaiDeleteTasks.deleteServiceInstance(execution);
+ }
+
+ @Test
+ public void deleteVnfTest() throws Exception {
+ doNothing().when(aaiVnfResources).deleteVnf(genericVnf);
+ aaiDeleteTasks.deleteVnf(execution);
+ verify(aaiVnfResources, times(1)).deleteVnf(genericVnf);
+ }
+
+ @Test
+ public void deleteVnfTestException() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.class).when(aaiVnfResources).deleteVnf(genericVnf);
+
+ aaiDeleteTasks.deleteVnf(execution);
+ verify(aaiVnfResources, times(1)).deleteVnf(genericVnf);
+ }
+
+ @Test
+ public void deleteNetworkTest() throws Exception {
+ doNothing().when(aaiNetworkResources).deleteNetwork(network);
+ aaiDeleteTasks.deleteNetwork(execution);
+ verify(aaiNetworkResources, times(1)).deleteNetwork(network);
+ }
+
+ @Test
+ public void deleteCollectionTest() throws Exception {
+ doNothing().when(aaiNetworkResources).deleteCollection(serviceInstance.getCollection());
+ aaiDeleteTasks.deleteCollection(execution);
+ verify(aaiNetworkResources, times(1)).deleteCollection(serviceInstance.getCollection());
+ }
+
+ @Test
+ public void deleteInstanceGroupTest() throws Exception {
+ doNothing().when(aaiNetworkResources)
+ .deleteNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup());
+ aaiDeleteTasks.deleteInstanceGroup(execution);
+ verify(aaiNetworkResources, times(1))
+ .deleteNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup());
+ }
+
+ @Test
+ public void deleteVolumeGroupTest() {
+ doNothing().when(aaiVolumeGroupResources).deleteVolumeGroup(volumeGroup, cloudRegion);
+
+ aaiDeleteTasks.deleteVolumeGroup(execution);
+
+ verify(aaiVolumeGroupResources, times(1)).deleteVolumeGroup(volumeGroup, cloudRegion);
+ }
+
+ @Test
+ public void deleteVolumeGroupExceptionTest() {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(RuntimeException.class).when(aaiVolumeGroupResources).deleteVolumeGroup(volumeGroup, cloudRegion);
+
+ aaiDeleteTasks.deleteVolumeGroup(execution);
+ }
+
+ @Test
+ public void deleteConfigurationTest() throws Exception {
+ gBBInput = execution.getGeneralBuildingBlock();
+ doNothing().when(aaiConfigurationResources).deleteConfiguration(configuration);
+ aaiDeleteTasks.deleteConfiguration(execution);
+ verify(aaiConfigurationResources, times(1)).deleteConfiguration(configuration);
+ }
+
+ @Test
+ public void deleteInstanceGroupVnfTest() throws Exception {
+ doNothing().when(aaiInstanceGroupResources).deleteInstanceGroup(instanceGroup);
+ aaiDeleteTasks.deleteInstanceGroupVnf(execution);
+ verify(aaiInstanceGroupResources, times(1)).deleteInstanceGroup(instanceGroup);
+ }
+
+ @Test
+ public void deleteNetworkPolicyNeedToDeleteAllTest() throws Exception {
+ execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123,DEF456");
+ final String content0 = new String(
+ Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPoliciesForDelete0.json")));
+ AAIResultWrapper aaiResultWrapper0 = new AAIResultWrapper(content0);
+ NetworkPolicies networkPolicies0 = aaiResultWrapper0.asBean(NetworkPolicies.class).get();
+ final String content1 = new String(
+ Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPoliciesForDelete1.json")));
+ AAIResultWrapper aaiResultWrapper1 = new AAIResultWrapper(content1);
+ NetworkPolicies networkPolicies1 = aaiResultWrapper1.asBean(NetworkPolicies.class).get();
+
+ doReturn(Optional.of(networkPolicies0), Optional.of(networkPolicies1)).when(aaiNetworkResources)
+ .getNetworkPolicies(any(AAIResourceUri.class));
+ doNothing().when(aaiNetworkResources).deleteNetworkPolicy(any(String.class));
+ aaiDeleteTasks.deleteNetworkPolicies(execution);
+ verify(aaiNetworkResources, times(2)).deleteNetworkPolicy(stringCaptor.capture());
+ assertEquals("testNetworkPolicyId0", stringCaptor.getAllValues().get(0));
+ assertEquals("testNetworkPolicyId1", stringCaptor.getAllValues().get(1));
+ }
+
+ @Test
+ public void deleteNetworkPolicyNeedToDeleteNoneTest() throws Exception {
+ execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123");
+ Optional<NetworkPolicies> networkPolicies = Optional.empty();
+ doReturn(networkPolicies).when(aaiNetworkResources).getNetworkPolicies(any(AAIResourceUri.class));
+ aaiDeleteTasks.deleteNetworkPolicies(execution);
+ verify(aaiNetworkResources, times(0)).deleteNetworkPolicy(any(String.class));
+ }
+
+ @Test
+ public void deleteNetworkPolicyNoNetworkPoliciesTest() throws Exception {
+ aaiDeleteTasks.deleteNetworkPolicies(execution);
+ verify(aaiNetworkResources, times(0)).deleteNetworkPolicy(any(String.class));
+ }
}
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
index 05af58040a..7109ac8826 100644
--- 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
@@ -32,9 +32,7 @@ import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-
import java.util.HashMap;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.hamcrest.Matchers;
import org.junit.Before;
@@ -59,613 +57,678 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
-public class AAIUpdateTasksTest extends BaseTaskTest{
-
- @InjectMocks
- private AAIUpdateTasks aaiUpdateTasks = new AAIUpdateTasks();
-
- private L3Network network;
- private ServiceInstance serviceInstance;
- private VfModule vfModule;
- private GenericVnf genericVnf;
- private VolumeGroup volumeGroup;
- private CloudRegion cloudRegion;
- private Configuration configuration;
- private Subnet subnet;
-
- @Before
- public void before() throws BBObjectNotFoundException {
- serviceInstance = setServiceInstance();
- genericVnf = setGenericVnf();
- vfModule = setVfModule();
- volumeGroup = setVolumeGroup();
- cloudRegion = setCloudRegion();
- network = setL3Network();
- configuration = setConfiguration();
- subnet = buildSubnet();
-
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID))).thenReturn(configuration);
-
-
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- }
-
- @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(RuntimeException.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(RuntimeException.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(RuntimeException.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(RuntimeException.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(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
-
- expectedException.expect(BpmnError.class);
-
- aaiUpdateTasks.updateOrchestrationStatusAssignedVfModule(execution);
- }
-
- @Test
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleNoMultiStageTest() throws Exception {
- execution.setVariable("aLaCarte", true);
- ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("false");
- genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
- doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
- aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
- verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
- assertEquals("", vfModule.getHeatStackId());
- }
-
- @Test
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleMultiStageButNotAlacarteTest() throws Exception {
- execution.setVariable("aLaCarte", false);
- ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("true");
- genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
- doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
- aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
- verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
- assertEquals("", vfModule.getHeatStackId());
- }
-
- @Test
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleWithMultiStageTest() throws Exception {
- execution.setVariable("aLaCarte", true);
- ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("true");
- genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
- doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.PENDING_ACTIVATION);
- aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
- verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.PENDING_ACTIVATION);
- assertEquals("", vfModule.getHeatStackId());
- }
-
- @Test
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleExceptionTest() throws Exception {
- execution.setVariable("aLaCarte", true);
- doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
-
- expectedException.expect(BpmnError.class);
-
- aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(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(RuntimeException.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(RuntimeException.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(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED);
-
- expectedException.expect(BpmnError.class);
-
- aaiUpdateTasks.updateOrchestrationStatusDeactivateVfModule(execution);
- }
-
- @Test
- public void updateHeatStackIdVfModuleTest() throws Exception {
- execution.setVariable("heatStackId", "newHeatStackId");
- doNothing().when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf);
-
- aaiUpdateTasks.updateHeatStackIdVfModule(execution);
-
- verify(aaiVfModuleResources, times(1)).updateHeatStackIdVfModule(vfModule, genericVnf);
- assertEquals("newHeatStackId", vfModule.getHeatStackId());
- }
-
- @Test
- public void updateHeatStackIdVfModuleToNullTest() throws Exception {
- execution.setVariable("heatStackId", null);
- doNothing().when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf);
-
- aaiUpdateTasks.updateHeatStackIdVfModule(execution);
-
- verify(aaiVfModuleResources, times(1)).updateHeatStackIdVfModule(vfModule, genericVnf);
- assertEquals(vfModule.getHeatStackId(), "");
- }
-
- @Test
- public void updateHeatStackIdVfModuleExceptionTest() throws Exception {
- doThrow(RuntimeException.class).when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf);
-
- expectedException.expect(BpmnError.class);
-
- aaiUpdateTasks.updateHeatStackIdVfModule(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(RuntimeException.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(RuntimeException.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(RuntimeException.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED);
- aaiUpdateTasks.updateOrchestrationStatusAssignedVolumeGroup(execution);
- }
- @Test
- public void updateHeatStackIdVolumeGroupTest() throws Exception {
- execution.setVariable("heatStackId", "newHeatStackId");
- doNothing().when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
-
- aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution);
-
- verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
- assertEquals("newHeatStackId", volumeGroup.getHeatStackId());
- }
- @Test
- public void updateHeatStackIdVolumeGroupToNullTest() throws Exception {
- execution.setVariable("heatStackId", null);
- doNothing().when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
-
- aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution);
-
- verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
- assertEquals(volumeGroup.getHeatStackId(), "");
- }
-
- @Test
- public void updateHeatStackIdVolumeGroupExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
- aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution);
- }
-
- @Test
- public void updateNetworkExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
-
- doThrow(RuntimeException.class).when(aaiNetworkResources).updateNetwork(network);
-
- aaiUpdateTasks.updateNetwork(execution, OrchestrationStatus.ACTIVE);
- }
-
- @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(RuntimeException.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(RuntimeException.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");
- HashMap<String, String> subnetMap = new HashMap<>();
- subnetMap.put("testSubnetId", "testNeutronSubnetId");
- createNetworkResponse.setSubnetMap(subnetMap);
-
- network.getSubnets().add(subnet);
-
- execution.setVariable("createNetworkResponse", createNetworkResponse);
-
- doNothing().when(aaiNetworkResources).updateNetwork(network);
- doNothing().when(aaiNetworkResources).updateSubnet(network, subnet);
-
- aaiUpdateTasks.updateNetworkCreated(execution);
- verify(aaiNetworkResources, times(1)).updateNetwork(network);
- verify(aaiNetworkResources, times(1)).updateSubnet(network, subnet);
-
- assertEquals(createNetworkResponse.getNetworkFqdn(), network.getContrailNetworkFqdn());
- assertEquals(OrchestrationStatus.CREATED, network.getOrchestrationStatus());
- assertEquals(createNetworkResponse.getNetworkStackId(), network.getHeatStackId());
- assertEquals(createNetworkResponse.getNeutronNetworkId(), network.getNeutronNetworkId());
- String neutronSubnetId = createNetworkResponse.getSubnetMap().entrySet().iterator().next().getValue();
- assertEquals(neutronSubnetId, network.getSubnets().get(0).getNeutronSubnetId());
- }
-
- @Test
- public void updateNetworkUpdatedTest() throws Exception {
- UpdateNetworkResponse updateNetworkResponse = new UpdateNetworkResponse();
- updateNetworkResponse.setNeutronNetworkId("testNeutronNetworkId");
- HashMap<String, String> subnetMap = new HashMap<>();
- subnetMap.put("testSubnetId", "testNeutronSubnetId");
- updateNetworkResponse.setSubnetMap(subnetMap);
-
- network.getSubnets().add(subnet);
-
- execution.setVariable("updateNetworkResponse", updateNetworkResponse);
-
- doNothing().when(aaiNetworkResources).updateNetwork(network);
- doNothing().when(aaiNetworkResources).updateSubnet(network, subnet);
-
- aaiUpdateTasks.updateNetworkUpdated(execution);
- verify(aaiNetworkResources, times(1)).updateNetwork(network);
- verify(aaiNetworkResources, times(1)).updateSubnet(network, subnet);
-
- String neutronSubnetId = updateNetworkResponse.getSubnetMap().entrySet().iterator().next().getValue();
- assertEquals(neutronSubnetId, network.getSubnets().get(0).getNeutronSubnetId());
- }
-
- @Test
- public void updateOrchestrationStatusNetworkTest() {
- AAIUpdateTasks spy = Mockito.spy(new AAIUpdateTasks());
- doNothing().when(spy).updateNetwork(eq(execution), any());
- spy.updateOrchestrationStatusActiveNetwork(execution);
- verify(spy, times(1)).updateNetwork(execution, OrchestrationStatus.ACTIVE);
- spy.updateOrchestrationStatusAssignedNetwork(execution);
- verify(spy, times(1)).updateNetwork(execution, OrchestrationStatus.ASSIGNED);
- spy.updateOrchestrationStatusCreatedNetwork(execution);
- verify(spy, times(1)).updateNetwork(execution, OrchestrationStatus.CREATED);
- }
-
- @Test
- public void updateNetworkAAITest() {
-
- L3Network spy = spy(new L3Network());
- L3Network shallowCopy = mock(L3Network.class);
- Subnet mockSubnet = mock(Subnet.class);
- Subnet shallowCopySubnet = mock(Subnet.class);
- when(mockSubnet.shallowCopyId()).thenReturn(shallowCopySubnet);
- doReturn(shallowCopy).when(spy).shallowCopyId();
-
- doNothing().when(aaiNetworkResources).updateNetwork(network);
- doNothing().when(aaiNetworkResources).updateSubnet(network, subnet);
-
- spy.getSubnets().add(mockSubnet);
- aaiUpdateTasks.updateNetworkAAI(spy, OrchestrationStatus.CREATED);
-
- verify(shallowCopy, times(1)).setOrchestrationStatus(OrchestrationStatus.CREATED);
- verify(spy, times(1)).setOrchestrationStatus(OrchestrationStatus.CREATED);
- verify(shallowCopySubnet, times(1)).setOrchestrationStatus(OrchestrationStatus.CREATED);
- }
- @Test
- public void updateNetworkCreatedkExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.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(RuntimeException.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(RuntimeException.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(RuntimeException.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(RuntimeException.class).when(aaiVfModuleResources).changeAssignVfModule(vfModule, genericVnf);
- aaiUpdateTasks.updateModelVfModule(execution);
- }
-
- @Test
- public void updateOrchestrationStatusDeactivateFabricConfigurationTest() throws Exception {
- gBBInput = execution.getGeneralBuildingBlock();
- doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED);
-
- aaiUpdateTasks.updateOrchestrationStatusDeactivateFabricConfiguration(execution);
-
- verify(aaiConfigurationResources, times(1)).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED);
- }
- @Test
- public void updateOrchestrationStatusActivateFabricConfigurationTest() throws Exception {
- gBBInput = execution.getGeneralBuildingBlock();
- doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
-
- aaiUpdateTasks.updateOrchestrationStatusActivateFabricConfiguration(execution);
-
- verify(aaiConfigurationResources, times(1)).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
- }
- @Test
- public void updateContrailServiceInstanceFqdnVfModuleTest() throws Exception {
- execution.setVariable("contrailServiceInstanceFqdn", "newContrailServiceInstanceFqdn");
- doNothing().when(aaiVfModuleResources).updateContrailServiceInstanceFqdnVfModule(vfModule, genericVnf);
-
- aaiUpdateTasks.updateContrailServiceInstanceFqdnVfModule(execution);
-
- verify(aaiVfModuleResources, times(1)).updateContrailServiceInstanceFqdnVfModule(vfModule, genericVnf);
- assertEquals("newContrailServiceInstanceFqdn", vfModule.getContrailServiceInstanceFqdn());
- }
- @Test
- public void updateContrailServiceInstanceFqdnVfModuleNoUpdateTest() throws Exception {
- aaiUpdateTasks.updateContrailServiceInstanceFqdnVfModule(execution);
- verify(aaiVfModuleResources, times(0)).updateContrailServiceInstanceFqdnVfModule(vfModule, genericVnf);
- }
- @Test
- public void updateIpv4OamAddressVnfTest() throws Exception {
- execution.setVariable("oamManagementV4Address", "newIpv4OamAddress");
- doNothing().when(aaiVnfResources).updateObjectVnf(genericVnf);
-
- aaiUpdateTasks.updateIpv4OamAddressVnf(execution);
-
- verify(aaiVnfResources, times(1)).updateObjectVnf(genericVnf);
- assertEquals("newIpv4OamAddress", genericVnf.getIpv4OamAddress());
- }
- @Test
- public void updateIpv4OamAddressVnfNoUpdateTest() throws Exception {
- aaiUpdateTasks.updateIpv4OamAddressVnf(execution);
- verify(aaiVnfResources, times(0)).updateObjectVnf(genericVnf);
- }
- @Test
- public void updateManagementV6AddressVnfTest() throws Exception {
- execution.setVariable("oamManagementV6Address", "newManagementV6Address");
- doNothing().when(aaiVnfResources).updateObjectVnf(genericVnf);
-
- aaiUpdateTasks.updateManagementV6AddressVnf(execution);
-
- verify(aaiVnfResources, times(1)).updateObjectVnf(genericVnf);
- assertEquals("newManagementV6Address", genericVnf.getManagementV6Address());
- }
- @Test
- public void updateManagementV6AddressVnfNoUpdateTest() throws Exception {
- aaiUpdateTasks.updateManagementV6AddressVnf(execution);
- verify(aaiVnfResources, times(0)).updateObjectVnf(genericVnf);
- }
-
- @Test
- public void updateOrchestrationStatusVnfConfigureTest() throws Exception {
- doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CONFIGURE);
-
- aaiUpdateTasks.updateOrchestrationStausConfigDeployConfigureVnf(execution);
- }
- @Test
- public void updateOrchestrationStatusVnfConfiguredTest() throws Exception {
- doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CONFIGURED);
-
- aaiUpdateTasks.updateOrchestrationStausConfigDeployConfiguredVnf(execution);
- }
+public class AAIUpdateTasksTest extends BaseTaskTest {
+
+ @InjectMocks
+ private AAIUpdateTasks aaiUpdateTasks = new AAIUpdateTasks();
+
+ private L3Network network;
+ private ServiceInstance serviceInstance;
+ private VfModule vfModule;
+ private GenericVnf genericVnf;
+ private VolumeGroup volumeGroup;
+ private CloudRegion cloudRegion;
+ private Configuration configuration;
+ private Subnet subnet;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ serviceInstance = setServiceInstance();
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+ volumeGroup = setVolumeGroup();
+ cloudRegion = setCloudRegion();
+ network = setL3Network();
+ configuration = setConfiguration();
+ subnet = buildSubnet();
+
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID)))
+ .thenReturn(volumeGroup);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID)))
+ .thenReturn(configuration);
+
+
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ }
+
+ @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(RuntimeException.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(RuntimeException.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(RuntimeException.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(RuntimeException.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(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule,
+ genericVnf, OrchestrationStatus.ASSIGNED);
+
+ expectedException.expect(BpmnError.class);
+
+ aaiUpdateTasks.updateOrchestrationStatusAssignedVfModule(execution);
+ }
+
+ @Test
+ public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleNoMultiStageTest() throws Exception {
+ execution.setVariable("aLaCarte", true);
+ ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setMultiStageDesign("false");
+ genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+ doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
+ OrchestrationStatus.ASSIGNED);
+ aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
+ verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf,
+ OrchestrationStatus.ASSIGNED);
+ assertEquals("", vfModule.getHeatStackId());
+ }
+
+ @Test
+ public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleMultiStageButNotAlacarteTest()
+ throws Exception {
+ execution.setVariable("aLaCarte", false);
+ ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setMultiStageDesign("true");
+ genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+ doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
+ OrchestrationStatus.ASSIGNED);
+ aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
+ verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf,
+ OrchestrationStatus.ASSIGNED);
+ assertEquals("", vfModule.getHeatStackId());
+ }
+
+ @Test
+ public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleWithMultiStageTest() throws Exception {
+ execution.setVariable("aLaCarte", true);
+ ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setMultiStageDesign("true");
+ genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+ doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
+ OrchestrationStatus.PENDING_ACTIVATION);
+ aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
+ verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf,
+ OrchestrationStatus.PENDING_ACTIVATION);
+ assertEquals("", vfModule.getHeatStackId());
+ }
+
+ @Test
+ public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleExceptionTest() throws Exception {
+ execution.setVariable("aLaCarte", true);
+ doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule,
+ genericVnf, OrchestrationStatus.ASSIGNED);
+
+ expectedException.expect(BpmnError.class);
+
+ aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(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(RuntimeException.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(RuntimeException.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(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule,
+ genericVnf, OrchestrationStatus.CREATED);
+
+ expectedException.expect(BpmnError.class);
+
+ aaiUpdateTasks.updateOrchestrationStatusDeactivateVfModule(execution);
+ }
+
+ @Test
+ public void updateHeatStackIdVfModuleTest() throws Exception {
+ execution.setVariable("heatStackId", "newHeatStackId");
+ doNothing().when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf);
+
+ aaiUpdateTasks.updateHeatStackIdVfModule(execution);
+
+ verify(aaiVfModuleResources, times(1)).updateHeatStackIdVfModule(vfModule, genericVnf);
+ assertEquals("newHeatStackId", vfModule.getHeatStackId());
+ }
+
+ @Test
+ public void updateHeatStackIdVfModuleToNullTest() throws Exception {
+ execution.setVariable("heatStackId", null);
+ doNothing().when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf);
+
+ aaiUpdateTasks.updateHeatStackIdVfModule(execution);
+
+ verify(aaiVfModuleResources, times(1)).updateHeatStackIdVfModule(vfModule, genericVnf);
+ assertEquals(vfModule.getHeatStackId(), "");
+ }
+
+ @Test
+ public void updateHeatStackIdVfModuleExceptionTest() throws Exception {
+ doThrow(RuntimeException.class).when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf);
+
+ expectedException.expect(BpmnError.class);
+
+ aaiUpdateTasks.updateHeatStackIdVfModule(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(RuntimeException.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(RuntimeException.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(RuntimeException.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup,
+ cloudRegion, OrchestrationStatus.ASSIGNED);
+ aaiUpdateTasks.updateOrchestrationStatusAssignedVolumeGroup(execution);
+ }
+
+ @Test
+ public void updateHeatStackIdVolumeGroupTest() throws Exception {
+ execution.setVariable("heatStackId", "newHeatStackId");
+ doNothing().when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
+
+ aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution);
+
+ verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
+ assertEquals("newHeatStackId", volumeGroup.getHeatStackId());
+ }
+
+ @Test
+ public void updateHeatStackIdVolumeGroupToNullTest() throws Exception {
+ execution.setVariable("heatStackId", null);
+ doNothing().when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
+
+ aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution);
+
+ verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
+ assertEquals(volumeGroup.getHeatStackId(), "");
+ }
+
+ @Test
+ public void updateHeatStackIdVolumeGroupExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.class).when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup,
+ cloudRegion);
+ aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution);
+ }
+
+ @Test
+ public void updateNetworkExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(RuntimeException.class).when(aaiNetworkResources).updateNetwork(network);
+
+ aaiUpdateTasks.updateNetwork(execution, OrchestrationStatus.ACTIVE);
+ }
+
+ @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(RuntimeException.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(RuntimeException.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");
+ HashMap<String, String> subnetMap = new HashMap<>();
+ subnetMap.put("testSubnetId", "testNeutronSubnetId");
+ createNetworkResponse.setSubnetMap(subnetMap);
+
+ network.getSubnets().add(subnet);
+
+ execution.setVariable("createNetworkResponse", createNetworkResponse);
+
+ doNothing().when(aaiNetworkResources).updateNetwork(network);
+ doNothing().when(aaiNetworkResources).updateSubnet(network, subnet);
+
+ aaiUpdateTasks.updateNetworkCreated(execution);
+ verify(aaiNetworkResources, times(1)).updateNetwork(network);
+ verify(aaiNetworkResources, times(1)).updateSubnet(network, subnet);
+
+ assertEquals(createNetworkResponse.getNetworkFqdn(), network.getContrailNetworkFqdn());
+ assertEquals(OrchestrationStatus.CREATED, network.getOrchestrationStatus());
+ assertEquals(createNetworkResponse.getNetworkStackId(), network.getHeatStackId());
+ assertEquals(createNetworkResponse.getNeutronNetworkId(), network.getNeutronNetworkId());
+ String neutronSubnetId = createNetworkResponse.getSubnetMap().entrySet().iterator().next().getValue();
+ assertEquals(neutronSubnetId, network.getSubnets().get(0).getNeutronSubnetId());
+ }
+
+ @Test
+ public void updateNetworkUpdatedTest() throws Exception {
+ UpdateNetworkResponse updateNetworkResponse = new UpdateNetworkResponse();
+ updateNetworkResponse.setNeutronNetworkId("testNeutronNetworkId");
+ HashMap<String, String> subnetMap = new HashMap<>();
+ subnetMap.put("testSubnetId", "testNeutronSubnetId");
+ updateNetworkResponse.setSubnetMap(subnetMap);
+
+ network.getSubnets().add(subnet);
+
+ execution.setVariable("updateNetworkResponse", updateNetworkResponse);
+
+ doNothing().when(aaiNetworkResources).updateNetwork(network);
+ doNothing().when(aaiNetworkResources).updateSubnet(network, subnet);
+
+ aaiUpdateTasks.updateNetworkUpdated(execution);
+ verify(aaiNetworkResources, times(1)).updateNetwork(network);
+ verify(aaiNetworkResources, times(1)).updateSubnet(network, subnet);
+
+ String neutronSubnetId = updateNetworkResponse.getSubnetMap().entrySet().iterator().next().getValue();
+ assertEquals(neutronSubnetId, network.getSubnets().get(0).getNeutronSubnetId());
+ }
+
+ @Test
+ public void updateOrchestrationStatusNetworkTest() {
+ AAIUpdateTasks spy = Mockito.spy(new AAIUpdateTasks());
+ doNothing().when(spy).updateNetwork(eq(execution), any());
+ spy.updateOrchestrationStatusActiveNetwork(execution);
+ verify(spy, times(1)).updateNetwork(execution, OrchestrationStatus.ACTIVE);
+ spy.updateOrchestrationStatusAssignedNetwork(execution);
+ verify(spy, times(1)).updateNetwork(execution, OrchestrationStatus.ASSIGNED);
+ spy.updateOrchestrationStatusCreatedNetwork(execution);
+ verify(spy, times(1)).updateNetwork(execution, OrchestrationStatus.CREATED);
+ }
+
+ @Test
+ public void updateNetworkAAITest() {
+
+ L3Network spy = spy(new L3Network());
+ L3Network shallowCopy = mock(L3Network.class);
+ Subnet mockSubnet = mock(Subnet.class);
+ Subnet shallowCopySubnet = mock(Subnet.class);
+ when(mockSubnet.shallowCopyId()).thenReturn(shallowCopySubnet);
+ doReturn(shallowCopy).when(spy).shallowCopyId();
+
+ doNothing().when(aaiNetworkResources).updateNetwork(network);
+ doNothing().when(aaiNetworkResources).updateSubnet(network, subnet);
+
+ spy.getSubnets().add(mockSubnet);
+ aaiUpdateTasks.updateNetworkAAI(spy, OrchestrationStatus.CREATED);
+
+ verify(shallowCopy, times(1)).setOrchestrationStatus(OrchestrationStatus.CREATED);
+ verify(spy, times(1)).setOrchestrationStatus(OrchestrationStatus.CREATED);
+ verify(shallowCopySubnet, times(1)).setOrchestrationStatus(OrchestrationStatus.CREATED);
+ }
+
+ @Test
+ public void updateNetworkCreatedkExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.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(RuntimeException.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(RuntimeException.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(RuntimeException.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(RuntimeException.class).when(aaiVfModuleResources).changeAssignVfModule(vfModule, genericVnf);
+ aaiUpdateTasks.updateModelVfModule(execution);
+ }
+
+ @Test
+ public void updateOrchestrationStatusDeactivateFabricConfigurationTest() throws Exception {
+ gBBInput = execution.getGeneralBuildingBlock();
+ doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration,
+ OrchestrationStatus.ASSIGNED);
+
+ aaiUpdateTasks.updateOrchestrationStatusDeactivateFabricConfiguration(execution);
+
+ verify(aaiConfigurationResources, times(1)).updateOrchestrationStatusConfiguration(configuration,
+ OrchestrationStatus.ASSIGNED);
+ }
+
+ @Test
+ public void updateOrchestrationStatusActivateFabricConfigurationTest() throws Exception {
+ gBBInput = execution.getGeneralBuildingBlock();
+ doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration,
+ OrchestrationStatus.ACTIVE);
+
+ aaiUpdateTasks.updateOrchestrationStatusActivateFabricConfiguration(execution);
+
+ verify(aaiConfigurationResources, times(1)).updateOrchestrationStatusConfiguration(configuration,
+ OrchestrationStatus.ACTIVE);
+ }
+
+ @Test
+ public void updateContrailServiceInstanceFqdnVfModuleTest() throws Exception {
+ execution.setVariable("contrailServiceInstanceFqdn", "newContrailServiceInstanceFqdn");
+ doNothing().when(aaiVfModuleResources).updateContrailServiceInstanceFqdnVfModule(vfModule, genericVnf);
+
+ aaiUpdateTasks.updateContrailServiceInstanceFqdnVfModule(execution);
+
+ verify(aaiVfModuleResources, times(1)).updateContrailServiceInstanceFqdnVfModule(vfModule, genericVnf);
+ assertEquals("newContrailServiceInstanceFqdn", vfModule.getContrailServiceInstanceFqdn());
+ }
+
+ @Test
+ public void updateContrailServiceInstanceFqdnVfModuleNoUpdateTest() throws Exception {
+ aaiUpdateTasks.updateContrailServiceInstanceFqdnVfModule(execution);
+ verify(aaiVfModuleResources, times(0)).updateContrailServiceInstanceFqdnVfModule(vfModule, genericVnf);
+ }
+
+ @Test
+ public void updateIpv4OamAddressVnfTest() throws Exception {
+ execution.setVariable("oamManagementV4Address", "newIpv4OamAddress");
+ doNothing().when(aaiVnfResources).updateObjectVnf(genericVnf);
+
+ aaiUpdateTasks.updateIpv4OamAddressVnf(execution);
+
+ verify(aaiVnfResources, times(1)).updateObjectVnf(genericVnf);
+ assertEquals("newIpv4OamAddress", genericVnf.getIpv4OamAddress());
+ }
+
+ @Test
+ public void updateIpv4OamAddressVnfNoUpdateTest() throws Exception {
+ aaiUpdateTasks.updateIpv4OamAddressVnf(execution);
+ verify(aaiVnfResources, times(0)).updateObjectVnf(genericVnf);
+ }
+
+ @Test
+ public void updateManagementV6AddressVnfTest() throws Exception {
+ execution.setVariable("oamManagementV6Address", "newManagementV6Address");
+ doNothing().when(aaiVnfResources).updateObjectVnf(genericVnf);
+
+ aaiUpdateTasks.updateManagementV6AddressVnf(execution);
+
+ verify(aaiVnfResources, times(1)).updateObjectVnf(genericVnf);
+ assertEquals("newManagementV6Address", genericVnf.getManagementV6Address());
+ }
+
+ @Test
+ public void updateManagementV6AddressVnfNoUpdateTest() throws Exception {
+ aaiUpdateTasks.updateManagementV6AddressVnf(execution);
+ verify(aaiVnfResources, times(0)).updateObjectVnf(genericVnf);
+ }
+
+ @Test
+ public void updateOrchestrationStatusVnfConfigureTest() throws Exception {
+ doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
+ OrchestrationStatus.CONFIGURE);
+
+ aaiUpdateTasks.updateOrchestrationStausConfigDeployConfigureVnf(execution);
+ }
+
+ @Test
+ public void updateOrchestrationStatusVnfConfiguredTest() throws Exception {
+ doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
+ OrchestrationStatus.CONFIGURED);
+
+ aaiUpdateTasks.updateOrchestrationStausConfigDeployConfiguredVnf(execution);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
index ee7a9ad952..56ff813e73 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
@@ -22,14 +22,11 @@ package org.onap.so.bpmn.infrastructure.activity;
import static org.junit.Assert.assertEquals;
-
import java.nio.file.Files;
import java.nio.file.Paths;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Before;
-
import org.junit.Test;
import org.mockito.InjectMocks;
import org.onap.so.bpmn.BaseTaskTest;
@@ -38,40 +35,41 @@ import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.springframework.beans.factory.annotation.Autowired;
public class ExecuteActivityTest extends BaseTaskTest {
- @InjectMocks
- protected ExecuteActivity executeActivity = new ExecuteActivity();
-
- private DelegateExecution execution;
-
- @Before
- public void before() throws Exception {
- execution = new DelegateExecutionFake();
- execution.setVariable("vnfType", "testVnfType");
- execution.setVariable("requestAction", "testRequestAction");
- execution.setVariable("mso-request-id", "testMsoRequestId");
- execution.setVariable("vnfId", "testVnfId");
- execution.setVariable("serviceInstanceId", "testServiceInstanceId");
- String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- }
-
- @Test
- public void buildBuildingBlock_Test(){
- BuildingBlock bb = executeActivity.buildBuildingBlock("testActivityName");
- assertEquals(bb.getBpmnFlowName(), "testActivityName");
- assertEquals(bb.getKey(), "");
- }
-
- @Test
- public void executeBuildingBlock_Test() throws Exception {
- BuildingBlock bb = executeActivity.buildBuildingBlock("testActivityName");
- ExecuteBuildingBlock ebb = executeActivity.buildExecuteBuildingBlock(execution, "testMsoRequestId", bb);
- assertEquals(ebb.getVnfType(), "testVnfType");
- assertEquals(ebb.getRequestAction(), "testRequestAction");
- assertEquals(ebb.getRequestId(), "testMsoRequestId");
- assertEquals(ebb.getWorkflowResourceIds().getVnfId(), "testVnfId");
- assertEquals(ebb.getWorkflowResourceIds().getServiceInstanceId(), "testServiceInstanceId");
- assertEquals(ebb.getBuildingBlock(), bb);
- }
-
+ @InjectMocks
+ protected ExecuteActivity executeActivity = new ExecuteActivity();
+
+ private DelegateExecution execution;
+
+ @Before
+ public void before() throws Exception {
+ execution = new DelegateExecutionFake();
+ execution.setVariable("vnfType", "testVnfType");
+ execution.setVariable("requestAction", "testRequestAction");
+ execution.setVariable("mso-request-id", "testMsoRequestId");
+ execution.setVariable("vnfId", "testVnfId");
+ execution.setVariable("serviceInstanceId", "testServiceInstanceId");
+ String bpmnRequest =
+ new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ }
+
+ @Test
+ public void buildBuildingBlock_Test() {
+ BuildingBlock bb = executeActivity.buildBuildingBlock("testActivityName");
+ assertEquals(bb.getBpmnFlowName(), "testActivityName");
+ assertEquals(bb.getKey(), "");
+ }
+
+ @Test
+ public void executeBuildingBlock_Test() throws Exception {
+ BuildingBlock bb = executeActivity.buildBuildingBlock("testActivityName");
+ ExecuteBuildingBlock ebb = executeActivity.buildExecuteBuildingBlock(execution, "testMsoRequestId", bb);
+ assertEquals(ebb.getVnfType(), "testVnfType");
+ assertEquals(ebb.getRequestAction(), "testRequestAction");
+ assertEquals(ebb.getRequestId(), "testMsoRequestId");
+ assertEquals(ebb.getWorkflowResourceIds().getVnfId(), "testVnfId");
+ assertEquals(ebb.getWorkflowResourceIds().getServiceInstanceId(), "testServiceInstanceId");
+ assertEquals(ebb.getBuildingBlock(), bb);
+ }
+
}
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
index 72f6a08ee7..00dfd4e236 100644
--- 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
@@ -27,10 +27,8 @@ 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.Map;
import java.util.Optional;
-
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentMatchers;
@@ -47,61 +45,69 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.exception.BBObjectNotFoundException;
-public class NetworkAdapterCreateTasksTest extends BaseTaskTest{
- @InjectMocks
- private NetworkAdapterCreateTasks networkAdapterCreateTasks = new NetworkAdapterCreateTasks();
+public class NetworkAdapterCreateTasksTest extends BaseTaskTest {
+ @InjectMocks
+ private NetworkAdapterCreateTasks networkAdapterCreateTasks = new NetworkAdapterCreateTasks();
+
+ private ServiceInstance serviceInstance;
+ private RequestContext requestContext;
+ private CloudRegion cloudRegion;
+ private OrchestrationContext orchestrationContext;
+ private L3Network l3Network;
+ private Map<String, String> userInput;
+ private Customer customer;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ customer = setCustomer();
+ serviceInstance = setServiceInstance();
+ l3Network = setL3Network();
+ userInput = setUserInput();
+ userInput.put("userInputKey1", "userInputValue1");
+ requestContext = setRequestContext();
+ cloudRegion = setCloudRegion();
+ orchestrationContext = setOrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(true);
+
+
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(l3Network);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
- private ServiceInstance serviceInstance;
- private RequestContext requestContext;
- private CloudRegion cloudRegion;
- private OrchestrationContext orchestrationContext;
- private L3Network l3Network;
- private Map<String, String> userInput;
- private Customer customer;
+ }
- @Before
- public void before() throws BBObjectNotFoundException {
- 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 {
+ String cloudRegionPo = "cloudRegionPo";
+ CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest();
+ execution.setVariable("cloudRegionPo", cloudRegionPo);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(l3Network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
-
- }
-
- @Test
- public void createNetworkTest() throws Exception {
- String cloudRegionPo = "cloudRegionPo";
- CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest();
- execution.setVariable("cloudRegionPo", cloudRegionPo);
+ doReturn(createNetworkRequest).when(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));
+ networkAdapterCreateTasks.createNetwork(execution);
+ verify(networkAdapterObjectMapper, times(1)).createNetworkRequestMapper(requestContext, cloudRegion,
+ orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer);
+ assertEquals(createNetworkRequest, execution.getVariable("networkAdapterRequest"));
+ }
- doReturn(createNetworkRequest).when(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));
- networkAdapterCreateTasks.createNetwork(execution);
- verify(networkAdapterObjectMapper, times(1)).createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer);
- assertEquals(createNetworkRequest, execution.getVariable("networkAdapterRequest"));
- }
-
- @Test
- public void rollbackCreateNetworkTest() throws Exception {
- CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse();
- createNetworkResponse.setNetworkStackId("networkStackId");
- createNetworkResponse.setNetworkCreated(true);
- execution.setVariable("createNetworkResponse", createNetworkResponse);
- Optional<CreateNetworkResponse> oCreateNetworkResponse = Optional.of(createNetworkResponse);
+ @Test
+ public void rollbackCreateNetworkTest() throws Exception {
+ CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse();
+ createNetworkResponse.setNetworkStackId("networkStackId");
+ createNetworkResponse.setNetworkCreated(true);
+ execution.setVariable("createNetworkResponse", createNetworkResponse);
+ Optional<CreateNetworkResponse> oCreateNetworkResponse = Optional.of(createNetworkResponse);
- String cloudRegionPo = "cloudRegionPo";
- execution.setVariable("cloudRegionPo", cloudRegionPo);
+ 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);
- }
+ 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
index ceb4796443..eb481651f0 100644
--- 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
@@ -27,9 +27,7 @@ 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 java.io.UnsupportedEncodingException;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
@@ -48,44 +46,48 @@ import org.onap.so.client.adapter.network.NetworkAdapterClientException;
import org.onap.so.client.exception.BBObjectNotFoundException;
-public class NetworkAdapterDeleteTasksTest extends BaseTaskTest{
-
- @InjectMocks
- private NetworkAdapterDeleteTasks networkAdapterDeleteTasks = new NetworkAdapterDeleteTasks();
+public class NetworkAdapterDeleteTasksTest extends BaseTaskTest {
+
+ @InjectMocks
+ private NetworkAdapterDeleteTasks networkAdapterDeleteTasks = new NetworkAdapterDeleteTasks();
- private ServiceInstance serviceInstance;
- private L3Network l3Network;
- private RequestContext requestContext;
- private CloudRegion cloudRegion;
+ private ServiceInstance serviceInstance;
+ private L3Network l3Network;
+ private RequestContext requestContext;
+ private CloudRegion cloudRegion;
- @Before
- public void before() throws BBObjectNotFoundException {
- serviceInstance = setServiceInstance();
- l3Network = setL3Network();
- requestContext = setRequestContext();
- cloudRegion = setCloudRegion();
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ serviceInstance = setServiceInstance();
+ l3Network = setL3Network();
+ requestContext = setRequestContext();
+ cloudRegion = setCloudRegion();
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(l3Network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- }
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(l3Network);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ }
- @Test
- public void test_deleteNetwork() throws UnsupportedEncodingException, NetworkAdapterClientException {
- DeleteNetworkRequest deleteNetworkRequest = new DeleteNetworkRequest();
- doReturn(deleteNetworkRequest).when(networkAdapterObjectMapper).deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network);
+ @Test
+ public void test_deleteNetwork() throws UnsupportedEncodingException, NetworkAdapterClientException {
+ DeleteNetworkRequest deleteNetworkRequest = new DeleteNetworkRequest();
+ doReturn(deleteNetworkRequest).when(networkAdapterObjectMapper).deleteNetworkRequestMapper(requestContext,
+ cloudRegion, serviceInstance, l3Network);
- networkAdapterDeleteTasks.deleteNetwork(execution);
- verify(networkAdapterObjectMapper, times(1)).deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network);
- }
+ networkAdapterDeleteTasks.deleteNetwork(execution);
+ verify(networkAdapterObjectMapper, times(1)).deleteNetworkRequestMapper(requestContext, cloudRegion,
+ serviceInstance, l3Network);
+ }
- @Test
- public void test_deleteNetwork_exception() throws UnsupportedEncodingException, NetworkAdapterClientException {
- expectedException.expect(BpmnError.class);
+ @Test
+ public void test_deleteNetwork_exception() throws UnsupportedEncodingException, NetworkAdapterClientException {
+ expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(networkAdapterObjectMapper).
- deleteNetworkRequestMapper(any(RequestContext.class), any(CloudRegion.class), any(ServiceInstance.class), eq(l3Network));
- networkAdapterDeleteTasks.deleteNetwork(execution);
- }
+ doThrow(RuntimeException.class).when(networkAdapterObjectMapper).deleteNetworkRequestMapper(
+ any(RequestContext.class), any(CloudRegion.class), any(ServiceInstance.class), eq(l3Network));
+ networkAdapterDeleteTasks.deleteNetwork(execution);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
index c11dc822b4..d0cee42178 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
@@ -23,15 +23,12 @@ package org.onap.so.bpmn.infrastructure.adapter.network.tasks;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-
import javax.xml.bind.JAXBException;
-
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.Test;
-
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
@@ -42,7 +39,6 @@ import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.exception.MapperException;
-
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
@@ -55,69 +51,74 @@ import static org.mockito.Mockito.verify;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
public class NetworkAdapterRestV1Test extends BaseTaskTest {
-
- @InjectMocks
- NetworkAdapterRestV1 networkAdapterRestV1Tasks = new NetworkAdapterRestV1();
- @Mock
- ExceptionBuilder exceptionBuilder = new ExceptionBuilder();
- @Before
- public void setup(){
- delegateExecution = new DelegateExecutionFake();
- }
-
- @Test
- public void testUnmarshalXml() throws IOException, JAXBException {
- String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><createNetworkResponse><messageId>ec37c121-e3ec-4697-8adf-2d7dca7044fc</messageId><networkCreated>true</networkCreated><networkFqdn>someNetworkFqdn</networkFqdn><networkId>991ec7bf-c9c4-4ac1-bb9c-4b61645bddb3</networkId><networkStackId>someStackId</networkStackId><neutronNetworkId>9c47521a-2916-4018-b2bc-71ab767497e3</neutronNetworkId><rollback><cloudId>someCloudId</cloudId><modelCustomizationUuid>b7171cdd-8b05-459b-80ef-2093150e8983</modelCustomizationUuid><msoRequest><requestId>90b32315-176e-4dab-bcf1-80eb97a1c4f4</requestId><serviceInstanceId>71e7db22-7907-4d78-8fcc-8d89d28e90be</serviceInstanceId></msoRequest><networkCreated>true</networkCreated><networkStackId>someStackId</networkStackId><networkType>SomeNetworkType</networkType><neutronNetworkId>9c47521a-2916-4018-b2bc-71ab767497e3</neutronNetworkId><tenantId>b60da4f71c1d4b35b8113d4eca6deaa1</tenantId></rollback><subnetMap><entry><key>6b381fa9-48ce-4e16-9978-d75309565bb6</key><value>bc1d5537-860b-4894-8eba-6faff41e648c</value></entry></subnetMap></createNetworkResponse>";
- CreateNetworkResponse response = (CreateNetworkResponse) new NetworkAdapterRestV1().unmarshalXml(xml, CreateNetworkResponse.class);
- String returnedXml = response.toXmlString();
- System.out.println(returnedXml);
- }
-
- @Test
- public void testUnmarshalXmlUpdate() throws IOException, JAXBException {
- UpdateNetworkResponse expectedResponse = new UpdateNetworkResponse();
- expectedResponse.setMessageId("ec100bcc-2659-4aa4-b4d8-3255715c2a51");
- expectedResponse.setNetworkId("80de31e3-cc78-4111-a9d3-5b92bf0a39eb");
- Map<String,String>subnetMap = new HashMap<String,String>();
- subnetMap.put("95cd8437-25f1-4238-8720-cbfe7fa81476", "d8d16606-5d01-4822-b160-9a0d257303e0");
- expectedResponse.setSubnetMap(subnetMap);
- String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><updateNetworkResponse><messageId>ec100bcc-2659-4aa4-b4d8-3255715c2a51</messageId><networkId>80de31e3-cc78-4111-a9d3-5b92bf0a39eb</networkId><subnetMap><entry><key>95cd8437-25f1-4238-8720-cbfe7fa81476</key><value>d8d16606-5d01-4822-b160-9a0d257303e0</value></entry></subnetMap></updateNetworkResponse>";
- UpdateNetworkResponse response = (UpdateNetworkResponse) new NetworkAdapterRestV1().unmarshalXml(xml, UpdateNetworkResponse.class);
- assertThat(expectedResponse, sameBeanAs(response));
- }
-
- @Test
- public void processCallbackTest() throws MapperException, BadResponseException, IOException{
- UpdateNetworkRequest updateNetworkRequest = new UpdateNetworkRequest();
- UpdateNetworkResponse updateNetworkResponse = new UpdateNetworkResponse();
- updateNetworkResponse.setMessageId("messageId");
- updateNetworkResponse.setNetworkId("networkId");
- delegateExecution.setVariable("networkAdapterRequest", updateNetworkRequest);
- delegateExecution.setVariable("NetworkAResponse_MESSAGE", updateNetworkResponse.toXmlString());
-
- networkAdapterRestV1Tasks.processCallback(delegateExecution);
-
- assertThat(updateNetworkResponse,sameBeanAs(delegateExecution.getVariable("updateNetworkResponse")));
- }
-
- @Test
- public void processCallbackErrorTest() throws MapperException, BadResponseException, IOException{
- UpdateNetworkRequest updateNetworkRequest = new UpdateNetworkRequest();
- UpdateNetworkError updateNetworkResponse = new UpdateNetworkError();
- updateNetworkResponse.setMessageId("messageId");
- updateNetworkResponse.setMessage("test error message");
- delegateExecution.setVariable("networkAdapterRequest", updateNetworkRequest);
- delegateExecution.setVariable("NetworkAResponse_MESSAGE", updateNetworkResponse.toXmlString());
-
- doThrow(new BpmnError("MSOWorkflowException")).when(exceptionBuilder).buildAndThrowWorkflowException(any(DelegateExecution.class), anyInt(), any(String.class));
- try {
- networkAdapterRestV1Tasks.processCallback(delegateExecution);
- }
- catch (BpmnError be){
- assertEquals("MSOWorkflowException",be.getErrorCode());
- }
- assertNull(delegateExecution.getVariable("updateNetworkResponse"));
- verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(any(DelegateExecution.class), eq(7000), eq("test error message"));
- }
+ @InjectMocks
+ NetworkAdapterRestV1 networkAdapterRestV1Tasks = new NetworkAdapterRestV1();
+ @Mock
+ ExceptionBuilder exceptionBuilder = new ExceptionBuilder();
+
+ @Before
+ public void setup() {
+ delegateExecution = new DelegateExecutionFake();
+ }
+
+ @Test
+ public void testUnmarshalXml() throws IOException, JAXBException {
+ String xml =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><createNetworkResponse><messageId>ec37c121-e3ec-4697-8adf-2d7dca7044fc</messageId><networkCreated>true</networkCreated><networkFqdn>someNetworkFqdn</networkFqdn><networkId>991ec7bf-c9c4-4ac1-bb9c-4b61645bddb3</networkId><networkStackId>someStackId</networkStackId><neutronNetworkId>9c47521a-2916-4018-b2bc-71ab767497e3</neutronNetworkId><rollback><cloudId>someCloudId</cloudId><modelCustomizationUuid>b7171cdd-8b05-459b-80ef-2093150e8983</modelCustomizationUuid><msoRequest><requestId>90b32315-176e-4dab-bcf1-80eb97a1c4f4</requestId><serviceInstanceId>71e7db22-7907-4d78-8fcc-8d89d28e90be</serviceInstanceId></msoRequest><networkCreated>true</networkCreated><networkStackId>someStackId</networkStackId><networkType>SomeNetworkType</networkType><neutronNetworkId>9c47521a-2916-4018-b2bc-71ab767497e3</neutronNetworkId><tenantId>b60da4f71c1d4b35b8113d4eca6deaa1</tenantId></rollback><subnetMap><entry><key>6b381fa9-48ce-4e16-9978-d75309565bb6</key><value>bc1d5537-860b-4894-8eba-6faff41e648c</value></entry></subnetMap></createNetworkResponse>";
+ CreateNetworkResponse response =
+ (CreateNetworkResponse) new NetworkAdapterRestV1().unmarshalXml(xml, CreateNetworkResponse.class);
+ String returnedXml = response.toXmlString();
+ System.out.println(returnedXml);
+ }
+
+ @Test
+ public void testUnmarshalXmlUpdate() throws IOException, JAXBException {
+ UpdateNetworkResponse expectedResponse = new UpdateNetworkResponse();
+ expectedResponse.setMessageId("ec100bcc-2659-4aa4-b4d8-3255715c2a51");
+ expectedResponse.setNetworkId("80de31e3-cc78-4111-a9d3-5b92bf0a39eb");
+ Map<String, String> subnetMap = new HashMap<String, String>();
+ subnetMap.put("95cd8437-25f1-4238-8720-cbfe7fa81476", "d8d16606-5d01-4822-b160-9a0d257303e0");
+ expectedResponse.setSubnetMap(subnetMap);
+ String xml =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><updateNetworkResponse><messageId>ec100bcc-2659-4aa4-b4d8-3255715c2a51</messageId><networkId>80de31e3-cc78-4111-a9d3-5b92bf0a39eb</networkId><subnetMap><entry><key>95cd8437-25f1-4238-8720-cbfe7fa81476</key><value>d8d16606-5d01-4822-b160-9a0d257303e0</value></entry></subnetMap></updateNetworkResponse>";
+ UpdateNetworkResponse response =
+ (UpdateNetworkResponse) new NetworkAdapterRestV1().unmarshalXml(xml, UpdateNetworkResponse.class);
+ assertThat(expectedResponse, sameBeanAs(response));
+ }
+
+ @Test
+ public void processCallbackTest() throws MapperException, BadResponseException, IOException {
+ UpdateNetworkRequest updateNetworkRequest = new UpdateNetworkRequest();
+ UpdateNetworkResponse updateNetworkResponse = new UpdateNetworkResponse();
+ updateNetworkResponse.setMessageId("messageId");
+ updateNetworkResponse.setNetworkId("networkId");
+ delegateExecution.setVariable("networkAdapterRequest", updateNetworkRequest);
+ delegateExecution.setVariable("NetworkAResponse_MESSAGE", updateNetworkResponse.toXmlString());
+
+ networkAdapterRestV1Tasks.processCallback(delegateExecution);
+
+ assertThat(updateNetworkResponse, sameBeanAs(delegateExecution.getVariable("updateNetworkResponse")));
+ }
+
+ @Test
+ public void processCallbackErrorTest() throws MapperException, BadResponseException, IOException {
+ UpdateNetworkRequest updateNetworkRequest = new UpdateNetworkRequest();
+ UpdateNetworkError updateNetworkResponse = new UpdateNetworkError();
+ updateNetworkResponse.setMessageId("messageId");
+ updateNetworkResponse.setMessage("test error message");
+ delegateExecution.setVariable("networkAdapterRequest", updateNetworkRequest);
+ delegateExecution.setVariable("NetworkAResponse_MESSAGE", updateNetworkResponse.toXmlString());
+
+ doThrow(new BpmnError("MSOWorkflowException")).when(exceptionBuilder)
+ .buildAndThrowWorkflowException(any(DelegateExecution.class), anyInt(), any(String.class));
+ try {
+ networkAdapterRestV1Tasks.processCallback(delegateExecution);
+ } catch (BpmnError be) {
+ assertEquals("MSOWorkflowException", be.getErrorCode());
+ }
+ assertNull(delegateExecution.getVariable("updateNetworkResponse"));
+ verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(any(DelegateExecution.class), eq(7000),
+ eq("test error message"));
+ }
}
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
index 0406ce09a3..af97c3d038 100644
--- 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
@@ -30,11 +30,9 @@ 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 java.io.UnsupportedEncodingException;
import java.util.Map;
import java.util.Optional;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
@@ -56,45 +54,49 @@ import org.onap.so.client.adapter.network.NetworkAdapterClientException;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
-public class NetworkAdapterUpdateTasksTest extends BaseTaskTest{
- @InjectMocks
- private NetworkAdapterUpdateTasks networkAdapterUpdateTasks = new NetworkAdapterUpdateTasks();
-
- private ServiceInstance serviceInstance;
- private L3Network network;
- private RequestContext requestContext;
- private CloudRegion cloudRegion;
- private OrchestrationContext orchestrationContext;
- private Map<String, String> userInput;
- private Customer customer;
-
- @Before
- public void before() throws BBObjectNotFoundException {
- customer = setCustomer();
- serviceInstance = setServiceInstance();
- network = setL3Network();
- requestContext = setRequestContext();
- cloudRegion = setCloudRegion();
- orchestrationContext = setOrchestrationContext();
- userInput = setUserInput();
- userInput.put("userInputKey1", "userInputValue1");
-
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
-
- }
-
- @Test
- public void updateNetworkTest() throws Exception {
- String cloudRegionPo = "cloudRegionPo";
- UpdateNetworkRequest updateNetworkRequest = new UpdateNetworkRequest();
- execution.setVariable("cloudRegionPo", cloudRegionPo);
+public class NetworkAdapterUpdateTasksTest extends BaseTaskTest {
+ @InjectMocks
+ private NetworkAdapterUpdateTasks networkAdapterUpdateTasks = new NetworkAdapterUpdateTasks();
+
+ private ServiceInstance serviceInstance;
+ private L3Network network;
+ private RequestContext requestContext;
+ private CloudRegion cloudRegion;
+ private OrchestrationContext orchestrationContext;
+ private Map<String, String> userInput;
+ private Customer customer;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ customer = setCustomer();
+ serviceInstance = setServiceInstance();
+ network = setL3Network();
+ requestContext = setRequestContext();
+ cloudRegion = setCloudRegion();
+ orchestrationContext = setOrchestrationContext();
+ userInput = setUserInput();
+ userInput.put("userInputKey1", "userInputValue1");
+
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+
+ }
+
+ @Test
+ public void updateNetworkTest() throws Exception {
+ String cloudRegionPo = "cloudRegionPo";
+ UpdateNetworkRequest updateNetworkRequest = new UpdateNetworkRequest();
+ execution.setVariable("cloudRegionPo", cloudRegionPo);
+
+ doReturn(updateNetworkRequest).when(networkAdapterObjectMapper).createNetworkUpdateRequestMapper(
+ isA(RequestContext.class), isA(CloudRegion.class), isA(OrchestrationContext.class),
+ isA(ServiceInstance.class), isA(L3Network.class), isA(Map.class), isA(Customer.class));
+ networkAdapterUpdateTasks.updateNetwork(execution);
+ verify(networkAdapterObjectMapper, times(1)).createNetworkUpdateRequestMapper(requestContext, cloudRegion,
+ orchestrationContext, serviceInstance, network, userInput, customer);
+ assertEquals(updateNetworkRequest, execution.getVariable("networkAdapterRequest"));
+ }
- doReturn(updateNetworkRequest).when(networkAdapterObjectMapper).createNetworkUpdateRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(OrchestrationContext.class), isA(ServiceInstance.class), isA(L3Network.class), isA(Map.class), isA(Customer.class));
- networkAdapterUpdateTasks.updateNetwork(execution);
- verify(networkAdapterObjectMapper, times(1)).createNetworkUpdateRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer);
- assertEquals(updateNetworkRequest, execution.getVariable("networkAdapterRequest"));
- }
-
}
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
index 32b3201d11..13f2b81fd9 100644
--- 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
@@ -28,7 +28,6 @@ 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.Test;
import org.mockito.ArgumentMatchers;
@@ -47,178 +46,197 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
-public class VnfAdapterCreateTasksTest extends BaseTaskTest{
- @InjectMocks
- private VnfAdapterCreateTasks vnfAdapterCreateTasks = new 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";
+public class VnfAdapterCreateTasksTest extends BaseTaskTest {
+ @InjectMocks
+ private VnfAdapterCreateTasks vnfAdapterCreateTasks = new 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");
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
- doReturn(request).when(vnfAdapterVolumeGroupResources).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVnfQueryResponse);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID)))
+ .thenReturn(volumeGroup);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ 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);
-
- VfModule vfModule = setVfModule();
- vfModule.setSelflink("vfModuleSelfLink");
-
- CloudRegion cloudRegion = setCloudRegion();
-
- OrchestrationContext orchestrationContext = setOrchestrationContext();
- orchestrationContext.setIsRollbackEnabled(true);
+
+ 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);
+
+ VfModule vfModule = setVfModule();
+ vfModule.setSelflink("vfModuleSelfLink");
+
+ CloudRegion cloudRegion = setCloudRegion();
+
+ OrchestrationContext orchestrationContext = setOrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(true);
CreateVolumeGroupRequest request = new CreateVolumeGroupRequest();
request.setVolumeGroupId("volumeGroupStackId");
-
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
- doReturn(request).when(vnfAdapterVolumeGroupResources).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, null);
-
- vnfAdapterCreateTasks.createVolumeGroupRequest(execution);
-
- verify(vnfAdapterVolumeGroupResources, times(1)).createVolumeGroupRequest(any(RequestContext.class),
- any(CloudRegion.class), any(OrchestrationContext.class), eq(serviceInstance), eq(genericVnf), eq(volumeGroup), ArgumentMatchers.isNull());
-
- assertEquals(request.toXmlString(), execution.getVariable("VNFREST_Request"));
- }
-
- @Test
- public void test_createVolumeGroupRequest_exception() throws Exception {
- doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID));
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- 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);
-
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
-
- doReturn(createVfModuleRequest).when(vnfAdapterVfModuleResources).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance,
- genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
-
- vnfAdapterCreateTasks.createVfModule(execution);
-
- verify(vnfAdapterVfModuleResources, times(1)).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance,
- genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
-
- assertEquals(execution.getVariable("VNFREST_Request"), createVfModuleRequest.toXmlString());
- }
-
- @Test
- public void test_createVfModuleWithVolumeGroup() throws Exception {
- RequestContext requestContext = setRequestContext();
-
- ServiceInstance serviceInstance = setServiceInstance();
-
- GenericVnf genericVnf = setGenericVnf();
-
- VfModule vfModule = setVfModule();
-
- VolumeGroup volumeGroup = setVolumeGroup();
-
- 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);
-
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
- doReturn(createVfModuleRequest).when(vnfAdapterVfModuleResources).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance,
- genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
-
- vnfAdapterCreateTasks.createVfModule(execution);
-
- verify(vnfAdapterVfModuleResources, times(1)).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance,
- genericVnf, vfModule, volumeGroup, 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
- doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID));
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- expectedException.expect(BpmnError.class);
- vnfAdapterCreateTasks.createVolumeGroupRequest(execution);
- }
+
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID)))
+ .thenReturn(volumeGroup);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ doReturn(request).when(vnfAdapterVolumeGroupResources).createVolumeGroupRequest(requestContext, cloudRegion,
+ orchestrationContext, serviceInstance, genericVnf, volumeGroup, null);
+
+ vnfAdapterCreateTasks.createVolumeGroupRequest(execution);
+
+ verify(vnfAdapterVolumeGroupResources, times(1)).createVolumeGroupRequest(any(RequestContext.class),
+ any(CloudRegion.class), any(OrchestrationContext.class), eq(serviceInstance), eq(genericVnf),
+ eq(volumeGroup), ArgumentMatchers.isNull());
+
+ assertEquals(request.toXmlString(), execution.getVariable("VNFREST_Request"));
+ }
+
+ @Test
+ public void test_createVolumeGroupRequest_exception() throws Exception {
+ doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),
+ ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID));
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ 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);
+
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
+ doReturn(createVfModuleRequest).when(vnfAdapterVfModuleResources).createVfModuleRequest(requestContext,
+ cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, null, sdncVnfQueryResponse,
+ sdncVfModuleQueryResponse);
+
+ vnfAdapterCreateTasks.createVfModule(execution);
+
+ verify(vnfAdapterVfModuleResources, times(1)).createVfModuleRequest(requestContext, cloudRegion,
+ orchestrationContext, serviceInstance, genericVnf, vfModule, null, sdncVnfQueryResponse,
+ sdncVfModuleQueryResponse);
+
+ assertEquals(execution.getVariable("VNFREST_Request"), createVfModuleRequest.toXmlString());
+ }
+
+ @Test
+ public void test_createVfModuleWithVolumeGroup() throws Exception {
+ RequestContext requestContext = setRequestContext();
+
+ ServiceInstance serviceInstance = setServiceInstance();
+
+ GenericVnf genericVnf = setGenericVnf();
+
+ VfModule vfModule = setVfModule();
+
+ VolumeGroup volumeGroup = setVolumeGroup();
+
+ 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);
+
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID)))
+ .thenReturn(volumeGroup);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ doReturn(createVfModuleRequest).when(vnfAdapterVfModuleResources).createVfModuleRequest(requestContext,
+ cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup,
+ sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+ vnfAdapterCreateTasks.createVfModule(execution);
+
+ verify(vnfAdapterVfModuleResources, times(1)).createVfModuleRequest(requestContext, cloudRegion,
+ orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup, 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
+ doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),
+ ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID));
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ 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
index efd2e7d849..c680978953 100644
--- 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
@@ -28,7 +28,6 @@ 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;
@@ -47,84 +46,97 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
-public class VnfAdapterDeleteTasksTest extends BaseTaskTest{
- @InjectMocks
- private VnfAdapterDeleteTasks vnfAdapterDeleteTasks = new 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);
-
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- }
-
- @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(ArgumentMatchers.eq(requestContext), ArgumentMatchers.eq(cloudRegion), ArgumentMatchers.eq(serviceInstance), ArgumentMatchers.eq(genericVnf),ArgumentMatchers.eq(vfModule));
- assertEquals(execution.getVariable("VNFREST_Request"), deleteVfModuleRequest.toXmlString());
- }
-
- @Test
- public void deleteVfModuleExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
-
- doThrow(RuntimeException.class).when(vnfAdapterVfModuleResources).deleteVfModuleRequest(requestContext, cloudRegion, serviceInstance, genericVnf, vfModule);
-
- vnfAdapterDeleteTasks.deleteVfModule(execution);
- }
-
- @Test
- public void test_deleteVolumeGroup() throws Exception {
- DeleteVolumeGroupRequest deleteVolumeGroupRequest = new DeleteVolumeGroupRequest();
- deleteVolumeGroupRequest.setVolumeGroupId("volumeGroupId");
-
- doReturn(deleteVolumeGroupRequest).when(vnfAdapterVolumeGroupResources).deleteVolumeGroupRequest(requestContext, cloudRegion, serviceInstance, volumeGroup);
-
- vnfAdapterDeleteTasks.deleteVolumeGroup(execution);
-
- verify(vnfAdapterVolumeGroupResources, times(1)).deleteVolumeGroupRequest(ArgumentMatchers.eq(requestContext), ArgumentMatchers.eq(cloudRegion), ArgumentMatchers.eq(serviceInstance), ArgumentMatchers.eq(volumeGroup));
- assertEquals(execution.getVariable("VNFREST_Request"), deleteVolumeGroupRequest.toXmlString());
- }
-
- @Test
- public void deleteVolumeGroupExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
-
- doThrow(RuntimeException.class).when(vnfAdapterVolumeGroupResources).deleteVolumeGroupRequest(requestContext, cloudRegion, serviceInstance, volumeGroup);
-
- vnfAdapterDeleteTasks.deleteVolumeGroup(execution);
- }
+public class VnfAdapterDeleteTasksTest extends BaseTaskTest {
+ @InjectMocks
+ private VnfAdapterDeleteTasks vnfAdapterDeleteTasks = new 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);
+
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID)))
+ .thenReturn(volumeGroup);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ }
+
+ @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(ArgumentMatchers.eq(requestContext),
+ ArgumentMatchers.eq(cloudRegion), ArgumentMatchers.eq(serviceInstance), ArgumentMatchers.eq(genericVnf),
+ ArgumentMatchers.eq(vfModule));
+ assertEquals(execution.getVariable("VNFREST_Request"), deleteVfModuleRequest.toXmlString());
+ }
+
+ @Test
+ public void deleteVfModuleExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(RuntimeException.class).when(vnfAdapterVfModuleResources).deleteVfModuleRequest(requestContext,
+ cloudRegion, serviceInstance, genericVnf, vfModule);
+
+ vnfAdapterDeleteTasks.deleteVfModule(execution);
+ }
+
+ @Test
+ public void test_deleteVolumeGroup() throws Exception {
+ DeleteVolumeGroupRequest deleteVolumeGroupRequest = new DeleteVolumeGroupRequest();
+ deleteVolumeGroupRequest.setVolumeGroupId("volumeGroupId");
+
+ doReturn(deleteVolumeGroupRequest).when(vnfAdapterVolumeGroupResources).deleteVolumeGroupRequest(requestContext,
+ cloudRegion, serviceInstance, volumeGroup);
+
+ vnfAdapterDeleteTasks.deleteVolumeGroup(execution);
+
+ verify(vnfAdapterVolumeGroupResources, times(1)).deleteVolumeGroupRequest(ArgumentMatchers.eq(requestContext),
+ ArgumentMatchers.eq(cloudRegion), ArgumentMatchers.eq(serviceInstance),
+ ArgumentMatchers.eq(volumeGroup));
+ assertEquals(execution.getVariable("VNFREST_Request"), deleteVolumeGroupRequest.toXmlString());
+ }
+
+ @Test
+ public void deleteVolumeGroupExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(RuntimeException.class).when(vnfAdapterVolumeGroupResources).deleteVolumeGroupRequest(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
index b515835f19..97a9388f8d 100644
--- 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
@@ -27,7 +27,6 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.when;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
@@ -46,173 +45,188 @@ import org.onap.so.client.exception.BBObjectNotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
public class VnfAdapterImplTest extends BaseTaskTest {
-
- @InjectMocks
- private VnfAdapterImpl vnfAdapterImpl = new VnfAdapterImpl();
-
- private RequestContext requestContext;
- private ServiceInstance serviceInstance;
- private GenericVnf genericVnf;
- private VfModule vfModule;
+
+ @InjectMocks
+ private VnfAdapterImpl vnfAdapterImpl = new VnfAdapterImpl();
+
+ private RequestContext requestContext;
+ private ServiceInstance serviceInstance;
+ private GenericVnf genericVnf;
+ 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 VNF_ADAPTER_VOLUME_DELETE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/DeleteVfModuleVolumeCallbackResponse.xml");
- private static final String TEST_VFMODULE_HEATSTACK_ID = "slowburn";
+
+ 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 VNF_ADAPTER_VOLUME_DELETE_RESPONSE =
+ FileUtil.readResourceFile("__files/VfModularity/DeleteVfModuleVolumeCallbackResponse.xml");
+ private static final String TEST_VFMODULE_HEATSTACK_ID = "slowburn";
private static final String TEST_VOLUME_HEATSTACK_ID = "testHeatStackId1";
private static final String TEST_CONTRAIL_SERVICE_INSTANCE_FQDN = "default-domain:MSOTest:MsoNW-RA";
private static final String TEST_OAM_MANAGEMENT_V4_ADDRESS = "127.0.0.1";
private static final String TEST_OAM_MANAGEMENT_V6_ADDRESS = "2000:abc:bce:1111";
- private static final String TEST_CONTRAIL_NETWORK_POLICY_FQDNS = "MSOTest:DefaultPolicyFQDN2,MSOTest:DefaultPolicyFQDN1";
-
- @Before
- public void before() throws BBObjectNotFoundException {
- requestContext = setRequestContext();
- serviceInstance = setServiceInstance();
- genericVnf = setGenericVnf();
- vfModule = setVfModule();
+ private static final String TEST_CONTRAIL_NETWORK_POLICY_FQDNS =
+ "MSOTest:DefaultPolicyFQDN2,MSOTest:DefaultPolicyFQDN1";
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ requestContext = setRequestContext();
+ serviceInstance = setServiceInstance();
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
volumeGroup = setVolumeGroup();
- vfModule.setHeatStackId(null);
- volumeGroup.setHeatStackId(null);
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
- }
-
- @Test
- public void preProcessVnfAdapterTest() {
- vnfAdapterImpl.preProcessVnfAdapter(execution);
-
- 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());
- assertEquals(TEST_CONTRAIL_SERVICE_INSTANCE_FQDN, vfModule.getContrailServiceInstanceFqdn());
- assertEquals(TEST_CONTRAIL_SERVICE_INSTANCE_FQDN, execution.getVariable("contrailServiceInstanceFqdn"));
- assertEquals(TEST_OAM_MANAGEMENT_V4_ADDRESS, genericVnf.getIpv4OamAddress());
- assertEquals(TEST_OAM_MANAGEMENT_V4_ADDRESS, execution.getVariable("oamManagementV4Address"));
- assertEquals(TEST_OAM_MANAGEMENT_V6_ADDRESS, genericVnf.getManagementV6Address());
- assertEquals(TEST_OAM_MANAGEMENT_V6_ADDRESS, execution.getVariable("oamManagementV6Address"));
- assertEquals(TEST_CONTRAIL_NETWORK_POLICY_FQDNS, execution.getVariable("contrailNetworkPolicyFqdnList"));
- }
-
-
- @Test
- public void postProcessVnfAdapter_CreateResponseTest_EmptyCreateVfModuleResponseTag() {
+ vfModule.setHeatStackId(null);
+ volumeGroup.setHeatStackId(null);
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID)))
+ .thenReturn(volumeGroup);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ }
+
+ @Test
+ public void preProcessVnfAdapterTest() {
+ vnfAdapterImpl.preProcessVnfAdapter(execution);
+
+ 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());
+ assertEquals(TEST_CONTRAIL_SERVICE_INSTANCE_FQDN, vfModule.getContrailServiceInstanceFqdn());
+ assertEquals(TEST_CONTRAIL_SERVICE_INSTANCE_FQDN, execution.getVariable("contrailServiceInstanceFqdn"));
+ assertEquals(TEST_OAM_MANAGEMENT_V4_ADDRESS, genericVnf.getIpv4OamAddress());
+ assertEquals(TEST_OAM_MANAGEMENT_V4_ADDRESS, execution.getVariable("oamManagementV4Address"));
+ assertEquals(TEST_OAM_MANAGEMENT_V6_ADDRESS, genericVnf.getManagementV6Address());
+ assertEquals(TEST_OAM_MANAGEMENT_V6_ADDRESS, execution.getVariable("oamManagementV6Address"));
+ assertEquals(TEST_CONTRAIL_NETWORK_POLICY_FQDNS, execution.getVariable("contrailNetworkPolicyFqdnList"));
+ }
+
+
+ @Test
+ public void postProcessVnfAdapter_CreateResponseTest_EmptyCreateVfModuleResponseTag() {
expectedException.expect(BpmnError.class);
- execution.setVariable("vnfAdapterRestV1Response", "<vfModuleStackId></vfModuleStackId>");
- vnfAdapterImpl.postProcessVnfAdapter(execution);
- }
-
- @Test
- public void postProcessVnfAdapter_CreateResponseTest_EmptyVfModuleStackIdTag() {
- execution.setVariable("vnfAdapterRestV1Response", "<createVfModuleResponse></createVfModuleResponse>");
- vnfAdapterImpl.postProcessVnfAdapter(execution);
- assertNull(vfModule.getHeatStackId());
- }
-
- @Test
- public void postProcessVnfAdapter_CreateResponseTest_EmptyHeatStackId() {
- execution.setVariable("vnfAdapterRestV1Response", "<createVfModuleResponse><vfModuleStackId></vfModuleStackId></createVfModuleResponse>");
- vnfAdapterImpl.postProcessVnfAdapter(execution);
- assertNull(vfModule.getHeatStackId());
- }
-
- @Test
- public void postProcessVnfAdapter_CreateResponseTest_EmptyVfModuleOutputs() {
- execution.setVariable("vnfAdapterRestV1Response", "<createVfModuleResponse><vfModuleOutputs></vfModuleOutputs></createVfModuleResponse>");
- vnfAdapterImpl.postProcessVnfAdapter(execution);
- assertNull(vfModule.getHeatStackId());
- assertNull(vfModule.getContrailServiceInstanceFqdn());
- assertNull(execution.getVariable("contrailServiceInstanceFqdn"));
- assertNotEquals(TEST_OAM_MANAGEMENT_V4_ADDRESS, genericVnf.getIpv4OamAddress());
- assertNull(execution.getVariable("oamManagementV4Address"));
- assertNull(genericVnf.getManagementV6Address());
- assertNull(execution.getVariable("oamManagementV6Address"));
- assertNull(execution.getVariable("contrailNetworkPolicyFqdnList"));
- }
-
- @Test
- public void postProcessVnfAdapter_DeleteResponseTest() {
- vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_DELETE_RESPONSE);
- vnfAdapterImpl.postProcessVnfAdapter(execution);
- assertNull(vfModule.getHeatStackId());
- assertEquals(vfModule.getContrailServiceInstanceFqdn(), "");
- assertEquals(execution.getVariable("contrailServiceInstanceFqdn"), "");
- assertEquals(genericVnf.getIpv4OamAddress(), "");
- assertEquals(execution.getVariable("oamManagementV4Address"), "");
- assertEquals(genericVnf.getManagementV6Address(), "");
- assertEquals(execution.getVariable("oamManagementV6Address"), "");
- assertEquals(TEST_CONTRAIL_NETWORK_POLICY_FQDNS, execution.getVariable("contrailNetworkPolicyFqdnList"));
- }
-
- @Test
- public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleOutputs() {
- execution.setVariable("vnfAdapterRestV1Response", "<createVfModuleResponse><vfModuleOutputs></vfModuleOutputs></createVfModuleResponse>");
- vnfAdapterImpl.postProcessVnfAdapter(execution);
- assertNull(vfModule.getHeatStackId());
- assertNull(vfModule.getContrailServiceInstanceFqdn());
- assertNull(execution.getVariable("contrailServiceInstanceFqdn"));
- assertNull(execution.getVariable("oamManagementV4Address"));
- assertNull(execution.getVariable("oamManagementV6Address"));
- assertNull(execution.getVariable("contrailNetworkPolicyFqdnList"));
- }
-
- @Test
- public void postProcessVnfAdapter_ResponseNullTest() {
- execution.setVariable("vnfAdapterRestV1Response", null);
- vnfAdapterImpl.postProcessVnfAdapter(execution);
- assertNull(vfModule.getHeatStackId());
- }
-
- @Test
- public void postProcessVnfAdapter_ResponseEmptyTest() {
+ execution.setVariable("vnfAdapterRestV1Response", "<vfModuleStackId></vfModuleStackId>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ }
+
+ @Test
+ public void postProcessVnfAdapter_CreateResponseTest_EmptyVfModuleStackIdTag() {
+ execution.setVariable("vnfAdapterRestV1Response", "<createVfModuleResponse></createVfModuleResponse>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertNull(vfModule.getHeatStackId());
+ }
+
+ @Test
+ public void postProcessVnfAdapter_CreateResponseTest_EmptyHeatStackId() {
+ execution.setVariable("vnfAdapterRestV1Response",
+ "<createVfModuleResponse><vfModuleStackId></vfModuleStackId></createVfModuleResponse>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertNull(vfModule.getHeatStackId());
+ }
+
+ @Test
+ public void postProcessVnfAdapter_CreateResponseTest_EmptyVfModuleOutputs() {
+ execution.setVariable("vnfAdapterRestV1Response",
+ "<createVfModuleResponse><vfModuleOutputs></vfModuleOutputs></createVfModuleResponse>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertNull(vfModule.getHeatStackId());
+ assertNull(vfModule.getContrailServiceInstanceFqdn());
+ assertNull(execution.getVariable("contrailServiceInstanceFqdn"));
+ assertNotEquals(TEST_OAM_MANAGEMENT_V4_ADDRESS, genericVnf.getIpv4OamAddress());
+ assertNull(execution.getVariable("oamManagementV4Address"));
+ assertNull(genericVnf.getManagementV6Address());
+ assertNull(execution.getVariable("oamManagementV6Address"));
+ assertNull(execution.getVariable("contrailNetworkPolicyFqdnList"));
+ }
+
+ @Test
+ public void postProcessVnfAdapter_DeleteResponseTest() {
+ vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID);
+ execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_DELETE_RESPONSE);
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertNull(vfModule.getHeatStackId());
+ assertEquals(vfModule.getContrailServiceInstanceFqdn(), "");
+ assertEquals(execution.getVariable("contrailServiceInstanceFqdn"), "");
+ assertEquals(genericVnf.getIpv4OamAddress(), "");
+ assertEquals(execution.getVariable("oamManagementV4Address"), "");
+ assertEquals(genericVnf.getManagementV6Address(), "");
+ assertEquals(execution.getVariable("oamManagementV6Address"), "");
+ assertEquals(TEST_CONTRAIL_NETWORK_POLICY_FQDNS, execution.getVariable("contrailNetworkPolicyFqdnList"));
+ }
+
+ @Test
+ public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleOutputs() {
+ execution.setVariable("vnfAdapterRestV1Response",
+ "<createVfModuleResponse><vfModuleOutputs></vfModuleOutputs></createVfModuleResponse>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertNull(vfModule.getHeatStackId());
+ assertNull(vfModule.getContrailServiceInstanceFqdn());
+ assertNull(execution.getVariable("contrailServiceInstanceFqdn"));
+ assertNull(execution.getVariable("oamManagementV4Address"));
+ assertNull(execution.getVariable("oamManagementV6Address"));
+ assertNull(execution.getVariable("contrailNetworkPolicyFqdnList"));
+ }
+
+ @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);
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
- }
-
- @Test
- public void postProcessVnfAdapter_DeleteResponseTest_VfModuleDeletedFalse() {
- vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response", "<deleteVfModuleResponse><vfModuleDeleted>false</vfModuleDeleted></deleteVfModuleResponse>");
- vnfAdapterImpl.postProcessVnfAdapter(execution);
- assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId());
- }
-
- @Test
- public void postProcessVnfAdapter_DeleteResponseTest_EmptyDeleteVfModuleResponseTag() {
+ }
+
+ @Test
+ public void postProcessVnfAdapter_DeleteResponseTest_VfModuleDeletedFalse() {
+ vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID);
+ execution.setVariable("vnfAdapterRestV1Response",
+ "<deleteVfModuleResponse><vfModuleDeleted>false</vfModuleDeleted></deleteVfModuleResponse>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId());
+ }
+
+ @Test
+ public void postProcessVnfAdapter_DeleteResponseTest_EmptyDeleteVfModuleResponseTag() {
+ expectedException.expect(BpmnError.class);
+ execution.setVariable("vnfAdapterRestV1Response", "<vfModuleDeleted></vfModuleDeleted>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ }
+
+ @Test
+ public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleDeletedTag() {
+ vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID);
+ execution.setVariable("vnfAdapterRestV1Response", "<deleteVfModuleResponse></deleteVfModuleResponse>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId());
+ }
+
+ @Test
+ public void preProcessVnfAdapterExceptionTest() throws BBObjectNotFoundException {
expectedException.expect(BpmnError.class);
- execution.setVariable("vnfAdapterRestV1Response", "<vfModuleDeleted></vfModuleDeleted>");
- vnfAdapterImpl.postProcessVnfAdapter(execution);
- }
-
- @Test
- public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleDeletedTag() {
- vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response", "<deleteVfModuleResponse></deleteVfModuleResponse>");
- vnfAdapterImpl.postProcessVnfAdapter(execution);
- assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId());
- }
-
- @Test
- public void preProcessVnfAdapterExceptionTest() throws BBObjectNotFoundException {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID));
-
- vnfAdapterImpl.preProcessVnfAdapter(execution);
- }
+ doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),
+ ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID));
+
+ vnfAdapterImpl.preProcessVnfAdapter(execution);
+ }
@Test
public void postProcessVnfAdapter_CreateVolumeResponseTest() {
@@ -222,52 +236,54 @@ public class VnfAdapterImplTest extends BaseTaskTest {
}
@Test
- public void postProcessVnfAdapter_CreateVolumeEmptyResponseTest() {
+ public void postProcessVnfAdapter_CreateVolumeEmptyResponseTest() {
expectedException.expect(BpmnError.class);
execution.setVariable("vnfAdapterRestV1Response", "<createVolumeGroupResponse></createVolumeGroupResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(volumeGroup.getHeatStackId());
}
-
+
@Test
- public void postProcessVnfAdapter_DeleteResponseTest_DeleteVolumeGroup() {
- volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_VOLUME_DELETE_RESPONSE);
- vnfAdapterImpl.postProcessVnfAdapter(execution);
- assertNull(volumeGroup.getHeatStackId());
- }
-
-
+ public void postProcessVnfAdapter_DeleteResponseTest_DeleteVolumeGroup() {
+ volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID);
+ execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_VOLUME_DELETE_RESPONSE);
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertNull(volumeGroup.getHeatStackId());
+ }
+
+
+ @Test
+ public void postProcessVnfAdapter_DeleteResponseTest_VolumeGroupDeletedFalse() {
+ volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID);
+ execution.setVariable("vnfAdapterRestV1Response",
+ "<deleteVolumeGroupResponse><volumeGroupDeleted>false</volumeGroupDeleted></deleteVolumeGroupResponse>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId());
+ }
+
@Test
- public void postProcessVnfAdapter_DeleteResponseTest_VolumeGroupDeletedFalse() {
- volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response", "<deleteVolumeGroupResponse><volumeGroupDeleted>false</volumeGroupDeleted></deleteVolumeGroupResponse>");
- vnfAdapterImpl.postProcessVnfAdapter(execution);
- assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId());
- }
-
- @Test
- public void postProcessVnfAdapter_DeleteResponseTest_EmptyDeleteVolumeGroupResponseTag() {
+ public void postProcessVnfAdapter_DeleteResponseTest_EmptyDeleteVolumeGroupResponseTag() {
expectedException.expect(BpmnError.class);
- execution.setVariable("vnfAdapterRestV1Response", "<volumeGroupDeleted></volumeGroupDeleted>");
- vnfAdapterImpl.postProcessVnfAdapter(execution);
- }
-
- @Test
- public void postProcessVnfAdapter_DeleteResponseTest_EmptyVolumeGroupDeletedTag() {
- volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response", "<deleteVolumeGroupResponse></deleteVolumeGroupResponse>");
- vnfAdapterImpl.postProcessVnfAdapter(execution);
- assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId());
- }
-
- @Test
- public void postProcessVnfAdapterExceptionTest() throws BBObjectNotFoundException {
- doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID));
-
- execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE);
- expectedException.expect(BpmnError.class);
-
- vnfAdapterImpl.postProcessVnfAdapter(execution);
- }
+ execution.setVariable("vnfAdapterRestV1Response", "<volumeGroupDeleted></volumeGroupDeleted>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ }
+
+ @Test
+ public void postProcessVnfAdapter_DeleteResponseTest_EmptyVolumeGroupDeletedTag() {
+ volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID);
+ execution.setVariable("vnfAdapterRestV1Response", "<deleteVolumeGroupResponse></deleteVolumeGroupResponse>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId());
+ }
+
+ @Test
+ public void postProcessVnfAdapterExceptionTest() throws BBObjectNotFoundException {
+ doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),
+ ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID));
+
+ execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE);
+ expectedException.expect(BpmnError.class);
+
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/EtsiVnfDeleteTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/EtsiVnfDeleteTaskTest.java
index 5c76018ced..5233203c05 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/EtsiVnfDeleteTaskTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/EtsiVnfDeleteTaskTest.java
@@ -46,66 +46,66 @@ import com.google.common.base.Optional;
*/
public class EtsiVnfDeleteTaskTest extends BaseTaskTest {
- private static final String MODEL_INSTANCE_NAME = "MODEL_INSTANCE_NAME";
-
- private static final String VNF_ID = UUID.randomUUID().toString();
-
- private static final String VNF_NAME = "VNF_NAME";
-
- private static final String JOB_ID = UUID.randomUUID().toString();
-
- @Mock
- private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider;
-
- @Mock
- private GeneralBuildingBlock buildingBlock;
-
- @Mock
- private RequestContext requestContext;
-
- private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution();
-
- @Test
- public void testInvokeVnfmAdapter() throws Exception {
- final EtsiVnfDeleteTask objUnderTest = getEtsiVnfDeleteTask();
- when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(getGenericVnf());
- when(mockedVnfmAdapterServiceProvider.invokeDeleteRequest(eq(VNF_ID))).thenReturn(getDeleteVnfResponse());
- objUnderTest.invokeVnfmAdapter(stubbedxecution);
- assertNotNull(stubbedxecution.getVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME));
- }
-
- @Test
- public void testInvokeVnfmAdapterException() throws Exception {
- final EtsiVnfDeleteTask objUnderTest = getEtsiVnfDeleteTask();
- when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(getGenericVnf());
- when(mockedVnfmAdapterServiceProvider.invokeDeleteRequest(eq(VNF_ID))).thenReturn(Optional.absent());
- objUnderTest.invokeVnfmAdapter(stubbedxecution);
- assertNull(stubbedxecution.getVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME));
- verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1212),
- any(Exception.class));
- }
-
- private Optional<DeleteVnfResponse> getDeleteVnfResponse() {
- final DeleteVnfResponse response = new DeleteVnfResponse();
- response.setJobId(JOB_ID);
- return Optional.of(response);
- }
-
- private GenericVnf getGenericVnf() {
- final GenericVnf genericVnf = new GenericVnf();
- genericVnf.setVnfId(VNF_ID);
- genericVnf.setModelInfoGenericVnf(getModelInfoGenericVnf());
- genericVnf.setVnfName(VNF_NAME);
- return genericVnf;
- }
-
- private ModelInfoGenericVnf getModelInfoGenericVnf() {
- final ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
- modelInfoGenericVnf.setModelInstanceName(MODEL_INSTANCE_NAME);
- return modelInfoGenericVnf;
- }
-
- private EtsiVnfDeleteTask getEtsiVnfDeleteTask() {
- return new EtsiVnfDeleteTask(exceptionUtil, extractPojosForBB, mockedVnfmAdapterServiceProvider);
- }
+ private static final String MODEL_INSTANCE_NAME = "MODEL_INSTANCE_NAME";
+
+ private static final String VNF_ID = UUID.randomUUID().toString();
+
+ private static final String VNF_NAME = "VNF_NAME";
+
+ private static final String JOB_ID = UUID.randomUUID().toString();
+
+ @Mock
+ private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider;
+
+ @Mock
+ private GeneralBuildingBlock buildingBlock;
+
+ @Mock
+ private RequestContext requestContext;
+
+ private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution();
+
+ @Test
+ public void testInvokeVnfmAdapter() throws Exception {
+ final EtsiVnfDeleteTask objUnderTest = getEtsiVnfDeleteTask();
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(getGenericVnf());
+ when(mockedVnfmAdapterServiceProvider.invokeDeleteRequest(eq(VNF_ID))).thenReturn(getDeleteVnfResponse());
+ objUnderTest.invokeVnfmAdapter(stubbedxecution);
+ assertNotNull(stubbedxecution.getVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME));
+ }
+
+ @Test
+ public void testInvokeVnfmAdapterException() throws Exception {
+ final EtsiVnfDeleteTask objUnderTest = getEtsiVnfDeleteTask();
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(getGenericVnf());
+ when(mockedVnfmAdapterServiceProvider.invokeDeleteRequest(eq(VNF_ID))).thenReturn(Optional.absent());
+ objUnderTest.invokeVnfmAdapter(stubbedxecution);
+ assertNull(stubbedxecution.getVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME));
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1212),
+ any(Exception.class));
+ }
+
+ private Optional<DeleteVnfResponse> getDeleteVnfResponse() {
+ final DeleteVnfResponse response = new DeleteVnfResponse();
+ response.setJobId(JOB_ID);
+ return Optional.of(response);
+ }
+
+ private GenericVnf getGenericVnf() {
+ final GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId(VNF_ID);
+ genericVnf.setModelInfoGenericVnf(getModelInfoGenericVnf());
+ genericVnf.setVnfName(VNF_NAME);
+ return genericVnf;
+ }
+
+ private ModelInfoGenericVnf getModelInfoGenericVnf() {
+ final ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelInstanceName(MODEL_INSTANCE_NAME);
+ return modelInfoGenericVnf;
+ }
+
+ private EtsiVnfDeleteTask getEtsiVnfDeleteTask() {
+ return new EtsiVnfDeleteTask(exceptionUtil, extractPojosForBB, mockedVnfmAdapterServiceProvider);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTaskTest.java
index 803b58b4b8..5805ea5ec1 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTaskTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTaskTest.java
@@ -24,12 +24,10 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
-
import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTaskTest.java
index ed5fa94100..718418eae0 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTaskTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTaskTest.java
@@ -49,130 +49,131 @@ import com.google.common.base.Optional;
*/
public class MonitorVnfmCreateJobTaskTest extends BaseTaskTest {
- private static final String JOB_ID = UUID.randomUUID().toString();
-
- @Mock
- private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider;
-
- private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution();
-
- @Test
- public void testGetCurrentOperationStatus() throws Exception {
- final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
- stubbedxecution.setVariable(Constants.CREATE_VNF_RESPONSE_PARAM_NAME, getCreateVnfResponse());
- Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
- queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
- queryJobResponse.get().setOperationState(OperationStateEnum.COMPLETED);
- when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
- objUnderTest.getCurrentOperationStatus(stubbedxecution);
- final Optional<OperationStateEnum> operationState =
- stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
- assertNotNull(operationState);
- assertEquals(OperationStateEnum.COMPLETED, operationState.get());
- }
-
- @Test
- public void testGetCurrentOperationStatusFailed() throws Exception {
- final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
- stubbedxecution.setVariable(Constants.CREATE_VNF_RESPONSE_PARAM_NAME, getCreateVnfResponse());
- Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
- queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.CANNOT_RETRIEVE_STATUS);
- queryJobResponse.get().setOperationState(OperationStateEnum.FAILED);
- when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
- objUnderTest.getCurrentOperationStatus(stubbedxecution);
- final Optional<OperationStateEnum> operationState =
- stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
- assertNotNull(operationState);
- assertEquals(OperationStateEnum.FAILED, operationState.get());
- }
-
- @Test
- public void testGetCurrentOperationStatusEmpty() throws Exception {
- final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
- stubbedxecution.setVariable(Constants.CREATE_VNF_RESPONSE_PARAM_NAME, getCreateVnfResponse());
- Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
- queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
- when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
- objUnderTest.getCurrentOperationStatus(stubbedxecution);
- final Optional<OperationStateEnum> operationState =
- stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
- assertFalse(operationState.isPresent());
- }
-
- @Test
- public void testGetCurrentOperationStatusException() throws Exception {
- final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
- stubbedxecution.setVariable(Constants.CREATE_VNF_RESPONSE_PARAM_NAME, getCreateVnfResponse());
- Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
- queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
- when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
- objUnderTest.getCurrentOperationStatus(stubbedxecution);
- final Optional<OperationStateEnum> operationState =
- stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
- assertFalse(operationState.isPresent());
- }
-
- @Test
- public void testHasOperationFinished() throws Exception {
- final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
- stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.COMPLETED));
- assertTrue(objUnderTest.hasOperationFinished(stubbedxecution));
- }
-
- @Test
- public void testHasOperationPending() throws Exception {
- final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
- stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.absent());
- assertFalse(objUnderTest.hasOperationFinished(stubbedxecution));
- }
-
- @Test
- public void testTimeOutLogFailue() throws Exception {
- final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
- objUnderTest.timeOutLogFailue(stubbedxecution);
- verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1205),
- eq("Instantiation operation time out"));
- }
-
- @Test
- public void testCheckIfOperationWasSuccessful() throws Exception {
- stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.COMPLETED));
- MonitorVnfmCreateJobTask objUnderTest = Mockito.spy(getEtsiVnfMonitorJobTask());
- objUnderTest.checkIfOperationWasSuccessful(stubbedxecution);
- verify(objUnderTest, times(1)).checkIfOperationWasSuccessful(stubbedxecution);
- }
-
- @Test
- public void testCheckIfOperationWasSuccessfulWithPending() throws Exception {
- final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
- stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.PROCESSING));
- objUnderTest.checkIfOperationWasSuccessful(stubbedxecution);
- verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1207), anyString());
- }
-
- @Test
- public void testCheckIfOperationWasSuccessfulEmpty() throws Exception {
- MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
- stubbedxecution.setVariable(Constants.CREATE_VNF_RESPONSE_PARAM_NAME, getCreateVnfResponse());
- stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.absent());
- objUnderTest.checkIfOperationWasSuccessful(stubbedxecution);
- verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1206), anyString());
- }
-
- private CreateVnfResponse getCreateVnfResponse() {
- final CreateVnfResponse response = new CreateVnfResponse();
- response.setJobId(JOB_ID);
- return response;
- }
-
- private Optional<QueryJobResponse> getQueryJobResponse() {
- final QueryJobResponse queryJobResponse = new QueryJobResponse();
- queryJobResponse.setId(JOB_ID);
- return Optional.of(queryJobResponse);
- }
-
- private MonitorVnfmCreateJobTask getEtsiVnfMonitorJobTask() {
- return new MonitorVnfmCreateJobTask(mockedVnfmAdapterServiceProvider, exceptionUtil);
- }
+ private static final String JOB_ID = UUID.randomUUID().toString();
+
+ @Mock
+ private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider;
+
+ private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution();
+
+ @Test
+ public void testGetCurrentOperationStatus() throws Exception {
+ final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
+ stubbedxecution.setVariable(Constants.CREATE_VNF_RESPONSE_PARAM_NAME, getCreateVnfResponse());
+ Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
+ queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
+ queryJobResponse.get().setOperationState(OperationStateEnum.COMPLETED);
+ when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
+ objUnderTest.getCurrentOperationStatus(stubbedxecution);
+ final Optional<OperationStateEnum> operationState =
+ stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
+ assertNotNull(operationState);
+ assertEquals(OperationStateEnum.COMPLETED, operationState.get());
+ }
+
+ @Test
+ public void testGetCurrentOperationStatusFailed() throws Exception {
+ final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
+ stubbedxecution.setVariable(Constants.CREATE_VNF_RESPONSE_PARAM_NAME, getCreateVnfResponse());
+ Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
+ queryJobResponse.get()
+ .setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.CANNOT_RETRIEVE_STATUS);
+ queryJobResponse.get().setOperationState(OperationStateEnum.FAILED);
+ when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
+ objUnderTest.getCurrentOperationStatus(stubbedxecution);
+ final Optional<OperationStateEnum> operationState =
+ stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
+ assertNotNull(operationState);
+ assertEquals(OperationStateEnum.FAILED, operationState.get());
+ }
+
+ @Test
+ public void testGetCurrentOperationStatusEmpty() throws Exception {
+ final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
+ stubbedxecution.setVariable(Constants.CREATE_VNF_RESPONSE_PARAM_NAME, getCreateVnfResponse());
+ Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
+ queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
+ when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
+ objUnderTest.getCurrentOperationStatus(stubbedxecution);
+ final Optional<OperationStateEnum> operationState =
+ stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
+ assertFalse(operationState.isPresent());
+ }
+
+ @Test
+ public void testGetCurrentOperationStatusException() throws Exception {
+ final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
+ stubbedxecution.setVariable(Constants.CREATE_VNF_RESPONSE_PARAM_NAME, getCreateVnfResponse());
+ Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
+ queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
+ when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
+ objUnderTest.getCurrentOperationStatus(stubbedxecution);
+ final Optional<OperationStateEnum> operationState =
+ stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
+ assertFalse(operationState.isPresent());
+ }
+
+ @Test
+ public void testHasOperationFinished() throws Exception {
+ final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.COMPLETED));
+ assertTrue(objUnderTest.hasOperationFinished(stubbedxecution));
+ }
+
+ @Test
+ public void testHasOperationPending() throws Exception {
+ final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.absent());
+ assertFalse(objUnderTest.hasOperationFinished(stubbedxecution));
+ }
+
+ @Test
+ public void testTimeOutLogFailue() throws Exception {
+ final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
+ objUnderTest.timeOutLogFailue(stubbedxecution);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1205),
+ eq("Instantiation operation time out"));
+ }
+
+ @Test
+ public void testCheckIfOperationWasSuccessful() throws Exception {
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.COMPLETED));
+ MonitorVnfmCreateJobTask objUnderTest = Mockito.spy(getEtsiVnfMonitorJobTask());
+ objUnderTest.checkIfOperationWasSuccessful(stubbedxecution);
+ verify(objUnderTest, times(1)).checkIfOperationWasSuccessful(stubbedxecution);
+ }
+
+ @Test
+ public void testCheckIfOperationWasSuccessfulWithPending() throws Exception {
+ final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.PROCESSING));
+ objUnderTest.checkIfOperationWasSuccessful(stubbedxecution);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1207), anyString());
+ }
+
+ @Test
+ public void testCheckIfOperationWasSuccessfulEmpty() throws Exception {
+ MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
+ stubbedxecution.setVariable(Constants.CREATE_VNF_RESPONSE_PARAM_NAME, getCreateVnfResponse());
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.absent());
+ objUnderTest.checkIfOperationWasSuccessful(stubbedxecution);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1206), anyString());
+ }
+
+ private CreateVnfResponse getCreateVnfResponse() {
+ final CreateVnfResponse response = new CreateVnfResponse();
+ response.setJobId(JOB_ID);
+ return response;
+ }
+
+ private Optional<QueryJobResponse> getQueryJobResponse() {
+ final QueryJobResponse queryJobResponse = new QueryJobResponse();
+ queryJobResponse.setId(JOB_ID);
+ return Optional.of(queryJobResponse);
+ }
+
+ private MonitorVnfmCreateJobTask getEtsiVnfMonitorJobTask() {
+ return new MonitorVnfmCreateJobTask(mockedVnfmAdapterServiceProvider, exceptionUtil);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTaskTest.java
index e41c571765..a821de1cd1 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTaskTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTaskTest.java
@@ -50,124 +50,125 @@ import com.google.common.base.Optional;
*/
public class MonitorVnfmDeleteJobTaskTest extends BaseTaskTest {
- private static final String JOB_ID = UUID.randomUUID().toString();
-
- private MonitorVnfmDeleteJobTask objUnderTest;
-
- @Mock
- private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider;
-
- private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution();
-
- @Before
- public void setUp() {
- objUnderTest = getEtsiVnfMonitorJobTask();
- stubbedxecution.setVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME, getDeleteVnfResponse());
- }
-
- @Test
- public void testGetCurrentOperationStatus() throws Exception {
- Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
- queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
- queryJobResponse.get().setOperationState(OperationStateEnum.COMPLETED);
- when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
- objUnderTest.getCurrentOperationStatus(stubbedxecution);
- final Optional<OperationStateEnum> operationState =
- stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
- assertNotNull(operationState);
- assertEquals(OperationStateEnum.COMPLETED, operationState.get());
- }
-
- @Test
- public void testGetCurrentOperationStatusFailed() throws Exception {
- Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
- queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.CANNOT_RETRIEVE_STATUS);
- queryJobResponse.get().setOperationState(OperationStateEnum.FAILED);
- when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
- objUnderTest.getCurrentOperationStatus(stubbedxecution);
- final Optional<OperationStateEnum> operationState =
- stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
- assertNotNull(operationState);
- assertEquals(OperationStateEnum.FAILED, operationState.get());
- }
-
- @Test
- public void testGetCurrentOperationStatusEmpty() throws Exception {
- Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
- queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
- when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
- objUnderTest.getCurrentOperationStatus(stubbedxecution);
- final Optional<OperationStateEnum> operationState =
- stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
- assertFalse(operationState.isPresent());
- }
-
- @Test
- public void testGetCurrentOperationStatusException() throws Exception {
- Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
- queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
- when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
- objUnderTest.getCurrentOperationStatus(stubbedxecution);
- final Optional<OperationStateEnum> operationState =
- stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
- assertFalse(operationState.isPresent());
- }
-
- @Test
- public void testHasOperationFinished() throws Exception {
- stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.COMPLETED));
- assertTrue(objUnderTest.hasOperationFinished(stubbedxecution));
- }
-
- @Test
- public void testHasOperationPending() throws Exception {
- stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.absent());
- assertFalse(objUnderTest.hasOperationFinished(stubbedxecution));
- }
-
- @Test
- public void testTimeOutLogFailue() throws Exception {
- objUnderTest.timeOutLogFailue(stubbedxecution);
- verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1213),
- eq("Delete operation time out"));
- }
-
- @Test
- public void testCheckIfOperationWasSuccessful() throws Exception {
- stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.COMPLETED));
- MonitorVnfmDeleteJobTask spyObject = Mockito.spy(objUnderTest);
- spyObject.checkIfOperationWasSuccessful(stubbedxecution);
- verify(spyObject, times(1)).checkIfOperationWasSuccessful(stubbedxecution);
- }
-
- @Test
- public void testCheckIfOperationWasSuccessfulWithPending() throws Exception {
- stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.PROCESSING));
- objUnderTest.checkIfOperationWasSuccessful(stubbedxecution);
- verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1215), anyString());
- }
-
- @Test
- public void testCheckIfOperationWasSuccessfulEmpty() throws Exception {
- stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.absent());
- objUnderTest.checkIfOperationWasSuccessful(stubbedxecution);
- verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1214), anyString());
- }
-
- private DeleteVnfResponse getDeleteVnfResponse() {
- final DeleteVnfResponse response = new DeleteVnfResponse();
- response.setJobId(JOB_ID);
- return response;
- }
-
- private Optional<QueryJobResponse> getQueryJobResponse() {
- final QueryJobResponse queryJobResponse = new QueryJobResponse();
- queryJobResponse.setId(JOB_ID);
- return Optional.of(queryJobResponse);
- }
-
- private MonitorVnfmDeleteJobTask getEtsiVnfMonitorJobTask() {
- return new MonitorVnfmDeleteJobTask(mockedVnfmAdapterServiceProvider, exceptionUtil);
- }
+ private static final String JOB_ID = UUID.randomUUID().toString();
+
+ private MonitorVnfmDeleteJobTask objUnderTest;
+
+ @Mock
+ private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider;
+
+ private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution();
+
+ @Before
+ public void setUp() {
+ objUnderTest = getEtsiVnfMonitorJobTask();
+ stubbedxecution.setVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME, getDeleteVnfResponse());
+ }
+
+ @Test
+ public void testGetCurrentOperationStatus() throws Exception {
+ Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
+ queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
+ queryJobResponse.get().setOperationState(OperationStateEnum.COMPLETED);
+ when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
+ objUnderTest.getCurrentOperationStatus(stubbedxecution);
+ final Optional<OperationStateEnum> operationState =
+ stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
+ assertNotNull(operationState);
+ assertEquals(OperationStateEnum.COMPLETED, operationState.get());
+ }
+
+ @Test
+ public void testGetCurrentOperationStatusFailed() throws Exception {
+ Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
+ queryJobResponse.get()
+ .setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.CANNOT_RETRIEVE_STATUS);
+ queryJobResponse.get().setOperationState(OperationStateEnum.FAILED);
+ when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
+ objUnderTest.getCurrentOperationStatus(stubbedxecution);
+ final Optional<OperationStateEnum> operationState =
+ stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
+ assertNotNull(operationState);
+ assertEquals(OperationStateEnum.FAILED, operationState.get());
+ }
+
+ @Test
+ public void testGetCurrentOperationStatusEmpty() throws Exception {
+ Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
+ queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
+ when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
+ objUnderTest.getCurrentOperationStatus(stubbedxecution);
+ final Optional<OperationStateEnum> operationState =
+ stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
+ assertFalse(operationState.isPresent());
+ }
+
+ @Test
+ public void testGetCurrentOperationStatusException() throws Exception {
+ Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
+ queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
+ when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
+ objUnderTest.getCurrentOperationStatus(stubbedxecution);
+ final Optional<OperationStateEnum> operationState =
+ stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
+ assertFalse(operationState.isPresent());
+ }
+
+ @Test
+ public void testHasOperationFinished() throws Exception {
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.COMPLETED));
+ assertTrue(objUnderTest.hasOperationFinished(stubbedxecution));
+ }
+
+ @Test
+ public void testHasOperationPending() throws Exception {
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.absent());
+ assertFalse(objUnderTest.hasOperationFinished(stubbedxecution));
+ }
+
+ @Test
+ public void testTimeOutLogFailue() throws Exception {
+ objUnderTest.timeOutLogFailue(stubbedxecution);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1213),
+ eq("Delete operation time out"));
+ }
+
+ @Test
+ public void testCheckIfOperationWasSuccessful() throws Exception {
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.COMPLETED));
+ MonitorVnfmDeleteJobTask spyObject = Mockito.spy(objUnderTest);
+ spyObject.checkIfOperationWasSuccessful(stubbedxecution);
+ verify(spyObject, times(1)).checkIfOperationWasSuccessful(stubbedxecution);
+ }
+
+ @Test
+ public void testCheckIfOperationWasSuccessfulWithPending() throws Exception {
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.PROCESSING));
+ objUnderTest.checkIfOperationWasSuccessful(stubbedxecution);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1215), anyString());
+ }
+
+ @Test
+ public void testCheckIfOperationWasSuccessfulEmpty() throws Exception {
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.absent());
+ objUnderTest.checkIfOperationWasSuccessful(stubbedxecution);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1214), anyString());
+ }
+
+ private DeleteVnfResponse getDeleteVnfResponse() {
+ final DeleteVnfResponse response = new DeleteVnfResponse();
+ response.setJobId(JOB_ID);
+ return response;
+ }
+
+ private Optional<QueryJobResponse> getQueryJobResponse() {
+ final QueryJobResponse queryJobResponse = new QueryJobResponse();
+ queryJobResponse.setId(JOB_ID);
+ return Optional.of(queryJobResponse);
+ }
+
+ private MonitorVnfmDeleteJobTask getEtsiVnfMonitorJobTask() {
+ return new MonitorVnfmDeleteJobTask(mockedVnfmAdapterServiceProvider, exceptionUtil);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeJobTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeJobTest.java
index aa3ab113a0..6b84f6a918 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeJobTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeJobTest.java
@@ -46,66 +46,66 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
*/
public class MonitorVnfmNodeJobTest extends BaseTaskTest {
- private static final String VNF_ID = UUID.randomUUID().toString();
-
- private static final String VNF_NAME = "VNF_NAME";
-
- private MonitorVnfmNodeTask objUnderTest;
-
- @Mock
- private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider;
-
- private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution();
-
- @Before
- public void setUp() {
- objUnderTest = getEtsiVnfMonitorNodeJobTask();
- }
-
- @Test
- public void testGetNodeStatusCreate() throws Exception {
- GenericVnf vnf = getGenericVnf();
- vnf.setOrchestrationStatus(VNF_CREATED);
- when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf);
- objUnderTest.getNodeStatus(stubbedxecution);
- assertTrue(stubbedxecution.getVariable(CREATE_VNF_NODE_STATUS));
- }
-
- @Test
- public void testGetNodeStatusDelete() throws Exception {
- GenericVnf vnf = getGenericVnf();
- vnf.setOrchestrationStatus(VNF_ASSIGNED);
- when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf);
- objUnderTest.getNodeStatus(stubbedxecution);
- assertTrue(stubbedxecution.getVariable(DELETE_VNF_NODE_STATUS));
- }
-
- @Test
- public void testGetNodeStatusException() throws Exception {
- when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenThrow(RuntimeException.class);
- objUnderTest.getNodeStatus(stubbedxecution);
- assertNull(stubbedxecution.getVariable(CREATE_VNF_NODE_STATUS));
- assertNull(stubbedxecution.getVariable(DELETE_VNF_NODE_STATUS));
- verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1220),
- any(Exception.class));
- }
-
- @Test
- public void testTimeOutLogFailue() throws Exception {
- objUnderTest.timeOutLogFailue(stubbedxecution);
- verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1221),
- eq("Node operation time out"));
- }
-
- private GenericVnf getGenericVnf() {
- final GenericVnf genericVnf = new GenericVnf();
- genericVnf.setVnfId(VNF_ID);
- genericVnf.setVnfName(VNF_NAME);
- return genericVnf;
- }
-
- private MonitorVnfmNodeTask getEtsiVnfMonitorNodeJobTask() {
- return new MonitorVnfmNodeTask(extractPojosForBB, exceptionUtil);
- }
+ private static final String VNF_ID = UUID.randomUUID().toString();
+
+ private static final String VNF_NAME = "VNF_NAME";
+
+ private MonitorVnfmNodeTask objUnderTest;
+
+ @Mock
+ private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider;
+
+ private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution();
+
+ @Before
+ public void setUp() {
+ objUnderTest = getEtsiVnfMonitorNodeJobTask();
+ }
+
+ @Test
+ public void testGetNodeStatusCreate() throws Exception {
+ GenericVnf vnf = getGenericVnf();
+ vnf.setOrchestrationStatus(VNF_CREATED);
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf);
+ objUnderTest.getNodeStatus(stubbedxecution);
+ assertTrue(stubbedxecution.getVariable(CREATE_VNF_NODE_STATUS));
+ }
+
+ @Test
+ public void testGetNodeStatusDelete() throws Exception {
+ GenericVnf vnf = getGenericVnf();
+ vnf.setOrchestrationStatus(VNF_ASSIGNED);
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf);
+ objUnderTest.getNodeStatus(stubbedxecution);
+ assertTrue(stubbedxecution.getVariable(DELETE_VNF_NODE_STATUS));
+ }
+
+ @Test
+ public void testGetNodeStatusException() throws Exception {
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenThrow(RuntimeException.class);
+ objUnderTest.getNodeStatus(stubbedxecution);
+ assertNull(stubbedxecution.getVariable(CREATE_VNF_NODE_STATUS));
+ assertNull(stubbedxecution.getVariable(DELETE_VNF_NODE_STATUS));
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1220),
+ any(Exception.class));
+ }
+
+ @Test
+ public void testTimeOutLogFailue() throws Exception {
+ objUnderTest.timeOutLogFailue(stubbedxecution);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1221),
+ eq("Node operation time out"));
+ }
+
+ private GenericVnf getGenericVnf() {
+ final GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId(VNF_ID);
+ genericVnf.setVnfName(VNF_NAME);
+ return genericVnf;
+ }
+
+ private MonitorVnfmNodeTask getEtsiVnfMonitorNodeJobTask() {
+ return new MonitorVnfmNodeTask(extractPojosForBB, exceptionUtil);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/StubbedBuildingBlockExecution.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/StubbedBuildingBlockExecution.java
index 260585d208..84012e8b8d 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/StubbedBuildingBlockExecution.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/StubbedBuildingBlockExecution.java
@@ -38,63 +38,63 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
*/
public class StubbedBuildingBlockExecution implements BuildingBlockExecution {
- private static final String CLOUD_OWNER = "CLOUD_OWNER";
- private static final String LCP_CLOUD_REGIONID = "RegionOnce";
- private static final String TENANT_ID = UUID.randomUUID().toString();
- private final Map<String, Serializable> execution = new HashMap<>();
- private final GeneralBuildingBlock generalBuildingBlock;
+ private static final String CLOUD_OWNER = "CLOUD_OWNER";
+ private static final String LCP_CLOUD_REGIONID = "RegionOnce";
+ private static final String TENANT_ID = UUID.randomUUID().toString();
+ private final Map<String, Serializable> execution = new HashMap<>();
+ private final GeneralBuildingBlock generalBuildingBlock;
- StubbedBuildingBlockExecution() {
- generalBuildingBlock = getGeneralBuildingBlockValue();
- }
+ StubbedBuildingBlockExecution() {
+ generalBuildingBlock = getGeneralBuildingBlockValue();
+ }
- @Override
- public GeneralBuildingBlock getGeneralBuildingBlock() {
- return generalBuildingBlock;
- }
+ @Override
+ public GeneralBuildingBlock getGeneralBuildingBlock() {
+ return generalBuildingBlock;
+ }
- @SuppressWarnings("unchecked")
- @Override
- public <T> T getVariable(final String key) {
- return (T) execution.get(key);
- }
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getVariable(final String key) {
+ return (T) execution.get(key);
+ }
- @Override
- public <T> T getRequiredVariable(final String key) throws RequiredExecutionVariableExeception {
- return null;
- }
+ @Override
+ public <T> T getRequiredVariable(final String key) throws RequiredExecutionVariableExeception {
+ return null;
+ }
- @Override
- public void setVariable(final String key, final Serializable value) {
- execution.put(key, value);
- }
+ @Override
+ public void setVariable(final String key, final Serializable value) {
+ execution.put(key, value);
+ }
- @Override
- public Map<ResourceKey, String> getLookupMap() {
- return Collections.emptyMap();
- }
+ @Override
+ public Map<ResourceKey, String> getLookupMap() {
+ return Collections.emptyMap();
+ }
- @Override
- public String getFlowToBeCalled() {
- return null;
- }
+ @Override
+ public String getFlowToBeCalled() {
+ return null;
+ }
- public static String getTenantId() {
- return TENANT_ID;
- }
+ public static String getTenantId() {
+ return TENANT_ID;
+ }
- private GeneralBuildingBlock getGeneralBuildingBlockValue() {
- final GeneralBuildingBlock buildingBlock = new GeneralBuildingBlock();
- buildingBlock.setCloudRegion(getCloudRegion());
- return buildingBlock;
- }
+ private GeneralBuildingBlock getGeneralBuildingBlockValue() {
+ final GeneralBuildingBlock buildingBlock = new GeneralBuildingBlock();
+ buildingBlock.setCloudRegion(getCloudRegion());
+ return buildingBlock;
+ }
- private CloudRegion getCloudRegion() {
- final CloudRegion cloudRegion = new CloudRegion();
- cloudRegion.setCloudOwner(CLOUD_OWNER);
- cloudRegion.setLcpCloudRegionId(LCP_CLOUD_REGIONID);
- cloudRegion.setTenantId(TENANT_ID);
- return cloudRegion;
- }
+ private CloudRegion getCloudRegion() {
+ final CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setCloudOwner(CLOUD_OWNER);
+ cloudRegion.setLcpCloudRegionId(LCP_CLOUD_REGIONID);
+ cloudRegion.setTenantId(TENANT_ID);
+ return cloudRegion;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java
index c4f19d6d1a..7b63e5f811 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java
@@ -21,9 +21,7 @@
package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.DUMMY_URL;
-
import java.util.UUID;
-
import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmBasicHttpConfigProvider;
/**
@@ -36,7 +34,7 @@ public class TestConstants {
public static final String DUMMY_BASIC_AUTH = "Basic 123abc";
public static final String DUMMY_URL = "http://localhost:30406/so/vnfm-adapter/v1/";
public static final String EXPECTED_URL = DUMMY_URL + "vnfs/" + DUMMY_GENERIC_VND_ID;
-
+
public static final String DUMMY_JOB_ID = UUID.randomUUID().toString();
public static final String JOB_STATUS_EXPECTED_URL = DUMMY_URL + "jobs/" + DUMMY_JOB_ID;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfigurationTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfigurationTest.java
index 5aaebea76e..75151d9c6a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfigurationTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfigurationTest.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
import static org.junit.Assert.assertNotNull;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.getVnfmBasicHttpConfigProvider;
-
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskTest.java
index 22c4c15079..cfa5aaa4b8 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskTest.java
@@ -51,131 +51,132 @@ import com.google.common.base.Optional;
*/
public class VnfmAdapterCreateVnfTaskTest extends BaseTaskTest {
- private static final String MODEL_INSTANCE_NAME = "MODEL_INSTANCE_NAME";
+ private static final String MODEL_INSTANCE_NAME = "MODEL_INSTANCE_NAME";
- private static final String CLOUD_OWNER = "CLOUD_OWNER";
+ private static final String CLOUD_OWNER = "CLOUD_OWNER";
- private static final String LCP_CLOUD_REGIONID = "RegionOnce";
+ private static final String LCP_CLOUD_REGIONID = "RegionOnce";
- private static final String VNF_ID = UUID.randomUUID().toString();
+ private static final String VNF_ID = UUID.randomUUID().toString();
- private static final String VNF_NAME = "VNF_NAME";
+ private static final String VNF_NAME = "VNF_NAME";
- private static final String JOB_ID = UUID.randomUUID().toString();
+ private static final String JOB_ID = UUID.randomUUID().toString();
- @Mock
- private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider;
+ @Mock
+ private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider;
- private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution();
+ private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution();
- @Test
- public void testBuildCreateVnfRequest_withValidValues_storesRequestInExecution() throws Exception {
+ @Test
+ public void testBuildCreateVnfRequest_withValidValues_storesRequestInExecution() throws Exception {
- final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
- stubbedxecution.setVariable(INPUT_PARAMETER, new InputParameter(Collections.emptyMap(), Collections.emptyList()));
+ final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
+ stubbedxecution.setVariable(INPUT_PARAMETER,
+ new InputParameter(Collections.emptyMap(), Collections.emptyList()));
- when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(getGenericVnf());
- objUnderTest.buildCreateVnfRequest(stubbedxecution);
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(getGenericVnf());
+ objUnderTest.buildCreateVnfRequest(stubbedxecution);
- final CreateVnfRequest actual = stubbedxecution.getVariable(CREATE_VNF_REQUEST_PARAM_NAME);
- assertNotNull(actual);
- assertEquals(VNF_NAME + "." + MODEL_INSTANCE_NAME, actual.getName());
+ final CreateVnfRequest actual = stubbedxecution.getVariable(CREATE_VNF_REQUEST_PARAM_NAME);
+ assertNotNull(actual);
+ assertEquals(VNF_NAME + "." + MODEL_INSTANCE_NAME, actual.getName());
- final Tenant actualTenant = actual.getTenant();
- assertEquals(CLOUD_OWNER, actualTenant.getCloudOwner());
- assertEquals(LCP_CLOUD_REGIONID, actualTenant.getRegionName());
- assertEquals(StubbedBuildingBlockExecution.getTenantId(), actualTenant.getTenantId());
+ final Tenant actualTenant = actual.getTenant();
+ assertEquals(CLOUD_OWNER, actualTenant.getCloudOwner());
+ assertEquals(LCP_CLOUD_REGIONID, actualTenant.getRegionName());
+ assertEquals(StubbedBuildingBlockExecution.getTenantId(), actualTenant.getTenantId());
- }
+ }
- @Test
- public void testBuildCreateVnfRequest_extractPojosForBBThrowsException_exceptionBuilderCalled() throws Exception {
+ @Test
+ public void testBuildCreateVnfRequest_extractPojosForBBThrowsException_exceptionBuilderCalled() throws Exception {
- final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
+ final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
- when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenThrow(RuntimeException.class);
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenThrow(RuntimeException.class);
- objUnderTest.buildCreateVnfRequest(stubbedxecution);
+ objUnderTest.buildCreateVnfRequest(stubbedxecution);
- final CreateVnfRequest actual = stubbedxecution.getVariable(CREATE_VNF_REQUEST_PARAM_NAME);
+ final CreateVnfRequest actual = stubbedxecution.getVariable(CREATE_VNF_REQUEST_PARAM_NAME);
- assertNull(actual);
- verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1200),
- any(Exception.class));
+ assertNull(actual);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1200),
+ any(Exception.class));
- }
+ }
- @Test
- public void testInvokeVnfmAdapter_validValues_storesResponseInExecution() throws Exception {
+ @Test
+ public void testInvokeVnfmAdapter_validValues_storesResponseInExecution() throws Exception {
- final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
+ final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
- stubbedxecution.setVariable(CREATE_VNF_REQUEST_PARAM_NAME, new CreateVnfRequest());
+ stubbedxecution.setVariable(CREATE_VNF_REQUEST_PARAM_NAME, new CreateVnfRequest());
- when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(getGenericVnf());
- when(mockedVnfmAdapterServiceProvider.invokeCreateInstantiationRequest(eq(VNF_ID), any(CreateVnfRequest.class)))
- .thenReturn(getCreateVnfResponse());
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(getGenericVnf());
+ when(mockedVnfmAdapterServiceProvider.invokeCreateInstantiationRequest(eq(VNF_ID), any(CreateVnfRequest.class)))
+ .thenReturn(getCreateVnfResponse());
- objUnderTest.invokeVnfmAdapter(stubbedxecution);
+ objUnderTest.invokeVnfmAdapter(stubbedxecution);
- assertNotNull(stubbedxecution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME));
- }
+ assertNotNull(stubbedxecution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME));
+ }
- @Test
- public void testInvokeVnfmAdapter_invalidValues_storesResponseInExecution() throws Exception {
+ @Test
+ public void testInvokeVnfmAdapter_invalidValues_storesResponseInExecution() throws Exception {
- final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
+ final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
- stubbedxecution.setVariable(CREATE_VNF_REQUEST_PARAM_NAME, new CreateVnfRequest());
+ stubbedxecution.setVariable(CREATE_VNF_REQUEST_PARAM_NAME, new CreateVnfRequest());
- when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(getGenericVnf());
- when(mockedVnfmAdapterServiceProvider.invokeCreateInstantiationRequest(eq(VNF_ID), any(CreateVnfRequest.class)))
- .thenReturn(Optional.absent());
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(getGenericVnf());
+ when(mockedVnfmAdapterServiceProvider.invokeCreateInstantiationRequest(eq(VNF_ID), any(CreateVnfRequest.class)))
+ .thenReturn(Optional.absent());
- objUnderTest.invokeVnfmAdapter(stubbedxecution);
+ objUnderTest.invokeVnfmAdapter(stubbedxecution);
- assertNull(stubbedxecution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME));
- verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1202),
- any(Exception.class));
- }
+ assertNull(stubbedxecution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME));
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1202),
+ any(Exception.class));
+ }
- @Test
- public void testInvokeVnfmAdapter_extractPojosForBBThrowsException_exceptionBuilderCalled() throws Exception {
+ @Test
+ public void testInvokeVnfmAdapter_extractPojosForBBThrowsException_exceptionBuilderCalled() throws Exception {
- final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
+ final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
- when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenThrow(RuntimeException.class);
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenThrow(RuntimeException.class);
- objUnderTest.invokeVnfmAdapter(stubbedxecution);
+ objUnderTest.invokeVnfmAdapter(stubbedxecution);
- assertNull(stubbedxecution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME));
- verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1202),
- any(Exception.class));
+ assertNull(stubbedxecution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME));
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1202),
+ any(Exception.class));
- }
+ }
- private Optional<CreateVnfResponse> getCreateVnfResponse() {
- final CreateVnfResponse response = new CreateVnfResponse();
- response.setJobId(JOB_ID);
- return Optional.of(response);
- }
+ private Optional<CreateVnfResponse> getCreateVnfResponse() {
+ final CreateVnfResponse response = new CreateVnfResponse();
+ response.setJobId(JOB_ID);
+ return Optional.of(response);
+ }
- private GenericVnf getGenericVnf() {
- final GenericVnf genericVnf = new GenericVnf();
- genericVnf.setVnfId(VNF_ID);
- genericVnf.setModelInfoGenericVnf(getModelInfoGenericVnf());
- genericVnf.setVnfName(VNF_NAME);
- return genericVnf;
- }
+ private GenericVnf getGenericVnf() {
+ final GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId(VNF_ID);
+ genericVnf.setModelInfoGenericVnf(getModelInfoGenericVnf());
+ genericVnf.setVnfName(VNF_NAME);
+ return genericVnf;
+ }
- private ModelInfoGenericVnf getModelInfoGenericVnf() {
- final ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
- modelInfoGenericVnf.setModelInstanceName(MODEL_INSTANCE_NAME);
- return modelInfoGenericVnf;
- }
+ private ModelInfoGenericVnf getModelInfoGenericVnf() {
+ final ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelInstanceName(MODEL_INSTANCE_NAME);
+ return modelInfoGenericVnf;
+ }
- private VnfmAdapterCreateVnfTask getEtsiVnfInstantiateTask() {
- return new VnfmAdapterCreateVnfTask(exceptionUtil, extractPojosForBB, mockedVnfmAdapterServiceProvider);
- }
+ private VnfmAdapterCreateVnfTask getEtsiVnfInstantiateTask() {
+ return new VnfmAdapterCreateVnfTask(exceptionUtil, extractPojosForBB, mockedVnfmAdapterServiceProvider);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java
index 6f1b6f0bd2..7bd6435b60 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java
@@ -52,242 +52,242 @@ import com.google.common.base.Optional;
@RunWith(MockitoJUnitRunner.class)
public class VnfmAdapterServiceProviderImplTest {
- private static final String EMPTY_JOB_ID = "";
-
- private static final CreateVnfRequest CREATE_VNF_REQUEST = new CreateVnfRequest();
-
- @Mock
- private HttpRestServiceProvider mockedHttpServiceProvider;
-
- @Mock
- private ResponseEntity<CreateVnfResponse> mockedResponseEntity;
-
- @Mock
- private ResponseEntity<DeleteVnfResponse> deleteVnfResponse;
- @Mock
- private ResponseEntity<QueryJobResponse> mockedQueryJobResponseResponseEntity;
-
- @Test
- public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusAcceptedWithBody_validResponse() {
-
- when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(), eq(CreateVnfResponse.class)))
- .thenReturn(mockedResponseEntity);
- when(mockedResponseEntity.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
- when(mockedResponseEntity.hasBody()).thenReturn(true);
- final CreateVnfResponse response = getCreateVnfResponse(DUMMY_JOB_ID);
- when(mockedResponseEntity.getBody()).thenReturn(response);
- final VnfmAdapterServiceProvider objUnderTest =
- new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
- final Optional<CreateVnfResponse> actual =
- objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
- assertTrue(actual.isPresent());
- assertEquals(actual.get(), response);
- }
-
- @Test
- public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusAcceptedWithNoBody_noResponse() {
- assertWithStatuCode(HttpStatus.ACCEPTED);
- }
-
- @Test
- public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusNotOkWithNoBody_noResponse() {
- assertWithStatuCode(HttpStatus.UNAUTHORIZED);
- }
-
-
- @Test
- public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusAcceptedWithBodyWithInvalidJobId_noResponse() {
- assertWithJobId(null);
- assertWithJobId(EMPTY_JOB_ID);
- }
-
- @Test
- public void testInvokeCreateInstantiationRequest_httpServiceProviderThrowException_httpRestServiceProviderNotNull() {
-
- when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(), eq(CreateVnfResponse.class)))
- .thenThrow(RestProcessingException.class);
-
-
- final VnfmAdapterServiceProvider objUnderTest =
- new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
-
- final Optional<CreateVnfResponse> actual =
- objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
- assertFalse(actual.isPresent());
-
- }
-
- @Test
- public void testInvokeDeleteRequest() {
- when(mockedHttpServiceProvider.deleteHttpRequest(anyString(), eq(DeleteVnfResponse.class)))
- .thenReturn(deleteVnfResponse);
- when(deleteVnfResponse.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
- when(deleteVnfResponse.hasBody()).thenReturn(true);
- final DeleteVnfResponse response = getDeleteVnfResponse(DUMMY_JOB_ID);
- when(deleteVnfResponse.getBody()).thenReturn(response);
- final VnfmAdapterServiceProvider objUnderTest =
- new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
- final Optional<DeleteVnfResponse> actual = objUnderTest.invokeDeleteRequest(DUMMY_GENERIC_VND_ID);
- assertTrue(actual.isPresent());
- }
-
- @Test
- public void testInvokeDeleteRequestNotAccepted() {
- when(mockedHttpServiceProvider.deleteHttpRequest(anyString(), eq(DeleteVnfResponse.class)))
- .thenReturn(deleteVnfResponse);
- when(deleteVnfResponse.getStatusCode()).thenReturn(HttpStatus.BAD_GATEWAY);
- final VnfmAdapterServiceProvider objUnderTest =
- new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
- final Optional<DeleteVnfResponse> actual = objUnderTest.invokeDeleteRequest(DUMMY_GENERIC_VND_ID);
- assertFalse(actual.isPresent());
- }
-
- @Test
- public void testInvokeDeleteRequestNoBody() {
- when(mockedHttpServiceProvider.deleteHttpRequest(anyString(), eq(DeleteVnfResponse.class)))
- .thenReturn(deleteVnfResponse);
- when(deleteVnfResponse.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
- when(deleteVnfResponse.hasBody()).thenReturn(false);
- final VnfmAdapterServiceProvider objUnderTest =
- new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
- final Optional<DeleteVnfResponse> actual = objUnderTest.invokeDeleteRequest(DUMMY_GENERIC_VND_ID);
- assertFalse(actual.isPresent());
- }
-
- @Test
- public void testInvokeDeleteRequestNoJobId() {
- when(mockedHttpServiceProvider.deleteHttpRequest(anyString(), eq(DeleteVnfResponse.class)))
- .thenReturn(deleteVnfResponse);
- when(deleteVnfResponse.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
- when(deleteVnfResponse.hasBody()).thenReturn(true);
- final DeleteVnfResponse response = getDeleteVnfResponse("");
- when(deleteVnfResponse.getBody()).thenReturn(response);
- final VnfmAdapterServiceProvider objUnderTest =
- new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
- final Optional<DeleteVnfResponse> actual = objUnderTest.invokeDeleteRequest(DUMMY_GENERIC_VND_ID);
- assertFalse(actual.isPresent());
- }
-
- @Test
- public void testInvokeDeleteRequestException() {
- when(mockedHttpServiceProvider.deleteHttpRequest(anyString(), eq(DeleteVnfResponse.class)))
- .thenThrow(RestProcessingException.class);
- final VnfmAdapterServiceProvider objUnderTest =
- new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
- final Optional<DeleteVnfResponse> actual = objUnderTest.invokeDeleteRequest(DUMMY_GENERIC_VND_ID);
- assertFalse(actual.isPresent());
- }
-
- @Test
- public void testGetInstantiateOperationJobStatus_httpServiceProviderReturnsStatusOkWithBody_validResponse() {
-
- when(mockedQueryJobResponseResponseEntity.getStatusCode()).thenReturn(HttpStatus.OK);
- when(mockedQueryJobResponseResponseEntity.hasBody()).thenReturn(true);
- when(mockedQueryJobResponseResponseEntity.getBody()).thenReturn(getQueryJobResponse());
-
- when(mockedHttpServiceProvider.getHttpResponse(eq(TestConstants.JOB_STATUS_EXPECTED_URL),
- eq(QueryJobResponse.class))).thenReturn(mockedQueryJobResponseResponseEntity);
-
- final VnfmAdapterServiceProvider objUnderTest =
- new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
-
- final Optional<QueryJobResponse> actual = objUnderTest.getInstantiateOperationJobStatus(DUMMY_JOB_ID);
- assertTrue(actual.isPresent());
- final QueryJobResponse actualQueryJobResponse = actual.get();
- assertNotNull(actualQueryJobResponse);
- }
-
- @Test
- public void testGetInstantiateOperationJobStatus_httpServiceProviderReturnsStatusOkWithOutBody_invalidResponse() {
-
- when(mockedQueryJobResponseResponseEntity.getStatusCode()).thenReturn(HttpStatus.OK);
- when(mockedQueryJobResponseResponseEntity.hasBody()).thenReturn(false);
-
- when(mockedHttpServiceProvider.getHttpResponse(eq(TestConstants.JOB_STATUS_EXPECTED_URL),
- eq(QueryJobResponse.class))).thenReturn(mockedQueryJobResponseResponseEntity);
-
- final VnfmAdapterServiceProvider objUnderTest =
- new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
-
- final Optional<QueryJobResponse> actual = objUnderTest.getInstantiateOperationJobStatus(DUMMY_JOB_ID);
- assertFalse(actual.isPresent());
- }
-
- @Test
- public void testGetInstantiateOperationJobStatus_httpServiceProviderReturnsStatusNotOkWithOutBody_invalidResponse() {
-
- when(mockedQueryJobResponseResponseEntity.getStatusCode()).thenReturn(HttpStatus.INTERNAL_SERVER_ERROR);
-
- when(mockedHttpServiceProvider.getHttpResponse(eq(TestConstants.JOB_STATUS_EXPECTED_URL),
- eq(QueryJobResponse.class))).thenReturn(mockedQueryJobResponseResponseEntity);
-
- final VnfmAdapterServiceProvider objUnderTest =
- new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
-
- final Optional<QueryJobResponse> actual = objUnderTest.getInstantiateOperationJobStatus(DUMMY_JOB_ID);
- assertFalse(actual.isPresent());
- }
-
- @Test
- public void testGetInstantiateOperationJobStatus_Exception() {
-
- when(mockedHttpServiceProvider.getHttpResponse(eq(TestConstants.JOB_STATUS_EXPECTED_URL),
- eq(QueryJobResponse.class))).thenThrow(RestProcessingException.class);
-
- final VnfmAdapterServiceProvider objUnderTest =
- new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
-
- final Optional<QueryJobResponse> actual = objUnderTest.getInstantiateOperationJobStatus(DUMMY_JOB_ID);
- assertFalse(actual.isPresent());
- }
-
- private QueryJobResponse getQueryJobResponse() {
- return new QueryJobResponse().id(DUMMY_JOB_ID).operationState(OperationStateEnum.COMPLETED);
-
- }
-
- private void assertWithJobId(final String jobId) {
- when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(), eq(CreateVnfResponse.class)))
- .thenReturn(mockedResponseEntity);
- when(mockedResponseEntity.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
- when(mockedResponseEntity.hasBody()).thenReturn(true);
- final CreateVnfResponse response = getCreateVnfResponse(jobId);
- when(mockedResponseEntity.getBody()).thenReturn(response);
-
-
- final VnfmAdapterServiceProvider objUnderTest =
- new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
-
- final Optional<CreateVnfResponse> actual =
- objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
- assertFalse(actual.isPresent());
- }
-
- private void assertWithStatuCode(final HttpStatus status) {
- when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(), eq(CreateVnfResponse.class)))
- .thenReturn(mockedResponseEntity);
- when(mockedResponseEntity.getStatusCode()).thenReturn(status);
- when(mockedResponseEntity.hasBody()).thenReturn(false);
+ private static final String EMPTY_JOB_ID = "";
+
+ private static final CreateVnfRequest CREATE_VNF_REQUEST = new CreateVnfRequest();
+
+ @Mock
+ private HttpRestServiceProvider mockedHttpServiceProvider;
+
+ @Mock
+ private ResponseEntity<CreateVnfResponse> mockedResponseEntity;
+
+ @Mock
+ private ResponseEntity<DeleteVnfResponse> deleteVnfResponse;
+ @Mock
+ private ResponseEntity<QueryJobResponse> mockedQueryJobResponseResponseEntity;
+
+ @Test
+ public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusAcceptedWithBody_validResponse() {
+
+ when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(),
+ eq(CreateVnfResponse.class))).thenReturn(mockedResponseEntity);
+ when(mockedResponseEntity.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
+ when(mockedResponseEntity.hasBody()).thenReturn(true);
+ final CreateVnfResponse response = getCreateVnfResponse(DUMMY_JOB_ID);
+ when(mockedResponseEntity.getBody()).thenReturn(response);
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+ final Optional<CreateVnfResponse> actual =
+ objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
+ assertTrue(actual.isPresent());
+ assertEquals(actual.get(), response);
+ }
+
+ @Test
+ public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusAcceptedWithNoBody_noResponse() {
+ assertWithStatuCode(HttpStatus.ACCEPTED);
+ }
+
+ @Test
+ public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusNotOkWithNoBody_noResponse() {
+ assertWithStatuCode(HttpStatus.UNAUTHORIZED);
+ }
+
+
+ @Test
+ public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusAcceptedWithBodyWithInvalidJobId_noResponse() {
+ assertWithJobId(null);
+ assertWithJobId(EMPTY_JOB_ID);
+ }
+
+ @Test
+ public void testInvokeCreateInstantiationRequest_httpServiceProviderThrowException_httpRestServiceProviderNotNull() {
+
+ when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(),
+ eq(CreateVnfResponse.class))).thenThrow(RestProcessingException.class);
+
+
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+
+ final Optional<CreateVnfResponse> actual =
+ objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
+ assertFalse(actual.isPresent());
+
+ }
+
+ @Test
+ public void testInvokeDeleteRequest() {
+ when(mockedHttpServiceProvider.deleteHttpRequest(anyString(), eq(DeleteVnfResponse.class)))
+ .thenReturn(deleteVnfResponse);
+ when(deleteVnfResponse.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
+ when(deleteVnfResponse.hasBody()).thenReturn(true);
+ final DeleteVnfResponse response = getDeleteVnfResponse(DUMMY_JOB_ID);
+ when(deleteVnfResponse.getBody()).thenReturn(response);
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+ final Optional<DeleteVnfResponse> actual = objUnderTest.invokeDeleteRequest(DUMMY_GENERIC_VND_ID);
+ assertTrue(actual.isPresent());
+ }
+
+ @Test
+ public void testInvokeDeleteRequestNotAccepted() {
+ when(mockedHttpServiceProvider.deleteHttpRequest(anyString(), eq(DeleteVnfResponse.class)))
+ .thenReturn(deleteVnfResponse);
+ when(deleteVnfResponse.getStatusCode()).thenReturn(HttpStatus.BAD_GATEWAY);
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+ final Optional<DeleteVnfResponse> actual = objUnderTest.invokeDeleteRequest(DUMMY_GENERIC_VND_ID);
+ assertFalse(actual.isPresent());
+ }
+
+ @Test
+ public void testInvokeDeleteRequestNoBody() {
+ when(mockedHttpServiceProvider.deleteHttpRequest(anyString(), eq(DeleteVnfResponse.class)))
+ .thenReturn(deleteVnfResponse);
+ when(deleteVnfResponse.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
+ when(deleteVnfResponse.hasBody()).thenReturn(false);
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+ final Optional<DeleteVnfResponse> actual = objUnderTest.invokeDeleteRequest(DUMMY_GENERIC_VND_ID);
+ assertFalse(actual.isPresent());
+ }
+
+ @Test
+ public void testInvokeDeleteRequestNoJobId() {
+ when(mockedHttpServiceProvider.deleteHttpRequest(anyString(), eq(DeleteVnfResponse.class)))
+ .thenReturn(deleteVnfResponse);
+ when(deleteVnfResponse.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
+ when(deleteVnfResponse.hasBody()).thenReturn(true);
+ final DeleteVnfResponse response = getDeleteVnfResponse("");
+ when(deleteVnfResponse.getBody()).thenReturn(response);
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+ final Optional<DeleteVnfResponse> actual = objUnderTest.invokeDeleteRequest(DUMMY_GENERIC_VND_ID);
+ assertFalse(actual.isPresent());
+ }
+
+ @Test
+ public void testInvokeDeleteRequestException() {
+ when(mockedHttpServiceProvider.deleteHttpRequest(anyString(), eq(DeleteVnfResponse.class)))
+ .thenThrow(RestProcessingException.class);
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+ final Optional<DeleteVnfResponse> actual = objUnderTest.invokeDeleteRequest(DUMMY_GENERIC_VND_ID);
+ assertFalse(actual.isPresent());
+ }
+
+ @Test
+ public void testGetInstantiateOperationJobStatus_httpServiceProviderReturnsStatusOkWithBody_validResponse() {
+
+ when(mockedQueryJobResponseResponseEntity.getStatusCode()).thenReturn(HttpStatus.OK);
+ when(mockedQueryJobResponseResponseEntity.hasBody()).thenReturn(true);
+ when(mockedQueryJobResponseResponseEntity.getBody()).thenReturn(getQueryJobResponse());
+
+ when(mockedHttpServiceProvider.getHttpResponse(eq(TestConstants.JOB_STATUS_EXPECTED_URL),
+ eq(QueryJobResponse.class))).thenReturn(mockedQueryJobResponseResponseEntity);
+
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+
+ final Optional<QueryJobResponse> actual = objUnderTest.getInstantiateOperationJobStatus(DUMMY_JOB_ID);
+ assertTrue(actual.isPresent());
+ final QueryJobResponse actualQueryJobResponse = actual.get();
+ assertNotNull(actualQueryJobResponse);
+ }
+
+ @Test
+ public void testGetInstantiateOperationJobStatus_httpServiceProviderReturnsStatusOkWithOutBody_invalidResponse() {
+
+ when(mockedQueryJobResponseResponseEntity.getStatusCode()).thenReturn(HttpStatus.OK);
+ when(mockedQueryJobResponseResponseEntity.hasBody()).thenReturn(false);
+
+ when(mockedHttpServiceProvider.getHttpResponse(eq(TestConstants.JOB_STATUS_EXPECTED_URL),
+ eq(QueryJobResponse.class))).thenReturn(mockedQueryJobResponseResponseEntity);
+
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+
+ final Optional<QueryJobResponse> actual = objUnderTest.getInstantiateOperationJobStatus(DUMMY_JOB_ID);
+ assertFalse(actual.isPresent());
+ }
+
+ @Test
+ public void testGetInstantiateOperationJobStatus_httpServiceProviderReturnsStatusNotOkWithOutBody_invalidResponse() {
+
+ when(mockedQueryJobResponseResponseEntity.getStatusCode()).thenReturn(HttpStatus.INTERNAL_SERVER_ERROR);
+
+ when(mockedHttpServiceProvider.getHttpResponse(eq(TestConstants.JOB_STATUS_EXPECTED_URL),
+ eq(QueryJobResponse.class))).thenReturn(mockedQueryJobResponseResponseEntity);
+
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+
+ final Optional<QueryJobResponse> actual = objUnderTest.getInstantiateOperationJobStatus(DUMMY_JOB_ID);
+ assertFalse(actual.isPresent());
+ }
+
+ @Test
+ public void testGetInstantiateOperationJobStatus_Exception() {
+
+ when(mockedHttpServiceProvider.getHttpResponse(eq(TestConstants.JOB_STATUS_EXPECTED_URL),
+ eq(QueryJobResponse.class))).thenThrow(RestProcessingException.class);
+
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+
+ final Optional<QueryJobResponse> actual = objUnderTest.getInstantiateOperationJobStatus(DUMMY_JOB_ID);
+ assertFalse(actual.isPresent());
+ }
+
+ private QueryJobResponse getQueryJobResponse() {
+ return new QueryJobResponse().id(DUMMY_JOB_ID).operationState(OperationStateEnum.COMPLETED);
+
+ }
+
+ private void assertWithJobId(final String jobId) {
+ when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(),
+ eq(CreateVnfResponse.class))).thenReturn(mockedResponseEntity);
+ when(mockedResponseEntity.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
+ when(mockedResponseEntity.hasBody()).thenReturn(true);
+ final CreateVnfResponse response = getCreateVnfResponse(jobId);
+ when(mockedResponseEntity.getBody()).thenReturn(response);
+
+
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+
+ final Optional<CreateVnfResponse> actual =
+ objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
+ assertFalse(actual.isPresent());
+ }
- final VnfmAdapterServiceProvider objUnderTest =
- new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+ private void assertWithStatuCode(final HttpStatus status) {
+ when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(),
+ eq(CreateVnfResponse.class))).thenReturn(mockedResponseEntity);
+ when(mockedResponseEntity.getStatusCode()).thenReturn(status);
+ when(mockedResponseEntity.hasBody()).thenReturn(false);
- final Optional<CreateVnfResponse> actual =
- objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
- assertFalse(actual.isPresent());
- }
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
- private CreateVnfResponse getCreateVnfResponse(final String jobId) {
- return new CreateVnfResponse().jobId(jobId);
- }
+ final Optional<CreateVnfResponse> actual =
+ objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
+ assertFalse(actual.isPresent());
+ }
- private DeleteVnfResponse getDeleteVnfResponse(final String jobId) {
- final DeleteVnfResponse response = new DeleteVnfResponse();
- response.setJobId(jobId);
- return response;
- }
+ private CreateVnfResponse getCreateVnfResponse(final String jobId) {
+ return new CreateVnfResponse().jobId(jobId);
+ }
- private VnfmAdapterUrlProvider getVnfmAdapterUrlProvider() {
- return new VnfmAdapterUrlProvider(getVnfmBasicHttpConfigProvider());
- }
+ private DeleteVnfResponse getDeleteVnfResponse(final String jobId) {
+ final DeleteVnfResponse response = new DeleteVnfResponse();
+ response.setJobId(jobId);
+ return response;
+ }
+
+ private VnfmAdapterUrlProvider getVnfmAdapterUrlProvider() {
+ return new VnfmAdapterUrlProvider(getVnfmBasicHttpConfigProvider());
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProviderTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProviderTest.java
index 133f24bbe1..4bffb845f4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProviderTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProviderTest.java
@@ -26,7 +26,6 @@ import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.D
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.EXPECTED_URL;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.JOB_STATUS_EXPECTED_URL;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.getVnfmBasicHttpConfigProvider;
-
import org.junit.Test;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImplTest.java
index d21942d08f..51e86c1fea 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImplTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImplTest.java
@@ -26,14 +26,12 @@ import static org.mockito.Mockito.when;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.FORWARD_SLASH;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.PRELOAD_VNFS_URL;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.DUMMY_GENERIC_VND_ID;
-
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Map;
-
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameterTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameterTest.java
index 46018b8f39..c7c61f9a1d 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameterTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameterTest.java
@@ -20,7 +20,6 @@
package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils;
import org.junit.Test;
-
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksIT.java
index 9cf1a1cdc9..e7a8b35db8 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksIT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksIT.java
@@ -24,11 +24,9 @@ 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.HashMap;
import java.util.Optional;
import java.util.UUID;
-
import org.junit.Before;
import org.junit.Test;
import org.onap.appc.client.lcm.model.Action;
@@ -40,62 +38,66 @@ import org.onap.so.db.catalog.beans.ControllerSelectionReference;
import org.springframework.beans.factory.annotation.Autowired;
public class AppcRunTasksIT extends BaseIntegrationTest {
-
- @Autowired
- private AppcRunTasks appcRunTasks;
-
- private GenericVnf genericVnf;
- private RequestContext requestContext;
- private String msoRequestId;
- @Before
- public void before() {
- genericVnf = setGenericVnf();
- msoRequestId = UUID.randomUUID().toString();
- requestContext = setRequestContext();
- requestContext.setMsoRequestId(msoRequestId);
- gBBInput.setRequestContext(requestContext);
- }
-
- @Test
- public void preProcessActivityTest() throws Exception {
- appcRunTasks.preProcessActivity(execution);
- assertEquals(execution.getVariable("actionQuiesceTraffic"), Action.QuiesceTraffic);
- assertEquals(execution.getVariable("rollbackQuiesceTraffic"), false);
- }
-
- @Test
- public void runAppcCommandTest() throws Exception {
- Action action = Action.QuiesceTraffic;
- ControllerSelectionReference controllerSelectionReference = new ControllerSelectionReference();
- controllerSelectionReference.setControllerName("testName");
- controllerSelectionReference.setActionCategory(action.toString());
- controllerSelectionReference.setVnfType("testVnfType");
-
- doReturn(controllerSelectionReference).when(catalogDbClient).getControllerSelectionReferenceByVnfTypeAndActionCategory(genericVnf.getVnfType(), Action.QuiesceTraffic.toString());
-
- execution.setVariable("aicIdentity", "testAicIdentity");
-
- String vnfId = genericVnf.getVnfId();
- genericVnf.setIpv4OamAddress("testOamIpAddress");
- String payload = "{\"testName\":\"testValue\",}";
- RequestParameters requestParameters = new RequestParameters();
- requestParameters.setPayload(payload);
- gBBInput.getRequestContext().setRequestParameters(requestParameters);
-
- String controllerType = "testName";
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- payloadInfo.put("vnfName", "testVnfName1");
- payloadInfo.put("aicIdentity", "testAicIdentity");
- payloadInfo.put("vnfHostIpAddress", "testOamIpAddress");
- payloadInfo.put("vserverIdList", null);
- payloadInfo.put("vfModuleId", null);
- payloadInfo.put("identityUrl", null);
- payloadInfo.put("vmIdList", null);
-
- doNothing().when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
-
- appcRunTasks.runAppcCommand(execution, action);
- verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
- }
+ @Autowired
+ private AppcRunTasks appcRunTasks;
+
+ private GenericVnf genericVnf;
+ private RequestContext requestContext;
+ private String msoRequestId;
+
+ @Before
+ public void before() {
+ genericVnf = setGenericVnf();
+ msoRequestId = UUID.randomUUID().toString();
+ requestContext = setRequestContext();
+ requestContext.setMsoRequestId(msoRequestId);
+ gBBInput.setRequestContext(requestContext);
+ }
+
+ @Test
+ public void preProcessActivityTest() throws Exception {
+ appcRunTasks.preProcessActivity(execution);
+ assertEquals(execution.getVariable("actionQuiesceTraffic"), Action.QuiesceTraffic);
+ assertEquals(execution.getVariable("rollbackQuiesceTraffic"), false);
+ }
+
+ @Test
+ public void runAppcCommandTest() throws Exception {
+ Action action = Action.QuiesceTraffic;
+ ControllerSelectionReference controllerSelectionReference = new ControllerSelectionReference();
+ controllerSelectionReference.setControllerName("testName");
+ controllerSelectionReference.setActionCategory(action.toString());
+ controllerSelectionReference.setVnfType("testVnfType");
+
+ doReturn(controllerSelectionReference).when(catalogDbClient)
+ .getControllerSelectionReferenceByVnfTypeAndActionCategory(genericVnf.getVnfType(),
+ Action.QuiesceTraffic.toString());
+
+ execution.setVariable("aicIdentity", "testAicIdentity");
+
+ String vnfId = genericVnf.getVnfId();
+ genericVnf.setIpv4OamAddress("testOamIpAddress");
+ String payload = "{\"testName\":\"testValue\",}";
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setPayload(payload);
+ gBBInput.getRequestContext().setRequestParameters(requestParameters);
+
+ String controllerType = "testName";
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", "testVnfName1");
+ payloadInfo.put("aicIdentity", "testAicIdentity");
+ payloadInfo.put("vnfHostIpAddress", "testOamIpAddress");
+ payloadInfo.put("vserverIdList", null);
+ payloadInfo.put("vfModuleId", null);
+ payloadInfo.put("identityUrl", null);
+ payloadInfo.put("vmIdList", null);
+
+ doNothing().when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo,
+ controllerType);
+
+ appcRunTasks.runAppcCommand(execution, action);
+ verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo,
+ controllerType);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
index a8518d9016..cf673c5eb5 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
@@ -30,7 +30,6 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-
import org.junit.Test;
import org.mockito.InjectMocks;
import org.onap.appc.client.lcm.model.Action;
@@ -45,47 +44,45 @@ import org.onap.so.db.catalog.beans.ControllerSelectionReference;
public class AppcRunTasksTest extends BaseTaskTest {
- @InjectMocks
- private AppcRunTasks appcRunTasks = new AppcRunTasks();
-
- @Test
- public void mapRollbackVariablesTest() {
-
- BuildingBlockExecution mock = mock(BuildingBlockExecution.class);
-
- appcRunTasks.mapRollbackVariables(mock, Action.Lock, "1");
- verify(mock, times(0)).setVariable(any(String.class), any());
- appcRunTasks.mapRollbackVariables(mock, Action.Lock, "0");
- verify(mock, times(1)).setVariable("rollbackVnfLock", true);
- appcRunTasks.mapRollbackVariables(mock, Action.Unlock, "0");
- verify(mock, times(1)).setVariable("rollbackVnfLock", false);
- appcRunTasks.mapRollbackVariables(mock, Action.Start, "0");
- verify(mock, times(1)).setVariable("rollbackVnfStop", false);
- appcRunTasks.mapRollbackVariables(mock, Action.Stop, "0");
- verify(mock, times(1)).setVariable("rollbackVnfStop", true);
- appcRunTasks.mapRollbackVariables(mock, Action.QuiesceTraffic, "0");
- verify(mock, times(1)).setVariable("rollbackQuiesceTraffic", true);
- appcRunTasks.mapRollbackVariables(mock, Action.ResumeTraffic, "0");
- verify(mock, times(1)).setVariable("rollbackQuiesceTraffic", false);
- }
+ @InjectMocks
+ private AppcRunTasks appcRunTasks = new AppcRunTasks();
+
+ @Test
+ public void mapRollbackVariablesTest() {
+
+ BuildingBlockExecution mock = mock(BuildingBlockExecution.class);
+
+ appcRunTasks.mapRollbackVariables(mock, Action.Lock, "1");
+ verify(mock, times(0)).setVariable(any(String.class), any());
+ appcRunTasks.mapRollbackVariables(mock, Action.Lock, "0");
+ verify(mock, times(1)).setVariable("rollbackVnfLock", true);
+ appcRunTasks.mapRollbackVariables(mock, Action.Unlock, "0");
+ verify(mock, times(1)).setVariable("rollbackVnfLock", false);
+ appcRunTasks.mapRollbackVariables(mock, Action.Start, "0");
+ verify(mock, times(1)).setVariable("rollbackVnfStop", false);
+ appcRunTasks.mapRollbackVariables(mock, Action.Stop, "0");
+ verify(mock, times(1)).setVariable("rollbackVnfStop", true);
+ appcRunTasks.mapRollbackVariables(mock, Action.QuiesceTraffic, "0");
+ verify(mock, times(1)).setVariable("rollbackQuiesceTraffic", true);
+ appcRunTasks.mapRollbackVariables(mock, Action.ResumeTraffic, "0");
+ verify(mock, times(1)).setVariable("rollbackQuiesceTraffic", false);
+ }
@Test
public void runAppcCommandVnfNull() throws BBObjectNotFoundException {
execution.getLookupMap().put(ResourceKey.GENERIC_VNF_ID, "NULL-TEST");
fillRequiredAppcExecutionFields();
- when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID)))
- .thenReturn(null);
- when(catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(
- isNull(), eq(Action.Lock.toString()))).
- thenThrow(new IllegalArgumentException("name or values is null"));
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(null);
+ when(catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(isNull(),
+ eq(Action.Lock.toString()))).thenThrow(new IllegalArgumentException("name or values is null"));
appcRunTasks.runAppcCommand(execution, Action.Lock);
// if vnf = null -> vnfType = null ->
- // IllegalArgumentException will be thrown in catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory
- verify(exceptionUtil, times(1)).
- buildAndThrowWorkflowException(
- any(BuildingBlockExecution.class), eq(1002), eq("name or values is null"));
+ // IllegalArgumentException will be thrown in
+ // catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1002),
+ eq("name or values is null"));
}
@Test
@@ -93,13 +90,12 @@ public class AppcRunTasksTest extends BaseTaskTest {
execution.getLookupMap().put(ResourceKey.GENERIC_VNF_ID, "EXCEPTION-TEST");
fillRequiredAppcExecutionFields();
when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID)))
- .thenThrow(new BBObjectNotFoundException());
+ .thenThrow(new BBObjectNotFoundException());
appcRunTasks.runAppcCommand(execution, Action.Lock);
- verify(exceptionUtil, times(1)).
- buildAndThrowWorkflowException(
- any(BuildingBlockExecution.class), eq(7000), eq("No valid VNF exists"));
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000),
+ eq("No valid VNF exists"));
}
@Test
@@ -107,12 +103,10 @@ public class AppcRunTasksTest extends BaseTaskTest {
execution.getLookupMap().put(ResourceKey.GENERIC_VNF_ID, "SUCCESS-TEST");
fillRequiredAppcExecutionFields();
GenericVnf genericVnf = getTestGenericVnf();
- when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID)))
- .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
mockReferenceResponse();
execution.getLookupMap().put(ResourceKey.VF_MODULE_ID, "VF-MODULE-ID-TEST");
- when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.VF_MODULE_ID)))
- .thenReturn(null);
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.VF_MODULE_ID))).thenReturn(null);
when(appCClient.getErrorCode()).thenReturn("0");
appcRunTasks.runAppcCommand(execution, Action.Lock);
@@ -125,14 +119,12 @@ public class AppcRunTasksTest extends BaseTaskTest {
execution.getLookupMap().put(ResourceKey.GENERIC_VNF_ID, "SUCCESS-TEST");
fillRequiredAppcExecutionFields();
GenericVnf genericVnf = getTestGenericVnf();
- when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID)))
- .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
mockReferenceResponse();
execution.getLookupMap().put(ResourceKey.VF_MODULE_ID, "VF-MODULE-ID-TEST");
VfModule vfModule = new VfModule();
vfModule.setVfModuleId("VF-MODULE-ID");
- when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.VF_MODULE_ID)))
- .thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
when(appCClient.getErrorCode()).thenReturn("0");
appcRunTasks.runAppcCommand(execution, Action.Lock);
@@ -143,8 +135,8 @@ public class AppcRunTasksTest extends BaseTaskTest {
private void mockReferenceResponse() {
ControllerSelectionReference reference = new ControllerSelectionReference();
reference.setControllerName("TEST-CONTROLLER-NAME");
- when(catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(
- eq("TEST-VNF-TYPE"), eq(Action.Lock.toString()))).thenReturn(reference);
+ when(catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(eq("TEST-VNF-TYPE"),
+ eq(Action.Lock.toString()))).thenReturn(reference);
}
private void fillRequiredAppcExecutionFields() {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java
index 3542d7fdb3..3bf24291ea 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java
@@ -23,7 +23,6 @@ import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
-
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -38,37 +37,39 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.client.exception.BBObjectNotFoundException;
-public class AuditTasksTest extends BaseTaskTest{
-
- @InjectMocks
- private AuditTasks auditTasks = new AuditTasks();
- private ServiceInstance serviceInstance;
- private GenericVnf genericVnf;
- private VfModule vfModule;
+public class AuditTasksTest extends BaseTaskTest {
+
+ @InjectMocks
+ private AuditTasks auditTasks = new AuditTasks();
+ private ServiceInstance serviceInstance;
+ private GenericVnf genericVnf;
+ private VfModule vfModule;
+
+
+ @Rule
+ public final ExpectedException exception = ExpectedException.none();
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ serviceInstance = setServiceInstance();
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+ setCloudRegion();
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+ }
-
- @Rule
- public final ExpectedException exception = ExpectedException.none();
-
- @Before
- public void before() throws BBObjectNotFoundException {
- serviceInstance = setServiceInstance();
- genericVnf = setGenericVnf();
- vfModule = setVfModule();
- setCloudRegion();
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
- }
-
- @Test
- public void setupAuditVariableTest() throws Exception {
- AuditInventory expectedAuditInventory = new AuditInventory();
- expectedAuditInventory.setCloudOwner("testCloudOwner");
- expectedAuditInventory.setCloudRegion("testLcpCloudRegionId");
- expectedAuditInventory.setHeatStackName("testVfModuleName1");
- expectedAuditInventory.setTenantId("testTenantId");
- auditTasks.setupAuditVariable(execution);
- assertThat((AuditInventory)execution.getVariable("auditInventory"), sameBeanAs(expectedAuditInventory));
- }
+ @Test
+ public void setupAuditVariableTest() throws Exception {
+ AuditInventory expectedAuditInventory = new AuditInventory();
+ expectedAuditInventory.setCloudOwner("testCloudOwner");
+ expectedAuditInventory.setCloudRegion("testLcpCloudRegionId");
+ expectedAuditInventory.setHeatStackName("testVfModuleName1");
+ expectedAuditInventory.setTenantId("testTenantId");
+ auditTasks.setupAuditVariable(execution);
+ assertThat((AuditInventory) execution.getVariable("auditInventory"), sameBeanAs(expectedAuditInventory));
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModuleTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModuleTest.java
index d1d167e561..0a880ad0e5 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModuleTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModuleTest.java
@@ -29,16 +29,18 @@ import org.mockito.InjectMocks;
import org.onap.so.bpmn.BaseTaskTest;
public class ActivateVfModuleTest extends BaseTaskTest {
-
- @InjectMocks
- private ActivateVfModule activateVfModule = new ActivateVfModule();
-
- @Test
- public void setWaitBeforeDurationTest() throws Exception {
- when(env.getProperty(ActivateVfModule.VF_MODULE_TIMER_DURATION_PATH, ActivateVfModule.DEFAULT_TIMER_DURATION)).thenReturn("PT300S");
- activateVfModule.setTimerDuration(execution);
- verify(env, times(1)).getProperty(ActivateVfModule.VF_MODULE_TIMER_DURATION_PATH, ActivateVfModule.DEFAULT_TIMER_DURATION);
- assertEquals("PT300S", (String) execution.getVariable("vfModuleActivateTimerDuration"));
- }
+
+ @InjectMocks
+ private ActivateVfModule activateVfModule = new ActivateVfModule();
+
+ @Test
+ public void setWaitBeforeDurationTest() throws Exception {
+ when(env.getProperty(ActivateVfModule.VF_MODULE_TIMER_DURATION_PATH, ActivateVfModule.DEFAULT_TIMER_DURATION))
+ .thenReturn("PT300S");
+ activateVfModule.setTimerDuration(execution);
+ verify(env, times(1)).getProperty(ActivateVfModule.VF_MODULE_TIMER_DURATION_PATH,
+ ActivateVfModule.DEFAULT_TIMER_DURATION);
+ assertEquals("PT300S", (String) execution.getVariable("vfModuleActivateTimerDuration"));
+ }
}
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
index e7f841fa47..8ca0e79c6e 100644
--- 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
@@ -20,7 +20,6 @@
package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import static org.junit.Assert.assertEquals;
-
import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
@@ -28,34 +27,34 @@ import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
public class AssignNetworkBBUtilsTest extends BaseTaskTest {
-
- @InjectMocks
- 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"));
- }
+
+ @InjectMocks
+ 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
index 19981bc45a..d7a5dbd8f0 100644
--- 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
@@ -24,7 +24,6 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.when;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
@@ -38,39 +37,40 @@ import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
public class AssignNetworkTest extends BaseTaskTest {
-
- @InjectMocks
- private AssignNetwork assignNetwork = new AssignNetwork();
-
- private L3Network network;
-
- @Before
- public void before() throws BBObjectNotFoundException {
- network = setL3Network();
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
- }
-
- @Test
- public void networkNotFoundTest() throws Exception {
- //network status to PRECREATED - when it was NOT found by name
- try {
- network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- } catch(BBObjectNotFoundException e) {
- }
-
- network.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
- boolean networkFound = assignNetwork.networkFoundByName(execution);
- assertEquals(false, networkFound);
- }
- @Test
- public void networkFoundTest() throws Exception {
- try {
- network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- } catch(BBObjectNotFoundException e) {
- }
- boolean networkFound = assignNetwork.networkFoundByName(execution);
- assertEquals(true, networkFound);
- }
+ @InjectMocks
+ private AssignNetwork assignNetwork = new AssignNetwork();
+
+ private L3Network network;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ network = setL3Network();
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ }
+
+ @Test
+ public void networkNotFoundTest() throws Exception {
+ // network status to PRECREATED - when it was NOT found by name
+ try {
+ network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ } catch (BBObjectNotFoundException e) {
+ }
+
+ network.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ boolean networkFound = assignNetwork.networkFoundByName(execution);
+ assertEquals(false, networkFound);
+ }
+
+ @Test
+ public void networkFoundTest() throws Exception {
+ try {
+ network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ } catch (BBObjectNotFoundException e) {
+ }
+ boolean networkFound = assignNetwork.networkFoundByName(execution);
+ assertEquals(true, networkFound);
+ }
}
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
index 834990db5a..06ad66e855 100644
--- 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
@@ -28,9 +28,7 @@ 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 java.util.List;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
@@ -48,94 +46,103 @@ import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.exception.BBObjectNotFoundException;
public class AssignVnfTest extends BaseTaskTest {
- @InjectMocks
- private AssignVnf assignVnf = new AssignVnf();
-
- @Mock
- private AAIObjectInstanceNameGenerator aaiObjectInstanceNameGenerator = new AAIObjectInstanceNameGenerator();
-
- private InstanceGroup instanceGroup1;
- private InstanceGroup instanceGroup2;
- private InstanceGroup instanceGroup3;
- private InstanceGroup instanceGroup4;
- private GenericVnf genericVnf;
-
- @Before
- public void before() throws BBObjectNotFoundException {
- ModelInfoInstanceGroup modelVnfc = new ModelInfoInstanceGroup();
- modelVnfc.setType("VNFC");
- modelVnfc.setFunction("function");
-
- ModelInfoInstanceGroup modelNetworkInstanceGroup = new ModelInfoInstanceGroup();
- modelNetworkInstanceGroup.setType("L3-NETWORK");
- 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");
-
-
- doNothing().when(aaiInstanceGroupResources).createInstanceGroup(isA(InstanceGroup.class));
- doNothing().when(aaiInstanceGroupResources).connectInstanceGroupToVnf(isA(InstanceGroup.class), isA(GenericVnf.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
- }
-
- @Test
- public void createInstanceGroupsSunnyDayTest() throws Exception {
-
- List<InstanceGroup> 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, AAIEdgeLabel.BELONGS_TO);
- verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup2, genericVnf, AAIEdgeLabel.BELONGS_TO);
- verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup3, genericVnf, AAIEdgeLabel.USES);
- verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup4, genericVnf, AAIEdgeLabel.USES);
- }
-
- @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 {
- List<InstanceGroup> instanceGroupList = genericVnf.getInstanceGroups();
- instanceGroupList.add(instanceGroup1);
- instanceGroupList.add(instanceGroup2);
- instanceGroupList.add(instanceGroup3);
- instanceGroupList.add(instanceGroup4);
- doThrow(RuntimeException.class).when(aaiInstanceGroupResources).createInstanceGroup(isA(InstanceGroup.class));
- expectedException.expect(BpmnError.class);
-
- genericVnf.setVnfId("test-999");
- assignVnf.createInstanceGroups(execution);
- }
+ @InjectMocks
+ private AssignVnf assignVnf = new AssignVnf();
+
+ @Mock
+ private AAIObjectInstanceNameGenerator aaiObjectInstanceNameGenerator = new AAIObjectInstanceNameGenerator();
+
+ private InstanceGroup instanceGroup1;
+ private InstanceGroup instanceGroup2;
+ private InstanceGroup instanceGroup3;
+ private InstanceGroup instanceGroup4;
+ private GenericVnf genericVnf;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ ModelInfoInstanceGroup modelVnfc = new ModelInfoInstanceGroup();
+ modelVnfc.setType("VNFC");
+ modelVnfc.setFunction("function");
+
+ ModelInfoInstanceGroup modelNetworkInstanceGroup = new ModelInfoInstanceGroup();
+ modelNetworkInstanceGroup.setType("L3-NETWORK");
+ 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");
+
+
+ doNothing().when(aaiInstanceGroupResources).createInstanceGroup(isA(InstanceGroup.class));
+ doNothing().when(aaiInstanceGroupResources).connectInstanceGroupToVnf(isA(InstanceGroup.class),
+ isA(GenericVnf.class));
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ }
+
+ @Test
+ public void createInstanceGroupsSunnyDayTest() throws Exception {
+
+ List<InstanceGroup> 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,
+ AAIEdgeLabel.BELONGS_TO);
+ verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup2, genericVnf,
+ AAIEdgeLabel.BELONGS_TO);
+ verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup3, genericVnf,
+ AAIEdgeLabel.USES);
+ verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup4, genericVnf,
+ AAIEdgeLabel.USES);
+ }
+
+ @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 {
+ List<InstanceGroup> instanceGroupList = genericVnf.getInstanceGroups();
+ instanceGroupList.add(instanceGroup1);
+ instanceGroupList.add(instanceGroup2);
+ instanceGroupList.add(instanceGroup3);
+ instanceGroupList.add(instanceGroup4);
+ doThrow(RuntimeException.class).when(aaiInstanceGroupResources).createInstanceGroup(isA(InstanceGroup.class));
+ 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/CloudSiteCatalogUtilsTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtilsTest.java
index 125c97109c..99516e69e3 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtilsTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtilsTest.java
@@ -25,64 +25,63 @@ import java.util.Optional;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.onap.so.bpmn.BaseTaskTest;
-
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
public class CloudSiteCatalogUtilsTest extends BaseTaskTest {
-
- @InjectMocks
- private CloudSiteCatalogUtils cloudSiteCatalogUtils = new CloudSiteCatalogUtils();
-
- @Test
- public void testGetCloudSiteGetVersion30Test() throws Exception {
- CloudSite cloudSite = new CloudSite();
- String testCloudSiteId = "testCloudSiteId";
- cloudSite.setClli(testCloudSiteId);
- doReturn(cloudSite).when(catalogDbClient).getCloudSite(testCloudSiteId);
- Optional<CloudSite> actualCloudSite = cloudSiteCatalogUtils.getCloudSite(testCloudSiteId);
- assertEquals(actualCloudSite.get().getClli(), testCloudSiteId);
- }
-
- @Test
- public void testGetCloudSiteGetVersion25Test() throws Exception {
- CloudSite cloudSite = new CloudSite();
- String testCloudSiteId = "testCloudSiteId";
- cloudSite.setClli(testCloudSiteId);
- doReturn(null).when(catalogDbClient).getCloudSite(testCloudSiteId);
- doReturn(cloudSite).when(catalogDbClient).getCloudSiteByClliAndAicVersion(testCloudSiteId, "2.5");
- Optional<CloudSite> actualCloudSite = cloudSiteCatalogUtils.getCloudSite(testCloudSiteId);
- assertEquals(actualCloudSite.get().getClli(), testCloudSiteId);
- }
-
- @Test
- public void testGetIdentityUrlFromCloudSiteSuccessTest() throws Exception {
- CloudSite cloudSite = new CloudSite();
- String testCloudSiteId = "testCloudSiteId";
- String testIdentityUrl = "testIdentityUrl";
- delegateExecution.setVariable("lcpCloudRegionId", testCloudSiteId);
- cloudSite.setClli(testCloudSiteId);
- CloudIdentity cloudIdentity = new CloudIdentity();
- cloudIdentity.setIdentityUrl(testIdentityUrl);
- cloudSite.setIdentityService(cloudIdentity);
- doReturn(cloudSite).when(catalogDbClient).getCloudSite(testCloudSiteId);
- cloudSiteCatalogUtils.getIdentityUrlFromCloudSite(delegateExecution);
- String actualIdentityUrl = (String) delegateExecution.getVariable("identityUrl");
- assertEquals(testIdentityUrl, actualIdentityUrl);
- }
-
- @Test
- public void testGetIdentityUrlFromCloudSiteNoCloudIdProvidedTest() throws Exception {
- CloudSite cloudSite = new CloudSite();
- String testCloudSiteId = "testCloudSiteId";
- String testIdentityUrl = "testIdentityUrl";
- cloudSite.setClli(testCloudSiteId);
- CloudIdentity cloudIdentity = new CloudIdentity();
- cloudIdentity.setIdentityUrl(testIdentityUrl);
- cloudSite.setIdentityService(cloudIdentity);
- doReturn(cloudSite).when(catalogDbClient).getCloudSite(testCloudSiteId);
- cloudSiteCatalogUtils.getIdentityUrlFromCloudSite(delegateExecution);
- String actualIdentityUrl = (String) delegateExecution.getVariable("identityUrl");
- assertEquals(null, actualIdentityUrl);
- }
+
+ @InjectMocks
+ private CloudSiteCatalogUtils cloudSiteCatalogUtils = new CloudSiteCatalogUtils();
+
+ @Test
+ public void testGetCloudSiteGetVersion30Test() throws Exception {
+ CloudSite cloudSite = new CloudSite();
+ String testCloudSiteId = "testCloudSiteId";
+ cloudSite.setClli(testCloudSiteId);
+ doReturn(cloudSite).when(catalogDbClient).getCloudSite(testCloudSiteId);
+ Optional<CloudSite> actualCloudSite = cloudSiteCatalogUtils.getCloudSite(testCloudSiteId);
+ assertEquals(actualCloudSite.get().getClli(), testCloudSiteId);
+ }
+
+ @Test
+ public void testGetCloudSiteGetVersion25Test() throws Exception {
+ CloudSite cloudSite = new CloudSite();
+ String testCloudSiteId = "testCloudSiteId";
+ cloudSite.setClli(testCloudSiteId);
+ doReturn(null).when(catalogDbClient).getCloudSite(testCloudSiteId);
+ doReturn(cloudSite).when(catalogDbClient).getCloudSiteByClliAndAicVersion(testCloudSiteId, "2.5");
+ Optional<CloudSite> actualCloudSite = cloudSiteCatalogUtils.getCloudSite(testCloudSiteId);
+ assertEquals(actualCloudSite.get().getClli(), testCloudSiteId);
+ }
+
+ @Test
+ public void testGetIdentityUrlFromCloudSiteSuccessTest() throws Exception {
+ CloudSite cloudSite = new CloudSite();
+ String testCloudSiteId = "testCloudSiteId";
+ String testIdentityUrl = "testIdentityUrl";
+ delegateExecution.setVariable("lcpCloudRegionId", testCloudSiteId);
+ cloudSite.setClli(testCloudSiteId);
+ CloudIdentity cloudIdentity = new CloudIdentity();
+ cloudIdentity.setIdentityUrl(testIdentityUrl);
+ cloudSite.setIdentityService(cloudIdentity);
+ doReturn(cloudSite).when(catalogDbClient).getCloudSite(testCloudSiteId);
+ cloudSiteCatalogUtils.getIdentityUrlFromCloudSite(delegateExecution);
+ String actualIdentityUrl = (String) delegateExecution.getVariable("identityUrl");
+ assertEquals(testIdentityUrl, actualIdentityUrl);
+ }
+
+ @Test
+ public void testGetIdentityUrlFromCloudSiteNoCloudIdProvidedTest() throws Exception {
+ CloudSite cloudSite = new CloudSite();
+ String testCloudSiteId = "testCloudSiteId";
+ String testIdentityUrl = "testIdentityUrl";
+ cloudSite.setClli(testCloudSiteId);
+ CloudIdentity cloudIdentity = new CloudIdentity();
+ cloudIdentity.setIdentityUrl(testIdentityUrl);
+ cloudSite.setIdentityService(cloudIdentity);
+ doReturn(cloudSite).when(catalogDbClient).getCloudSite(testCloudSiteId);
+ cloudSiteCatalogUtils.getIdentityUrlFromCloudSite(delegateExecution);
+ String actualIdentityUrl = (String) delegateExecution.getVariable("identityUrl");
+ assertEquals(null, actualIdentityUrl);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java
index 07983ccd50..7d96a18305 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java
@@ -25,9 +25,7 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.when;
-
import java.util.UUID;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnfTest.java
index e5aa702dad..6f76c83c6f 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnfTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnfTest.java
@@ -1,23 +1,18 @@
/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2019 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=========================================================
-*/
+ * ============LICENSE_START======================================================= ONAP : SO
+ * ================================================================================ Copyright 2019 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.infrastructure.flowspecific.tasks;
@@ -26,9 +21,7 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.when;
-
import java.util.UUID;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
@@ -46,52 +39,55 @@ import org.onap.so.client.exception.BBObjectNotFoundException;
public class ConfigDeployVnfTest extends BaseTaskTest {
- @InjectMocks
- private ConfigDeployVnf configDeployVnf = new ConfigDeployVnf();
- @Mock
- AAIUpdateTasks aAIUpdateTasks = new AAIUpdateTasks();
-
-
- private GenericVnf genericVnf;
- private ServiceInstance serviceInstance;
- private RequestContext requestContext;
- private String msoRequestId;
-
- @Before
- public void before() throws BBObjectNotFoundException {
- genericVnf = setGenericVnf();
- serviceInstance = setServiceInstance();
- msoRequestId = UUID.randomUUID().toString();
- requestContext = setRequestContext();
- requestContext.setMsoRequestId(msoRequestId);
- gBBInput.setRequestContext(requestContext);
-
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
- }
-
-
-
- @Test
- public void preProcessAbstractCDSProcessingTest() throws Exception {
-
- configDeployVnf.preProcessAbstractCDSProcessing(execution);
-
- assertTrue(true);
- }
-
- @Test
- public void updateAAIConfigureTaskTest() throws Exception {
-
- configDeployVnf.updateAAIConfigure(execution);
- assertTrue(true);
- }
-
- @Test
- public void updateAAIConfiguredTaskTest() throws Exception {
- configDeployVnf.updateAAIConfigured(execution);
- assertTrue(true);
- }
+ @InjectMocks
+ private ConfigDeployVnf configDeployVnf = new ConfigDeployVnf();
+ @Mock
+ AAIUpdateTasks aAIUpdateTasks = new AAIUpdateTasks();
+
+
+ private GenericVnf genericVnf;
+ private ServiceInstance serviceInstance;
+ private RequestContext requestContext;
+ private String msoRequestId;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ genericVnf = setGenericVnf();
+ serviceInstance = setServiceInstance();
+ msoRequestId = UUID.randomUUID().toString();
+ requestContext = setRequestContext();
+ requestContext.setMsoRequestId(msoRequestId);
+ gBBInput.setRequestContext(requestContext);
+
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+ }
+
+
+
+ @Test
+ public void preProcessAbstractCDSProcessingTest() throws Exception {
+
+ configDeployVnf.preProcessAbstractCDSProcessing(execution);
+
+ assertTrue(true);
+ }
+
+ @Test
+ public void updateAAIConfigureTaskTest() throws Exception {
+
+ configDeployVnf.updateAAIConfigure(execution);
+ assertTrue(true);
+ }
+
+ @Test
+ public void updateAAIConfiguredTaskTest() throws Exception {
+ configDeployVnf.updateAAIConfigured(execution);
+ assertTrue(true);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java
index 6390268a0c..4d43bbbce7 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java
@@ -28,7 +28,6 @@ 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 java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
@@ -37,7 +36,6 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
@@ -54,137 +52,153 @@ import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.db.catalog.beans.ControllerSelectionReference;
public class ConfigurationScaleOutTest extends BaseTaskTest {
-
- @InjectMocks
- private ConfigurationScaleOut configurationScaleOut = new ConfigurationScaleOut();
-
- private GenericVnf genericVnf;
- private VfModule vfModule;
- private RequestContext requestContext;
- private String msoRequestId;
- private List<Map<String, String>> configurationParameters = new ArrayList<>();
- private Map<String, String> configParamsMap = new HashMap<>();
-
-
-
- @Before
- public void before() throws BBObjectNotFoundException {
- genericVnf = setGenericVnf();
- vfModule = setVfModule();
- msoRequestId = UUID.randomUUID().toString();
- requestContext = setRequestContext();
- requestContext.setMsoRequestId(msoRequestId);
- configParamsMap.put("availability-zone", "$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]");
- configParamsMap.put("vnf-id", "$.vnf-topology.vnf-topology-identifier-structure.vnf-id");
- configurationParameters.add(configParamsMap);
- requestContext.setConfigurationParameters(configurationParameters);
- gBBInput.setRequestContext(requestContext);
-
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
-
- }
-
- @Test
- public void setParamsForConfigurationScaleOutTest() throws Exception {
- ControllerSelectionReference controllerSelectionReference = new ControllerSelectionReference();
- controllerSelectionReference.setControllerName("testName");
- controllerSelectionReference.setActionCategory("testAction");
- controllerSelectionReference.setVnfType("testVnfType");
- String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNCClientGetResponse.json")));
- String expectedPayload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"10.222.22.2\","
- + "\"vf-module-id\":\"testVfModuleId1\"},\"configuration-parameters\""
- + ":{\"vnf-id\":\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\",\"availability-zone\":\"AZ-MN02\"}}";
- execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncResponse);
-
- doReturn(controllerSelectionReference).when(catalogDbClient).getControllerSelectionReferenceByVnfTypeAndActionCategory(genericVnf.getVnfType(), Action.ConfigScaleOut.toString());
-
- configurationScaleOut.setParamsForConfigurationScaleOut(execution);
-
- assertEquals(genericVnf.getVnfId(), execution.getVariable("vnfId"));
- assertEquals(genericVnf.getVnfName(), execution.getVariable("vnfName"));
- assertEquals("ConfigScaleOut", execution.getVariable("action"));
- assertEquals(requestContext.getMsoRequestId(), execution.getVariable("msoRequestId"));
- assertEquals(controllerSelectionReference.getControllerName(), execution.getVariable("controllerType"));
- assertEquals(vfModule.getVfModuleId(), execution.getVariable("vfModuleId"));
- assertEquals(expectedPayload, execution.getVariable("payload"));
- }
- @Test
- public void callAppcClientTest() throws Exception {
- Action action = Action.ConfigScaleOut;
- String vnfId = genericVnf.getVnfId();
- String controllerType = "testType";
- String payload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"10.222.22.2\","
- + "\"vf-module-id\":\"testVfModuleId1\"},\"configuration-parameters\""
- + ":{\"vnf-id\":\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\",\"availability-zone\":\"AZ-MN02\"}}";
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- payloadInfo.put("vnfName", "testVnfName");
- payloadInfo.put("vfModuleId", "testVfModuleId");
-
- execution.setVariable("action", Action.ConfigScaleOut.toString());
- execution.setVariable("msoRequestId", msoRequestId);
- execution.setVariable("controllerType", controllerType);
- execution.setVariable("vnfId", "testVnfId1");
- execution.setVariable("vnfName", "testVnfName");
- execution.setVariable("vfModuleId", "testVfModuleId");
- execution.setVariable("payload", payload);
-
- doNothing().when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
-
- configurationScaleOut.callAppcClient(execution);
- verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
- }
- @Test
- public void setParamsForConfigurationScaleOutBadPathTest() throws Exception {
- ControllerSelectionReference controllerSelectionReference = new ControllerSelectionReference();
- controllerSelectionReference.setControllerName("testName");
- controllerSelectionReference.setActionCategory("testAction");
- controllerSelectionReference.setVnfType("testVnfType");
- String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNCClientResponseIncorrectPath.json")));
- String expectedPayload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"10.222.22.2\","
- + "\"vf-module-id\":\"testVfModuleId1\"},\"configuration-parameters\""
- + ":{\"vnf-id\":\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\",\"availability-zone\":null}}";
- execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncResponse);
-
- doReturn(controllerSelectionReference).when(catalogDbClient).getControllerSelectionReferenceByVnfTypeAndActionCategory(genericVnf.getVnfType(), Action.ConfigScaleOut.toString());
-
- configurationScaleOut.setParamsForConfigurationScaleOut(execution);
-
- assertEquals(genericVnf.getVnfId(), execution.getVariable("vnfId"));
- assertEquals(genericVnf.getVnfName(), execution.getVariable("vnfName"));
- assertEquals("ConfigScaleOut", execution.getVariable("action"));
- assertEquals(requestContext.getMsoRequestId(), execution.getVariable("msoRequestId"));
- assertEquals(controllerSelectionReference.getControllerName(), execution.getVariable("controllerType"));
- assertEquals(vfModule.getVfModuleId(), execution.getVariable("vfModuleId"));
- assertEquals(expectedPayload, execution.getVariable("payload"));
- }
-
- @Test
- public void callAppcClientExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
- Action action = Action.ConfigScaleOut;
- String vnfId = genericVnf.getVnfId();
- String controllerType = "testType";
- String payload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"10.222.22.2\","
- + "\"vf-module-id\":\"testVfModuleId1\"},\"configuration-parameters\""
- + ":{\"vnf-id\":\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\",\"availability-zone\":\"AZ-MN02\"}}";
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- payloadInfo.put("vnfName", "testVnfName");
- payloadInfo.put("vfModuleId", "testVfModuleId");
-
- execution.setVariable("action", Action.ConfigScaleOut.toString());
- execution.setVariable("msoRequestId", msoRequestId);
- execution.setVariable("controllerType", controllerType);
- execution.setVariable("vnfId", "testVnfId1");
- execution.setVariable("vnfName", "testVnfName");
- execution.setVariable("vfModuleId", "testVfModuleId");
- execution.setVariable("payload", payload);
-
-
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1002), eq("APPC Client Failed"));
- doThrow(new RuntimeException("APPC Client Failed")).when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
- configurationScaleOut.callAppcClient(execution);
- verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
- }
+
+ @InjectMocks
+ private ConfigurationScaleOut configurationScaleOut = new ConfigurationScaleOut();
+
+ private GenericVnf genericVnf;
+ private VfModule vfModule;
+ private RequestContext requestContext;
+ private String msoRequestId;
+ private List<Map<String, String>> configurationParameters = new ArrayList<>();
+ private Map<String, String> configParamsMap = new HashMap<>();
+
+
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+ msoRequestId = UUID.randomUUID().toString();
+ requestContext = setRequestContext();
+ requestContext.setMsoRequestId(msoRequestId);
+ configParamsMap.put("availability-zone",
+ "$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]");
+ configParamsMap.put("vnf-id", "$.vnf-topology.vnf-topology-identifier-structure.vnf-id");
+ configurationParameters.add(configParamsMap);
+ requestContext.setConfigurationParameters(configurationParameters);
+ gBBInput.setRequestContext(requestContext);
+
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
+ }
+
+ @Test
+ public void setParamsForConfigurationScaleOutTest() throws Exception {
+ ControllerSelectionReference controllerSelectionReference = new ControllerSelectionReference();
+ controllerSelectionReference.setControllerName("testName");
+ controllerSelectionReference.setActionCategory("testAction");
+ controllerSelectionReference.setVnfType("testVnfType");
+ String sdncResponse =
+ new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNCClientGetResponse.json")));
+ String expectedPayload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"10.222.22.2\","
+ + "\"vf-module-id\":\"testVfModuleId1\"},\"configuration-parameters\""
+ + ":{\"vnf-id\":\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\",\"availability-zone\":\"AZ-MN02\"}}";
+ execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncResponse);
+
+ doReturn(controllerSelectionReference).when(catalogDbClient)
+ .getControllerSelectionReferenceByVnfTypeAndActionCategory(genericVnf.getVnfType(),
+ Action.ConfigScaleOut.toString());
+
+ configurationScaleOut.setParamsForConfigurationScaleOut(execution);
+
+ assertEquals(genericVnf.getVnfId(), execution.getVariable("vnfId"));
+ assertEquals(genericVnf.getVnfName(), execution.getVariable("vnfName"));
+ assertEquals("ConfigScaleOut", execution.getVariable("action"));
+ assertEquals(requestContext.getMsoRequestId(), execution.getVariable("msoRequestId"));
+ assertEquals(controllerSelectionReference.getControllerName(), execution.getVariable("controllerType"));
+ assertEquals(vfModule.getVfModuleId(), execution.getVariable("vfModuleId"));
+ assertEquals(expectedPayload, execution.getVariable("payload"));
+ }
+
+ @Test
+ public void callAppcClientTest() throws Exception {
+ Action action = Action.ConfigScaleOut;
+ String vnfId = genericVnf.getVnfId();
+ String controllerType = "testType";
+ String payload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"10.222.22.2\","
+ + "\"vf-module-id\":\"testVfModuleId1\"},\"configuration-parameters\""
+ + ":{\"vnf-id\":\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\",\"availability-zone\":\"AZ-MN02\"}}";
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", "testVnfName");
+ payloadInfo.put("vfModuleId", "testVfModuleId");
+
+ execution.setVariable("action", Action.ConfigScaleOut.toString());
+ execution.setVariable("msoRequestId", msoRequestId);
+ execution.setVariable("controllerType", controllerType);
+ execution.setVariable("vnfId", "testVnfId1");
+ execution.setVariable("vnfName", "testVnfName");
+ execution.setVariable("vfModuleId", "testVfModuleId");
+ execution.setVariable("payload", payload);
+
+ doNothing().when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo,
+ controllerType);
+
+ configurationScaleOut.callAppcClient(execution);
+ verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo,
+ controllerType);
+ }
+
+ @Test
+ public void setParamsForConfigurationScaleOutBadPathTest() throws Exception {
+ ControllerSelectionReference controllerSelectionReference = new ControllerSelectionReference();
+ controllerSelectionReference.setControllerName("testName");
+ controllerSelectionReference.setActionCategory("testAction");
+ controllerSelectionReference.setVnfType("testVnfType");
+ String sdncResponse = new String(
+ Files.readAllBytes(Paths.get("src/test/resources/__files/SDNCClientResponseIncorrectPath.json")));
+ String expectedPayload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"10.222.22.2\","
+ + "\"vf-module-id\":\"testVfModuleId1\"},\"configuration-parameters\""
+ + ":{\"vnf-id\":\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\",\"availability-zone\":null}}";
+ execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncResponse);
+
+ doReturn(controllerSelectionReference).when(catalogDbClient)
+ .getControllerSelectionReferenceByVnfTypeAndActionCategory(genericVnf.getVnfType(),
+ Action.ConfigScaleOut.toString());
+
+ configurationScaleOut.setParamsForConfigurationScaleOut(execution);
+
+ assertEquals(genericVnf.getVnfId(), execution.getVariable("vnfId"));
+ assertEquals(genericVnf.getVnfName(), execution.getVariable("vnfName"));
+ assertEquals("ConfigScaleOut", execution.getVariable("action"));
+ assertEquals(requestContext.getMsoRequestId(), execution.getVariable("msoRequestId"));
+ assertEquals(controllerSelectionReference.getControllerName(), execution.getVariable("controllerType"));
+ assertEquals(vfModule.getVfModuleId(), execution.getVariable("vfModuleId"));
+ assertEquals(expectedPayload, execution.getVariable("payload"));
+ }
+
+ @Test
+ public void callAppcClientExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ Action action = Action.ConfigScaleOut;
+ String vnfId = genericVnf.getVnfId();
+ String controllerType = "testType";
+ String payload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"10.222.22.2\","
+ + "\"vf-module-id\":\"testVfModuleId1\"},\"configuration-parameters\""
+ + ":{\"vnf-id\":\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\",\"availability-zone\":\"AZ-MN02\"}}";
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", "testVnfName");
+ payloadInfo.put("vfModuleId", "testVfModuleId");
+
+ execution.setVariable("action", Action.ConfigScaleOut.toString());
+ execution.setVariable("msoRequestId", msoRequestId);
+ execution.setVariable("controllerType", controllerType);
+ execution.setVariable("vnfId", "testVnfId1");
+ execution.setVariable("vnfName", "testVnfName");
+ execution.setVariable("vfModuleId", "testVfModuleId");
+ execution.setVariable("payload", payload);
+
+
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1002), eq("APPC Client Failed"));
+ doThrow(new RuntimeException("APPC Client Failed")).when(appCClient).runAppCCommand(action, msoRequestId, vnfId,
+ Optional.of(payload), payloadInfo, controllerType);
+ configurationScaleOut.callAppcClient(execution);
+ verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo,
+ controllerType);
+ }
}
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
index 423029c59b..f0889f62c0 100644
--- 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
@@ -18,6 +18,7 @@
* ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
@@ -26,10 +27,8 @@ 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 java.util.ArrayList;
import java.util.List;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
@@ -45,73 +44,84 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
import org.onap.so.client.exception.BBObjectNotFoundException;
-public class CreateNetworkCollectionTest extends BaseTaskTest{
- @InjectMocks
- private CreateNetworkCollection createNetworkCollection = new CreateNetworkCollection();
-
- private L3Network network;
- private ServiceInstance serviceInstance;
- private OrchestrationContext orchestrationContext;
- private CloudRegion cloudRegion;
-
- @Before
- public void before() throws BBObjectNotFoundException {
- serviceInstance = setServiceInstance();
- network = setL3Network();
- cloudRegion = setCloudRegion();
-
- List<L3Network> l3NetworkList = new ArrayList<L3Network>();
- l3NetworkList.add(network);
- ModelInfoInstanceGroup modelInfoInstanceGroup = new ModelInfoInstanceGroup();
- modelInfoInstanceGroup.setFunction("function");
- serviceInstance.getCollection().getInstanceGroup().setModelInfoInstanceGroup(modelInfoInstanceGroup);
-
- orchestrationContext = setOrchestrationContext();
- orchestrationContext.setIsRollbackEnabled(true);
-
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
- }
-
- @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);
- }
-
- @Test
- public void connectInstanceGroupToCloudRegionTest() throws Exception {
- doNothing().when(aaiNetworkResources).connectInstanceGroupToCloudRegion(serviceInstance.getCollection().getInstanceGroup(), cloudRegion);
- createNetworkCollection.connectInstanceGroupToCloudRegion(execution);
- verify(aaiNetworkResources, times(1)).connectInstanceGroupToCloudRegion(serviceInstance.getCollection().getInstanceGroup(), cloudRegion);
- }
+public class CreateNetworkCollectionTest extends BaseTaskTest {
+ @InjectMocks
+ private CreateNetworkCollection createNetworkCollection = new CreateNetworkCollection();
+
+ private L3Network network;
+ private ServiceInstance serviceInstance;
+ private OrchestrationContext orchestrationContext;
+ private CloudRegion cloudRegion;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ serviceInstance = setServiceInstance();
+ network = setL3Network();
+ cloudRegion = setCloudRegion();
+
+ List<L3Network> l3NetworkList = new ArrayList<L3Network>();
+ l3NetworkList.add(network);
+ ModelInfoInstanceGroup modelInfoInstanceGroup = new ModelInfoInstanceGroup();
+ modelInfoInstanceGroup.setFunction("function");
+ serviceInstance.getCollection().getInstanceGroup().setModelInfoInstanceGroup(modelInfoInstanceGroup);
+
+ orchestrationContext = setOrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(true);
+
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+ }
+
+ @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);
+ }
+
+ @Test
+ public void connectInstanceGroupToCloudRegionTest() throws Exception {
+ doNothing().when(aaiNetworkResources)
+ .connectInstanceGroupToCloudRegion(serviceInstance.getCollection().getInstanceGroup(), cloudRegion);
+ createNetworkCollection.connectInstanceGroupToCloudRegion(execution);
+ verify(aaiNetworkResources, times(1))
+ .connectInstanceGroupToCloudRegion(serviceInstance.getCollection().getInstanceGroup(), cloudRegion);
+ }
}
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
index de1aa63f55..1e0ab20d97 100644
--- 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
@@ -26,9 +26,7 @@ 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.Map;
-
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentMatchers;
@@ -45,47 +43,51 @@ import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.springframework.beans.factory.annotation.Autowired;
-public class CreateNetworkTest extends BaseTaskTest{
- @InjectMocks
- private CreateNetwork createNetwork = new CreateNetwork();
-
- private L3Network network;
- private ServiceInstance serviceInstance;
- private CloudRegion cloudRegion;
- private OrchestrationContext orchestrationContext;
- private Map<String, String> userInput;
- private RequestContext requestContext;
- private String cloudRegionPo = "testCloudRegionPo";
- private Customer customer;
-
- @Before
- public void before() throws BBObjectNotFoundException {
- customer = setCustomer();
- serviceInstance = setServiceInstance();
- network = setL3Network();
- cloudRegion = setCloudRegion();
- orchestrationContext = setOrchestrationContext();
- orchestrationContext.setIsRollbackEnabled(true);
- requestContext = setRequestContext();
- userInput = setUserInput();
+public class CreateNetworkTest extends BaseTaskTest {
+ @InjectMocks
+ private CreateNetwork createNetwork = new CreateNetwork();
+
+ private L3Network network;
+ private ServiceInstance serviceInstance;
+ private CloudRegion cloudRegion;
+ private OrchestrationContext orchestrationContext;
+ private Map<String, String> userInput;
+ private RequestContext requestContext;
+ private String cloudRegionPo = "testCloudRegionPo";
+ private Customer customer;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ customer = setCustomer();
+ serviceInstance = setServiceInstance();
+ network = setL3Network();
+ cloudRegion = setCloudRegion();
+ orchestrationContext = setOrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(true);
+ requestContext = setRequestContext();
+ userInput = setUserInput();
+
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(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);
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(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")));
- }
+ assertThat(expectedCreateNetworkRequest, sameBeanAs(execution.getVariable("createNetworkRequest")));
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java
index 2386da743b..f23bbd8c91 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java
@@ -28,11 +28,9 @@ 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 java.util.HashMap;
import java.util.Optional;
import java.util.UUID;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Ignore;
@@ -49,128 +47,140 @@ import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.db.catalog.beans.ControllerSelectionReference;
public class GenericVnfHealthCheckTest extends BaseTaskTest {
-
- @InjectMocks
- private GenericVnfHealthCheck genericVnfHealthCheck = new GenericVnfHealthCheck();
-
- private GenericVnf genericVnf;
- private RequestContext requestContext;
- private String msoRequestId;
-
- @Before
- public void before() throws BBObjectNotFoundException {
- genericVnf = setGenericVnf();
- msoRequestId = UUID.randomUUID().toString();
- requestContext = setRequestContext();
- requestContext.setMsoRequestId(msoRequestId);
- gBBInput.setRequestContext(requestContext);
-
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- }
-
- @Test
- public void setParamsForGenericVnfHealthCheckTest() throws Exception {
- ControllerSelectionReference controllerSelectionReference = new ControllerSelectionReference();
- controllerSelectionReference.setControllerName("testName");
- controllerSelectionReference.setActionCategory("testAction");
- controllerSelectionReference.setVnfType("testVnfType");
-
- doReturn(controllerSelectionReference).when(catalogDbClient).getControllerSelectionReferenceByVnfTypeAndActionCategory(genericVnf.getVnfType(), Action.HealthCheck.toString());
-
- genericVnfHealthCheck.setParamsForGenericVnfHealthCheck(execution);
-
- assertEquals(genericVnf.getVnfId(), execution.getVariable("vnfId"));
- assertEquals(genericVnf.getVnfName(), execution.getVariable("vnfName"));
- assertEquals(genericVnf.getIpv4OamAddress(), execution.getVariable("oamIpAddress"));
- assertEquals("HealthCheck", execution.getVariable("action"));
- assertEquals(requestContext.getMsoRequestId(), execution.getVariable("msoRequestId"));
- assertEquals(controllerSelectionReference.getControllerName(), execution.getVariable("controllerType"));
- }
- @Test
- public void callAppcClientTest() throws Exception {
- Action action = Action.HealthCheck;
- String vnfId = genericVnf.getVnfId();
- String payload = "{\"testName\":\"testValue\",}";
- String controllerType = "testType";
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- payloadInfo.put("vnfName", "testVnfName");
- payloadInfo.put("vfModuleId", "testVfModuleId");
- payloadInfo.put("oamIpAddress", "testOamIpAddress");
- payloadInfo.put("vnfHostIpAddress", "testOamIpAddress");
- execution.setVariable("action", Action.HealthCheck.toString());
- execution.setVariable("msoRequestId", msoRequestId);
- execution.setVariable("controllerType", controllerType);
- execution.setVariable("vnfId", "testVnfId1");
- execution.setVariable("vnfName", "testVnfName");
- execution.setVariable("vfModuleId", "testVfModuleId");
- execution.setVariable("oamIpAddress", "testOamIpAddress");
- execution.setVariable("vnfHostIpAddress", "testOamIpAddress");
- execution.setVariable("payload", payload);
-
- doNothing().when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
-
- genericVnfHealthCheck.callAppcClient(execution);
- verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
- }
-
- @Test
- public void callAppcClientExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
- Action action = Action.HealthCheck;
- String vnfId = genericVnf.getVnfId();
- String payload = "{\"testName\":\"testValue\",}";
- String controllerType = "testType";
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- payloadInfo.put("vnfName", "testVnfName");
- payloadInfo.put("vfModuleId", "testVfModuleId");
- payloadInfo.put("oamIpAddress", "testOamIpAddress");
- payloadInfo.put("vnfHostIpAddress", "testOamIpAddress");
- execution.setVariable("action", Action.HealthCheck.toString());
- execution.setVariable("msoRequestId", msoRequestId);
- execution.setVariable("controllerType", controllerType);
- execution.setVariable("vnfId", "testVnfId1");
- execution.setVariable("vnfName", "testVnfName");
- execution.setVariable("vfModuleId", "testVfModuleId");
- execution.setVariable("oamIpAddress", "testOamIpAddress");
- execution.setVariable("vnfHostIpAddress", "testOamIpAddress");
- execution.setVariable("payload", payload);
-
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1002), eq("APPC Client Failed"));
- doThrow(new RuntimeException("APPC Client Failed")).when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
-
-
- genericVnfHealthCheck.callAppcClient(execution);
- verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
- }
-
- @Test
- @Ignore //The runAppCCommand method in not capable of throwing this exception
- public void callAppcClientTimeOutExceptionTest() {
- expectedException.expect(java.util.concurrent.TimeoutException.class);
- Action action = Action.HealthCheck;
- String vnfId = genericVnf.getVnfId();
- String payload = "{\"testName\":\"testValue\",}";
- String controllerType = "testType";
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- payloadInfo.put("vnfName", "testVnfName");
- payloadInfo.put("vfModuleId", "testVfModuleId");
- payloadInfo.put("oamIpAddress", "testOamIpAddress");
- payloadInfo.put("vnfHostIpAddress", "testOamIpAddress");
- execution.setVariable("action", Action.HealthCheck.toString());
- execution.setVariable("msoRequestId", msoRequestId);
- execution.setVariable("controllerType", controllerType);
- execution.setVariable("vnfId", "testVnfId1");
- execution.setVariable("vnfName", "testVnfName");
- execution.setVariable("vfModuleId", "testVfModuleId");
- execution.setVariable("oamIpAddress", "testOamIpAddress");
- execution.setVariable("vnfHostIpAddress", "testOamIpAddress");
- execution.setVariable("payload", payload);
-
- doThrow(java.util.concurrent.TimeoutException.class).when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
-
-
- genericVnfHealthCheck.callAppcClient(execution);
- verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
- }
+
+ @InjectMocks
+ private GenericVnfHealthCheck genericVnfHealthCheck = new GenericVnfHealthCheck();
+
+ private GenericVnf genericVnf;
+ private RequestContext requestContext;
+ private String msoRequestId;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ genericVnf = setGenericVnf();
+ msoRequestId = UUID.randomUUID().toString();
+ requestContext = setRequestContext();
+ requestContext.setMsoRequestId(msoRequestId);
+ gBBInput.setRequestContext(requestContext);
+
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ }
+
+ @Test
+ public void setParamsForGenericVnfHealthCheckTest() throws Exception {
+ ControllerSelectionReference controllerSelectionReference = new ControllerSelectionReference();
+ controllerSelectionReference.setControllerName("testName");
+ controllerSelectionReference.setActionCategory("testAction");
+ controllerSelectionReference.setVnfType("testVnfType");
+
+ doReturn(controllerSelectionReference).when(catalogDbClient)
+ .getControllerSelectionReferenceByVnfTypeAndActionCategory(genericVnf.getVnfType(),
+ Action.HealthCheck.toString());
+
+ genericVnfHealthCheck.setParamsForGenericVnfHealthCheck(execution);
+
+ assertEquals(genericVnf.getVnfId(), execution.getVariable("vnfId"));
+ assertEquals(genericVnf.getVnfName(), execution.getVariable("vnfName"));
+ assertEquals(genericVnf.getIpv4OamAddress(), execution.getVariable("oamIpAddress"));
+ assertEquals("HealthCheck", execution.getVariable("action"));
+ assertEquals(requestContext.getMsoRequestId(), execution.getVariable("msoRequestId"));
+ assertEquals(controllerSelectionReference.getControllerName(), execution.getVariable("controllerType"));
+ }
+
+ @Test
+ public void callAppcClientTest() throws Exception {
+ Action action = Action.HealthCheck;
+ String vnfId = genericVnf.getVnfId();
+ String payload = "{\"testName\":\"testValue\",}";
+ String controllerType = "testType";
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", "testVnfName");
+ payloadInfo.put("vfModuleId", "testVfModuleId");
+ payloadInfo.put("oamIpAddress", "testOamIpAddress");
+ payloadInfo.put("vnfHostIpAddress", "testOamIpAddress");
+ execution.setVariable("action", Action.HealthCheck.toString());
+ execution.setVariable("msoRequestId", msoRequestId);
+ execution.setVariable("controllerType", controllerType);
+ execution.setVariable("vnfId", "testVnfId1");
+ execution.setVariable("vnfName", "testVnfName");
+ execution.setVariable("vfModuleId", "testVfModuleId");
+ execution.setVariable("oamIpAddress", "testOamIpAddress");
+ execution.setVariable("vnfHostIpAddress", "testOamIpAddress");
+ execution.setVariable("payload", payload);
+
+ doNothing().when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo,
+ controllerType);
+
+ genericVnfHealthCheck.callAppcClient(execution);
+ verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo,
+ controllerType);
+ }
+
+ @Test
+ public void callAppcClientExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ Action action = Action.HealthCheck;
+ String vnfId = genericVnf.getVnfId();
+ String payload = "{\"testName\":\"testValue\",}";
+ String controllerType = "testType";
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", "testVnfName");
+ payloadInfo.put("vfModuleId", "testVfModuleId");
+ payloadInfo.put("oamIpAddress", "testOamIpAddress");
+ payloadInfo.put("vnfHostIpAddress", "testOamIpAddress");
+ execution.setVariable("action", Action.HealthCheck.toString());
+ execution.setVariable("msoRequestId", msoRequestId);
+ execution.setVariable("controllerType", controllerType);
+ execution.setVariable("vnfId", "testVnfId1");
+ execution.setVariable("vnfName", "testVnfName");
+ execution.setVariable("vfModuleId", "testVfModuleId");
+ execution.setVariable("oamIpAddress", "testOamIpAddress");
+ execution.setVariable("vnfHostIpAddress", "testOamIpAddress");
+ execution.setVariable("payload", payload);
+
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1002), eq("APPC Client Failed"));
+ doThrow(new RuntimeException("APPC Client Failed")).when(appCClient).runAppCCommand(action, msoRequestId, vnfId,
+ Optional.of(payload), payloadInfo, controllerType);
+
+
+ genericVnfHealthCheck.callAppcClient(execution);
+ verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo,
+ controllerType);
+ }
+
+ @Test
+ @Ignore // The runAppCCommand method in not capable of throwing this exception
+ public void callAppcClientTimeOutExceptionTest() {
+ expectedException.expect(java.util.concurrent.TimeoutException.class);
+ Action action = Action.HealthCheck;
+ String vnfId = genericVnf.getVnfId();
+ String payload = "{\"testName\":\"testValue\",}";
+ String controllerType = "testType";
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", "testVnfName");
+ payloadInfo.put("vfModuleId", "testVfModuleId");
+ payloadInfo.put("oamIpAddress", "testOamIpAddress");
+ payloadInfo.put("vnfHostIpAddress", "testOamIpAddress");
+ execution.setVariable("action", Action.HealthCheck.toString());
+ execution.setVariable("msoRequestId", msoRequestId);
+ execution.setVariable("controllerType", controllerType);
+ execution.setVariable("vnfId", "testVnfId1");
+ execution.setVariable("vnfName", "testVnfName");
+ execution.setVariable("vfModuleId", "testVfModuleId");
+ execution.setVariable("oamIpAddress", "testOamIpAddress");
+ execution.setVariable("vnfHostIpAddress", "testOamIpAddress");
+ execution.setVariable("payload", payload);
+
+ doThrow(java.util.concurrent.TimeoutException.class).when(appCClient).runAppCCommand(action, msoRequestId,
+ vnfId, Optional.of(payload), payloadInfo, controllerType);
+
+
+ genericVnfHealthCheck.callAppcClient(execution);
+ verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo,
+ controllerType);
+ }
}
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
index bf9be282d4..5eafb982e6 100644
--- 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
@@ -23,11 +23,9 @@ 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.InjectMocks;
@@ -38,82 +36,84 @@ 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{
- @InjectMocks
- private NetworkBBUtils networkBBUtils = new 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> 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> 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);
- }
+public class NetworkBBUtilsTest extends BaseTaskTest {
+ @InjectMocks
+ private NetworkBBUtils networkBBUtils = new 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> 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> 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/SniroHomingV2IT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java
index b50cd69f73..8d51ceb65f 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java
@@ -29,11 +29,9 @@ import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.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;
@@ -53,443 +51,542 @@ 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 SniroHomingV2IT extends BaseIntegrationTest{
+public class SniroHomingV2IT extends BaseIntegrationTest {
+
+ 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("testSubscriptionServiceType");
+ 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.setIdentifierType(CandidateType.VNF_ID);
+ List<String> c = new ArrayList<String>();
+ c.add("testVnfId");
+ requiredCandidate.setIdentifiers(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");
+
+ wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
+
+ sniroHoming.callSniro(execution);
+
+ String request = readResourceFile(RESOURCE_PATH + "SniroManagerRequest1Vpn.json");
+ request = request.replace("28080", wireMockPort);
+
+ ArgumentCaptor<SniroManagerRequest> 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");
+
+ wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
+
+ sniroHoming.callSniro(execution);
+
+ String request = readResourceFile(RESOURCE_PATH + "SniroManagerRequest3Vpn.json");
+ request = request.replace("28080", wireMockPort);
+
+ ArgumentCaptor<SniroManagerRequest> 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();
- private ServiceInstance serviceInstance;
+ wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
- private RequestContext requestContext;
+ sniroHoming.callSniro(execution);
- private Customer customer;
- ObjectMapper mapper = new ObjectMapper();
+ String request = readResourceFile(RESOURCE_PATH + "SniroManagerRequest3AR.json");
+ request = request.replace("28080", wireMockPort);
- private static final String RESOURCE_PATH = "__files/BuildingBlocks/SniroHoming/";
+ ArgumentCaptor<SniroManagerRequest> 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();
- String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"corys cool\", \"requestStatus\": \"accepted\"}";
+ wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
- @Before
- public void before() {
- serviceInstance = setServiceInstance();
- customer = setCustomer();
- customer.setGlobalCustomerId("testCustomerId");
- customer.setSubscriberName("testCustomerName");
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ sniroHoming.callSniro(execution);
- requestContext = setRequestContext();
- requestContext.setMsoRequestId("testRequestId");
- RequestParameters params = new RequestParameters();
- params.setaLaCarte(false);
- params.setSubscriptionServiceType("testSubscriptionServiceType");
- requestContext.setRequestParameters(params);
- }
+ ArgumentCaptor<SniroManagerRequest> argument = ArgumentCaptor.forClass(SniroManagerRequest.class);
+ verify(sniroClient, times(1)).postDemands(argument.capture());
+ // TODO assertEquals(request, argument.getValue().toJsonString());
+ }
- 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.setIdentifierType(CandidateType.VNF_ID);
- List<String> c = new ArrayList<String>();
- c.add("testVnfId");
- requiredCandidate.setIdentifiers(c);
- sp2.addRequiredCandidates(requiredCandidate);
- bondingLink.getServiceProxies().add(sp2);
- serviceInstance.getVpnBondingLinks().add(bondingLink);
+ @Test
+ public void testCallSniro_success_3Allotteds1Vnf() throws JsonProcessingException, BadResponseException {
+ beforeAllottedResource();
+ beforeVnf();
- }
+ wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
- public void beforeAllottedResource(){
- serviceInstance.getAllottedResources().add(setAllottedResource("1"));
- serviceInstance.getAllottedResources().add(setAllottedResource("2"));
- serviceInstance.getAllottedResources().add(setAllottedResource("3"));
- }
+ sniroHoming.callSniro(execution);
- public void beforeVnf(){
- setGenericVnf();
- }
+ verify(sniroClient, times(1)).postDemands(isA(SniroManagerRequest.class));
+ }
@Test(expected = Test.None.class)
- public void testCallSniro_success_1VpnLink() throws BadResponseException, IOException{
- beforeVpnBondingLink("1");
-
- wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
-
- sniroHoming.callSniro(execution);
-
- String request = readResourceFile(RESOURCE_PATH + "SniroManagerRequest1Vpn.json");
- request = request.replace("28080", wireMockPort);
-
- ArgumentCaptor<SniroManagerRequest> 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");
-
- wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
-
- sniroHoming.callSniro(execution);
-
- String request = readResourceFile(RESOURCE_PATH + "SniroManagerRequest3Vpn.json");
- request = request.replace("28080", wireMockPort);
-
- ArgumentCaptor<SniroManagerRequest> 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();
-
- wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
-
- sniroHoming.callSniro(execution);
-
- String request = readResourceFile(RESOURCE_PATH + "SniroManagerRequest3AR.json");
- request = request.replace("28080", wireMockPort);
-
- ArgumentCaptor<SniroManagerRequest> 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();
-
- wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
-
- sniroHoming.callSniro(execution);
-
- ArgumentCaptor<SniroManagerRequest> 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();
-
- wireMockServer.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("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("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("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("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("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("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("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("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("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("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("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("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\"}";
- wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
-
- sniroHoming.callSniro(execution);
+ 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("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("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("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("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("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("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("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("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("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("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("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("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\"}";
+ wireMockServer.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));
- }
+ verify(sniroClient, times(1)).postDemands(isA(SniroManagerRequest.class));
+ }
}
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
index ecdf11bd05..bacc57758b 100644
--- 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
@@ -27,11 +27,9 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
-
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Optional;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
@@ -47,71 +45,77 @@ import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.springframework.beans.factory.annotation.Autowired;
public class UnassignNetworkBBTest extends BaseTaskTest {
-
- @Mock
- private NetworkBBUtils networkBBUtils;
- @InjectMocks
- private UnassignNetworkBB unassignNetworkBB = new UnassignNetworkBB();
-
- private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/Network/";
- private L3Network network;
-
- @Before
- public void setup(){
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
- }
-
- @Test
- public void checkRelationshipRelatedToTrueTest() throws Exception {
- expectedException.expect(BpmnError.class);
- network = setL3Network();
- network.setNetworkId("testNetworkId1");
- final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "unassignNetworkBB_queryAAIResponse_.json")));
- AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse);
- Optional<org.onap.aai.domain.yang.L3Network> l3network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
-
- doReturn(network).when(extractPojosForBB).extractByKey(execution, ResourceKey.NETWORK_ID);
- doReturn(aaiResultWrapper).when(aaiNetworkResources).queryNetworkWrapperById(network);
-
- doReturn(true).when(networkBBUtils).isRelationshipRelatedToExists(any(Optional.class), eq("vf-module"));
-
- unassignNetworkBB.checkRelationshipRelatedTo(execution, "vf-module");
- assertThat(execution.getVariable("ErrorUnassignNetworkBB"), notNullValue());
- }
-
- @Test
- public void getCloudSdncRegion25Test() throws Exception {
- CloudRegion cloudRegion = setCloudRegion();
- cloudRegion.setCloudRegionVersion("2.5");
- doReturn("AAIAIC25").when(networkBBUtils).getCloudRegion(execution, SourceSystem.SDNC);
- unassignNetworkBB.getCloudSdncRegion(execution);
- assertEquals("AAIAIC25", execution.getVariable("cloudRegionSdnc"));
- }
-
- @Test
- public void getCloudSdncRegion30Test() throws Exception {
- CloudRegion cloudRegion = setCloudRegion();
- cloudRegion.setCloudRegionVersion("3.0");
- gBBInput.setCloudRegion(cloudRegion);
- doReturn(cloudRegion.getLcpCloudRegionId()).when(networkBBUtils).getCloudRegion(execution, SourceSystem.SDNC);
- 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);
- }
+ @Mock
+ private NetworkBBUtils networkBBUtils;
+
+ @InjectMocks
+ private UnassignNetworkBB unassignNetworkBB = new UnassignNetworkBB();
+
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/Network/";
+ private L3Network network;
+
+ @Before
+ public void setup() {
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ }
+
+ @Test
+ public void checkRelationshipRelatedToTrueTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ network = setL3Network();
+ network.setNetworkId("testNetworkId1");
+ final String aaiResponse = new String(
+ Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "unassignNetworkBB_queryAAIResponse_.json")));
+ AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse);
+ Optional<org.onap.aai.domain.yang.L3Network> l3network =
+ aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
+
+ doReturn(network).when(extractPojosForBB).extractByKey(execution, ResourceKey.NETWORK_ID);
+ doReturn(aaiResultWrapper).when(aaiNetworkResources).queryNetworkWrapperById(network);
+
+ doReturn(true).when(networkBBUtils).isRelationshipRelatedToExists(any(Optional.class), eq("vf-module"));
+
+ unassignNetworkBB.checkRelationshipRelatedTo(execution, "vf-module");
+ assertThat(execution.getVariable("ErrorUnassignNetworkBB"), notNullValue());
+ }
+
+ @Test
+ public void getCloudSdncRegion25Test() throws Exception {
+ CloudRegion cloudRegion = setCloudRegion();
+ cloudRegion.setCloudRegionVersion("2.5");
+ doReturn("AAIAIC25").when(networkBBUtils).getCloudRegion(execution, SourceSystem.SDNC);
+ unassignNetworkBB.getCloudSdncRegion(execution);
+ assertEquals("AAIAIC25", execution.getVariable("cloudRegionSdnc"));
+ }
+
+ @Test
+ public void getCloudSdncRegion30Test() throws Exception {
+ CloudRegion cloudRegion = setCloudRegion();
+ cloudRegion.setCloudRegionVersion("3.0");
+ gBBInput.setCloudRegion(cloudRegion);
+ doReturn(cloudRegion.getLcpCloudRegionId()).when(networkBBUtils).getCloudRegion(execution, SourceSystem.SDNC);
+ 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
index 394ffcf0ac..b4cb214483 100644
--- 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
@@ -28,7 +28,6 @@ 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;
@@ -41,43 +40,46 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
-public class UnassignVnfTest extends BaseTaskTest{
- @InjectMocks
- private UnassignVnf unassignVnf = new UnassignVnf();
-
- @Before
- public void setup(){
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
-
- }
+public class UnassignVnfTest extends BaseTaskTest {
+ @InjectMocks
+ private UnassignVnf unassignVnf = new UnassignVnf();
+
+ @Before
+ public void setup() {
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+
+ }
+
+ @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);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ 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);
- @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);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- 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);
- }
+ unassignVnf.deleteInstanceGroups(execution);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
index 5e9565446f..f9ad473e5a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
@@ -6,10 +6,8 @@ import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-
import java.util.HashMap;
import java.util.Map;
-
import org.camunda.bpm.engine.ProcessEngineServices;
import org.camunda.bpm.engine.TaskService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -23,76 +21,76 @@ import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.db.request.beans.InfraActiveRequests;
public class ManualHandlingTasksTest extends BaseTaskTest {
- @InjectMocks
- protected ManualHandlingTasks manualHandlingTasks = new ManualHandlingTasks();
-
- @Mock
- TaskService taskService;
-
- @Mock
- private DelegateExecution mockExecution;
-
- @Mock
- ProcessEngineServices processEngineServices;
-
- @Mock
- private DelegateTask task;
-
- private DelegateExecution delegateExecution;
-
- @Before
- public void before() throws Exception {
- delegateExecution = new DelegateExecutionFake();
- }
-
- @Test
- public void setFalloutTaskVariables_Test () {
- when(task.getId()).thenReturn("taskId");
- when(task.getExecution()).thenReturn(mockExecution);
- when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices);
- when(processEngineServices.getTaskService()).thenReturn(taskService);
- manualHandlingTasks.setFalloutTaskVariables(task);
- verify(taskService, times(1)).setVariables(any(String.class), any(Map.class));
- }
-
- @Test
- public void setPauseTaskVariables_Test () {
- when(task.getId()).thenReturn("taskId");
- when(task.getExecution()).thenReturn(mockExecution);
- when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices);
- when(processEngineServices.getTaskService()).thenReturn(taskService);
- manualHandlingTasks.setPauseTaskVariables(task);
- verify(taskService, times(1)).setVariables(any(String.class), any(Map.class));
- }
-
- @Test
- public void completeTask_Test() throws Exception{
- when(task.getId()).thenReturn("taskId");
- when(task.getExecution()).thenReturn(mockExecution);
- Map<String, Object> taskVariables = new HashMap<String, Object>();
- taskVariables.put("responseValue", "resume");
- when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices);
- when(processEngineServices.getTaskService()).thenReturn(taskService);
- when(taskService.getVariables(any(String.class))).thenReturn(taskVariables);
- manualHandlingTasks.completeTask(task);
- verify(mockExecution, times(1)).setVariable("responseValueTask", "Resume");
- }
-
- @Test
- public void updateRequestDbStatus_Test() throws Exception{
- InfraActiveRequests mockedRequest = new InfraActiveRequests();
- delegateExecution.setVariable("msoRequestId", "testMsoRequestId");
- when(requestsDbClient.getInfraActiveRequestbyRequestId(any(String.class))).thenReturn(mockedRequest);
- doNothing().when(requestsDbClient).updateInfraActiveRequests(any(InfraActiveRequests.class));
- manualHandlingTasks.updateRequestDbStatus(delegateExecution, "IN_PROGRESS");
- verify(requestsDbClient, times(1)).updateInfraActiveRequests(any(InfraActiveRequests.class));
- assertEquals(mockedRequest.getRequestStatus(), "IN_PROGRESS");
- }
-
- @Test
- public void createExternalTicket_Test() throws Exception{
- delegateExecution.setVariable("msoRequestId", ("testMsoRequestId"));
- delegateExecution.setVariable("vnfType", "testVnfType");
- manualHandlingTasks.createExternalTicket(delegateExecution);
- }
+ @InjectMocks
+ protected ManualHandlingTasks manualHandlingTasks = new ManualHandlingTasks();
+
+ @Mock
+ TaskService taskService;
+
+ @Mock
+ private DelegateExecution mockExecution;
+
+ @Mock
+ ProcessEngineServices processEngineServices;
+
+ @Mock
+ private DelegateTask task;
+
+ private DelegateExecution delegateExecution;
+
+ @Before
+ public void before() throws Exception {
+ delegateExecution = new DelegateExecutionFake();
+ }
+
+ @Test
+ public void setFalloutTaskVariables_Test() {
+ when(task.getId()).thenReturn("taskId");
+ when(task.getExecution()).thenReturn(mockExecution);
+ when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices);
+ when(processEngineServices.getTaskService()).thenReturn(taskService);
+ manualHandlingTasks.setFalloutTaskVariables(task);
+ verify(taskService, times(1)).setVariables(any(String.class), any(Map.class));
+ }
+
+ @Test
+ public void setPauseTaskVariables_Test() {
+ when(task.getId()).thenReturn("taskId");
+ when(task.getExecution()).thenReturn(mockExecution);
+ when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices);
+ when(processEngineServices.getTaskService()).thenReturn(taskService);
+ manualHandlingTasks.setPauseTaskVariables(task);
+ verify(taskService, times(1)).setVariables(any(String.class), any(Map.class));
+ }
+
+ @Test
+ public void completeTask_Test() throws Exception {
+ when(task.getId()).thenReturn("taskId");
+ when(task.getExecution()).thenReturn(mockExecution);
+ Map<String, Object> taskVariables = new HashMap<String, Object>();
+ taskVariables.put("responseValue", "resume");
+ when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices);
+ when(processEngineServices.getTaskService()).thenReturn(taskService);
+ when(taskService.getVariables(any(String.class))).thenReturn(taskVariables);
+ manualHandlingTasks.completeTask(task);
+ verify(mockExecution, times(1)).setVariable("responseValueTask", "Resume");
+ }
+
+ @Test
+ public void updateRequestDbStatus_Test() throws Exception {
+ InfraActiveRequests mockedRequest = new InfraActiveRequests();
+ delegateExecution.setVariable("msoRequestId", "testMsoRequestId");
+ when(requestsDbClient.getInfraActiveRequestbyRequestId(any(String.class))).thenReturn(mockedRequest);
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(any(InfraActiveRequests.class));
+ manualHandlingTasks.updateRequestDbStatus(delegateExecution, "IN_PROGRESS");
+ verify(requestsDbClient, times(1)).updateInfraActiveRequests(any(InfraActiveRequests.class));
+ assertEquals(mockedRequest.getRequestStatus(), "IN_PROGRESS");
+ }
+
+ @Test
+ public void createExternalTicket_Test() throws Exception {
+ delegateExecution.setVariable("msoRequestId", ("testMsoRequestId"));
+ delegateExecution.setVariable("vnfType", "testVnfType");
+ manualHandlingTasks.createExternalTicket(delegateExecution);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java
index 67c48d1e91..f5785f94fd 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java
@@ -27,7 +27,6 @@ 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.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentMatchers;
@@ -38,44 +37,50 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.client.exception.BBObjectNotFoundException;
public class NamingServiceCreateTasksTest extends BaseTaskTest {
- @InjectMocks
- private NamingServiceCreateTasks namingServiceCreateTasks = new NamingServiceCreateTasks();
-
- private InstanceGroup instanceGroup;
-
- @Before
- public void before() throws BBObjectNotFoundException {
- instanceGroup = setInstanceGroup();
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID))).thenReturn(instanceGroup);
- }
-
- @Test
- public void createInstanceGroupTest() throws Exception {
- String policyInstanceName = "policyInstanceName";
- String nfNamingCode = "nfNamingCode";
- String generatedName = "generatedInstanceGroupName";
- execution.setVariable(policyInstanceName, policyInstanceName);
- execution.setVariable(nfNamingCode, nfNamingCode);
- doReturn(generatedName).when(namingServiceResources).generateInstanceGroupName(instanceGroup, policyInstanceName, nfNamingCode);
-
- namingServiceCreateTasks.createInstanceGroupName(execution);
- verify(namingServiceResources, times(1)).generateInstanceGroupName(instanceGroup, policyInstanceName, nfNamingCode);
- assertEquals(instanceGroup.getInstanceGroupName(), generatedName);
- }
-
- @Test
- public void createInstanceGroupExceptionTest() throws Exception {
- expectedException.expect(BBObjectNotFoundException.class);
- lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, "notfound");
- doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID));
- String policyInstanceName = "policyInstanceName";
- String nfNamingCode = "nfNamingCode";
- execution.setVariable(policyInstanceName, policyInstanceName);
- execution.setVariable(nfNamingCode, nfNamingCode);
- doReturn("").when(namingServiceResources).generateInstanceGroupName(instanceGroup, policyInstanceName, nfNamingCode);
- namingServiceCreateTasks.createInstanceGroupName(execution);
- verify(namingServiceResources, times(1)).generateInstanceGroupName(instanceGroup, policyInstanceName, nfNamingCode);
-
- }
-
+ @InjectMocks
+ private NamingServiceCreateTasks namingServiceCreateTasks = new NamingServiceCreateTasks();
+
+ private InstanceGroup instanceGroup;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ instanceGroup = setInstanceGroup();
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID)))
+ .thenReturn(instanceGroup);
+ }
+
+ @Test
+ public void createInstanceGroupTest() throws Exception {
+ String policyInstanceName = "policyInstanceName";
+ String nfNamingCode = "nfNamingCode";
+ String generatedName = "generatedInstanceGroupName";
+ execution.setVariable(policyInstanceName, policyInstanceName);
+ execution.setVariable(nfNamingCode, nfNamingCode);
+ doReturn(generatedName).when(namingServiceResources).generateInstanceGroupName(instanceGroup,
+ policyInstanceName, nfNamingCode);
+
+ namingServiceCreateTasks.createInstanceGroupName(execution);
+ verify(namingServiceResources, times(1)).generateInstanceGroupName(instanceGroup, policyInstanceName,
+ nfNamingCode);
+ assertEquals(instanceGroup.getInstanceGroupName(), generatedName);
+ }
+
+ @Test
+ public void createInstanceGroupExceptionTest() throws Exception {
+ expectedException.expect(BBObjectNotFoundException.class);
+ lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, "notfound");
+ doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),
+ ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID));
+ String policyInstanceName = "policyInstanceName";
+ String nfNamingCode = "nfNamingCode";
+ execution.setVariable(policyInstanceName, policyInstanceName);
+ execution.setVariable(nfNamingCode, nfNamingCode);
+ doReturn("").when(namingServiceResources).generateInstanceGroupName(instanceGroup, policyInstanceName,
+ nfNamingCode);
+ namingServiceCreateTasks.createInstanceGroupName(execution);
+ verify(namingServiceResources, times(1)).generateInstanceGroupName(instanceGroup, policyInstanceName,
+ nfNamingCode);
+
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasksTest.java
index 56226dfa96..758b8f4ffd 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasksTest.java
@@ -26,7 +26,6 @@ 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.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentMatchers;
@@ -37,34 +36,36 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.client.exception.BBObjectNotFoundException;
public class NamingServiceDeleteTasksTest extends BaseTaskTest {
- @InjectMocks
- private NamingServiceDeleteTasks namingServiceDeleteTasks = new NamingServiceDeleteTasks();
-
- private InstanceGroup instanceGroup;
-
- @Before
- public void before() throws BBObjectNotFoundException {
- instanceGroup = setInstanceGroup();
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID))).thenReturn(instanceGroup);
- }
-
- @Test
- public void deleteInstanceGroupTest() throws Exception {
-
- doReturn("").when(namingServiceResources).deleteInstanceGroupName(instanceGroup);
-
- namingServiceDeleteTasks.deleteInstanceGroupName(execution);
- verify(namingServiceResources, times(1)).deleteInstanceGroupName(instanceGroup);
- }
-
- @Test
- public void deleteInstanceGroupExceptionTest() throws Exception {
- expectedException.expect(BBObjectNotFoundException.class);
- lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, "notfound");
- doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID));
- doReturn("").when(namingServiceResources).deleteInstanceGroupName(instanceGroup);
- namingServiceDeleteTasks.deleteInstanceGroupName(execution);
- verify(namingServiceResources, times(1)).deleteInstanceGroupName(instanceGroup);
- }
-
+ @InjectMocks
+ private NamingServiceDeleteTasks namingServiceDeleteTasks = new NamingServiceDeleteTasks();
+
+ private InstanceGroup instanceGroup;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ instanceGroup = setInstanceGroup();
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID)))
+ .thenReturn(instanceGroup);
+ }
+
+ @Test
+ public void deleteInstanceGroupTest() throws Exception {
+
+ doReturn("").when(namingServiceResources).deleteInstanceGroupName(instanceGroup);
+
+ namingServiceDeleteTasks.deleteInstanceGroupName(execution);
+ verify(namingServiceResources, times(1)).deleteInstanceGroupName(instanceGroup);
+ }
+
+ @Test
+ public void deleteInstanceGroupExceptionTest() throws Exception {
+ expectedException.expect(BBObjectNotFoundException.class);
+ lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, "notfound");
+ doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),
+ ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID));
+ doReturn("").when(namingServiceResources).deleteInstanceGroupName(instanceGroup);
+ namingServiceDeleteTasks.deleteInstanceGroupName(execution);
+ verify(namingServiceResources, times(1)).deleteInstanceGroupName(instanceGroup);
+ }
+
}
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
index cbd7605aa4..4eb1432bbf 100644
--- 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
@@ -29,7 +29,6 @@ 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;
@@ -52,84 +51,98 @@ import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.sdnc.beans.SDNCRequest;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
-public class SDNCActivateTaskTest extends BaseTaskTest{
-
- @InjectMocks
- private SDNCActivateTasks sdncActivateTasks = new 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() throws BBObjectNotFoundException {
- serviceInstance = setServiceInstance();
- network = setL3Network();
- genericVnf = setGenericVnf();
- vfModule = setVfModule();
- cloudRegion = setCloudRegion();
- requestContext = setRequestContext();
- customer = setCustomer();
+public class SDNCActivateTaskTest extends BaseTaskTest {
+
+ @InjectMocks
+ private SDNCActivateTasks sdncActivateTasks = new 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() throws BBObjectNotFoundException {
+ serviceInstance = setServiceInstance();
+ network = setL3Network();
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+ cloudRegion = setCloudRegion();
+ requestContext = setRequestContext();
+ customer = setCustomer();
+
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+
+ }
+
+ @Test
+ public void activateVnfTest() throws Exception {
+ doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).activateVnf(genericVnf,
+ serviceInstance, customer, cloudRegion, requestContext);
+ sdncActivateTasks.activateVnf(execution);
+ verify(sdncVnfResources, times(1)).activateVnf(genericVnf, serviceInstance, customer, cloudRegion,
+ requestContext);
+ SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
+ assertEquals(SDNCTopology.VNF, sdncRequest.getTopology());
+ }
+
+ @Test
+ public void activateVnfTestException() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.class).when(sdncVnfResources).activateVnf(genericVnf, serviceInstance, customer,
+ cloudRegion, requestContext);
+ sdncActivateTasks.activateVnf(execution);
+ }
+
+ @Test
+ public void activateNetworkTest() throws Exception {
+ doReturn(new GenericResourceApiNetworkOperationInformation()).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);
+ SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
+ assertEquals(SDNCTopology.NETWORK, sdncRequest.getTopology());
+ }
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
+ @Test
+ public void activateNetworkExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.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(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources)
+ .activateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ sdncActivateTasks.activateVfModule(execution);
+ verify(sdncVfModuleResources, times(1)).activateVfModule(vfModule, genericVnf, serviceInstance, customer,
+ cloudRegion, requestContext);
+ SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
+ assertEquals(SDNCTopology.VFMODULE, sdncRequest.getTopology());
+ }
- @Test
- public void activateVnfTest() throws Exception {
- doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).activateVnf(genericVnf,serviceInstance, customer, cloudRegion,requestContext);
- sdncActivateTasks.activateVnf(execution);
- verify(sdncVnfResources, times(1)).activateVnf(genericVnf,serviceInstance, customer,cloudRegion,requestContext);
- SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
- assertEquals(SDNCTopology.VNF,sdncRequest.getTopology());
- }
-
- @Test
- public void activateVnfTestException() throws Exception {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVnfResources).activateVnf(genericVnf,serviceInstance, customer,cloudRegion,requestContext);
- sdncActivateTasks.activateVnf(execution);
- }
-
- @Test
- public void activateNetworkTest() throws Exception {
- doReturn(new GenericResourceApiNetworkOperationInformation()).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);
- SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
- assertEquals(SDNCTopology.NETWORK,sdncRequest.getTopology());
- }
-
- @Test
- public void activateNetworkExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.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(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).activateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- sdncActivateTasks.activateVfModule(execution);
- verify(sdncVfModuleResources, times(1)).activateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
- assertEquals(SDNCTopology.VFMODULE,sdncRequest.getTopology());
- }
-
- @Test
- public void activateVfModuleTestException() throws Exception {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVfModuleResources).activateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- sdncActivateTasks.activateVfModule(execution);
- }
+ @Test
+ public void activateVfModuleTestException() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.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
index b5509b1e12..7d8e94d1e9 100644
--- 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
@@ -28,7 +28,6 @@ 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;
@@ -54,101 +53,117 @@ import org.onap.so.client.sdnc.beans.SDNCRequest;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
-public class SDNCAssignTasksTest extends BaseTaskTest{
- @InjectMocks
- private SDNCAssignTasks sdncAssignTasks = new SDNCAssignTasks();
+public class SDNCAssignTasksTest extends BaseTaskTest {
+ @InjectMocks
+ private SDNCAssignTasks sdncAssignTasks = new 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;
- 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() throws BBObjectNotFoundException {
+ customer = setCustomer();
+ serviceInstance = setServiceInstance();
+ network = setL3Network();
+ cloudRegion = setCloudRegion();
+ requestContext = setRequestContext();
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+ volumeGroup = setVolumeGroup();
- @Before
- public void before() throws BBObjectNotFoundException {
- customer = setCustomer();
- serviceInstance = setServiceInstance();
- network = setL3Network();
- cloudRegion = setCloudRegion();
- requestContext = setRequestContext();
- genericVnf = setGenericVnf();
- vfModule = setVfModule();
- volumeGroup = setVolumeGroup();
-
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
- }
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID)))
+ .thenReturn(volumeGroup);
+ }
- @Test
- public void assignServiceInstanceTest() throws Exception {
- doReturn(new GenericResourceApiServiceOperationInformation()).when(sdncServiceInstanceResources).assignServiceInstance(serviceInstance, customer, requestContext);
- sdncAssignTasks.assignServiceInstance(execution);
- verify(sdncServiceInstanceResources, times(1)).assignServiceInstance(serviceInstance, customer, requestContext);
- SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
- assertEquals(SDNCTopology.SERVICE,sdncRequest.getTopology());
- }
+ @Test
+ public void assignServiceInstanceTest() throws Exception {
+ doReturn(new GenericResourceApiServiceOperationInformation()).when(sdncServiceInstanceResources)
+ .assignServiceInstance(serviceInstance, customer, requestContext);
+ sdncAssignTasks.assignServiceInstance(execution);
+ verify(sdncServiceInstanceResources, times(1)).assignServiceInstance(serviceInstance, customer, requestContext);
+ SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
+ assertEquals(SDNCTopology.SERVICE, sdncRequest.getTopology());
+ }
- @Test
- public void assignServiceInstanceExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncServiceInstanceResources).assignServiceInstance(serviceInstance, customer, requestContext);
- sdncAssignTasks.assignServiceInstance(execution);
- }
+ @Test
+ public void assignServiceInstanceExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.class).when(sdncServiceInstanceResources).assignServiceInstance(serviceInstance,
+ customer, requestContext);
+ sdncAssignTasks.assignServiceInstance(execution);
+ }
- @Test
- public void assignVnfTest() throws Exception {
- doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false);
- execution.setVariable("generalBuildingBlock", gBBInput);
- sdncAssignTasks.assignVnf(execution);
- verify(sdncVnfResources, times(1)).assignVnf(genericVnf, serviceInstance,customer, cloudRegion, requestContext, false);
- SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
- assertEquals(SDNCTopology.VNF,sdncRequest.getTopology());
- }
+ @Test
+ public void assignVnfTest() throws Exception {
+ doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).assignVnf(genericVnf,
+ serviceInstance, customer, cloudRegion, requestContext, false);
+ execution.setVariable("generalBuildingBlock", gBBInput);
+ sdncAssignTasks.assignVnf(execution);
+ verify(sdncVnfResources, times(1)).assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext,
+ false);
+ SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
+ assertEquals(SDNCTopology.VNF, sdncRequest.getTopology());
+ }
- @Test
- public void assignVnfExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVnfResources).assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false);
- sdncAssignTasks.assignVnf(execution);
- }
+ @Test
+ public void assignVnfExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.class).when(sdncVnfResources).assignVnf(genericVnf, serviceInstance, customer,
+ cloudRegion, requestContext, false);
+ sdncAssignTasks.assignVnf(execution);
+ }
- @Test
- public void assignVfModuleTest() throws Exception {
- doReturn(new GenericResourceApiVfModuleOperationInformation()).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);
- SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
- assertEquals(SDNCTopology.VFMODULE,sdncRequest.getTopology());
- }
+ @Test
+ public void assignVfModuleTest() throws Exception {
+ doReturn(new GenericResourceApiVfModuleOperationInformation()).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);
+ SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
+ assertEquals(SDNCTopology.VFMODULE, sdncRequest.getTopology());
+ }
- @Test
- public void assignVfModuleExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVfModuleResources).assignVfModule(vfModule, volumeGroup, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- sdncAssignTasks.assignVfModule(execution);
- }
+ @Test
+ public void assignVfModuleExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.class).when(sdncVfModuleResources).assignVfModule(vfModule, volumeGroup, genericVnf,
+ serviceInstance, customer, cloudRegion, requestContext);
+ sdncAssignTasks.assignVfModule(execution);
+ }
- @Test
- public void assignNetworkTest() throws Exception {
- doReturn(new GenericResourceApiNetworkOperationInformation()).when(sdncNetworkResources).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
- sdncAssignTasks.assignNetwork(execution);
- verify(sdncNetworkResources, times(1)).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
- SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
- assertEquals(SDNCTopology.NETWORK,sdncRequest.getTopology());
- }
+ @Test
+ public void assignNetworkTest() throws Exception {
+ doReturn(new GenericResourceApiNetworkOperationInformation()).when(sdncNetworkResources).assignNetwork(network,
+ serviceInstance, customer, requestContext, cloudRegion);
+ sdncAssignTasks.assignNetwork(execution);
+ verify(sdncNetworkResources, times(1)).assignNetwork(network, serviceInstance, customer, requestContext,
+ cloudRegion);
+ SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
+ assertEquals(SDNCTopology.NETWORK, sdncRequest.getTopology());
+ }
- @Test
- public void assignNetworkExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncNetworkResources).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
- sdncAssignTasks.assignNetwork(execution);
- }
+ @Test
+ public void assignNetworkExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.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
index be792115c9..1c1616a472 100644
--- 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
@@ -27,7 +27,6 @@ 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;
@@ -48,61 +47,70 @@ import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.sdnc.beans.SDNCRequest;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
-public class SDNCChangeAssignTasksTest extends BaseTaskTest{
- @InjectMocks
- private SDNCChangeAssignTasks sdncChangeAssignTasks = new SDNCChangeAssignTasks();
-
- private ServiceInstance serviceInstance;
- private RequestContext requestContext;
- private CloudRegion cloudRegion;
- private VfModule vfModule;
- private GenericVnf genericVnf;
- private Customer customer;
-
- @Before
- public void before() throws BBObjectNotFoundException {
- customer = setCustomer();
- serviceInstance = setServiceInstance();
- genericVnf = setGenericVnf();
- vfModule = setVfModule();
- cloudRegion = setCloudRegion();
- requestContext = setRequestContext();
+public class SDNCChangeAssignTasksTest extends BaseTaskTest {
+ @InjectMocks
+ private SDNCChangeAssignTasks sdncChangeAssignTasks = new SDNCChangeAssignTasks();
+
+ private ServiceInstance serviceInstance;
+ private RequestContext requestContext;
+ private CloudRegion cloudRegion;
+ private VfModule vfModule;
+ private GenericVnf genericVnf;
+ private Customer customer;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ customer = setCustomer();
+ serviceInstance = setServiceInstance();
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+ cloudRegion = setCloudRegion();
+ requestContext = setRequestContext();
+
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+ }
+
+ @Test
+ public void changeModelVnfTest() throws Exception {
+ doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).changeModelVnf(genericVnf,
+ serviceInstance, customer, cloudRegion, requestContext);
+ sdncChangeAssignTasks.changeModelVnf(execution);
+ verify(sdncVnfResources, times(1)).changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion,
+ requestContext);
+ SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
+ assertEquals(SDNCTopology.VNF, sdncRequest.getTopology());
+ }
+
+ @Test
+ public void changeModelVnfExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.class).when(sdncVnfResources).changeModelVnf(genericVnf, serviceInstance, customer,
+ cloudRegion, requestContext);
+ sdncChangeAssignTasks.changeModelVnf(execution);
+ }
+
+ @Test
+ public void changeAssignModelVfModuleTest() throws Exception {
+ doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources)
+ .changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ sdncChangeAssignTasks.changeAssignModelVfModule(execution);
+ verify(sdncVfModuleResources, times(1)).changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer,
+ cloudRegion, requestContext);
+ SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
+ assertEquals(SDNCTopology.VFMODULE, sdncRequest.getTopology());
+ }
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
- }
-
- @Test
- public void changeModelVnfTest() throws Exception {
- doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- sdncChangeAssignTasks.changeModelVnf(execution);
- verify(sdncVnfResources, times(1)).changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
- assertEquals(SDNCTopology.VNF,sdncRequest.getTopology());
- }
-
- @Test
- public void changeModelVnfExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVnfResources).changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- sdncChangeAssignTasks.changeModelVnf(execution);
- }
-
- @Test
- public void changeAssignModelVfModuleTest() throws Exception {
- doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- sdncChangeAssignTasks.changeAssignModelVfModule(execution);
- verify(sdncVfModuleResources, times(1)).changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
- assertEquals(SDNCTopology.VFMODULE,sdncRequest.getTopology());
- }
-
- @Test
- public void changeAssignModelVfModuleExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVfModuleResources).changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- sdncChangeAssignTasks.changeAssignModelVfModule(execution);
- }
+ @Test
+ public void changeAssignModelVfModuleExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.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
index 18048da50d..08d4d196da 100644
--- 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
@@ -28,7 +28,6 @@ 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;
@@ -53,97 +52,113 @@ import org.onap.so.client.sdnc.beans.SDNCRequest;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
public class SDNCDeactivateTaskTest extends BaseTaskTest {
- @InjectMocks
- private SDNCDeactivateTasks sdncDeactivateTasks = new 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() throws BBObjectNotFoundException {
- customer = setCustomer();
- serviceInstance = setServiceInstance();
- cloudRegion = setCloudRegion();
- requestContext = setRequestContext();
- genericVnf = setGenericVnf();
- vfModule = setVfModule();
- network = setL3Network();
-
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
+ @InjectMocks
+ private SDNCDeactivateTasks sdncDeactivateTasks = new 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() throws BBObjectNotFoundException {
+ customer = setCustomer();
+ serviceInstance = setServiceInstance();
+ cloudRegion = setCloudRegion();
+ requestContext = setRequestContext();
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+ network = setL3Network();
+
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+
+ }
+
+ @Test
+ public void deactivateVfModuleTest() throws Exception {
+ doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources)
+ .deactivateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ sdncDeactivateTasks.deactivateVfModule(execution);
+ verify(sdncVfModuleResources, times(1)).deactivateVfModule(vfModule, genericVnf, serviceInstance, customer,
+ cloudRegion, requestContext);
+ SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
+ assertEquals(SDNCTopology.VFMODULE, sdncRequest.getTopology());
+ }
+
+ @Test
+ public void deactivateVfModuleExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.class).when(sdncVfModuleResources).deactivateVfModule(vfModule, genericVnf,
+ serviceInstance, customer, cloudRegion, requestContext);
+ sdncDeactivateTasks.deactivateVfModule(execution);
+ }
+
+ @Test
+ public void deactivateVnfTest() throws Exception {
+ doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).deactivateVnf(genericVnf,
+ serviceInstance, customer, cloudRegion, requestContext);
+ sdncDeactivateTasks.deactivateVnf(execution);
+ verify(sdncVnfResources, times(1)).deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion,
+ requestContext);
+ SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
+ assertEquals(SDNCTopology.VNF, sdncRequest.getTopology());
+ }
+
+ @Test
+ public void deactivateVnfExceptionTest() throws Exception {
+ doThrow(RuntimeException.class).when(sdncVnfResources).deactivateVnf(genericVnf, serviceInstance, customer,
+ cloudRegion, requestContext);
+ expectedException.expect(BpmnError.class);
+ sdncDeactivateTasks.deactivateVnf(execution);
+ }
+
+ @Test
+ public void deactivateServiceInstanceTest() throws Exception {
+ doReturn(new GenericResourceApiServiceOperationInformation()).when(sdncServiceInstanceResources)
+ .deactivateServiceInstance(serviceInstance, customer, requestContext);
+ sdncDeactivateTasks.deactivateServiceInstance(execution);
+ verify(sdncServiceInstanceResources, times(1)).deactivateServiceInstance(serviceInstance, customer,
+ requestContext);
+ SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
+ assertEquals(SDNCTopology.SERVICE, sdncRequest.getTopology());
+ }
+
+ @Test
+ public void deactivateServiceInstanceExceptionTest() throws Exception {
+ doThrow(RuntimeException.class).when(sdncServiceInstanceResources).deactivateServiceInstance(serviceInstance,
+ customer, requestContext);
+ expectedException.expect(BpmnError.class);
+ sdncDeactivateTasks.deactivateServiceInstance(execution);
+ }
+
+ @Test
+ public void test_deactivateNetwork() throws Exception {
+ doReturn(new GenericResourceApiNetworkOperationInformation()).when(sdncNetworkResources)
+ .deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+ sdncDeactivateTasks.deactivateNetwork(execution);
+ verify(sdncNetworkResources, times(1)).deactivateNetwork(network, serviceInstance, customer, requestContext,
+ cloudRegion);
+ SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
+ assertEquals(SDNCTopology.NETWORK, sdncRequest.getTopology());
+ }
- }
-
- @Test
- public void deactivateVfModuleTest() throws Exception {
- doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).deactivateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- sdncDeactivateTasks.deactivateVfModule(execution);
- verify(sdncVfModuleResources, times(1)).deactivateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
- assertEquals(SDNCTopology.VFMODULE,sdncRequest.getTopology());
- }
-
- @Test
- public void deactivateVfModuleExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVfModuleResources).deactivateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- sdncDeactivateTasks.deactivateVfModule(execution);
- }
-
- @Test
- public void deactivateVnfTest() throws Exception {
- doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- sdncDeactivateTasks.deactivateVnf(execution);
- verify(sdncVnfResources, times(1)).deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
- assertEquals(SDNCTopology.VNF,sdncRequest.getTopology());
- }
-
- @Test
- public void deactivateVnfExceptionTest() throws Exception {
- doThrow(RuntimeException.class).when(sdncVnfResources).deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- expectedException.expect(BpmnError.class);
- sdncDeactivateTasks.deactivateVnf(execution);
- }
-
- @Test
- public void deactivateServiceInstanceTest() throws Exception {
- doReturn(new GenericResourceApiServiceOperationInformation()).when(sdncServiceInstanceResources).deactivateServiceInstance(serviceInstance, customer, requestContext);
- sdncDeactivateTasks.deactivateServiceInstance(execution);
- verify(sdncServiceInstanceResources, times(1)).deactivateServiceInstance(serviceInstance, customer, requestContext);
- SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
- assertEquals(SDNCTopology.SERVICE,sdncRequest.getTopology());
- }
-
- @Test
- public void deactivateServiceInstanceExceptionTest() throws Exception {
- doThrow(RuntimeException.class).when(sdncServiceInstanceResources).deactivateServiceInstance(serviceInstance, customer, requestContext);
- expectedException.expect(BpmnError.class);
- sdncDeactivateTasks.deactivateServiceInstance(execution);
- }
-
- @Test
- public void test_deactivateNetwork() throws Exception {
- doReturn(new GenericResourceApiNetworkOperationInformation()).when(sdncNetworkResources).deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
- sdncDeactivateTasks.deactivateNetwork(execution);
- verify(sdncNetworkResources, times(1)).deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
- SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
- assertEquals(SDNCTopology.NETWORK,sdncRequest.getTopology());
- }
-
- @Test
- public void test_deactivateNetwork_exception() throws Exception {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID));
- sdncDeactivateTasks.deactivateNetwork(execution);
- verify(sdncNetworkResources, times(0)).deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
- }
+ @Test
+ public void test_deactivateNetwork_exception() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),
+ ArgumentMatchers.eq(ResourceKey.NETWORK_ID));
+ sdncDeactivateTasks.deactivateNetwork(execution);
+ verify(sdncNetworkResources, times(0)).deactivateNetwork(network, serviceInstance, customer, requestContext,
+ cloudRegion);
+ }
}
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
index 28551baa7a..3ea8474b24 100644
--- 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
@@ -29,7 +29,6 @@ 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.Rule;
@@ -45,95 +44,99 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.client.exception.BBObjectNotFoundException;
-public class SDNCQueryTasksTest extends BaseTaskTest{
- @InjectMocks
- private SDNCQueryTasks sdncQueryTasks = new SDNCQueryTasks();
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- private ServiceInstance serviceInstance;
- private GenericVnf genericVnf;
- private VfModule vfModule;
-
- @Before
- public void before() throws BBObjectNotFoundException {
- serviceInstance = setServiceInstance();
- genericVnf = setGenericVnf();
- vfModule = setVfModule();
-
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
-
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
-
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
-
- }
-
- @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 {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID));
- sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
-
- verify(sdncVfModuleResources, times(0)).queryVfModule(any(VfModule.class));
- }
-
- @Test
- public void queryVfModuleForVolumeGroupNonVfObjectExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
-
- sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
- }
+public class SDNCQueryTasksTest extends BaseTaskTest {
+ @InjectMocks
+ private SDNCQueryTasks sdncQueryTasks = new SDNCQueryTasks();
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ private ServiceInstance serviceInstance;
+ private GenericVnf genericVnf;
+ private VfModule vfModule;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ serviceInstance = setServiceInstance();
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
+ }
+
+ @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 {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),
+ ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID));
+ 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/SDNCRequestTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
index 043aad43b1..b5d34ea4c9 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
@@ -25,18 +25,14 @@ 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.io.IOException;
import java.io.StringReader;
import java.nio.file.Files;
import java.nio.file.Paths;
-
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.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Before;
import org.junit.Rule;
@@ -57,128 +53,133 @@ import org.onap.so.client.sdnc.beans.SDNCRequest;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
-
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(MockitoJUnitRunner.class)
-public class SDNCRequestTasksTest extends SDNCRequestTasks{
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- @InjectMocks
- SDNCRequestTasks sndcRequestTasks = new SDNCRequestTasks();
-
- @Mock
- SDNCClient sdncClient;
-
- @Spy
- private ExceptionBuilder exceptionBuilder;
-
- protected DelegateExecution delegateExecution;
-
-
- @Before
- public void setup(){
- delegateExecution = new DelegateExecutionFake();
- delegateExecution.setVariable("SDNCRequest", createSDNCRequest());
- }
-
- @Test
- public void createCorrelationVariables_Test(){
- sndcRequestTasks.createCorrelationVariables(delegateExecution);
- assertEquals("correlationValue",delegateExecution.getVariable("correlationName_CORRELATOR"));
- }
-
- @Test
- public void callSDNC_Final_Test() throws MapperException, BadResponseException, IOException{
- final String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNCClientPut200Response.json")));
- doReturn(sdncResponse).when(sdncClient).post(createSDNCRequest().getSDNCPayload(),SDNCTopology.CONFIGURATION);
- sndcRequestTasks.callSDNC(delegateExecution);
- assertEquals(true,delegateExecution.getVariable("isSDNCCompleted"));
- }
-
- @Test
- public void callSDNC_Not_Final_Test() throws MapperException, BadResponseException, IOException{
- final String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNCClientPut200ResponseNotFinal.json")));
- doReturn(sdncResponse).when(sdncClient).post(createSDNCRequest().getSDNCPayload(),SDNCTopology.CONFIGURATION);
- sndcRequestTasks.callSDNC(delegateExecution);
- assertEquals(false,delegateExecution.getVariable("isSDNCCompleted"));
- }
-
- @Test
- public void callSDNC_Error_Test() throws MapperException, BadResponseException{
- doThrow(MapperException.class).when(sdncClient).post(createSDNCRequest().getSDNCPayload(),SDNCTopology.CONFIGURATION);
- doReturn("processKey").when(exceptionBuilder).getProcessKey(delegateExecution);
- expectedException.expect(BpmnError.class);
- sndcRequestTasks.callSDNC(delegateExecution);
- }
-
- @Test
- public void convertIndicatorToBoolean_True_Test() throws MapperException, BadResponseException{
- boolean testValue = sndcRequestTasks.convertIndicatorToBoolean("Y");
- assertEquals(true,testValue);
- }
-
- @Test
- public void convertIndicatorToBoolean_False_Test() throws MapperException, BadResponseException{
- boolean testValue = sndcRequestTasks.convertIndicatorToBoolean("N");
- assertEquals(false,testValue);
- }
-
- @Test
- public void HandleTimeout_Test() throws MapperException, BadResponseException{
- doReturn("processKey").when(exceptionBuilder).getProcessKey(delegateExecution);
- expectedException.expect(BpmnError.class);
- sndcRequestTasks.handleTimeOutException(delegateExecution);
- }
-
- @Test
- public void processCallBack_Final_Test() throws MapperException, BadResponseException, IOException{
- final String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNC_Async_Request2.xml")));
- delegateExecution.setVariable("correlationName_MESSAGE", sdncResponse);
- sndcRequestTasks.processCallback(delegateExecution);
- assertEquals(true,delegateExecution.getVariable(IS_CALLBACK_COMPLETED));
- }
-
- @Test
- public void getXmlElementTest() throws Exception {
- final String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNC_Async_Request2.xml")));
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance ();
+public class SDNCRequestTasksTest extends SDNCRequestTasks {
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @InjectMocks
+ SDNCRequestTasks sndcRequestTasks = new SDNCRequestTasks();
+
+ @Mock
+ SDNCClient sdncClient;
+
+ @Spy
+ private ExceptionBuilder exceptionBuilder;
+
+ protected DelegateExecution delegateExecution;
+
+
+ @Before
+ public void setup() {
+ delegateExecution = new DelegateExecutionFake();
+ delegateExecution.setVariable("SDNCRequest", createSDNCRequest());
+ }
+
+ @Test
+ public void createCorrelationVariables_Test() {
+ sndcRequestTasks.createCorrelationVariables(delegateExecution);
+ assertEquals("correlationValue", delegateExecution.getVariable("correlationName_CORRELATOR"));
+ }
+
+ @Test
+ public void callSDNC_Final_Test() throws MapperException, BadResponseException, IOException {
+ final String sdncResponse =
+ new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNCClientPut200Response.json")));
+ doReturn(sdncResponse).when(sdncClient).post(createSDNCRequest().getSDNCPayload(), SDNCTopology.CONFIGURATION);
+ sndcRequestTasks.callSDNC(delegateExecution);
+ assertEquals(true, delegateExecution.getVariable("isSDNCCompleted"));
+ }
+
+ @Test
+ public void callSDNC_Not_Final_Test() throws MapperException, BadResponseException, IOException {
+ final String sdncResponse = new String(
+ Files.readAllBytes(Paths.get("src/test/resources/__files/SDNCClientPut200ResponseNotFinal.json")));
+ doReturn(sdncResponse).when(sdncClient).post(createSDNCRequest().getSDNCPayload(), SDNCTopology.CONFIGURATION);
+ sndcRequestTasks.callSDNC(delegateExecution);
+ assertEquals(false, delegateExecution.getVariable("isSDNCCompleted"));
+ }
+
+ @Test
+ public void callSDNC_Error_Test() throws MapperException, BadResponseException {
+ doThrow(MapperException.class).when(sdncClient).post(createSDNCRequest().getSDNCPayload(),
+ SDNCTopology.CONFIGURATION);
+ doReturn("processKey").when(exceptionBuilder).getProcessKey(delegateExecution);
+ expectedException.expect(BpmnError.class);
+ sndcRequestTasks.callSDNC(delegateExecution);
+ }
+
+ @Test
+ public void convertIndicatorToBoolean_True_Test() throws MapperException, BadResponseException {
+ boolean testValue = sndcRequestTasks.convertIndicatorToBoolean("Y");
+ assertEquals(true, testValue);
+ }
+
+ @Test
+ public void convertIndicatorToBoolean_False_Test() throws MapperException, BadResponseException {
+ boolean testValue = sndcRequestTasks.convertIndicatorToBoolean("N");
+ assertEquals(false, testValue);
+ }
+
+ @Test
+ public void HandleTimeout_Test() throws MapperException, BadResponseException {
+ doReturn("processKey").when(exceptionBuilder).getProcessKey(delegateExecution);
+ expectedException.expect(BpmnError.class);
+ sndcRequestTasks.handleTimeOutException(delegateExecution);
+ }
+
+ @Test
+ public void processCallBack_Final_Test() throws MapperException, BadResponseException, IOException {
+ final String sdncResponse =
+ new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNC_Async_Request2.xml")));
+ delegateExecution.setVariable("correlationName_MESSAGE", sdncResponse);
+ sndcRequestTasks.processCallback(delegateExecution);
+ assertEquals(true, delegateExecution.getVariable(IS_CALLBACK_COMPLETED));
+ }
+
+ @Test
+ public void getXmlElementTest() throws Exception {
+ final String sdncResponse =
+ new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNC_Async_Request2.xml")));
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db;
- db = dbf.newDocumentBuilder ();
- Document doc = db.parse (new InputSource(new StringReader(sdncResponse)));
-
+ db = dbf.newDocumentBuilder();
+ Document doc = db.parse(new InputSource(new StringReader(sdncResponse)));
+
String finalMessageIndicator = getXmlElement(doc, "/input/ack-final-indicator");
String responseCode = getXmlElement(doc, "/input/response-code");
- String responseMessage = getXmlElement(doc, "/input/response-message");
-
- assertEquals("Y", finalMessageIndicator);
- assertEquals("200", responseCode);
- assertEquals("Success", responseMessage);
- }
-
- public SDNCRequest createSDNCRequest(){
- SDNCRequest request = new SDNCRequest();
- request.setCorrelationName("correlationName");
- request.setCorrelationValue("correlationValue");
- request.setTopology(SDNCTopology.CONFIGURATION);
- ObjectMapper mapper = new ObjectMapper();
- try {
- GenericResourceApiServiceOperationInformation sdncReq =
- mapper.readValue(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNC_Client_Request.json")), GenericResourceApiServiceOperationInformation.class);
- request.setSDNCPayload(sdncReq);
- } catch (JsonParseException e) {
-
- } catch (JsonMappingException e) {
-
- } catch (IOException e) {
-
- }
-
- return request;
- }
-
+ String responseMessage = getXmlElement(doc, "/input/response-message");
+
+ assertEquals("Y", finalMessageIndicator);
+ assertEquals("200", responseCode);
+ assertEquals("Success", responseMessage);
+ }
+
+ public SDNCRequest createSDNCRequest() {
+ SDNCRequest request = new SDNCRequest();
+ request.setCorrelationName("correlationName");
+ request.setCorrelationValue("correlationValue");
+ request.setTopology(SDNCTopology.CONFIGURATION);
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ GenericResourceApiServiceOperationInformation sdncReq = mapper.readValue(
+ Files.readAllBytes(Paths.get("src/test/resources/__files/SDNC_Client_Request.json")),
+ GenericResourceApiServiceOperationInformation.class);
+ request.setSDNCPayload(sdncReq);
+ } catch (JsonParseException e) {
+
+ } catch (JsonMappingException e) {
+
+ } catch (IOException e) {
+
+ }
+
+ return request;
+ }
+
}
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
index 527fe0d916..c6ed1cca7a 100644
--- 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
@@ -30,7 +30,6 @@ 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;
@@ -54,99 +53,111 @@ import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.sdnc.beans.SDNCRequest;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
-public class SDNCUnassignTasksTest extends BaseTaskTest{
- @InjectMocks
- private SDNCUnassignTasks sdncUnassignTasks = new 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() throws BBObjectNotFoundException {
- customer = setCustomer();
- serviceInstance = setServiceInstance();
- requestContext = setRequestContext();
- genericVnf = setGenericVnf();
- vfModule = setVfModule();
- cloudRegion = setCloudRegion();
- network = setL3Network();
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
- }
-
- @Test
- public void unassignServiceInstanceTest() throws Exception {
- doReturn(new GenericResourceApiServiceOperationInformation()).when(sdncServiceInstanceResources).unassignServiceInstance(serviceInstance, customer, requestContext);
- sdncUnassignTasks.unassignServiceInstance(execution);
- verify(sdncServiceInstanceResources, times(1)).unassignServiceInstance(serviceInstance, customer, requestContext);
- SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
- assertEquals(SDNCTopology.SERVICE,sdncRequest.getTopology());
- }
-
-
-
- @Test
- public void unassignServiceInstanceExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncServiceInstanceResources).unassignServiceInstance(serviceInstance, customer, requestContext);
- sdncUnassignTasks.unassignServiceInstance(execution);
- }
-
- @Test
- public void unassignVfModuleTest() throws Exception {
- doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).unassignVfModule(vfModule, genericVnf, serviceInstance);
- sdncUnassignTasks.unassignVfModule(execution);
- verify(sdncVfModuleResources, times(1)).unassignVfModule(vfModule, genericVnf, serviceInstance);
- SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
- assertEquals(SDNCTopology.VFMODULE,sdncRequest.getTopology());
- }
-
-
-
-
- @Test
- public void unassignVfModuleExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVfModuleResources).unassignVfModule(vfModule, genericVnf, serviceInstance);
- sdncUnassignTasks.unassignVfModule(execution);
- }
-
- @Test
- public void unassignVnfTest() throws Exception {
- doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- sdncUnassignTasks.unassignVnf(execution);
- verify(sdncVnfResources, times(1)).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
- assertEquals(SDNCTopology.VNF,sdncRequest.getTopology());
- }
-
-
- @Test
- public void unassignVnfExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.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(new GenericResourceApiNetworkOperationInformation()).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(cloudRegionSdnc, cloudRegion.getLcpCloudRegionId());
- SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
- assertEquals(SDNCTopology.NETWORK,sdncRequest.getTopology());
- }
+public class SDNCUnassignTasksTest extends BaseTaskTest {
+ @InjectMocks
+ private SDNCUnassignTasks sdncUnassignTasks = new 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() throws BBObjectNotFoundException {
+ customer = setCustomer();
+ serviceInstance = setServiceInstance();
+ requestContext = setRequestContext();
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+ cloudRegion = setCloudRegion();
+ network = setL3Network();
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+ }
+
+ @Test
+ public void unassignServiceInstanceTest() throws Exception {
+ doReturn(new GenericResourceApiServiceOperationInformation()).when(sdncServiceInstanceResources)
+ .unassignServiceInstance(serviceInstance, customer, requestContext);
+ sdncUnassignTasks.unassignServiceInstance(execution);
+ verify(sdncServiceInstanceResources, times(1)).unassignServiceInstance(serviceInstance, customer,
+ requestContext);
+ SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
+ assertEquals(SDNCTopology.SERVICE, sdncRequest.getTopology());
+ }
+
+
+
+ @Test
+ public void unassignServiceInstanceExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.class).when(sdncServiceInstanceResources).unassignServiceInstance(serviceInstance,
+ customer, requestContext);
+ sdncUnassignTasks.unassignServiceInstance(execution);
+ }
+
+ @Test
+ public void unassignVfModuleTest() throws Exception {
+ doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources)
+ .unassignVfModule(vfModule, genericVnf, serviceInstance);
+ sdncUnassignTasks.unassignVfModule(execution);
+ verify(sdncVfModuleResources, times(1)).unassignVfModule(vfModule, genericVnf, serviceInstance);
+ SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
+ assertEquals(SDNCTopology.VFMODULE, sdncRequest.getTopology());
+ }
+
+
+
+ @Test
+ public void unassignVfModuleExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.class).when(sdncVfModuleResources).unassignVfModule(vfModule, genericVnf,
+ serviceInstance);
+ sdncUnassignTasks.unassignVfModule(execution);
+ }
+
+ @Test
+ public void unassignVnfTest() throws Exception {
+ doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).unassignVnf(genericVnf,
+ serviceInstance, customer, cloudRegion, requestContext);
+ sdncUnassignTasks.unassignVnf(execution);
+ verify(sdncVnfResources, times(1)).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion,
+ requestContext);
+ SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
+ assertEquals(SDNCTopology.VNF, sdncRequest.getTopology());
+ }
+
+
+ @Test
+ public void unassignVnfExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.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(new GenericResourceApiNetworkOperationInformation()).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(cloudRegionSdnc, cloudRegion.getLcpCloudRegionId());
+ SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
+ assertEquals(SDNCTopology.NETWORK, sdncRequest.getTopology());
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidatorTest.java
index 81ec388649..2fc3cf639c 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidatorTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidatorTest.java
@@ -27,7 +27,6 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import java.util.Optional;
import java.util.Set;
-
import org.junit.Before;
import org.junit.Test;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -35,83 +34,84 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
public class CloudRegionOrchestrationValidatorTest {
-
- private BuildingBlockExecution mockExecution;
- private CloudRegion cloudRegion;
-
- @Before
- public void setUp() {
- cloudRegion = new CloudRegion();
- cloudRegion.setCloudOwner("CloudOwner");
- cloudRegion.setLcpCloudRegionId("my-region-id");
- GeneralBuildingBlock gbb = new GeneralBuildingBlock();
- gbb.setCloudRegion(cloudRegion);
- mockExecution = mock(BuildingBlockExecution.class);
- doReturn(gbb).when(mockExecution).getGeneralBuildingBlock();
- }
-
- @Test
- public void validateDisabledTest() {
- cloudRegion.setOrchestrationDisabled(true);
- CloudRegionOrchestrationValidator validation = new CloudRegionOrchestrationValidator();
- Optional<String> result = validation.validate(mockExecution);
- assertEquals("Error: The request has failed due to orchestration currently disabled for the target cloud region my-region-id for cloud owner CloudOwner",
- result.get());
- }
-
- @Test
- public void validateNotDisabledTest() {
- cloudRegion.setOrchestrationDisabled(false);
- CloudRegionOrchestrationValidator validation = new CloudRegionOrchestrationValidator();
- Optional<String> result = validation.validate(mockExecution);
- assertFalse(result.isPresent());
- }
-
- @Test
- public void validateDisabledIsNullTest() {
- CloudRegionOrchestrationValidator validation = new CloudRegionOrchestrationValidator();
- Optional<String> result = validation.validate(mockExecution);
- assertFalse(result.isPresent());
- }
- @Test
- public void shouldRunForTest() {
- CloudRegionOrchestrationValidator validator = new CloudRegionOrchestrationValidator();
- assertTrue(validator.shouldRunFor("ActivateNetworkBB"));
- assertTrue(validator.shouldRunFor("AssignNetworkBB"));
- assertTrue(validator.shouldRunFor("CreateNetworkBB"));
- assertTrue(validator.shouldRunFor("DeactivateNetworkBB"));
- assertTrue(validator.shouldRunFor("DeleteNetworkBB"));
- assertTrue(validator.shouldRunFor("UnassignNetworkBB"));
- assertTrue(validator.shouldRunFor("UpdateNetworkBB"));
-
- assertTrue(validator.shouldRunFor("ActivateVnfBB"));
- assertTrue(validator.shouldRunFor("AssignVnfBB"));
- assertTrue(validator.shouldRunFor("UnassignVnfBB"));
- assertTrue(validator.shouldRunFor("DeactivateVnfBB"));
+ private BuildingBlockExecution mockExecution;
+ private CloudRegion cloudRegion;
+
+ @Before
+ public void setUp() {
+ cloudRegion = new CloudRegion();
+ cloudRegion.setCloudOwner("CloudOwner");
+ cloudRegion.setLcpCloudRegionId("my-region-id");
+ GeneralBuildingBlock gbb = new GeneralBuildingBlock();
+ gbb.setCloudRegion(cloudRegion);
+ mockExecution = mock(BuildingBlockExecution.class);
+ doReturn(gbb).when(mockExecution).getGeneralBuildingBlock();
+ }
+
+ @Test
+ public void validateDisabledTest() {
+ cloudRegion.setOrchestrationDisabled(true);
+ CloudRegionOrchestrationValidator validation = new CloudRegionOrchestrationValidator();
+ Optional<String> result = validation.validate(mockExecution);
+ assertEquals(
+ "Error: The request has failed due to orchestration currently disabled for the target cloud region my-region-id for cloud owner CloudOwner",
+ result.get());
+ }
+
+ @Test
+ public void validateNotDisabledTest() {
+ cloudRegion.setOrchestrationDisabled(false);
+ CloudRegionOrchestrationValidator validation = new CloudRegionOrchestrationValidator();
+ Optional<String> result = validation.validate(mockExecution);
+ assertFalse(result.isPresent());
+ }
+
+ @Test
+ public void validateDisabledIsNullTest() {
+ CloudRegionOrchestrationValidator validation = new CloudRegionOrchestrationValidator();
+ Optional<String> result = validation.validate(mockExecution);
+ assertFalse(result.isPresent());
+ }
+
+ @Test
+ public void shouldRunForTest() {
+ CloudRegionOrchestrationValidator validator = new CloudRegionOrchestrationValidator();
+ assertTrue(validator.shouldRunFor("ActivateNetworkBB"));
+ assertTrue(validator.shouldRunFor("AssignNetworkBB"));
+ assertTrue(validator.shouldRunFor("CreateNetworkBB"));
+ assertTrue(validator.shouldRunFor("DeactivateNetworkBB"));
+ assertTrue(validator.shouldRunFor("DeleteNetworkBB"));
+ assertTrue(validator.shouldRunFor("UnassignNetworkBB"));
+ assertTrue(validator.shouldRunFor("UpdateNetworkBB"));
+
+ assertTrue(validator.shouldRunFor("ActivateVnfBB"));
+ assertTrue(validator.shouldRunFor("AssignVnfBB"));
+ assertTrue(validator.shouldRunFor("UnassignVnfBB"));
+ assertTrue(validator.shouldRunFor("DeactivateVnfBB"));
+
+ assertTrue(validator.shouldRunFor("ActivateVfModuleBB"));
+ assertTrue(validator.shouldRunFor("AssignVfModuleBB"));
+ assertTrue(validator.shouldRunFor("CreateVfModuleBB"));
+ assertTrue(validator.shouldRunFor("DeactivateVfModuleBB"));
+ assertTrue(validator.shouldRunFor("DeleteVfModuleBB"));
+ assertTrue(validator.shouldRunFor("UnassignVfModuleBB"));
+
+ assertTrue(validator.shouldRunFor("ActivateVolumeGroupBB"));
+ assertTrue(validator.shouldRunFor("AssignVolumeGroupBB"));
+ assertTrue(validator.shouldRunFor("CreateVolumeGroupBB"));
+ assertTrue(validator.shouldRunFor("DeactivateVolumeGroupBB"));
+ assertTrue(validator.shouldRunFor("DeleteVolumeGroupBB"));
+ assertTrue(validator.shouldRunFor("UnassignVolumeGroupBB"));
+
+ assertTrue(validator.shouldRunFor("ActivateFabricConfigurationBB"));
+ assertTrue(validator.shouldRunFor("AssignFabricConfigurationBB"));
+ assertTrue(validator.shouldRunFor("UnassignFabricConfigurationBB"));
+ assertTrue(validator.shouldRunFor("DeactivateFabricConfigurationBB"));
- assertTrue(validator.shouldRunFor("ActivateVfModuleBB"));
- assertTrue(validator.shouldRunFor("AssignVfModuleBB"));
- assertTrue(validator.shouldRunFor("CreateVfModuleBB"));
- assertTrue(validator.shouldRunFor("DeactivateVfModuleBB"));
- assertTrue(validator.shouldRunFor("DeleteVfModuleBB"));
- assertTrue(validator.shouldRunFor("UnassignVfModuleBB"));
-
- assertTrue(validator.shouldRunFor("ActivateVolumeGroupBB"));
- assertTrue(validator.shouldRunFor("AssignVolumeGroupBB"));
- assertTrue(validator.shouldRunFor("CreateVolumeGroupBB"));
- assertTrue(validator.shouldRunFor("DeactivateVolumeGroupBB"));
- assertTrue(validator.shouldRunFor("DeleteVolumeGroupBB"));
- assertTrue(validator.shouldRunFor("UnassignVolumeGroupBB"));
-
- assertTrue(validator.shouldRunFor("ActivateFabricConfigurationBB"));
- assertTrue(validator.shouldRunFor("AssignFabricConfigurationBB"));
- assertTrue(validator.shouldRunFor("UnassignFabricConfigurationBB"));
- assertTrue(validator.shouldRunFor("DeactivateFabricConfigurationBB"));
-
- assertFalse(validator.shouldRunFor("AssignServiceInstanceBB"));
- assertFalse(validator.shouldRunFor("AAICheckVnfInMaintBB"));
- assertFalse(validator.shouldRunFor("ChangeModelVfModuleBB"));
- assertFalse(validator.shouldRunFor("CreateNetworkCollectionBB"));
- }
+ assertFalse(validator.shouldRunFor("AssignServiceInstanceBB"));
+ assertFalse(validator.shouldRunFor("AAICheckVnfInMaintBB"));
+ assertFalse(validator.shouldRunFor("ChangeModelVfModuleBB"));
+ assertFalse(validator.shouldRunFor("CreateNetworkCollectionBB"));
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasksTest.java
index 3cf003d1ad..1bdde8f904 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasksTest.java
@@ -26,7 +26,6 @@ import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-
import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
@@ -37,33 +36,33 @@ import org.springframework.beans.factory.annotation.Autowired;
public class FlowCompletionTasksTest extends BaseTaskTest {
- @InjectMocks
- protected FlowCompletionTasks flowCompletionTasks = new FlowCompletionTasks();
+ @InjectMocks
+ protected FlowCompletionTasks flowCompletionTasks = new FlowCompletionTasks();
+
+ @Before
+ public void before() {
+ setRequestContext();
+ }
+
+ @Test
+ public void updateRequestDbStatusComplete_Test() throws Exception {
+ InfraActiveRequests mockedRequest = new InfraActiveRequests();
+ when(requestsDbClient.getInfraActiveRequestbyRequestId(any(String.class))).thenReturn(mockedRequest);
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(any(InfraActiveRequests.class));
+ flowCompletionTasks.updateRequestDbStatus(execution);
+ verify(requestsDbClient, times(1)).updateInfraActiveRequests(any(InfraActiveRequests.class));
+ assertEquals(mockedRequest.getRequestStatus(), "COMPLETE");
+ }
- @Before
- public void before() {
- setRequestContext();
- }
-
- @Test
- public void updateRequestDbStatusComplete_Test() throws Exception{
- InfraActiveRequests mockedRequest = new InfraActiveRequests();
- when(requestsDbClient.getInfraActiveRequestbyRequestId(any(String.class))).thenReturn(mockedRequest);
- doNothing().when(requestsDbClient).updateInfraActiveRequests(any(InfraActiveRequests.class));
- flowCompletionTasks.updateRequestDbStatus(execution);
- verify(requestsDbClient, times(1)).updateInfraActiveRequests(any(InfraActiveRequests.class));
- assertEquals(mockedRequest.getRequestStatus(), "COMPLETE");
- }
-
- @Test
- public void updateRequestDbStatusFailed_Test() throws Exception{
- WorkflowException workflowException = new WorkflowException("testProcessKey", 7000, "Error");
- execution.setVariable("WorkflowException", workflowException);
- InfraActiveRequests mockedRequest = new InfraActiveRequests();
- when(requestsDbClient.getInfraActiveRequestbyRequestId(any(String.class))).thenReturn(mockedRequest);
- doNothing().when(requestsDbClient).updateInfraActiveRequests(any(InfraActiveRequests.class));
- flowCompletionTasks.updateRequestDbStatus(execution);
- verify(requestsDbClient, times(1)).updateInfraActiveRequests(any(InfraActiveRequests.class));
- assertEquals(mockedRequest.getRequestStatus(), "FAILED");
- }
+ @Test
+ public void updateRequestDbStatusFailed_Test() throws Exception {
+ WorkflowException workflowException = new WorkflowException("testProcessKey", 7000, "Error");
+ execution.setVariable("WorkflowException", workflowException);
+ InfraActiveRequests mockedRequest = new InfraActiveRequests();
+ when(requestsDbClient.getInfraActiveRequestbyRequestId(any(String.class))).thenReturn(mockedRequest);
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(any(InfraActiveRequests.class));
+ flowCompletionTasks.updateRequestDbStatus(execution);
+ verify(requestsDbClient, times(1)).updateInfraActiveRequests(any(InfraActiveRequests.class));
+ assertEquals(mockedRequest.getRequestStatus(), "FAILED");
+ }
}
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
index 60d456e2b5..b371e3a48a 100644
--- 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
@@ -26,11 +26,9 @@ import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.when;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Ignore;
@@ -54,384 +52,434 @@ import org.springframework.beans.factory.annotation.Autowired;
@Ignore
public class OrchestrationStatusValidatorTest extends BaseTaskTest {
- @InjectMocks
- protected OrchestrationStatusValidator orchestrationStatusValidator = new OrchestrationStatusValidator();
-
-
-
- @Test
- public void test_validateOrchestrationStatus() throws Exception {
- String flowToBeCalled = "AssignServiceInstanceBB";
- setServiceInstance().setOrchestrationStatus(OrchestrationStatus.PRECREATED);
- execution.setVariable("aLaCarte", true);
- 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<Configuration> 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);
- execution.setVariable("aLaCarte", true);
-
- 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);
- }
-
- @Test
- public void test_validateOrchestrationStatus_unassignNotFound() throws Exception{
- String flowToBeCalled = "UnassignServiceInstanceBB";
-
- execution.setVariable("flowToBeCalled", flowToBeCalled);
- execution.setVariable("aLaCarte", true);
-
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("UnassignServiceInstanceBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.SERVICE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.UNASSIGN);
-
- doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
-
- lookupKeyMap = new HashMap<ResourceKey, String>();
-
- orchestrationStatusValidator.validateOrchestrationStatus(execution);
-
- assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,execution.getVariable("orchestrationStatusValidationResult"));
- }
-
- @Test
- public void test_validateOrchestrationStatusSecondStageOfMultiStageEnabledVfModule() throws Exception {
- String flowToBeCalled = "CreateVfModuleBB";
-
- execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("flowToBeCalled", flowToBeCalled);
-
- GenericVnf genericVnf = buildGenericVnf();
- ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("true");
- setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
- setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
-
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
-
- doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
-
- OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.FAIL);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.CREATE);
-
- doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.PENDING_ACTIVATION, OrchestrationAction.CREATE);
-
- orchestrationStatusValidator.validateOrchestrationStatus(execution);
-
- assertEquals(OrchestrationStatusValidationDirective.CONTINUE, execution.getVariable("orchestrationStatusValidationResult"));
- }
-
-
- @Test
- public void test_validateOrchestrationStatusSecondStageOfMultiStageWrongPrevStatusVfModule() throws Exception {
- String flowToBeCalled = "CreateVfModuleBB";
-
- execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.CONTINUE);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("flowToBeCalled", flowToBeCalled);
-
- GenericVnf genericVnf = buildGenericVnf();
- ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("true");
- setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
- setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
-
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
-
- doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
-
- OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.CREATE);
-
- doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.PENDING_ACTIVATION, OrchestrationAction.CREATE);
-
- orchestrationStatusValidator.validateOrchestrationStatus(execution);
-
- assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS, execution.getVariable("orchestrationStatusValidationResult"));
- }
-
- @Test
- public void test_validateOrchestrationStatusSecondStageOfMultiStageDisabledVfModule() throws Exception {
- String flowToBeCalled = "CreateVfModuleBB";
-
- execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("flowToBeCalled", flowToBeCalled);
-
- GenericVnf genericVnf = buildGenericVnf();
- ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("false");
- setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
- setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
-
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
-
- doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
-
- OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.CREATE);
-
- doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.PENDING_ACTIVATION, OrchestrationAction.CREATE);
-
- orchestrationStatusValidator.validateOrchestrationStatus(execution);
-
- assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS, execution.getVariable("orchestrationStatusValidationResult"));
- }
-
- @Test
- public void test_validateOrchestrationStatusSecondStageOfMultiStageWrongOrchStatusVfModule() throws Exception {
- String flowToBeCalled = "CreateVfModuleBB";
-
- execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("flowToBeCalled", flowToBeCalled);
-
- GenericVnf genericVnf = buildGenericVnf();
- ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("true");
- setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
- setVfModule().setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
-
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
-
- doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
-
- OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.CREATE);
-
- doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.ASSIGNED, OrchestrationAction.CREATE);
-
- orchestrationStatusValidator.validateOrchestrationStatus(execution);
-
- assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS, execution.getVariable("orchestrationStatusValidationResult"));
- }
-
- @Test
- public void test_validateOrchestrationStatusSecondStageOfMultiStageWrongTargetActionVfModule() throws Exception {
- String flowToBeCalled = "CreateVfModuleBB";
-
- execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("flowToBeCalled", flowToBeCalled);
-
- GenericVnf genericVnf = buildGenericVnf();
- ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("true");
- setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
- setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
-
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.ACTIVATE);
-
- doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
-
- OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ACTIVATE);
-
- doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.PENDING_ACTIVATION, OrchestrationAction.ACTIVATE);
-
- orchestrationStatusValidator.validateOrchestrationStatus(execution);
-
- assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS, execution.getVariable("orchestrationStatusValidationResult"));
- }
-
- @Test
- public void test_validateOrchestrationStatusSecondStageOfMultiStageWrongAlacarteValueVfModule() throws Exception {
- String flowToBeCalled = "CreateVfModuleBB";
-
- execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("flowToBeCalled", flowToBeCalled);
-
- GenericVnf genericVnf = buildGenericVnf();
- ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("true");
- setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
- setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
-
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
-
- doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
-
- OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ACTIVATE);
-
- doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.PENDING_ACTIVATION, OrchestrationAction.CREATE);
-
- orchestrationStatusValidator.validateOrchestrationStatus(execution);
-
- assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS, execution.getVariable("orchestrationStatusValidationResult"));
- }
+ @InjectMocks
+ protected OrchestrationStatusValidator orchestrationStatusValidator = new OrchestrationStatusValidator();
+
+
+
+ @Test
+ public void test_validateOrchestrationStatus() throws Exception {
+ String flowToBeCalled = "AssignServiceInstanceBB";
+ setServiceInstance().setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ execution.setVariable("aLaCarte", true);
+ 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<Configuration> 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);
+ execution.setVariable("aLaCarte", true);
+
+ 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);
+ }
+
+ @Test
+ public void test_validateOrchestrationStatus_unassignNotFound() throws Exception {
+ String flowToBeCalled = "UnassignServiceInstanceBB";
+
+ execution.setVariable("flowToBeCalled", flowToBeCalled);
+ execution.setVariable("aLaCarte", true);
+
+ BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
+ buildingBlockDetail.setBuildingBlockName("UnassignServiceInstanceBB");
+ buildingBlockDetail.setId(1);
+ buildingBlockDetail.setResourceType(ResourceType.SERVICE);
+ buildingBlockDetail.setTargetAction(OrchestrationAction.UNASSIGN);
+
+ doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+
+ lookupKeyMap = new HashMap<ResourceKey, String>();
+
+ orchestrationStatusValidator.validateOrchestrationStatus(execution);
+
+ assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ execution.getVariable("orchestrationStatusValidationResult"));
+ }
+
+ @Test
+ public void test_validateOrchestrationStatusSecondStageOfMultiStageEnabledVfModule() throws Exception {
+ String flowToBeCalled = "CreateVfModuleBB";
+
+ execution.setVariable("orchestrationStatusValidationResult",
+ OrchestrationStatusValidationDirective.SILENT_SUCCESS);
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("flowToBeCalled", flowToBeCalled);
+
+ GenericVnf genericVnf = buildGenericVnf();
+ ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf();
+ modelInfoGenericVnf.setMultiStageDesign("true");
+ setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
+ setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+
+ BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
+ buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
+ buildingBlockDetail.setId(1);
+ buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
+ buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
+
+ doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
+ new OrchestrationStatusStateTransitionDirective();
+ orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.FAIL);
+ orchestrationStatusStateTransitionDirective.setId(1);
+ orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
+ orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.CREATE);
+
+ doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
+ .getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
+ OrchestrationStatus.PENDING_ACTIVATION, OrchestrationAction.CREATE);
+
+ orchestrationStatusValidator.validateOrchestrationStatus(execution);
+
+ assertEquals(OrchestrationStatusValidationDirective.CONTINUE,
+ execution.getVariable("orchestrationStatusValidationResult"));
+ }
+
+
+ @Test
+ public void test_validateOrchestrationStatusSecondStageOfMultiStageWrongPrevStatusVfModule() throws Exception {
+ String flowToBeCalled = "CreateVfModuleBB";
+
+ execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.CONTINUE);
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("flowToBeCalled", flowToBeCalled);
+
+ GenericVnf genericVnf = buildGenericVnf();
+ ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf();
+ modelInfoGenericVnf.setMultiStageDesign("true");
+ setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
+ setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+
+ BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
+ buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
+ buildingBlockDetail.setId(1);
+ buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
+ buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
+
+ doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
+ new OrchestrationStatusStateTransitionDirective();
+ orchestrationStatusStateTransitionDirective
+ .setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
+ orchestrationStatusStateTransitionDirective.setId(1);
+ orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
+ orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.CREATE);
+
+ doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
+ .getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
+ OrchestrationStatus.PENDING_ACTIVATION, OrchestrationAction.CREATE);
+
+ orchestrationStatusValidator.validateOrchestrationStatus(execution);
+
+ assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ execution.getVariable("orchestrationStatusValidationResult"));
+ }
+
+ @Test
+ public void test_validateOrchestrationStatusSecondStageOfMultiStageDisabledVfModule() throws Exception {
+ String flowToBeCalled = "CreateVfModuleBB";
+
+ execution.setVariable("orchestrationStatusValidationResult",
+ OrchestrationStatusValidationDirective.SILENT_SUCCESS);
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("flowToBeCalled", flowToBeCalled);
+
+ GenericVnf genericVnf = buildGenericVnf();
+ ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf();
+ modelInfoGenericVnf.setMultiStageDesign("false");
+ setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
+ setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+
+ BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
+ buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
+ buildingBlockDetail.setId(1);
+ buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
+ buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
+
+ doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
+ new OrchestrationStatusStateTransitionDirective();
+ orchestrationStatusStateTransitionDirective
+ .setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
+ orchestrationStatusStateTransitionDirective.setId(1);
+ orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
+ orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.CREATE);
+
+ doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
+ .getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
+ OrchestrationStatus.PENDING_ACTIVATION, OrchestrationAction.CREATE);
+
+ orchestrationStatusValidator.validateOrchestrationStatus(execution);
+
+ assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ execution.getVariable("orchestrationStatusValidationResult"));
+ }
+
+ @Test
+ public void test_validateOrchestrationStatusSecondStageOfMultiStageWrongOrchStatusVfModule() throws Exception {
+ String flowToBeCalled = "CreateVfModuleBB";
+
+ execution.setVariable("orchestrationStatusValidationResult",
+ OrchestrationStatusValidationDirective.SILENT_SUCCESS);
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("flowToBeCalled", flowToBeCalled);
+
+ GenericVnf genericVnf = buildGenericVnf();
+ ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf();
+ modelInfoGenericVnf.setMultiStageDesign("true");
+ setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
+ setVfModule().setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+
+ BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
+ buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
+ buildingBlockDetail.setId(1);
+ buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
+ buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
+
+ doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
+ new OrchestrationStatusStateTransitionDirective();
+ orchestrationStatusStateTransitionDirective
+ .setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
+ orchestrationStatusStateTransitionDirective.setId(1);
+ orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
+ orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.CREATE);
+
+ doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
+ .getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.ASSIGNED,
+ OrchestrationAction.CREATE);
+
+ orchestrationStatusValidator.validateOrchestrationStatus(execution);
+
+ assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ execution.getVariable("orchestrationStatusValidationResult"));
+ }
+
+ @Test
+ public void test_validateOrchestrationStatusSecondStageOfMultiStageWrongTargetActionVfModule() throws Exception {
+ String flowToBeCalled = "CreateVfModuleBB";
+
+ execution.setVariable("orchestrationStatusValidationResult",
+ OrchestrationStatusValidationDirective.SILENT_SUCCESS);
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("flowToBeCalled", flowToBeCalled);
+
+ GenericVnf genericVnf = buildGenericVnf();
+ ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf();
+ modelInfoGenericVnf.setMultiStageDesign("true");
+ setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
+ setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+
+ BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
+ buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
+ buildingBlockDetail.setId(1);
+ buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
+ buildingBlockDetail.setTargetAction(OrchestrationAction.ACTIVATE);
+
+ doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
+ new OrchestrationStatusStateTransitionDirective();
+ orchestrationStatusStateTransitionDirective
+ .setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
+ orchestrationStatusStateTransitionDirective.setId(1);
+ orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
+ orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ACTIVATE);
+
+ doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
+ .getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
+ OrchestrationStatus.PENDING_ACTIVATION, OrchestrationAction.ACTIVATE);
+
+ orchestrationStatusValidator.validateOrchestrationStatus(execution);
+
+ assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ execution.getVariable("orchestrationStatusValidationResult"));
+ }
+
+ @Test
+ public void test_validateOrchestrationStatusSecondStageOfMultiStageWrongAlacarteValueVfModule() throws Exception {
+ String flowToBeCalled = "CreateVfModuleBB";
+
+ execution.setVariable("orchestrationStatusValidationResult",
+ OrchestrationStatusValidationDirective.SILENT_SUCCESS);
+ execution.setVariable("aLaCarte", false);
+ execution.setVariable("flowToBeCalled", flowToBeCalled);
+
+ GenericVnf genericVnf = buildGenericVnf();
+ ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf();
+ modelInfoGenericVnf.setMultiStageDesign("true");
+ setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
+ setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+
+ BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
+ buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
+ buildingBlockDetail.setId(1);
+ buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
+ buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
+
+ doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
+ new OrchestrationStatusStateTransitionDirective();
+ orchestrationStatusStateTransitionDirective
+ .setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
+ orchestrationStatusStateTransitionDirective.setId(1);
+ orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
+ orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ACTIVATE);
+
+ doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
+ .getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
+ OrchestrationStatus.PENDING_ACTIVATION, OrchestrationAction.CREATE);
+
+ orchestrationStatusValidator.validateOrchestrationStatus(execution);
+
+ assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ execution.getVariable("orchestrationStatusValidationResult"));
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorUnitTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorUnitTest.java
index 03b39f57e5..0da683de62 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorUnitTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorUnitTest.java
@@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.when;
-
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -41,25 +40,27 @@ import org.onap.so.db.catalog.client.CatalogDbClient;
@RunWith(MockitoJUnitRunner.class)
public class OrchestrationStatusValidatorUnitTest {
- @Mock
- private CatalogDbClient catalogDbClient;
-
- @InjectMocks
- private OrchestrationStatusValidator validator;
- @Test
- public void skipValidationTest() {
- BuildingBlockDetail bbDetail = new BuildingBlockDetail();
- bbDetail.setBuildingBlockName("customBB");
- bbDetail.setResourceType(ResourceType.NO_VALIDATE);
- bbDetail.setTargetAction(OrchestrationAction.CUSTOM);
- when(catalogDbClient.getBuildingBlockDetail("customBB")).thenReturn(bbDetail);
- BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake());
- execution.setVariable("flowToBeCalled", "customBB");
- execution.setVariable("aLaCarte", false);
- validator.validateOrchestrationStatus(execution);
-
-
- assertThat(execution.getVariable("orchestrationStatusValidationResult"), equalTo(OrchestrationStatusValidationDirective.VALIDATION_SKIPPED));
- }
-
+ @Mock
+ private CatalogDbClient catalogDbClient;
+
+ @InjectMocks
+ private OrchestrationStatusValidator validator;
+
+ @Test
+ public void skipValidationTest() {
+ BuildingBlockDetail bbDetail = new BuildingBlockDetail();
+ bbDetail.setBuildingBlockName("customBB");
+ bbDetail.setResourceType(ResourceType.NO_VALIDATE);
+ bbDetail.setTargetAction(OrchestrationAction.CUSTOM);
+ when(catalogDbClient.getBuildingBlockDetail("customBB")).thenReturn(bbDetail);
+ BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake());
+ execution.setVariable("flowToBeCalled", "customBB");
+ execution.setVariable("aLaCarte", false);
+ validator.validateOrchestrationStatus(execution);
+
+
+ assertThat(execution.getVariable("orchestrationStatusValidationResult"),
+ equalTo(OrchestrationStatusValidationDirective.VALIDATION_SKIPPED));
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
index 14261e876d..a6ce88f164 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
@@ -26,7 +26,6 @@ import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.when;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Before;
@@ -42,105 +41,105 @@ import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.db.request.beans.InfraActiveRequests;
-public class WorkflowActionBBFailureTest extends BaseTaskTest {
+public class WorkflowActionBBFailureTest extends BaseTaskTest {
+
+ @Mock
+ protected WorkflowAction workflowAction;
+
+ @InjectMocks
+ @Spy
+ protected WorkflowActionBBFailure workflowActionBBFailure;
+
+ @Mock
+ InfraActiveRequests reqMock;
+
+ 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(), isA(Customer.class))).thenReturn(servInstance);
+ workflowAction.setBbInputSetupUtils(bbSetupUtils);
+ workflowAction.setBbInputSetup(bbInputSetup);
+ }
+
+ @Test
+ public void updateRequestStatusToFailed_Null_Rollback() {
+ String reqId = "reqId123";
+ execution.setVariable("mso-request-id", reqId);
+ execution.setVariable("retryCount", 3);
+ execution.setVariable("handlingCode", "Success");
+ execution.setVariable("gCurrentSequence", 1);
+ WorkflowException we = new WorkflowException("WorkflowAction", 1231, "Error Case");
+ execution.setVariable("WorkflowException", we);
+
+ doReturn(reqMock).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
+ workflowActionBBFailure.updateRequestStatusToFailed(execution);
+ Mockito.verify(reqMock, Mockito.times(1)).setStatusMessage("Error Case");
+ Mockito.verify(reqMock, Mockito.times(1)).setRequestStatus("FAILED");
+ Mockito.verify(reqMock, Mockito.times(1)).setProgress(Long.valueOf(100));
+ Mockito.verify(reqMock, Mockito.times(1)).setLastModifiedBy("CamundaBPMN");
+ }
+
+ @Test
+ public void updateRequestStatusToFailed() {
+ execution.setVariable("mso-request-id", "123");
+ execution.setVariable("isRollbackComplete", false);
+ execution.setVariable("isRollback", false);
+ InfraActiveRequests req = new InfraActiveRequests();
+ WorkflowException wfe = new WorkflowException("processKey123", 1, "error in test case");
+ execution.setVariable("WorkflowException", wfe);
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
+ workflowActionBBFailure.updateRequestStatusToFailed(execution);
+ String errorMsg = (String) execution.getVariable("ErrorMessage");
+ assertEquals("error in test case", errorMsg);
+ }
+
+ @Test
+ public void updateRequestStatusToFailedRollback() {
+ execution.setVariable("mso-request-id", "123");
+ execution.setVariable("isRollbackComplete", false);
+ execution.setVariable("isRollback", true);
+ InfraActiveRequests req = new InfraActiveRequests();
+ WorkflowException wfe = new WorkflowException("processKey123", 1, "error in rollback");
+ execution.setVariable("WorkflowException", wfe);
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
+ workflowActionBBFailure.updateRequestStatusToFailed(execution);
+ String errorMsg = (String) execution.getVariable("RollbackErrorMessage");
+ assertEquals("error in rollback", errorMsg);
+ }
+
+ @Test
+ public void updateRequestStatusToFailedRollbackCompleted() {
+ execution.setVariable("mso-request-id", "123");
+ execution.setVariable("isRollbackComplete", true);
+ execution.setVariable("isRollback", true);
+ InfraActiveRequests req = new InfraActiveRequests();
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
+ workflowActionBBFailure.updateRequestStatusToFailed(execution);
+ String errorMsg = (String) execution.getVariable("RollbackErrorMessage");
+ assertEquals("Rollback has been completed successfully.", errorMsg);
+ }
- @Mock
- protected WorkflowAction workflowAction;
-
- @InjectMocks
- @Spy
- protected WorkflowActionBBFailure workflowActionBBFailure;
-
- @Mock
- InfraActiveRequests reqMock;
-
- 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(), isA(Customer.class))).thenReturn(servInstance);
- workflowAction.setBbInputSetupUtils(bbSetupUtils);
- workflowAction.setBbInputSetup(bbInputSetup);
- }
-
- @Test
- public void updateRequestStatusToFailed_Null_Rollback(){
- String reqId = "reqId123";
- execution.setVariable("mso-request-id", reqId);
- execution.setVariable("retryCount", 3);
- execution.setVariable("handlingCode","Success");
- execution.setVariable("gCurrentSequence",1);
- WorkflowException we = new WorkflowException("WorkflowAction",1231,"Error Case");
- execution.setVariable("WorkflowException",we);
-
- doReturn(reqMock).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
- workflowActionBBFailure.updateRequestStatusToFailed(execution);
- Mockito.verify( reqMock, Mockito.times(1)).setStatusMessage("Error Case");
- Mockito.verify( reqMock, Mockito.times(1)).setRequestStatus("FAILED");
- Mockito.verify( reqMock, Mockito.times(1)).setProgress(Long.valueOf(100));
- Mockito.verify( reqMock, Mockito.times(1)).setLastModifiedBy("CamundaBPMN");
- }
-
- @Test
- public void updateRequestStatusToFailed(){
- execution.setVariable("mso-request-id", "123");
- execution.setVariable("isRollbackComplete", false);
- execution.setVariable("isRollback", false);
- InfraActiveRequests req = new InfraActiveRequests();
- WorkflowException wfe = new WorkflowException("processKey123", 1, "error in test case");
- execution.setVariable("WorkflowException", wfe);
- doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
- doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
- workflowActionBBFailure.updateRequestStatusToFailed(execution);
- String errorMsg = (String) execution.getVariable("ErrorMessage");
- assertEquals("error in test case", errorMsg);
- }
-
- @Test
- public void updateRequestStatusToFailedRollback(){
- execution.setVariable("mso-request-id", "123");
- execution.setVariable("isRollbackComplete", false);
- execution.setVariable("isRollback", true);
- InfraActiveRequests req = new InfraActiveRequests();
- WorkflowException wfe = new WorkflowException("processKey123", 1, "error in rollback");
- execution.setVariable("WorkflowException", wfe);
- doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
- doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
- workflowActionBBFailure.updateRequestStatusToFailed(execution);
- String errorMsg = (String) execution.getVariable("RollbackErrorMessage");
- assertEquals("error in rollback", errorMsg);
- }
-
- @Test
- public void updateRequestStatusToFailedRollbackCompleted(){
- execution.setVariable("mso-request-id", "123");
- execution.setVariable("isRollbackComplete", true);
- execution.setVariable("isRollback", true);
- InfraActiveRequests req = new InfraActiveRequests();
- doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
- doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
- workflowActionBBFailure.updateRequestStatusToFailed(execution);
- String errorMsg = (String) execution.getVariable("RollbackErrorMessage");
- assertEquals("Rollback has been completed successfully.", errorMsg);
- }
-
- @Test
- public void updateRequestStatusToFailedNoWorkflowException(){
- execution.setVariable("mso-request-id", "123");
- execution.setVariable("isRollbackComplete", false);
- execution.setVariable("isRollback", false);
- execution.setVariable("WorkflowExceptionErrorMessage", "error in test case");
- InfraActiveRequests req = new InfraActiveRequests();
- doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
- doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
- workflowActionBBFailure.updateRequestStatusToFailed(execution);
- String errorMsg = (String) execution.getVariable("ErrorMessage");
- assertEquals("error in test case", errorMsg);
- }
+ @Test
+ public void updateRequestStatusToFailedNoWorkflowException() {
+ execution.setVariable("mso-request-id", "123");
+ execution.setVariable("isRollbackComplete", false);
+ execution.setVariable("isRollback", false);
+ execution.setVariable("WorkflowExceptionErrorMessage", "error in test case");
+ InfraActiveRequests req = new InfraActiveRequests();
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
+ workflowActionBBFailure.updateRequestStatusToFailed(execution);
+ String errorMsg = (String) execution.getVariable("ErrorMessage");
+ assertEquals("error in test case", errorMsg);
+ }
}
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
index c5b4a482b7..029562a6e9 100644
--- 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
@@ -27,10 +27,8 @@ import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.when;
-
import java.util.ArrayList;
import java.util.List;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
@@ -51,314 +49,315 @@ import org.springframework.core.env.Environment;
public class WorkflowActionBBTasksTest extends BaseTaskTest {
- @Mock
- protected WorkflowAction workflowAction;
-
- @Mock
- protected WorkflowActionBBFailure workflowActionBBFailure;
-
- @InjectMocks
- @Spy
- protected WorkflowActionBBTasks workflowActionBBTasks;
-
- @Mock
- InfraActiveRequests reqMock;
-
- private DelegateExecution execution;
-
- @Mock
- protected Environment environment;
-
- @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<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
- ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
- flowsToExecute.add(ebb);
- execution.setVariable("flowsToExecute", flowsToExecute);
- workflowActionBBTasks.selectBB(execution);
- boolean success = (boolean) execution.getVariable("completed");
- int currentSequence = (int) execution.getVariable("gCurrentSequence");
- assertEquals(true,success);
- assertEquals(1,currentSequence);
- }
-
- @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<ExecuteBuildingBlock> 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");
- int currentSequence = (int) execution.getVariable("gCurrentSequence");
- assertEquals(false,success);
- assertEquals(1,currentSequence);
- }
-
- @Test
- public void updateRequestStatusToCompleteTest() throws Exception{
- String reqId = "reqId123";
- execution.setVariable("mso-request-id", reqId);
- execution.setVariable("requestAction", "createInstance");
- execution.setVariable("resourceName", "Service");
- execution.setVariable("aLaCarte", true);
- InfraActiveRequests req = new InfraActiveRequests();
- doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
- doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
- workflowActionBBTasks.updateRequestStatusToComplete(execution);
- assertEquals("ALaCarte-Service-createInstance request was executed correctly.",execution.getVariable("finalStatusMessage"));
- }
-
- @Test
- public void rollbackExecutionPathTest(){
- execution.setVariable("handlingCode", "Rollback");
- execution.setVariable("isRollback", false);
- List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- BuildingBlock bb1 = new BuildingBlock();
- bb1.setBpmnFlowName("AssignVfModuleBB");
- ebb1.setBuildingBlock(bb1);
- flowsToExecute.add(ebb1);
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- BuildingBlock bb2 = new BuildingBlock();
- bb2.setBpmnFlowName("CreateVfModuleBB");
- ebb2.setBuildingBlock(bb2);
- flowsToExecute.add(ebb2);
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- BuildingBlock bb3 = new BuildingBlock();
- bb3.setBpmnFlowName("ActivateVfModuleBB");
- ebb3.setBuildingBlock(bb3);
- flowsToExecute.add(ebb3);
-
- execution.setVariable("flowsToExecute", flowsToExecute);
- execution.setVariable("gCurrentSequence", 3);
- doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
-
- workflowActionBBTasks.rollbackExecutionPath(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateVfModuleBB");
- assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeleteVfModuleBB");
- assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignVfModuleBB");
- assertEquals(0,execution.getVariable("gCurrentSequence"));
- }
-
- @Test
- public void rollbackExecutionPathUnfinishedFlowTest(){
- execution.setVariable("handlingCode", "Rollback");
- execution.setVariable("isRollback", false);
- List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- BuildingBlock bb1 = new BuildingBlock();
- bb1.setBpmnFlowName("AssignVfModuleBB");
- ebb1.setBuildingBlock(bb1);
- flowsToExecute.add(ebb1);
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- BuildingBlock bb2 = new BuildingBlock();
- bb2.setBpmnFlowName("CreateVfModuleBB");
- ebb2.setBuildingBlock(bb2);
- flowsToExecute.add(ebb2);
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- BuildingBlock bb3 = new BuildingBlock();
- bb3.setBpmnFlowName("ActivateVfModuleBB");
- ebb3.setBuildingBlock(bb3);
- flowsToExecute.add(ebb3);
-
- execution.setVariable("flowsToExecute", flowsToExecute);
- execution.setVariable("gCurrentSequence", 2);
- doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
-
- workflowActionBBTasks.rollbackExecutionPath(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeleteVfModuleBB");
- assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"UnassignVfModuleBB");
- assertEquals(0,execution.getVariable("gCurrentSequence"));
- assertEquals(0,execution.getVariable("retryCount"));
- }
-
- @Test
- public void rollbackExecutionTest(){
- execution.setVariable("handlingCode", "Rollback");
- execution.setVariable("isRollback", false);
- List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- BuildingBlock bb1 = new BuildingBlock();
- bb1.setBpmnFlowName("AssignServiceInstanceBB");
- ebb1.setBuildingBlock(bb1);
- flowsToExecute.add(ebb1);
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- BuildingBlock bb2 = new BuildingBlock();
- bb2.setBpmnFlowName("CreateNetworkCollectionBB");
- ebb2.setBuildingBlock(bb2);
- flowsToExecute.add(ebb2);
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- BuildingBlock bb3 = new BuildingBlock();
- bb3.setBpmnFlowName("AssignNetworkBB");
- ebb3.setBuildingBlock(bb3);
- flowsToExecute.add(ebb3);
- ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
- BuildingBlock bb4 = new BuildingBlock();
- bb4.setBpmnFlowName("CreateNetworkBB");
- ebb4.setBuildingBlock(bb4);
- flowsToExecute.add(ebb4);
-
- execution.setVariable("flowsToExecute", flowsToExecute);
- execution.setVariable("gCurrentSequence", 3);
- doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
-
- workflowActionBBTasks.rollbackExecutionPath(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB");
- assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkCollectionBB");
- assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignServiceInstanceBB");
- assertEquals(0,execution.getVariable("gCurrentSequence"));
- }
-
- @Test
- public void rollbackExecutionRollbackToAssignedTest(){
- execution.setVariable("isRollback", false);
- execution.setVariable("handlingCode", "RollbackToAssigned");
- List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- BuildingBlock bb1 = new BuildingBlock();
- bb1.setBpmnFlowName("AssignVfModuleBB");
- ebb1.setBuildingBlock(bb1);
- flowsToExecute.add(ebb1);
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- BuildingBlock bb2 = new BuildingBlock();
- bb2.setBpmnFlowName("CreateVfModuleBB");
- ebb2.setBuildingBlock(bb2);
- flowsToExecute.add(ebb2);
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- BuildingBlock bb3 = new BuildingBlock();
- bb3.setBpmnFlowName("ActivateVfModuleBB");
- ebb3.setBuildingBlock(bb3);
- flowsToExecute.add(ebb3);
-
- execution.setVariable("flowsToExecute", flowsToExecute);
- execution.setVariable("gCurrentSequence", 2);
-
- workflowActionBBTasks.rollbackExecutionPath(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEquals("DeleteVfModuleBB",ebbs.get(0).getBuildingBlock().getBpmnFlowName());
- assertEquals(0,execution.getVariable("gCurrentSequence"));
- assertEquals(1,ebbs.size());
- }
-
- @Test
- public void rollbackExecutionRollbackToCreatedTest(){
- execution.setVariable("isRollback", false);
- execution.setVariable("handlingCode", "RollbackToCreated");
- List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- BuildingBlock bb1 = new BuildingBlock();
- bb1.setBpmnFlowName("AssignVfModuleBB");
- ebb1.setBuildingBlock(bb1);
- flowsToExecute.add(ebb1);
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- BuildingBlock bb2 = new BuildingBlock();
- bb2.setBpmnFlowName("CreateVfModuleBB");
- ebb2.setBuildingBlock(bb2);
- flowsToExecute.add(ebb2);
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- BuildingBlock bb3 = new BuildingBlock();
- bb3.setBpmnFlowName("ActivateVfModuleBB");
- ebb3.setBuildingBlock(bb3);
- flowsToExecute.add(ebb3);
-
- execution.setVariable("flowsToExecute", flowsToExecute);
- execution.setVariable("gCurrentSequence", 3);
-
- workflowActionBBTasks.rollbackExecutionPath(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEquals("DeactivateVfModuleBB",ebbs.get(0).getBuildingBlock().getBpmnFlowName());
- assertEquals(0,execution.getVariable("gCurrentSequence"));
- assertEquals(1,ebbs.size());
- }
-
- @Test
- public void checkRetryStatusTest(){
- String reqId = "reqId123";
- execution.setVariable("mso-request-id", reqId);
- doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
- doReturn("6").when(environment).getProperty("mso.rainyDay.maxRetries");
- execution.setVariable("handlingCode","Retry");
- execution.setVariable("retryCount", 1);
- execution.setVariable("gCurrentSequence",1);
- InfraActiveRequests req = new InfraActiveRequests();
- doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
- workflowActionBBTasks.checkRetryStatus(execution);
- assertEquals(0,execution.getVariable("gCurrentSequence"));
- }
-
- @Test
- public void checkRetryStatusTestExceededMaxRetries(){
- String reqId = "reqId123";
- execution.setVariable("mso-request-id", reqId);
- doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
- doReturn("6").when(environment).getProperty("mso.rainyDay.maxRetries");
- execution.setVariable("handlingCode","Retry");
- execution.setVariable("retryCount", 6);
- execution.setVariable("gCurrentSequence",1);
- InfraActiveRequests req = new InfraActiveRequests();
- doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
- try{
- workflowActionBBTasks.checkRetryStatus(execution);
- } catch (BpmnError e) {
- WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
- assertEquals("Exceeded maximum retries. Ending flow with status Abort",exception.getErrorMessage());
- }
- }
-
- @Test
- public void checkRetryStatusNoRetryTest(){
- String reqId = "reqId123";
- execution.setVariable("mso-request-id", reqId);
- execution.setVariable("retryCount", 3);
- execution.setVariable("handlingCode","Success");
- execution.setVariable("gCurrentSequence",1);
- InfraActiveRequests req = new InfraActiveRequests();
- doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
- workflowActionBBTasks.checkRetryStatus(execution);
- assertEquals(0,execution.getVariable("retryCount"));
- }
-
- @Test
- public void updateInstanceId(){
- String reqId = "req123";
- String instanceId = "123123123";
- execution.setVariable("mso-request-id", reqId);
- execution.setVariable("resourceId", instanceId);
- execution.setVariable("resourceType", WorkflowType.SERVICE);
- doReturn(reqMock).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
- doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
- workflowActionBBTasks.updateInstanceId(execution);
- Mockito.verify( reqMock, Mockito.times(1)).setServiceInstanceId(instanceId);
- }
+ @Mock
+ protected WorkflowAction workflowAction;
+
+ @Mock
+ protected WorkflowActionBBFailure workflowActionBBFailure;
+
+ @InjectMocks
+ @Spy
+ protected WorkflowActionBBTasks workflowActionBBTasks;
+
+ @Mock
+ InfraActiveRequests reqMock;
+
+ private DelegateExecution execution;
+
+ @Mock
+ protected Environment environment;
+
+ @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<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
+ flowsToExecute.add(ebb);
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ workflowActionBBTasks.selectBB(execution);
+ boolean success = (boolean) execution.getVariable("completed");
+ int currentSequence = (int) execution.getVariable("gCurrentSequence");
+ assertEquals(true, success);
+ assertEquals(1, currentSequence);
+ }
+
+ @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<ExecuteBuildingBlock> 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");
+ int currentSequence = (int) execution.getVariable("gCurrentSequence");
+ assertEquals(false, success);
+ assertEquals(1, currentSequence);
+ }
+
+ @Test
+ public void updateRequestStatusToCompleteTest() throws Exception {
+ String reqId = "reqId123";
+ execution.setVariable("mso-request-id", reqId);
+ execution.setVariable("requestAction", "createInstance");
+ execution.setVariable("resourceName", "Service");
+ execution.setVariable("aLaCarte", true);
+ InfraActiveRequests req = new InfraActiveRequests();
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
+ workflowActionBBTasks.updateRequestStatusToComplete(execution);
+ assertEquals("ALaCarte-Service-createInstance request was executed correctly.",
+ execution.getVariable("finalStatusMessage"));
+ }
+
+ @Test
+ public void rollbackExecutionPathTest() {
+ execution.setVariable("handlingCode", "Rollback");
+ execution.setVariable("isRollback", false);
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
+ BuildingBlock bb1 = new BuildingBlock();
+ bb1.setBpmnFlowName("AssignVfModuleBB");
+ ebb1.setBuildingBlock(bb1);
+ flowsToExecute.add(ebb1);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
+ BuildingBlock bb2 = new BuildingBlock();
+ bb2.setBpmnFlowName("CreateVfModuleBB");
+ ebb2.setBuildingBlock(bb2);
+ flowsToExecute.add(ebb2);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
+ BuildingBlock bb3 = new BuildingBlock();
+ bb3.setBpmnFlowName("ActivateVfModuleBB");
+ ebb3.setBuildingBlock(bb3);
+ flowsToExecute.add(ebb3);
+
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("gCurrentSequence", 3);
+ doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
+
+ workflowActionBBTasks.rollbackExecutionPath(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(), "DeactivateVfModuleBB");
+ assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(), "DeleteVfModuleBB");
+ assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(), "UnassignVfModuleBB");
+ assertEquals(0, execution.getVariable("gCurrentSequence"));
+ }
+
+ @Test
+ public void rollbackExecutionPathUnfinishedFlowTest() {
+ execution.setVariable("handlingCode", "Rollback");
+ execution.setVariable("isRollback", false);
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
+ BuildingBlock bb1 = new BuildingBlock();
+ bb1.setBpmnFlowName("AssignVfModuleBB");
+ ebb1.setBuildingBlock(bb1);
+ flowsToExecute.add(ebb1);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
+ BuildingBlock bb2 = new BuildingBlock();
+ bb2.setBpmnFlowName("CreateVfModuleBB");
+ ebb2.setBuildingBlock(bb2);
+ flowsToExecute.add(ebb2);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
+ BuildingBlock bb3 = new BuildingBlock();
+ bb3.setBpmnFlowName("ActivateVfModuleBB");
+ ebb3.setBuildingBlock(bb3);
+ flowsToExecute.add(ebb3);
+
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("gCurrentSequence", 2);
+ doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
+
+ workflowActionBBTasks.rollbackExecutionPath(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(), "DeleteVfModuleBB");
+ assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(), "UnassignVfModuleBB");
+ assertEquals(0, execution.getVariable("gCurrentSequence"));
+ assertEquals(0, execution.getVariable("retryCount"));
+ }
+
+ @Test
+ public void rollbackExecutionTest() {
+ execution.setVariable("handlingCode", "Rollback");
+ execution.setVariable("isRollback", false);
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
+ BuildingBlock bb1 = new BuildingBlock();
+ bb1.setBpmnFlowName("AssignServiceInstanceBB");
+ ebb1.setBuildingBlock(bb1);
+ flowsToExecute.add(ebb1);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
+ BuildingBlock bb2 = new BuildingBlock();
+ bb2.setBpmnFlowName("CreateNetworkCollectionBB");
+ ebb2.setBuildingBlock(bb2);
+ flowsToExecute.add(ebb2);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
+ BuildingBlock bb3 = new BuildingBlock();
+ bb3.setBpmnFlowName("AssignNetworkBB");
+ ebb3.setBuildingBlock(bb3);
+ flowsToExecute.add(ebb3);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
+ BuildingBlock bb4 = new BuildingBlock();
+ bb4.setBpmnFlowName("CreateNetworkBB");
+ ebb4.setBuildingBlock(bb4);
+ flowsToExecute.add(ebb4);
+
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("gCurrentSequence", 3);
+ doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
+
+ workflowActionBBTasks.rollbackExecutionPath(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(), "UnassignNetworkBB");
+ assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(), "DeleteNetworkCollectionBB");
+ assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(), "UnassignServiceInstanceBB");
+ assertEquals(0, execution.getVariable("gCurrentSequence"));
+ }
+
+ @Test
+ public void rollbackExecutionRollbackToAssignedTest() {
+ execution.setVariable("isRollback", false);
+ execution.setVariable("handlingCode", "RollbackToAssigned");
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
+ BuildingBlock bb1 = new BuildingBlock();
+ bb1.setBpmnFlowName("AssignVfModuleBB");
+ ebb1.setBuildingBlock(bb1);
+ flowsToExecute.add(ebb1);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
+ BuildingBlock bb2 = new BuildingBlock();
+ bb2.setBpmnFlowName("CreateVfModuleBB");
+ ebb2.setBuildingBlock(bb2);
+ flowsToExecute.add(ebb2);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
+ BuildingBlock bb3 = new BuildingBlock();
+ bb3.setBpmnFlowName("ActivateVfModuleBB");
+ ebb3.setBuildingBlock(bb3);
+ flowsToExecute.add(ebb3);
+
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("gCurrentSequence", 2);
+
+ workflowActionBBTasks.rollbackExecutionPath(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals("DeleteVfModuleBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName());
+ assertEquals(0, execution.getVariable("gCurrentSequence"));
+ assertEquals(1, ebbs.size());
+ }
+
+ @Test
+ public void rollbackExecutionRollbackToCreatedTest() {
+ execution.setVariable("isRollback", false);
+ execution.setVariable("handlingCode", "RollbackToCreated");
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
+ BuildingBlock bb1 = new BuildingBlock();
+ bb1.setBpmnFlowName("AssignVfModuleBB");
+ ebb1.setBuildingBlock(bb1);
+ flowsToExecute.add(ebb1);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
+ BuildingBlock bb2 = new BuildingBlock();
+ bb2.setBpmnFlowName("CreateVfModuleBB");
+ ebb2.setBuildingBlock(bb2);
+ flowsToExecute.add(ebb2);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
+ BuildingBlock bb3 = new BuildingBlock();
+ bb3.setBpmnFlowName("ActivateVfModuleBB");
+ ebb3.setBuildingBlock(bb3);
+ flowsToExecute.add(ebb3);
+
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("gCurrentSequence", 3);
+
+ workflowActionBBTasks.rollbackExecutionPath(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals("DeactivateVfModuleBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName());
+ assertEquals(0, execution.getVariable("gCurrentSequence"));
+ assertEquals(1, ebbs.size());
+ }
+
+ @Test
+ public void checkRetryStatusTest() {
+ String reqId = "reqId123";
+ execution.setVariable("mso-request-id", reqId);
+ doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
+ doReturn("6").when(environment).getProperty("mso.rainyDay.maxRetries");
+ execution.setVariable("handlingCode", "Retry");
+ execution.setVariable("retryCount", 1);
+ execution.setVariable("gCurrentSequence", 1);
+ InfraActiveRequests req = new InfraActiveRequests();
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
+ workflowActionBBTasks.checkRetryStatus(execution);
+ assertEquals(0, execution.getVariable("gCurrentSequence"));
+ }
+
+ @Test
+ public void checkRetryStatusTestExceededMaxRetries() {
+ String reqId = "reqId123";
+ execution.setVariable("mso-request-id", reqId);
+ doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
+ doReturn("6").when(environment).getProperty("mso.rainyDay.maxRetries");
+ execution.setVariable("handlingCode", "Retry");
+ execution.setVariable("retryCount", 6);
+ execution.setVariable("gCurrentSequence", 1);
+ InfraActiveRequests req = new InfraActiveRequests();
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
+ try {
+ workflowActionBBTasks.checkRetryStatus(execution);
+ } catch (BpmnError e) {
+ WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
+ assertEquals("Exceeded maximum retries. Ending flow with status Abort", exception.getErrorMessage());
+ }
+ }
+
+ @Test
+ public void checkRetryStatusNoRetryTest() {
+ String reqId = "reqId123";
+ execution.setVariable("mso-request-id", reqId);
+ execution.setVariable("retryCount", 3);
+ execution.setVariable("handlingCode", "Success");
+ execution.setVariable("gCurrentSequence", 1);
+ InfraActiveRequests req = new InfraActiveRequests();
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
+ workflowActionBBTasks.checkRetryStatus(execution);
+ assertEquals(0, execution.getVariable("retryCount"));
+ }
+
+ @Test
+ public void updateInstanceId() {
+ String reqId = "req123";
+ String instanceId = "123123123";
+ execution.setVariable("mso-request-id", reqId);
+ execution.setVariable("resourceId", instanceId);
+ execution.setVariable("resourceType", WorkflowType.SERVICE);
+ doReturn(reqMock).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
+ workflowActionBBTasks.updateInstanceId(execution);
+ Mockito.verify(reqMock, Mockito.times(1)).setServiceInstanceId(instanceId);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksUpdateReqDbTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksUpdateReqDbTest.java
index 0f106ad913..9c3f0c6f0b 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksUpdateReqDbTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksUpdateReqDbTest.java
@@ -26,10 +26,8 @@ import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
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;
@@ -43,52 +41,53 @@ import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.db.request.beans.InfraActiveRequests;
-public class WorkflowActionBBTasksUpdateReqDbTest extends BaseTaskTest{
+public class WorkflowActionBBTasksUpdateReqDbTest extends BaseTaskTest {
+
+ protected WorkflowAction workflowAction = new WorkflowAction();
+
+ @Spy
+ @InjectMocks
+ 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(), any())).thenReturn(servInstance);
+ workflowAction.setBbInputSetupUtils(bbSetupUtils);
+ workflowAction.setBbInputSetup(bbInputSetup);
+ }
- protected WorkflowAction workflowAction = new WorkflowAction();
-
- @Spy
- @InjectMocks
- 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(), any())).thenReturn(servInstance);
- workflowAction.setBbInputSetupUtils(bbSetupUtils);
- workflowAction.setBbInputSetup(bbInputSetup);
- }
-
- @Test
- public void getUpdatedRequestTest() throws Exception{
- List<ExecuteBuildingBlock> 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);
- String requestId = "requestId";
- execution.setVariable("mso-request-id", requestId);
- execution.setVariable("flowsToExecute", flowsToExecute);
- int currentSequence = 2;
- String expectedStatusMessage = "Execution of CreateNetworkBB has completed successfully, next invoking ActivateNetworkBB (Execution Path progress: BBs completed = 1; BBs remaining = 1).";
- Long expectedLong = new Long(52);
- InfraActiveRequests mockedRequest = new InfraActiveRequests();
- doReturn(mockedRequest).when(requestsDbClient).getInfraActiveRequestbyRequestId(isA(String.class));
- InfraActiveRequests actual = workflowActionBBTasks.getUpdatedRequest(execution, currentSequence);
- assertEquals(expectedStatusMessage, actual.getFlowStatus());
- assertEquals(expectedLong, actual.getProgress());
- }
+ @Test
+ public void getUpdatedRequestTest() throws Exception {
+ List<ExecuteBuildingBlock> 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);
+ String requestId = "requestId";
+ execution.setVariable("mso-request-id", requestId);
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ int currentSequence = 2;
+ String expectedStatusMessage =
+ "Execution of CreateNetworkBB has completed successfully, next invoking ActivateNetworkBB (Execution Path progress: BBs completed = 1; BBs remaining = 1).";
+ Long expectedLong = new Long(52);
+ InfraActiveRequests mockedRequest = new InfraActiveRequests();
+ doReturn(mockedRequest).when(requestsDbClient).getInfraActiveRequestbyRequestId(isA(String.class));
+ InfraActiveRequests actual = workflowActionBBTasks.getUpdatedRequest(execution, currentSequence);
+ assertEquals(expectedStatusMessage, actual.getFlowStatus());
+ assertEquals(expectedLong, actual.getProgress());
+ }
}
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
index 87e6daa58a..ad1238b86f 100644
--- 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
@@ -30,7 +30,6 @@ import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.when;
-
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -97,687 +96,808 @@ import org.onap.so.serviceinstancebeans.SubscriberInfo;
import org.springframework.core.env.Environment;
public class WorkflowActionTest extends BaseTaskTest {
-
-
- @Mock
- protected Environment environment;
- @InjectMocks
- protected WorkflowAction workflowAction;
- private DelegateExecution execution;
-
-
- @InjectMocks
- @Spy
- protected WorkflowAction SPY_workflowAction;
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- private String RESOURCE_PATH = "src/test/resources/__files/";
-
- @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<OrchestrationFlow> orchFlows = createFlowList("AssignNetwork1802BB","CreateNetworkBB","ActivateNetworkBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
- workflowAction.selectExecutionList(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"AssignNetwork1802BB","CreateNetworkBB","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<OrchestrationFlow> orchFlows = createFlowList("DeactivateNetworkBB","DeleteNetworkBB","UnassignNetwork1802BB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,true,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
- workflowAction.selectExecutionList(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"DeactivateNetworkBB","DeleteNetworkBB","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<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB","ActivateServiceInstanceBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,true,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
- workflowAction.selectExecutionList(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"AssignServiceInstanceBB","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<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB","AssignNetworkBB","AssignVnfBB","AssignVolumeGroupBB","AssignVfModuleBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- 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.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).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<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"AssignServiceInstanceBB","AssignVnfBB","AssignVolumeGroupBB","AssignVfModuleBB","AssignVfModuleBB","AssignVfModuleBB");
- }
-
- @Test
- public void selectExecutionListServiceMacroAssignNoCloudTest() 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/ServiceMacroAssignNoCloud.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
- execution.setVariable("requestUri", "v6/serviceInstances/123");
-
-
- NorthBoundRequest northBoundRequest = new NorthBoundRequest();
- List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB","AssignNetworkBB","AssignVnfBB","AssignVolumeGroupBB","AssignVfModuleBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- 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(environment.getProperty("org.onap.so.cloud-owner")).thenReturn("att-aic");
- when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"att-aic")).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<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"AssignServiceInstanceBB","AssignVnfBB","AssignVolumeGroupBB","AssignVfModuleBB","AssignVfModuleBB","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<OrchestrationFlow> orchFlows = createFlowList("CreateNetworkBB","ActivateNetworkBB","CreateVolumeGroupBB","ActivateVolumeGroupBB","CreateVfModuleBB","ActivateVfModuleBB"
- ,"ActivateVnfBB","ActivateServiceInstanceBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- 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.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
- workflowAction.selectExecutionList(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"CreateVolumeGroupBB","ActivateVolumeGroupBB","CreateVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","ActivateVfModuleBB","ActivateVnfBB","ActivateServiceInstanceBB");
- assertEquals("volumeGroup0", ebbs.get(0).getWorkflowResourceIds().getVolumeGroupId());
- assertEquals("volumeGroup0", ebbs.get(1).getWorkflowResourceIds().getVolumeGroupId());
- assertEquals("vfModule0", ebbs.get(2).getWorkflowResourceIds().getVfModuleId());
- assertEquals("vfModule1", ebbs.get(3).getWorkflowResourceIds().getVfModuleId());
- assertEquals("vfModule0", ebbs.get(4).getWorkflowResourceIds().getVfModuleId());
- assertEquals("vfModule1", ebbs.get(5).getWorkflowResourceIds().getVfModuleId());
- assertEquals("vnf0", ebbs.get(6).getWorkflowResourceIds().getVnfId());
- 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<OrchestrationFlow> orchFlows = createFlowList("DeactivateServiceInstanceBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
- workflowAction.selectExecutionList(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) 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<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB","CreateNetworkCollectionBB","AssignNetworkBB","AssignVnfBB","AssignVolumeGroupBB","AssignVfModuleBB"
- ,"CreateNetworkBB","ActivateNetworkBB","CreateVolumeGroupBB","ActivateVolumeGroupBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB"
- ,"ActivateVnfBB","ActivateNetworkCollectionBB","ActivateServiceInstanceBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- Service service = new Service();
- doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a");
- when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
- workflowAction.selectExecutionList(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"AssignServiceInstanceBB","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<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB","CreateNetworkCollectionBB","AssignNetworkBB","AssignVnfBB","AssignVolumeGroupBB","AssignVfModuleBB"
- ,"CreateNetworkBB","ActivateNetworkBB","CreateVolumeGroupBB","ActivateVolumeGroupBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB"
- ,"ActivateVnfBB","ActivateNetworkCollectionBB","ActivateServiceInstanceBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- 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.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
- workflowAction.selectExecutionList(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"AssignServiceInstanceBB","AssignNetworkBB","CreateNetworkBB","ActivateNetworkBB","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<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB","CreateNetworkCollectionBB","AssignNetworkBB","AssignVnfBB","AssignVolumeGroupBB","AssignVfModuleBB"
- ,"CreateNetworkBB","ActivateNetworkBB","CreateVolumeGroupBB","ActivateVolumeGroupBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB"
- ,"ActivateVnfBB","ActivateNetworkCollectionBB","ActivateServiceInstanceBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- Service service = new Service();
- List<NetworkResourceCustomization> 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");
- collectionNetworkResourceCust.setNetworkResourceCustomization(collectionResourceCustomization);
- instanceGroup.getCollectionNetworkResourceCustomizations().add(collectionNetworkResourceCust );
- List<CollectionResourceInstanceGroupCustomization> collectionInstanceGroupCustomizations = new ArrayList<>();
- CollectionResourceInstanceGroupCustomization collectionInstanceGroupCustomization = new CollectionResourceInstanceGroupCustomization();
- collectionInstanceGroupCustomization.setModelCustomizationUUID("123");
- collectionInstanceGroupCustomization.setSubInterfaceNetworkQuantity(3);
- collectionInstanceGroupCustomizations.add(collectionInstanceGroupCustomization);
- collectionInstanceGroupCustomization.setInstanceGroup(instanceGroup);
- collectionInstanceGroupCustomization.setCollectionResourceCust(collectionResourceCustomization);
- 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.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
- workflowAction.selectExecutionList(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"AssignServiceInstanceBB","CreateNetworkCollectionBB","AssignNetworkBB","CreateNetworkBB","ActivateNetworkBB","AssignNetworkBB","CreateNetworkBB","ActivateNetworkBB"
- ,"AssignNetworkBB","CreateNetworkBB","ActivateNetworkBB","ActivateNetworkCollectionBB","ActivateServiceInstanceBB");
- assertEquals("Network id not empty", !ebbs.get(2).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
- assertEquals("Network id not empty", !ebbs.get(3).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
- assertEquals("Network id not empty", !ebbs.get(4).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
- assertEquals("Network id same for AssignNetworkBB CreateNetworkBB ActivateNetworkBB",
- ebbs.get(2).getWorkflowResourceIds().getNetworkId() == ebbs.get(3).getWorkflowResourceIds().getNetworkId()
- && ebbs.get(3).getWorkflowResourceIds().getNetworkId() == ebbs.get(4).getWorkflowResourceIds().getNetworkId(), true);
- assertEquals("Network id not empty", !ebbs.get(5).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
- assertEquals("Network id not empty", !ebbs.get(6).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
- assertEquals("Network id not empty", !ebbs.get(7).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
- assertEquals("Network id same for AssignNetworkBB CreateNetworkBB ActivateNetworkBB",
- ebbs.get(5).getWorkflowResourceIds().getNetworkId() == ebbs.get(6).getWorkflowResourceIds().getNetworkId()
- && ebbs.get(6).getWorkflowResourceIds().getNetworkId() == ebbs.get(7).getWorkflowResourceIds().getNetworkId(), true);
- assertEquals("Network id not empty", !ebbs.get(8).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
- assertEquals("Network id not empty", !ebbs.get(9).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
- assertEquals("Network id not empty", !ebbs.get(10).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
- assertEquals("Network id same for AssignNetworkBB CreateNetworkBB ActivateNetworkBB",
- ebbs.get(8).getWorkflowResourceIds().getNetworkId() == ebbs.get(9).getWorkflowResourceIds().getNetworkId()
- && ebbs.get(9).getWorkflowResourceIds().getNetworkId() == ebbs.get(10).getWorkflowResourceIds().getNetworkId(), true);
- }
-
- @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<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB","CreateNetworkCollectionBB","AssignNetworkBB","AssignVnfBB","AssignVolumeGroupBB","AssignVfModuleBB"
- ,"CreateNetworkBB","ActivateNetworkBB","CreateVolumeGroupBB","ActivateVolumeGroupBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB"
- ,"ActivateVnfBB","ActivateNetworkCollectionBB","ActivateServiceInstanceBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- Service service = new Service();
- service.setModelUUID("3c40d244-808e-42ca-b09a-256d83d19d0a");
-
- 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.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).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);
- when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service);
- workflowAction.selectExecutionList(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"AssignServiceInstanceBB","AssignVnfBB","AssignVolumeGroupBB","AssignVfModuleBB","AssignVfModuleBB","AssignVfModuleBB","CreateVolumeGroupBB"
- ,"ActivateVolumeGroupBB","CreateVfModuleBB","CreateVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","ActivateVfModuleBB","ActivateVfModuleBB","ActivateVnfBB","ActivateServiceInstanceBB");
- assertEquals(3,ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
- int randomUUIDLength = UUID.randomUUID().toString().length();
- assertEquals(randomUUIDLength,ebbs.get(1).getWorkflowResourceIds().getVnfId().length());
- assertEquals(randomUUIDLength,ebbs.get(2).getWorkflowResourceIds().getVolumeGroupId().length());
- assertEquals(randomUUIDLength,ebbs.get(3).getWorkflowResourceIds().getVfModuleId().length());
- assertEquals(randomUUIDLength,ebbs.get(4).getWorkflowResourceIds().getVfModuleId().length());
- assertEquals(randomUUIDLength,ebbs.get(5).getWorkflowResourceIds().getVfModuleId().length());
- assertEquals(randomUUIDLength,ebbs.get(6).getWorkflowResourceIds().getVolumeGroupId().length());
- assertEquals(randomUUIDLength,ebbs.get(7).getWorkflowResourceIds().getVolumeGroupId().length());
- assertEquals(randomUUIDLength,ebbs.get(8).getWorkflowResourceIds().getVfModuleId().length());
- assertEquals(randomUUIDLength,ebbs.get(9).getWorkflowResourceIds().getVfModuleId().length());
- assertEquals(randomUUIDLength,ebbs.get(10).getWorkflowResourceIds().getVfModuleId().length());
- assertEquals(randomUUIDLength,ebbs.get(11).getWorkflowResourceIds().getVfModuleId().length());
- assertEquals(randomUUIDLength,ebbs.get(12).getWorkflowResourceIds().getVfModuleId().length());
- assertEquals(randomUUIDLength,ebbs.get(13).getWorkflowResourceIds().getVfModuleId().length());
- assertEquals(randomUUIDLength,ebbs.get(14).getWorkflowResourceIds().getVnfId().length());
- assertEquals(3,ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
- assertEquals(true, execution.getVariable("homing"));
- }
-
- @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<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB","DeleteVfModuleBB","DeactivateVolumeGroupBB","DeleteVolumeGroupBB","DeactivateVnfBB","DeactivateNetworkBB"
- ,"DeleteNetworkBB","DeleteNetworkCollectionBB","DeactivateServiceInstanceBB","UnassignVfModuleBB","UnassignVolumeGroupBB","UnassignVnfBB","UnassignNetworkBB","UnassignServiceInstanceBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- 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.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
- workflowAction.selectExecutionList(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"DeactivateVfModuleBB","DeactivateVfModuleBB","DeleteVfModuleBB","DeleteVfModuleBB","DeactivateVolumeGroupBB","DeleteVolumeGroupBB","DeactivateVnfBB"
- ,"DeactivateServiceInstanceBB","UnassignVfModuleBB","UnassignVfModuleBB","UnassignVolumeGroupBB","UnassignVnfBB","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<OrchestrationFlow> orchFlows = createFlowList("UnassignVfModuleBB","UnassignVolumeGroupBB","UnassignVnfBB","UnassignNetworkBB","UnassignServiceInstanceBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- 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.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
- workflowAction.selectExecutionList(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"UnassignVfModuleBB","UnassignVfModuleBB","UnassignVolumeGroupBB","UnassignVnfBB","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<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB","DeleteVfModuleBB","DeactivateVolumeGroupBB","DeleteVolumeGroupBB","DeactivateVnfBB","DeactivateNetworkBB"
- ,"DeleteNetworkBB","DeleteNetworkCollectionBB","DeactivateServiceInstanceBB","UnassignVfModuleBB","UnassignVolumeGroupBB","UnassignVnfBB","UnassignNetworkBB","UnassignServiceInstanceBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- 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.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
- workflowAction.selectExecutionList(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"DeactivateNetworkBB","DeleteNetworkBB","UnassignNetworkBB","DeactivateNetworkBB","DeleteNetworkBB","UnassignNetworkBB","DeleteNetworkCollectionBB"
- ,"DeactivateServiceInstanceBB","UnassignServiceInstanceBB");
- }
-
+
+
+ @Mock
+ protected Environment environment;
+ @InjectMocks
+ protected WorkflowAction workflowAction;
+ private DelegateExecution execution;
+
+
+ @InjectMocks
+ @Spy
+ protected WorkflowAction SPY_workflowAction;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ private String RESOURCE_PATH = "src/test/resources/__files/";
+
+ @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<OrchestrationFlow> orchFlows =
+ createFlowList("AssignNetwork1802BB", "CreateNetworkBB", "ActivateNetworkBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "AssignNetwork1802BB", "CreateNetworkBB", "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<OrchestrationFlow> orchFlows =
+ createFlowList("DeactivateNetworkBB", "DeleteNetworkBB", "UnassignNetwork1802BB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "DeactivateNetworkBB", "DeleteNetworkBB", "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<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "ActivateServiceInstanceBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "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<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "AssignNetworkBB", "AssignVnfBB",
+ "AssignVolumeGroupBB", "AssignVfModuleBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ 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.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "my-custom-cloud-owner")).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<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "AssignVnfBB", "AssignVolumeGroupBB",
+ "AssignVfModuleBB", "AssignVfModuleBB", "AssignVfModuleBB");
+ }
+
+ @Test
+ public void selectExecutionListServiceMacroAssignNoCloudTest() 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/ServiceMacroAssignNoCloud.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", false);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v6/serviceInstances/123");
+
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "AssignNetworkBB", "AssignVnfBB",
+ "AssignVolumeGroupBB", "AssignVfModuleBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ 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(environment.getProperty("org.onap.so.cloud-owner")).thenReturn("att-aic");
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "att-aic")).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<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "AssignVnfBB", "AssignVolumeGroupBB",
+ "AssignVfModuleBB", "AssignVfModuleBB", "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<OrchestrationFlow> orchFlows =
+ createFlowList("CreateNetworkBB", "ActivateNetworkBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB",
+ "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB", "ActivateServiceInstanceBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ 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.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "CreateVolumeGroupBB", "ActivateVolumeGroupBB", "CreateVfModuleBB",
+ "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB",
+ "ActivateServiceInstanceBB");
+ assertEquals("volumeGroup0", ebbs.get(0).getWorkflowResourceIds().getVolumeGroupId());
+ assertEquals("volumeGroup0", ebbs.get(1).getWorkflowResourceIds().getVolumeGroupId());
+ assertEquals("vfModule0", ebbs.get(2).getWorkflowResourceIds().getVfModuleId());
+ assertEquals("vfModule1", ebbs.get(3).getWorkflowResourceIds().getVfModuleId());
+ assertEquals("vfModule0", ebbs.get(4).getWorkflowResourceIds().getVfModuleId());
+ assertEquals("vfModule1", ebbs.get(5).getWorkflowResourceIds().getVfModuleId());
+ assertEquals("vnf0", ebbs.get(6).getWorkflowResourceIds().getVnfId());
+ 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<OrchestrationFlow> orchFlows = createFlowList("DeactivateServiceInstanceBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) 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<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB",
+ "AssignNetworkBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB", "CreateNetworkBB",
+ "ActivateNetworkBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB", "CreateVfModuleBB",
+ "ActivateVfModuleBB", "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB", "ActivateVnfBB",
+ "ActivateNetworkCollectionBB", "ActivateServiceInstanceBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ Service service = new Service();
+ doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a");
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "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<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB",
+ "AssignNetworkBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB", "CreateNetworkBB",
+ "ActivateNetworkBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB", "CreateVfModuleBB",
+ "ActivateVfModuleBB", "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB", "ActivateVnfBB",
+ "ActivateNetworkCollectionBB", "ActivateServiceInstanceBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ 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.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "AssignNetworkBB", "CreateNetworkBB",
+ "ActivateNetworkBB", "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<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB",
+ "AssignNetworkBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB", "CreateNetworkBB",
+ "ActivateNetworkBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB", "CreateVfModuleBB",
+ "ActivateVfModuleBB", "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB", "ActivateVnfBB",
+ "ActivateNetworkCollectionBB", "ActivateServiceInstanceBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ Service service = new Service();
+ List<NetworkResourceCustomization> 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");
+ collectionNetworkResourceCust.setNetworkResourceCustomization(collectionResourceCustomization);
+ instanceGroup.getCollectionNetworkResourceCustomizations().add(collectionNetworkResourceCust);
+ List<CollectionResourceInstanceGroupCustomization> collectionInstanceGroupCustomizations = new ArrayList<>();
+ CollectionResourceInstanceGroupCustomization collectionInstanceGroupCustomization =
+ new CollectionResourceInstanceGroupCustomization();
+ collectionInstanceGroupCustomization.setModelCustomizationUUID("123");
+ collectionInstanceGroupCustomization.setSubInterfaceNetworkQuantity(3);
+ collectionInstanceGroupCustomizations.add(collectionInstanceGroupCustomization);
+ collectionInstanceGroupCustomization.setInstanceGroup(instanceGroup);
+ collectionInstanceGroupCustomization.setCollectionResourceCust(collectionResourceCustomization);
+ 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.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "CreateNetworkCollectionBB", "AssignNetworkBB",
+ "CreateNetworkBB", "ActivateNetworkBB", "AssignNetworkBB", "CreateNetworkBB", "ActivateNetworkBB",
+ "AssignNetworkBB", "CreateNetworkBB", "ActivateNetworkBB", "ActivateNetworkCollectionBB",
+ "ActivateServiceInstanceBB");
+ assertEquals("Network id not empty", !ebbs.get(2).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
+ assertEquals("Network id not empty", !ebbs.get(3).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
+ assertEquals("Network id not empty", !ebbs.get(4).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
+ assertEquals("Network id same for AssignNetworkBB CreateNetworkBB ActivateNetworkBB",
+ ebbs.get(2).getWorkflowResourceIds().getNetworkId() == ebbs.get(3).getWorkflowResourceIds()
+ .getNetworkId()
+ && ebbs.get(3).getWorkflowResourceIds().getNetworkId() == ebbs.get(4).getWorkflowResourceIds()
+ .getNetworkId(),
+ true);
+ assertEquals("Network id not empty", !ebbs.get(5).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
+ assertEquals("Network id not empty", !ebbs.get(6).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
+ assertEquals("Network id not empty", !ebbs.get(7).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
+ assertEquals("Network id same for AssignNetworkBB CreateNetworkBB ActivateNetworkBB",
+ ebbs.get(5).getWorkflowResourceIds().getNetworkId() == ebbs.get(6).getWorkflowResourceIds()
+ .getNetworkId()
+ && ebbs.get(6).getWorkflowResourceIds().getNetworkId() == ebbs.get(7).getWorkflowResourceIds()
+ .getNetworkId(),
+ true);
+ assertEquals("Network id not empty", !ebbs.get(8).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
+ assertEquals("Network id not empty", !ebbs.get(9).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
+ assertEquals("Network id not empty", !ebbs.get(10).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
+ assertEquals("Network id same for AssignNetworkBB CreateNetworkBB ActivateNetworkBB",
+ ebbs.get(8).getWorkflowResourceIds().getNetworkId() == ebbs.get(9).getWorkflowResourceIds()
+ .getNetworkId()
+ && ebbs.get(9).getWorkflowResourceIds().getNetworkId() == ebbs.get(10).getWorkflowResourceIds()
+ .getNetworkId(),
+ true);
+ }
+
+ @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<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB",
+ "AssignNetworkBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB", "CreateNetworkBB",
+ "ActivateNetworkBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB", "CreateVfModuleBB",
+ "ActivateVfModuleBB", "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB", "ActivateVnfBB",
+ "ActivateNetworkCollectionBB", "ActivateServiceInstanceBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ Service service = new Service();
+ service.setModelUUID("3c40d244-808e-42ca-b09a-256d83d19d0a");
+
+ 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.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "my-custom-cloud-owner")).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);
+ when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "AssignVnfBB", "AssignVolumeGroupBB",
+ "AssignVfModuleBB", "AssignVfModuleBB", "AssignVfModuleBB", "CreateVolumeGroupBB",
+ "ActivateVolumeGroupBB", "CreateVfModuleBB", "CreateVfModuleBB", "CreateVfModuleBB",
+ "ActivateVfModuleBB", "ActivateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB",
+ "ActivateServiceInstanceBB");
+ assertEquals(3, ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
+ int randomUUIDLength = UUID.randomUUID().toString().length();
+ assertEquals(randomUUIDLength, ebbs.get(1).getWorkflowResourceIds().getVnfId().length());
+ assertEquals(randomUUIDLength, ebbs.get(2).getWorkflowResourceIds().getVolumeGroupId().length());
+ assertEquals(randomUUIDLength, ebbs.get(3).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(randomUUIDLength, ebbs.get(4).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(randomUUIDLength, ebbs.get(5).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(randomUUIDLength, ebbs.get(6).getWorkflowResourceIds().getVolumeGroupId().length());
+ assertEquals(randomUUIDLength, ebbs.get(7).getWorkflowResourceIds().getVolumeGroupId().length());
+ assertEquals(randomUUIDLength, ebbs.get(8).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(randomUUIDLength, ebbs.get(9).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(randomUUIDLength, ebbs.get(10).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(randomUUIDLength, ebbs.get(11).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(randomUUIDLength, ebbs.get(12).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(randomUUIDLength, ebbs.get(13).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(randomUUIDLength, ebbs.get(14).getWorkflowResourceIds().getVnfId().length());
+ assertEquals(3, ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
+ assertEquals(true, execution.getVariable("homing"));
+ }
+
+ @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<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
+ "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB", "DeactivateNetworkBB",
+ "DeleteNetworkBB", "DeleteNetworkCollectionBB", "DeactivateServiceInstanceBB", "UnassignVfModuleBB",
+ "UnassignVolumeGroupBB", "UnassignVnfBB", "UnassignNetworkBB", "UnassignServiceInstanceBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ 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.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "DeactivateVfModuleBB", "DeactivateVfModuleBB", "DeleteVfModuleBB",
+ "DeleteVfModuleBB", "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB",
+ "DeactivateServiceInstanceBB", "UnassignVfModuleBB", "UnassignVfModuleBB", "UnassignVolumeGroupBB",
+ "UnassignVnfBB", "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<OrchestrationFlow> orchFlows = createFlowList("UnassignVfModuleBB", "UnassignVolumeGroupBB",
+ "UnassignVnfBB", "UnassignNetworkBB", "UnassignServiceInstanceBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ 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.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "UnassignVfModuleBB", "UnassignVfModuleBB", "UnassignVolumeGroupBB",
+ "UnassignVnfBB", "UnassignServiceInstanceBB");
+ }
+
@Test
- public void selectExecutionListVnfMacroRecreateTest() throws Exception{
+ 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<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
+ "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB", "DeactivateNetworkBB",
+ "DeleteNetworkBB", "DeleteNetworkCollectionBB", "DeactivateServiceInstanceBB", "UnassignVfModuleBB",
+ "UnassignVolumeGroupBB", "UnassignVnfBB", "UnassignNetworkBB", "UnassignServiceInstanceBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ 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.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "DeactivateNetworkBB", "DeleteNetworkBB", "UnassignNetworkBB",
+ "DeactivateNetworkBB", "DeleteNetworkBB", "UnassignNetworkBB", "DeleteNetworkCollectionBB",
+ "DeactivateServiceInstanceBB", "UnassignServiceInstanceBB");
+ }
+
+ @Test
+ public void selectExecutionListVnfMacroRecreateTest() throws Exception {
String gAction = "recreateInstance";
String resource = "Vnf";
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/VnfMacroReplace.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
+ String bpmnRequest =
+ new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/VnfMacroReplace.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
execution.setVariable("aLaCarte", false);
execution.setVariable("apiVersion", "7");
execution.setVariable("requestUri", "v7/serviceInstances/123/vnfs/1234/recreate");
execution.setVariable("serviceInstanceId", "123");
execution.setVariable("vnfId", "1234");
-
+
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
- List<OrchestrationFlow> orchFlows = createFlowList("AAICheckVnfInMaintBB","AAISetVnfInMaintBB","DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB", "DeactivateVfModuleBB","DeleteVfModuleBB","DeactivateVnfBB","CreateVfModuleBB"
- ,"ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB","ActivateVnfBB","SDNOVnfHealthCheckBB","AAIUnsetVnfInMaintBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
+ List<OrchestrationFlow> orchFlows = createFlowList("AAICheckVnfInMaintBB", "AAISetVnfInMaintBB",
+ "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB", "DeactivateVfModuleBB",
+ "DeleteVfModuleBB", "DeactivateVnfBB", "CreateVfModuleBB", "ActivateVfModuleBB",
+ "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB", "ActivateVnfBB", "SDNOVnfHealthCheckBB",
+ "AAIUnsetVnfInMaintBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
ServiceInstance serviceInstanceAAI = new ServiceInstance();
serviceInstanceAAI.setServiceInstanceId("123");
- 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();
+ 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("1234");
-
- org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+
+ 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();
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
vfModule2.setVfModuleId("vfModule2");
vnf.getVfModules().add(vfModule2);
-
+
serviceInstanceMSO.getVnfs().add(vnf);
-
+
doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123");
doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
- when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"cloud-owner")).thenReturn(northBoundRequest);
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "cloud-owner")).thenReturn(northBoundRequest);
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"AAICheckVnfInMaintBB","AAISetVnfInMaintBB","DeactivateVfModuleBB","DeactivateVfModuleBB","DeleteVfModuleBB","DeleteVfModuleBB","DeactivateVnfBB"
- ,"CreateVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","ActivateVfModuleBB","ActivateVnfBB","SDNOVnfHealthCheckBB","AAIUnsetVnfInMaintBB");
+ assertEqualsBulkFlowName(ebbs, "AAICheckVnfInMaintBB", "AAISetVnfInMaintBB", "DeactivateVfModuleBB",
+ "DeactivateVfModuleBB", "DeleteVfModuleBB", "DeleteVfModuleBB", "DeactivateVnfBB", "CreateVfModuleBB",
+ "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB", "SDNOVnfHealthCheckBB",
+ "AAIUnsetVnfInMaintBB");
}
-
+
@Test
- public void selectExecutionListVnfMacroReplaceTest() throws Exception{
+ public void selectExecutionListVnfMacroReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "Vnf";
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/VnfMacroReplace.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
+ String bpmnRequest =
+ new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/VnfMacroReplace.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
execution.setVariable("aLaCarte", false);
execution.setVariable("apiVersion", "7");
execution.setVariable("requestUri", "v7/serviceInstances/123/vnfs/1234/replace");
execution.setVariable("serviceInstanceId", "123");
execution.setVariable("vnfId", "1234");
-
+
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
- List<OrchestrationFlow> orchFlows = createFlowList("AAICheckVnfInMaintBB","AAISetVnfInMaintBB","DeactivateFabricConfigurationBB","UnassignFabricConfigurationBB","DeactivateVfModuleBB","DeleteVfModuleBB"
- ,"DeactivateVnfBB","ChangeModelVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB","ChangeModelVnfBB","ActivateVnfBB","ChangeModelServiceInstanceBB","SDNOVnfHealthCheckBB","AAIUnsetVnfInMaintBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
+ List<OrchestrationFlow> orchFlows = createFlowList("AAICheckVnfInMaintBB", "AAISetVnfInMaintBB",
+ "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB", "DeactivateVfModuleBB",
+ "DeleteVfModuleBB", "DeactivateVnfBB", "ChangeModelVfModuleBB", "CreateVfModuleBB",
+ "ActivateVfModuleBB", "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB",
+ "ChangeModelVnfBB", "ActivateVnfBB", "ChangeModelServiceInstanceBB", "SDNOVnfHealthCheckBB",
+ "AAIUnsetVnfInMaintBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
ServiceInstance serviceInstanceAAI = new ServiceInstance();
serviceInstanceAAI.setServiceInstanceId("123");
- 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();
+ 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("1234");
- org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ 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();
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
vfModule2.setVfModuleId("vfModule2");
vnf.getVfModules().add(vfModule2);
serviceInstanceMSO.getVnfs().add(vnf);
@@ -792,647 +912,716 @@ public class WorkflowActionTest extends BaseTaskTest {
config.setConfigurationId("configId");
Optional<Configuration> configOp = Optional.of(config);
Optional<Relationships> relationshipsOp = Optional.of(relationships);
-
+
doReturn(relationshipsOp).when(workflowActionUtils).extractRelationshipsVnfc(isA(Relationships.class));
doReturn(configOp).when(workflowActionUtils).extractRelationshipsConfiguration(isA(Relationships.class));
doReturn(vfModuleAAI).when(bbSetupUtils).getAAIVfModule("1234", "vfModule2");
doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123");
doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
- when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"cloud-owner")).thenReturn(northBoundRequest);
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "cloud-owner")).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "AAICheckVnfInMaintBB", "AAISetVnfInMaintBB", "DeactivateFabricConfigurationBB",
+ "UnassignFabricConfigurationBB", "DeactivateVfModuleBB", "DeactivateVfModuleBB", "DeleteVfModuleBB",
+ "DeleteVfModuleBB", "DeactivateVnfBB", "ChangeModelVfModuleBB", "ChangeModelVfModuleBB",
+ "CreateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVfModuleBB",
+ "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB", "ChangeModelVnfBB", "ActivateVnfBB",
+ "ChangeModelServiceInstanceBB", "SDNOVnfHealthCheckBB", "AAIUnsetVnfInMaintBB");
+ }
+
+ @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<OrchestrationFlow> orchFlows = createFlowList("CreateNetworkCollectionBB", "AssignNetworkBB",
+ "CreateNetworkBB", "ActivateNetworkBB", "ActivateNetworkCollectionBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ 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.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "CreateNetworkCollectionBB", "AssignNetworkBB", "CreateNetworkBB",
+ "ActivateNetworkBB", "AssignNetworkBB", "CreateNetworkBB", "ActivateNetworkBB",
+ "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<OrchestrationFlow> orchFlows = createFlowList("DeactivateNetworkBB", "DeleteNetworkBB",
+ "UnassignNetworkBB", "DeactivateNetworkCollectionBB", "DeleteNetworkCollectionBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ 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.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "DeactivateNetworkBB", "DeleteNetworkBB", "UnassignNetworkBB",
+ "DeactivateNetworkBB", "DeleteNetworkBB", "UnassignNetworkBB", "DeactivateNetworkCollectionBB",
+ "DeleteNetworkCollectionBB");
+ }
+
+ @Test
+ public void selectExecutionListALaCarteVfModuleNoFabricCreateTest() throws Exception {
+ String gAction = "createInstance";
+ String resource = "VfModule";
+ 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/VfModuleCreateWithFabric.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri",
+ "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
+
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB",
+ "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB");
+ }
+
+ @Test
+ public void selectExecutionListALaCarteVfModuleFabricCreateTest() throws Exception {
+ String gAction = "createInstance";
+ String resource = "VfModule";
+ 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/VfModuleCreateWithFabric.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri",
+ "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB",
+ "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ List<CvnfcCustomization> cvnfcCustomizations = new ArrayList<CvnfcCustomization>();
+ CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
+ CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization =
+ new CvnfcConfigurationCustomization();
+ ConfigurationResource configurationResource = new ConfigurationResource();
+ configurationResource.setToscaNodeType("FabricConfiguration");
+ vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
+ vnfVfmoduleCvnfcConfigurationCustomization.setModelInstanceName("modelInstanceName1");
+ vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization);
+ Set<CvnfcConfigurationCustomization> custSet = new HashSet<CvnfcConfigurationCustomization>();
+ custSet.add(vnfVfmoduleCvnfcConfigurationCustomization);
+ cvnfcCustomization.setCvnfcConfigurationCustomization(custSet);
+ cvnfcCustomization.setDescription("description");
+ cvnfcCustomizations.add(cvnfcCustomization);
+
+ CvnfcCustomization cvnfcCustomization2 = new CvnfcCustomization();
+ CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization2 =
+ new CvnfcConfigurationCustomization();
+ ConfigurationResource configurationResource2 = new ConfigurationResource();
+ configurationResource2.setToscaNodeType("FabricConfiguration");
+ vnfVfmoduleCvnfcConfigurationCustomization2.setConfigurationResource(configurationResource2);
+ vnfVfmoduleCvnfcConfigurationCustomization2.setModelInstanceName("modelInstanceName2");
+ vnfVfmoduleCvnfcConfigurationCustomization2.setCvnfcCustomization(cvnfcCustomization2);
+ Set<CvnfcConfigurationCustomization> custSet2 = new HashSet<CvnfcConfigurationCustomization>();
+ custSet2.add(vnfVfmoduleCvnfcConfigurationCustomization2);
+ cvnfcCustomization2.setCvnfcConfigurationCustomization(custSet2);
+ cvnfcCustomization2.setDescription("description2");
+ cvnfcCustomizations.add(cvnfcCustomization2);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ // when(catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID("fc25201d-36d6-43a3-8d39-fdae88e526ae",
+ // "9a6d01fd-19a7-490a-9800-460830a12e0b")).thenReturn(cvnfcCustomizations);
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"AAICheckVnfInMaintBB","AAISetVnfInMaintBB", "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB", "DeactivateVfModuleBB","DeactivateVfModuleBB","DeleteVfModuleBB","DeleteVfModuleBB","DeactivateVnfBB"
- ,"ChangeModelVfModuleBB" ,"ChangeModelVfModuleBB" , "CreateVfModuleBB","CreateVfModuleBB", "ActivateVfModuleBB","ActivateVfModuleBB", "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB", "ChangeModelVnfBB", "ActivateVnfBB","ChangeModelServiceInstanceBB","SDNOVnfHealthCheckBB","AAIUnsetVnfInMaintBB");
+ assertEqualsBulkFlowName(ebbs, "AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB",
+ "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB", "AssignFabricConfigurationBB",
+ "ActivateFabricConfigurationBB");
+ }
+
+ @Test
+ public void selectExecutionListALaCarteVfModuleFabricDeleteTest() throws Exception {
+ String gAction = "deleteInstance";
+ String resource = "VfModule";
+ 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/VfModuleCreateWithFabric.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri",
+ "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
+ "UnassignVfModuleBB", "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+
+ org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
+ vnf.setVnfId("vnf0");
+ vnf.setModelCustomizationId("modelCustomizationId");
+ when(bbSetupUtils.getAAIGenericVnf(anyObject())).thenReturn(vnf);
+
+ org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule();
+ vfModule.setModelCustomizationId("modelCustomizationId");
+ when(bbSetupUtils.getAAIVfModule(anyObject(), anyObject())).thenReturn(vfModule);
+
+ List<org.onap.aai.domain.yang.Vnfc> vnfcs = new ArrayList<org.onap.aai.domain.yang.Vnfc>();
+ org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
+ vnfc.setModelInvariantId("modelInvariantId");
+ vnfc.setVnfcName("testVnfcName");
+ vnfcs.add(vnfc);
+ doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(anyObject(), anyObject(), anyObject(),
+ anyObject());
+
+ List<org.onap.aai.domain.yang.Configuration> configurations =
+ new ArrayList<org.onap.aai.domain.yang.Configuration>();
+ org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
+ configuration.setConfigurationId("configurationId");
+ configuration.setModelCustomizationId("modelCustimizationId");
+ configuration.setConfigurationName("testConfigurationName");
+ configurations.add(configuration);
+ doReturn(configurations).when(SPY_workflowAction).getRelatedResourcesInVnfc(anyObject(), anyObject(),
+ anyObject());
+
+ doReturn("testName").when(SPY_workflowAction).getVnfcNameForConfiguration(anyObject());
+
+ SPY_workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB",
+ "DeactivateVfModuleBB", "DeleteVfModuleBB", "UnassignVfModuleBB");
}
-
- @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<OrchestrationFlow> orchFlows = createFlowList("CreateNetworkCollectionBB","AssignNetworkBB","CreateNetworkBB","ActivateNetworkBB","ActivateNetworkCollectionBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- 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.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
- when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service);
- workflowAction.selectExecutionList(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"CreateNetworkCollectionBB","AssignNetworkBB","CreateNetworkBB","ActivateNetworkBB","AssignNetworkBB","CreateNetworkBB","ActivateNetworkBB","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<OrchestrationFlow> orchFlows = createFlowList("DeactivateNetworkBB","DeleteNetworkBB","UnassignNetworkBB","DeactivateNetworkCollectionBB","DeleteNetworkCollectionBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- 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.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,false,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
- when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service);
- workflowAction.selectExecutionList(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"DeactivateNetworkBB","DeleteNetworkBB","UnassignNetworkBB","DeactivateNetworkBB","DeleteNetworkBB","UnassignNetworkBB","DeactivateNetworkCollectionBB"
- ,"DeleteNetworkCollectionBB");
- }
-
- @Test
- public void selectExecutionListALaCarteVfModuleNoFabricCreateTest() throws Exception{
- String gAction = "createInstance";
- String resource = "VfModule";
- 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/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
- execution.setVariable("requestUri", "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
-
-
- NorthBoundRequest northBoundRequest = new NorthBoundRequest();
- List<OrchestrationFlow> orchFlows = createFlowList("AssignVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,true,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
- workflowAction.selectExecutionList(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"AssignVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB");
- }
-
- @Test
- public void selectExecutionListALaCarteVfModuleFabricCreateTest() throws Exception{
- String gAction = "createInstance";
- String resource = "VfModule";
- 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/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
- execution.setVariable("requestUri", "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
-
- NorthBoundRequest northBoundRequest = new NorthBoundRequest();
- List<OrchestrationFlow> orchFlows = createFlowList("AssignVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- List<CvnfcCustomization> cvnfcCustomizations = new ArrayList<CvnfcCustomization>();
- CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
- CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new CvnfcConfigurationCustomization();
- ConfigurationResource configurationResource = new ConfigurationResource();
- configurationResource.setToscaNodeType("FabricConfiguration");
- vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
- vnfVfmoduleCvnfcConfigurationCustomization.setModelInstanceName("modelInstanceName1");
- vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization);
- Set<CvnfcConfigurationCustomization> custSet = new HashSet<CvnfcConfigurationCustomization>();
- custSet.add(vnfVfmoduleCvnfcConfigurationCustomization);
- cvnfcCustomization.setCvnfcConfigurationCustomization(custSet);
- cvnfcCustomization.setDescription("description");
- cvnfcCustomizations.add(cvnfcCustomization);
-
- CvnfcCustomization cvnfcCustomization2 = new CvnfcCustomization();
- CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization2 = new CvnfcConfigurationCustomization();
- ConfigurationResource configurationResource2 = new ConfigurationResource();
- configurationResource2.setToscaNodeType("FabricConfiguration");
- vnfVfmoduleCvnfcConfigurationCustomization2.setConfigurationResource(configurationResource2);
- vnfVfmoduleCvnfcConfigurationCustomization2.setModelInstanceName("modelInstanceName2");
- vnfVfmoduleCvnfcConfigurationCustomization2.setCvnfcCustomization(cvnfcCustomization2);
- Set<CvnfcConfigurationCustomization> custSet2 = new HashSet<CvnfcConfigurationCustomization>();
- custSet2.add(vnfVfmoduleCvnfcConfigurationCustomization2);
- cvnfcCustomization2.setCvnfcConfigurationCustomization(custSet2);
- cvnfcCustomization2.setDescription("description2");
- cvnfcCustomizations.add(cvnfcCustomization2);
-
- when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,true,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
- //when(catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID("fc25201d-36d6-43a3-8d39-fdae88e526ae", "9a6d01fd-19a7-490a-9800-460830a12e0b")).thenReturn(cvnfcCustomizations);
- workflowAction.selectExecutionList(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"AssignVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB", "AssignFabricConfigurationBB","ActivateFabricConfigurationBB");
- }
-
- @Test
- public void selectExecutionListALaCarteVfModuleFabricDeleteTest() throws Exception{
- String gAction = "deleteInstance";
- String resource = "VfModule";
- 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/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
- execution.setVariable("requestUri", "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
-
- NorthBoundRequest northBoundRequest = new NorthBoundRequest();
- List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB","DeleteVfModuleBB","UnassignVfModuleBB","DeactivateFabricConfigurationBB","UnassignFabricConfigurationBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,true,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
-
- org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
- vnf.setVnfId("vnf0");
- vnf.setModelCustomizationId("modelCustomizationId");
- when(bbSetupUtils.getAAIGenericVnf(anyObject())).thenReturn(vnf);
-
- org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule();
- vfModule.setModelCustomizationId("modelCustomizationId");
- when(bbSetupUtils.getAAIVfModule(anyObject(), anyObject())).thenReturn(vfModule);
-
- List<org.onap.aai.domain.yang.Vnfc> vnfcs = new ArrayList<org.onap.aai.domain.yang.Vnfc>();
- org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
- vnfc.setModelInvariantId("modelInvariantId");
- vnfc.setVnfcName("testVnfcName");
- vnfcs.add(vnfc);
- doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(anyObject(), anyObject(), anyObject(), anyObject());
-
- List<org.onap.aai.domain.yang.Configuration> configurations = new ArrayList<org.onap.aai.domain.yang.Configuration>();
- org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
- configuration.setConfigurationId("configurationId");
- configuration.setModelCustomizationId("modelCustimizationId");
- configuration.setConfigurationName("testConfigurationName");
- configurations.add(configuration);
- doReturn(configurations).when(SPY_workflowAction).getRelatedResourcesInVnfc(anyObject(), anyObject(), anyObject());
-
- doReturn("testName").when(SPY_workflowAction).getVnfcNameForConfiguration(anyObject());
-
- SPY_workflowAction.selectExecutionList(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"DeactivateFabricConfigurationBB","UnassignFabricConfigurationBB","DeactivateVfModuleBB","DeleteVfModuleBB","UnassignVfModuleBB");
- }
-
- @Test
- public void selectExecutionListALaCarteVfModuleNoFabricDeleteTest() throws Exception{
- String gAction = "deleteInstance";
- String resource = "VfModule";
- 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/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
- execution.setVariable("requestUri", "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
-
- NorthBoundRequest northBoundRequest = new NorthBoundRequest();
- List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB","DeleteVfModuleBB","UnassignVfModuleBB","DeactivateFabricConfigurationBB","UnassignFabricConfigurationBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,true,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
-
- org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
- vnf.setVnfId("vnf0");
- vnf.setModelCustomizationId("modelCustomizationId");
- when(bbSetupUtils.getAAIGenericVnf(anyObject())).thenReturn(vnf);
-
- org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule();
- vfModule.setModelCustomizationId("modelCustomizationId");
- when(bbSetupUtils.getAAIVfModule(anyObject(), anyObject())).thenReturn(vfModule);
-
- List<org.onap.aai.domain.yang.Vnfc> vnfcs = new ArrayList<org.onap.aai.domain.yang.Vnfc>();
- org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
- vnfc.setModelInvariantId("modelInvariantId");
- vnfc.setVnfcName("testVnfcName");
- vnfcs.add(vnfc);
- doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(anyObject(), anyObject(), anyObject(), anyObject());
-
- List<org.onap.aai.domain.yang.Configuration> configurations = new ArrayList<org.onap.aai.domain.yang.Configuration>();
- org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
- doReturn(configurations).when(SPY_workflowAction).getRelatedResourcesInVnfc(anyObject(), anyObject(), anyObject());
-
- doReturn("testName").when(SPY_workflowAction).getVnfcNameForConfiguration(anyObject());
-
- SPY_workflowAction.selectExecutionList(execution);
- List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"DeactivateVfModuleBB","DeleteVfModuleBB","UnassignVfModuleBB");
- }
-
- @Test
- public void getRelatedResourcesInVfModuleTest() throws Exception{
- org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
- vnfc.setModelInvariantId("modelInvariantId");
- vnfc.setVnfcName("testVnfcName");
-
- String vfncPayload = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/BuildingBlocks/vnfcResponse.json")));
- AAIResultWrapper vfncWrapper = new AAIResultWrapper(vfncPayload);
-
- String configurationPayload = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/BuildingBlocks/configurationResponse.json")));
- AAIResultWrapper configurationWrapper = new AAIResultWrapper(configurationPayload);
- List<AAIResultWrapper> configurationResultWrappers = new ArrayList<AAIResultWrapper>();
- configurationResultWrappers.add(configurationWrapper);
-
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfc.getVnfcName());
- when(bbSetupUtils.getAAIResourceDepthOne(uri)).thenReturn(vfncWrapper);
-
- doReturn(configurationResultWrappers).when(SPY_workflowAction).getResultWrappersFromRelationships(anyObject(),anyObject());
- List<org.onap.aai.domain.yang.Configuration> configurationsList = SPY_workflowAction.getRelatedResourcesInVnfc(vnfc, org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION);
- assertEquals(1,configurationsList.size());
- assertEquals("testConfigurationId",configurationsList.get(0).getConfigurationId());
- }
-
- /**
- * WorkflowActionBB Tests
- */
-
- @Test
- public void pluralTest() {
- List<String> 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<ExecuteBuildingBlock> 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<ExecuteBuildingBlock> sorted = workflowAction.sortExecutionPathByObjectForVlanTagging(executeFlows,"createInstance");
- assertEqualsBulkFlowName(sorted,"AssignNetworkBB","CreateNetworkBB","ActivateNetworkBB","AssignNetworkBB","CreateNetworkBB","ActivateNetworkBB");
- }
-
- @Test
- public void sortExecutionPathByObjectForVlanTaggingDeleteTest() throws Exception{
- List<ExecuteBuildingBlock> 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<ExecuteBuildingBlock> sorted = workflowAction.sortExecutionPathByObjectForVlanTagging(executeFlows,"deleteInstance");
- assertEqualsBulkFlowName(sorted,"DeactivateNetworkBB","DeleteNetworkBB","UnassignNetworkBB","DeactivateNetworkBB","DeleteNetworkBB","UnassignNetworkBB");
- }
- @Test
- public void queryNorthBoundRequestCatalogDbNestedTest() throws MalformedURLException {
- NorthBoundRequest northBoundRequest = new NorthBoundRequest();
- List<OrchestrationFlow> orchFlows = createFlowList("AAICheckVnfInMaintBB","AAISetVnfInMaintBB","VNF-Macro-Replace","SDNOVnfHealthCheckBB","AAIUnsetVnfInMaintBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
- List<OrchestrationFlow> macroFlows = createFlowList("DeactivateVfModuleBB","DeleteVfModuleBB","DeactivateVnfBB","CreateVfModuleBB","ActivateVfModuleBB","ActivateVnfBB");
-
- when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner("replaceInstance","Vnf",false,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
- when(catalogDbClient.getOrchestrationFlowByAction("VNF-Macro-Replace")).thenReturn(macroFlows);
- List<OrchestrationFlow> flows = workflowAction.queryNorthBoundRequestCatalogDb(execution, "replaceInstance", WorkflowType.VNF, false,"my-custom-cloud-owner");
- 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 queryNorthBoundRequestCatalogDbTransportTest() throws MalformedURLException {
- NorthBoundRequest northBoundRequest = new NorthBoundRequest();
- List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
- when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwnerAndServiceType("createInstance","Service",true,"my-custom-cloud-owner","TRANSPORT")).thenReturn(northBoundRequest);
-
- List<OrchestrationFlow> flows = workflowAction.queryNorthBoundRequestCatalogDb(execution, "createInstance", WorkflowType.SERVICE, true,"my-custom-cloud-owner","TRANSPORT");
- assertEquals(flows.get(0).getFlowName(),"AssignServiceInstanceBB");
- }
-
- @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";
- String uri8 = "/v6/serviceInstances/123/vnfs/1234/vfModules/scaleOut";
- 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());
- result = workflowAction.extractResourceIdAndTypeFromUri(uri8);
- assertEquals(UUID.randomUUID().toString().length(),result.getResourceId().length());
+
+ @Test
+ public void selectExecutionListALaCarteVfModuleNoFabricDeleteTest() throws Exception {
+ String gAction = "deleteInstance";
+ String resource = "VfModule";
+ 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/VfModuleCreateWithFabric.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri",
+ "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
+ "UnassignVfModuleBB", "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+
+ org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
+ vnf.setVnfId("vnf0");
+ vnf.setModelCustomizationId("modelCustomizationId");
+ when(bbSetupUtils.getAAIGenericVnf(anyObject())).thenReturn(vnf);
+
+ org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule();
+ vfModule.setModelCustomizationId("modelCustomizationId");
+ when(bbSetupUtils.getAAIVfModule(anyObject(), anyObject())).thenReturn(vfModule);
+
+ List<org.onap.aai.domain.yang.Vnfc> vnfcs = new ArrayList<org.onap.aai.domain.yang.Vnfc>();
+ org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
+ vnfc.setModelInvariantId("modelInvariantId");
+ vnfc.setVnfcName("testVnfcName");
+ vnfcs.add(vnfc);
+ doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(anyObject(), anyObject(), anyObject(),
+ anyObject());
+
+ List<org.onap.aai.domain.yang.Configuration> configurations =
+ new ArrayList<org.onap.aai.domain.yang.Configuration>();
+ org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
+ doReturn(configurations).when(SPY_workflowAction).getRelatedResourcesInVnfc(anyObject(), anyObject(),
+ anyObject());
+
+ doReturn("testName").when(SPY_workflowAction).getVnfcNameForConfiguration(anyObject());
+
+ SPY_workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "DeactivateVfModuleBB", "DeleteVfModuleBB", "UnassignVfModuleBB");
+ }
+
+ @Test
+ public void getRelatedResourcesInVfModuleTest() throws Exception {
+ org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
+ vnfc.setModelInvariantId("modelInvariantId");
+ vnfc.setVnfcName("testVnfcName");
+
+ String vfncPayload =
+ new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/BuildingBlocks/vnfcResponse.json")));
+ AAIResultWrapper vfncWrapper = new AAIResultWrapper(vfncPayload);
+
+ String configurationPayload =
+ new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/BuildingBlocks/configurationResponse.json")));
+ AAIResultWrapper configurationWrapper = new AAIResultWrapper(configurationPayload);
+ List<AAIResultWrapper> configurationResultWrappers = new ArrayList<AAIResultWrapper>();
+ configurationResultWrappers.add(configurationWrapper);
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfc.getVnfcName());
+ when(bbSetupUtils.getAAIResourceDepthOne(uri)).thenReturn(vfncWrapper);
+
+ doReturn(configurationResultWrappers).when(SPY_workflowAction).getResultWrappersFromRelationships(anyObject(),
+ anyObject());
+ List<org.onap.aai.domain.yang.Configuration> configurationsList = SPY_workflowAction.getRelatedResourcesInVnfc(
+ vnfc, org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION);
+ assertEquals(1, configurationsList.size());
+ assertEquals("testConfigurationId", configurationsList.get(0).getConfigurationId());
+ }
+
+ /**
+ * WorkflowActionBB Tests
+ */
+
+ @Test
+ public void pluralTest() {
+ List<String> 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<ExecuteBuildingBlock> 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<ExecuteBuildingBlock> sorted =
+ workflowAction.sortExecutionPathByObjectForVlanTagging(executeFlows, "createInstance");
+ assertEqualsBulkFlowName(sorted, "AssignNetworkBB", "CreateNetworkBB", "ActivateNetworkBB", "AssignNetworkBB",
+ "CreateNetworkBB", "ActivateNetworkBB");
+ }
+
+ @Test
+ public void sortExecutionPathByObjectForVlanTaggingDeleteTest() throws Exception {
+ List<ExecuteBuildingBlock> 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<ExecuteBuildingBlock> sorted =
+ workflowAction.sortExecutionPathByObjectForVlanTagging(executeFlows, "deleteInstance");
+ assertEqualsBulkFlowName(sorted, "DeactivateNetworkBB", "DeleteNetworkBB", "UnassignNetworkBB",
+ "DeactivateNetworkBB", "DeleteNetworkBB", "UnassignNetworkBB");
+ }
+
+ @Test
+ public void queryNorthBoundRequestCatalogDbNestedTest() throws MalformedURLException {
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("AAICheckVnfInMaintBB", "AAISetVnfInMaintBB",
+ "VNF-Macro-Replace", "SDNOVnfHealthCheckBB", "AAIUnsetVnfInMaintBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+ List<OrchestrationFlow> macroFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
+ "DeactivateVnfBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB");
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner("replaceInstance",
+ "Vnf", false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ when(catalogDbClient.getOrchestrationFlowByAction("VNF-Macro-Replace")).thenReturn(macroFlows);
+ List<OrchestrationFlow> flows = workflowAction.queryNorthBoundRequestCatalogDb(execution, "replaceInstance",
+ WorkflowType.VNF, false, "my-custom-cloud-owner");
+ 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 queryNorthBoundRequestCatalogDbTransportTest() throws MalformedURLException {
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwnerAndServiceType(
+ "createInstance", "Service", true, "my-custom-cloud-owner", "TRANSPORT")).thenReturn(northBoundRequest);
+
+ List<OrchestrationFlow> flows = workflowAction.queryNorthBoundRequestCatalogDb(execution, "createInstance",
+ WorkflowType.SERVICE, true, "my-custom-cloud-owner", "TRANSPORT");
+ assertEquals(flows.get(0).getFlowName(), "AssignServiceInstanceBB");
+ }
+
+ @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";
+ String uri8 = "/v6/serviceInstances/123/vnfs/1234/vfModules/scaleOut";
+ 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());
+ result = workflowAction.extractResourceIdAndTypeFromUri(uri8);
+ assertEquals(UUID.randomUUID().toString().length(), result.getResourceId().length());
assertEquals("VfModule", result.getResourceType().toString());
-
- }
-
- @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<ServiceInstance> 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<L3Network> 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<GenericVnf> 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<VolumeGroup> 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", "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());
- }
- }
-
- @Ignore
- @Test
- public void traverseCatalogDbServiceMultipleNetworkTest() throws IOException{
- execution.setVariable("testProcessKey", "testProcessKeyValue");
- Service service = new Service();
- List<NetworkResourceCustomization> 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<CollectionResourceInstanceGroupCustomization> 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<Resource> resourceCounter = new ArrayList<>();
- thrown.expect(BpmnError.class);
- workflowAction.traverseCatalogDbService(execution, sIRequest, resourceCounter);
- }
-
- @Test
- public void sortVfModulesByBaseFirstTest(){
- List<Resource> 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<Resource> result = workflowAction.sortVfModulesByBaseFirst(resources);
- assertEquals("333",result.get(0).getResourceId());
- assertEquals("222",result.get(1).getResourceId());
- assertEquals("111",result.get(2).getResourceId());
- }
-
- @Test
- public void sortVfModulesByBaseLastTest(){
- List<Resource> resources = new ArrayList<>();
- Resource resource1 = new Resource(WorkflowType.VFMODULE,"111",false);
- resource1.setBaseVfModule(true);
- 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(false);
- resources.add(resource3);
- List<Resource> result = workflowAction.sortVfModulesByBaseLast(resources);
- assertEquals("333",result.get(0).getResourceId());
- assertEquals("222",result.get(1).getResourceId());
- assertEquals("111",result.get(2).getResourceId());
- }
+
+ }
+
+ @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<ServiceInstance> 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<L3Network> 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<GenericVnf> 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<VolumeGroup> 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", "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());
+ }
+ }
+
+ @Ignore
+ @Test
+ public void traverseCatalogDbServiceMultipleNetworkTest() throws IOException {
+ execution.setVariable("testProcessKey", "testProcessKeyValue");
+ Service service = new Service();
+ List<NetworkResourceCustomization> 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<CollectionResourceInstanceGroupCustomization> 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<Resource> resourceCounter = new ArrayList<>();
+ thrown.expect(BpmnError.class);
+ workflowAction.traverseCatalogDbService(execution, sIRequest, resourceCounter);
+ }
+
+ @Test
+ public void sortVfModulesByBaseFirstTest() {
+ List<Resource> 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<Resource> result = workflowAction.sortVfModulesByBaseFirst(resources);
+ assertEquals("333", result.get(0).getResourceId());
+ assertEquals("222", result.get(1).getResourceId());
+ assertEquals("111", result.get(2).getResourceId());
+ }
+
+ @Test
+ public void sortVfModulesByBaseLastTest() {
+ List<Resource> resources = new ArrayList<>();
+ Resource resource1 = new Resource(WorkflowType.VFMODULE, "111", false);
+ resource1.setBaseVfModule(true);
+ 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(false);
+ resources.add(resource3);
+ List<Resource> result = workflowAction.sortVfModulesByBaseLast(resources);
+ assertEquals("333", result.get(0).getResourceId());
+ assertEquals("222", result.get(1).getResourceId());
+ assertEquals("111", result.get(2).getResourceId());
+ }
@Test
public void findCatalogNetworkCollectionTest() {
@@ -1468,35 +1657,34 @@ public class WorkflowActionTest extends BaseTaskTest {
doReturn(networkCustomization2).when(catalogDbClient).getNetworkCollectionResourceCustomizationByID("321");
workflowAction.findCatalogNetworkCollection(execution, service);
assertEquals("Found multiple Network Collections in the Service model, only one per Service is supported.",
- execution.getVariable("WorkflowActionErrorMessage"));
+ execution.getVariable("WorkflowActionErrorMessage"));
}
@Test
- public void verifyLackOfNullPointerExceptionForNullResource(){
- ExecuteBuildingBlock result = null;
- try {
- result = workflowAction
- .buildExecuteBuildingBlock(new OrchestrationFlow(), null, null, null, null, null, false,
- null, null, null, false, null, true);
- }catch (NullPointerException e){
- fail("NullPointerException should not be thrown when 'resource' is null");
- }
- assertNotNull(result);
+ public void verifyLackOfNullPointerExceptionForNullResource() {
+ ExecuteBuildingBlock result = null;
+ try {
+ result = workflowAction.buildExecuteBuildingBlock(new OrchestrationFlow(), null, null, null, null, null,
+ false, null, null, null, false, null, true);
+ } catch (NullPointerException e) {
+ fail("NullPointerException should not be thrown when 'resource' is null");
+ }
+ assertNotNull(result);
}
- private List<OrchestrationFlow> createFlowList (String... flowNames){
- List<OrchestrationFlow> result = new ArrayList<>();
- for(String flowName : flowNames){
- OrchestrationFlow orchFlow = new OrchestrationFlow();
- orchFlow.setFlowName(flowName);
- result.add(orchFlow);
- }
- return result;
- }
-
- private void assertEqualsBulkFlowName (List<ExecuteBuildingBlock> ebbs, String... flowNames){
- for(int i = 0; i<ebbs.size(); i++){
- assertEquals(ebbs.get(i).getBuildingBlock().getBpmnFlowName(),flowNames[i]);
- }
- }
+ private List<OrchestrationFlow> createFlowList(String... flowNames) {
+ List<OrchestrationFlow> result = new ArrayList<>();
+ for (String flowName : flowNames) {
+ OrchestrationFlow orchFlow = new OrchestrationFlow();
+ orchFlow.setFlowName(flowName);
+ result.add(orchFlow);
+ }
+ return result;
+ }
+
+ private void assertEqualsBulkFlowName(List<ExecuteBuildingBlock> ebbs, String... flowNames) {
+ for (int i = 0; i < ebbs.size(); i++) {
+ assertEquals(ebbs.get(i).getBuildingBlock().getBpmnFlowName(), flowNames[i]);
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
index ada8a237e7..34ad1b0fd4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
@@ -31,7 +31,6 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -39,7 +38,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -65,57 +63,59 @@ import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
@RunWith(MockitoJUnitRunner.class)
public class WorkflowActionUnitTest {
- private final static String JSON_FILE_LOCATION = "src/test/resources/__files/Macro/";
-
- @Mock
- private CatalogDbClient catalogDbClient;
- @Mock
- private BBInputSetup bbInputSetup;
- @Mock
- private BBInputSetupUtils bbInputSetupUtils;
- @Mock
- private ExceptionBuilder exceptionBuilder;
- @Mock
- private AAIConfigurationResources aaiConfigurationResources;
-
- @InjectMocks
- @Spy
- private WorkflowAction workflowAction;
-
- @Test
- public void traverseCatalogDbForConfigurationTest() {
-
- CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
- CvnfcConfigurationCustomization vfModuleCustomization = new CvnfcConfigurationCustomization();
- ConfigurationResource configuration = new ConfigurationResource();
- configuration.setToscaNodeType("FabricConfiguration");
- configuration.setModelUUID("my-uuid");
- vfModuleCustomization.setConfigurationResource(configuration);
- cvnfcCustomization.setCvnfcConfigurationCustomization(Collections.singleton(vfModuleCustomization));
- List<CvnfcCustomization> cvnfcCustomizations = Arrays.asList(cvnfcCustomization);
- // when(catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(any(String.class), any(String.class)))
- // .thenReturn(cvnfcCustomizations);
-
- // List<CvnfcConfigurationCustomization> results = workflowAction.traverseCatalogDbForConfiguration("myVnfCustomizationId", "myVfModuleCustomizationId");
-
- //assertThat(results, is(Arrays.asList(vfModuleCustomization)));
-
- }
-
- private String getJson(String filename) throws IOException {
- return new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + filename)));
- }
-
- private List<OrchestrationFlow> createFlowList(String... myList) {
-
- List<OrchestrationFlow> result = new ArrayList<>();
- for (String name : myList) {
- OrchestrationFlow flow = new OrchestrationFlow();
- flow.setFlowName(name);
- result.add(flow);
- }
-
- return result;
-
- }
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/Macro/";
+
+ @Mock
+ private CatalogDbClient catalogDbClient;
+ @Mock
+ private BBInputSetup bbInputSetup;
+ @Mock
+ private BBInputSetupUtils bbInputSetupUtils;
+ @Mock
+ private ExceptionBuilder exceptionBuilder;
+ @Mock
+ private AAIConfigurationResources aaiConfigurationResources;
+
+ @InjectMocks
+ @Spy
+ private WorkflowAction workflowAction;
+
+ @Test
+ public void traverseCatalogDbForConfigurationTest() {
+
+ CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
+ CvnfcConfigurationCustomization vfModuleCustomization = new CvnfcConfigurationCustomization();
+ ConfigurationResource configuration = new ConfigurationResource();
+ configuration.setToscaNodeType("FabricConfiguration");
+ configuration.setModelUUID("my-uuid");
+ vfModuleCustomization.setConfigurationResource(configuration);
+ cvnfcCustomization.setCvnfcConfigurationCustomization(Collections.singleton(vfModuleCustomization));
+ List<CvnfcCustomization> cvnfcCustomizations = Arrays.asList(cvnfcCustomization);
+ // when(catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(any(String.class),
+ // any(String.class)))
+ // .thenReturn(cvnfcCustomizations);
+
+ // List<CvnfcConfigurationCustomization> results =
+ // workflowAction.traverseCatalogDbForConfiguration("myVnfCustomizationId", "myVfModuleCustomizationId");
+
+ // assertThat(results, is(Arrays.asList(vfModuleCustomization)));
+
+ }
+
+ private String getJson(String filename) throws IOException {
+ return new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + filename)));
+ }
+
+ private List<OrchestrationFlow> createFlowList(String... myList) {
+
+ List<OrchestrationFlow> result = new ArrayList<>();
+ for (String name : myList) {
+ OrchestrationFlow flow = new OrchestrationFlow();
+ flow.setFlowName(name);
+ result.add(flow);
+ }
+
+ return result;
+
+ }
}
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
index 329f2cf8c1..c235902561 100644
--- 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
@@ -27,7 +27,6 @@ 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;
@@ -47,62 +46,66 @@ import org.onap.so.client.orchestration.SDNOHealthCheckResources;
@RunWith(MockitoJUnitRunner.Silent.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())).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));
- }
-
- }
+
+ @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())).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
index d5b529288f..821e70a8c8 100644
--- 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
@@ -24,13 +24,11 @@ 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;
@@ -60,562 +58,581 @@ 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.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
- configuration.setManagementOption("managementOption");
- ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
- modelInfoConfiguration.setModelCustomizationId("modelCustId");
- modelInfoConfiguration.setModelInvariantId("modelInvariantId");
- modelInfoConfiguration.setModelVersionId("modelVersionId");
- modelInfoConfiguration.setConfigurationType("5G");
- modelInfoConfiguration.setConfigurationRole("ConfigurationRole");
- 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.getModelInfoConfiguration().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());
- expectedConfiguration.setConfigurationSubType(configuration.getModelInfoConfiguration().getConfigurationRole());
- expectedConfiguration.setConfigPolicyName(configuration.getModelInfoConfiguration().getPolicyName());
-
- 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(){
+ 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.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+ configuration.setManagementOption("managementOption");
+ ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
+ modelInfoConfiguration.setModelCustomizationId("modelCustId");
+ modelInfoConfiguration.setModelInvariantId("modelInvariantId");
+ modelInfoConfiguration.setModelVersionId("modelVersionId");
+ modelInfoConfiguration.setConfigurationType("5G");
+ modelInfoConfiguration.setConfigurationRole("ConfigurationRole");
+ 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.getModelInfoConfiguration().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());
+ expectedConfiguration.setConfigurationSubType(configuration.getModelInfoConfiguration().getConfigurationRole());
+ expectedConfiguration.setConfigPolicyName(configuration.getModelInfoConfiguration().getPolicyName());
+
+ 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);
+ org.onap.aai.domain.yang.ServiceSubscription serviceSubscriptionMapped =
+ aaiObjectMapper.mapServiceSubscription(serviceSubscription);
assertNotNull(serviceSubscriptionMapped);
- assertEquals(serviceSubscription.getTempUbSubAccountId(),serviceSubscriptionMapped.getTempUbSubAccountId());
- assertEquals(serviceSubscription.getServiceType(),serviceSubscriptionMapped.getServiceType());
+ 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 vfModuleBaseMap() 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(true);
+ vfModule.setModelInfoVfModule(modelInfoVfModule);
+
+ org.onap.aai.domain.yang.VfModule AAIVfModule = aaiObjectMapper.mapVfModule(vfModule);
+
+ String jsonToCompare =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiVfModuleBaseMap.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");
+ model.setInstanceGroupRole("SUB-INTERFACE");
+
+ 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());
+ assertEquals(aaiInstanceGroup.getInstanceGroupRole(),
+ instanceGroup.getModelInfoInstanceGroup().getInstanceGroupRole());
+ }
+
+ @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.setIsSharedNetwork(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");
+ modelInfoCollection.setCollectionType("networkCollectionType");
+ modelInfoCollection.setModelCustomizationUUID("modelCustomizationUUID");
+ modelInfoCollection.setModelVersionId("modelVersionId");
+ modelInfoCollection.setModelInvariantUUID("modelInvariantUUID");
+ networkCollection.setModelInfoCollection(modelInfoCollection);
+ networkCollection.setName("networkCollectionName");
+
+ org.onap.aai.domain.yang.Collection expectedCollection = new org.onap.aai.domain.yang.Collection();
+ expectedCollection.setCollectionId("networkCollectionId");
+ expectedCollection.setCollectionType("networkCollectionType");
+ expectedCollection.setCollectionCustomizationId("modelCustomizationUUID");
+ expectedCollection.setModelVersionId("modelVersionId");
+ expectedCollection.setModelInvariantId("modelInvariantUUID");
+ 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(true);
+ l3Network.setSelflink("self_link");
+ l3Network.setOperationalStatus("operationalStatus");
+
+ List<Subnet> subnets = new ArrayList<Subnet>();
+ 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<HostRoute> hostRoutes = new ArrayList<HostRoute>();
+ 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<CtagAssignment> ctagAssignments = new ArrayList<CtagAssignment>();
+ CtagAssignment ctagAssignment1 = new CtagAssignment();
+ ctagAssignment1.setVlanIdInner(1L);
+ ctagAssignments.add(ctagAssignment1);
+ l3Network.getCtagAssignments().addAll(ctagAssignments);
+
+ List<SegmentationAssignment> segmentationAssignments = new ArrayList<SegmentationAssignment>();
+ 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<Subnet> subnets = new ArrayList<Subnet>();
+ 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<HostRoute> hostRoutes = new ArrayList<HostRoute>();
+ 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 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 vfModuleBaseMap() 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(true);
- vfModule.setModelInfoVfModule(modelInfoVfModule);
-
- org.onap.aai.domain.yang.VfModule AAIVfModule = aaiObjectMapper.mapVfModule(vfModule);
-
- String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiVfModuleBaseMap.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");
- model.setInstanceGroupRole("SUB-INTERFACE");
-
- 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());
- assertEquals(aaiInstanceGroup.getInstanceGroupRole(), instanceGroup.getModelInfoInstanceGroup().getInstanceGroupRole());
- }
-
- @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.setIsSharedNetwork(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");
- modelInfoCollection.setCollectionType("networkCollectionType");
- modelInfoCollection.setModelCustomizationUUID("modelCustomizationUUID");
- modelInfoCollection.setModelVersionId("modelVersionId");
- modelInfoCollection.setModelInvariantUUID("modelInvariantUUID");
- networkCollection.setModelInfoCollection(modelInfoCollection);
- networkCollection.setName("networkCollectionName");
-
- org.onap.aai.domain.yang.Collection expectedCollection = new org.onap.aai.domain.yang.Collection();
- expectedCollection.setCollectionId("networkCollectionId");
- expectedCollection.setCollectionType("networkCollectionType");
- expectedCollection.setCollectionCustomizationId("modelCustomizationUUID");
- expectedCollection.setModelVersionId("modelVersionId");
- expectedCollection.setModelInvariantId("modelInvariantUUID");
- 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(true);
- l3Network.setSelflink("self_link");
- l3Network.setOperationalStatus("operationalStatus");
-
- List<Subnet> subnets = new ArrayList<Subnet>();
- 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<HostRoute> hostRoutes = new ArrayList<HostRoute>();
- 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<CtagAssignment> ctagAssignments = new ArrayList<CtagAssignment>();
- CtagAssignment ctagAssignment1 = new CtagAssignment();
- ctagAssignment1.setVlanIdInner(1L);
- ctagAssignments.add(ctagAssignment1);
- l3Network.getCtagAssignments().addAll(ctagAssignments);
-
- List<SegmentationAssignment> segmentationAssignments = new ArrayList<SegmentationAssignment>();
- 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<Subnet> subnets = new ArrayList<Subnet>();
- 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<HostRoute> hostRoutes = new ArrayList<HostRoute>();
- 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<CtagAssignment> ctagAssignments = new ArrayList<CtagAssignment>();
- 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(new Long(ctagAssignments.get(0).getVlanIdInner().longValue()), new Long(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<SegmentationAssignment> segmentationAssignments = new ArrayList<SegmentationAssignment>();
- 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 mapToAAICtagAssignmentListTest() throws Exception {
+ List<CtagAssignment> ctagAssignments = new ArrayList<CtagAssignment>();
+ 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(new Long(ctagAssignments.get(0).getVlanIdInner().longValue()),
+ new Long(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<SegmentationAssignment> segmentationAssignments = new ArrayList<SegmentationAssignment>();
+ 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");
+ 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");
@@ -659,7 +676,7 @@ public class AAIObjectMapperTest {
assertThat(actualRouteTarget, sameBeanAs(expectedRouteTarget));
}
-
+
@Test
public void mapSubnetTest() {
Subnet subnet = new Subnet();
@@ -671,24 +688,24 @@ public class AAIObjectMapperTest {
expectedSubnet.setSubnetId("testSubnetId");
expectedSubnet.setOrchestrationStatus("Pending");
expectedSubnet.setNeutronSubnetId("testNeutronSubnetId");
-
+
org.onap.aai.domain.yang.Subnet actualSubnet = aaiObjectMapper.mapSubnet(subnet);
assertThat(actualSubnet, sameBeanAs(expectedSubnet));
}
-
+
@Test
public void mapNetworkPolicyTest() {
NetworkPolicy networkPolicy = new NetworkPolicy();
networkPolicy.setNetworkPolicyId("testNetworkPolicyId");
networkPolicy.setNetworkPolicyFqdn("testNetworkPolicyFqdn");
- networkPolicy.setHeatStackId("testHeatStackId");
+ networkPolicy.setHeatStackId("testHeatStackId");
org.onap.aai.domain.yang.NetworkPolicy expectedNetworkPolicy = new org.onap.aai.domain.yang.NetworkPolicy();
expectedNetworkPolicy.setNetworkPolicyId("testNetworkPolicyId");
expectedNetworkPolicy.setNetworkPolicyFqdn("testNetworkPolicyFqdn");
- expectedNetworkPolicy.setHeatStackId("testHeatStackId");
-
+ expectedNetworkPolicy.setHeatStackId("testHeatStackId");
+
org.onap.aai.domain.yang.NetworkPolicy actualNetworkPolicy = aaiObjectMapper.mapNetworkPolicy(networkPolicy);
assertThat(actualNetworkPolicy, sameBeanAs(expectedNetworkPolicy));
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
index fe9e1c1608..251ab2cb74 100644
--- 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
@@ -29,9 +29,7 @@ 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 static org.junit.Assert.assertNotNull;
-
import javax.ws.rs.core.Response;
-
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
@@ -51,197 +49,196 @@ import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.client.policy.JettisonStyleMapperProvider;
import org.onap.so.openstack.beans.NetworkRollback;
-
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-public class NetworkAdapterClientIT extends BaseIntegrationTest{
-
- 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 JettisonStyleMapperProvider().getMapper();
-
- @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);
- wireMockServer.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");
- wireMockServer.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);
-
- wireMockServer.stubFor(delete(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");
- wireMockServer.stubFor(delete(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);
-
- wireMockServer.stubFor(delete(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");
-
- wireMockServer.stubFor(delete(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);
-
- wireMockServer.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");
-
- wireMockServer.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");
- wireMockServer.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
- public void updateNetworkTestAsync() throws NetworkAdapterClientException, JsonProcessingException {
- UpdateNetworkRequest request = new UpdateNetworkRequest();
- request.setCloudSiteId(TESTING_ID);
- request.setNetworkId("test1");
-
- UpdateNetworkResponse mockResponse = new UpdateNetworkResponse();
- mockResponse.setNetworkId("test1");
- wireMockServer.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200)));
-
- Response response = client.updateNetworkAsync(AAI_NETWORK_ID, request);
- assertNotNull(response.getEntity());
- }
-
- @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");
- wireMockServer.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);
- }
+public class NetworkAdapterClientIT extends BaseIntegrationTest {
+
+ 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 JettisonStyleMapperProvider().getMapper();
+
+ @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);
+ wireMockServer.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");
+ wireMockServer.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);
+
+ wireMockServer.stubFor(delete(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");
+ wireMockServer.stubFor(delete(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);
+
+ wireMockServer.stubFor(delete(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");
+
+ wireMockServer.stubFor(delete(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);
+
+ wireMockServer.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");
+
+ wireMockServer.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");
+ wireMockServer.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
+ public void updateNetworkTestAsync() throws NetworkAdapterClientException, JsonProcessingException {
+ UpdateNetworkRequest request = new UpdateNetworkRequest();
+ request.setCloudSiteId(TESTING_ID);
+ request.setNetworkId("test1");
+
+ UpdateNetworkResponse mockResponse = new UpdateNetworkResponse();
+ mockResponse.setNetworkId("test1");
+ wireMockServer.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200)));
+
+ Response response = client.updateNetworkAsync(AAI_NETWORK_ID, request);
+ assertNotNull(response.getEntity());
+ }
+
+ @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");
+ wireMockServer.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
index 4bdbd1a846..ccd677c80e 100644
--- 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
@@ -24,7 +24,6 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.*;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
-
import java.io.UnsupportedEncodingException;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -33,7 +32,6 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -62,314 +60,329 @@ 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<String, String> 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);
- expectedCreateNetworkRequest.setNetworkTechnology("CONTRAIL");
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId(requestContext.getMsoRequestId());
- msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
- expectedCreateNetworkRequest.setMsoRequest(msoRequest);
- expectedCreateNetworkRequest.setSkipAAI(true);
- HashMap<String, String> networkParams = new HashMap<String, String>();
- networkParams.put("shared", "true");
- networkParams.put("external", "false");
- networkParams.put("testUserInputKey", "testUserInputValue");
- expectedCreateNetworkRequest.setNetworkParams(networkParams);
-
- expectedCreateNetworkRequest.setNotificationUrl("endpoint/NetworkAResponse/messageId");
-
- Subnet openstackSubnet = new Subnet();
- HostRoute hostRoute = new HostRoute();
- hostRoute.setHostRouteId("hostRouteId");
- hostRoute.setNextHop("nextHop");
- hostRoute.setRoutePrefix("routePrefix");
- openstackSubnet.getHostRoutes().add(hostRoute);
- List<Subnet> subnetList = new ArrayList<Subnet>();
- subnetList.add(openstackSubnet);
- l3Network.getSubnets().add(openstackSubnet);
- l3Network.setNetworkTechnology("Contrail");
- l3Network.setIsSharedNetwork(true);
- l3Network.setIsExternalNetwork(false);
-
- doReturn("endpoint/").when(SPY_networkAdapterObjectMapper).getEndpoint();
- doReturn("messageId").when(SPY_networkAdapterObjectMapper).getRandomUuid();
-
- CreateNetworkRequest createNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer);
-
- assertThat(createNetworkRequest, sameBeanAs(expectedCreateNetworkRequest).ignoring("contrailRequest").ignoring("contrailNetwork").ignoring("providerVlanNetwork").ignoring("subnets").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<org.onap.so.openstack.beans.HostRoute>());
-
- List<org.onap.so.openstack.beans.Subnet> subnets = new ArrayList<>();
- subnets.add(subnet);
-
- ProviderVlanNetwork providerVlanNetwork = new ProviderVlanNetwork("physicalNetworkName", new ArrayList<Integer>());
-
- List<String> 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<String>());
- contrailNetwork.setRouteTargets(new ArrayList<org.onap.so.openstack.beans.RouteTarget>());
- 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.setDhcpEnabled(false);
- 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);
- l3Network.setIsSharedNetwork(false);
- l3Network.setIsExternalNetwork(false);
- HashMap<String, String> networkParams = new HashMap<String, String>();
- networkParams.put("shared", "false");
- networkParams.put("external", "false");
- networkParams.put("testUserInputKey", "testUserInputValue");
-
- 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(networkParams);
- expectedUpdateNetworkRequest.setMsoRequest(msoRequest);
- expectedUpdateNetworkRequest.setSkipAAI(true);
- expectedUpdateNetworkRequest.setBackout(Boolean.TRUE.equals(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());
-
- expectedDeleteNetworkRequest.setNotificationUrl("endpoint/NetworkAResponse/messageId");
-
- doReturn("endpoint/").when(SPY_networkAdapterObjectMapper).getEndpoint();
- doReturn("messageId").when(SPY_networkAdapterObjectMapper).getRandomUuid();
-
- DeleteNetworkRequest deleteNetworkRequest = SPY_networkAdapterObjectMapper.deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network);
-
- assertThat(expectedDeleteNetworkRequest, sameBeanAs(deleteNetworkRequest));
- }
-
- @Test
- public void deleteNetworkRequestNoHeatIdMapperTest() 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.setNetworkName("heatStackId");
- expectedDeleteNetworkRequest.setNetworkStackId("heatStackId");
-
- expectedDeleteNetworkRequest.setNetworkType(l3Network.getNetworkType());
-
- expectedDeleteNetworkRequest.setSkipAAI(true);
-
- expectedDeleteNetworkRequest.setTenantId(cloudRegion.getTenantId());
-
- expectedDeleteNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
-
- expectedDeleteNetworkRequest.setNotificationUrl("endpoint/NetworkAResponse/messageId");
-
- doReturn("endpoint/").when(SPY_networkAdapterObjectMapper).getEndpoint();
- doReturn("messageId").when(SPY_networkAdapterObjectMapper).getRandomUuid();
- 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";
-
- expectedCreateNetworkRequest.setNotificationUrl("endpoint/NetworkAResponse/messageId");
-
- doReturn("endpoint/").when(SPY_networkAdapterObjectMapper).getEndpoint();
- doReturn("messageId").when(SPY_networkAdapterObjectMapper).getRandomUuid();
- 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"));
- }
+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<String, String> 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);
+ expectedCreateNetworkRequest.setNetworkTechnology("CONTRAIL");
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId(requestContext.getMsoRequestId());
+ msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ expectedCreateNetworkRequest.setMsoRequest(msoRequest);
+ expectedCreateNetworkRequest.setSkipAAI(true);
+ HashMap<String, String> networkParams = new HashMap<String, String>();
+ networkParams.put("shared", "true");
+ networkParams.put("external", "false");
+ networkParams.put("testUserInputKey", "testUserInputValue");
+ expectedCreateNetworkRequest.setNetworkParams(networkParams);
+
+ expectedCreateNetworkRequest.setNotificationUrl("endpoint/NetworkAResponse/messageId");
+
+ Subnet openstackSubnet = new Subnet();
+ HostRoute hostRoute = new HostRoute();
+ hostRoute.setHostRouteId("hostRouteId");
+ hostRoute.setNextHop("nextHop");
+ hostRoute.setRoutePrefix("routePrefix");
+ openstackSubnet.getHostRoutes().add(hostRoute);
+ List<Subnet> subnetList = new ArrayList<Subnet>();
+ subnetList.add(openstackSubnet);
+ l3Network.getSubnets().add(openstackSubnet);
+ l3Network.setNetworkTechnology("Contrail");
+ l3Network.setIsSharedNetwork(true);
+ l3Network.setIsExternalNetwork(false);
+
+ doReturn("endpoint/").when(SPY_networkAdapterObjectMapper).getEndpoint();
+ doReturn("messageId").when(SPY_networkAdapterObjectMapper).getRandomUuid();
+
+ CreateNetworkRequest createNetworkRequest =
+ SPY_networkAdapterObjectMapper.createNetworkRequestMapper(requestContext, cloudRegion,
+ orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer);
+
+ assertThat(createNetworkRequest, sameBeanAs(expectedCreateNetworkRequest).ignoring("contrailRequest")
+ .ignoring("contrailNetwork").ignoring("providerVlanNetwork").ignoring("subnets").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<org.onap.so.openstack.beans.HostRoute>());
+
+ List<org.onap.so.openstack.beans.Subnet> subnets = new ArrayList<>();
+ subnets.add(subnet);
+
+ ProviderVlanNetwork providerVlanNetwork =
+ new ProviderVlanNetwork("physicalNetworkName", new ArrayList<Integer>());
+
+ List<String> 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<String>());
+ contrailNetwork.setRouteTargets(new ArrayList<org.onap.so.openstack.beans.RouteTarget>());
+ 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.setDhcpEnabled(false);
+ 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);
+ l3Network.setIsSharedNetwork(false);
+ l3Network.setIsExternalNetwork(false);
+ HashMap<String, String> networkParams = new HashMap<String, String>();
+ networkParams.put("shared", "false");
+ networkParams.put("external", "false");
+ networkParams.put("testUserInputKey", "testUserInputValue");
+
+ 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(networkParams);
+ expectedUpdateNetworkRequest.setMsoRequest(msoRequest);
+ expectedUpdateNetworkRequest.setSkipAAI(true);
+ expectedUpdateNetworkRequest.setBackout(Boolean.TRUE.equals(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());
+
+ expectedDeleteNetworkRequest.setNotificationUrl("endpoint/NetworkAResponse/messageId");
+
+ doReturn("endpoint/").when(SPY_networkAdapterObjectMapper).getEndpoint();
+ doReturn("messageId").when(SPY_networkAdapterObjectMapper).getRandomUuid();
+
+ DeleteNetworkRequest deleteNetworkRequest = SPY_networkAdapterObjectMapper
+ .deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network);
+
+ assertThat(expectedDeleteNetworkRequest, sameBeanAs(deleteNetworkRequest));
+ }
+
+ @Test
+ public void deleteNetworkRequestNoHeatIdMapperTest() 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.setNetworkName("heatStackId");
+ expectedDeleteNetworkRequest.setNetworkStackId("heatStackId");
+
+ expectedDeleteNetworkRequest.setNetworkType(l3Network.getNetworkType());
+
+ expectedDeleteNetworkRequest.setSkipAAI(true);
+
+ expectedDeleteNetworkRequest.setTenantId(cloudRegion.getTenantId());
+
+ expectedDeleteNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+
+ expectedDeleteNetworkRequest.setNotificationUrl("endpoint/NetworkAResponse/messageId");
+
+ doReturn("endpoint/").when(SPY_networkAdapterObjectMapper).getEndpoint();
+ doReturn("messageId").when(SPY_networkAdapterObjectMapper).getRandomUuid();
+ 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";
+
+ expectedCreateNetworkRequest.setNotificationUrl("endpoint/NetworkAResponse/messageId");
+
+ doReturn("endpoint/").when(SPY_networkAdapterObjectMapper).getEndpoint();
+ doReturn("messageId").when(SPY_networkAdapterObjectMapper).getRandomUuid();
+ 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
index 90e99eb0ad..7fb1db9d98 100644
--- 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
@@ -28,7 +28,6 @@ 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.BaseIntegrationTest;
@@ -44,182 +43,179 @@ import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse;
import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse;
import org.onap.so.adapters.vnfrest.VfModuleRollback;
import org.onap.so.client.policy.JettisonStyleMapperProvider;
-
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-public class VnfAdapterClientIT extends BaseIntegrationTest{
-
- 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 JettisonStyleMapperProvider().getMapper();
-
- @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);
- wireMockServer.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");
- wireMockServer.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);
- wireMockServer.stubFor(
- delete(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");
- wireMockServer.stubFor(
- delete(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);
- wireMockServer.stubFor(delete(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");
- wireMockServer.stubFor(delete(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");
- wireMockServer.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");
- wireMockServer.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);
- wireMockServer.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");
- wireMockServer.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");
- }
+public class VnfAdapterClientIT extends BaseIntegrationTest {
+
+ 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 JettisonStyleMapperProvider().getMapper();
+
+ @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);
+ wireMockServer.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");
+ wireMockServer.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);
+ wireMockServer.stubFor(delete(
+ 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");
+ wireMockServer.stubFor(delete(
+ 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);
+ wireMockServer
+ .stubFor(delete(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");
+ wireMockServer
+ .stubFor(delete(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");
+ wireMockServer.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");
+ wireMockServer.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);
+ wireMockServer.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");
+ wireMockServer.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
index 4a006f8b66..282d7a04f9 100644
--- 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
@@ -25,10 +25,8 @@ 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;
@@ -44,169 +42,170 @@ import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse;
import org.onap.so.client.adapter.rest.AdapterRestClient;
import org.onap.so.BaseIntegrationTest;
-public class VnfVolumeAdapterClientIT extends BaseIntegrationTest{
-
- 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);
- }
+public class VnfVolumeAdapterClientIT extends BaseIntegrationTest {
+
+ 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
index df48596893..63c73322a5 100644
--- 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
@@ -21,26 +21,24 @@
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);
- }
+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
index 5169663add..4450e4a9f4 100644
--- 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
@@ -26,14 +26,12 @@ import static org.junit.Assert.assertThat;
import static org.mockito.ArgumentMatchers.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.Ignore;
@@ -55,282 +53,294 @@ 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/VnfAndVfModuleMapper/";
-
- @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<String, Object> 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(Boolean.TRUE.equals(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<String, Object> 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(Boolean.TRUE.equals(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_deleteVolumeGroupHeatIdRequestMapper() throws Exception{
- this.test_deleteVolumeGroupRequestMapper("heatStackId");
- }
-
- @Test
- public void test_deleteVolumeGroupNoHeatIdRequestMapper() throws Exception{
- this.test_deleteVolumeGroupRequestMapper(null);
- }
-
- private void test_deleteVolumeGroupRequestMapper(String heatStackId) 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());
-
- if (heatStackId != null){
- volumeGroup.setHeatStackId("heatStackId");
- expectedDeleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
- } else {
- volumeGroup.setVolumeGroupName("volumeGroupName");
- expectedDeleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getVolumeGroupName());
- }
-
- 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<String, String> 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<String, Object> 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<String, String> 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<String, Object> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, null);
-
- assertEquals(expectedVolumeGroupParams, actualVolumeGroupParams);
- }
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/";
+
+ @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<String, Object> 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(Boolean.TRUE.equals(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<String, Object> 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(Boolean.TRUE.equals(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_deleteVolumeGroupHeatIdRequestMapper() throws Exception {
+ this.test_deleteVolumeGroupRequestMapper("heatStackId");
+ }
+
+ @Test
+ public void test_deleteVolumeGroupNoHeatIdRequestMapper() throws Exception {
+ this.test_deleteVolumeGroupRequestMapper(null);
+ }
+
+ private void test_deleteVolumeGroupRequestMapper(String heatStackId) 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());
+
+ if (heatStackId != null) {
+ volumeGroup.setHeatStackId("heatStackId");
+ expectedDeleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
+ } else {
+ volumeGroup.setVolumeGroupName("volumeGroupName");
+ expectedDeleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getVolumeGroupName());
+ }
+
+ 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<String, String> 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<String, Object> 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<String, String> 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<String, Object> actualVolumeGroupParams =
+ vnfAdapterObjectMapper.createVolumeGroupParams(requestContext, genericVnf, volumeGroup, null);
+
+ assertEquals(expectedVolumeGroupParams, actualVolumeGroupParams);
+ }
@Test
public void test_createVolumeGroupParams_with_user_params() throws Exception {
@@ -351,7 +361,8 @@ public class VnfAdapterObjectMapperTest {
volumeGroup.setVolumeGroupId("volumeGroupId");
volumeGroup.setVolumeGroupName("volumeGroupName");
- String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json")));
+ String sdncVfModuleQueryResponse = new String(Files
+ .readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json")));
Map<String, String> expectedVolumeGroupParams = new HashMap<>();
expectedVolumeGroupParams.put("vnf_id", genericVnf.getVnfId());
@@ -363,25 +374,26 @@ public class VnfAdapterObjectMapperTest {
expectedVolumeGroupParams.put("paramThree", "paramThreeValue");
expectedVolumeGroupParams.put("userParamKey", "userParamValue");
- Map<String, Object> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, sdncVfModuleQueryResponse);
+ Map<String, Object> 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));
- }
+ @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/VnfAdapterVfModuleObjectMapperPayloadTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java
index 00e5c10f73..5a8e57135a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java
@@ -23,13 +23,11 @@ package org.onap.so.client.adapter.vnf.mapper;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
-
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
-
import org.junit.Before;
import org.junit.Test;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVmNetworkData;
@@ -45,820 +43,831 @@ 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 VnfAdapterVfModuleObjectMapperPayloadTest {
- private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/";
-
- private VnfAdapterVfModuleObjectMapper vfModuleObjectMapper = new VnfAdapterVfModuleObjectMapper();
- private ObjectMapper omapper = new ObjectMapper();
- @Before
- public void setUp() {
- vfModuleObjectMapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils();
- vfModuleObjectMapper.init();
-
- }
- @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);
-
- RequestContext requestContext = new RequestContext();
- Map<String, Object> userParams = new HashMap<>();
- userParams.put("key1", "value2");
- 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);
- HashMap<String, String> cloudParams = new HashMap<String, String>();
- cloudParams.put("key3", "value3");
- vfModule.setCloudParams(cloudParams);
-
- 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")));
-
- CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper(
- requestContext, cloudRegion, orchestrationContext, serviceInstance,
- vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
-
-
- String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequest.json")));
-
- CreateVfModuleRequest reqMapper1 = omapper.readValue(
- jsonToCompare,
- CreateVfModuleRequest.class);
-
- assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
- }
-
- @Test
- public void createVfModuleWithFalseRollbackRequestMapperTest() 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);
-
- RequestContext requestContext = new RequestContext();
- Map<String, Object> userParams = new HashMap<>();
- userParams.put("key1", "value2");
- 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);
- HashMap<String, String> cloudParams = new HashMap<String, String>();
- cloudParams.put("key3", "value3");
- vfModule.setCloudParams(cloudParams);
-
- CloudRegion cloudRegion = new CloudRegion();
- cloudRegion.setLcpCloudRegionId("cloudRegionId");
- cloudRegion.setTenantId("tenantId");
-
- OrchestrationContext orchestrationContext = new OrchestrationContext();
- orchestrationContext.setIsRollbackEnabled(true);
-
- 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")));
-
- CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper(
- requestContext, cloudRegion, orchestrationContext, serviceInstance,
- vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
-
-
- String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestTrueBackout.json")));
-
- CreateVfModuleRequest reqMapper1 = omapper.readValue(
- jsonToCompare,
- CreateVfModuleRequest.class);
-
- assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
- }
-
- @Test
- public void createVfModuleRequestWithNoEnvironmentAndWorkloadContextMapperTest() 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(null);
- serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
-
- RequestContext requestContext = new RequestContext();
- Map<String, Object> userParams = new HashMap<>();
- userParams.put("key1", "value2");
- 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")));
-
- CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper(
- requestContext, cloudRegion, orchestrationContext, serviceInstance,
- vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
-
-
- String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json")));
-
- CreateVfModuleRequest reqMapper1 = omapper.readValue(
- jsonToCompare,
- CreateVfModuleRequest.class);
-
- assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
- }
-
- @Test
- public void createVfModuleAddonRequestMapperTest() 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);
-
- //
- RequestContext requestContext = new RequestContext();
- Map<String, Object> userParams = new HashMap<>();
- userParams.put("key1", "value2");
- 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);
-
- VfModule baseVfModule = new VfModule();
- baseVfModule.setVfModuleId("baseVfModuleId");
- baseVfModule.setHeatStackId("baseVfModuleStackId");
- ModelInfoVfModule baseModelInfoVfModule = new ModelInfoVfModule();
- baseModelInfoVfModule.setIsBaseBoolean(true);
- baseVfModule.setModelInfoVfModule(baseModelInfoVfModule);
- vnf.getVfModules().add(baseVfModule);
-
- 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")));
-
- CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper(
- requestContext, cloudRegion, orchestrationContext, serviceInstance,
- vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
-
-
- String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleAddonRequest.json")));
-
- CreateVfModuleRequest reqMapper1 = omapper.readValue(
- jsonToCompare,
- CreateVfModuleRequest.class);
-
- assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
- }
-
- @Test
- public void createVfModuleWithVolumeGroupRequestMapperTest() 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);
-
- //
- RequestContext requestContext = new RequestContext();
- Map<String, Object> userParams = new HashMap<>();
- userParams.put("key1", "value2");
- 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);
-
- VolumeGroup volumeGroup = new VolumeGroup();
- volumeGroup.setVolumeGroupId("volumeGroupId");
- volumeGroup.setHeatStackId("volumeGroupStackId");
-
- 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")));
-
- CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper(
- requestContext, cloudRegion, orchestrationContext, serviceInstance,
- vnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
-
-
- String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleWithVolumeGroupRequest.json")));
-
- CreateVfModuleRequest reqMapper1 = omapper.readValue(
- jsonToCompare,
- CreateVfModuleRequest.class);
-
- assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
- }
-
- @Test
- public void createVfModuleWithSingleAvailabilityZoneRequestMapperTest() 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);
-
- RequestContext requestContext = new RequestContext();
- Map<String, Object> userParams = new HashMap<>();
- userParams.put("key1", "value2");
- 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 + "genericResourceApiVfModuleSdncVnfTopologyWithSingletonArray.json")));
- String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json")));
-
- CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper(
- requestContext, cloudRegion, orchestrationContext, serviceInstance,
- vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
-
-
- String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestWithSingleAvailabilityZone.json")));
-
- 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);
-
- RequestContext requestContext = new RequestContext();
- Map<String, Object> 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")));
-
- CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper(
- requestContext, cloudRegion, orchestrationContext, serviceInstance,
- vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
-
-
- String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestWithCloudResources.json")));
-
- 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);
-
- RequestContext requestContext = new RequestContext();
- Map<String, Object> 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")));
-
- CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper(
- requestContext, cloudRegion, orchestrationContext, serviceInstance,
- vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
-
-
- String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestDhcpDisabled.json")));
-
- 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);
-
- RequestContext requestContext = new RequestContext();
- Map<String, Object> 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")));
-
- CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper(
- requestContext, cloudRegion, orchestrationContext, serviceInstance,
- vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
-
-
- String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestMultipleDhcp.json")));
-
- CreateVfModuleRequest reqMapper1 = omapper.readValue(
- jsonToCompare,
- CreateVfModuleRequest.class);
-
- assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
- }
-
- @Test
- public void createVfModuleRequestMapperWithNullUserParamsTest() 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);
-
- RequestContext requestContext = new RequestContext();
- requestContext.setMsoRequestId("requestId");
- 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")));
-
- CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper(
- requestContext, cloudRegion, orchestrationContext, serviceInstance,
- vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
-
-
- String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestNoUserParams.json")));
-
- 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);
-
- RequestContext requestContext = new RequestContext();
- Map<String, Object> 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);
-
- DeleteVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.deleteVfModuleRequestMapper(
- requestContext, cloudRegion, serviceInstance,
- vnf, vfModule);
-
-
- String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterDeleteVfModuleRequest.json")));
-
- DeleteVfModuleRequest reqMapper1 = omapper.readValue(
- jsonToCompare,
- DeleteVfModuleRequest.class);
-
- assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl").ignoring("vfModuleStackId"));
- }
-
- @Test
- public void networkCloudParamsTest() throws IOException {
-
- String json = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "grApiVmNetworkSubSectionWith5GParams.json")));
- GenericResourceApiVmNetworkData network = omapper.readValue(json, GenericResourceApiVmNetworkData.class);
- Map<String, Object> paramsMap = new HashMap<>();
- vfModuleObjectMapper.buildVlanInformation(paramsMap, network, "testKey", "testType");
-
- assertEquals("1,3", paramsMap.get("testKey_testType_private_vlans"));
- assertEquals("2,3", paramsMap.get("testKey_testType_public_vlans"));
- assertEquals("1,2,3", paramsMap.get("testKey_testType_guest_vlans"));
- assertEquals("my-segemntation-id", paramsMap.get("testKey_testType_vlan_filter"));
- }
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/";
+
+ private VnfAdapterVfModuleObjectMapper vfModuleObjectMapper = new VnfAdapterVfModuleObjectMapper();
+ private ObjectMapper omapper = new ObjectMapper();
+
+ @Before
+ public void setUp() {
+ vfModuleObjectMapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils();
+ vfModuleObjectMapper.init();
+
+ }
+
+ @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);
+
+ RequestContext requestContext = new RequestContext();
+ Map<String, Object> userParams = new HashMap<>();
+ userParams.put("key1", "value2");
+ 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);
+ HashMap<String, String> cloudParams = new HashMap<String, String>();
+ cloudParams.put("key3", "value3");
+ vfModule.setCloudParams(cloudParams);
+
+ 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")));
+
+ CreateVfModuleRequest vfModuleVNFAdapterRequest =
+ vfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext,
+ serviceInstance, vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+
+ String jsonToCompare =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequest.json")));
+
+ CreateVfModuleRequest reqMapper1 = omapper.readValue(jsonToCompare, CreateVfModuleRequest.class);
+
+ assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
+ }
+
+ @Test
+ public void createVfModuleWithFalseRollbackRequestMapperTest() 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);
+
+ RequestContext requestContext = new RequestContext();
+ Map<String, Object> userParams = new HashMap<>();
+ userParams.put("key1", "value2");
+ 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);
+ HashMap<String, String> cloudParams = new HashMap<String, String>();
+ cloudParams.put("key3", "value3");
+ vfModule.setCloudParams(cloudParams);
+
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setLcpCloudRegionId("cloudRegionId");
+ cloudRegion.setTenantId("tenantId");
+
+ OrchestrationContext orchestrationContext = new OrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(true);
+
+ 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")));
+
+ CreateVfModuleRequest vfModuleVNFAdapterRequest =
+ vfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext,
+ serviceInstance, vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+
+ String jsonToCompare = new String(
+ Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestTrueBackout.json")));
+
+ CreateVfModuleRequest reqMapper1 = omapper.readValue(jsonToCompare, CreateVfModuleRequest.class);
+
+ assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
+ }
+
+ @Test
+ public void createVfModuleRequestWithNoEnvironmentAndWorkloadContextMapperTest() 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(null);
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+
+ RequestContext requestContext = new RequestContext();
+ Map<String, Object> userParams = new HashMap<>();
+ userParams.put("key1", "value2");
+ 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")));
+
+ CreateVfModuleRequest vfModuleVNFAdapterRequest =
+ vfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext,
+ serviceInstance, vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+
+ String jsonToCompare = new String(Files.readAllBytes(Paths
+ .get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json")));
+
+ CreateVfModuleRequest reqMapper1 = omapper.readValue(jsonToCompare, CreateVfModuleRequest.class);
+
+ assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
+ }
+
+ @Test
+ public void createVfModuleAddonRequestMapperTest() 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);
+
+ //
+ RequestContext requestContext = new RequestContext();
+ Map<String, Object> userParams = new HashMap<>();
+ userParams.put("key1", "value2");
+ 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);
+
+ VfModule baseVfModule = new VfModule();
+ baseVfModule.setVfModuleId("baseVfModuleId");
+ baseVfModule.setHeatStackId("baseVfModuleStackId");
+ ModelInfoVfModule baseModelInfoVfModule = new ModelInfoVfModule();
+ baseModelInfoVfModule.setIsBaseBoolean(true);
+ baseVfModule.setModelInfoVfModule(baseModelInfoVfModule);
+ vnf.getVfModules().add(baseVfModule);
+
+ 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")));
+
+ CreateVfModuleRequest vfModuleVNFAdapterRequest =
+ vfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext,
+ serviceInstance, vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+
+ String jsonToCompare = new String(
+ Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleAddonRequest.json")));
+
+ CreateVfModuleRequest reqMapper1 = omapper.readValue(jsonToCompare, CreateVfModuleRequest.class);
+
+ assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
+ }
+
+ @Test
+ public void createVfModuleWithVolumeGroupRequestMapperTest() 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);
+
+ //
+ RequestContext requestContext = new RequestContext();
+ Map<String, Object> userParams = new HashMap<>();
+ userParams.put("key1", "value2");
+ 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);
+
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupId("volumeGroupId");
+ volumeGroup.setHeatStackId("volumeGroupStackId");
+
+ 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")));
+
+ CreateVfModuleRequest vfModuleVNFAdapterRequest =
+ vfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext,
+ serviceInstance, vnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+
+ String jsonToCompare = new String(Files
+ .readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleWithVolumeGroupRequest.json")));
+
+ CreateVfModuleRequest reqMapper1 = omapper.readValue(jsonToCompare, CreateVfModuleRequest.class);
+
+ assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
+ }
+
+ @Test
+ public void createVfModuleWithSingleAvailabilityZoneRequestMapperTest() 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);
+
+ RequestContext requestContext = new RequestContext();
+ Map<String, Object> userParams = new HashMap<>();
+ userParams.put("key1", "value2");
+ 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 + "genericResourceApiVfModuleSdncVnfTopologyWithSingletonArray.json")));
+ String sdncVfModuleQueryResponse = new String(Files
+ .readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json")));
+
+ CreateVfModuleRequest vfModuleVNFAdapterRequest =
+ vfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext,
+ serviceInstance, vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+
+ String jsonToCompare = new String(Files.readAllBytes(
+ Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestWithSingleAvailabilityZone.json")));
+
+ 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);
+
+ RequestContext requestContext = new RequestContext();
+ Map<String, Object> 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")));
+
+ CreateVfModuleRequest vfModuleVNFAdapterRequest =
+ vfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext,
+ serviceInstance, vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+
+ String jsonToCompare = new String(Files.readAllBytes(
+ Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestWithCloudResources.json")));
+
+ 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);
+
+ RequestContext requestContext = new RequestContext();
+ Map<String, Object> 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")));
+
+ CreateVfModuleRequest vfModuleVNFAdapterRequest =
+ vfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext,
+ serviceInstance, vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+
+ String jsonToCompare = new String(
+ Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestDhcpDisabled.json")));
+
+ 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);
+
+ RequestContext requestContext = new RequestContext();
+ Map<String, Object> 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")));
+
+ CreateVfModuleRequest vfModuleVNFAdapterRequest =
+ vfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext,
+ serviceInstance, vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+
+ String jsonToCompare = new String(
+ Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestMultipleDhcp.json")));
+
+ CreateVfModuleRequest reqMapper1 = omapper.readValue(jsonToCompare, CreateVfModuleRequest.class);
+
+ assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
+ }
+
+ @Test
+ public void createVfModuleRequestMapperWithNullUserParamsTest() 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);
+
+ RequestContext requestContext = new RequestContext();
+ requestContext.setMsoRequestId("requestId");
+ 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")));
+
+ CreateVfModuleRequest vfModuleVNFAdapterRequest =
+ vfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext,
+ serviceInstance, vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+
+ String jsonToCompare = new String(
+ Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestNoUserParams.json")));
+
+ 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);
+
+ RequestContext requestContext = new RequestContext();
+ Map<String, Object> 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);
+
+ DeleteVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper
+ .deleteVfModuleRequestMapper(requestContext, cloudRegion, serviceInstance, vnf, vfModule);
+
+
+ String jsonToCompare =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterDeleteVfModuleRequest.json")));
+
+ DeleteVfModuleRequest reqMapper1 = omapper.readValue(jsonToCompare, DeleteVfModuleRequest.class);
+
+ assertThat(vfModuleVNFAdapterRequest,
+ sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl").ignoring("vfModuleStackId"));
+ }
+
+ @Test
+ public void networkCloudParamsTest() throws IOException {
+
+ String json = new String(
+ Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "grApiVmNetworkSubSectionWith5GParams.json")));
+ GenericResourceApiVmNetworkData network = omapper.readValue(json, GenericResourceApiVmNetworkData.class);
+ Map<String, Object> paramsMap = new HashMap<>();
+ vfModuleObjectMapper.buildVlanInformation(paramsMap, network, "testKey", "testType");
+
+ assertEquals("1,3", paramsMap.get("testKey_testType_private_vlans"));
+ assertEquals("2,3", paramsMap.get("testKey_testType_public_vlans"));
+ assertEquals("1,2,3", paramsMap.get("testKey_testType_guest_vlans"));
+ assertEquals("my-segemntation-id", paramsMap.get("testKey_testType_vlan_filter"));
+ }
}
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
index 81d30e33c5..d6ab3db094 100644
--- 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
@@ -26,11 +26,9 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doNothing;
-
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
-
import org.junit.Before;
import org.junit.Test;
import org.mockito.MockitoAnnotations;
@@ -45,80 +43,81 @@ import org.onap.so.entity.MsoRequest;
public class VnfAdapterVfModuleObjectMapperTest {
- @Spy
- private VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper();
-
- @Before
- public void before() {
- MockitoAnnotations.initMocks(this);
- }
-
- @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<String, Object> 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"));
-
- }
-
- @Test
- public void test_deleteVfModuleNoHeatIdRequestMapper() throws Exception {
- DeleteVfModuleRequest expectedDeleteVfModuleRequest = new DeleteVfModuleRequest();
-
- CloudRegion cloudRegion = new CloudRegion();
- cloudRegion.setLcpCloudRegionId("lcpCloudRegionId");
- expectedDeleteVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
-
- cloudRegion.setTenantId("tenantId");
- expectedDeleteVfModuleRequest.setTenantId(cloudRegion.getTenantId());
-
- GenericVnf genericVnf = new GenericVnf();
- VfModule vfModule = new VfModule();
- vfModule.setHeatStackId("heatStackId");
- expectedDeleteVfModuleRequest.setVfModuleStackId("heatStackId");
- expectedDeleteVfModuleRequest.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());
- expectedDeleteVfModuleRequest.setMsoRequest(msoRequest);
-
- String messageId = "messageId";
- String endpoint = "endpoint";
- doNothing().when(mapper).setIdAndUrl(any());
- expectedDeleteVfModuleRequest.setMessageId(messageId);
- expectedDeleteVfModuleRequest.setNotificationUrl(endpoint + "/VNFAResponse/" + messageId);
-
- DeleteVfModuleRequest actualDeleteVfModuleRequest = mapper.deleteVfModuleRequestMapper(requestContext, cloudRegion,
- serviceInstance, genericVnf, vfModule);
-
- assertThat(actualDeleteVfModuleRequest, sameBeanAs(expectedDeleteVfModuleRequest).ignoring("messageId").ignoring("notificationUrl"));
- }
-
+ @Spy
+ private VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper();
+
+ @Before
+ public void before() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @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<String, Object> 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"));
+
+ }
+
+ @Test
+ public void test_deleteVfModuleNoHeatIdRequestMapper() throws Exception {
+ DeleteVfModuleRequest expectedDeleteVfModuleRequest = new DeleteVfModuleRequest();
+
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setLcpCloudRegionId("lcpCloudRegionId");
+ expectedDeleteVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+
+ cloudRegion.setTenantId("tenantId");
+ expectedDeleteVfModuleRequest.setTenantId(cloudRegion.getTenantId());
+
+ GenericVnf genericVnf = new GenericVnf();
+ VfModule vfModule = new VfModule();
+ vfModule.setHeatStackId("heatStackId");
+ expectedDeleteVfModuleRequest.setVfModuleStackId("heatStackId");
+ expectedDeleteVfModuleRequest.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());
+ expectedDeleteVfModuleRequest.setMsoRequest(msoRequest);
+
+ String messageId = "messageId";
+ String endpoint = "endpoint";
+ doNothing().when(mapper).setIdAndUrl(any());
+ expectedDeleteVfModuleRequest.setMessageId(messageId);
+ expectedDeleteVfModuleRequest.setNotificationUrl(endpoint + "/VNFAResponse/" + messageId);
+
+ DeleteVfModuleRequest actualDeleteVfModuleRequest =
+ mapper.deleteVfModuleRequestMapper(requestContext, cloudRegion, serviceInstance, genericVnf, vfModule);
+
+ assertThat(actualDeleteVfModuleRequest,
+ sameBeanAs(expectedDeleteVfModuleRequest).ignoring("messageId").ignoring("notificationUrl"));
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientResponseValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientResponseValidatorTest.java
index 7c58038f65..f50916c0be 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientResponseValidatorTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientResponseValidatorTest.java
@@ -21,10 +21,8 @@
package org.onap.so.client.namingservice;
import static org.junit.Assert.assertEquals;
-
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Test;
import org.onap.namingservice.model.NameGenDeleteResponse;
import org.onap.namingservice.model.NameGenResponse;
@@ -35,70 +33,70 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
public class NamingClientResponseValidatorTest extends TestDataSetup {
-
- private NamingClientResponseValidator responseValidator = new NamingClientResponseValidator();
- private String instanceGroupName = "generatedInstanceGroupName";
-
- @Test
- public void validateNameGenResponseSuccessTest() throws BadResponseException {
- NameGenResponse name = new NameGenResponse();
- Respelement respElement = new Respelement();
- respElement.setResourceName("instance-group-name");
- respElement.setResourceValue(instanceGroupName);
- List<Respelement> respList = new ArrayList<Respelement>();
- respList.add(respElement);
- name.setElements(respList);
- ResponseEntity<NameGenResponse> resp = new ResponseEntity<>(name, null, HttpStatus.OK);
-
- String actual = responseValidator.validateNameGenResponse(resp);
-
- assertEquals(actual, "generatedInstanceGroupName");
- }
-
- @Test
- public void validateNameGenResponseNoNameGeneratedTest() throws BadResponseException {
- NameGenResponse name = new NameGenResponse();
- Respelement respElement = new Respelement();
- respElement.setResourceName("instance-group");
- respElement.setResourceValue(instanceGroupName);
- List<Respelement> respList = new ArrayList<Respelement>();
- respList.add(respElement);
- name.setElements(respList);
- ResponseEntity<NameGenResponse> resp = new ResponseEntity<>(name, null, HttpStatus.OK);
-
- String actual = responseValidator.validateNameGenResponse(resp);
-
- assertEquals(actual, "");
- }
-
- @Test
- public void validateNameGenResponseBadStatusTest() throws BadResponseException {
- NameGenResponse name = new NameGenResponse();
-
- ResponseEntity<NameGenResponse> resp = new ResponseEntity<>(name, null, HttpStatus.NOT_FOUND);
-
- expectedException.expect(BadResponseException.class);
- responseValidator.validateNameGenResponse(resp);
- }
-
- @Test
- public void validateNameGenDeleteResponseSuccessTest() throws BadResponseException {
- NameGenDeleteResponse name = new NameGenDeleteResponse();
- ResponseEntity<NameGenDeleteResponse> resp = new ResponseEntity<>(name, null, HttpStatus.OK);
-
- String actual = responseValidator.validateNameGenDeleteResponse(resp);
-
- assertEquals(actual, "");
- }
-
- @Test
- public void validateNameGenDeleteResponseBadStatusTest() throws BadResponseException {
- NameGenDeleteResponse name = new NameGenDeleteResponse();
-
- ResponseEntity<NameGenDeleteResponse> resp = new ResponseEntity<>(name, null, HttpStatus.NOT_FOUND);
-
- expectedException.expect(BadResponseException.class);
- responseValidator.validateNameGenDeleteResponse(resp);
- }
-
+
+ private NamingClientResponseValidator responseValidator = new NamingClientResponseValidator();
+ private String instanceGroupName = "generatedInstanceGroupName";
+
+ @Test
+ public void validateNameGenResponseSuccessTest() throws BadResponseException {
+ NameGenResponse name = new NameGenResponse();
+ Respelement respElement = new Respelement();
+ respElement.setResourceName("instance-group-name");
+ respElement.setResourceValue(instanceGroupName);
+ List<Respelement> respList = new ArrayList<Respelement>();
+ respList.add(respElement);
+ name.setElements(respList);
+ ResponseEntity<NameGenResponse> resp = new ResponseEntity<>(name, null, HttpStatus.OK);
+
+ String actual = responseValidator.validateNameGenResponse(resp);
+
+ assertEquals(actual, "generatedInstanceGroupName");
+ }
+
+ @Test
+ public void validateNameGenResponseNoNameGeneratedTest() throws BadResponseException {
+ NameGenResponse name = new NameGenResponse();
+ Respelement respElement = new Respelement();
+ respElement.setResourceName("instance-group");
+ respElement.setResourceValue(instanceGroupName);
+ List<Respelement> respList = new ArrayList<Respelement>();
+ respList.add(respElement);
+ name.setElements(respList);
+ ResponseEntity<NameGenResponse> resp = new ResponseEntity<>(name, null, HttpStatus.OK);
+
+ String actual = responseValidator.validateNameGenResponse(resp);
+
+ assertEquals(actual, "");
+ }
+
+ @Test
+ public void validateNameGenResponseBadStatusTest() throws BadResponseException {
+ NameGenResponse name = new NameGenResponse();
+
+ ResponseEntity<NameGenResponse> resp = new ResponseEntity<>(name, null, HttpStatus.NOT_FOUND);
+
+ expectedException.expect(BadResponseException.class);
+ responseValidator.validateNameGenResponse(resp);
+ }
+
+ @Test
+ public void validateNameGenDeleteResponseSuccessTest() throws BadResponseException {
+ NameGenDeleteResponse name = new NameGenDeleteResponse();
+ ResponseEntity<NameGenDeleteResponse> resp = new ResponseEntity<>(name, null, HttpStatus.OK);
+
+ String actual = responseValidator.validateNameGenDeleteResponse(resp);
+
+ assertEquals(actual, "");
+ }
+
+ @Test
+ public void validateNameGenDeleteResponseBadStatusTest() throws BadResponseException {
+ NameGenDeleteResponse name = new NameGenDeleteResponse();
+
+ ResponseEntity<NameGenDeleteResponse> resp = new ResponseEntity<>(name, null, HttpStatus.NOT_FOUND);
+
+ expectedException.expect(BadResponseException.class);
+ responseValidator.validateNameGenDeleteResponse(resp);
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientTest.java
index 4bae5b40e4..8a387a88a4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientTest.java
@@ -25,11 +25,9 @@ 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.urlPathEqualTo;
import static org.junit.Assert.assertTrue;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-
import org.apache.http.HttpStatus;
import org.junit.Rule;
import org.junit.Test;
@@ -41,78 +39,78 @@ import org.onap.namingservice.model.NameGenRequest;
import org.onap.so.BaseIntegrationTest;
import org.onap.so.client.exception.BadResponseException;
import org.springframework.beans.factory.annotation.Autowired;
-
import com.fasterxml.jackson.core.JsonProcessingException;
-public class NamingClientTest extends BaseIntegrationTest{
- @Autowired
- NamingClient client;
- @Autowired
- NamingRequestObjectBuilder requestBuilder;
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Test
- public void assignNameGenRequest() throws BadResponseException, IOException{
- wireMockServer.stubFor(post(urlPathEqualTo("/web/service/v1/genNetworkElementName"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBodyFile("NamingClient/AssignResponse.json")
- .withStatus(HttpStatus.SC_ACCEPTED)));
-
- NameGenRequest request = assignSetup();
- String response = client.postNameGenRequest(request);
- assertTrue(response.equals("$vnf-name"));
- }
- @Test
- public void assignNameGenRequestError() throws BadResponseException, IOException{
- wireMockServer.stubFor(post(urlPathEqualTo("/web/service/v1/genNetworkElementName"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBodyFile("NamingClient/ErrorResponse.json")
- .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
-
- thrown.expect(BadResponseException.class);
- thrown.expectMessage("Error from Naming Service: External Key is required and must be unique");
- NameGenRequest request = assignSetup();
- client.postNameGenRequest(request);
- }
- @Test
- public void unassignNameGenRequest() throws BadResponseException, IOException{
- wireMockServer.stubFor(delete(urlPathEqualTo("/web/service/v1/genNetworkElementName"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBodyFile("NamingClient/UnassignResponse.json")
- .withStatus(HttpStatus.SC_ACCEPTED)));
-
- String response = client.deleteNameGenRequest(unassignSetup());
- assertTrue(response.equals(""));
- }
- @Test
- public void unassignNameGenRequestError() throws BadResponseException, IOException{
- wireMockServer.stubFor(delete(urlPathEqualTo("/web/service/v1/genNetworkElementName"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBodyFile("NamingClient/ErrorResponse.json")
- .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
-
- thrown.expect(BadResponseException.class);
- thrown.expectMessage("Error from Naming Service: External Key is required and must be unique");
- client.deleteNameGenRequest(unassignSetup());
- }
-
- public NameGenRequest assignSetup() throws JsonProcessingException{
- NameGenRequest request = new NameGenRequest();
- List<Element> elements = new ArrayList<>();
- Element testElement = new Element();
- testElement = requestBuilder.elementMapper("SomeUniqueValue", "SDNC_Policy.Config_MS_1806SRIOV_VNATJson.4.xml", "VNF", "nfNamingCode", "vnf_name");
- elements.add(testElement);
- request = requestBuilder.nameGenRequestMapper(elements);
- return request;
- }
- public NameGenDeleteRequest unassignSetup() throws JsonProcessingException{
- NameGenDeleteRequest request = new NameGenDeleteRequest();
- List<Deleteelement> deleteElements = new ArrayList<>();
- Deleteelement testElement = new Deleteelement();
- testElement = requestBuilder.deleteElementMapper("instanceGroupId");
- deleteElements.add(testElement);
- request = requestBuilder.nameGenDeleteRequestMapper(deleteElements);
- return request;
- }
+public class NamingClientTest extends BaseIntegrationTest {
+ @Autowired
+ NamingClient client;
+ @Autowired
+ NamingRequestObjectBuilder requestBuilder;
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Test
+ public void assignNameGenRequest() throws BadResponseException, IOException {
+ wireMockServer.stubFor(post(urlPathEqualTo("/web/service/v1/genNetworkElementName"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("NamingClient/AssignResponse.json").withStatus(HttpStatus.SC_ACCEPTED)));
+
+ NameGenRequest request = assignSetup();
+ String response = client.postNameGenRequest(request);
+ assertTrue(response.equals("$vnf-name"));
+ }
+
+ @Test
+ public void assignNameGenRequestError() throws BadResponseException, IOException {
+ wireMockServer.stubFor(post(urlPathEqualTo("/web/service/v1/genNetworkElementName")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withBodyFile("NamingClient/ErrorResponse.json")
+ .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
+
+ thrown.expect(BadResponseException.class);
+ thrown.expectMessage("Error from Naming Service: External Key is required and must be unique");
+ NameGenRequest request = assignSetup();
+ client.postNameGenRequest(request);
+ }
+
+ @Test
+ public void unassignNameGenRequest() throws BadResponseException, IOException {
+ wireMockServer.stubFor(delete(urlPathEqualTo("/web/service/v1/genNetworkElementName"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("NamingClient/UnassignResponse.json").withStatus(HttpStatus.SC_ACCEPTED)));
+
+ String response = client.deleteNameGenRequest(unassignSetup());
+ assertTrue(response.equals(""));
+ }
+
+ @Test
+ public void unassignNameGenRequestError() throws BadResponseException, IOException {
+ wireMockServer.stubFor(delete(urlPathEqualTo("/web/service/v1/genNetworkElementName")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withBodyFile("NamingClient/ErrorResponse.json")
+ .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
+
+ thrown.expect(BadResponseException.class);
+ thrown.expectMessage("Error from Naming Service: External Key is required and must be unique");
+ client.deleteNameGenRequest(unassignSetup());
+ }
+
+ public NameGenRequest assignSetup() throws JsonProcessingException {
+ NameGenRequest request = new NameGenRequest();
+ List<Element> elements = new ArrayList<>();
+ Element testElement = new Element();
+ testElement = requestBuilder.elementMapper("SomeUniqueValue", "SDNC_Policy.Config_MS_1806SRIOV_VNATJson.4.xml",
+ "VNF", "nfNamingCode", "vnf_name");
+ elements.add(testElement);
+ request = requestBuilder.nameGenRequestMapper(elements);
+ return request;
+ }
+
+ public NameGenDeleteRequest unassignSetup() throws JsonProcessingException {
+ NameGenDeleteRequest request = new NameGenDeleteRequest();
+ List<Deleteelement> deleteElements = new ArrayList<>();
+ Deleteelement testElement = new Deleteelement();
+ testElement = requestBuilder.deleteElementMapper("instanceGroupId");
+ deleteElements.add(testElement);
+ request = requestBuilder.nameGenDeleteRequestMapper(deleteElements);
+ return request;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestObjectBuilderTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestObjectBuilderTest.java
index 6cb4987bee..bec588b6d3 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestObjectBuilderTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestObjectBuilderTest.java
@@ -22,10 +22,8 @@ package org.onap.so.client.namingservice;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertThat;
-
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Test;
import org.onap.namingservice.model.Deleteelement;
import org.onap.namingservice.model.Element;
@@ -34,72 +32,76 @@ import org.onap.namingservice.model.NameGenRequest;
import org.onap.so.client.namingservice.NamingRequestObjectBuilder;
public class NamingRequestObjectBuilderTest {
-
- private NamingRequestObjectBuilder mapper = new NamingRequestObjectBuilder();
- private String instanceGroupId = "95cbbe59-1017-4c13-b4e8-d824e54def3e";
- private String policyInstanceName = "MSO_Policy.Config_MS_VNFInstanceGroup";
- private String namingType = "InstanceGroup";
- private String nfNamingCode = "NamingCode";
- private String instanceGroupName = "InstanceGroupName";
-
- @Test
- public void elementMapperTest(){
- // Expected element
- Element expected = new Element();
- expected.put("external-key", instanceGroupId);
- expected.put("policy-instance-name", policyInstanceName);
- expected.put("naming-type", namingType);
- expected.put("resource-name", instanceGroupName);
- expected.put("nf-naming-code", nfNamingCode);
-
- // Actual element
- Element actual = mapper.elementMapper(instanceGroupId, policyInstanceName, namingType, nfNamingCode, instanceGroupName);
-
- assertThat(actual, sameBeanAs(expected));
- }
- @Test
- public void deleteElementMapperTest(){
- // Expected Deleteelement
- Deleteelement expected = new Deleteelement();
- expected.setExternalKey(instanceGroupId);
-
- // Actual Deleteelement
- Deleteelement actual = mapper.deleteElementMapper(instanceGroupId);
-
- assertThat(actual, sameBeanAs(expected));
- }
- @Test
- public void nameGenRequestMapper(){
- // Expected NameGenRequest
- NameGenRequest expected = new NameGenRequest();
- List<Element> elements = new ArrayList<>();
- Element element = new Element();
- element.setExternalKey(instanceGroupId);
- element.setPolicyInstanceName(policyInstanceName);
- element.setNamingType(namingType);
- element.setResourceName(instanceGroupName);
- element.setNamingIngredientsZeroOrMore(nfNamingCode);
- elements.add(element);
- expected.setElements(elements);
-
- //Actual NameGenRequest
- NameGenRequest actual = mapper.nameGenRequestMapper(elements);
-
- assertThat(actual, sameBeanAs(expected));
- }
- @Test
- public void nameGenDeleteRequestMapper(){
- // Expected NameGenDeleteRequest
- NameGenDeleteRequest expected = new NameGenDeleteRequest();
- List<Deleteelement> deleteElements = new ArrayList<>();
- Deleteelement deleteElement = new Deleteelement();
- deleteElement.setExternalKey(instanceGroupId);
- deleteElements.add(deleteElement);
- expected.setElements(deleteElements);
-
- // Actual NameGenDeleteRequest
- NameGenDeleteRequest actual = mapper.nameGenDeleteRequestMapper(deleteElements);
-
- assertThat(actual, sameBeanAs(expected));
- }
+
+ private NamingRequestObjectBuilder mapper = new NamingRequestObjectBuilder();
+ private String instanceGroupId = "95cbbe59-1017-4c13-b4e8-d824e54def3e";
+ private String policyInstanceName = "MSO_Policy.Config_MS_VNFInstanceGroup";
+ private String namingType = "InstanceGroup";
+ private String nfNamingCode = "NamingCode";
+ private String instanceGroupName = "InstanceGroupName";
+
+ @Test
+ public void elementMapperTest() {
+ // Expected element
+ Element expected = new Element();
+ expected.put("external-key", instanceGroupId);
+ expected.put("policy-instance-name", policyInstanceName);
+ expected.put("naming-type", namingType);
+ expected.put("resource-name", instanceGroupName);
+ expected.put("nf-naming-code", nfNamingCode);
+
+ // Actual element
+ Element actual =
+ mapper.elementMapper(instanceGroupId, policyInstanceName, namingType, nfNamingCode, instanceGroupName);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void deleteElementMapperTest() {
+ // Expected Deleteelement
+ Deleteelement expected = new Deleteelement();
+ expected.setExternalKey(instanceGroupId);
+
+ // Actual Deleteelement
+ Deleteelement actual = mapper.deleteElementMapper(instanceGroupId);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void nameGenRequestMapper() {
+ // Expected NameGenRequest
+ NameGenRequest expected = new NameGenRequest();
+ List<Element> elements = new ArrayList<>();
+ Element element = new Element();
+ element.setExternalKey(instanceGroupId);
+ element.setPolicyInstanceName(policyInstanceName);
+ element.setNamingType(namingType);
+ element.setResourceName(instanceGroupName);
+ element.setNamingIngredientsZeroOrMore(nfNamingCode);
+ elements.add(element);
+ expected.setElements(elements);
+
+ // Actual NameGenRequest
+ NameGenRequest actual = mapper.nameGenRequestMapper(elements);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void nameGenDeleteRequestMapper() {
+ // Expected NameGenDeleteRequest
+ NameGenDeleteRequest expected = new NameGenDeleteRequest();
+ List<Deleteelement> deleteElements = new ArrayList<>();
+ Deleteelement deleteElement = new Deleteelement();
+ deleteElement.setExternalKey(instanceGroupId);
+ deleteElements.add(deleteElement);
+ expected.setElements(deleteElements);
+
+ // Actual NameGenDeleteRequest
+ NameGenDeleteRequest actual = mapper.nameGenDeleteRequestMapper(deleteElements);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java
index c4e50412a9..ce7d557254 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java
@@ -24,7 +24,6 @@ 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 org.junit.Assert.assertEquals;
-
import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
import org.onap.so.client.exception.BadResponseException;
@@ -38,9 +37,7 @@ import org.onap.so.client.oof.beans.ResourceModelInfo;
import org.onap.so.client.oof.beans.ServiceInfo;
import org.onap.so.client.oof.beans.SubscriberInfo;
import org.springframework.beans.factory.annotation.Autowired;
-
import com.fasterxml.jackson.core.JsonProcessingException;
-
import java.util.ArrayList;
import java.util.List;
@@ -52,7 +49,8 @@ public class OofClientTestIT extends BaseIntegrationTest {
@Test
public void testPostDemands_success() throws BadResponseException, JsonProcessingException {
- String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"status\", \"requestStatus\": \"accepted\"}";
+ String mockResponse =
+ "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"status\", \"requestStatus\": \"accepted\"}";
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelCustomizationName("modelCustomizationName-Service");
@@ -118,102 +116,73 @@ public class OofClientTestIT extends BaseIntegrationTest {
oofRequest.setServiceInformation(serviceInfo);
oofRequest.setLicenseInformation("");
- wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
+ wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
client.postDemands(oofRequest);
String oofRequestOutput = oofRequest.toJsonString();
- assertEquals("{\n" +
- " \"requestInfo\" : {\n" +
- " \"transactionId\" : \"transactionId\",\n" +
- " \"requestId\" : \"requestId\",\n" +
- " \"callbackUrl\" : \"callBackUrl\",\n" +
- " \"sourceId\" : \"sourceId\",\n" +
- " \"requestType\" : \"requestType\",\n" +
- " \"numSolutions\" : 1,\n" +
- " \"optimizers\" : [ \"optimizer1\", \"optimizer2\" ],\n" +
- " \"timeout\" : 30\n" +
- " },\n" +
- " \"serviceInfo\" : {\n" +
- " \"serviceInstanceId\" : \"serviceInstanceId\",\n" +
- " \"serviceName\" : \"serviceName\",\n" +
- " \"modelInfo\" : {\n" +
- " \"modelType\" : \"modelType-Service\",\n" +
- " \"modelInvariantId\" : \"modelInvariantId-Service\",\n" +
- " \"modelVersionId\" : \"modelVersionId-Service\",\n" +
- " \"modelName\" : \"modelName-Service\",\n" +
- " \"modelVersion\" : \"modelVersion-Service\",\n" +
- " \"modelCustomizationName\" : \"modelCustomizationName-Service\"\n" +
- " }\n" +
- " },\n" +
- " \"placementInfo\" : {\n" +
- " \"requestParameters\" : {\n" +
- " \"customerLatitude\" : \"customerLatitude\",\n" +
- " \"customerLongitude\" : \"customerLongitude\",\n" +
- " \"customerName\" : \"customerName\"\n" +
- " },\n" +
- " \"subscriberInfo\" : {\n" +
- " \"globalSubscriberId\" : \"globalSubscriberId\",\n" +
- " \"subscriberName\" : \"subscriberName\",\n" +
- " \"subscriberCommonSiteId\" : \"subscriberCommonSiteId\"\n" +
- " },\n" +
- " \"placementDemands\" : [ {\n" +
- " \"resourceModuleName\" : \"resourceModuleName\",\n" +
- " \"serviceResourceId\" : \"serviceResourceId\",\n" +
- " \"tenantId\" : \"tenantId\",\n" +
- " \"resourceModelInfo\" : {\n" +
- " \"modelType\" : \"modelType\",\n" +
- " \"modelInvariantId\" : \"invarianteId\",\n" +
- " \"modelVersionId\" : \"versionId\",\n" +
- " \"modelName\" : \"modelName\",\n" +
- " \"modelVersion\" : \"version\",\n" +
- " \"modelCustomizationName\" : \"modelCustomizationName\"\n" +
- " }\n" +
- " } ]\n" +
- " },\n" +
- " \"licenseInfo\" : \"\"\n" +
- "}", oofRequestOutput);
+ assertEquals("{\n" + " \"requestInfo\" : {\n" + " \"transactionId\" : \"transactionId\",\n"
+ + " \"requestId\" : \"requestId\",\n" + " \"callbackUrl\" : \"callBackUrl\",\n"
+ + " \"sourceId\" : \"sourceId\",\n" + " \"requestType\" : \"requestType\",\n"
+ + " \"numSolutions\" : 1,\n" + " \"optimizers\" : [ \"optimizer1\", \"optimizer2\" ],\n"
+ + " \"timeout\" : 30\n" + " },\n" + " \"serviceInfo\" : {\n"
+ + " \"serviceInstanceId\" : \"serviceInstanceId\",\n" + " \"serviceName\" : \"serviceName\",\n"
+ + " \"modelInfo\" : {\n" + " \"modelType\" : \"modelType-Service\",\n"
+ + " \"modelInvariantId\" : \"modelInvariantId-Service\",\n"
+ + " \"modelVersionId\" : \"modelVersionId-Service\",\n"
+ + " \"modelName\" : \"modelName-Service\",\n"
+ + " \"modelVersion\" : \"modelVersion-Service\",\n"
+ + " \"modelCustomizationName\" : \"modelCustomizationName-Service\"\n" + " }\n" + " },\n"
+ + " \"placementInfo\" : {\n" + " \"requestParameters\" : {\n"
+ + " \"customerLatitude\" : \"customerLatitude\",\n"
+ + " \"customerLongitude\" : \"customerLongitude\",\n"
+ + " \"customerName\" : \"customerName\"\n" + " },\n" + " \"subscriberInfo\" : {\n"
+ + " \"globalSubscriberId\" : \"globalSubscriberId\",\n"
+ + " \"subscriberName\" : \"subscriberName\",\n"
+ + " \"subscriberCommonSiteId\" : \"subscriberCommonSiteId\"\n" + " },\n"
+ + " \"placementDemands\" : [ {\n" + " \"resourceModuleName\" : \"resourceModuleName\",\n"
+ + " \"serviceResourceId\" : \"serviceResourceId\",\n" + " \"tenantId\" : \"tenantId\",\n"
+ + " \"resourceModelInfo\" : {\n" + " \"modelType\" : \"modelType\",\n"
+ + " \"modelInvariantId\" : \"invarianteId\",\n" + " \"modelVersionId\" : \"versionId\",\n"
+ + " \"modelName\" : \"modelName\",\n" + " \"modelVersion\" : \"version\",\n"
+ + " \"modelCustomizationName\" : \"modelCustomizationName\"\n" + " }\n" + " } ]\n"
+ + " },\n" + " \"licenseInfo\" : \"\"\n" + "}", oofRequestOutput);
}
@Test
public void testAsyncResponse_success() throws BadResponseException, JsonProcessingException {
- String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"status\", \"requestStatus\": \"accepted\"}";
+ String mockResponse =
+ "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"status\", \"requestStatus\": \"accepted\"}";
- wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
+ wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
client.postDemands(new OofRequest());
}
@Test(expected = BadResponseException.class)
public void testPostDemands_error_failed() throws JsonProcessingException, BadResponseException {
- String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": \"failed\"}";
+ String mockResponse =
+ "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": \"failed\"}";
- wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
+ wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
client.postDemands(new OofRequest());
- //TODO assertEquals("missing data", );
+ // 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\"}";
+ String mockResponse =
+ "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"\", \"requestStatus\": \"failed\"}";
- wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
+ wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
client.postDemands(new OofRequest());
@@ -222,12 +191,11 @@ public class OofClientTestIT extends BaseIntegrationTest {
@Test(expected = BadResponseException.class)
public void testPostDemands_error_noStatus() throws JsonProcessingException, BadResponseException {
- String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": null}";
+ String mockResponse =
+ "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": null}";
- wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
+ wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
client.postDemands(new OofRequest());
@@ -238,10 +206,8 @@ public class OofClientTestIT extends BaseIntegrationTest {
public void testPostDemands_error_empty() throws JsonProcessingException, BadResponseException {
String mockResponse = "{ }";
- wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
+ wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
client.postDemands(new OofRequest());
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
index 8bf3de5c4e..7c40995d48 100644
--- 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
@@ -26,7 +26,6 @@ import static org.mockito.ArgumentMatchers.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;
@@ -43,42 +42,47 @@ 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;
-public class AAICollectionResourcesTest extends BaseTaskTest{
-
- @InjectMocks
- private AAICollectionResources aaiCollectionResources = new AAICollectionResources();
-
-
- 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())));
- }
-
+public class AAICollectionResourcesTest extends BaseTaskTest {
+
+ @InjectMocks
+ private AAICollectionResources aaiCollectionResources = new AAICollectionResources();
+
+
+ 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
index 4bf445949a..2e1a40dd22 100644
--- 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
@@ -27,9 +27,7 @@ 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;
@@ -57,32 +55,32 @@ import org.onap.so.bpmn.common.data.TestDataSetup;
@RunWith(MockitoJUnitRunner.Silent.class)
-public class AAIConfigurationResourcesTest extends TestDataSetup{
-
-
-
- private Configuration configuration;
+public class AAIConfigurationResourcesTest extends TestDataSetup {
+
+
+
+ private Configuration configuration;
private ServiceProxy serviceProxy;
private ServiceInstance serviceInstance;
private GenericVnf genericVnf;
private VpnBinding vpnBinding;
private VfModule vfModule;
-
- @Mock
- protected AAIResourcesClient MOCK_aaiResourcesClient;
-
+
+ @Mock
+ protected AAIResourcesClient MOCK_aaiResourcesClient;
+
@Mock
protected AAIObjectMapper MOCK_aaiObjectMapper;
-
+
@Mock
protected InjectionHelper MOCK_injectionHelper;
-
+
@InjectMocks
- private AAIConfigurationResources aaiConfigurationResources = new AAIConfigurationResources();
-
+ private AAIConfigurationResources aaiConfigurationResources = new AAIConfigurationResources();
+
@Before
public void before() {
- configuration = buildConfiguration();
+ configuration = buildConfiguration();
serviceProxy = buildServiceProxy();
serviceInstance = buildServiceInstance();
genericVnf = buildGenericVnf();
@@ -90,62 +88,73 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{
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));
-
+ 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.ASSIGNED, configuration.getOrchestrationStatus());
- verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Configuration.class));
+ 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));
+ 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),ArgumentMatchers.isNull());
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), ArgumentMatchers.isNull());
}
@Test
public void connectConfigurationToServiceInstanceTest() {
doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
- aaiConfigurationResources.connectConfigurationToServiceInstance(configuration.getConfigurationId(), serviceInstance.getServiceInstanceId());
+ aaiConfigurationResources.connectConfigurationToServiceInstance(configuration.getConfigurationId(),
+ serviceInstance.getServiceInstanceId());
verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
}
-
+
@Test
public void connectConfigurationToServiceInstanceWithEdgeTest() {
- doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class), any(AAIEdgeLabel.class));
- aaiConfigurationResources.connectConfigurationToServiceInstance(configuration.getConfigurationId(), serviceInstance.getServiceInstanceId(), AAIEdgeLabel.USES);
- verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class), any(AAIEdgeLabel.class));
+ doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class),
+ any(AAIEdgeLabel.class));
+ aaiConfigurationResources.connectConfigurationToServiceInstance(configuration.getConfigurationId(),
+ serviceInstance.getServiceInstanceId(), AAIEdgeLabel.USES);
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class),
+ any(AAIEdgeLabel.class));
}
-
+
@Test
- public void disconnectConfigurationToServiceInstanceTest(){
+ public void disconnectConfigurationToServiceInstanceTest() {
doNothing().when(MOCK_aaiResourcesClient).disconnect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
- aaiConfigurationResources.disconnectConfigurationToServiceInstance("TEST_CONFIGURATION_ID", "TEST_SERVICE_INSTANCE_ID");
+ 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());
+ aaiConfigurationResources.connectConfigurationToGenericVnf(configuration.getConfigurationId(),
+ genericVnf.getVnfId());
verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
}
-
+
@Test
public void connectConfigurationToVfModuleTest() {
doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
- aaiConfigurationResources.connectConfigurationToVfModule(configuration.getConfigurationId(), vfModule.getVfModuleId(),genericVnf.getVnfId());
+ aaiConfigurationResources.connectConfigurationToVfModule(configuration.getConfigurationId(),
+ vfModule.getVfModuleId(), genericVnf.getVnfId());
verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
}
-
+
@Test
public void connectConfigurationToVnfcTest() {
doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
@@ -156,17 +165,22 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{
@Test
public void connectConfigurationToVpnBindingTest() {
doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
- aaiConfigurationResources.connectConfigurationToVpnBinding(configuration.getConfigurationId(), vpnBinding.getVpnId());
+ aaiConfigurationResources.connectConfigurationToVpnBinding(configuration.getConfigurationId(),
+ vpnBinding.getVpnId());
verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
}
@Test
- public void getConfigurationFromRelatedLinkTest () {
- Optional<org.onap.aai.domain.yang.Configuration> configuration = Optional.of(new org.onap.aai.domain.yang.Configuration());
+ public void getConfigurationFromRelatedLinkTest() {
+ Optional<org.onap.aai.domain.yang.Configuration> 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));
+ 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
@@ -174,24 +188,28 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{
Configuration vrfConfiguration = buildConfiguration();
Configuration vnrConfiguration = buildConfiguration();
doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
- aaiConfigurationResources.connectVrfConfigurationToVnrConfiguration(vrfConfiguration.getConfigurationId(),vnrConfiguration.getConfigurationId());
+ 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());
+
+ 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);
+ 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);
}
@@ -203,13 +221,14 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{
aaiConfigurationResources.deleteConfiguration("configurationId");
verify(MOCK_aaiResourcesClient, times(1)).delete(aaiResourceUri);
}
-
+
@Test
- public void updateOrchestrationStatusConfigurationTest() throws Exception {
- configuration.setOrchestrationStatus(OrchestrationStatus.ACTIVE);
- doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Configuration.class));
- aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration,OrchestrationStatus.ACTIVE);
- verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), ArgumentMatchers.isNull());
- assertEquals(OrchestrationStatus.ACTIVE, configuration.getOrchestrationStatus());
- }
-} \ No newline at end of file
+ public void updateOrchestrationStatusConfigurationTest() throws Exception {
+ configuration.setOrchestrationStatus(OrchestrationStatus.ACTIVE);
+ doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class),
+ isA(org.onap.aai.domain.yang.Configuration.class));
+ aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), ArgumentMatchers.isNull());
+ assertEquals(OrchestrationStatus.ACTIVE, configuration.getOrchestrationStatus());
+ }
+}
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
index 58bcc8b1aa..8c0d27f799 100644
--- 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
@@ -28,9 +28,7 @@ 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;
@@ -49,75 +47,88 @@ 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.Silent.class)
-public class AAIInstanceGroupResourcesTest extends TestDataSetup{
-
- @InjectMocks
- private AAIInstanceGroupResources aaiInstanceGroupResources = new AAIInstanceGroupResources();
-
- private InstanceGroup instanceGroup;
- private GenericVnf vnf;
- private ServiceInstance serviceInstance;
-
- @Mock
- protected AAIResourcesClient MOCK_aaiResourcesClient;
-
+public class AAIInstanceGroupResourcesTest extends TestDataSetup {
+
+ @InjectMocks
+ private AAIInstanceGroupResources aaiInstanceGroupResources = new AAIInstanceGroupResources();
+
+ private InstanceGroup instanceGroup;
+ private GenericVnf vnf;
+ private ServiceInstance serviceInstance;
+
+ @Mock
+ protected AAIResourcesClient MOCK_aaiResourcesClient;
+
@Mock
protected AAIObjectMapper MOCK_aaiObjectMapper;
-
+
@Mock
protected InjectionHelper MOCK_injectionHelper;
-
- @Before
- public void before() {
- instanceGroup = buildInstanceGroup();
- vnf = buildGenericVnf();
- serviceInstance = buildServiceInstance();
- 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 connectInstanceGroupWithEdgeTest() throws Exception {
- aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf, AAIEdgeLabel.BELONGS_TO);
- verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())), eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId())), eq(AAIEdgeLabel.BELONGS_TO));
- }
-
- @Test
- public void existsTest() throws Exception {
- aaiInstanceGroupResources.exists(instanceGroup);
- verify(MOCK_aaiResourcesClient, times(1)).exists(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())));
- }
-
- @Test
- public void createInstanceGroupandConnectServiceInstanceTest() {
- doReturn(new org.onap.aai.domain.yang.InstanceGroup()).when(MOCK_aaiObjectMapper).mapInstanceGroup(instanceGroup);
- doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), any(Optional.class));
- doNothing().when(MOCK_aaiResourcesClient).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
-
- aaiInstanceGroupResources.createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance);
-
- verify(MOCK_aaiObjectMapper, times(1)).mapInstanceGroup(instanceGroup);
- verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
- verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
- }
-
+
+ @Before
+ public void before() {
+ instanceGroup = buildInstanceGroup();
+ vnf = buildGenericVnf();
+ serviceInstance = buildServiceInstance();
+ 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 connectInstanceGroupWithEdgeTest() throws Exception {
+ aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf, AAIEdgeLabel.BELONGS_TO);
+ verify(MOCK_aaiResourcesClient, times(1)).connect(
+ eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())),
+ eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId())),
+ eq(AAIEdgeLabel.BELONGS_TO));
+ }
+
+ @Test
+ public void existsTest() throws Exception {
+ aaiInstanceGroupResources.exists(instanceGroup);
+ verify(MOCK_aaiResourcesClient, times(1))
+ .exists(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())));
+ }
+
+ @Test
+ public void createInstanceGroupandConnectServiceInstanceTest() {
+ doReturn(new org.onap.aai.domain.yang.InstanceGroup()).when(MOCK_aaiObjectMapper)
+ .mapInstanceGroup(instanceGroup);
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class),
+ any(Optional.class));
+ doNothing().when(MOCK_aaiResourcesClient).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+
+ aaiInstanceGroupResources.createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance);
+
+ verify(MOCK_aaiObjectMapper, times(1)).mapInstanceGroup(instanceGroup);
+ verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+ 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/AAINetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
index 8632a6afdd..d41148d784 100644
--- 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
@@ -32,13 +32,11 @@ 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;
@@ -68,328 +66,363 @@ import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@RunWith(MockitoJUnitRunner.Silent.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;
- private Subnet subnet;
- private NetworkPolicy networkPolicy;
-
- @Mock
- protected AAIResourcesClient MOCK_aaiResourcesClient;
-
+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;
+ private Subnet subnet;
+ private NetworkPolicy networkPolicy;
+
+ @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<L3Network> l3NetworkList = new ArrayList<L3Network>();
- l3NetworkList.add(network);
-
- instanceGroup = buildInstanceGroup();
-
- serviceInstance = buildServiceInstance();
-
- cloudRegion = buildCloudRegion();
-
- subnet = buildSubnet();
-
- networkPolicy = buildNetworkPolicy();
-
- 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());
+
+ @InjectMocks
+ private AAINetworkResources aaiNetworkResources = new AAINetworkResources();
+
+ @Before
+ public void before() {
+ network = buildL3Network();
+
+ collection = buildCollection();
+
+ List<L3Network> l3NetworkList = new ArrayList<L3Network>();
+ l3NetworkList.add(network);
+
+ instanceGroup = buildInstanceGroup();
+
+ serviceInstance = buildServiceInstance();
+
+ cloudRegion = buildCloudRegion();
+
+ subnet = buildSubnet();
+
+ networkPolicy = buildNetworkPolicy();
+
+ 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<VpnBinding> oVpnBinding = Optional.empty();
- AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, "ModelInvariantUUID");
-
- 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<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy = Optional.empty();
- AAIResourceUri netPolicyUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, "ModelInvariantUUID");
-
- 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()) {
- org.onap.aai.domain.yang.NetworkPolicy networkPolicy = oNetPolicy.get();
- assertThat(aaiResultWrapper.asBean(org.onap.aai.domain.yang.NetworkPolicy.class).get(), sameBeanAs(networkPolicy));
- }
- }
-
- @Test
- public void getNetworkPoliciesTest() throws Exception {
- final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPolicies.json")));
- AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
- Optional<org.onap.aai.domain.yang.NetworkPolicies> oNetPolicies = Optional.empty();
- AAIResourceUri netPoliciesUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
-
- doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
- oNetPolicies = aaiNetworkResources.getNetworkPolicies(netPoliciesUri);
- verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class));
- if (oNetPolicies.isPresent()) {
- org.onap.aai.domain.yang.NetworkPolicies networkPolicies = oNetPolicies.get();
- assertThat(aaiResultWrapper.asBean(org.onap.aai.domain.yang.NetworkPolicies.class).get(), sameBeanAs(networkPolicies));
- }
- }
-
- @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<RouteTableReference> oRtref = Optional.empty();
- AAIResourceUri rTRefUri = AAIUriFactory.createResourceUri(AAIObjectType.ROUTE_TABLE_REFERENCE, "ModelInvariantUUID");
-
- 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<org.onap.aai.domain.yang.L3Network> 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<Relationships> resultNetworkRelationships = result.getRelationships();
- assertTrue(resultNetworkRelationships.isPresent());
- Optional<org.onap.aai.domain.yang.L3Network> 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.L3_NETWORK, network.getNetworkId())),eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
- cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())));
- }
-
- @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));
- }
-
- @Test
- public void updateSubnetTest() throws Exception {
-
- doReturn(new org.onap.aai.domain.yang.Subnet()).when(MOCK_aaiObjectMapper).mapSubnet(subnet);
- doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Subnet.class));
-
- aaiNetworkResources.updateSubnet(network, subnet);
-
- verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Subnet.class));
- }
-
- @Test
- public void connectInstanceGroupToCloudRegionTest() throws Exception {
- aaiNetworkResources.connectInstanceGroupToCloudRegion(instanceGroup, cloudRegion);
- verify(MOCK_aaiResourcesClient, times(1)).connect(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())),
- eq(AAIEdgeLabel.USES));
- }
-
- @Test
- public void getSubnetTest() throws Exception {
- final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiSubnetsMapped_to_aai.json")));
- AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
- Optional<org.onap.aai.domain.yang.Subnet> oSubnet = Optional.empty();
- AAIResourceUri subnetUri = AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, "ModelInvariantUUID", "serviceModelVersionId");
-
- doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
- oSubnet = aaiNetworkResources.getSubnet(subnetUri);
- verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class));
-
- if (oSubnet.isPresent()) {
- org.onap.aai.domain.yang.Subnet subnet = oSubnet.get();
- assertThat(aaiResultWrapper.asBean(org.onap.aai.domain.yang.Subnet.class).get(), sameBeanAs(subnet));
- }
- }
-
- @Test
- public void createNetworkPolicyTest() throws Exception {
- doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.NetworkPolicy.class));
- doReturn(new org.onap.aai.domain.yang.NetworkPolicy()).when(MOCK_aaiObjectMapper).mapNetworkPolicy(networkPolicy);
- aaiNetworkResources.createNetworkPolicy(networkPolicy);
- verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.NetworkPolicy.class));
- }
-
- @Test
- public void deleteNetworkPolicyTest() throws Exception {
- doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class));
- aaiNetworkResources.deleteNetworkPolicy(networkPolicy.getNetworkPolicyId());
- verify(MOCK_aaiResourcesClient, times(1)).delete(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<VpnBinding> oVpnBinding = Optional.empty();
+ AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, "ModelInvariantUUID");
+
+ 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<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy = Optional.empty();
+ AAIResourceUri netPolicyUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, "ModelInvariantUUID");
+
+ 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()) {
+ org.onap.aai.domain.yang.NetworkPolicy networkPolicy = oNetPolicy.get();
+ assertThat(aaiResultWrapper.asBean(org.onap.aai.domain.yang.NetworkPolicy.class).get(),
+ sameBeanAs(networkPolicy));
+ }
+ }
+
+ @Test
+ public void getNetworkPoliciesTest() throws Exception {
+ final String content =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPolicies.json")));
+ AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
+ Optional<org.onap.aai.domain.yang.NetworkPolicies> oNetPolicies = Optional.empty();
+ AAIResourceUri netPoliciesUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+
+ doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
+ oNetPolicies = aaiNetworkResources.getNetworkPolicies(netPoliciesUri);
+ verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class));
+ if (oNetPolicies.isPresent()) {
+ org.onap.aai.domain.yang.NetworkPolicies networkPolicies = oNetPolicies.get();
+ assertThat(aaiResultWrapper.asBean(org.onap.aai.domain.yang.NetworkPolicies.class).get(),
+ sameBeanAs(networkPolicies));
+ }
+ }
+
+ @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<RouteTableReference> oRtref = Optional.empty();
+ AAIResourceUri rTRefUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.ROUTE_TABLE_REFERENCE, "ModelInvariantUUID");
+
+ 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<org.onap.aai.domain.yang.L3Network> 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<Relationships> resultNetworkRelationships = result.getRelationships();
+ assertTrue(resultNetworkRelationships.isPresent());
+ Optional<org.onap.aai.domain.yang.L3Network> 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.L3_NETWORK, network.getNetworkId())),
+ eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(),
+ cloudRegion.getLcpCloudRegionId())));
+ }
+
+ @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));
+ }
+
+ @Test
+ public void updateSubnetTest() throws Exception {
+
+ doReturn(new org.onap.aai.domain.yang.Subnet()).when(MOCK_aaiObjectMapper).mapSubnet(subnet);
+ doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class),
+ isA(org.onap.aai.domain.yang.Subnet.class));
+
+ aaiNetworkResources.updateSubnet(network, subnet);
+
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class),
+ isA(org.onap.aai.domain.yang.Subnet.class));
+ }
+
+ @Test
+ public void connectInstanceGroupToCloudRegionTest() throws Exception {
+ aaiNetworkResources.connectInstanceGroupToCloudRegion(instanceGroup, cloudRegion);
+ verify(MOCK_aaiResourcesClient, times(1)).connect(
+ eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())),
+ eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(),
+ cloudRegion.getLcpCloudRegionId())),
+ eq(AAIEdgeLabel.USES));
+ }
+
+ @Test
+ public void getSubnetTest() throws Exception {
+ final String content =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiSubnetsMapped_to_aai.json")));
+ AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
+ Optional<org.onap.aai.domain.yang.Subnet> oSubnet = Optional.empty();
+ AAIResourceUri subnetUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, "ModelInvariantUUID", "serviceModelVersionId");
+
+ doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
+ oSubnet = aaiNetworkResources.getSubnet(subnetUri);
+ verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class));
+
+ if (oSubnet.isPresent()) {
+ org.onap.aai.domain.yang.Subnet subnet = oSubnet.get();
+ assertThat(aaiResultWrapper.asBean(org.onap.aai.domain.yang.Subnet.class).get(), sameBeanAs(subnet));
+ }
+ }
+
+ @Test
+ public void createNetworkPolicyTest() throws Exception {
+ doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class),
+ isA(org.onap.aai.domain.yang.NetworkPolicy.class));
+ doReturn(new org.onap.aai.domain.yang.NetworkPolicy()).when(MOCK_aaiObjectMapper)
+ .mapNetworkPolicy(networkPolicy);
+ aaiNetworkResources.createNetworkPolicy(networkPolicy);
+ verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class),
+ isA(org.onap.aai.domain.yang.NetworkPolicy.class));
+ }
+
+ @Test
+ public void deleteNetworkPolicyTest() throws Exception {
+ doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class));
+ aaiNetworkResources.deleteNetworkPolicy(networkPolicy.getNetworkPolicyId());
+ 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
index a4b59f1f81..14df832754 100644
--- 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
@@ -28,9 +28,7 @@ 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.Ignore;
import org.junit.Test;
@@ -51,36 +49,36 @@ import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@RunWith(MockitoJUnitRunner.Silent.class)
-public class AAIServiceInstanceResourcesTest extends TestDataSetup{
-
+public class AAIServiceInstanceResourcesTest extends TestDataSetup {
+
@InjectMocks
private AAIServiceInstanceResources aaiServiceInstanceResources = new AAIServiceInstanceResources();
-
+
@Mock
- protected AAIResourcesClient MOCK_aaiResourcesClient;
-
+ 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();
+ 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);
@@ -104,34 +102,37 @@ public class AAIServiceInstanceResourcesTest extends TestDataSetup{
public void createServiceSubscriptionTest() {
serviceSubscription.setServiceType("IP-FLEX");
customer.setServiceSubscription(serviceSubscription);
- doReturn(new org.onap.aai.domain.yang.ServiceSubscription()).when(MOCK_aaiObjectMapper).mapServiceSubscription(customer.getServiceSubscription());
+ 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");
+ serviceSubscription.setServiceType("testSubscriberType");
customer.setServiceSubscription(serviceSubscription);
- doReturn(new org.onap.aai.domain.yang.ServiceInstance()).when(MOCK_aaiObjectMapper).mapServiceInstance(serviceInstance);
+ 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);
+ 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));
+ 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);
@@ -141,7 +142,7 @@ public class AAIServiceInstanceResourcesTest extends TestDataSetup{
@Test
public void createOwningEntityTest() {
- doReturn(new org.onap.aai.domain.yang.OwningEntity()).when(MOCK_aaiObjectMapper).mapOwningEntity(owningEntity);
+ 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));
}
@@ -160,7 +161,8 @@ public class AAIServiceInstanceResourcesTest extends TestDataSetup{
@Test
public void createOwningEntityandConnectServiceInstanceTest() {
- doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+ 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);
@@ -171,14 +173,17 @@ public class AAIServiceInstanceResourcesTest extends TestDataSetup{
@Test
@Ignore
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));
+ aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance,
+ OrchestrationStatus.ACTIVE);
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class),
+ any(org.onap.aai.domain.yang.ServiceInstance.class));
}
@Test
@Ignore
public void test_updateServiceInstance() {
aaiServiceInstanceResources.updateServiceInstance(serviceInstance);
- verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.ServiceInstance.class));
+ 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
index a8200caf79..ae3ebeddbd 100644
--- 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
@@ -27,9 +27,7 @@ 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;
@@ -49,106 +47,111 @@ import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@RunWith(MockitoJUnitRunner.Silent.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),ArgumentMatchers.isNull());
-
- 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), ArgumentMatchers.isNull());
- }
-
- @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));
- }
-
- @Test
- public void updateHeatStackIdVfModuleTest() throws Exception {
- vfModule.setHeatStackId("testHeatStackId");
-
- doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VfModule.class));
-
- aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf);
-
- verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class),ArgumentMatchers.isNull());
-
- assertEquals("testHeatStackId", vfModule.getHeatStackId());
- }
-
- @Test
- public void updateContrailServiceInstanceFqdnVfModuleTest() throws Exception {
- vfModule.setContrailServiceInstanceFqdn("testContrailServiceInstanceFqdn");
-
- doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VfModule.class));
-
- aaiVfModuleResources.updateContrailServiceInstanceFqdnVfModule(vfModule, vnf);
-
- verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class),ArgumentMatchers.isNull());
-
- assertEquals("testContrailServiceInstanceFqdn", vfModule.getContrailServiceInstanceFqdn());
- }
+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), ArgumentMatchers.isNull());
+
+ 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), ArgumentMatchers.isNull());
+ }
+
+ @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));
+ }
+
+ @Test
+ public void updateHeatStackIdVfModuleTest() throws Exception {
+ vfModule.setHeatStackId("testHeatStackId");
+
+ doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class),
+ isA(org.onap.aai.domain.yang.VfModule.class));
+
+ aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf);
+
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), ArgumentMatchers.isNull());
+
+ assertEquals("testHeatStackId", vfModule.getHeatStackId());
+ }
+
+ @Test
+ public void updateContrailServiceInstanceFqdnVfModuleTest() throws Exception {
+ vfModule.setContrailServiceInstanceFqdn("testContrailServiceInstanceFqdn");
+
+ doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class),
+ isA(org.onap.aai.domain.yang.VfModule.class));
+
+ aaiVfModuleResources.updateContrailServiceInstanceFqdnVfModule(vfModule, vnf);
+
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), ArgumentMatchers.isNull());
+
+ assertEquals("testContrailServiceInstanceFqdn", vfModule.getContrailServiceInstanceFqdn());
+ }
}
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
index d499bcd36e..cdc601c1e4 100644
--- 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
@@ -29,10 +29,8 @@ 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.IOException;
import java.util.Optional;
-
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -58,159 +56,175 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus;
@RunWith(MockitoJUnitRunner.Silent.class)
public class AAIVnfResourcesTest extends TestDataSetup {
- private GenericVnf genericVnf;
-
- private ServiceInstance serviceInstance;
-
- private CloudRegion cloudRegion;
-
- @Mock
- protected AAIResourcesClient MOCK_aaiResourcesClient;
-
- @Mock
- protected AAIObjectMapper MOCK_aaiObjectMapper;
-
- @Mock
- protected InjectionHelper MOCK_injectionHelper;
-
- @Mock
- protected AAIValidatorImpl MOCK_aaiValidatorImpl;
-
- @InjectMocks
- AAIVnfResources aaiVnfResources = new AAIVnfResources();
-
- @Before
- public void before() {
- serviceInstance = buildServiceInstance();
- genericVnf = buildGenericVnf();
- cloudRegion = buildCloudRegion();
- 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), ArgumentMatchers.isNull());
-
- 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<org.onap.aai.domain.yang.GenericVnf> 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<org.onap.aai.domain.yang.GenericVnf> 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);
- }
-
- @Test
- public void connectVnfToTenantTest() throws Exception {
- aaiVnfResources.connectVnfToTenant(genericVnf, cloudRegion);
- verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.TENANT,
- cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnf.getVnfId())));
- }
-
- @Test
- public void connectVnfToCloudRegionTest() throws Exception {
- aaiVnfResources.connectVnfToCloudRegion(genericVnf, cloudRegion);
- verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnf.getVnfId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
- cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())));
- }
-
-
- @Test
- public void checkVnfClosedLoopDisabledFlagTest () {
- Optional<org.onap.aai.domain.yang.GenericVnf> vnf = Optional.of(new org.onap.aai.domain.yang.GenericVnf());
- vnf.get().setVnfId("vnfId");
- vnf.get().setIsClosedLoopDisabled(true);
- doReturn(vnf).when(MOCK_aaiResourcesClient).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class));
- boolean isCheckVnfClosedLoopDisabledFlag = aaiVnfResources.checkVnfClosedLoopDisabledFlag("vnfId");
- verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class));
- assertEquals(isCheckVnfClosedLoopDisabledFlag, true);
- }
-
- @Test
- public void checkVnfPserversLockedFlagTest () throws IOException {
-
- Optional<org.onap.aai.domain.yang.GenericVnf> 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));
- doReturn(true).when(MOCK_aaiValidatorImpl).isPhysicalServerLocked("vnfId");
- boolean isVnfPserversLockedFlag = aaiVnfResources.checkVnfPserversLockedFlag("vnfId");
- verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class));
- verify(MOCK_aaiValidatorImpl, times(1)).isPhysicalServerLocked(isA(String.class));
- assertTrue(isVnfPserversLockedFlag);
- }
+ private GenericVnf genericVnf;
+
+ private ServiceInstance serviceInstance;
+
+ private CloudRegion cloudRegion;
+
+ @Mock
+ protected AAIResourcesClient MOCK_aaiResourcesClient;
+
+ @Mock
+ protected AAIObjectMapper MOCK_aaiObjectMapper;
+
+ @Mock
+ protected InjectionHelper MOCK_injectionHelper;
+
+ @Mock
+ protected AAIValidatorImpl MOCK_aaiValidatorImpl;
+
+ @InjectMocks
+ AAIVnfResources aaiVnfResources = new AAIVnfResources();
+
+ @Before
+ public void before() {
+ serviceInstance = buildServiceInstance();
+ genericVnf = buildGenericVnf();
+ cloudRegion = buildCloudRegion();
+ 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), ArgumentMatchers.isNull());
+
+ 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<org.onap.aai.domain.yang.GenericVnf> 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<org.onap.aai.domain.yang.GenericVnf> 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);
+ }
+
+ @Test
+ public void connectVnfToTenantTest() throws Exception {
+ aaiVnfResources.connectVnfToTenant(genericVnf, cloudRegion);
+ verify(MOCK_aaiResourcesClient, times(1)).connect(
+ eq(AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(),
+ cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId())),
+ eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnf.getVnfId())));
+ }
+
+ @Test
+ public void connectVnfToCloudRegionTest() throws Exception {
+ aaiVnfResources.connectVnfToCloudRegion(genericVnf, cloudRegion);
+ verify(MOCK_aaiResourcesClient, times(1)).connect(
+ eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnf.getVnfId())),
+ eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(),
+ cloudRegion.getLcpCloudRegionId())));
+ }
+
+
+ @Test
+ public void checkVnfClosedLoopDisabledFlagTest() {
+ Optional<org.onap.aai.domain.yang.GenericVnf> vnf = Optional.of(new org.onap.aai.domain.yang.GenericVnf());
+ vnf.get().setVnfId("vnfId");
+ vnf.get().setIsClosedLoopDisabled(true);
+ doReturn(vnf).when(MOCK_aaiResourcesClient).get(eq(org.onap.aai.domain.yang.GenericVnf.class),
+ isA(AAIResourceUri.class));
+ boolean isCheckVnfClosedLoopDisabledFlag = aaiVnfResources.checkVnfClosedLoopDisabledFlag("vnfId");
+ verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.GenericVnf.class),
+ isA(AAIResourceUri.class));
+ assertEquals(isCheckVnfClosedLoopDisabledFlag, true);
+ }
+
+ @Test
+ public void checkVnfPserversLockedFlagTest() throws IOException {
+
+ Optional<org.onap.aai.domain.yang.GenericVnf> 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));
+ doReturn(true).when(MOCK_aaiValidatorImpl).isPhysicalServerLocked("vnfId");
+ boolean isVnfPserversLockedFlag = aaiVnfResources.checkVnfPserversLockedFlag("vnfId");
+ verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.GenericVnf.class),
+ isA(AAIResourceUri.class));
+ verify(MOCK_aaiValidatorImpl, times(1)).isPhysicalServerLocked(isA(String.class));
+ assertTrue(isVnfPserversLockedFlag);
+ }
}
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
index 6a44ed649e..2bdcf30a4c 100644
--- 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
@@ -27,7 +27,6 @@ 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;
@@ -46,101 +45,105 @@ import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@RunWith(MockitoJUnitRunner.Silent.class)
-public class AAIVolumeGroupResourcesTest extends TestDataSetup{
- @InjectMocks
- private AAIVolumeGroupResources aaiVolumeGroupResources = new AAIVolumeGroupResources();
+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();
+ }
+
+
- private CloudRegion cloudRegion;
- private VolumeGroup volumeGroup;
+ @Test
+ public void updateOrchestrationStatusVolumeGroupTest() throws Exception {
+ volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
- @Mock
- protected AAIResourcesClient MOCK_aaiResourcesClient;
+ doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class),
+ isA(org.onap.aai.domain.yang.VolumeGroup.class));
- @Mock
- protected AAIObjectMapper MOCK_aaiObjectMapper;
+ aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
+ OrchestrationStatus.ACTIVE);
- @Mock
- protected InjectionHelper MOCK_injectionHelper;
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), ArgumentMatchers.isNull());
- @Before
- public void before() {
- cloudRegion = buildCloudRegion();
- volumeGroup = buildVolumeGroup();
- doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient();
- }
+ 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));
- @Test
- public void updateOrchestrationStatusVolumeGroupTest() throws Exception {
- volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+ aaiVolumeGroupResources.createVolumeGroup(volumeGroup, cloudRegion);
- doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VolumeGroup.class));
+ verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), ArgumentMatchers.isNull());
- aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE);
+ assertEquals(OrchestrationStatus.ASSIGNED, volumeGroup.getOrchestrationStatus());
+ }
- verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), ArgumentMatchers.isNull());
+ @Test
+ public void connectVolumeGroupToVnfTest() throws Exception {
- assertEquals(OrchestrationStatus.ACTIVE, volumeGroup.getOrchestrationStatus());
- }
+ volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
- @Test
- public void createVolumeGroupTest() throws Exception {
- volumeGroup.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
- doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VolumeGroup.class));
+ aaiVolumeGroupResources.connectVolumeGroupToTenant(volumeGroup, cloudRegion);
- aaiVolumeGroupResources.createVolumeGroup(volumeGroup, cloudRegion);
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
- verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), ArgumentMatchers.isNull());
+ @Test
+ public void connectVolumeGroupToTenantTest() throws Exception {
+ GenericVnf genericVnf = buildGenericVnf();
- assertEquals(OrchestrationStatus.ASSIGNED, volumeGroup.getOrchestrationStatus());
- }
+ volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
- @Test
- public void connectVolumeGroupToVnfTest() throws Exception {
-
- volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
-
- doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+ doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
- aaiVolumeGroupResources.connectVolumeGroupToTenant(volumeGroup, cloudRegion);
+ aaiVolumeGroupResources.connectVolumeGroupToVnf(genericVnf, volumeGroup, cloudRegion);
- verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
- }
-
- @Test
- public void connectVolumeGroupToTenantTest() throws Exception {
- GenericVnf genericVnf = buildGenericVnf();
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
- volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+ @Test
+ public void deleteVolumeGroupTest() {
+ doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class));
- doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+ aaiVolumeGroupResources.deleteVolumeGroup(volumeGroup, cloudRegion);
- aaiVolumeGroupResources.connectVolumeGroupToVnf(genericVnf, volumeGroup, cloudRegion);
+ verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class));
+ }
- verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
- }
+ @Test
+ public void updateHeatStackIdVolumeGroupTest() throws Exception {
+ volumeGroup.setHeatStackId("testVolumeHeatStackId");
- @Test
- public void deleteVolumeGroupTest() {
- doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class));
+ doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class),
+ isA(org.onap.aai.domain.yang.VolumeGroup.class));
- aaiVolumeGroupResources.deleteVolumeGroup(volumeGroup, cloudRegion);
+ aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
- verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class));
- }
-
- @Test
- public void updateHeatStackIdVolumeGroupTest() throws Exception {
- volumeGroup.setHeatStackId("testVolumeHeatStackId");
-
- doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VolumeGroup.class));
-
- aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), ArgumentMatchers.isNull());
- verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), ArgumentMatchers.isNull());
-
- assertEquals("testVolumeHeatStackId", volumeGroup.getHeatStackId());
- }
+ assertEquals("testVolumeHeatStackId", volumeGroup.getHeatStackId());
+ }
}
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
index c50b084df2..0cbdee396f 100644
--- 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
@@ -29,9 +29,7 @@ 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.mockito.InjectMocks;
@@ -42,76 +40,84 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-public class AAIVpnBindingResourcesTest extends BaseTaskTest{
-
- @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));
- }
+public class AAIVpnBindingResourcesTest extends BaseTaskTest {
+
+ @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);
- }
+ 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> 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));
- }
+ when(MOCK_aaiResourcesClient.get(eq(VpnBindings.class), isA(AAIResourceUri.class)))
+ .thenReturn(Optional.of(new VpnBindings()));
+ Optional<VpnBindings> 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/NamingServiceResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NamingServiceResourcesTest.java
index 629e98abb2..195c89a651 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NamingServiceResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NamingServiceResourcesTest.java
@@ -26,9 +26,7 @@ import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-
import java.util.List;
-
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -49,57 +47,58 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@RunWith(MockitoJUnitRunner.Silent.class)
-public class NamingServiceResourcesTest extends TestDataSetup{
- @InjectMocks
- private NamingServiceResources namingServiceResources = new NamingServiceResources();
-
- private InstanceGroup instanceGroup;
-
- @Mock
- protected NamingRequestObjectBuilder MOCK_namingRequestObjectBuilder;
-
- @Mock
- protected NamingClient MOCK_namingClient;
-
- @Before
- public void before() {
- instanceGroup = buildInstanceGroup();
- }
-
- @Test
- public void generateInstanceGroupNameTest() throws Exception {
- NameGenResponse name = new NameGenResponse();
- ResponseEntity<NameGenResponse> resp = new ResponseEntity<>(name, null, HttpStatus.OK);
- Element element = new Element();
-
- NameGenRequest req = new NameGenRequest();
- doReturn(element).when(MOCK_namingRequestObjectBuilder).elementMapper(isA(String.class), isA(String.class),
- isA(String.class), isA(String.class), isA(String.class));
- doReturn("generatedInstanceGroupName").when(MOCK_namingClient).postNameGenRequest(isA(NameGenRequest.class));
- doReturn(req).when(MOCK_namingRequestObjectBuilder).nameGenRequestMapper(isA(List.class));
-
- String generatedName = namingServiceResources.generateInstanceGroupName(instanceGroup, "policyInstanceName", "nfNamingCode");
-
- verify(MOCK_namingClient, times(1)).postNameGenRequest(any(NameGenRequest.class));
- assertEquals(generatedName, "generatedInstanceGroupName");
- }
-
- @Test
- public void deleteInstanceGroupNameTest() throws Exception {
- NameGenDeleteResponse name = new NameGenDeleteResponse();
- ResponseEntity<NameGenDeleteResponse> resp = new ResponseEntity<>(name, null, HttpStatus.OK);
- Deleteelement deleteElement = new Deleteelement();
- deleteElement.setExternalKey(instanceGroup.getId());
- NameGenDeleteRequest req = new NameGenDeleteRequest();
- doReturn(deleteElement).when(MOCK_namingRequestObjectBuilder).deleteElementMapper(isA(String.class));
- doReturn("").when(MOCK_namingClient).deleteNameGenRequest(isA(NameGenDeleteRequest.class));
- doReturn(req).when(MOCK_namingRequestObjectBuilder).nameGenDeleteRequestMapper(isA(List.class));
-
- namingServiceResources.deleteInstanceGroupName(instanceGroup);
-
- verify(MOCK_namingClient, times(1)).deleteNameGenRequest(any(NameGenDeleteRequest.class));
-
- }
-
-
+public class NamingServiceResourcesTest extends TestDataSetup {
+ @InjectMocks
+ private NamingServiceResources namingServiceResources = new NamingServiceResources();
+
+ private InstanceGroup instanceGroup;
+
+ @Mock
+ protected NamingRequestObjectBuilder MOCK_namingRequestObjectBuilder;
+
+ @Mock
+ protected NamingClient MOCK_namingClient;
+
+ @Before
+ public void before() {
+ instanceGroup = buildInstanceGroup();
+ }
+
+ @Test
+ public void generateInstanceGroupNameTest() throws Exception {
+ NameGenResponse name = new NameGenResponse();
+ ResponseEntity<NameGenResponse> resp = new ResponseEntity<>(name, null, HttpStatus.OK);
+ Element element = new Element();
+
+ NameGenRequest req = new NameGenRequest();
+ doReturn(element).when(MOCK_namingRequestObjectBuilder).elementMapper(isA(String.class), isA(String.class),
+ isA(String.class), isA(String.class), isA(String.class));
+ doReturn("generatedInstanceGroupName").when(MOCK_namingClient).postNameGenRequest(isA(NameGenRequest.class));
+ doReturn(req).when(MOCK_namingRequestObjectBuilder).nameGenRequestMapper(isA(List.class));
+
+ String generatedName =
+ namingServiceResources.generateInstanceGroupName(instanceGroup, "policyInstanceName", "nfNamingCode");
+
+ verify(MOCK_namingClient, times(1)).postNameGenRequest(any(NameGenRequest.class));
+ assertEquals(generatedName, "generatedInstanceGroupName");
+ }
+
+ @Test
+ public void deleteInstanceGroupNameTest() throws Exception {
+ NameGenDeleteResponse name = new NameGenDeleteResponse();
+ ResponseEntity<NameGenDeleteResponse> resp = new ResponseEntity<>(name, null, HttpStatus.OK);
+ Deleteelement deleteElement = new Deleteelement();
+ deleteElement.setExternalKey(instanceGroup.getId());
+ NameGenDeleteRequest req = new NameGenDeleteRequest();
+ doReturn(deleteElement).when(MOCK_namingRequestObjectBuilder).deleteElementMapper(isA(String.class));
+ doReturn("").when(MOCK_namingClient).deleteNameGenRequest(isA(NameGenDeleteRequest.class));
+ doReturn(req).when(MOCK_namingRequestObjectBuilder).nameGenDeleteRequestMapper(isA(List.class));
+
+ namingServiceResources.deleteInstanceGroupName(instanceGroup);
+
+ verify(MOCK_namingClient, times(1)).deleteNameGenRequest(any(NameGenDeleteRequest.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
index 1ff9d2af2d..96e2a74297 100644
--- 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
@@ -26,13 +26,11 @@ import static org.mockito.ArgumentMatchers.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;
@@ -61,159 +59,182 @@ 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.Silent.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<String, String> 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<Subnet> subnetList = new ArrayList<Subnet>();
- 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<UpdateNetworkResponse> 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<DeleteNetworkResponse> 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));
- }
+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<String, String> 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<Subnet> subnetList = new ArrayList<Subnet>();
+ 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<UpdateNetworkResponse> 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<DeleteNetworkResponse> 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
index 0023066949..9049fe1965 100644
--- 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
@@ -24,10 +24,8 @@ import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.verify;
-
import java.net.URI;
import java.net.URISyntaxException;
-
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -50,17 +48,17 @@ import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.mapper.GCTopologyOperationRequestMapper;
@RunWith(MockitoJUnitRunner.Silent.class)
-public class SDNCConfigurationResourcesTest extends TestDataSetup{
-
- @InjectMocks
+public class SDNCConfigurationResourcesTest extends TestDataSetup {
+
+ @InjectMocks
private SDNCConfigurationResources sdncConfigurationResources = new SDNCConfigurationResources();
-
- @Mock
- private GCTopologyOperationRequestMapper MOCK_gcTopologyMapper ;
-
- @Mock
- protected SDNCClient MOCK_sdncClient;
-
+
+ @Mock
+ private GCTopologyOperationRequestMapper MOCK_gcTopologyMapper;
+
+ @Mock
+ protected SDNCClient MOCK_sdncClient;
+
private RequestContext requestContext;
private ServiceInstance serviceInstance;
private VpnBondingLink vpnBondingLink;
@@ -68,45 +66,55 @@ public class SDNCConfigurationResourcesTest extends TestDataSetup{
private Customer customer;
@Before
- public void setUp(){
- customer = buildCustomer();
+ public void setUp() {
+ customer = buildCustomer();
requestContext = buildRequestContext();
serviceInstance = buildServiceInstance();
- vpnBondingLink = buildVpnBondingLink();
+ vpnBondingLink = buildVpnBondingLink();
vnf = vpnBondingLink.getInfrastructureServiceProxy().getServiceInstance().getVnfs().get(0);
}
@Test
public void activateVnrConfigurationTest() throws BadResponseException, MapperException, URISyntaxException {
- GenericResourceApiGcTopologyOperationInformation response = sdncConfigurationResources.activateVnrConfiguration(serviceInstance,requestContext,customer,vpnBondingLink.getVnrConfiguration(),vnf,"uuid",new URI("http://localhost"));
- verify(MOCK_gcTopologyMapper).assignOrActivateVnrReqMapper(
- eq(SDNCSvcAction.ACTIVATE), eq(GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE),
- eq(serviceInstance), eq(requestContext), eq(customer), any(Configuration.class), any(GenericVnf.class), any(String.class), any(URI.class));
+ GenericResourceApiGcTopologyOperationInformation response =
+ sdncConfigurationResources.activateVnrConfiguration(serviceInstance, requestContext, customer,
+ vpnBondingLink.getVnrConfiguration(), vnf, "uuid", new URI("http://localhost"));
+ verify(MOCK_gcTopologyMapper).assignOrActivateVnrReqMapper(eq(SDNCSvcAction.ACTIVATE),
+ eq(GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE), eq(serviceInstance),
+ eq(requestContext), eq(customer), any(Configuration.class), any(GenericVnf.class), any(String.class),
+ any(URI.class));
}
@Test
public void assignVnrConfigurationTest() throws BadResponseException, MapperException, URISyntaxException {
- GenericResourceApiGcTopologyOperationInformation response = sdncConfigurationResources.assignVnrConfiguration(serviceInstance,requestContext,customer,vpnBondingLink.getVnrConfiguration(),vnf,"uuid",new URI("http://localhost"));
- verify(MOCK_gcTopologyMapper).assignOrActivateVnrReqMapper(
- eq(SDNCSvcAction.ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE),
- eq(serviceInstance), eq(requestContext), eq(customer), any(Configuration.class), any(GenericVnf.class), any(String.class), any(URI.class));
+ GenericResourceApiGcTopologyOperationInformation response =
+ sdncConfigurationResources.assignVnrConfiguration(serviceInstance, requestContext, customer,
+ vpnBondingLink.getVnrConfiguration(), vnf, "uuid", new URI("http://localhost"));
+ verify(MOCK_gcTopologyMapper).assignOrActivateVnrReqMapper(eq(SDNCSvcAction.ASSIGN),
+ eq(GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE), eq(serviceInstance),
+ eq(requestContext), eq(customer), any(Configuration.class), any(GenericVnf.class), any(String.class),
+ any(URI.class));
}
@Test
- public void unAssignVnrConfigurationTest() throws BadResponseException, MapperException , URISyntaxException{
- GenericResourceApiGcTopologyOperationInformation response = sdncConfigurationResources.unAssignVnrConfiguration(serviceInstance,requestContext,vpnBondingLink.getVnrConfiguration(),"uuid",new URI("http://localhost"));
- verify(MOCK_gcTopologyMapper).deactivateOrUnassignVnrReqMapper(
- eq(SDNCSvcAction.UNASSIGN), eq(serviceInstance), eq(requestContext), any(Configuration.class), any(String.class), any(URI.class));
+ public void unAssignVnrConfigurationTest() throws BadResponseException, MapperException, URISyntaxException {
+ GenericResourceApiGcTopologyOperationInformation response =
+ sdncConfigurationResources.unAssignVnrConfiguration(serviceInstance, requestContext,
+ vpnBondingLink.getVnrConfiguration(), "uuid", new URI("http://localhost"));
+ verify(MOCK_gcTopologyMapper).deactivateOrUnassignVnrReqMapper(eq(SDNCSvcAction.UNASSIGN), eq(serviceInstance),
+ eq(requestContext), any(Configuration.class), any(String.class), any(URI.class));
}
@Test
- public void deactivateVnrConfigurationTest() throws BadResponseException, MapperException , URISyntaxException{
- GenericResourceApiGcTopologyOperationInformation response = sdncConfigurationResources.deactivateVnrConfiguration(serviceInstance,requestContext,vpnBondingLink.getVnrConfiguration(),"uuid",new URI("http://localhost"));
- verify(MOCK_gcTopologyMapper).deactivateOrUnassignVnrReqMapper(
- eq(SDNCSvcAction.DEACTIVATE), eq(serviceInstance), eq(requestContext), any(Configuration.class), any(String.class), any(URI.class));
+ public void deactivateVnrConfigurationTest() throws BadResponseException, MapperException, URISyntaxException {
+ GenericResourceApiGcTopologyOperationInformation response =
+ sdncConfigurationResources.deactivateVnrConfiguration(serviceInstance, requestContext,
+ vpnBondingLink.getVnrConfiguration(), "uuid", new URI("http://localhost"));
+ verify(MOCK_gcTopologyMapper).deactivateOrUnassignVnrReqMapper(eq(SDNCSvcAction.DEACTIVATE),
+ eq(serviceInstance), eq(requestContext), any(Configuration.class), any(String.class), any(URI.class));
}
}
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
index f275f3c484..327bae5749 100644
--- 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
@@ -23,7 +23,6 @@ package org.onap.so.client.orchestration;
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;
@@ -48,122 +47,122 @@ import org.onap.so.client.sdnc.mapper.NetworkTopologyOperationRequestMapper;
@RunWith(MockitoJUnitRunner.Silent.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 {
- doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper)
- .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
- GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance,
- customer, requestContext, cloudRegion);
- sdncNetworkResources.assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
- verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper(
- SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
- GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
- requestContext, cloudRegion);
- }
-
- @Test
- public void rollbackAssignNetworkTest() throws Exception {
- doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper)
- .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
- GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance,
- customer, requestContext, cloudRegion);
- sdncNetworkResources.rollbackAssignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
- verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper(
- SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
- GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
- requestContext, cloudRegion);
- }
-
- @Test
- public void activateNetworkTest() throws Exception {
- doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper)
- .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE,
- GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance,
- customer, requestContext, cloudRegion);
- sdncNetworkResources.activateNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
- verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper(
- SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE,
- GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
- requestContext, cloudRegion);
- }
-
- @Test
- public void deleteNetworkTest() throws Exception {
- doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper)
- .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
- GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance,
- customer, requestContext, cloudRegion);
- sdncNetworkResources.deleteNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
- verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper(
- SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
- GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
- requestContext, cloudRegion);
- }
-
- @Test
- public void test_deactivateNetwork() throws MapperException, BadResponseException {
- doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper)
- .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
- GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance,
- customer, requestContext, cloudRegion);
- 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);
- }
-
- @Test
- public void changeAssignNetworkTest() throws MapperException, BadResponseException {
- doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper)
- .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,
- GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance,
- customer, requestContext, cloudRegion);
- 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);
- }
-
- @Test
- public void unassignNetwork_Test() throws Exception {
- doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper)
- .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
- GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance,
- customer, requestContext, cloudRegion);
- sdncNetworkResources.unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
- verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper(
- SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
- GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
- requestContext, cloudRegion);
- }
-} \ No newline at end of file
+ @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 {
+ doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper)
+ .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance,
+ customer, requestContext, cloudRegion);
+ sdncNetworkResources.assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+ verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper(
+ SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ }
+
+ @Test
+ public void rollbackAssignNetworkTest() throws Exception {
+ doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper)
+ .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
+ GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance,
+ customer, requestContext, cloudRegion);
+ sdncNetworkResources.rollbackAssignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+ verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper(
+ SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
+ GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ }
+
+ @Test
+ public void activateNetworkTest() throws Exception {
+ doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper)
+ .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE,
+ GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance,
+ customer, requestContext, cloudRegion);
+ sdncNetworkResources.activateNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+ verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper(
+ SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE,
+ GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ }
+
+ @Test
+ public void deleteNetworkTest() throws Exception {
+ doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper)
+ .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
+ GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance,
+ customer, requestContext, cloudRegion);
+ sdncNetworkResources.deleteNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+ verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper(
+ SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
+ GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ }
+
+ @Test
+ public void test_deactivateNetwork() throws MapperException, BadResponseException {
+ doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper)
+ .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
+ GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance,
+ customer, requestContext, cloudRegion);
+ 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);
+ }
+
+ @Test
+ public void changeAssignNetworkTest() throws MapperException, BadResponseException {
+ doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper)
+ .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance,
+ customer, requestContext, cloudRegion);
+ 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);
+ }
+
+ @Test
+ public void unassignNetwork_Test() throws Exception {
+ doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper)
+ .reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
+ GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance,
+ customer, requestContext, cloudRegion);
+ sdncNetworkResources.unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+ verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper(
+ SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
+ GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ }
+}
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
index 509dc1de0d..ad05ac0072 100644
--- 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
@@ -26,7 +26,6 @@ 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;
@@ -46,84 +45,121 @@ import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
import org.onap.so.client.sdnc.mapper.ServiceTopologyOperationMapper;
@RunWith(MockitoJUnitRunner.Silent.class)
-public class SDNCServiceInstanceResourcesTest extends TestDataSetup{
-
- @InjectMocks
+public class SDNCServiceInstanceResourcesTest extends TestDataSetup {
+
+ @InjectMocks
private SDNCServiceInstanceResources sdncServiceInstanceResources;
- @Mock
- protected ServiceTopologyOperationMapper MOCK_serviceTopologyOperationMapper;
- private RequestContext requestContext;
- private ServiceInstance serviceInstance;
- private Customer customer;
-
- @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));
- sdncServiceInstanceResources.assignServiceInstance(serviceInstance, customer, requestContext);
- verify(MOCK_serviceTopologyOperationMapper, times(1)).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
- }
-
- @Test
- public void assignServiceInstanceExceptionTest() throws Exception {
- expectedException.expect(Exception.class);
- doThrow(Exception.class).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
- 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));
- sdncServiceInstanceResources.deleteServiceInstance(serviceInstance, customer, requestContext);
- verify(MOCK_serviceTopologyOperationMapper, times(1)).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
- }
-
- @Test
- public void deleteServiceInstanceExceptionTest() throws Exception {
- expectedException.expect(Exception.class);
- doThrow(Exception.class).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
- 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));
- sdncServiceInstanceResources.unassignServiceInstance(serviceInstance, customer, requestContext);
- verify(MOCK_serviceTopologyOperationMapper, times(1)).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
- }
-
- @Test
- public void unassignServiceInstanceExceptionTest() throws Exception {
- expectedException.expect(Exception.class);
- doThrow(Exception.class).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
- sdncServiceInstanceResources.unassignServiceInstance(serviceInstance,customer, requestContext);
- }
+ @Mock
+ protected ServiceTopologyOperationMapper MOCK_serviceTopologyOperationMapper;
+ private RequestContext requestContext;
+ private ServiceInstance serviceInstance;
+ private Customer customer;
+
+ @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));
+ sdncServiceInstanceResources.assignServiceInstance(serviceInstance, customer, requestContext);
+ verify(MOCK_serviceTopologyOperationMapper, times(1)).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION),
+ eq(SDNCSvcAction.ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE),
+ any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
+ }
+
+ @Test
+ public void assignServiceInstanceExceptionTest() throws Exception {
+ expectedException.expect(Exception.class);
+ doThrow(Exception.class).when(MOCK_serviceTopologyOperationMapper).reqMapper(
+ eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.ASSIGN),
+ eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class),
+ any(Customer.class), any(RequestContext.class));
+ 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));
+ sdncServiceInstanceResources.deleteServiceInstance(serviceInstance, customer, requestContext);
+ verify(MOCK_serviceTopologyOperationMapper, times(1)).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION),
+ eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE),
+ any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
+ }
+
+ @Test
+ public void deleteServiceInstanceExceptionTest() throws Exception {
+ expectedException.expect(Exception.class);
+ doThrow(Exception.class).when(MOCK_serviceTopologyOperationMapper).reqMapper(
+ eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE),
+ eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class),
+ any(Customer.class), any(RequestContext.class));
+ 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));
+ sdncServiceInstanceResources.unassignServiceInstance(serviceInstance, customer, requestContext);
+ verify(MOCK_serviceTopologyOperationMapper, times(1)).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION),
+ eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE),
+ any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
+ }
+
+ @Test
+ public void unassignServiceInstanceExceptionTest() throws Exception {
+ expectedException.expect(Exception.class);
+ doThrow(Exception.class).when(MOCK_serviceTopologyOperationMapper).reqMapper(
+ eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE),
+ eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class),
+ any(Customer.class), any(RequestContext.class));
+ 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.DELETESERVICEINSTANCE),
+ any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
+ sdncServiceInstanceResources.deactivateServiceInstance(serviceInstance, customer, requestContext);
+ verify(MOCK_serviceTopologyOperationMapper, times(1)).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION),
+ eq(SDNCSvcAction.DEACTIVATE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE),
+ any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
+ }
- @Test
- public void deactivateServiceInstanceSuccessTest() throws Exception {
- doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
- sdncServiceInstanceResources.deactivateServiceInstance(serviceInstance, customer, requestContext);
- verify(MOCK_serviceTopologyOperationMapper, times(1)).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
- }
-
- @Test
- public void deactivateServiceInstanceExceptionTest() throws Exception {
- expectedException.expect(Exception.class);
- doThrow(Exception.class).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
- sdncServiceInstanceResources.deactivateServiceInstance(serviceInstance, customer, requestContext);
- }
+ @Test
+ public void deactivateServiceInstanceExceptionTest() throws Exception {
+ expectedException.expect(Exception.class);
+ doThrow(Exception.class).when(MOCK_serviceTopologyOperationMapper).reqMapper(
+ eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE),
+ eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class),
+ any(Customer.class), any(RequestContext.class));
+ 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));
- sdncServiceInstanceResources.changeModelServiceInstance(serviceInstance, customer, requestContext);
- verify(MOCK_serviceTopologyOperationMapper, times(1)).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.CHANGE_ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
- }
+ @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));
+ sdncServiceInstanceResources.changeModelServiceInstance(serviceInstance, customer, requestContext);
+ verify(MOCK_serviceTopologyOperationMapper, times(1)).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION),
+ eq(SDNCSvcAction.CHANGE_ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE),
+ any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
+ }
}
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
index 7d05758129..2b45a3302c 100644
--- 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
@@ -23,7 +23,6 @@ package org.onap.so.client.orchestration;
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;
@@ -46,77 +45,87 @@ import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
import org.onap.so.client.sdnc.mapper.VfModuleTopologyOperationRequestMapper;;
@RunWith(MockitoJUnitRunner.Silent.class)
-public class SDNCVfModuleResourcesTest extends TestDataSetup{
+public class SDNCVfModuleResourcesTest extends TestDataSetup {
+
+ @InjectMocks
+ private SDNCVfModuleResources sdncVfModuleResources;
+
+ @Mock
+ protected VfModuleTopologyOperationRequestMapper vfModuleTopologyMapper;
+
+ private VfModule vfModule;
+ private GenericVnf vnf;
+ private ServiceInstance serviceInstance;
+ private VolumeGroup volumeGroup;
+ private Customer customer;
+ private CloudRegion cloudRegion;
+ private RequestContext requestContext;
+ private GenericResourceApiVfModuleOperationInformation sdncReq;
+
+ @Before
+ public void before() {
+ vfModule = buildVfModule();
+ vnf = buildGenericVnf();
+ serviceInstance = buildServiceInstance();
+ volumeGroup = buildVolumeGroup();
+ customer = buildCustomer();
+ cloudRegion = buildCloudRegion();
+ requestContext = buildRequestContext();
+ sdncReq = new GenericResourceApiVfModuleOperationInformation();
+ }
+
+ @Test
+ public void assignVfModuleTest() throws MapperException {
+ doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
+ SDNCSvcAction.ASSIGN, vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion,
+ requestContext, null);
+ sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion,
+ requestContext);
+ verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
+ SDNCSvcAction.ASSIGN, vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion,
+ requestContext, null);
+ }
+
+ @Test
+ public void unassignVfModuleTest() throws MapperException {
+ doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
+ SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, null, null);
+ sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance);
+ verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
+ SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, null, null);
+ }
+
+ @Test
+ public void activateVfModuleTest() throws MapperException {
+ doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
+ SDNCSvcAction.ACTIVATE, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext,
+ null);
+ sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext);
+ verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
+ SDNCSvcAction.ACTIVATE, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext,
+ null);
+ }
+
+ @Test
+ public void deactivateVfModuleTest() throws MapperException {
+ doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
+ SDNCSvcAction.DEACTIVATE, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext,
+ null);
+ sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext);
+ verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
+ SDNCSvcAction.DEACTIVATE, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext,
+ null);
+ }
- @InjectMocks
- private SDNCVfModuleResources sdncVfModuleResources;
-
- @Mock
- protected VfModuleTopologyOperationRequestMapper vfModuleTopologyMapper;
-
- private VfModule vfModule;
- private GenericVnf vnf;
- private ServiceInstance serviceInstance;
- private VolumeGroup volumeGroup;
- private Customer customer;
- private CloudRegion cloudRegion;
- private RequestContext requestContext;
- private GenericResourceApiVfModuleOperationInformation sdncReq;
-
- @Before
- public void before() {
- vfModule = buildVfModule();
- vnf = buildGenericVnf();
- serviceInstance = buildServiceInstance();
- volumeGroup = buildVolumeGroup();
- customer = buildCustomer();
- cloudRegion = buildCloudRegion();
- requestContext = buildRequestContext();
- sdncReq = new GenericResourceApiVfModuleOperationInformation();
- }
-
- @Test
- public void assignVfModuleTest() throws MapperException {
- doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule,
- volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
- sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext);
- verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule,
- volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
- }
-
- @Test
- public void unassignVfModuleTest() throws MapperException {
- doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null,
- vnf, serviceInstance, null, null, null, null);
- sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance);
- verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null,
- vnf, serviceInstance, null, null, null, null);
- }
-
- @Test
- public void activateVfModuleTest() throws MapperException {
- doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE, vfModule, null,
- vnf, serviceInstance, customer, cloudRegion, requestContext, null);
- sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext);
- verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE, vfModule, null,
- vnf, serviceInstance, customer, cloudRegion, requestContext, null);
- }
-
- @Test
- public void deactivateVfModuleTest() throws MapperException {
- doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, vfModule, null,
- vnf, serviceInstance, customer, cloudRegion, requestContext, null);
- sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext);
- verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, vfModule, null,
- vnf, serviceInstance, customer, cloudRegion, requestContext, null);
- }
-
- @Test
- public void changeAssignVfModuleTest() throws MapperException, BadResponseException {
- doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, vfModule,
- null, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
- sdncVfModuleResources.changeAssignVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext);
- verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, vfModule,
- null, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
- }
+ @Test
+ public void changeAssignVfModuleTest() throws MapperException, BadResponseException {
+ doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
+ SDNCSvcAction.CHANGE_ASSIGN, vfModule, null, vnf, serviceInstance, customer, cloudRegion,
+ requestContext, null);
+ sdncVfModuleResources.changeAssignVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion,
+ requestContext);
+ verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
+ SDNCSvcAction.CHANGE_ASSIGN, vfModule, null, vnf, serviceInstance, customer, cloudRegion,
+ requestContext, null);
+ }
}
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
index 9bbf790ecb..4c0e2b873f 100644
--- 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
@@ -28,7 +28,6 @@ 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;
@@ -51,103 +50,148 @@ import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
import org.onap.so.client.sdnc.mapper.VnfTopologyOperationRequestMapper;
@RunWith(MockitoJUnitRunner.Silent.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() {
- 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());
- sdncVnfResources.assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false);
- verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).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());
- }
-
- @Test
- public void activateVnfTest() {
- 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());
- sdncVnfResources.activateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).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());
- }
-
- @Test
- public void deleteVnfTest() {
- 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());
- sdncVnfResources.deleteVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).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());
- }
-
- @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() {
- 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());
- 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);
- }
-
- @Test
- public void deactivateVnfSuccessTest() {
- 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());
- sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).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());
-
- }
-
- @Test
- public void deactivateVnfExceptionTest() {
- expectedException.expect(Exception.class);
- doThrow(Exception.class).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());
- sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- }
-
- @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());
- sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).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());
- }
-
- @Test
- public void unassignVnfExceptionTest() throws Exception {
- expectedException.expect(Exception.class);
- doThrow(Exception.class).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());
- sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- }
+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() {
+ 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());
+ sdncVnfResources.assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false);
+ verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).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());
+ }
+
+ @Test
+ public void activateVnfTest() {
+ 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());
+ sdncVnfResources.activateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).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());
+ }
+
+ @Test
+ public void deleteVnfTest() {
+ 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());
+ sdncVnfResources.deleteVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).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());
+ }
+
+ @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() {
+ 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());
+ 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);
+ }
+
+ @Test
+ public void deactivateVnfSuccessTest() {
+ 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());
+ sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).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());
+
+ }
+
+ @Test
+ public void deactivateVnfExceptionTest() {
+ expectedException.expect(Exception.class);
+ doThrow(Exception.class).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());
+ sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ }
+
+ @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());
+ sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).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());
+ }
+
+ @Test
+ public void unassignVnfExceptionTest() throws Exception {
+ expectedException.expect(Exception.class);
+ doThrow(Exception.class).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());
+ sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ }
}
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
index 46d87c7ca3..265bb5d3b5 100644
--- 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
@@ -24,9 +24,7 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
import static org.mockito.ArgumentMatchers.any;
-
import java.util.UUID;
-
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -40,29 +38,29 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.sdno.SDNOValidator;
@RunWith(MockitoJUnitRunner.Silent.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(any(String.class), any(UUID.class), any(String.class));
- assertTrue(sdnoHealthCheckResources.healthCheck(genericVnf, requestContext));
- }
+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(any(String.class), any(UUID.class), any(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
index 2de4f11801..4cebd2cde5 100644
--- 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
@@ -26,7 +26,6 @@ import static org.mockito.ArgumentMatchers.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;
@@ -48,94 +47,102 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper;
@RunWith(MockitoJUnitRunner.Silent.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 VolumeGroup volumeGroup;
- 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, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
-
- CreateVfModuleRequest actualCreateVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance,
- genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
-
- verify(MOCK_vnfAdapterVfModuleObjectMapper, times(1)).createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance,
- genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
-
- assertNotNull(createVfModuleRequest);
- assertNotNull(actualCreateVfModuleRequest);
- assertEquals(createVfModuleRequest, actualCreateVfModuleRequest);
- }
-
- @Test
- public void test_createVfModuleWithVolumeGroup() throws Exception {
- volumeGroup = buildVolumeGroup();
- doReturn(createVfModuleRequest).when(MOCK_vnfAdapterVfModuleObjectMapper).createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance,
- genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
-
- CreateVfModuleRequest actualCreateVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance,
- genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
-
- verify(MOCK_vnfAdapterVfModuleObjectMapper, times(1)).createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance,
- genericVnf, vfModule, volumeGroup, 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);
- }
+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 VolumeGroup volumeGroup;
+ 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, null,
+ sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+ CreateVfModuleRequest actualCreateVfModuleRequest =
+ vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext,
+ serviceInstance, genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+ verify(MOCK_vnfAdapterVfModuleObjectMapper, times(1)).createVfModuleRequestMapper(requestContext, cloudRegion,
+ orchestrationContext, serviceInstance, genericVnf, vfModule, null, sdncVnfQueryResponse,
+ sdncVfModuleQueryResponse);
+
+ assertNotNull(createVfModuleRequest);
+ assertNotNull(actualCreateVfModuleRequest);
+ assertEquals(createVfModuleRequest, actualCreateVfModuleRequest);
+ }
+
+ @Test
+ public void test_createVfModuleWithVolumeGroup() throws Exception {
+ volumeGroup = buildVolumeGroup();
+ doReturn(createVfModuleRequest).when(MOCK_vnfAdapterVfModuleObjectMapper).createVfModuleRequestMapper(
+ requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup,
+ sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+ CreateVfModuleRequest actualCreateVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(
+ requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup,
+ sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+ verify(MOCK_vnfAdapterVfModuleObjectMapper, times(1)).createVfModuleRequestMapper(requestContext, cloudRegion,
+ orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup, 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
index b1812a3da9..b23c5bca87 100644
--- 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
@@ -24,7 +24,6 @@ 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;
@@ -46,74 +45,81 @@ 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.Silent.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);
-
- DeleteVolumeGroupRequest expectedDeleteVolumeGroupRequest = new DeleteVolumeGroupRequest();
- DeleteVolumeGroupRequest actualDeleteVolumeGroupRequest = vnfAdapterVolumeGroupResources.deleteVolumeGroupRequest(requestContext, cloudRegion, serviceInstance, volumeGroup);
-
- verify(MOCK_vnfAdapterObjectMapper, times(1)).deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup);
- assertThat(expectedDeleteVolumeGroupRequest, Matchers.sameBeanAs(actualDeleteVolumeGroupRequest));
- }
+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);
+
+ DeleteVolumeGroupRequest expectedDeleteVolumeGroupRequest = new DeleteVolumeGroupRequest();
+ DeleteVolumeGroupRequest actualDeleteVolumeGroupRequest = vnfAdapterVolumeGroupResources
+ .deleteVolumeGroupRequest(requestContext, cloudRegion, serviceInstance, volumeGroup);
+
+ verify(MOCK_vnfAdapterObjectMapper, times(1)).deleteVolumeGroupRequestMapper(requestContext, cloudRegion,
+ serviceInstance, volumeGroup);
+ assertThat(expectedDeleteVolumeGroupRequest, Matchers.sameBeanAs(actualDeleteVolumeGroupRequest));
+ }
}
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
index e3f6a1829e..2ff0d1d281 100644
--- 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
@@ -22,9 +22,7 @@ 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;
@@ -43,4 +41,4 @@ public class CommonObjectMapperProviderTest {
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
index 2636aec4a7..9c736b7634 100644
--- 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
@@ -21,9 +21,7 @@
package org.onap.so.client.sdn.common;
import static org.junit.Assert.assertEquals;
-
import java.util.LinkedHashMap;
-
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
@@ -33,9 +31,9 @@ import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SdnCommonTasks;
-public class SdnCommonTasksTest{
+public class SdnCommonTasksTest {
+
-
SdnCommonTasks sdnCommonTasks = new SdnCommonTasks();
@Rule
@@ -60,7 +58,7 @@ public class SdnCommonTasksTest{
@Test
public void validateSDNResponseTest() throws BadResponseException {
- String jsonResponse = "{\"output\":{\"response-code\":\"0\",\"response-message\":\"success\"}}";
+ String jsonResponse = "{\"output\":{\"response-code\":\"0\",\"response-message\":\"success\"}}";
LinkedHashMap<String, Object> responseMap = new LinkedHashMap<>();
LinkedHashMap<String, Object> output = new LinkedHashMap<>();
output.put("response-code", "0");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java
index 70f196db8c..0b338bde1d 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java
@@ -25,11 +25,9 @@ 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.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
-
import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
import org.onap.so.client.exception.BadResponseException;
@@ -38,43 +36,43 @@ import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.skyscreamer.jsonassert.JSONAssert;
public class SDNCClientIT extends BaseIntegrationTest {
- private final static String JSON_FILE_LOCATION = "src/test/resources/__files/";
-
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/";
+
@Test
public void getTest() throws BadResponseException, MapperException, IOException {
- String responseJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientGetResponse.json")));
- String queryLink = "/topologyQuery";
-
- wireMockServer.stubFor(get(urlEqualTo(queryLink))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json").withBody(responseJson)));
+ String responseJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientGetResponse.json")));
+ String queryLink = "/topologyQuery";
+
+ wireMockServer.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);
}
-
+
@Test(expected = BadResponseException.class)
public void post404Test() throws BadResponseException, MapperException, IOException {
- String responseJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientPut404Response.json")));
-
- String queryLink = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation/";
-
- wireMockServer.stubFor(post(urlMatching(queryLink))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json").withBody(responseJson)));
-
+ String responseJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientPut404Response.json")));
+
+ String queryLink = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation/";
+
+ wireMockServer.stubFor(post(urlMatching(queryLink)).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(responseJson)));
+
SPY_sdncClient.post("", SDNCTopology.NETWORK);
}
-
+
@Test
public void post200Test() throws BadResponseException, MapperException, IOException {
- String responseJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientPut200Response.json")));
-
- String queryLink = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation/";
-
- wireMockServer.stubFor(post(urlMatching(queryLink))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json").withBody(responseJson)));
-
+ String responseJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientPut200Response.json")));
+
+ String queryLink = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation/";
+
+ wireMockServer.stubFor(post(urlMatching(queryLink)).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(responseJson)));
+
String response = SPY_sdncClient.post("", SDNCTopology.NETWORK);
JSONAssert.assertEquals(responseJson, response, true);
}
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
index 302bb551c3..0eb0304cdf 100644
--- 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
@@ -25,7 +25,6 @@ import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -47,11 +46,11 @@ import org.onap.so.client.sdnc.beans.SDNCSvcAction;
@RunWith(MockitoJUnitRunner.Silent.class)
public class GCTopologyOperationRequestMapperTest extends TestDataSetup {
-
- @Spy
- private GeneralTopologyObjectMapper generalTopologyObjectMapper;
-
- @InjectMocks
+
+ @Spy
+ private GeneralTopologyObjectMapper generalTopologyObjectMapper;
+
+ @InjectMocks
private GCTopologyOperationRequestMapper genObjMapper = new GCTopologyOperationRequestMapper();
@Test
@@ -63,8 +62,9 @@ public class GCTopologyOperationRequestMapperTest extends TestDataSetup {
Configuration Configuration = new Configuration();
Configuration.setConfigurationId("ConfigurationId");
Configuration.setConfigurationType("VLAN-NETWORK-RECEPTOR");
- GenericResourceApiGcTopologyOperationInformation genericInfo = genObjMapper.deactivateOrUnassignVnrReqMapper
- (SDNCSvcAction.UNASSIGN, serviceInstance, requestContext, Configuration,"uuid",new URI("http://localhost"));
+ GenericResourceApiGcTopologyOperationInformation genericInfo =
+ genObjMapper.deactivateOrUnassignVnrReqMapper(SDNCSvcAction.UNASSIGN, serviceInstance, requestContext,
+ Configuration, "uuid", new URI("http://localhost"));
Assert.assertNotNull(genericInfo);
Assert.assertNotNull(genericInfo.getRequestInformation());
@@ -73,9 +73,9 @@ public class GCTopologyOperationRequestMapperTest extends TestDataSetup {
Assert.assertNotNull(genericInfo.getServiceInformation());
Assert.assertEquals("ConfigurationId", genericInfo.getConfigurationInformation().getConfigurationId());
Assert.assertEquals("VLAN-NETWORK-RECEPTOR", genericInfo.getConfigurationInformation().getConfigurationType());
- Assert.assertEquals("uuid",genericInfo.getSdncRequestHeader().getSvcRequestId());
- Assert.assertEquals("http://localhost",genericInfo.getSdncRequestHeader().getSvcNotificationUrl());
- Assert.assertEquals("MsoRequestId",genericInfo.getRequestInformation().getRequestId());
+ Assert.assertEquals("uuid", genericInfo.getSdncRequestHeader().getSvcRequestId());
+ Assert.assertEquals("http://localhost", genericInfo.getSdncRequestHeader().getSvcNotificationUrl());
+ Assert.assertEquals("MsoRequestId", genericInfo.getRequestInformation().getRequestId());
}
@@ -99,8 +99,8 @@ public class GCTopologyOperationRequestMapperTest extends TestDataSetup {
}
private Map<String, Object> getUserParams() {
- Map<String,Object> userParams = new HashMap<>();
- userParams.put("lppCustomerId","lppCustomerId");
+ Map<String, Object> userParams = new HashMap<>();
+ userParams.put("lppCustomerId", "lppCustomerId");
return userParams;
}
@@ -148,7 +148,7 @@ public class GCTopologyOperationRequestMapperTest extends TestDataSetup {
return ipv4subnet;
}
- private ServiceInstance buildServiceInstance(GenericVnf vnf) {
+ private ServiceInstance buildServiceInstance(GenericVnf vnf) {
ServiceInstance serviceInstance = new ServiceInstance();
serviceInstance.setServiceInstanceId("ServiceInstanceId");
List<GenericVnf> vnfs = serviceInstance.getVnfs();
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
index 630bccee9d..88a291e68b 100644
--- 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
@@ -27,10 +27,8 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
-
import java.util.HashMap;
import java.util.Map;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
@@ -66,365 +64,383 @@ import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
-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();
- Map<String, Object> 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());
- }
-
- @Test
- public void buildNetworkInformationTest() {
-
- L3Network network = new L3Network();
- ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
- modelInfoNetwork.setModelInvariantUUID("my-uuid");
- modelInfoNetwork.setModelName("my-model-name");
- modelInfoNetwork.setModelVersion("my-model-version");
- modelInfoNetwork.setModelUUID("my-model-uuid");
- modelInfoNetwork.setModelCustomizationUUID("my-customization-uuid");
- network.setModelInfoNetwork(modelInfoNetwork);
- network.setNetworkId("my-network-id");
- network.setNetworkType("my-network-type");
- network.setNetworkTechnology("my-network-technology");
-
- GenericResourceApiNetworkinformationNetworkInformation networkInformation = new GenericResourceApiNetworkinformationNetworkInformation();
- GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation();
- networkInformation.setNetworkId("my-network-id");
- networkInformation.setNetworkType("my-network-type");
- networkInformation.networkTechnology("my-network-technology");
- networkInformation.setFromPreload(null);
- onapModelInformation.setModelInvariantUuid("my-uuid");
- onapModelInformation.setModelName("my-model-name");
- onapModelInformation.setModelVersion("my-model-version");
- onapModelInformation.setModelUuid("my-model-uuid");
- onapModelInformation.setModelCustomizationUuid("my-customization-uuid");
- networkInformation.setOnapModelInformation(onapModelInformation);
-
- assertThat(networkInformation, sameBeanAs(genObjMapper.buildNetworkInformation(network)));
-
- }
-
- @Test
- public void buildNetworkInformationNoModelTest() {
-
- L3Network network = new L3Network();
- network.setNetworkId("my-network-id");
- network.setNetworkType("my-network-type");
- network.setNetworkTechnology("my-network-technology");
-
- GenericResourceApiNetworkinformationNetworkInformation networkInformation = new GenericResourceApiNetworkinformationNetworkInformation();
- networkInformation.setNetworkId("my-network-id");
- networkInformation.setNetworkType("my-network-type");
- networkInformation.networkTechnology("my-network-technology");
- networkInformation.setFromPreload(null);
-
-
- assertThat(networkInformation, sameBeanAs(genObjMapper.buildNetworkInformation(network)));
-
- }
-
-
- @Test
- public void buildVfModuleInformationTest_withNoModelIsFromPreload() {
- VfModule vfModule = new VfModule();
- vfModule.setVfModuleId("TestVfModuleId");
- ServiceInstance serviceInstance = new ServiceInstance();
- serviceInstance.setServiceInstanceId("serviceInstanceId");
- GenericVnf genericVnf = new GenericVnf();
- genericVnf.setVnfId("TestVnfId");
- RequestContext requestContext = new RequestContext();
- RequestParameters requestParameters = new RequestParameters();
- requestParameters.setUsePreload(true);
- requestContext.setRequestParameters(requestParameters);
- GenericResourceApiVfmoduleinformationVfModuleInformation gcRequestInput = null;
- try {
- gcRequestInput = genObjMapper.buildVfModuleInformation(vfModule, genericVnf, serviceInstance, requestContext, false);
- }
- catch (MapperException ex) {
-
- }
- assertNotNull(gcRequestInput);
- assertNull(vfModule.getModelInfoVfModule());
- assertNull(gcRequestInput.getOnapModelInformation());
- assertEquals(vfModule.getVfModuleId(),gcRequestInput.getVfModuleId());
- assertNotNull(gcRequestInput.getVfModuleId());
- assertTrue(gcRequestInput.getFromPreload());
- }
-
- @Test
- public void buildVfModuleInformationTest_withNoModelIsNotFromPreload() {
- VfModule vfModule = new VfModule();
- vfModule.setVfModuleId("TestVfModuleId");
- ServiceInstance serviceInstance = new ServiceInstance();
- serviceInstance.setServiceInstanceId("serviceInstanceId");
- GenericVnf genericVnf = new GenericVnf();
- genericVnf.setVnfId("TestVnfId");
- RequestContext requestContext = new RequestContext();
- RequestParameters requestParameters = new RequestParameters();
- requestParameters.setUsePreload(false);
- requestContext.setRequestParameters(requestParameters);
- GenericResourceApiVfmoduleinformationVfModuleInformation gcRequestInput = null;
- try {
- gcRequestInput = genObjMapper.buildVfModuleInformation(vfModule, genericVnf, serviceInstance, requestContext, false);
- }
- catch (MapperException ex) {
-
- }
- assertNotNull(gcRequestInput);
- assertNull(vfModule.getModelInfoVfModule());
- assertNull(gcRequestInput.getOnapModelInformation());
- assertEquals(vfModule.getVfModuleId(),gcRequestInput.getVfModuleId());
- assertNotNull(gcRequestInput.getVfModuleId());
- assertFalse(gcRequestInput.getFromPreload());
- }
-
- @Test
- public void buildVfModuleInformationTest_withNoModelNoRequestContext() {
- VfModule vfModule = new VfModule();
- vfModule.setVfModuleId("TestVfModuleId");
- ServiceInstance serviceInstance = new ServiceInstance();
- serviceInstance.setServiceInstanceId("serviceInstanceId");
- GenericVnf genericVnf = new GenericVnf();
- genericVnf.setVnfId("TestVnfId");
- GenericResourceApiVfmoduleinformationVfModuleInformation gcRequestInput = null;
- try {
- gcRequestInput = genObjMapper.buildVfModuleInformation(vfModule, genericVnf, serviceInstance, null, false);
- }
- catch (MapperException ex) {
-
- }
- assertNotNull(gcRequestInput);
- assertNull(vfModule.getModelInfoVfModule());
- assertNull(gcRequestInput.getOnapModelInformation());
- assertEquals(vfModule.getVfModuleId(),gcRequestInput.getVfModuleId());
- assertNotNull(gcRequestInput.getVfModuleId());
- assertTrue(gcRequestInput.getFromPreload());
- }
-
- @Test
- public void buildVfModuleInformationTest_withNoModelNoRequestParameters() {
- VfModule vfModule = new VfModule();
- vfModule.setVfModuleId("TestVfModuleId");
- ServiceInstance serviceInstance = new ServiceInstance();
- serviceInstance.setServiceInstanceId("serviceInstanceId");
- GenericVnf genericVnf = new GenericVnf();
- genericVnf.setVnfId("TestVnfId");
- RequestContext requestContext = new RequestContext();
- GenericResourceApiVfmoduleinformationVfModuleInformation gcRequestInput = null;
- try {
- gcRequestInput = genObjMapper.buildVfModuleInformation(vfModule, genericVnf, serviceInstance, requestContext, false);
- }
- catch (MapperException ex) {
-
- }
- assertNotNull(gcRequestInput);
- assertNull(vfModule.getModelInfoVfModule());
- assertNull(gcRequestInput.getOnapModelInformation());
- assertEquals(vfModule.getVfModuleId(),gcRequestInput.getVfModuleId());
- assertNotNull(gcRequestInput.getVfModuleId());
- assertTrue(gcRequestInput.getFromPreload());
- }
-
- @Test
- public void buildVfModuleInformationTest_withModel() {
- VfModule vfModule = new VfModule();
- vfModule.setVfModuleId("TestVfModuleId");
- ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
- modelInfoVfModule.setModelInvariantUUID("testModelInvariantUUID");
- modelInfoVfModule.setModelName("testModelName");
- modelInfoVfModule.setModelVersion("testModelVersion");
- modelInfoVfModule.setModelUUID("testModelUUID");
- modelInfoVfModule.setModelCustomizationUUID("testModelCustomizationUUID");
- vfModule.setModelInfoVfModule(modelInfoVfModule);
- ServiceInstance serviceInstance = new ServiceInstance();
- serviceInstance.setServiceInstanceId("serviceInstanceId");
- GenericVnf genericVnf = new GenericVnf();
- genericVnf.setVnfId("TestVnfId");
- RequestContext requestContext = new RequestContext();
- RequestParameters requestParameters = new RequestParameters();
- requestParameters.setUsePreload(true);
- requestContext.setRequestParameters(requestParameters);
- GenericResourceApiVfmoduleinformationVfModuleInformation gcRequestInput = null;
- try {
- gcRequestInput = genObjMapper.buildVfModuleInformation(vfModule, genericVnf, serviceInstance, requestContext, true);
- }
- catch (MapperException ex) {
-
- }
- assertNotNull(gcRequestInput);
- assertNotNull(vfModule.getModelInfoVfModule());
- assertNotNull(gcRequestInput.getOnapModelInformation());
- assertEquals(modelInfoVfModule.getModelInvariantUUID(), gcRequestInput.getOnapModelInformation().getModelInvariantUuid());
- assertEquals(modelInfoVfModule.getModelName(), gcRequestInput.getOnapModelInformation().getModelName());
- assertEquals(modelInfoVfModule.getModelVersion(), gcRequestInput.getOnapModelInformation().getModelVersion());
- assertEquals(modelInfoVfModule.getModelUUID(), gcRequestInput.getOnapModelInformation().getModelUuid());
- assertEquals(modelInfoVfModule.getModelCustomizationUUID(), gcRequestInput.getOnapModelInformation().getModelCustomizationUuid());
- assertEquals(vfModule.getVfModuleId(),gcRequestInput.getVfModuleId());
- assertNotNull(gcRequestInput.getVfModuleId());
- assertTrue(gcRequestInput.getFromPreload());
- }
+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();
+ Map<String, Object> 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());
+ }
+
+ @Test
+ public void buildNetworkInformationTest() {
+
+ L3Network network = new L3Network();
+ ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
+ modelInfoNetwork.setModelInvariantUUID("my-uuid");
+ modelInfoNetwork.setModelName("my-model-name");
+ modelInfoNetwork.setModelVersion("my-model-version");
+ modelInfoNetwork.setModelUUID("my-model-uuid");
+ modelInfoNetwork.setModelCustomizationUUID("my-customization-uuid");
+ network.setModelInfoNetwork(modelInfoNetwork);
+ network.setNetworkId("my-network-id");
+ network.setNetworkType("my-network-type");
+ network.setNetworkTechnology("my-network-technology");
+
+ GenericResourceApiNetworkinformationNetworkInformation networkInformation =
+ new GenericResourceApiNetworkinformationNetworkInformation();
+ GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation =
+ new GenericResourceApiOnapmodelinformationOnapModelInformation();
+ networkInformation.setNetworkId("my-network-id");
+ networkInformation.setNetworkType("my-network-type");
+ networkInformation.networkTechnology("my-network-technology");
+ networkInformation.setFromPreload(null);
+ onapModelInformation.setModelInvariantUuid("my-uuid");
+ onapModelInformation.setModelName("my-model-name");
+ onapModelInformation.setModelVersion("my-model-version");
+ onapModelInformation.setModelUuid("my-model-uuid");
+ onapModelInformation.setModelCustomizationUuid("my-customization-uuid");
+ networkInformation.setOnapModelInformation(onapModelInformation);
+
+ assertThat(networkInformation, sameBeanAs(genObjMapper.buildNetworkInformation(network)));
+
+ }
+
+ @Test
+ public void buildNetworkInformationNoModelTest() {
+
+ L3Network network = new L3Network();
+ network.setNetworkId("my-network-id");
+ network.setNetworkType("my-network-type");
+ network.setNetworkTechnology("my-network-technology");
+
+ GenericResourceApiNetworkinformationNetworkInformation networkInformation =
+ new GenericResourceApiNetworkinformationNetworkInformation();
+ networkInformation.setNetworkId("my-network-id");
+ networkInformation.setNetworkType("my-network-type");
+ networkInformation.networkTechnology("my-network-technology");
+ networkInformation.setFromPreload(null);
+
+
+ assertThat(networkInformation, sameBeanAs(genObjMapper.buildNetworkInformation(network)));
+
+ }
+
+
+ @Test
+ public void buildVfModuleInformationTest_withNoModelIsFromPreload() {
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("TestVfModuleId");
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId("TestVnfId");
+ RequestContext requestContext = new RequestContext();
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setUsePreload(true);
+ requestContext.setRequestParameters(requestParameters);
+ GenericResourceApiVfmoduleinformationVfModuleInformation gcRequestInput = null;
+ try {
+ gcRequestInput =
+ genObjMapper.buildVfModuleInformation(vfModule, genericVnf, serviceInstance, requestContext, false);
+ } catch (MapperException ex) {
+
+ }
+ assertNotNull(gcRequestInput);
+ assertNull(vfModule.getModelInfoVfModule());
+ assertNull(gcRequestInput.getOnapModelInformation());
+ assertEquals(vfModule.getVfModuleId(), gcRequestInput.getVfModuleId());
+ assertNotNull(gcRequestInput.getVfModuleId());
+ assertTrue(gcRequestInput.getFromPreload());
+ }
+
+ @Test
+ public void buildVfModuleInformationTest_withNoModelIsNotFromPreload() {
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("TestVfModuleId");
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId("TestVnfId");
+ RequestContext requestContext = new RequestContext();
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setUsePreload(false);
+ requestContext.setRequestParameters(requestParameters);
+ GenericResourceApiVfmoduleinformationVfModuleInformation gcRequestInput = null;
+ try {
+ gcRequestInput =
+ genObjMapper.buildVfModuleInformation(vfModule, genericVnf, serviceInstance, requestContext, false);
+ } catch (MapperException ex) {
+
+ }
+ assertNotNull(gcRequestInput);
+ assertNull(vfModule.getModelInfoVfModule());
+ assertNull(gcRequestInput.getOnapModelInformation());
+ assertEquals(vfModule.getVfModuleId(), gcRequestInput.getVfModuleId());
+ assertNotNull(gcRequestInput.getVfModuleId());
+ assertFalse(gcRequestInput.getFromPreload());
+ }
+
+ @Test
+ public void buildVfModuleInformationTest_withNoModelNoRequestContext() {
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("TestVfModuleId");
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId("TestVnfId");
+ GenericResourceApiVfmoduleinformationVfModuleInformation gcRequestInput = null;
+ try {
+ gcRequestInput = genObjMapper.buildVfModuleInformation(vfModule, genericVnf, serviceInstance, null, false);
+ } catch (MapperException ex) {
+
+ }
+ assertNotNull(gcRequestInput);
+ assertNull(vfModule.getModelInfoVfModule());
+ assertNull(gcRequestInput.getOnapModelInformation());
+ assertEquals(vfModule.getVfModuleId(), gcRequestInput.getVfModuleId());
+ assertNotNull(gcRequestInput.getVfModuleId());
+ assertTrue(gcRequestInput.getFromPreload());
+ }
+
+ @Test
+ public void buildVfModuleInformationTest_withNoModelNoRequestParameters() {
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("TestVfModuleId");
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId("TestVnfId");
+ RequestContext requestContext = new RequestContext();
+ GenericResourceApiVfmoduleinformationVfModuleInformation gcRequestInput = null;
+ try {
+ gcRequestInput =
+ genObjMapper.buildVfModuleInformation(vfModule, genericVnf, serviceInstance, requestContext, false);
+ } catch (MapperException ex) {
+
+ }
+ assertNotNull(gcRequestInput);
+ assertNull(vfModule.getModelInfoVfModule());
+ assertNull(gcRequestInput.getOnapModelInformation());
+ assertEquals(vfModule.getVfModuleId(), gcRequestInput.getVfModuleId());
+ assertNotNull(gcRequestInput.getVfModuleId());
+ assertTrue(gcRequestInput.getFromPreload());
+ }
+
+ @Test
+ public void buildVfModuleInformationTest_withModel() {
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("TestVfModuleId");
+ ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
+ modelInfoVfModule.setModelInvariantUUID("testModelInvariantUUID");
+ modelInfoVfModule.setModelName("testModelName");
+ modelInfoVfModule.setModelVersion("testModelVersion");
+ modelInfoVfModule.setModelUUID("testModelUUID");
+ modelInfoVfModule.setModelCustomizationUUID("testModelCustomizationUUID");
+ vfModule.setModelInfoVfModule(modelInfoVfModule);
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId("TestVnfId");
+ RequestContext requestContext = new RequestContext();
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setUsePreload(true);
+ requestContext.setRequestParameters(requestParameters);
+ GenericResourceApiVfmoduleinformationVfModuleInformation gcRequestInput = null;
+ try {
+ gcRequestInput =
+ genObjMapper.buildVfModuleInformation(vfModule, genericVnf, serviceInstance, requestContext, true);
+ } catch (MapperException ex) {
+
+ }
+ assertNotNull(gcRequestInput);
+ assertNotNull(vfModule.getModelInfoVfModule());
+ assertNotNull(gcRequestInput.getOnapModelInformation());
+ assertEquals(modelInfoVfModule.getModelInvariantUUID(),
+ gcRequestInput.getOnapModelInformation().getModelInvariantUuid());
+ assertEquals(modelInfoVfModule.getModelName(), gcRequestInput.getOnapModelInformation().getModelName());
+ assertEquals(modelInfoVfModule.getModelVersion(), gcRequestInput.getOnapModelInformation().getModelVersion());
+ assertEquals(modelInfoVfModule.getModelUUID(), gcRequestInput.getOnapModelInformation().getModelUuid());
+ assertEquals(modelInfoVfModule.getModelCustomizationUUID(),
+ gcRequestInput.getOnapModelInformation().getModelCustomizationUuid());
+ assertEquals(vfModule.getVfModuleId(), gcRequestInput.getVfModuleId());
+ assertNotNull(gcRequestInput.getVfModuleId());
+ assertTrue(gcRequestInput.getFromPreload());
+ }
}
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
index 1bfa78ad6d..76e915781f 100644
--- 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
@@ -25,13 +25,11 @@ 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 java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
-
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -52,174 +50,183 @@ 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 com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(MockitoJUnitRunner.class)
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;
-
- @Spy
- private GeneralTopologyObjectMapper generalTopologyObjectMapper;
-
- @InjectMocks
- private NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper();
-
- @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();
- Map<String, Object> userParams = new HashMap<>();
- userParams.put("key1", "value1");
- requestContext.setUserParams(userParams);
- requestContext.setProductFamilyId("productFamilyId");
- requestContext.setMsoRequestId("MsoRequestId");
-
- 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 {
-
- 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"));
- assertEquals("MsoRequestId", networkSDNCrequest.getRequestInformation().getRequestId());
- }
-
- @Test
- public void createGenericResourceApiNetworkOperationInformationReqContextNullTest() throws Exception {
-
- RequestContext rc = new RequestContext();
- rc.setMsoRequestId(null);
- GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper(
- SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
- rc, cloudRegion);
- assertNotNull(networkSDNCrequest.getRequestInformation().getRequestId());
- GenericResourceApiNetworkOperationInformation networkSDNCrequest2 = mapper.reqMapper(
- SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
- null, cloudRegion);
- assertNotNull(networkSDNCrequest2.getRequestInformation().getRequestId());
- }
-
- @Test
- public void reqMapperTest() throws Exception {
-
- 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 {
- 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 = mapper;
- 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"));
- assertEquals("MsoRequestId", networkSDNCrequestUnassign.getRequestInformation().getRequestId());
-
- }
-
- @Test
- public void createGenericResourceApiNetworkOperationInformationNoNetworkNameTest() throws Exception {
-
- //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)));
- }
+ 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;
+
+ @Spy
+ private GeneralTopologyObjectMapper generalTopologyObjectMapper;
+
+ @InjectMocks
+ private NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper();
+
+ @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();
+ Map<String, Object> userParams = new HashMap<>();
+ userParams.put("key1", "value1");
+ requestContext.setUserParams(userParams);
+ requestContext.setProductFamilyId("productFamilyId");
+ requestContext.setMsoRequestId("MsoRequestId");
+
+ 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 {
+
+ 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"));
+ assertEquals("MsoRequestId", networkSDNCrequest.getRequestInformation().getRequestId());
+ }
+
+ @Test
+ public void createGenericResourceApiNetworkOperationInformationReqContextNullTest() throws Exception {
+
+ RequestContext rc = new RequestContext();
+ rc.setMsoRequestId(null);
+ GenericResourceApiNetworkOperationInformation networkSDNCrequest =
+ mapper.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance,
+ customer, rc, cloudRegion);
+ assertNotNull(networkSDNCrequest.getRequestInformation().getRequestId());
+ GenericResourceApiNetworkOperationInformation networkSDNCrequest2 =
+ mapper.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance,
+ customer, null, cloudRegion);
+ assertNotNull(networkSDNCrequest2.getRequestInformation().getRequestId());
+ }
+
+ @Test
+ public void reqMapperTest() throws Exception {
+
+ 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 {
+ 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 = mapper;
+ 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"));
+ assertEquals("MsoRequestId", networkSDNCrequestUnassign.getRequestInformation().getRequestId());
+
+ }
+
+ @Test
+ public void createGenericResourceApiNetworkOperationInformationNoNetworkNameTest() throws Exception {
+
+ // 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
index 1919ef437b..f4006ab5d5 100644
--- 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
@@ -24,12 +24,10 @@ 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 java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
-
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
@@ -42,7 +40,6 @@ 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.northbound.client.model.GenericResourceApiOnapmodelinformationOnapModelInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
@@ -51,54 +48,56 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(MockitoJUnitRunner.class)
public class ServiceTopologyOperationMapperTest {
- @Spy
- private GeneralTopologyObjectMapper generalTopologyObjectMapper;
-
- @InjectMocks
- private ServiceTopologyOperationMapper mapper = new ServiceTopologyOperationMapper();
+ @Spy
+ private GeneralTopologyObjectMapper generalTopologyObjectMapper;
+
+ @InjectMocks
+ private ServiceTopologyOperationMapper mapper = new ServiceTopologyOperationMapper();
- @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);
+ @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");
+ // prepare Customer object
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("globalCustomerId");
- customer.setServiceSubscription(new ServiceSubscription());
- // set Customer on service instance
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ customer.setServiceSubscription(new ServiceSubscription());
+ // set Customer on service instance
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- //prepare RequestContext
- RequestContext requestContext = new RequestContext();
- Map<String, Object> userParams = new HashMap<>();
- userParams.put("key1", "value1");
- requestContext.setUserParams(userParams);
- requestContext.setProductFamilyId("productFamilyId");
- requestContext.setMsoRequestId("MsoRequestId");
+ // prepare RequestContext
+ RequestContext requestContext = new RequestContext();
+ Map<String, Object> userParams = new HashMap<>();
+ userParams.put("key1", "value1");
+ requestContext.setUserParams(userParams);
+ requestContext.setProductFamilyId("productFamilyId");
+ requestContext.setMsoRequestId("MsoRequestId");
- GenericResourceApiServiceOperationInformation serviceOpInformation = mapper.reqMapper(
- SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer,
- requestContext);
- GenericResourceApiServiceOperationInformation serviceOpInformationNullReqContext = mapper.reqMapper(
- SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer,
- null);
+ GenericResourceApiServiceOperationInformation serviceOpInformation =
+ mapper.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer,
+ requestContext);
+ GenericResourceApiServiceOperationInformation serviceOpInformationNullReqContext = mapper.reqMapper(
+ SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer, null);
- String jsonToCompare = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json")));
+ 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);
+ ObjectMapper omapper = new ObjectMapper();
+ GenericResourceApiOnapmodelinformationOnapModelInformation reqMapper1 =
+ omapper.readValue(jsonToCompare, GenericResourceApiOnapmodelinformationOnapModelInformation.class);
- assertThat(reqMapper1, sameBeanAs(serviceOpInformation.getServiceInformation().getOnapModelInformation()));
- assertEquals("MsoRequestId", serviceOpInformation.getRequestInformation().getRequestId());
- assertNotNull(serviceOpInformationNullReqContext.getRequestInformation().getRequestId());
- }
+ assertThat(reqMapper1, sameBeanAs(serviceOpInformation.getServiceInformation().getOnapModelInformation()));
+ assertEquals("MsoRequestId", serviceOpInformation.getRequestInformation().getRequestId());
+ assertNotNull(serviceOpInformationNullReqContext.getRequestInformation().getRequestId());
+ }
}
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
index 7fce8c48c8..275e9f7dbb 100644
--- 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
@@ -25,14 +25,12 @@ 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 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.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -55,283 +53,284 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
-
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(MockitoJUnitRunner.class)
public class VfModuleTopologyOperationRequestMapperTest {
- private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
- private final static String ERRORMESSAGE = "VF Module model info is null for testVfModuleId";
-
- @Spy
- private GeneralTopologyObjectMapper generalTopologyObjectMapper;
-
- @InjectMocks
- private VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper();
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- @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();
- Map<String,Object> userParams = new HashMap<>();
- userParams.put("key1", "value1");
- requestContext.setUserParams(userParams);
- requestContext.setProductFamilyId("productFamilyId");
- RequestParameters requestParameters = new RequestParameters();
- requestParameters.setUsePreload(true);
- requestContext.setRequestParameters(requestParameters);
- requestContext.setMsoRequestId("MsoRequestId");
-
- 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);
- HashMap<String, String> cloudParams = new HashMap<String, String>();
- cloudParams.put("key2", "value2");
- vfModule.setCloudParams(cloudParams);
-
- VolumeGroup volumeGroup = new VolumeGroup();
- volumeGroup.setVolumeGroupId("volumeGroupId");
- volumeGroup.setVolumeGroupName("volumeGroupName");
-
- CloudRegion cloudRegion = new CloudRegion();
-
- 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"));
- assertEquals("MsoRequestId", vfModuleSDNCrequest.getRequestInformation().getRequestId());
- }
-
- @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");
-
- RequestContext requestContext = new RequestContext();
- requestContext.setMsoRequestId("MsoRequestId");
-
- GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper(
- SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null,
- null, requestContext, 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"));
- assertEquals("MsoRequestId", vfModuleSDNCrequest.getRequestInformation().getRequestId());
- }
-
- @Test
- public void unassignGenericResourceApiVfModuleInformationNullMsoReqIdTest() 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");
-
- RequestContext requestContext = new RequestContext();
-
- GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper(
- SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null,
- null, requestContext, null);
-
- assertNotNull(vfModuleSDNCrequest.getRequestInformation().getRequestId());
- }
-
- @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();
- RequestParameters requestParameters = new RequestParameters();
- HashMap<String,Object> userParams1 = new HashMap<>();
- userParams1.put("key1", "value1");
- List<Map<String,Object>> userParams = new ArrayList<>();
- userParams.add(userParams1);
-
- requestParameters.setUserParams(userParams);
- requestContext.setRequestParameters(requestParameters);
- 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();
-
- 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());
- }
-
- @Test
- public void reqMapperNoModelInfoTest() 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();
- Map<String, Object> userParams = new HashMap<String, Object>();
- 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");
- vfModule.setModelInfoVfModule(null);
-
- CloudRegion cloudRegion = new CloudRegion();
-
- expectedException.expect(MapperException.class);
- expectedException.expectMessage(ERRORMESSAGE);
-
- mapper.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, null, vnf, serviceInstance, customer,
- cloudRegion, requestContext, null);
- }
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
+ private final static String ERRORMESSAGE = "VF Module model info is null for testVfModuleId";
+
+ @Spy
+ private GeneralTopologyObjectMapper generalTopologyObjectMapper;
+
+ @InjectMocks
+ private VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper();
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @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();
+ Map<String, Object> userParams = new HashMap<>();
+ userParams.put("key1", "value1");
+ requestContext.setUserParams(userParams);
+ requestContext.setProductFamilyId("productFamilyId");
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setUsePreload(true);
+ requestContext.setRequestParameters(requestParameters);
+ requestContext.setMsoRequestId("MsoRequestId");
+
+ 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);
+ HashMap<String, String> cloudParams = new HashMap<String, String>();
+ cloudParams.put("key2", "value2");
+ vfModule.setCloudParams(cloudParams);
+
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupId("volumeGroupId");
+ volumeGroup.setVolumeGroupName("volumeGroupName");
+
+ CloudRegion cloudRegion = new CloudRegion();
+
+ 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"));
+ assertEquals("MsoRequestId", vfModuleSDNCrequest.getRequestInformation().getRequestId());
+ }
+
+ @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");
+
+ RequestContext requestContext = new RequestContext();
+ requestContext.setMsoRequestId("MsoRequestId");
+
+ GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest =
+ mapper.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null,
+ vnf, serviceInstance, null, null, requestContext, 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"));
+ assertEquals("MsoRequestId", vfModuleSDNCrequest.getRequestInformation().getRequestId());
+ }
+
+ @Test
+ public void unassignGenericResourceApiVfModuleInformationNullMsoReqIdTest() 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");
+
+ RequestContext requestContext = new RequestContext();
+
+ GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest =
+ mapper.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null,
+ vnf, serviceInstance, null, null, requestContext, null);
+
+ assertNotNull(vfModuleSDNCrequest.getRequestInformation().getRequestId());
+ }
+
+ @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();
+ RequestParameters requestParameters = new RequestParameters();
+ HashMap<String, Object> userParams1 = new HashMap<>();
+ userParams1.put("key1", "value1");
+ List<Map<String, Object>> userParams = new ArrayList<>();
+ userParams.add(userParams1);
+
+ requestParameters.setUserParams(userParams);
+ requestContext.setRequestParameters(requestParameters);
+ 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();
+
+ 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());
+ }
+
+ @Test
+ public void reqMapperNoModelInfoTest() 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();
+ Map<String, Object> userParams = new HashMap<String, Object>();
+ 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");
+ vfModule.setModelInfoVfModule(null);
+
+ CloudRegion cloudRegion = new CloudRegion();
+
+ expectedException.expect(MapperException.class);
+ expectedException.expectMessage(ERRORMESSAGE);
+
+ mapper.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, null, vnf,
+ serviceInstance, customer, cloudRegion, requestContext, null);
+ }
}
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
index 64b532fd07..cecf34ea10 100644
--- 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
@@ -23,12 +23,10 @@ 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.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
-
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
@@ -47,101 +45,107 @@ 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.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
@RunWith(MockitoJUnitRunner.class)
public class VnfTopologyOperationRequestMapperTest {
- @Spy
- private GeneralTopologyObjectMapper generalTopologyObjectMapper;
-
- @InjectMocks
- private VnfTopologyOperationRequestMapper mapper = new VnfTopologyOperationRequestMapper();
-
- @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("L3-NETWORK");
-
- 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<String> entitlementPoolUuids = new ArrayList<>();
- entitlementPoolUuids.add("entitlementPoolUuid");
- List<String> 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();
- Map<String, Object> userParams = new HashMap<>();
- userParams.put("key1", "value1");
- requestContext.setUserParams(userParams);
- requestContext.setProductFamilyId("productFamilyId");
- requestContext.setMsoRequestId("MsoRequestId");
-
- CloudRegion cloudRegion = new CloudRegion();
-
- GenericResourceApiVnfOperationInformation vnfOpInformation = mapper.reqMapper(
- SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
- cloudRegion, requestContext,true);
- GenericResourceApiVnfOperationInformation vnfOpInformationNullReqContext = mapper.reqMapper(
- SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
- cloudRegion, null,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());
- assertEquals("MsoRequestId", vnfOpInformation.getRequestInformation().getRequestId());
- assertNotNull(vnfOpInformationNullReqContext.getRequestInformation().getRequestId());
- }
+ @Spy
+ private GeneralTopologyObjectMapper generalTopologyObjectMapper;
+
+ @InjectMocks
+ private VnfTopologyOperationRequestMapper mapper = new VnfTopologyOperationRequestMapper();
+
+ @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("L3-NETWORK");
+
+ 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<String> entitlementPoolUuids = new ArrayList<>();
+ entitlementPoolUuids.add("entitlementPoolUuid");
+ List<String> 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();
+ Map<String, Object> userParams = new HashMap<>();
+ userParams.put("key1", "value1");
+ requestContext.setUserParams(userParams);
+ requestContext.setProductFamilyId("productFamilyId");
+ requestContext.setMsoRequestId("MsoRequestId");
+
+ CloudRegion cloudRegion = new CloudRegion();
+
+ GenericResourceApiVnfOperationInformation vnfOpInformation =
+ mapper.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
+ cloudRegion, requestContext, true);
+ GenericResourceApiVnfOperationInformation vnfOpInformationNullReqContext =
+ mapper.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
+ cloudRegion, null, 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());
+ assertEquals("MsoRequestId", vnfOpInformation.getRequestInformation().getRequestId());
+ assertNotNull(vnfOpInformationNullReqContext.getRequestInformation().getRequestId());
+ }
}
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
index 722180f54b..56c52388f8 100644
--- 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
@@ -23,14 +23,12 @@ 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.BaseIntegrationTest;
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;
@@ -42,108 +40,96 @@ public class SniroClientTestIT extends BaseIntegrationTest {
@Test(expected = Test.None.class)
public void testPostDemands_success() throws BadResponseException, JsonProcessingException {
- String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"corys cool\", \"requestStatus\": \"accepted\"}";
+ String mockResponse =
+ "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"corys cool\", \"requestStatus\": \"accepted\"}";
- wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
+ wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
- client.postDemands(new SniroManagerRequest());
+ 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\"}";
+ String mockResponse =
+ "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": \"failed\"}";
- wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
+ wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
- client.postDemands(new SniroManagerRequest());
+ client.postDemands(new SniroManagerRequest());
- //TODO assertEquals("missing data", );
+ // 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\"}";
+ String mockResponse =
+ "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"\", \"requestStatus\": \"failed\"}";
- wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
+ wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
- client.postDemands(new SniroManagerRequest());
+ 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}";
+ String mockResponse =
+ "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": null}";
- wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
+ wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
- client.postDemands(new SniroManagerRequest());
+ client.postDemands(new SniroManagerRequest());
}
@Test(expected = BadResponseException.class)
public void testPostDemands_error_empty() throws JsonProcessingException, BadResponseException {
- String mockResponse = "{ }";
+ String mockResponse = "{ }";
- wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
+ wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
- client.postDemands(new SniroManagerRequest());
+ client.postDemands(new SniroManagerRequest());
}
@Test(expected = Test.None.class)
public void testPostRelease_success() throws BadResponseException, JsonProcessingException {
String mockResponse = "{\"status\": \"success\", \"message\": \"corys cool\"}";
- wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
+ wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
- client.postRelease(new SniroConductorRequest());
+ client.postRelease(new SniroConductorRequest());
}
@Test(expected = BadResponseException.class)
public void testPostRelease_error_failed() throws BadResponseException, JsonProcessingException {
String mockResponse = "{\"status\": \"failure\", \"message\": \"corys cool\"}";
- wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
+ wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
- client.postRelease(new SniroConductorRequest());
+ client.postRelease(new SniroConductorRequest());
}
@Test(expected = BadResponseException.class)
public void testPostRelease_error_noStatus() throws BadResponseException, JsonProcessingException {
String mockResponse = "{\"status\": \"\", \"message\": \"corys cool\"}";
- wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
+ wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
- client.postRelease(new SniroConductorRequest());
+ client.postRelease(new SniroConductorRequest());
}
@@ -151,12 +137,10 @@ public class SniroClientTestIT extends BaseIntegrationTest {
public void testPostRelease_error_noMessage() throws BadResponseException, JsonProcessingException {
String mockResponse = "{\"status\": \"failure\", \"message\": null}";
- wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
+ wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
- client.postRelease(new SniroConductorRequest());
+ client.postRelease(new SniroConductorRequest());
}
@@ -164,12 +148,10 @@ public class SniroClientTestIT extends BaseIntegrationTest {
public void testPostRelease_error_empty() throws BadResponseException, JsonProcessingException {
String mockResponse = "{ }";
- wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders"))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBody(mockResponse)));
+ wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
- client.postRelease(new SniroConductorRequest());
+ client.postRelease(new SniroConductorRequest());
}