summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy182
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy18
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy17
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy168
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy9
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy274
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy11
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy163
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy8
-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.java219
-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.java152
-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.java889
-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.java64
-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.java63
-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.java3465
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java866
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java777
-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.java203
-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.java296
-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.java182
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java89
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java105
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java105
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java43
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java43
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java111
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java81
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java43
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java43
-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.java6
-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/main/resources/subprocess/SDNCAdapterRestV1.bpmn3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV2.bpmn3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy7
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1Test.groovy3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy1
-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.java169
-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.java209
-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.java21
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java46
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java523
-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.java54
-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.java34
-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.java622
-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/MockResource.java207
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java55
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java156
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java148
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java141
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java2062
-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.java148
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseNetworkAdapter.java140
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseOof.java35
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponsePolicy.java147
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java172
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSNIRO.java47
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java269
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java167
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java153
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java149
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java158
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java151
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java152
-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.java380
-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.java1299
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java5265
-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.java93
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnfTest.java68
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnfTest.java66
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnfTest.java46
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnfTest.java49
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnfTest.java63
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnfTest.java48
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnfTest.java40
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnfTest.java41
-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/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfcInstanceGroupCustomization.json3
278 files changed, 21554 insertions, 21756 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
index c700fa70e1..4670b11b71 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -32,111 +34,15 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.client.aai.AAIResourcesClient
import org.springframework.web.util.UriUtils
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import groovy.json.JsonSlurper
public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcessor {
- public MsoUtils utils = new MsoUtils()
-
-
- /**
- * Logs a message at the ERROR level.
- * @param message the message
- */
- public void logError(String message) {
- log('ERROR', message, null, "true")
- }
-
- /**
- * Logs a message at the ERROR level.
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- */
- public void logError(String message, Throwable cause) {
- log('ERROR', message, cause, "true")
- }
-
- /**
- * Logs a message at the WARN level.
- * @param message the message
- */
- public void logWarn(String message) {
- log('WARN', message, null, "true")
- }
-
- /**
- * Logs a message at the WARN level.
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- */
- public void logWarn(String message, Throwable cause) {
- log('WARN', message, cause, "true")
- }
-
- /**
- * Logs a message at the DEBUG level.
- * @param message the message
- * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled
- */
- public void logDebug(String message, String isDebugLogEnabled) {
- log('DEBUG', message, null, isDebugLogEnabled)
- }
-
- /**
- * Logs a message at the DEBUG level.
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled
- */
- public void logDebug(String message, Throwable cause, String isDebugLogEnabled) {
- log('DEBUG', message, cause, isDebugLogEnabled)
- }
+ private static final Logger logger = LoggerFactory.getLogger( MsoUtils.class);
- /**
- * Logs a message at the specified level.
- * @param level the level (DEBUG, INFO, WARN, ERROR)
- * @param message the message
- * @param isLevelEnabled a flag indicating if the level is enabled
- * (used only at the DEBUG level)
- */
- public void log(String level, String message, String isLevelEnabled) {
- log(level, message, null, isLevelEnabled)
- }
-
- /**
- * Logs a message at the specified level.
- * @param level the level (DEBUG, INFO, WARN, ERROR)
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- * @param isLevelEnabled a flag indicating if the level is enabled
- * (used only at the DEBUG level)
- */
- public void log(String level, String message, Throwable cause, String isLevelEnabled) {
- if (cause == null) {
- utils.log(level, message, isLevelEnabled);
- } else {
- StringWriter stringWriter = new StringWriter();
- PrintWriter printWriter = new PrintWriter(stringWriter);
- printWriter.println(message);
- cause.printStackTrace(printWriter);
- utils.log(level, stringWriter.toString(), isLevelEnabled);
- printWriter.close();
- }
- }
-
- /**
- * Logs a WorkflowException at the ERROR level with the specified message.
- * @param execution the execution
- */
- public void logWorkflowException(DelegateExecution execution, String message) {
- def workflowException = execution.getVariable("WorkflowException")
-
- if (workflowException == null) {
- logError(message);
- } else {
- logError(message + ": " + workflowException)
- }
- }
+ public MsoUtils utils = new MsoUtils()
/**
* Saves the WorkflowException in the execution to the specified variable,
@@ -173,7 +79,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
', requredVariables=' + requiredVariables +
')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
+ logger.debug('Entered ' + method)
String processKey = getProcessKey(execution)
def prefix = execution.getVariable("prefix")
@@ -236,14 +142,13 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
serviceInstanceId = (String) execution.getVariable("mso-service-instance-id")
}
- utils.logContext(requestId, serviceInstanceId)
- logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled)
- logDebug('Exited ' + method, isDebugLogEnabled)
+ logger.debug('Incoming message: ' + System.lineSeparator() + request)
+ logger.debug('Exited ' + method)
return request
} catch (BpmnError e) {
throw e
} catch (Exception e) {
- logError('Caught exception in ' + method, e)
+ logger.error('Caught exception in {}: {}', method, e.getMessage(), e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
}
}
@@ -259,18 +164,11 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
'execution=' + execution.getId() +
')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
+ logger.debug('Entered ' + method)
String processKey = getProcessKey(execution);
def prefix = execution.getVariable("prefix")
- def requestId =getVariable(execution, "mso-request-id")
- def serviceInstanceId = getVariable(execution, "mso-service-instance-id")
- if(requestId!=null && serviceInstanceId!=null){
- utils.logContext(requestId, serviceInstanceId)
- }
-
-
def request = getVariable(execution, prefix + 'Request')
if (request == null) {
@@ -286,8 +184,8 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
def parsed = jsonSlurper.parseText(request)
- logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled)
- logDebug('Exited ' + method, isDebugLogEnabled)
+ logger.debug('Incoming message: ' + System.lineSeparator() + request)
+ logger.debug('Exited ' + method)
return parsed
}
@@ -317,10 +215,10 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
}
if (String.valueOf(execution.getVariable(processKey + "WorkflowResponseSent")).equals("true")) {
- logDebug("Sync response has already been sent for " + processKey, isDebugLogEnabled)
+ logger.debug("Sync response has already been sent for " + processKey)
}else{
- logDebug("Building " + processKey + " response ", isDebugLogEnabled)
+ logger.debug("Building " + processKey + " response ")
int intResponseCode;
@@ -345,11 +243,10 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
execution.setVariable(processKey + "Status", status);
execution.setVariable("WorkflowResponse", response)
- logDebug("Sending response for " + processKey
+ logger.debug("Sending response for " + processKey
+ " ResponseCode=" + intResponseCode
+ " Status=" + status
- + " Response=\n" + response,
- isDebugLogEnabled)
+ + " Response=\n" + response)
// TODO: ensure that this flow was invoked asynchronously?
@@ -370,7 +267,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
}
} catch (Exception ex) {
- logError("Unable to send workflow response to client ....", ex)
+ logger.error("Unable to send workflow response to client ....", ex)
}
}
@@ -440,7 +337,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
def element = utils.getNodeXml(xml, elementName, false)
if (element.trim().isEmpty()) {
def msg = 'Required element \'' + elementName + '\' is missing or empty'
- logError(msg)
+ logger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
} else {
return element
@@ -462,7 +359,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
def elementText = utils.getNodeText(xml, elementName)
if ((elementText == null) || (elementText.isEmpty())) {
def msg = 'Required element \'' + elementName + '\' is missing or empty'
- logError(msg)
+ logger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
} else {
return elementText
@@ -519,7 +416,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
*@param name
*@return
**/
- public String getVariable(DelegateExecution execution, String name) {
+ public static String getVariable(DelegateExecution execution, String name) {
def myObj = execution.getVariable(name)
if(myObj instanceof VariableMap){
VariableMap serializedObjectMap = (VariableMap) myObj
@@ -577,9 +474,9 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
String prefix = execution.getVariable('prefix')
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered SetSuccessIndicator Method', isDebugLogEnabled)
+ logger.debug('Entered SetSuccessIndicator Method')
execution.setVariable(prefix+'SuccessIndicator', isSuccess)
- logDebug('Outgoing SuccessIndicator is: ' + execution.getVariable(prefix+'SuccessIndicator') + '', isDebugLogEnabled)
+ logger.debug('Outgoing SuccessIndicator is: ' + execution.getVariable(prefix+'SuccessIndicator') + '')
}
/**
@@ -587,14 +484,14 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
*
*/
public void sendSyncError(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
String requestId = execution.getVariable("mso-request-id")
- logDebug('sendSyncError, requestId: ' + requestId, isDebugEnabled)
+ logger.debug('sendSyncError, requestId: ' + requestId)
WorkflowException workflowExceptionObj = execution.getVariable("WorkflowException")
if (workflowExceptionObj != null) {
String errorMessage = workflowExceptionObj.getErrorMessage()
def errorCode = workflowExceptionObj.getErrorCode()
- logDebug('sendSyncError, requestId: ' + requestId + ' | errorMessage: ' + errorMessage + ' | errorCode: ' + errorCode, isDebugEnabled)
+ logger.debug('sendSyncError, requestId: ' + requestId + ' | errorMessage: ' + errorMessage + ' | errorCode: ' + errorCode)
sendWorkflowResponse(execution, errorCode, errorMessage)
}
}
@@ -610,27 +507,26 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
DelegateExecution execution = (DelegateExecution) args[0]
def classAndMethod = getClass().getSimpleName() + '.' + methodName + '(execution=' + execution.getId() + ')'
- def isDebugEnabled = execution.getVariable('isDebugLogEnabled')
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + classAndMethod, isDebugEnabled)
- logDebug('Received parameters: ' + args, isDebugEnabled)
+ logger.debug('Entered ' + classAndMethod)
+ logger.debug('Received parameters: ' + args)
try{
def methodToCall = this.metaClass.getMetaMethod(methodName, args)
- logDebug('Method to call: ' + methodToCall, isDebugEnabled)
+ logger.debug('Method to call: ' + methodToCall)
methodToCall?.invoke(this, args)
}
catch(BpmnError bpmnError) {
- logDebug('Rethrowing BpmnError ' + bpmnError.getMessage(), isDebugEnabled)
+ logger.debug('Rethrowing BpmnError ' + bpmnError.getMessage())
throw bpmnError
}
catch(Exception e) {
- e.printStackTrace()
- logDebug('Unexpected error encountered - ' + e.getMessage(), isDebugEnabled)
+ logger.debug('Unexpected error encountered - {}', e.getMessage(), e)
(new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
}
finally {
- logDebug('Exited ' + classAndMethod, isDebugEnabled)
+ logger.debug('Exited ' + classAndMethod)
}
}
}
@@ -726,8 +622,8 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
def disableRollback = execution.getVariable("disableRollback")
def defaultRollback = UrnPropertiesReader.getVariable("mso.rollback", execution).toBoolean()
- logDebug('disableRollback: ' + disableRollback, isDebugLogEnabled)
- logDebug('defaultRollback: ' + defaultRollback, isDebugLogEnabled)
+ logger.debug('disableRollback: ' + disableRollback)
+ logger.debug('defaultRollback: ' + defaultRollback)
def rollbackEnabled
@@ -735,7 +631,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
// get from default urn settings for mso_rollback
disableRollback = !defaultRollback
rollbackEnabled = defaultRollback
- logDebug('disableRollback is null or empty!', isDebugLogEnabled)
+ logger.debug('disableRollback is null or empty!')
}
else {
if(disableRollback == true) {
@@ -748,9 +644,9 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
rollbackEnabled = defaultRollback
}
}
-
+
execution.setVariable(prefix+"backoutOnFailure", rollbackEnabled)
- logDebug('rollbackEnabled (aka backoutOnFailure): ' + rollbackEnabled, isDebugLogEnabled)
+ logger.debug('rollbackEnabled (aka backoutOnFailure): ' + rollbackEnabled)
}
public void setBasicDBAuthHeader(DelegateExecution execution, isDebugLogEnabled) {
@@ -760,7 +656,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
execution.setVariable("BasicAuthHeaderValueDB",encodedString)
} catch (IOException ex) {
String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage()
- utils.log("DEBUG", dataErrorMessage, isDebugLogEnabled)
+ logger.debug(dataErrorMessage)
(new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
index 0d9b3c5b94..d5b0b31a39 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
@@ -51,13 +51,13 @@ class CatalogDbUtils {
private static final Logger logger = LoggerFactory.getLogger( CatalogDbUtils.class);
private HttpClientFactory httpClientFactory
- private MsoUtils msoUtils
- private JsonUtils jsonUtils
+ private MsoUtils utils
+ private JsonUtils jsonUtils
static private String defaultDbAdapterVersion = "v2"
- CatalogDbUtils(HttpClientFactory httpClientFactory, MsoUtils msoUtils, JsonUtils jsonUtils) {
+ CatalogDbUtils(HttpClientFactory httpClientFactory, JsonUtils jsonUtils) {
this.httpClientFactory = httpClientFactory
- this.msoUtils = msoUtils
+ this.utils = new MsoUtils()
this.jsonUtils = jsonUtils
}
@@ -105,7 +105,7 @@ class CatalogDbUtils {
}
}
catch (Exception e) {
- msoUtils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ logger.error("Exception in Querying Catalog DB: " + e.message)
throw e
}
@@ -488,7 +488,7 @@ class CatalogDbUtils {
}
}
catch (Exception e) {
- msoUtils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ logger.error("Exception in Querying Catalog DB: " + e.message)
throw e
}
@@ -500,13 +500,13 @@ class CatalogDbUtils {
String encodedString = null
try {
String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution)
- msoUtils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB)
+ logger.debug("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB)
- encodedString = msoUtils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution))
+ encodedString = utils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution))
execution.setVariable("BasicAuthHeaderValueDB",encodedString)
} catch (IOException ex) {
String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage()
- msoUtils.log("ERROR", dataErrorMessage)
+ logger.error(dataErrorMessage)
}
return encodedString
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy
index faa0037169..bf7d07cbb3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 NOKIA.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -26,6 +28,6 @@ import org.onap.so.client.HttpClientFactory
public class CatalogDbUtilsFactory {
CatalogDbUtils create() {
- return new CatalogDbUtils(new HttpClientFactory(), new MsoUtils(), new JsonUtils())
+ return new CatalogDbUtils(new HttpClientFactory(), new JsonUtils())
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
index c1f9f5b0b3..e9e7d1ed7c 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
@@ -63,8 +63,8 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("CAAIVfMod_moduleExists",false)
execution.setVariable("CAAIVfMod_baseModuleConflict", false)
execution.setVariable("CAAIVfMod_vnfNameFromAAI", null)
-
-
+
+
// CreateAAIVfModule workflow response variable placeholders
execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode",null)
execution.setVariable("CAAIVfMod_queryGenericVnfResponse","")
@@ -80,14 +80,14 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("CreateAAIVfModuleResponse","")
execution.setVariable("RollbackData", null)
- }
-
+ }
+
// parse the incoming CREATE_VF_MODULE request and store the Generic VNF
// and VF Module data in the flow DelegateExecution
public void preProcessRequest(DelegateExecution execution) {
initProcessVariables(execution)
- def vnfId = execution.getVariable("vnfId")
+ def vnfId = execution.getVariable("vnfId")
if (vnfId == null || vnfId.isEmpty()) {
execution.setVariable("CAAIVfMod_newGenericVnf", true)
execution.setVariable("CAAIVfMod_vnfId","")
@@ -96,14 +96,14 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("CAAIVfMod_vnfId",vnfId)
}
- def vnfName = execution.getVariable("vnfName")
+ def vnfName = execution.getVariable("vnfName")
execution.setVariable("CAAIVfMod_vnfName", vnfName)
String vnfType = execution.getVariable("vnfType")
execution.setVariable("CAAIVfMod_vnfType", StringUtils.defaultString(vnfType))
execution.setVariable("CAAIVfMod_serviceId", execution.getVariable("serviceId"))
-
+
String personaModelId = execution.getVariable("personaModelId")
execution.setVariable("CAAIVfMod_personaId",StringUtils.defaultString(personaModelId))
@@ -219,8 +219,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("CAAIVfMod_createGenericVnfResponseCode", 201)
execution.setVariable("CAAIVfMod_createGenericVnfResponse", "Vnf Created")
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI PUT: {}", ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in createGenericVnf.")
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
index dc4871119e..7e46784af2 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
@@ -121,8 +121,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
execution.setVariable('CAAIVfModVG_getVfModuleResponse', "VF-Module Not found!!")
}
}catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', 500)
execution.setVariable('CAAIVfModVG_getVfModuleResponse', 'AAI GET Failed:' + ex.getMessage())
}
@@ -174,8 +173,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
logger.debug("CreateAAIVfModule Response code: " + 200)
logger.debug("CreateAAIVfModule Response: " + "Success")
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI PUT:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI PUT: {}', ex.getMessage(), ex)
execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', 500)
execution.setVariable('CAAIVfModVG_updateVfModuleResponse', 'AAI PUT Failed:' + ex.getMessage())
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
index 83f31450b8..4bce23eff7 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
@@ -76,7 +76,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
// send a GET request to AA&I to retrieve the Generic Vnf/Vf Module information based on a Vnf Id
// expect a 200 response with the information in the response body or a 404 if the Generic Vnf does not exist
public void queryAAIForGenericVnf(DelegateExecution execution) {
-
+
def vnfId = execution.getVariable("DAAIVfMod_vnfId")
try {
@@ -112,8 +112,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode", 200)
execution.setVariable("DAAIVfMod_deleteGenericVnfResponse", "Vnf Deleted")
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug("Exception occurred while executing AAI DELETE:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI DELETE: {}", ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteGenericVnf")
}
}
@@ -131,8 +130,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode", 200)
execution.setVariable("DAAIVfMod_deleteVfModuleResponse", "Vf Module Deleted")
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI PUT: {}", ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteVfModule")
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
index 740d9f70b6..f008130c32 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
@@ -151,8 +151,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
}
}
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
logger.trace('Exited ' + method)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
index 324cc63649..f371ccef4d 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
@@ -28,7 +28,6 @@ import java.text.SimpleDateFormat
import org.apache.commons.codec.binary.Base64
import org.apache.commons.lang3.StringEscapeUtils
-import org.onap.so.bpmn.core.BPMNLogger
import org.onap.so.bpmn.core.xml.XmlTool
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
@@ -89,7 +88,7 @@ class MsoUtils {
}
return nodes
}
-
+
def getNodeXml(xmlInput,element){
return getNodeXml(xmlInput, element, true)
}
@@ -106,7 +105,7 @@ class MsoUtils {
return unescapeNodeContents(nodeToSerialize, nodeAsText)
}
-
+
def unescapeNodeContents(NodeChild node, String text) {
if (!node.childNodes().hasNext()) {
return StringEscapeUtils.unescapeXml(text)
@@ -125,9 +124,9 @@ class MsoUtils {
}
}
-
+
/***** Utilities when using XmlParser *****/
-
+
/**
* Convert a Node into a String by deserializing it and formatting it.
*
@@ -139,12 +138,12 @@ class MsoUtils {
nodeAsString = removeXmlPreamble(nodeAsString)
return formatXml(nodeAsString)
}
-
+
/**
* Get the specified child Node of the specified parent. If there are
* multiple children of the same name, only the first one is returned.
* If there are no children with the specified name, 'null' is returned.
- *
+ *
* @param parent Parent Node in which to find a child.
* @param childNodeName Name of the child Node to get.
* @return the (first) child Node with the specified name or 'null'
@@ -158,11 +157,11 @@ class MsoUtils {
return nodeList.get(0)
}
}
-
+
/**
* Get the textual value of the specified child Node of the specified parent.
* If there are no children with the specified name, 'null' is returned.
- *
+ *
* @param parent Parent Node in which to find a child.
* @param childNodeName Name of the child Node whose value to get.
* @return the textual value of child Node with the specified name or 'null'
@@ -176,11 +175,11 @@ class MsoUtils {
return childNode.text()
}
}
-
+
/**
* Get all of the child nodes from the specified parent that have the
* specified name. The returned NodeList could be empty.
- *
+ *
* @param parent Parent Node in which to find children.
* @param childNodeName Name of the children to get.
* @return a NodeList of all the children from the parent with the specified
@@ -192,14 +191,14 @@ class MsoUtils {
/***** End of Utilities when using XmlParser *****/
-
+
/** these are covered under the common function above**/
def getSubscriberName(xmlInput,element){
def rtn=null
if(xmlInput!=null){
def xml= new XmlSlurper().parseText(xmlInput)
rtn= xml.'**'.find{node->node.name()==element}.text()
- }
+ }
return rtn
}
def getTenantInformation(xmlInput,element){
@@ -227,7 +226,7 @@ class MsoUtils {
}
return ret
}
-
+
def searchMetaDataNode(fxml, searchName, searchValue){
def ret = fxml.'**'.find {it.metaname.text() == searchName && it.metaval.text() == searchValue}
if(ret != null){
@@ -235,7 +234,7 @@ class MsoUtils {
}
return ret
}
-
+
// for Trinity L3 add/delete bonding
def getPBGFList(isDebugLogEnabled, xmlInput){
log("DEBUG", "getPBGFList: xmlInput " + xmlInput,isDebugLogEnabled)
@@ -271,20 +270,18 @@ class MsoUtils {
}
myNodes.add(XmlUtil.serialize(nodeToAdd))
}
-
}
}
-
return myNodes
}else{
return null
}
}
-
+
def getPBGFList(xmlInput){
getPBGFList("false", xmlInput)
}
-
+
def getMetaVal(node, name){
try{
return node.'**'.find {it.metaname.text() == name}.metaval.text()
@@ -293,37 +290,20 @@ class MsoUtils {
}
}
- def log(logmode,logtxt,isDebugLogEnabled="false"){
+ def private log(logmode,logtxt,isDebugLogEnabled="false"){
if ("INFO"==logmode) {
- logger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN");
+ logger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN");
} else if ("WARN"==logmode) {
logger.warn ("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), logtxt, "BPMN",
ErrorCode.UnknownError.getValue(), logtxt);
} else if ("ERROR"==logmode) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN",
ErrorCode.UnknownError.getValue(), logtxt);
-
} else {
- BPMNLogger.debug(isDebugLogEnabled, logtxt);
+ logger.debug(logtxt);
}
}
- def logContext(requestId, serviceInstanceId){
-// msoLogger.setLogContext(requestId, serviceInstanceId);
- }
-
- def logMetrics(elapsedTime, logtxt){
-
-// msoLogger.recordMetricEvent (elapsedTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
-// logtxt, "BPMN", MsoLogger.getServiceName(), null);
- }
-
- def logAudit(logtxt){
- long startTime = System.currentTimeMillis();
-
-// msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logtxt);
- }
-
// headers: header - name-value
def getHeaderNameValue(xmlInput, nameAttribute){
def rtn=null
@@ -333,7 +313,7 @@ class MsoUtils {
}
return rtn
}
-
+
/**
* Gets the children of the specified element.
*/
@@ -352,10 +332,10 @@ class MsoUtils {
}
return out.toString();
}
-
+
/**
* Encodes a value so it can be used inside an XML text element.
- *
+ *
* <b>Will double encode</b>
* @param s the string to encode
* @return the encoded string
@@ -363,7 +343,7 @@ class MsoUtils {
public static String xmlEscape(Object value) {
return XmlTool.encode(value)
}
-
+
/**
* Removes the preamble, if present, from an XML document.
* Also, for historical reasons, this also trims leading and trailing
@@ -411,29 +391,29 @@ class MsoUtils {
public String formatXml(def xml) {
return XmlTool.normalize(xml);
}
-
+
// build single elements
def buildElements(xmlInput, elementList, parentName) {
String var = ""
def xmlBuild = ""
if (parentName != "") {
xmlBuild += "<tns2:"+parentName+">"
- }
+ }
if (xmlInput != null) {
for (element in elementList) {
def xml= new XmlSlurper().parseText(xmlInput)
var = xml.'**'.find {it.name() == element}
if (var != null) {
xmlBuild += "<tns2:"+element+">"+var.toString()+"</tns2:"+element+">"
- }
+ }
}
}
if (parentName != "") {
xmlBuild += "</tns2:"+parentName+">"
- }
+ }
return xmlBuild
}
-
+
// build the Unbounded elements
def buildElementsUnbounded(xmlInput, elementList, parentName) {
def varParents = ""
@@ -461,7 +441,7 @@ class MsoUtils {
}
return xmlBuildUnbounded
}
-
+
// Build l2-homing-information
def buildL2HomingInformation(xmlInput) {
def elementsL2HomingList = ["evc-name", "topology", "preferred-aic-clli","aic-version"]
@@ -471,7 +451,7 @@ class MsoUtils {
}
return rebuildL2Home
}
-
+
// Build internet-evc-access-information
def buildInternetEvcAccessInformation(xmlInput) {
def elementsInternetEvcAccessInformationList = ["internet-evc-speed-value", "internet-evc-speed-units", "ip-version"]
@@ -481,7 +461,7 @@ class MsoUtils {
}
return rebuildInternetEvcAccess
}
-
+
// Build ucpe-vms-service-information
def buildUcpeVmsServiceInformation(xmlInput) {
def rebuildUcpeVmsServiceInformation = ''
@@ -513,7 +493,7 @@ class MsoUtils {
log("DEBUG", " rebuildUcpeVmsServiceInformation - " + rebuildUcpeVmsServiceInformation)
return rebuildUcpeVmsServiceInformation
}
-
+
// Build internet-service-change-details
def buildInternetServiceChangeDetails(xmlInput) {
def rebuildInternetServiceChangeDetails = ""
@@ -543,33 +523,33 @@ class MsoUtils {
}
}
return rebuildInternetServiceChangeDetails
- }
-
- // Build vr-lan
+ }
+
+ // Build vr-lan
def buildVrLan(xmlInput) {
-
+
def rebuildVrLan = ''
if (xmlInput != null) {
-
+
rebuildVrLan = "<tns2:vr-lan>"
def vrLan = getNodeXml(xmlInput, "vr-lan").drop(38).trim()
rebuildVrLan += buildElements(vrLan, ["routing-protocol"], "")
-
+
// vr-lan-interface
def rebuildVrLanInterface = "<tns2:vr-lan-interface>"
def vrLanInterface = getNodeXml(vrLan, "vr-lan-interface").drop(38).trim()
rebuildVrLanInterface += buildVrLanInterfacePartial(vrLanInterface)
-
+
// dhcp
def dhcp = getNodeXml(vrLan, "dhcp").drop(38).trim()
def rebuildDhcp = buildDhcp(dhcp)
rebuildVrLanInterface += rebuildDhcp
-
+
// pat
def pat = getNodeXml(vrLan, "pat").drop(38).trim()
def rebuildPat = buildPat(pat)
rebuildVrLanInterface += rebuildPat
-
+
// nat
def rebuildNat = ""
try { // optional
@@ -579,31 +559,31 @@ class MsoUtils {
log("ERROR", " Optional - Exception 'nat' ")
}
rebuildVrLanInterface += rebuildNat
-
+
// firewall-lite
def firewallLite = getNodeXml(vrLan, "firewall-lite").drop(38).trim()
def rebuildFirewallLite = buildFirewallLite(firewallLite)
rebuildVrLanInterface += rebuildFirewallLite
-
+
// static-routes
def rebuildStaticRoutes = ""
- try { // optional
+ try { // optional
def staticRoutes = getNodeXml(vrLan, "static-routes").drop(38).trim()
rebuildStaticRoutes = buildStaticRoutes(staticRoutes)
} catch (Exception e) {
log("ERROR", " Optional - Exception 'static-routes' ")
}
rebuildVrLanInterface += rebuildStaticRoutes
-
+
rebuildVrLan += rebuildVrLanInterface
rebuildVrLan += "</tns2:vr-lan-interface>"
rebuildVrLan += "</tns2:vr-lan>"
-
+
}
log("DEBUG", " rebuildVrLan - " + rebuildVrLan)
- return rebuildVrLan
+ return rebuildVrLan
}
-
+
// Build vr-lan-interface
def buildVrLanInterfacePartial(xmlInput) {
def rebuildingVrLanInterface = ''
@@ -632,7 +612,7 @@ class MsoUtils {
log("DEBUG", " rebuildingVrLanInterface - " + rebuildingVrLanInterface)
return rebuildingVrLanInterface
}
-
+
// Build dhcp
def buildDhcp(xmlInput) {
def rebuildingDhcp = ''
@@ -702,10 +682,10 @@ class MsoUtils {
log("ERROR", " Optional - Exception DHCP 'v6-dhcp-pools' ")
}
rebuildingDhcp += "</tns2:dhcp>"
- }
+ }
log("DEBUG", " rebuildingDhcp - " + rebuildingDhcp)
return rebuildingDhcp
- }
+ }
// Build pat
def buildPat(xmlInput) {
@@ -726,7 +706,7 @@ class MsoUtils {
log("DEBUG", " rebuildingPat - " + rebuildingPat)
return rebuildingPat
}
-
+
// Build nat
def buildNat(xmlInput) {
def rebuildingNat = ''
@@ -744,19 +724,19 @@ class MsoUtils {
}
log("DEBUG", " rebuildingNat - " + rebuildingNat)
return rebuildingNat
- }
-
+ }
+
// Build firewall-lite
def buildFirewallLite(xmlInput) {
def rebuildingFirewallLite = ''
-
+
if (xmlInput != null) {
-
+
def firewallLiteData = new XmlSlurper().parseText(xmlInput)
rebuildingFirewallLite = "<tns2:firewall-lite>"
def firewallLiteList = ["stateful-firewall-lite-v4-enabled", "stateful-firewall-lite-v6-enabled"]
rebuildingFirewallLite += buildElements(xmlInput, firewallLiteList, "")
-
+
try { // optional
def v4FirewallPacketFilters = firewallLiteData.'**'.findAll {it.name() == "v4-firewall-packet-filters"}
def v4FirewallPacketFiltersSize = v4FirewallPacketFilters.size()
@@ -784,7 +764,7 @@ class MsoUtils {
} catch (Exception e) {
log("ERROR", " Optional - Exception FIREWALL-LITE 'v4-firewall-packet-filters' ")
}
-
+
try { // optional
def v6FirewallPacketFilters = firewallLiteData.'**'.findAll {it.name() == "v6-firewall-packet-filters"}
def v6FirewallPacketFiltersSize = v6FirewallPacketFilters.size()
@@ -817,7 +797,7 @@ class MsoUtils {
log("DEBUG", " rebuildingFirewallLite - " + rebuildingFirewallLite)
return rebuildingFirewallLite
}
-
+
def buildStaticRoutes(xmlInput) {
def rebuildingStaticRoutes = ''
if (xmlInput != null) {
@@ -831,21 +811,21 @@ class MsoUtils {
log("DEBUG", " rebuildingStaticRoutes - " + rebuildingStaticRoutes)
return rebuildingStaticRoutes
}
-
+
public String generateCurrentTimeInUtc(){
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
final String utcTime = sdf.format(new Date());
return utcTime;
}
-
+
public String generateCurrentTimeInGMT(){
final SimpleDateFormat sdf = new SimpleDateFormat("E, d MMM yyyy h:m:s z");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
final String utcTime = sdf.format(new Date());
return utcTime;
}
-
+
/**
* @param encryptedAuth: encrypted credentials from urn properties
@@ -866,7 +846,7 @@ class MsoUtils {
throw ex
}
}
-
+
def encrypt(toEncrypt, msokey){
try {
String result = CryptoUtils.encrypt(toEncrypt, msokey);
@@ -876,7 +856,7 @@ class MsoUtils {
log("ERROR", "Failed to encrypt credentials")
}
}
-
+
def decrypt(toDecrypt, msokey){
try {
String result = CryptoUtils.decrypt(toDecrypt, msokey);
@@ -887,7 +867,7 @@ class MsoUtils {
throw e
}
}
-
+
/**
* Return URL with qualified host name (if any) or urn mapping
* @param String url from urn mapping
@@ -903,12 +883,12 @@ class MsoUtils {
callbackUrlToUse = callbackUrlToUse.replaceAll("(http://)(.*)(:28080*)", {orig, first, torepl, last -> "${first}${qualifiedHostName}${last}"})
}
}catch(Exception e){
- log("DEBUG", "unable to grab qualified host name, using what's in urn properties for callbackurl. Exception was: " + e.printStackTrace())
+ logger.debug("Unable to grab qualified host name, using what's in urn properties for callbackurl. Exception was: {}", e.getMessage(), e)
}
return callbackUrlToUse
-
+
}
-
+
/**
* Retrieves text context of the element if the element exists, returns empty string otherwise
* @param com.sun.org.apache.xerces.internal.dom.DeferredElementNSImpl element to parse
@@ -923,7 +903,7 @@ class MsoUtils {
}
return text
}
-
+
/**
*
* Find the lowest unused module-index value in a given xml
@@ -931,14 +911,14 @@ class MsoUtils {
public String getLowestUnusedIndex(String xml) {
if (xml == null || xml.isEmpty()) {
return "0"
- }
- def moduleIndexList = getMultNodes(xml, "module-index")
- if (moduleIndexList == null || moduleIndexList.size() == 0) {
+ }
+ def moduleIndexList = getMultNodes(xml, "module-index")
+ if (moduleIndexList == null || moduleIndexList.size() == 0) {
return "0"
}
-
+
def sortedModuleIndexList = moduleIndexList.sort{ a, b -> a as Integer <=> b as Integer}
-
+
for (i in 0..sortedModuleIndexList.size()-1) {
if (Integer.parseInt(sortedModuleIndexList[i]) != i) {
return i.toString()
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
index cac7a35282..d17a3c42a6 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
@@ -167,7 +167,7 @@ class OofHoming extends AbstractServiceTaskProcessor {
Response httpResponse = httpClient.post(oofRequest)
int responseCode = httpResponse.getStatus()
- logDebug("OOF sync response code is: " + responseCode)
+ logger.debug("OOF sync response code is: " + responseCode)
logger.debug( "*** Completed Homing Call OOF ***")
@@ -195,7 +195,6 @@ class OofHoming extends AbstractServiceTaskProcessor {
try {
String response = execution.getVariable("asyncCallbackResponse")
logger.debug( "OOF Async Callback Response is: " + response)
- utils.logAudit("OOF Async Callback Response is: " + response)
oofUtils.validateCallbackResponse(execution, response)
String placements = jsonUtil.getJsonValue(response, "solutions.placementSolutions")
@@ -378,7 +377,6 @@ class OofHoming extends AbstractServiceTaskProcessor {
}
execution.setVariable("DHVCS_requestId", requestId)
logger.debug( "***** STARTED Homing Subflow for request: " + requestId + " *****")
- utils.logAudit("***** STARTED Homing Subflow for request: " + requestId + " *****")
}
/**
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
index b68e979b3c..2f46630715 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
@@ -518,9 +518,9 @@ class OofUtils {
Response response = client.post(request.getBody().toString())
int responseCode = response.getStatus()
- logDebug("CatalogDB response code is: " + responseCode)
+ logger.debug("CatalogDB response code is: " + responseCode)
String syncResponse = response.readEntity(String.class)
- logDebug("CatalogDB response is: " + syncResponse)
+ logger.debug("CatalogDB response is: " + syncResponse)
if(responseCode != 202){
exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from CatalogDB.")
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy
index d909a77cc2..a7bb707dff 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy
@@ -166,7 +166,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
logger.debug(UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint", execution))
}catch(Exception e){
- logger.debug('Internal Error occured during PreProcess Method: ', e)
+ logger.debug('Internal Error occured during PreProcess Method: {}', e.getMessage(), e)
exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error occured during PreProcess Method') // TODO: what message and error code?
}
logger.trace("End pre Process SDNCRequestScript ")
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
index 8b04803050..fdd53b2f05 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
@@ -165,7 +165,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter",
- "BPMN", ErrorCode.UnknownError.getValue());
+ "BPMN", ErrorCode.UnknownError.getValue(), ex);
}
}
@@ -274,9 +274,6 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String prefix = execution.getVariable('prefix')
String callback = execution.getVariable('SDNCAResponse_MESSAGE')
- String requestId = execution.getVariable("mso-request-id");
- String serviceInstanceId = execution.getVariable("mso-service-instance-id")
- utils.logContext(requestId, serviceInstanceId)
logger.debug("Incoming SDNC Rest Callback is: " + callback)
try {
@@ -402,4 +399,8 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
+
+ public Logger getLogger() {
+ return logger;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy
index c1d68c5f7c..e56091ad65 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy
@@ -161,7 +161,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter",
- "BPMN", ErrorCode.UnknownError.getValue());
+ "BPMN", ErrorCode.UnknownError.getValue(), ex);
}
}
@@ -294,4 +294,8 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
exceptionUtil.buildWorkflowException(execution, 5300, msg)
}
}
+
+ public Logger getLogger() {
+ return logger;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy
index e6d54b8681..eb832224db 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy
@@ -47,22 +47,19 @@ class SDNCAdapterUtils {
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
+ MsoUtils msoUtils = new MsoUtils()
- private AbstractServiceTaskProcessor taskProcessor
-
- public SDNCAdapterUtils(AbstractServiceTaskProcessor taskProcessor) {
- this.taskProcessor = taskProcessor
+ public SDNCAdapterUtils() {
}
String SDNCAdapterFeatureRequest(DelegateExecution execution, String requestName, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) {
- def utils=new MsoUtils()
def prefix = execution.getVariable('prefix')
- def request = taskProcessor.getVariable(execution, requestName)
- def requestInformation = utils.getNodeXml(request, 'request-information', false)
- def serviceInformation = utils.getNodeXml(request, 'service-information', false)
- def featureInformation = utils.getNodeXml(request, 'feature-information', false)
- def featureParameters = utils.getNodeXml(request, 'feature-parameters', false)
+ def request = AbstractServiceTaskProcessor.getVariable(execution, requestName)
+ def requestInformation = msoUtils.getNodeXml(request, 'request-information', false)
+ def serviceInformation = msoUtils.getNodeXml(request, 'service-information', false)
+ def featureInformation = msoUtils.getNodeXml(request, 'feature-information', false)
+ def featureParameters = msoUtils.getNodeXml(request, 'feature-parameters', false)
def requestId = execution.getVariable('testReqId') // for junits
if(requestId==null){
@@ -71,10 +68,10 @@ class SDNCAdapterUtils {
def svcInstanceId = execution.getVariable("mso-service-instance-id")
- def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation)
- def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation)
- def nnsFeatureInformation = utils.removeXmlNamespaces(featureInformation)
- def nnsFeatureParameters = utils.removeXmlNamespaces(featureParameters)
+ def nnsRequestInformation = msoUtils.removeXmlNamespaces(requestInformation)
+ def nnsServiceInformation = msoUtils.removeXmlNamespaces(serviceInformation)
+ def nnsFeatureInformation = msoUtils.removeXmlNamespaces(featureInformation)
+ def nnsFeatureParameters = msoUtils.removeXmlNamespaces(featureParameters)
String sdncAdapterFeatureRequest = """
<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
@@ -95,18 +92,17 @@ class SDNCAdapterUtils {
<sdncadapterworkflow:SDNCTimeOutValueInMinutes>${MsoUtils.xmlEscape(timeoutValueInMinutes)}</sdncadapterworkflow:SDNCTimeOutValueInMinutes>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>
"""
- sdncAdapterFeatureRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterFeatureRequest))
+ sdncAdapterFeatureRequest = msoUtils.removeXmlPreamble(msoUtils.formatXml(sdncAdapterFeatureRequest))
return sdncAdapterFeatureRequest
}
String SDNCAdapterActivateVnfRequest(DelegateExecution execution, String action, String callbackURL, String serviceOperation, String msoAction, String timeoutValueInMinutes) {
- def utils=new MsoUtils()
def prefix = execution.getVariable('prefix')
- def request = taskProcessor.getVariable(execution, prefix+'Request')
- def requestInformation = utils.getNodeXml(request, 'request-information', false)
- def serviceInformation = utils.getNodeXml(request, 'service-information', false)
- def vnfInformationList = utils.getNodeXml(request, 'vnf-information-list', false)
+ def request = AbstractServiceTaskProcessor.getVariable(execution, prefix+'Request')
+ def requestInformation = msoUtils.getNodeXml(request, 'request-information', false)
+ def serviceInformation = msoUtils.getNodeXml(request, 'service-information', false)
+ def vnfInformationList = msoUtils.getNodeXml(request, 'vnf-information-list', false)
def requestId = execution.getVariable('testReqId') // for junits
if(requestId==null){
@@ -115,9 +111,9 @@ class SDNCAdapterUtils {
def svcInstanceId = execution.getVariable("mso-service-instance-id")
- def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation)
- def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation)
- def nnsVnfInformationList = utils.removeXmlNamespaces(vnfInformationList)
+ def nnsRequestInformation = msoUtils.removeXmlNamespaces(requestInformation)
+ def nnsServiceInformation = msoUtils.removeXmlNamespaces(serviceInformation)
+ def nnsVnfInformationList = msoUtils.removeXmlNamespaces(vnfInformationList)
String sdncAdapterActivateVnfRequest = """
<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
@@ -138,15 +134,14 @@ class SDNCAdapterUtils {
<sdncadapterworkflow:SDNCTimeOutValueInMinutes>${MsoUtils.xmlEscape(timeoutValueInMinutes)}</sdncadapterworkflow:SDNCTimeOutValueInMinutes>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>
"""
- sdncAdapterActivateVnfRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterActivateVnfRequest))
+ sdncAdapterActivateVnfRequest = msoUtils.removeXmlPreamble(msoUtils.formatXml(sdncAdapterActivateVnfRequest))
return sdncAdapterActivateVnfRequest
}
String SDNCAdapterL3ToHigherLayerRequest(DelegateExecution execution, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) {
- def utils=new MsoUtils()
def prefix = execution.getVariable('prefix')
- def request = taskProcessor.getVariable(execution, prefix+'Request')
+ def request = AbstractServiceTaskProcessor.getVariable(execution, prefix+'Request')
String requestInformation = """<request-information>
<request-id>${MsoUtils.xmlEscape(execution.getVariable("mso-request-id"))}</request-id>
@@ -164,8 +159,8 @@ class SDNCAdapterUtils {
}else if("delete".equalsIgnoreCase(action)){
xml.'request-action'.replaceBody('deleteTrinityBonding')
}
- requestInformation = utils.removeXmlPreamble(groovy.xml.XmlUtil.serialize(xml))
- def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation)
+ requestInformation = msoUtils.removeXmlPreamble(groovy.xml.XmlUtil.serialize(xml))
+ def nnsRequestInformation = msoUtils.removeXmlNamespaces(requestInformation)
def requestId = execution.getVariable('testReqId') // for junits
if(requestId==null){
@@ -234,7 +229,7 @@ class SDNCAdapterUtils {
<sdncadapterworkflow:SDNCTimeOutValueInMinutes>${MsoUtils.xmlEscape(timeoutValueInMinutes)}</sdncadapterworkflow:SDNCTimeOutValueInMinutes>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>
"""
- sdncAdapterL3ToHLRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterL3ToHLRequest))
+ sdncAdapterL3ToHLRequest = msoUtils.removeXmlPreamble(msoUtils.formatXml(sdncAdapterL3ToHLRequest))
return sdncAdapterL3ToHLRequest
}
@@ -243,13 +238,12 @@ class SDNCAdapterUtils {
private void SDNCAdapterActivateRequest(DelegateExecution execution, String resultVar, String svcAction,
String svcOperation, String additionalData) {
- def utils=new MsoUtils()
def prefix = execution.getVariable('prefix')
- def request = taskProcessor.getVariable(execution, prefix+'Request')
- def requestInformation = utils.getNodeXml(request, 'request-information', false)
- def serviceInformation = utils.getNodeXml(request, 'service-information', false)
- def serviceParameters = utils.getNodeXml(request, 'service-parameters', false)
+ def request = AbstractServiceTaskProcessor.getVariable(execution, prefix+'Request')
+ def requestInformation = msoUtils.getNodeXml(request, 'request-information', false)
+ def serviceInformation = msoUtils.getNodeXml(request, 'service-information', false)
+ def serviceParameters = msoUtils.getNodeXml(request, 'service-parameters', false)
def requestId = execution.getVariable('testReqId') // for junits
if(requestId==null){
@@ -269,18 +263,18 @@ class SDNCAdapterUtils {
workflowException(execution, 'Internal Error', 9999) // TODO: what message and error code?
}
- def l2HomingInformation = utils.getNodeXml(serviceParameters, 'l2-homing-information', false)
- def internetEvcAccessInformation = utils.getNodeXml(serviceParameters, 'internet-evc-access-information', false)
- def vrLan = utils.getNodeXml(serviceParameters, 'vr-lan', false)
- def upceVmsServiceInformation = utils.getNodeXml(serviceParameters, 'ucpe-vms-service-information', false)
+ def l2HomingInformation = msoUtils.getNodeXml(serviceParameters, 'l2-homing-information', false)
+ def internetEvcAccessInformation = msoUtils.getNodeXml(serviceParameters, 'internet-evc-access-information', false)
+ def vrLan = msoUtils.getNodeXml(serviceParameters, 'vr-lan', false)
+ def upceVmsServiceInformation = msoUtils.getNodeXml(serviceParameters, 'ucpe-vms-service-information', false)
- def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation)
- def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation)
- def nnsl2HomingInformation = utils.removeXmlNamespaces(l2HomingInformation)
- def nnsInternetEvcAccessInformation = utils.removeXmlNamespaces(internetEvcAccessInformation)
- def nnsVrLan = utils.removeXmlNamespaces(vrLan)
- def nnsUpceVmsServiceInformation = utils.removeXmlNamespaces(upceVmsServiceInformation)
+ def nnsRequestInformation = msoUtils.removeXmlNamespaces(requestInformation)
+ def nnsServiceInformation = msoUtils.removeXmlNamespaces(serviceInformation)
+ def nnsl2HomingInformation = msoUtils.removeXmlNamespaces(l2HomingInformation)
+ def nnsInternetEvcAccessInformation = msoUtils.removeXmlNamespaces(internetEvcAccessInformation)
+ def nnsVrLan = msoUtils.removeXmlNamespaces(vrLan)
+ def nnsUpceVmsServiceInformation = msoUtils.removeXmlNamespaces(upceVmsServiceInformation)
if (additionalData == null) {
additionalData = ""
@@ -319,7 +313,7 @@ class SDNCAdapterUtils {
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>
"""
- content = utils.removeXmlPreamble(utils.formatXML(content))
+ content = msoUtils.removeXmlPreamble(msoUtils.formatXml(content))
execution.setVariable(resultVar, content)
}
@@ -343,7 +337,7 @@ class SDNCAdapterUtils {
* @param isAic3 boolean to indicate whether request is for AIC3.0
*/
public void sdncReservePrep(DelegateExecution execution, String action, String resultVar, boolean isAic3) {
- sdncPrep(execution, resultVar, action , 'service-configuration-operation', null, isAic3, this.taskProcessor)
+ sdncPrep(execution, resultVar, action , 'service-configuration-operation', null, isAic3)
}
/**
@@ -356,8 +350,8 @@ class SDNCAdapterUtils {
* RequestData element (may be null)
*/
public void sdncPrep(DelegateExecution execution, String resultVar, String svcAction,
- String svcOperation, String additionalData, AbstractServiceTaskProcessor taskProcessor) {
- sdncPrep(execution, resultVar, svcAction, svcOperation, additionalData, false, taskProcessor)
+ String svcOperation, String additionalData) {
+ sdncPrep(execution, resultVar, svcAction, svcOperation, additionalData, false)
}
/**
@@ -370,7 +364,7 @@ class SDNCAdapterUtils {
* @param isAic3 boolean to indicate whether request is for AIC3.0
*/
public void sdncPrep(DelegateExecution execution, String resultVar, String svcAction,
- String svcOperation, String additionalData, boolean isAic3, AbstractServiceTaskProcessor taskProcessor) {
+ String svcOperation, String additionalData, boolean isAic3) {
def method = getClass().getSimpleName() + '.sdncPrep(' +
'execution=' + execution.getId() +
', resultVar=' + resultVar +
@@ -380,14 +374,14 @@ class SDNCAdapterUtils {
')'
logger.trace('Entered ' + method)
- MsoUtils utils = taskProcessor.utils
+
try {
def prefix = execution.getVariable('prefix')
- def request = taskProcessor.getVariable(execution, prefix+'Request')
- def requestInformation = utils.getNodeXml(request, 'request-information', false)
- def serviceInformation = utils.getNodeXml(request, 'service-information', false)
- def serviceParameters = utils.getChildNodes(request, 'service-parameters')
- def requestAction = utils.getNodeText(request, 'request-action')
+ def request = AbstractServiceTaskProcessor.getVariable(execution, prefix+'Request')
+ def requestInformation = msoUtils.getNodeXml(request, 'request-information', false)
+ def serviceInformation = msoUtils.getNodeXml(request, 'service-information', false)
+ def serviceParameters = msoUtils.getChildNodes(request, 'service-parameters')
+ def requestAction = msoUtils.getNodeText(request, 'request-action')
def timeoutInMinutes = UrnPropertiesReader.getVariable('mso.sdnc.timeout.firewall.minutes',execution)
@@ -407,23 +401,23 @@ class SDNCAdapterUtils {
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request")
}
- def l2HomingInformation = utils.getNodeXml(request, 'l2-homing-information', false)
- def internetEvcAccessInformation = utils.getNodeXml(request, 'internet-evc-access-information', false)
- def vrLan = utils.getNodeXml(request, 'vr-lan', false)
- def upceVmsServiceInfo = utils.getNodeXml(request, 'ucpe-vms-service-information', false)
- def vnfInformationList = utils.getNodeXml(request, 'vnf-information-list', false)
-
- def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation)
- def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation)
- def nnsl2HomingInformation = utils.removeXmlNamespaces(l2HomingInformation)
- def nnsInternetEvcAccessInformation = utils.removeXmlNamespaces(internetEvcAccessInformation)
- def nnsVrLan = utils.removeXmlNamespaces(vrLan)
- def nnsUpceVmsServiceInfo = utils.removeXmlNamespaces(upceVmsServiceInfo)
- def nnsVnfInformationList = utils.removeXmlNamespaces(vrLan)
+ def l2HomingInformation = msoUtils.getNodeXml(request, 'l2-homing-information', false)
+ def internetEvcAccessInformation = msoUtils.getNodeXml(request, 'internet-evc-access-information', false)
+ def vrLan = msoUtils.getNodeXml(request, 'vr-lan', false)
+ def upceVmsServiceInfo = msoUtils.getNodeXml(request, 'ucpe-vms-service-information', false)
+ def vnfInformationList = msoUtils.getNodeXml(request, 'vnf-information-list', false)
+
+ def nnsRequestInformation = msoUtils.removeXmlNamespaces(requestInformation)
+ def nnsServiceInformation = msoUtils.removeXmlNamespaces(serviceInformation)
+ def nnsl2HomingInformation = msoUtils.removeXmlNamespaces(l2HomingInformation)
+ def nnsInternetEvcAccessInformation = msoUtils.removeXmlNamespaces(internetEvcAccessInformation)
+ def nnsVrLan = msoUtils.removeXmlNamespaces(vrLan)
+ def nnsUpceVmsServiceInfo = msoUtils.removeXmlNamespaces(upceVmsServiceInfo)
+ def nnsVnfInformationList = msoUtils.removeXmlNamespaces(vrLan)
def nnsinternetSvcChangeDetails = ""
if(requestAction!=null && requestAction.equals("ChangeLayer3ServiceProvRequest")){
- def internetSvcChangeDetails = utils.removeXmlNamespaces(serviceParameters)
+ def internetSvcChangeDetails = msoUtils.removeXmlNamespaces(serviceParameters)
nnsinternetSvcChangeDetails = """<internet-service-change-details>
${internetSvcChangeDetails}
</internet-service-change-details>"""
@@ -466,7 +460,7 @@ class SDNCAdapterUtils {
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>
"""
- content = utils.removeXmlPreamble(utils.formatXML(content))
+ content = msoUtils.removeXmlPreamble(msoUtils.formatXml(content))
execution.setVariable(resultVar, content)
logger.debug(resultVar + ' = ' + System.lineSeparator() + content)
@@ -506,7 +500,6 @@ class SDNCAdapterUtils {
* RequestData element (may be null)
*/
public String sdncTopologyRequestV2 (DelegateExecution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, L3Network queryAAIResponse, String additionalData) {
- def utils=new MsoUtils()
// SNDC is expecting request Id for header as unique each call.
String hdrRequestId = ""
@@ -521,17 +514,17 @@ class SDNCAdapterUtils {
try {
requestId = execution.getVariable("mso-request-id")
} catch (Exception ex) {
- requestId = utils.getNodeText(requestXML, "request-id")
+ requestId = msoUtils.getNodeText(requestXML, "request-id")
}
String aicCloudRegion = cloudRegionId
String tenantId = ""
- if (utils.nodeExists(requestXML, "tenant-id")) {
- tenantId = utils.getNodeText(requestXML, "tenant-id")
+ if (msoUtils.nodeExists(requestXML, "tenant-id")) {
+ tenantId = msoUtils.getNodeText(requestXML, "tenant-id")
}
String networkType = ""
- if (utils.nodeExists(requestXML, "network-type")) {
- networkType = utils.getNodeText(requestXML, "network-type")
+ if (msoUtils.nodeExists(requestXML, "network-type")) {
+ networkType = msoUtils.getNodeText(requestXML, "network-type")
}
// Replace/Use the value of network-type from aai query (vs input) during Delete Network flows.
@@ -540,20 +533,20 @@ class SDNCAdapterUtils {
}
String serviceId = ""
- if (utils.nodeExists(requestXML, "service-id")) {
- serviceId = utils.getNodeText(requestXML, "service-id")
+ if (msoUtils.nodeExists(requestXML, "service-id")) {
+ serviceId = msoUtils.getNodeText(requestXML, "service-id")
}
String networkName = ""
// Replace/Use the value of network-name from aai query (vs input) if it was already set in AAI
if (queryAAIResponse != null) {
networkName = queryAAIResponse.getNetworkName()
}
- if (networkName.isEmpty() && utils.nodeExists(requestXML, "network-name")) {
- networkName = utils.getNodeText(requestXML, "network-name")
+ if (networkName.isEmpty() && msoUtils.nodeExists(requestXML, "network-name")) {
+ networkName = msoUtils.getNodeText(requestXML, "network-name")
}
String source = ""
- if (utils.nodeExists(requestXML, "source")) {
- source = utils.getNodeText(requestXML, "source")
+ if (msoUtils.nodeExists(requestXML, "source")) {
+ source = msoUtils.getNodeText(requestXML, "source")
}
// get resourceLink from subflow execution variable
@@ -631,7 +624,6 @@ class SDNCAdapterUtils {
* RequestData element (may be null)
*/
public String sdncTopologyRequestRsrc (DelegateExecution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String additionalData) {
- def utils=new MsoUtils()
// SNDC is expecting request Id for header as unique each call.
String hdrRequestId = ""
@@ -655,35 +647,35 @@ class SDNCAdapterUtils {
String aicCloudRegion = cloudRegionId
String tenantId = ""
- if (utils.nodeExists(requestXML, "tenant-id")) {
- tenantId = utils.getNodeText(requestXML, "tenant-id")
+ if (msoUtils.nodeExists(requestXML, "tenant-id")) {
+ tenantId = msoUtils.getNodeText(requestXML, "tenant-id")
}
String networkType = ""
- if (utils.nodeExists(requestXML, "network-type")) {
- networkType = utils.getNodeText(requestXML, "network-type")
+ if (msoUtils.nodeExists(requestXML, "network-type")) {
+ networkType = msoUtils.getNodeText(requestXML, "network-type")
}
String subscriptionServiceType = ""
- if (utils.nodeExists(requestXML, "subscription-service-type")) {
- subscriptionServiceType = utils.getNodeText(requestXML, "subscription-service-type")
+ if (msoUtils.nodeExists(requestXML, "subscription-service-type")) {
+ subscriptionServiceType = msoUtils.getNodeText(requestXML, "subscription-service-type")
}
String globalCustomerId = ""
- if (utils.nodeExists(requestXML, "global-customer-id")) {
- globalCustomerId = utils.getNodeText(requestXML, "global-customer-id")
+ if (msoUtils.nodeExists(requestXML, "global-customer-id")) {
+ globalCustomerId = msoUtils.getNodeText(requestXML, "global-customer-id")
}
String serviceId = ""
- if (utils.nodeExists(requestXML, "service-id")) {
- serviceId = utils.getNodeText(requestXML, "service-id")
+ if (msoUtils.nodeExists(requestXML, "service-id")) {
+ serviceId = msoUtils.getNodeText(requestXML, "service-id")
}
String networkName = ""
- if (utils.nodeExists(requestXML, "network-name")) {
- networkName = utils.getNodeText(requestXML, "network-name")
+ if (msoUtils.nodeExists(requestXML, "network-name")) {
+ networkName = msoUtils.getNodeText(requestXML, "network-name")
}
String source = ""
- if (utils.nodeExists(requestXML, "source")) {
- source = utils.getNodeText(requestXML, "source")
+ if (msoUtils.nodeExists(requestXML, "source")) {
+ source = msoUtils.getNodeText(requestXML, "source")
}
// get resourceLink from subflow execution variable
@@ -704,28 +696,28 @@ class SDNCAdapterUtils {
}
// network-information from 'networkModelInfo' // verify the DB Catalog response
- String networkModelInfo = utils.getNodeXml(requestXML, "networkModelInfo", false).replace("tag0:","").replace(":tag0","")
- String modelInvariantUuid = utils.getNodeText(networkModelInfo, "modelInvariantUuid") !=null ?
- utils.getNodeText(networkModelInfo, "modelInvariantUuid") : ""
- String modelCustomizationUuid = utils.getNodeText(networkModelInfo, "modelCustomizationUuid") !=null ?
- utils.getNodeText(networkModelInfo, "modelCustomizationUuid") : ""
- String modelUuid = utils.getNodeText(networkModelInfo, "modelUuid") !=null ?
- utils.getNodeText(networkModelInfo, "modelUuid") : ""
- String modelVersion = utils.getNodeText(networkModelInfo, "modelVersion") !=null ?
- utils.getNodeText(networkModelInfo, "modelVersion") : ""
- String modelName = utils.getNodeText(networkModelInfo, "modelName") !=null ?
- utils.getNodeText(networkModelInfo, "modelName") : ""
+ String networkModelInfo = msoUtils.getNodeXml(requestXML, "networkModelInfo", false).replace("tag0:","").replace(":tag0","")
+ String modelInvariantUuid = msoUtils.getNodeText(networkModelInfo, "modelInvariantUuid") !=null ?
+ msoUtils.getNodeText(networkModelInfo, "modelInvariantUuid") : ""
+ String modelCustomizationUuid = msoUtils.getNodeText(networkModelInfo, "modelCustomizationUuid") !=null ?
+ msoUtils.getNodeText(networkModelInfo, "modelCustomizationUuid") : ""
+ String modelUuid = msoUtils.getNodeText(networkModelInfo, "modelUuid") !=null ?
+ msoUtils.getNodeText(networkModelInfo, "modelUuid") : ""
+ String modelVersion = msoUtils.getNodeText(networkModelInfo, "modelVersion") !=null ?
+ msoUtils.getNodeText(networkModelInfo, "modelVersion") : ""
+ String modelName = msoUtils.getNodeText(networkModelInfo, "modelName") !=null ?
+ msoUtils.getNodeText(networkModelInfo, "modelName") : ""
// service-information from 'networkModelInfo' // verify the DB Catalog response
- String serviceModelInfo = utils.getNodeXml(requestXML, "serviceModelInfo", false).replace("tag0:","").replace(":tag0","")
- String serviceModelInvariantUuid = utils.getNodeText(serviceModelInfo, "modelInvariantUuid") !=null ?
- utils.getNodeText(serviceModelInfo, "modelInvariantUuid") : ""
- String serviceModelUuid = utils.getNodeText(serviceModelInfo, "modelUuid") !=null ?
- utils.getNodeText(serviceModelInfo, "modelUuid") : ""
- String serviceModelVersion = utils.getNodeText(serviceModelInfo, "modelVersion") !=null ?
- utils.getNodeText(serviceModelInfo, "modelVersion") : ""
- String serviceModelName = utils.getNodeText(serviceModelInfo, "modelName") !=null ?
- utils.getNodeText(serviceModelInfo, "modelName") : ""
+ String serviceModelInfo = msoUtils.getNodeXml(requestXML, "serviceModelInfo", false).replace("tag0:","").replace(":tag0","")
+ String serviceModelInvariantUuid = msoUtils.getNodeText(serviceModelInfo, "modelInvariantUuid") !=null ?
+ msoUtils.getNodeText(serviceModelInfo, "modelInvariantUuid") : ""
+ String serviceModelUuid = msoUtils.getNodeText(serviceModelInfo, "modelUuid") !=null ?
+ msoUtils.getNodeText(serviceModelInfo, "modelUuid") : ""
+ String serviceModelVersion = msoUtils.getNodeText(serviceModelInfo, "modelVersion") !=null ?
+ msoUtils.getNodeText(serviceModelInfo, "modelVersion") : ""
+ String serviceModelName = msoUtils.getNodeText(serviceModelInfo, "modelName") !=null ?
+ msoUtils.getNodeText(serviceModelInfo, "modelName") : ""
String content =
@@ -808,27 +800,27 @@ class SDNCAdapterUtils {
}else{
// we need to peer into the request data for error
- def String sdncAdapterWorkflowResponse = taskProcessor.utils.getNodeXml(response, 'response-data', false)
+ def String sdncAdapterWorkflowResponse = msoUtils.getNodeXml(response, 'response-data', false)
def String decodedXml = sdncAdapterWorkflowResponse.replace('<?xml version="1.0" encoding="UTF-8"?>', "")
- decodedXml = taskProcessor.utils.getNodeXml(response, 'RequestData')
+ decodedXml = msoUtils.getNodeXml(response, 'RequestData')
logger.debug("decodedXml:\n" + decodedXml)
int requestDataResponseCode = 200
def String requestDataResponseMessage = ''
try{
- if (taskProcessor.utils.nodeExists(decodedXml, "response-message")) {
- requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "response-message")
- } else if (taskProcessor.utils.nodeExists(sdncAdapterWorkflowResponse, "ResponseMessage")) {
- requestDataResponseMessage = taskProcessor.utils.getNodeText(sdncAdapterWorkflowResponse, "ResponseMessage")
+ if (msoUtils.nodeExists(decodedXml, "response-message")) {
+ requestDataResponseMessage = msoUtils.getNodeText(decodedXml, "response-message")
+ } else if (msoUtils.nodeExists(sdncAdapterWorkflowResponse, "ResponseMessage")) {
+ requestDataResponseMessage = msoUtils.getNodeText(sdncAdapterWorkflowResponse, "ResponseMessage")
}
}catch(Exception e){
logger.debug('Error caught while decoding resposne ' + e.getMessage())
}
- if(taskProcessor.utils.nodeExists(decodedXml, "response-code")) {
+ if(msoUtils.nodeExists(decodedXml, "response-code")) {
logger.debug("response-code node Exist ")
- String code = taskProcessor.utils.getNodeText(decodedXml, "response-code")
+ String code = msoUtils.getNodeText(decodedXml, "response-code")
if(code.isEmpty() || code.equals("")){
// if response-code is blank then Success
logger.debug("response-code node is empty")
@@ -837,9 +829,9 @@ class SDNCAdapterUtils {
requestDataResponseCode = code.toInteger()
logger.debug("response-code is: " + requestDataResponseCode)
}
- }else if(taskProcessor.utils.nodeExists(sdncAdapterWorkflowResponse, "ResponseCode")){
+ }else if(msoUtils.nodeExists(sdncAdapterWorkflowResponse, "ResponseCode")){
logger.debug("ResponseCode node Exist ")
- String code = taskProcessor.utils.getNodeText(sdncAdapterWorkflowResponse, "ResponseCode")
+ String code = msoUtils.getNodeText(sdncAdapterWorkflowResponse, "ResponseCode")
if(code.isEmpty() || code.equals("")){
// if ResponseCode blank then Success
logger.debug("ResponseCode node is empty")
@@ -918,7 +910,7 @@ class SDNCAdapterUtils {
if (success) {
// we need to look inside the request data for error
- def String callbackRequestData = taskProcessor.utils.getNodeXml(response, 'RequestData', false)
+ def String callbackRequestData = msoUtils.getNodeXml(response, 'RequestData', false)
def String decodedXml = callbackRequestData
logger.debug("decodedXml:\n" + decodedXml)
@@ -926,17 +918,17 @@ class SDNCAdapterUtils {
def requestDataResponseMessage = ''
int intDataResponseCode = 200
- if (taskProcessor.utils.nodeExists(decodedXml, "response-code")) {
+ if (msoUtils.nodeExists(decodedXml, "response-code")) {
- requestDataResponseCode = ((String) taskProcessor.utils.getNodeText(decodedXml, "response-code"))
- if (taskProcessor.utils.nodeExists(decodedXml, "response-message")) {
- requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "response-message")
+ requestDataResponseCode = ((String) msoUtils.getNodeText(decodedXml, "response-code"))
+ if (msoUtils.nodeExists(decodedXml, "response-message")) {
+ requestDataResponseMessage = msoUtils.getNodeText(decodedXml, "response-message")
}
- }else if(taskProcessor.utils.nodeExists(decodedXml, "ResponseCode")){
- requestDataResponseCode = ((String) taskProcessor.utils.getNodeText(decodedXml, "ResponseCode")).toInteger()
- }else if(taskProcessor.utils.nodeExists(response, "ResponseCode")){
- requestDataResponseCode = ((String) taskProcessor.utils.getNodeText(response, "ResponseCode")).toInteger()
- requestDataResponseMessage = taskProcessor.utils.getNodeText(response, "ResponseMessage")
+ }else if(msoUtils.nodeExists(decodedXml, "ResponseCode")){
+ requestDataResponseCode = ((String) msoUtils.getNodeText(decodedXml, "ResponseCode")).toInteger()
+ }else if(msoUtils.nodeExists(response, "ResponseCode")){
+ requestDataResponseCode = ((String) msoUtils.getNodeText(response, "ResponseCode")).toInteger()
+ requestDataResponseMessage = msoUtils.getNodeText(response, "ResponseMessage")
}
logger.debug("SDNC callback response-code: " + requestDataResponseCode)
@@ -944,8 +936,8 @@ class SDNCAdapterUtils {
// Get the AAI Status to determine if rollback is needed on ASSIGN
def aai_status = ''
- if (taskProcessor.utils.nodeExists(decodedXml, "aai-status")) {
- aai_status = ((String) taskProcessor.utils.getNodeText(decodedXml, "aai-status"))
+ if (msoUtils.nodeExists(decodedXml, "aai-status")) {
+ aai_status = ((String) msoUtils.getNodeText(decodedXml, "aai-status"))
logger.debug("SDNC sent AAI STATUS code: " + aai_status)
}
if (aai_status != null && !aai_status.equals("")) {
@@ -955,8 +947,8 @@ class SDNCAdapterUtils {
// Get the result string to determine if rollback is needed on ASSIGN in Add Bonding flow only
def sdncResult = ''
- if (taskProcessor.utils.nodeExists(decodedXml, "result")) {
- sdncResult = ((String) taskProcessor.utils.getNodeText(decodedXml, "result"))
+ if (msoUtils.nodeExists(decodedXml, "result")) {
+ sdncResult = ((String) msoUtils.getNodeText(decodedXml, "result"))
logger.debug("SDNC sent result: " + sdncResult)
}
if (sdncResult != null && !sdncResult.equals("")) {
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
index 796ee43cf4..a40bf59097 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
@@ -206,7 +206,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
// Construct payload
managementV6AddressEntry = updateGenericVnfNode(origRequest, 'management-v6-address')
}
-
+
// Handle orchestration-status
String orchestrationStatus = execution.getVariable('UAAIGenVnf_orchestrationStatus')
String orchestrationStatusEntry = null
@@ -214,7 +214,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
// Construct payload
orchestrationStatusEntry = updateGenericVnfNode(origRequest, 'orchestration-status')
}
-
+
org.onap.aai.domain.yang.GenericVnf payload = new org.onap.aai.domain.yang.GenericVnf();
payload.setVnfId(vnfId)
payload.setPersonaModelVersion(personaModelVersionEntry)
@@ -227,8 +227,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
try {
getAAIClient().update(uri,payload)
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI PATCH:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI PATCH: {}', ex.getMessage(), ex)
execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', 500)
execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', 'AAI PATCH Failed:' + ex.getMessage())
}
@@ -258,9 +257,9 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
return ""
}
else {
- return elementValue
+ return elementValue
}
-
+
}
/**
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy
index 259a7872a3..1960cafb0f 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy
@@ -69,7 +69,7 @@ class VidUtils {
public String createXmlVolumeRequest(Map requestMap, String action, String serviceInstanceId) {
createXmlVolumeRequest(requestMap, action, serviceInstanceId, '')
}
-
+
/**
* Create a volume-request XML using a map
@@ -84,9 +84,9 @@ class VidUtils {
def serviceName = ''
def modelCustomizationName = ''
def asdcServiceModelVersion = ''
-
+
def suppressRollback = requestMap.requestDetails.requestInfo.suppressRollback
-
+
def backoutOnFailure = ""
if(suppressRollback != null){
if ( suppressRollback == true) {
@@ -95,7 +95,7 @@ class VidUtils {
backoutOnFailure = "true"
}
}
-
+
def volGrpName = requestMap.requestDetails.requestInfo?.instanceName ?: ''
def serviceId = requestMap.requestDetails.requestParameters?.serviceId ?: ''
def relatedInstanceList = requestMap.requestDetails.relatedInstanceList
@@ -108,16 +108,16 @@ class VidUtils {
modelCustomizationName = it.relatedInstance.modelInfo?.modelInstanceName
}
}
-
+
vnfType = serviceName + '/' + modelCustomizationName
-
+
def userParams = requestMap.requestDetails?.requestParameters?.userParams
def userParamsNode = ''
if(userParams != null) {
userParamsNode = buildUserParams(userParams)
}
def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationUuid ?: ''
-
+
String xmlReq = """
<volume-request xmlns="http://www.w3.org/2001/XMLSchema">
<request-info>
@@ -145,9 +145,9 @@ class VidUtils {
// return a pretty-print of the volume-request xml without the preamble
return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
}
-
+
/**
- * A common method that can be used to build volume-params node from a map.
+ * A common method that can be used to build volume-params node from a map.
* @param Map userParams
* @return
*/
@@ -166,9 +166,9 @@ class VidUtils {
}
/**
- * A common method that can be used to extract 'requestDetails'
+ * A common method that can be used to extract 'requestDetails'
* @param String json
- * @return String json requestDetails
+ * @return String json requestDetails
*/
@Deprecated
public getJsonRequestDetails(String jsonInput) {
@@ -183,10 +183,10 @@ class VidUtils {
return rtn
} else {
return rtn
- }
+ }
}
}
-
+
/**
* A common method that can be used to extract 'requestDetails' in Xml
* @param String json
@@ -203,17 +203,17 @@ class VidUtils {
return XmlTool.normalize(XML.toString(jsonObj))
}
}
-
+
/**
* Create a network-request XML using a map
- * @param execution
- * @param xmlRequestDetails - requestDetails in xml
+ * @param execution
+ * @param xmlRequestDetails - requestDetails in xml
* @return
* Note: See latest version: createXmlNetworkRequestInstance()
*/
public String createXmlNetworkRequestInfra(execution, def networkJsonIncoming) {
-
+
def requestId = execution.getVariable("requestId")
def serviceInstanceId = execution.getVariable("serviceInstanceId")
def requestAction = execution.getVariable("requestAction")
@@ -225,13 +225,13 @@ class VidUtils {
def instanceName = reqMap.requestDetails.requestInfo.instanceName
def modelCustomizationId = reqMap.requestDetails.modelInfo.modelCustomizationId
if (modelCustomizationId == null) {
- modelCustomizationId = reqMap.requestDetails.modelInfo.modelCustomizationUuid !=null ?
+ modelCustomizationId = reqMap.requestDetails.modelInfo.modelCustomizationUuid !=null ?
reqMap.requestDetails.modelInfo.modelCustomizationUuid : ""
}
def modelName = reqMap.requestDetails.modelInfo.modelName
def lcpCloudRegionId = reqMap.requestDetails.cloudConfiguration.lcpCloudRegionId
def tenantId = reqMap.requestDetails.cloudConfiguration.tenantId
- def serviceId = reqMap.requestDetails.requestInfo.productFamilyId
+ def serviceId = reqMap.requestDetails.requestInfo.productFamilyId
def suppressRollback = reqMap.requestDetails.requestInfo.suppressRollback.toString()
def backoutOnFailure = "true"
if(suppressRollback != null){
@@ -241,7 +241,7 @@ class VidUtils {
backoutOnFailure = "true"
}
}
-
+
//def userParams = reqMap.requestDetails.requestParameters.userParams
//def userParamsNode = buildUserParams(userParams)
def userParams = reqMap.requestDetails?.requestParameters?.userParams
@@ -249,26 +249,26 @@ class VidUtils {
if(userParams != null) {
userParamsNode = buildUserParams(userParams)
}
-
+
//'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC)
def sdncVersion = execution.getVariable("sdncVersion")
-
+
String xmlReq = """
- <network-request xmlns="http://www.w3.org/2001/XMLSchema">
- <request-info>
+ <network-request xmlns="http://www.w3.org/2001/XMLSchema">
+ <request-info>
<request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
- <action>${MsoUtils.xmlEscape(requestAction)}</action>
- <source>VID</source>
+ <action>${MsoUtils.xmlEscape(requestAction)}</action>
+ <source>VID</source>
<service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- </request-info>
+ </request-info>
<network-inputs>
- <network-id>${MsoUtils.xmlEscape(networkId)}</network-id>
- <network-name>${MsoUtils.xmlEscape(instanceName)}</network-name>
+ <network-id>${MsoUtils.xmlEscape(networkId)}</network-id>
+ <network-name>${MsoUtils.xmlEscape(instanceName)}</network-name>
<network-type>${MsoUtils.xmlEscape(modelName)}</network-type>
- <modelCustomizationId>${MsoUtils.xmlEscape(modelCustomizationId)}</modelCustomizationId>
- <aic-cloud-region>${MsoUtils.xmlEscape(lcpCloudRegionId)}</aic-cloud-region>
+ <modelCustomizationId>${MsoUtils.xmlEscape(modelCustomizationId)}</modelCustomizationId>
+ <aic-cloud-region>${MsoUtils.xmlEscape(lcpCloudRegionId)}</aic-cloud-region>
<tenant-id>${MsoUtils.xmlEscape(tenantId)}</tenant-id>
- <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
+ <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
<backout-on-failure>${MsoUtils.xmlEscape(backoutOnFailure)}</backout-on-failure>
<sdncVersion>${MsoUtils.xmlEscape(sdncVersion)}</sdncVersion>
</network-inputs>
@@ -281,8 +281,7 @@ class VidUtils {
return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
} catch(Exception e) {
- logger.debug("{} {}", "Error in Vid Utils", e.getCause())
- e.printStackTrace();
+ logger.debug("Error in Vid Utils: {}", e.getCause(), e)
throw e
}
}
@@ -299,7 +298,7 @@ class VidUtils {
def networkModelVersion = ""
def networkModelCustomizationUuid = ""
def networkModelInvariantUuid = ""
-
+
// verify the DB Catalog response JSON structure
def networkModelInfo = execution.getVariable("networkModelInfo")
def jsonSlurper = new JsonSlurper()
@@ -326,14 +325,14 @@ class VidUtils {
} catch (Exception ex) {
throw ex
}
- }
-
+ }
+
def serviceModelUuid = ""
def serviceModelName = ""
def serviceModelVersion = ""
def serviceModelCustomizationUuid = ""
def serviceModelInvariantUuid = ""
-
+
// verify the DB Catalog response JSON structure
def serviceModelInfo = execution.getVariable("serviceModelInfo")
def jsonServiceSlurper = new JsonSlurper()
@@ -361,8 +360,8 @@ class VidUtils {
throw ex
}
}
-
-
+
+
def subscriptionServiceType = execution.getVariable("subscriptionServiceType") != null ? execution.getVariable("subscriptionServiceType") : ""
def globalSubscriberId = execution.getVariable("globalSubscriberId") != null ? execution.getVariable("globalSubscriberId") : ""
def requestId = execution.getVariable("msoRequestId")
@@ -382,88 +381,88 @@ class VidUtils {
backoutOnFailure = "true"
}
}
-
+
//'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC)
def sdncVersion = execution.getVariable("sdncVersion")
-
+
def source = "VID"
def action = execution.getVariable("action")
-
+
def userParamsNode = ""
def userParams = execution.getVariable("networkInputParams")
if(userParams != null) {
userParamsNode = buildUserParams(userParams)
}
-
+
String xmlReq = """
- <network-request xmlns="http://www.w3.org/2001/XMLSchema">
- <request-info>
+ <network-request xmlns="http://www.w3.org/2001/XMLSchema">
+ <request-info>
<request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
- <action>${MsoUtils.xmlEscape(action)}</action>
- <source>${MsoUtils.xmlEscape(source)}</source>
+ <action>${MsoUtils.xmlEscape(action)}</action>
+ <source>${MsoUtils.xmlEscape(source)}</source>
<service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- </request-info>
- <network-inputs>
- <network-id>${MsoUtils.xmlEscape(networkId)}</network-id>
- <network-name>${MsoUtils.xmlEscape(networkName)}</network-name>
+ </request-info>
+ <network-inputs>
+ <network-id>${MsoUtils.xmlEscape(networkId)}</network-id>
+ <network-name>${MsoUtils.xmlEscape(networkName)}</network-name>
<network-type>${MsoUtils.xmlEscape(networkModelName)}</network-type>
<subscription-service-type>${MsoUtils.xmlEscape(subscriptionServiceType)}</subscription-service-type>
<global-customer-id>${MsoUtils.xmlEscape(globalSubscriberId)}</global-customer-id>
- <aic-cloud-region>${MsoUtils.xmlEscape(aicCloudReqion)}</aic-cloud-region>
+ <aic-cloud-region>${MsoUtils.xmlEscape(aicCloudReqion)}</aic-cloud-region>
<tenant-id>${MsoUtils.xmlEscape(tenantId)}</tenant-id>
- <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
+ <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
<backout-on-failure>${MsoUtils.xmlEscape(backoutOnFailure)}</backout-on-failure>
<failIfExist>${MsoUtils.xmlEscape(failIfExist)}</failIfExist>
<networkModelInfo>
<modelName>${MsoUtils.xmlEscape(networkModelName)}</modelName>
<modelUuid>${MsoUtils.xmlEscape(networkModelUuid)}</modelUuid>
- <modelInvariantUuid>${MsoUtils.xmlEscape(networkModelInvariantUuid)}</modelInvariantUuid>
+ <modelInvariantUuid>${MsoUtils.xmlEscape(networkModelInvariantUuid)}</modelInvariantUuid>
<modelVersion>${MsoUtils.xmlEscape(networkModelVersion)}</modelVersion>
<modelCustomizationUuid>${MsoUtils.xmlEscape(networkModelCustomizationUuid)}</modelCustomizationUuid>
</networkModelInfo>
<serviceModelInfo>
<modelName>${MsoUtils.xmlEscape(serviceModelName)}</modelName>
<modelUuid>${MsoUtils.xmlEscape(serviceModelUuid)}</modelUuid>
- <modelInvariantUuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</modelInvariantUuid>
+ <modelInvariantUuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</modelInvariantUuid>
<modelVersion>${MsoUtils.xmlEscape(serviceModelVersion)}</modelVersion>
<modelCustomizationUuid>${MsoUtils.xmlEscape(serviceModelCustomizationUuid)}</modelCustomizationUuid>
-
- </serviceModelInfo>
- <sdncVersion>${MsoUtils.xmlEscape(sdncVersion)}</sdncVersion>
+
+ </serviceModelInfo>
+ <sdncVersion>${MsoUtils.xmlEscape(sdncVersion)}</sdncVersion>
</network-inputs>
<network-params>
${userParamsNode}
- </network-params>
+ </network-params>
</network-request>
"""
// return a pretty-print of the volume-request xml without the preamble
return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
-
+
}
-
+
/**
* Create a vnf-request XML using a map
- * @param requestMap - map created from VID JSON
+ * @param requestMap - map created from VID JSON
* @param action
* @return
*/
public String createXmlVfModuleRequest(execution, Map requestMap, String action, String serviceInstanceId) {
-
+
//def relatedInstanceList = requestMap.requestDetails.relatedInstanceList
-
+
//relatedInstanceList.each {
// if (it.relatedInstance.modelInfo.modelType == 'vnf') {
// vnfType = it.relatedInstance.modelInfo.modelName
// vnfId = it.relatedInstance.modelInfo.modelInvariantId
// }
//}
-
+
def vnfName = ''
def asdcServiceModelInfo = ''
-
+
def relatedInstanceList = requestMap.requestDetails?.relatedInstanceList
-
-
+
+
if (relatedInstanceList != null) {
relatedInstanceList.each {
if (it.relatedInstance.modelInfo?.modelType == 'service') {
@@ -474,30 +473,30 @@ class VidUtils {
}
}
}
-
+
def vnfType = execution.getVariable('vnfType')
def vnfId = execution.getVariable('vnfId')
def vfModuleId = execution.getVariable('vfModuleId')
def volumeGroupId = execution.getVariable('volumeGroupId')
def userParams = requestMap.requestDetails?.requestParameters?.userParams
-
-
+
+
def userParamsNode = ''
if(userParams != null) {
userParamsNode = buildUserParams(userParams)
}
-
+
def isBaseVfModule = "false"
if (execution.getVariable('isBaseVfModule') == true) {
isBaseVfModule = "true"
}
-
+
def requestId = execution.getVariable("mso-request-id")
def vfModuleName = requestMap.requestDetails?.requestInfo?.instanceName ?: ''
def vfModuleModelName = requestMap.requestDetails?.modelInfo?.modelName ?: ''
def suppressRollback = requestMap.requestDetails?.requestInfo?.suppressRollback
-
+
def backoutOnFailure = ""
if(suppressRollback != null){
if ( suppressRollback == true) {
@@ -506,14 +505,14 @@ class VidUtils {
backoutOnFailure = "true"
}
}
-
+
def serviceId = requestMap.requestDetails?.requestParameters?.serviceId ?: ''
def aicCloudRegion = requestMap.requestDetails?.cloudConfiguration?.lcpCloudRegionId ?: ''
def tenantId = requestMap.requestDetails?.cloudConfiguration?.tenantId ?: ''
def personaModelId = requestMap.requestDetails?.modelInfo?.modelInvariantUuid ?: ''
def personaModelVersion = requestMap.requestDetails?.modelInfo?.modelUuid ?: ''
def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationUuid ?: ''
-
+
String xmlReq = """
<vnf-request>
<request-info>
@@ -524,17 +523,17 @@ class VidUtils {
</request-info>
<vnf-inputs>
<!-- not in use in 1610 -->
- <vnf-name>${MsoUtils.xmlEscape(vnfName)}</vnf-name>
+ <vnf-name>${MsoUtils.xmlEscape(vnfName)}</vnf-name>
<vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<volume-group-id>${MsoUtils.xmlEscape(volumeGroupId)}</volume-group-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
- <vf-module-name>${MsoUtils.xmlEscape(vfModuleName)}</vf-module-name>
+ <vf-module-name>${MsoUtils.xmlEscape(vfModuleName)}</vf-module-name>
<vf-module-model-name>${MsoUtils.xmlEscape(vfModuleModelName)}</vf-module-model-name>
<model-customization-id>${MsoUtils.xmlEscape(modelCustomizationId)}</model-customization-id>
<is-base-vf-module>${MsoUtils.xmlEscape(isBaseVfModule)}</is-base-vf-module>
<asdc-service-model-version>${MsoUtils.xmlEscape(asdcServiceModelInfo)}</asdc-service-model-version>
- <aic-cloud-region>${MsoUtils.xmlEscape(aicCloudRegion)}</aic-cloud-region>
+ <aic-cloud-region>${MsoUtils.xmlEscape(aicCloudRegion)}</aic-cloud-region>
<tenant-id>${MsoUtils.xmlEscape(tenantId)}</tenant-id>
<service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
<backout-on-failure>${MsoUtils.xmlEscape(backoutOnFailure)}</backout-on-failure>
@@ -546,10 +545,10 @@ class VidUtils {
</vnf-params>
</vnf-request>
"""
-
+
// return a pretty-print of the volume-request xml without the preamble
return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
}
-
+
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
index ac67d949a5..9215eabc57 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
@@ -294,7 +294,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
} catch (IOException ex) {
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter",
- "BPMN", ErrorCode.UnknownError.getValue());
+ "BPMN", ErrorCode.UnknownError.getValue(), ex);
}
}
@@ -398,7 +398,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
vnfAdapterWorkflowException(execution, callback)
}
} catch (Exception e) {
- logger.debug("Error encountered within VnfAdapterRest ProcessCallback method", e)
+ logger.debug("Error encountered within VnfAdapterRest ProcessCallback method: {}", e.getMessage(), e)
exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method")
}
}
@@ -450,4 +450,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
Node child = getChild(node, name)
return child == null ? null : child.text()
}
+
+ public Logger getLogger() {
+ return logger;
+ }
}
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 1c1d6b73fd..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
@@ -1,122 +1,135 @@
/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+* ============LICENSE_START=======================================================
+* ONAP - SO
+* ================================================================================
+* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+* ================================================================================
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
* http://www.apache.org/licenses/LICENSE-2.0
- *
+*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+* ============LICENSE_END=========================================================
+*/
package org.onap.so.bpmn.common;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.common.exceptions.MalformedBuildingBlockInputException;
import org.onap.so.bpmn.common.exceptions.MissingBuildingBlockInputException;
import org.onap.so.bpmn.common.exceptions.RequiredExecutionVariableExeception;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
public class DelegateExecutionImpl implements BuildingBlockExecution, Serializable {
- private final Map<String, Serializable> seedMap;
- private transient DelegateExecution execution;
- private static final String INVALID_INPUT_MISSING = "Expected variable of \"%s\" not found in execution";
- private static final String INVALID_INPUT_CLASS_CAST = "Expected variable of \"%s\" was the wrong object type in the execution";
-
- private static final String MISSING_MSG = "Execution variable \"gBBInput\" cannot be null when executing building blocks";
- private static final String MALFORMED_MSG = "Execution variable \"gBBInput\" must contain an element of type GeneralBuildingBlock";
-
- public DelegateExecutionImpl(Map<String, Serializable> seedMap) {
- this.seedMap = seedMap;
- }
-
- public DelegateExecutionImpl(DelegateExecution execution) {
- this.seedMap = new HashMap<>();
- execution.getVariables().forEach((key, value) -> {
- if (value instanceof Serializable) {
- seedMap.put(key, (Serializable)value);
- }
- });
- /* must occur for junit tests to work */
- this.execution = execution;
- }
- @Override
- public GeneralBuildingBlock getGeneralBuildingBlock() {
- try {
- GeneralBuildingBlock generalBuildingBlock = (GeneralBuildingBlock) execution.getVariable("gBBInput");
-
- if (generalBuildingBlock == null) {
- throw new MissingBuildingBlockInputException(MISSING_MSG);
- }
-
- return generalBuildingBlock;
- } catch (ClassCastException e) {
- throw new MalformedBuildingBlockInputException(MALFORMED_MSG, e);
- }
- }
-
- @Override
- public <T> T getVariable(String key) {
- return this.get(key);
- }
-
- @Override
- public <T> T getRequiredVariable(String key) throws RequiredExecutionVariableExeception {
- final T result;
-
- result = this.get(key);
- if (result == null) {
- throw new RequiredExecutionVariableExeception(String.format(INVALID_INPUT_MISSING, key));
-
- }
- return result;
- }
-
- @Override
- public void setVariable(String key, Serializable value) {
- this.execution.setVariable(key, value);
- }
-
- @Override
- public Map<ResourceKey, String> getLookupMap() {
- return this.get("lookupKeyMap");
- }
-
- @Override
- public String getFlowToBeCalled() {
- return this.get("flowToBeCalled");
- }
- public DelegateExecution getDelegateExecution() {
- return this.execution;
- }
-
- public void setDelegateExecution(DelegateExecution execution) {
- this.execution = execution;
- this.seedMap.forEach((key, value) -> {
- if (!execution.hasVariable(key)) {
- execution.setVariable(key, value);
- }
- });
- }
-
- protected <T> T get(String key) {
- final Object value = this.execution.getVariable(key);
-
- return (T)value;
- }
+ private static final long serialVersionUID = 5559067662634919395L;
+
+ @JsonProperty
+ private final Map<String, Serializable> seedMap;
+
+ private transient DelegateExecution execution;
+ private static final String INVALID_INPUT_MISSING = "Expected variable of \"%s\" not found in execution";
+
+ private static final String MISSING_MSG =
+ "Execution variable \"gBBInput\" cannot be null when executing building blocks";
+ private static final String MALFORMED_MSG =
+ "Execution variable \"gBBInput\" must contain an element of type GeneralBuildingBlock";
+
+ public DelegateExecutionImpl(final Map<String, Serializable> seedMap) {
+ this.seedMap = seedMap;
+ }
+
+ public DelegateExecutionImpl(final DelegateExecution execution) {
+ this.seedMap = new HashMap<>();
+ execution.getVariables().forEach((key, value) -> {
+ if (value instanceof Serializable) {
+ seedMap.put(key, (Serializable) value);
+ }
+ });
+ /* must occur for junit tests to work */
+ this.execution = execution;
+ }
+
+ @JsonIgnore
+ @Override
+ public GeneralBuildingBlock getGeneralBuildingBlock() {
+ try {
+ final GeneralBuildingBlock generalBuildingBlock = (GeneralBuildingBlock) execution.getVariable("gBBInput");
+
+ if (generalBuildingBlock == null) {
+ throw new MissingBuildingBlockInputException(MISSING_MSG);
+ }
+
+ return generalBuildingBlock;
+ } catch (final ClassCastException e) {
+ throw new MalformedBuildingBlockInputException(MALFORMED_MSG, e);
+ }
+ }
+
+ @Override
+ public <T> T getVariable(final String key) {
+ return this.get(key);
+ }
+
+ @Override
+ public <T> T getRequiredVariable(final String key) throws RequiredExecutionVariableExeception {
+ final T result;
+
+ result = this.get(key);
+ if (result == null) {
+ throw new RequiredExecutionVariableExeception(String.format(INVALID_INPUT_MISSING, key));
+
+ }
+ return result;
+ }
+
+ @Override
+ public void setVariable(final String key, final Serializable value) {
+ this.execution.setVariable(key, value);
+ }
+
+ @JsonIgnore
+ @Override
+ public Map<ResourceKey, String> getLookupMap() {
+ return this.get("lookupKeyMap");
+ }
+
+ @JsonIgnore
+ @Override
+ public String getFlowToBeCalled() {
+ return this.get("flowToBeCalled");
+ }
+
+ @JsonIgnore
+ public DelegateExecution getDelegateExecution() {
+ return this.execution;
+ }
+
+ public void setDelegateExecution(final DelegateExecution execution) {
+ this.execution = execution;
+ this.seedMap.forEach((key, value) -> {
+ if (!execution.hasVariable(key)) {
+ execution.setVariable(key, value);
+ }
+ });
+ }
+
+ @SuppressWarnings("unchecked")
+ protected <T> T get(final String key) {
+ final Object value = this.execution.getVariable(key);
+ return (T) value;
+ }
+
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectExecution.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectExecution.java
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 5352fc2fe0..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..d7b58bac46 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,97 @@ 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("customer-latitude")
+ private String customerLatitude;
+ @JsonProperty("customer-longitude")
+ private String customerLongitude;
@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 String getCustomerLatitude() {
+ return customerLatitude;
+ }
+
+ public void setCustomerLatitude(String customerLatitude) {
+ this.customerLatitude = customerLatitude;
+ }
+
+ public String getCustomerLongitude() {
+ return customerLongitude;
+ }
+
+ public void setCustomerLongitude(String customerLongitude) {
+ this.customerLongitude = customerLongitude;
+ }
+
+ 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 ba3ab7f315..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,496 +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;
-
-
- 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 5868da563c..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
@@ -21,43 +21,49 @@
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;
-
- @Id
- @JsonProperty("line-of-business-name")
- private String lineOfBusinessName;
-
- public String getLineOfBusinessName() {
- return lineOfBusinessName;
- }
-
- public void setLineOfBusinessName(String lineOfBusinessName) {
- this.lineOfBusinessName = lineOfBusinessName;
- }
-
- @Override
- public boolean equals(final Object other) {
- if (!(other instanceof LineOfBusiness)) {
- return false;
- }
- LineOfBusiness castOther = (LineOfBusiness) other;
- return new EqualsBuilder().append(lineOfBusinessName, castOther.lineOfBusinessName).isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(lineOfBusinessName).toHashCode();
- }
+ private static final long serialVersionUID = -7697815326894443926L;
+
+ @Id
+ @JsonProperty("line-of-business-name")
+ private String lineOfBusinessName;
+
+ public LineOfBusiness() {}
+
+
+ public LineOfBusiness(String lineOfBusinessName) {
+ this.lineOfBusinessName = lineOfBusinessName;
+ }
+
+ public String getLineOfBusinessName() {
+ return lineOfBusinessName;
+ }
+
+ public void setLineOfBusinessName(String lineOfBusinessName) {
+ this.lineOfBusinessName = lineOfBusinessName;
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof LineOfBusiness)) {
+ return false;
+ }
+ LineOfBusiness castOther = (LineOfBusiness) other;
+ return new EqualsBuilder().append(lineOfBusinessName, castOther.lineOfBusinessName).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(lineOfBusinessName).toHashCode();
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Metadatum.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Metadatum.java
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 642417fa56..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,43 +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;
-
- @Id
- @JsonProperty("platform-name")
- private String platformName;
-
- public String getPlatformName() {
- return platformName;
- }
-
- public void setPlatformName(String platformName) {
- this.platformName = platformName;
- }
-
- @Override
- public boolean equals(final Object other) {
- if (!(other instanceof Platform)) {
- return false;
- }
- Platform castOther = (Platform) other;
- return new EqualsBuilder().append(platformName, castOther.platformName).isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(platformName).toHashCode();
- }
+ private static final long serialVersionUID = -9127507763010448699L;
+
+ @Id
+ @JsonProperty("platform-name")
+ private String platformName;
+
+ public Platform() {}
+
+
+ public Platform(String platformName) {
+ this.platformName = platformName;
+ }
+
+ public String getPlatformName() {
+ return platformName;
+ }
+
+ public void setPlatformName(String platformName) {
+ this.platformName = platformName;
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof Platform)) {
+ return false;
+ }
+ Platform castOther = (Platform) other;
+ return new EqualsBuilder().append(platformName, castOther.platformName).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(platformName).toHashCode();
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java
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 76b24caf09..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;
@@ -72,13 +71,13 @@ import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResource;
import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
+import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
-import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
@@ -96,1726 +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);
- VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization =
- findVnfVfmoduleCvnfcConfigurationCustomization(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(configurationResourceKeys.getVnfResourceCustomizationUUID(),
- configurationResourceKeys.getVfModuleCustomizationUUID(), configurationResourceKeys.getCvnfcCustomizationUUID());
- if (vnfVfmoduleCvnfcConfigurationCustomization != null){
- configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(vnfVfmoduleCvnfcConfigurationCustomization));
- }
- }
- }
-
- protected VnfVfmoduleCvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String vfModuleCustomizationUUID,
- String vnfResourceCustomizationUUID, String cvnfcCustomizationUUID, ConfigurationResourceCustomization configurationResourceCustomization) {
- if(configurationResourceCustomization != null && configurationResourceCustomization.getConfigurationResource() != null)
- for(VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization :
- configurationResourceCustomization.getConfigurationResource().getVnfVfmoduleCvnfcConfigurationCustomization()) {
- if(vnfVfmoduleCvnfcConfigurationCustomization.getVfModuleCustomization().getModelCustomizationUUID().equalsIgnoreCase(vfModuleCustomizationUUID)
- && vnfVfmoduleCvnfcConfigurationCustomization.getVnfResourceCustomization().getModelCustomizationUUID().equalsIgnoreCase(vnfResourceCustomizationUUID)
- && vnfVfmoduleCvnfcConfigurationCustomization.getCvnfcCustomization().getModelCustomizationUUID().equalsIgnoreCase(cvnfcCustomizationUUID)) {
- return vnfVfmoduleCvnfcConfigurationCustomization;
- }
- }
- return null;
- }
-
- protected ConfigurationResourceCustomization findConfigurationResourceCustomization(ModelInfo modelInfo, Service service) {
- for (ConfigurationResourceCustomization resourceCust : service.getConfigurationCustomizations()) {
- if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) {
- return resourceCust;
- }
- }
- return null;
- }
-
- protected VnfVfmoduleCvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String vnfResourceCustomizationUUID,
- String vfModuleCustomizationUUID, String cvnfcCustomizationUUID) {
- return bbInputSetupUtils.getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationIdnAndVfModuleCustomizationIdAndCvnfcCustomizationId(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.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 50a9c4e8b1..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;
@@ -74,6 +73,7 @@ import org.onap.so.db.catalog.beans.CollectionResource;
import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
+import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.InstanceGroupType;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
@@ -81,7 +81,6 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
-import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.RequestDetails;
import org.slf4j.Logger;
@@ -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,
- VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization) {
- ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
- modelInfoConfiguration.setModelVersionId(configurationResourceCustomization.getConfigurationResource().getModelUUID());
- modelInfoConfiguration.setModelCustomizationId(configurationResourceCustomization.getModelCustomizationUUID());
- modelInfoConfiguration.setModelInvariantId(configurationResourceCustomization.getConfigurationResource().getModelInvariantUUID());
- modelInfoConfiguration.setPolicyName(vnfVfmoduleCvnfcConfigurationCustomization.getPolicyName());
- return modelInfoConfiguration;
- }
-
- protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration(
- VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization) {
- ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
- modelInfoConfiguration.setModelVersionId(vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationResource().getModelUUID());
- modelInfoConfiguration.setModelCustomizationId(vnfVfmoduleCvnfcConfigurationCustomization.getModelCustomizationUUID());
- modelInfoConfiguration.setModelInvariantId(vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationResource().getModelInvariantUUID());
- modelInfoConfiguration.setPolicyName(vnfVfmoduleCvnfcConfigurationCustomization.getPolicyName());
- modelInfoConfiguration.setConfigurationType(vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationType());
- modelInfoConfiguration.setConfigurationRole(vnfVfmoduleCvnfcConfigurationCustomization.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 36a6bf37d9..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,14 +48,13 @@ 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;
+import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
-import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
@@ -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,385 +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 VnfVfmoduleCvnfcConfigurationCustomization getVnfVfmoduleCvnfcConfigurationCustomizationByActionAndIsALaCarteAndRequestScopeAndCloudOwner(String vnfCustomizationUuid,
- String vfModuleCustomizationUuid, String cvnfcCustomizationUuid) {
- return catalogDbClient.getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(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);
- }
- }
-
- public VnfVfmoduleCvnfcConfigurationCustomization getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationIdnAndVfModuleCustomizationIdAndCvnfcCustomizationId(
- String vnfResourceCustomizationUUID, String vfModuleCustomizationUUID, String cvnfcCustomizationUUID) {
- return catalogDbClient.getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(vnfResourceCustomizationUUID, vfModuleCustomizationUUID, cvnfcCustomizationUUID);
- }
+ 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 d2d321f8f4..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,108 +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, 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, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- result = lookupObjectInList(serviceInstance.getVnfs(), value);
- break;
- case NETWORK_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- result = lookupObjectInList(serviceInstance.getNetworks(), value);
- break;
- case VOLUME_GROUP_ID:
- vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
- result = lookupObjectInList(vnf.getVolumeGroups(), value);
- break;
- case VF_MODULE_ID:
- vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
- result = lookupObjectInList(vnf.getVfModules(), value);
- break;
- case ALLOTTED_RESOURCE_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- result = lookupObjectInList(serviceInstance.getAllottedResources(), value);
- break;
- case CONFIGURATION_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- result = lookupObjectInList(serviceInstance.getConfigurations(), value);
- break;
- case VPN_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- result = lookupObjectInList(gBBInput.getCustomer().getVpnBindings(), value);
- break;
- case VPN_BONDING_LINK_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- result = lookupObjectInList(serviceInstance.getVpnBondingLinks(),value);
- break;
- case INSTANCE_GROUP_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(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 8fae2816b2..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,152 +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:
- 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
new file mode 100644
index 0000000000..6bfa67502d
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java
@@ -0,0 +1,182 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 TechMahindra
+ * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.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;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput;
+import org.onap.so.client.PreconditionFailedException;
+import org.onap.so.client.RestPropertiesLoader;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.onap.so.client.exception.ExceptionBuilder;
+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;
+
+/**
+ * Util class to support Call to CDS client
+ *
+ */
+@Component
+public class AbstractCDSProcessingBBUtils implements CDSProcessingListener {
+
+ private static final Logger logger = LoggerFactory.getLogger(AbstractCDSProcessingBBUtils.class);
+
+ private static final String SUCCESS = "Success";
+ private static final String FAILED = "Failed";
+ private static final String PROCESSING = "Processing";
+
+ private final AtomicReference<String> cdsResponse = new AtomicReference<>();
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ /**
+ * Extracting data from execution object and building the ExecutionServiceInput Object
+ *
+ * @param execution DelegateExecution object
+ */
+ public void constructExecutionServiceInputObject(DelegateExecution execution) {
+ logger.trace("Start AbstractCDSProcessingBBUtils.preProcessRequest ");
+
+ try {
+ 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();
+
+ Builder struct = Struct.newBuilder();
+ try {
+ JsonFormat.parser().merge(payload, struct);
+ } catch (InvalidProtocolBufferException e) {
+ logger.error("Failed to parse received message. blueprint({}:{}) for action({}). {}",
+ executionObject.getBlueprintVersion(), executionObject.getBlueprintName(),
+ executionObject.getActionName(), e);
+ }
+
+ ExecutionServiceInput executionServiceInput =
+ ExecutionServiceInput.newBuilder().setCommonHeader(commonHeader)
+ .setActionIdentifiers(actionIdentifiers).setPayload(struct.build()).build();
+
+ execution.setVariable("executionServiceInput", executionServiceInput);
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * get the executionServiceInput object from execution and send a request to CDS Client and wait for TIMEOUT period
+ *
+ * @param execution DelegateExecution object
+ */
+ public void sendRequestToCDSClient(DelegateExecution execution) {
+
+ logger.trace("Start AbstractCDSProcessingBBUtils.sendRequestToCDSClient ");
+ try {
+ CDSProperties props = RestPropertiesLoader.getInstance().getNewImpl(CDSProperties.class);
+ if (props == null) {
+ throw new PreconditionFailedException(
+ "No RestProperty.CDSProperties implementation found on classpath, can't create client.");
+ }
+
+ ExecutionServiceInput executionServiceInput =
+ (ExecutionServiceInput) execution.getVariable("executionServiceInput");
+
+ try (CDSProcessingClient cdsClient = new CDSProcessingClient(this)) {
+ CountDownLatch countDownLatch = cdsClient.sendRequest(executionServiceInput);
+ countDownLatch.await(props.getTimeout(), TimeUnit.SECONDS);
+ } catch (InterruptedException ex) {
+ logger.error("Caught exception in sendRequestToCDSClient in AbstractCDSProcessingBBUtils : ", ex);
+ Thread.currentThread().interrupt();
+ }
+
+ if (cdsResponse != null) {
+ execution.setVariable("CDSStatus", cdsResponse.get());
+ }
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * Get Response from CDS Client
+ *
+ */
+ @Override
+ public void onMessage(ExecutionServiceOutput message) {
+ logger.info("Received notification from CDS: {}", message);
+ EventType eventType = message.getStatus().getEventType();
+
+ 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;
+ }
+
+ }
+
+ /**
+ * On error at CDS, log the error
+ */
+ @Override
+ public void onError(Throwable t) {
+ Status status = Status.fromThrowable(t);
+ logger.error("Failed processing blueprint {}", status, t);
+ }
+
+}
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
new file mode 100644
index 0000000000..2e84f384dc
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java
@@ -0,0 +1,89 @@
+package org.onap.so.client.cds.beans;
+
+import java.io.Serializable;
+
+public class AbstractCDSPropertiesBean implements Serializable {
+
+ private static final long serialVersionUID = -4800522372460352963L;
+
+ private String blueprintName;
+
+ private String blueprintVersion;
+
+ private String requestObject;
+
+ private String originatorId;
+
+ private String requestId;
+
+ private String subRequestId;
+
+ private String actionName;
+
+ private String mode;
+
+ 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 getRequestObject() {
+ return requestObject;
+ }
+
+ public void setRequestObject(String requestObject) {
+ this.requestObject = requestObject;
+ }
+
+ public String getOriginatorId() {
+ return originatorId;
+ }
+
+ public void setOriginatorId(String originatorId) {
+ this.originatorId = originatorId;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public String getSubRequestId() {
+ return subRequestId;
+ }
+
+ public void setSubRequestId(String subRequestId) {
+ this.subRequestId = subRequestId;
+ }
+
+ public String getActionName() {
+ return actionName;
+ }
+
+ public void setActionName(String actionName) {
+ this.actionName = actionName;
+ }
+
+ public String getMode() {
+ return 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
new file mode 100644
index 0000000000..cb0b5663e6
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java
@@ -0,0 +1,105 @@
+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"})
+
+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();
+ }
+
+}
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
new file mode 100644
index 0000000000..bd894e3e7f
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java
@@ -0,0 +1,105 @@
+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"})
+
+public class ConfigAssignPropertiesForVnf {
+
+ @JsonProperty("service-instance-id")
+ private String serviceInstanceId;
+
+ @JsonProperty("vnf-id")
+ private String vnfId;
+
+ @JsonProperty("vnf-name")
+ private String vnfName;
+
+ @JsonProperty("service-model-uuid")
+ private String serviceModelUuid;
+
+ @JsonProperty("vnf-customization-uuid")
+ private String vnfCustomizationUuid;
+
+ @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 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 getServiceModelUuid() {
+ return serviceModelUuid;
+ }
+
+ public void setServiceModelUuid(String serviceModelUuid) {
+ this.serviceModelUuid = serviceModelUuid;
+ }
+
+ public String getVnfCustomizationUuid() {
+ return vnfCustomizationUuid;
+ }
+
+ public void setVnfCustomizationUuid(String vnfCustomizationUuid) {
+ this.vnfCustomizationUuid = vnfCustomizationUuid;
+ }
+
+ 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(", \"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("\"");
+ 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/ConfigAssignRequestPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java
new file mode 100644
index 0000000000..33b7187ac8
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java
@@ -0,0 +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"})
+
+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();
+ }
+
+}
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
new file mode 100644
index 0000000000..8512c4017f
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java
@@ -0,0 +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"})
+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();
+ }
+
+}
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
new file mode 100644
index 0000000000..a9a3b0db15
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java
@@ -0,0 +1,111 @@
+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({"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("pnf-id")
+ private String pnfId;
+
+ @JsonProperty("pnf-name")
+ private String pnfName;
+
+ /**
+ * Config Deploy require IP address of PNF.
+ */
+ @JsonProperty("pnf-ipv4-address")
+ private String pnfIpV4Address;
+
+ @JsonProperty("pnf-ipv6-address")
+ private String pnfIpV6Address;
+
+ @JsonProperty("service-model-uuid")
+ private String serviceModelUuid;
+
+ @JsonProperty("pnf-customization-uuid")
+ private String pnfCustomizationUuid;
+
+ 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 String getPnfIpV4Address() {
+ return pnfIpV4Address;
+ }
+
+ public void setPnfIpV4Address(String pnfIpV4Address) {
+ this.pnfIpV4Address = pnfIpV4Address;
+ }
+
+ public String getPnfIpV6Address() {
+ return pnfIpV6Address;
+ }
+
+ public void setPnfIpV6Address(String pnfIpV6Address) {
+ this.pnfIpV6Address = pnfIpV6Address;
+ }
+
+
+ @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("\"");
+
+ sb.append('}');
+
+ 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
new file mode 100644
index 0000000000..a3ac91ab9d
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java
@@ -0,0 +1,81 @@
+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({"service-instance-id", "vnf-id", "vnf-name", "service-model-uuid", "vnf-customization-uuid"})
+public class ConfigDeployPropertiesForVnf {
+
+ @JsonProperty("service-instance-id")
+ private String serviceInstanceId;
+
+ @JsonProperty("vnf-id")
+ private String vnfId;
+
+ @JsonProperty("vnf-name")
+ private String vnfName;
+
+ @JsonProperty("service-model-uuid")
+ private String serviceModelUuid;
+
+ @JsonProperty("vnf-customization-uuid")
+ private String vnfCustomizationUuid;
+
+ 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 getVnfName() {
+ return vnfName;
+ }
+
+ public void setVnfName(String vnfName) {
+ this.vnfName = vnfName;
+ }
+
+ public String getServiceModelUuid() {
+ return serviceModelUuid;
+ }
+
+ public void setServiceModelUuid(String serviceModelUuid) {
+ this.serviceModelUuid = serviceModelUuid;
+ }
+
+ public String getVnfCustomizationUuid() {
+ return vnfCustomizationUuid;
+ }
+
+ public void setVnfCustomizationUuid(String vnfCustomizationUuid) {
+ this.vnfCustomizationUuid = vnfCustomizationUuid;
+ }
+
+ @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("\"");
+
+ sb.append('}');
+
+ 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
new file mode 100644
index 0000000000..817729ba4f
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java
@@ -0,0 +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-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();
+ }
+
+}
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
new file mode 100644
index 0000000000..c5fc0307b2
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java
@@ -0,0 +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-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();
+ }
+
+}
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 1967e5a1ce..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
@@ -30,6 +30,7 @@ public class CDSPropertiesImpl implements CDSProperties {
private static final String ENDPOINT = "cds.endpoint";
private static final String PORT = "cds.port";
private static final String AUTH = "cds.auth";
+ private static final String TIMEOUT = "cds.timeout";
public CDSPropertiesImpl() {
// Needed for service loader
@@ -74,4 +75,9 @@ public class CDSPropertiesImpl implements CDSProperties {
public boolean mapNotFoundToEmpty() {
return false;
}
+
+ @Override
+ 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/main/resources/subprocess/SDNCAdapterRestV1.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV1.bpmn
index 7a9a7f8308..e2da44d272 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV1.bpmn
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV1.bpmn
@@ -10,8 +10,7 @@ def statusCode = execution.getVariable('SDNCREST_sdncAdapterStatusCode')
String response = String.valueOf(execution.getVariable('SDNCREST_sdncAdapterResponse'))
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def processKey = sdncAdapterRestV1.getProcessKey(execution)
-sdncAdapterRestV1.logDebug(processKey + " received response from SDNCAdapter: statusCode=" + statusCode +
- " response=" + (response.isEmpty() ? "" : "\n") + response, isDebugLogEnabled)</bpmn2:script>
+sdncAdapterRestV1.getLogger().debug("{} received response from SDNCAdapter: statusCode= {} response={}", processKey, statusCode, (response.isEmpty() ? "" : "\n" + response))</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:scriptTask id="ScriptTask_3" name="Workflow Exception (no connection)" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_17</bpmn2:incoming>
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV2.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV2.bpmn
index cee6e43f93..a262801005 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV2.bpmn
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV2.bpmn
@@ -11,8 +11,7 @@ def statusCode = execution.getVariable('SDNCREST_sdncAdapterStatusCode')
String response = String.valueOf(execution.getVariable('SDNCREST_sdncAdapterResponse'))
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def processKey = sdncAdapterRestV2.getProcessKey(execution)
-sdncAdapterRestV2.logDebug(processKey + " received response from SDNCAdapter: statusCode=" + statusCode +
- " response=" + (response.isEmpty() ? "" : "\n") + response, isDebugLogEnabled)</bpmn2:script>
+sdncAdapterRestV2.getLogger().debug("{} received response from SDNCAdapter: statusCode= {} response={}", processKey, statusCode, (response.isEmpty() ? "" : "\n" + response))</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:scriptTask id="ScriptTask_3" name="Workflow Exception (no connection)" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_17</bpmn2:incoming>
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn
index cdd710d102..db93df9f09 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn
@@ -10,8 +10,7 @@ def statusCode = execution.getVariable('VNFREST_vnfAdapterStatusCode')
String response = String.valueOf(execution.getVariable('VNFREST_vnfAdapterResponse'))
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def processKey = vnfAdapterRestV1.getProcessKey(execution)
-vnfAdapterRestV1.logDebug(processKey + " received response from VnfAdapter: statusCode=" + statusCode +
- " response=" + (response.isEmpty() ? "" : "\n") + response, isDebugLogEnabled)]]></bpmn2:script>
+vnfAdapterRestV1.getLogger().debug("{} received response from VnfAdapter: statusCode= {} response={}", processKey, statusCode, (response.isEmpty() ? "" : "\n" + response))]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:scriptTask id="ScriptTask_3" name="Workflow Exception (no connection)">
<bpmn2:incoming>SequenceFlow_17</bpmn2:incoming>
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
index d6a7cf0634..d7438f80f9 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Nokia.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -51,7 +53,6 @@ class CatalogDbUtilsTest {
private static final String RESPONSE_FROM_CATALOG_DB = "{\"serviceVnfs\": [{\"name\": \"service1\"," +
"\"vfModules\": [{\"name\": \"module1\", \"isBase\":true, \"initialCount\":1}]}]}"
private HttpClientFactory httpClientFactoryMock
- private MsoUtils msoUtilsMock
private JsonUtils jsonUtilsMock
private HttpClient httpClientMock
private DelegateExecutionFake executionFake
@@ -61,11 +62,10 @@ class CatalogDbUtilsTest {
@Before
void setUp() {
httpClientFactoryMock = mock(HttpClientFactory.class)
- msoUtilsMock = mock(MsoUtils.class)
jsonUtilsMock = mock(JsonUtils.class)
httpClientMock = mock(HttpClient.class)
executionFake = new DelegateExecutionFake()
- testedObject = new CatalogDbUtils(httpClientFactoryMock, msoUtilsMock, jsonUtilsMock)
+ testedObject = new CatalogDbUtils(httpClientFactoryMock, jsonUtilsMock)
}
@Test
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy
index 21441b9b73..9a778a7380 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy
@@ -34,15 +34,12 @@ import org.mockito.ArgumentCaptor
import org.mockito.Captor
import org.mockito.MockitoAnnotations
import org.mockito.runners.MockitoJUnitRunner
-import org.onap.so.bpmn.mock.StubResponseAAI
import static org.mockito.Mockito.*
@RunWith(MockitoJUnitRunner.class)
@Ignore
class PrepareUpdateAAIVfModuleTest {
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(28090)
@Captor
static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy
index 51dd77d383..570acf4524 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy
@@ -53,12 +53,7 @@ public class SDNCAdapterUtilsTest {
map = new HashMap<String,Object>()
svcex = mock(ExecutionEntity.class)
wfex = null
- tp = new AbstractServiceTaskProcessor() {
- @Override
- public void preProcessRequest(DelegateExecution execution) {
- }
- };
- utils = new SDNCAdapterUtils(tp)
+ utils = new SDNCAdapterUtils()
// svcex gets its variables from "map"
when(svcex.getVariable(any())).thenAnswer(
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1Test.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1Test.groovy
index b093aaa491..e3942f0d2e 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1Test.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1Test.groovy
@@ -70,9 +70,6 @@ class SniroHomingV1Test {
serviceDecomp.setVnfResources(vnfResourceList)
}
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(28090)
-
@Captor
static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy
index 2bd5181c31..12c437fc0a 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy
@@ -37,7 +37,6 @@ import org.mockito.MockitoAnnotations
import org.mockito.runners.MockitoJUnitRunner
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.mock.FileUtil
-import org.onap.so.bpmn.mock.StubResponseAAI
import static com.github.tomakehurst.wiremock.client.WireMock.*
import static org.mockito.ArgumentMatchers.any
@@ -49,8 +48,6 @@ import static org.mockito.Mockito.*
class UpdateAAIGenericVnfTest {
String getVfModuleResponse = FileUtil.readResourceFile("__files/VfModularity/GenericVnf.xml")
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(28090)
@Captor
static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy
index 72bcfcf359..99b178c044 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy
@@ -50,9 +50,6 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest {
@Spy
UpdateAAIVfModule updateAAIVfModule;
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(28090)
-
@Captor
static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy
index afc180e8a4..75ddca5e98 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy
@@ -85,6 +85,7 @@ public class VnfAdapterRestV1Test {
<volumeGroupId>8a07b246-155e-4b08-b56e-76e98a3c2d66</volumeGroupId>
<volumeGroupStackId>phmaz401me6-vpevre-VOLUMEGROUP/dbd560b6-b03f-4a17-92e7-8942459a60c1</volumeGroupStackId>
<cloudSiteId>mtrnj1b</cloudSiteId>
+ <cloudOwnerId>CloudOwner</cloudOwnerId>
<tenantId>cfb5e0a790374c9a98a1c0d2044206a7</tenantId>
<volumeGroupCreated>true</volumeGroupCreated>
<msoRequest>
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 5d6f98c907..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;
@@ -41,20 +40,19 @@ import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.test.categories.SpringAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
import org.springframework.http.HttpHeaders;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
-
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.github.tomakehurst.wiremock.client.WireMock;
+import com.github.tomakehurst.wiremock.WireMockServer;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@@ -63,85 +61,86 @@ import com.github.tomakehurst.wiremock.client.WireMock;
@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;
- /*
- * Mocked for injection via autowiring
- */
-
- @Value("${mso.catalog.db.spring.endpoint}")
- protected String endpoint;
-
- @Value("${wiremock.server.port}")
- protected String wireMockPort;
-
- @MockBean
- protected CatalogDbClient MOCK_catalogDbClient;
-
- @SpyBean
- protected InjectionHelper MOCK_injectionHelper;
-
- @SpyBean
- protected ExceptionBuilder exceptionUtil;
-
- /*
- * Classes that cannot be simply mocked because they are both
- * needed for testing another class, and must be autowired when
- * being tested themselves....or classes with private methods that
- * must be stubbed during testing
- */
-
- @SpyBean
- protected BBInputSetupMapperLayer SPY_bbInputSetupMapperLayer;
- @SpyBean
- protected BBInputSetupUtils SPY_bbInputSetupUtils;
- @SpyBean
- protected BBInputSetup SPY_bbInputSetup;
-
- /*
- * Mocked for injection via the IntectionHelper
- */
-
-
-
- @Before
- public void baseTestBefore() {
- WireMock.reset();
- variables.put("gBuildingBlockExecution", execution);
- }
-
- @LocalServerPort
- private int port;
-
- protected String readFile(String path) throws IOException {
- return readFile(path, Charset.defaultCharset());
- }
-
- protected String readFile(String path, Charset encoding) throws IOException {
- byte[] encoded = Files.readAllBytes(Paths.get(path));
- return new String(encoded, encoding);
- }
-
- protected String readJsonFileAsString(String fileLocation) throws IOException{
- ObjectMapper mapper = new ObjectMapper();
- JsonNode jsonNode = mapper.readTree(new File(fileLocation));
- return jsonNode.asText();
- }
-
- protected String createURLWithPort(String uri) {
- return "http://localhost:" + port + uri;
- }
-
+
+
+ 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 d5b5cde99b..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, execution.getLookupMap().get(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, execution.getLookupMap().get(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, execution.getLookupMap().get(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, execution.getLookupMap().get(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, execution.getLookupMap().get(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, execution.getLookupMap().get(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, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- } catch(BBObjectNotFoundException e) {
- serviceInstance = setServiceInstance();
- }
-
- serviceInstance.getVpnBondingLinks().add(vpnBondingLink);
- lookupKeyMap.put(ResourceKey.VPN_BONDING_LINK_ID, vpnBondingLink.getVpnBondingLinkId());
-
-
- return vpnBondingLink;
- }
-
- public Customer setAvpnCustomer() {
- Customer customer = buildCustomer();
-
- gBBInput.setCustomer(customer);
-
- return customer;
- }
-
- public ServiceProxy setServiceProxy(String uniqueIdentifier, String type) {
- ServiceProxy serviceProxy = new ServiceProxy();
- serviceProxy.setId("testProxyId" + uniqueIdentifier);
- serviceProxy.setType(type);
-
- ModelInfoServiceProxy modelInfo = new ModelInfoServiceProxy();
- modelInfo.setModelInvariantUuid("testProxyModelInvariantUuid" + uniqueIdentifier);
- modelInfo.setModelName("testProxyModelName" + uniqueIdentifier);
- modelInfo.setModelUuid("testProxyModelUuid" + uniqueIdentifier);
- modelInfo.setModelVersion("testProxyModelVersion" + uniqueIdentifier);
- modelInfo.setModelInstanceName("testProxyInstanceName" + uniqueIdentifier);
-
- serviceProxy.setModelInfoServiceProxy(modelInfo);
-
- return serviceProxy;
- }
-
- public AllottedResource setAllottedResource(String uniqueIdentifier) {
- AllottedResource ar = new AllottedResource();
- ar.setId("testAllottedResourceId" + uniqueIdentifier);
-
- ModelInfoAllottedResource modelInfo = new ModelInfoAllottedResource();
- modelInfo.setModelInvariantUuid("testAllottedModelInvariantUuid" + uniqueIdentifier);
- modelInfo.setModelName("testAllottedModelName" + uniqueIdentifier);
- modelInfo.setModelUuid("testAllottedModelUuid" + uniqueIdentifier);
- modelInfo.setModelVersion("testAllottedModelVersion" + uniqueIdentifier);
- modelInfo.setModelInstanceName("testAllottedInstanceName" + uniqueIdentifier);
-
- ar.setModelInfoAllottedResource(modelInfo);
-
- return ar;
- }
-
- 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, execution.getLookupMap().get(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 32a18d5a7a..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
@@ -20,22 +20,16 @@
package org.onap.so.bpmn.common;
-import static org.hamcrest.CoreMatchers.hasItems;
-import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
-import static org.mockito.ArgumentMatchers.contains;
+import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
-
import java.io.Serializable;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.hamcrest.collection.IsIterableContainingInOrder;
import org.junit.Rule;
@@ -45,102 +39,115 @@ 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;
public class DelegateExecutionImplTest {
- @Rule
- public ExpectedException thrown= ExpectedException.none();
-
-
- @Test
- public void getVariable() throws RequiredExecutionVariableExeception {
- Map<String, Serializable> map = new HashMap<>();
- map.put("var1", "value1");
- map.put("var2", "value2");
- map.put("list1", (Serializable)Arrays.asList("value1", "value2"));
- DelegateExecutionImpl impl = create(map);
-
- assertEquals("value1", impl.getVariable("var1"));
- assertEquals("value2", impl.getRequiredVariable("var2"));
- assertThat(impl.getVariable("list1"), IsIterableContainingInOrder.contains("value1", "value2"));
-
- }
-
-
- @Test
- public void getRequiredVariableNotFound() throws RequiredExecutionVariableExeception {
- DelegateExecutionImpl impl = create();
-
- thrown.expect(RequiredExecutionVariableExeception.class);
- impl.getRequiredVariable("var1");
- }
-
-
- @Test
- public void setVariable() {
- DelegateExecutionImpl impl = create();
- impl.setVariable("var1", "value1");
-
- assertEquals("value1", impl.get("var1"));
- }
-
- @Test
- public void getGeneralBuildingBlock() {
- GeneralBuildingBlock gBB = mock(GeneralBuildingBlock.class);
- Map<String, Serializable> map = new HashMap<>();
- map.put("gBBInput", gBB);
- DelegateExecutionImpl impl = create(map);
-
- assertEquals(gBB, impl.getGeneralBuildingBlock());
- }
-
- @Test
- public void getGeneralBuildingBlockNotFound() {
-
- DelegateExecutionImpl impl = create();
-
- thrown.expect(MissingBuildingBlockInputException.class);
- impl.getGeneralBuildingBlock();
- }
-
- @Test
- public void getGeneralBuildingBlockCastException() {
- Map<String, Serializable> map = new HashMap<>();
- map.put("gBBInput", new DelegateExecutionFake());
- DelegateExecutionImpl impl = create(map);
-
- thrown.expect(MalformedBuildingBlockInputException.class);
- impl.getGeneralBuildingBlock();
- }
-
- @Test
- public void getDelegateExecution() {
- DelegateExecutionImpl impl = create();
-
- assertNotNull(impl.getDelegateExecution());
- }
-
- @Test
- public void getLookupMap() {
- Map<String, Serializable> lookup = new HashMap<>();
- Map<String, Serializable> map = new HashMap<>();
- map.put("lookupKeyMap", (Serializable) lookup);
- DelegateExecutionImpl impl = create(map);
-
- assertEquals(lookup, impl.getLookupMap());
- }
-
- private DelegateExecutionImpl create() {
- return create(new HashMap<String, Serializable>());
- }
-
- private DelegateExecutionImpl create(Map<String, Serializable> map) {
- DelegateExecutionFake fake = new DelegateExecutionFake();
-
- for (Entry<String, Serializable> entry : map.entrySet()) {
- fake.setVariable(entry.getKey(), entry.getValue());
- }
- return new DelegateExecutionImpl(fake);
- }
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+
+ @Test
+ public void getVariable() throws RequiredExecutionVariableExeception {
+ final Map<String, Serializable> map = new HashMap<>();
+ map.put("var1", "value1");
+ map.put("var2", "value2");
+ map.put("list1", (Serializable) Arrays.asList("value1", "value2"));
+ final DelegateExecutionImpl impl = create(map);
+
+ assertEquals("value1", impl.getVariable("var1"));
+ assertEquals("value2", impl.getRequiredVariable("var2"));
+ assertThat(impl.getVariable("list1"), IsIterableContainingInOrder.contains("value1", "value2"));
+
+ }
+
+
+ @Test
+ public void getRequiredVariableNotFound() throws RequiredExecutionVariableExeception {
+ final DelegateExecutionImpl impl = create();
+
+ thrown.expect(RequiredExecutionVariableExeception.class);
+ impl.getRequiredVariable("var1");
+ }
+
+
+ @Test
+ public void setVariable() {
+ final DelegateExecutionImpl impl = create();
+ impl.setVariable("var1", "value1");
+
+ assertEquals("value1", impl.get("var1"));
+ }
+
+ @Test
+ public void getGeneralBuildingBlock() {
+ final GeneralBuildingBlock gBB = mock(GeneralBuildingBlock.class);
+ final Map<String, Serializable> map = new HashMap<>();
+ map.put("gBBInput", gBB);
+ final DelegateExecutionImpl impl = create(map);
+
+ assertEquals(gBB, impl.getGeneralBuildingBlock());
+ }
+
+ @Test
+ public void getGeneralBuildingBlockNotFound() {
+ final DelegateExecutionImpl impl = create();
+ thrown.expect(MissingBuildingBlockInputException.class);
+ impl.getGeneralBuildingBlock();
+ }
+
+ @Test
+ public void getGeneralBuildingBlockCastException() {
+ final Map<String, Serializable> map = new HashMap<>();
+ map.put("gBBInput", new DelegateExecutionFake());
+ final DelegateExecutionImpl impl = create(map);
+
+ thrown.expect(MalformedBuildingBlockInputException.class);
+ impl.getGeneralBuildingBlock();
+ }
+
+ @Test
+ public void getDelegateExecution() {
+ final DelegateExecutionImpl impl = create();
+
+ assertNotNull(impl.getDelegateExecution());
+ }
+
+ @Test
+ public void getLookupMap() {
+ final Map<String, Serializable> lookup = new HashMap<>();
+ final Map<String, Serializable> map = new HashMap<>();
+ map.put("lookupKeyMap", (Serializable) lookup);
+ final DelegateExecutionImpl impl = create(map);
+
+ assertEquals(lookup, impl.getLookupMap());
+ }
+
+ @Test
+ public void testDelegateExecutionImpl_serializeDelegateExecutionImplObject_shouldNotThrowAnyExceptionWhenSerializing() {
+ final DelegateExecutionImpl objectUnderTest = create();
+
+ try {
+ final ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper.writeValueAsString(objectUnderTest);
+ } catch (final JsonProcessingException e) {
+ fail("Should be possible to serialize DelegateExecutionImpl object");
+ }
+
+ }
+
+ private DelegateExecutionImpl create() {
+ return create(new HashMap<String, Serializable>());
+ }
+
+ private DelegateExecutionImpl create(final Map<String, Serializable> map) {
+ final DelegateExecutionFake fake = new DelegateExecutionFake();
+
+ for (final Entry<String, Serializable> entry : map.entrySet()) {
+ fake.setVariable(entry.getKey(), entry.getValue());
+ }
+ return new DelegateExecutionImpl(fake);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java
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 819962f16c..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
@@ -22,18 +22,17 @@ package org.onap.so.bpmn.common;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import com.github.tomakehurst.wiremock.WireMockServer;
public class MockAAIDeleteGenericVnf {
- public MockAAIDeleteGenericVnf(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/[?]resource-version=0000018"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
- }
+ 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 9cb10a0494..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
@@ -23,31 +23,31 @@ package org.onap.so.bpmn.common;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.delete;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import com.github.tomakehurst.wiremock.WireMockServer;
public class MockAAIDeleteVfModule {
-
- public MockAAIDeleteVfModule()
- {
- stubFor(delete(urlMatching(
- "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73/[?]resource-version=0000073"))
- .willReturn(aResponse().withStatus(200)));
- stubFor(delete(urlMatching(
- "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a75/[?]resource-version=0000075"))
- .willReturn(aResponse().withStatus(200)));
- stubFor(delete(urlMatching(
- "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a78/[?]resource-version=0000078"))
- .willReturn(aResponse().withStatus(200)));
- stubFor(delete(urlMatching(
- "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a77/[?]resource-version=0000077"))
- .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*"))
- .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml")));
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
- .willReturn(aResponse().withStatus(200)));
- }
+ 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 b46d528cc5..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
@@ -22,319 +22,220 @@ package org.onap.so.bpmn.common;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import com.github.tomakehurst.wiremock.WireMockServer;
public class MockAAIGenericVnfSearch {
-
- private static final String EOL = "\n";
- public MockAAIGenericVnfSearch(){
- String body;
-
- // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1"))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBody("Generic VNF Not Found")));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBody("Generic VNF Not Found")));
-
- body =
- "<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;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<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;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- // The following stubs are for DeleteAAIVfModule
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBody("Generic VNF Not Found")));
-
- body =
- "<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;
- 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;
- 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;
- 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;
- 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;
- 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 f84a76468f..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,43 +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 static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-
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());
- 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());
- 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 85507afd3f..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
@@ -20,38 +20,34 @@
package org.onap.so.bpmn.common.recipe;
+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.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;
-import java.io.IOException;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.*;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-public class BpmnRestClientTest extends BaseTest{
+public class BpmnRestClientTest extends BaseTest {
@Autowired
private BpmnRestClient bpmnRestClient;
@Test
- public void postTest() throws IOException, Exception{
- stubFor(post(urlPathMatching("/testRecipeUri"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(org.springframework.http.HttpStatus.OK.value()).withBody("{}")));
+ 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("{}")));
- 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 ddca319708..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
@@ -19,23 +19,15 @@
*/
package org.onap.so.bpmn.common.resource;
+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 static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
-import org.junit.Rule;
import org.junit.Test;
-import org.mockito.Mock;
import org.onap.so.BaseTest;
-import org.onap.so.bpmn.core.UrnPropertiesReader;
-import org.springframework.core.env.Environment;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.*;
public class ResourceRequestBuilderTest extends BaseTest {
@@ -45,362 +37,283 @@ public class ResourceRequestBuilderTest extends BaseTest {
- 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 {
- 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 {
- 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 {
- 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");
@@ -409,27 +322,22 @@ public class ResourceRequestBuilderTest extends BaseTest {
@Test
public void getResourceInputWithEmptyServiceResourcesTest() throws Exception {
- 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/MockResource.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java
deleted file mode 100644
index b9a413fc96..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Response;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-
-/**
- *
- * Mock Resource which is used to start, stop the WireMock Server
- * Also up to 50 mock properties can be added at run-time to change the properties used in transformers such as sdnc_delay in SDNCAdapterMockTransformer
- * You can also selectively setup a stub (use reset before setting up), reset all stubs
- */
-@Path("/server")
-public class MockResource {
-
- private boolean started = false;
- private final Integer defaultPort = 28090;
- private WireMockServer wireMockServer = null;
- private static Map<String,String> mockProperties = new HashMap<>();
-
- public static String getMockProperties(String key) {
- return mockProperties.get(key);
- }
-
- private synchronized void initMockServer(int portNumber) {
- String path = "src/test/resources/" + "__files/sdncSimResponse.xml";
- path = path.substring(0,path.indexOf("__files/"));
-
- wireMockServer = new WireMockServer(wireMockConfig().port(portNumber).extensions("org.onap.so.bpmn.mock.SDNCAdapterMockTransformer")
- .extensions("org.onap.so.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer")
- .extensions("org.onap.so.bpmn.mock.VnfAdapterCreateMockTransformer")
- .extensions("org.onap.so.bpmn.mock.VnfAdapterDeleteMockTransformer")
- .extensions("org.onap.so.bpmn.mock.VnfAdapterUpdateMockTransformer")
- .extensions("org.onap.so.bpmn.mock.VnfAdapterRollbackMockTransformer")
- .extensions("org.onap.so.bpmn.mock.VnfAdapterQueryMockTransformer"));
- //.withRootDirectory(path));
- //Mocks were failing - commenting out for now, both mock and transformers seem to work fine
- WireMock.configureFor("localhost", portNumber);
- wireMockServer.start();
-// StubResponse.setupAllMocks();
- started= true;
- }
-
- public static void main(String [] args) {
- MockResource mockresource = new MockResource();
- mockresource.start(28090);
- mockresource.reset();
-// mockresource.setupStub("MockCreateTenant");
- }
-
- /**
- * Starts the wiremock server in default port
- * @return
- */
- @GET
- @Path("/start")
- @Produces("application/json")
- public Response start() {
- return startMockServer(defaultPort);
- }
-
- private Response startMockServer(int port) {
- if (!started) {
- initMockServer(defaultPort);
- System.out.println("Started Mock Server in port " + port);
- return Response.status(200).entity("Started Mock Server in port " + port).build();
- } else {
- return Response.status(200).entity("Mock Server is already running").build();
- }
- }
-
- /**
- * Starts the wiremock server in a different port
- * @param portNumber
- * @return
- */
- @GET
- @Path("/start/{portNumber}")
- @Produces("application/json")
- public Response start(@PathParam("portNumber") Integer portNumber) {
- if (portNumber == null) portNumber = defaultPort;
- return startMockServer(portNumber);
- }
-
-
- /**
- * Stop the wiremock server
- * @return
- */
- @GET
- @Path("/stop")
- @Produces("application/json")
- public synchronized Response stop() {
- if (wireMockServer.isRunning()) {
- wireMockServer.stop();
- started = false;
- return Response.status(200).entity("Stopped Mock Server in port ").build();
- }
- return Response.status(200).entity("Mock Server is not running").build();
- }
-
-
- /**
- * Return list of mock properties
- * @return
- */
- @GET
- @Path("/properties")
- @Produces("application/json")
- public Response getProperties() {
- return Response.status(200).entity(mockProperties).build();
- }
-
- /**
- * Update a particular mock property at run-time
- * @param name
- * @param value
- * @return
- */
- @POST
- @Path("/properties/{name}/{value}")
- public Response updateProperties(@PathParam("name") String name, @PathParam("value") String value) {
- if (mockProperties.size() > 50) return Response.serverError().build();
- mockProperties.put(name, value);
- return Response.status(200).build();
- }
-
- /**
- * Reset all stubs
- * @return
- */
- @GET
- @Path("/reset")
- @Produces("application/json")
- public Response reset() {
- WireMock.reset();
- return Response.status(200).entity("Wiremock stubs are reset").build();
- }
-
-
- /**
- * Setup a stub selectively
- * Prior to use, make sure that stub method is available in StubResponse class
- * @param methodName
- * @return
- */
-
- // commenting for now until we figure out a way to use new StubResponse classes to setupStubs
-// @GET
-// @Path("/stub/{methodName}")
-// @Produces("application/json")
-// public Response setupStub(@PathParam("methodName") String methodName) {
-//
-// @SuppressWarnings("rawtypes")
-// Class params[] = {};
-// Object paramsObj[] = {};
-//
-// try {
-// Method thisMethod = StubResponse.class.getDeclaredMethod(methodName, params);
-// try {
-// thisMethod.invoke(StubResponse.class, paramsObj);
-// } catch (IllegalAccessException | IllegalArgumentException
-// | InvocationTargetException e) {
-// return Response.status(200).entity("Error invoking " + methodName ).build();
-// }
-// } catch (NoSuchMethodException | SecurityException e) {
-// return Response.status(200).entity("Stub " + methodName + " not found...").build();
-// }
-// return Response.status(200).entity("Successfully invoked " + methodName).build();
-// }
-
-
- public static Map<String,String> getMockProperties(){
- return mockProperties;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java
deleted file mode 100644
index 6c62920781..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.ws.rs.ApplicationPath;
-import javax.ws.rs.core.Application;
-
-import org.junit.Ignore;
-
-/**
- *
- * JAX RS Application wiring for Mock Resource
- */
-@ApplicationPath("/console")
-@Ignore
-public class MockResourceApplication extends Application {
-
- private Set<Object> singletons = new HashSet<>();
- private Set<Class<?>> classes = new HashSet<>();
-
- public MockResourceApplication() {
- singletons.add(new MockResource());
- }
-
- @Override
- public Set<Class<?>> getClasses() {
- return classes;
- }
-
- @Override
- public Set<Object> getSingletons() {
- return singletons;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java
deleted file mode 100644
index 8515307394..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.BinaryFile;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-
-/**
- *
- * Simulates SDNC Adapter Callback response
- *
- */
-public class SDNCAdapterAsyncTransformer extends ResponseDefinitionTransformer {
-
- private String syncResponse;
- private String callbackResponseWrapper;
-
- public SDNCAdapterAsyncTransformer() {
- syncResponse = FileUtil.readResourceFile("__files/StandardSDNCSynchResponse.xml");
- callbackResponseWrapper = FileUtil.readResourceFile("__files/sdncCallbackSoapWrapper.xml");
- }
-
- @Override
- public String getName() {
- return "sdnc-adapter-vf-module-assign";
- }
-
- /**
- * Grab the incoming request xml,extract the request id and replace the stub response with the incoming request id
- * so that callback response can be correlated
- *
- * Mock Resource can be used to add dynamic properties. If sdnc_delay is not in the list by default waits for 300ms before
- * the callback response is sent
- */
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>"));
- String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>"));
-
- System.out.println("responseDefinition: " + responseDefinition);
-
- // For this mock, the mapped response body is the Async callback (since the sync response is generic for all requests)
- String sdncResponse = responseDefinition.getBody();
- System.out.println("sdncResponse:" + sdncResponse);
-
- if (sdncResponse == null) {
- // Body wasn't specified. Check for a body file
- String bodyFileName = responseDefinition.getBodyFileName();
- System.out.println("bodyFileName" + bodyFileName);
- if (bodyFileName != null) {
- System.out.println("fileSource Class: " + fileSource.getClass().getName());
- BinaryFile bodyFile = fileSource.getBinaryFileNamed(bodyFileName);
- byte[] responseFile = bodyFile.readContents();
- sdncResponse = new String(responseFile);
- System.out.println("sdncResponse(2):" + sdncResponse);
- }
- }
-
- // Next substitute the SDNC response into the callbackResponse (SOAP wrapper).
- // Also, replace the request ID wherever it appears
- String callbackResponse = callbackResponseWrapper.replace("SDNC_RESPONSE_DATA", sdncResponse).replaceAll("SDNC_REQUEST_ID", requestId);
-
- Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay");
- int delay = 2000;
- if (sdncDelay != null) {
- delay = Integer.parseInt(sdncDelay.toString());
- }
-
- //Kick off callback thread
- System.out.println("callback Url:" + callbackUrl + ":delay:" + delay);
- CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay);
- calbackResponseThread.start();
-
- //return 200 OK with empty body
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(syncResponse).withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- /**
- *
- * Callback response thread which sends the callback response asynchronously
- *
- */
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.SDNC_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java
deleted file mode 100644
index 11788be76e..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * Simulates SDNC Adapter Callback response
- *
- */
-public class SDNCAdapterMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(SDNCAdapterMockTransformer.class);
- private String callbackResponse;
- private String requestId;
-
- public SDNCAdapterMockTransformer() {
- callbackResponse = FileUtil.readResourceFile("__files/sdncSimResponse.xml");
- }
-
- public SDNCAdapterMockTransformer(String requestId) {
- this.requestId = requestId;
- }
-
- @Override
- public String getName() {
- return "sdnc-adapter-transformer";
- }
-
- /**
- * Grab the incoming request xml,extract the request id and replace the stub response with the incoming request id
- * so that callback response can be correlated
- *
- * Mock Resource can be used to add dynamic properties. If sdnc_delay is not in the list by default waits for 300ms before
- * the callback response is sent
- */
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
- String requestBody = request.getBodyAsString();
-
- String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>"));
- String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>"));
-
- callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- logger.info("callbackResponse:" + callbackResponse);
-
- if (this.requestId != null) {
- callbackResponse = callbackResponse.replace(this.requestId, requestId);
- } else {
- callbackResponse = callbackResponse.replace("testRequestId", requestId);
- }
-
-
- Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay");
- int delay = 300;
- if (sdncDelay != null) {
- delay = Integer.parseInt(sdncDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("callback Url:" + callbackUrl + ":delay:" + delay);
- CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay);
- calbackResponseThread.start();
-
- //return 200 OK with empty body
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody("").withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- /**
- *
- * Callback response thread which sends the callback response asynchronously
- *
- */
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- logger.debug("Exception :", e1);
- }
- logger.debug("Sending callback response:" + callbackUrl);
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.SDNC_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- logger.debug("Exception :", e);
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java
deleted file mode 100644
index 344c3b521d..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(SDNCAdapterNetworkTopologyMockTransformer.class);
-
- private String callbackResponse;
- private String requestId;
-
- public SDNCAdapterNetworkTopologyMockTransformer() {
- callbackResponse = ""; // FileUtil.readResourceFile("__files/sdncDeleteNetworkTopologySimResponse.xml");
- }
-
- public SDNCAdapterNetworkTopologyMockTransformer(String requestId) {
- this.requestId = requestId;
- }
-
- @Override
- public String getName() {
- return "network-topology-operation-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, FileSource fileSource, Parameters parameters) {
- String requestBody = request.getBodyAsString();
-
- String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>"));
- String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>"));
- logger.info("request callbackUrl : " + callbackUrl);
- logger.info("request requestId : " + requestId);
-
- logger.info("file path/name : " + responseDefinition.getBodyFileName());
- callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- // extract Response responseRequestId
- String responseRequestId = callbackResponse.substring(callbackResponse.indexOf("<RequestId>")+11, callbackResponse.indexOf("</RequestId>"));
- logger.info("response requestId: " + responseRequestId);
- logger.info("callbackResponse (before): " + callbackResponse);
- callbackResponse = callbackResponse.replace(responseRequestId, requestId);
- if (this.requestId != null) {
- callbackResponse = callbackResponse.replace(this.requestId, requestId);
- } else {
- callbackResponse = callbackResponse.replace(responseRequestId, requestId);
- }
- logger.info("callbackResponse (after):" + callbackResponse);
-
- Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay");
- int delay = 300;
- if (sdncDelay != null) {
- delay = Integer.parseInt(sdncDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("(NetworkTopologyMockTransformer) callback Url:" + callbackUrl + ":delay:" + delay);
- CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay);
- calbackResponseThread.start();
-
- //return 200 OK with body
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(callbackResponse).withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- logger.debug("Exception :", e1);
- }
- logger.debug("Sending callback response to url: {}", callbackUrl);
- try {
- HttpClient client = new HttpClientFactory()
- .newTextXmlClient(UriBuilder.fromUri(callbackUrl).build().toURL(), TargetEntity.SDNC_ADAPTER);
- Response response = client.post(payLoad);
- logger.debug("Successfully posted callback? Status: {}", response.getStatus());
- } catch (Exception e) {
- // TODO Auto-generated catch block
- logger.debug("catch error in - request.post() ");
- logger.debug("Exception :", e);
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java
index 79b0d33062..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
@@ -20,16 +20,17 @@
package org.onap.so.bpmn.mock;
-import static com.github.tomakehurst.wiremock.client.WireMock.*;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.containing;
import static com.github.tomakehurst.wiremock.client.WireMock.delete;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.patch;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import com.github.tomakehurst.wiremock.WireMockServer;
/**
@@ -38,1038 +39,1027 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
*/
public class StubResponseAAI {
- public static void setupAllMocks() {
-
- }
-
-
- /**
- * Allotted Resource Mock StubResponses below
- */
- public static void MockGetAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPutAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutAllottedResource_500(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockDeleteAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String resourceVersion) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(204)));
- }
-
- public static void MockPatchAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
- stubFor(patch(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockQueryAllottedResourceById(String allottedResourceId, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=allotted-resource[&]filter=id:EQUALS:" + allottedResourceId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
-
- /**
- * Service Instance Mock StubResponses below
- */
- public static void MockGetServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId) {
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")));
- }
-
- /**
- * Service Instance Mock StubResponses below
- */
- public static void MockGetServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNodeQueryServiceInstanceByName(String serviceInstanceName, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-name:EQUALS:" + serviceInstanceName))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNodeQueryServiceInstanceByName_404(String serviceInstanceName){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockNodeQueryServiceInstanceByName_500(String serviceInstanceName){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockNodeQueryServiceInstanceById(String serviceInstanceId, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-id:EQUALS:" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNodeQueryServiceInstanceById_404(String serviceInstanceId){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockNodeQueryServiceInstanceById_500(String serviceInstanceId){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(204)));
- }
-
- public static void MockGetServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockGetServiceInstance(String customer, String serviceSubscription, int statusCode){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")));
- }
-
- public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" +1234))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockDeleteServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockDeleteServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockPutServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPutServiceInstance_500(String globalCustId, String subscriptionType, String serviceInstanceId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- /**
- * Service-Subscription Mock StubResponses below
- */
- public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockDeleteServiceSubscription(String globalCustId, String subscriptionType, int statusCode) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockDeleteServiceInstanceId(String globalCustId, String subscriptionType, String serviceInstanceId) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutServiceSubscription(String globalCustId, String subscriptionType) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- /**
- * Customer Mock StubResponses below
- */
- public static void MockGetCustomer(String globalCustId, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockDeleteCustomer(String globalCustId) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutCustomer(String globalCustId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutCustomer_500(String globalCustId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
-
- /**
- * Generic-Vnf Mock StubResponses below
- */
-
- public static void MockGetGenericVnfById(String vnfId, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfById(String vnfId, String responseFile, int statusCode){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfByIdWithPriority(String vnfId, int statusCode, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
- .atPriority(1)
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfByIdWithPriority(String vnfId, String vfModuleId, int statusCode, String responseFile, int priority) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
- .atPriority(priority)
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfByIdWithDepth(String vnfId, int depth, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=" + depth))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfById_404(String vnfId){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockGetGenericVnfById_500(String vnfId){
- stubFor(get(urlMatching("/aai/v9/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1"))
- .withQueryParam("depth", equalTo("1"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockGetGenericVnfByName(String vnfName, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfByNameWithDepth(String vnfName, int depth, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName + "[&]depth=" + depth))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfByName_404(String vnfName){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockDeleteGenericVnf(String vnfId, String resourceVersion){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(204)));
- }
-
- public static void MockDeleteGenericVnf(String vnfId, String resourceVersion, int statusCode){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockDeleteGenericVnf_500(String vnfId, String resourceVersion){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockPutGenericVnf(String vnfId){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutGenericVnf(String vnfId, String requestBodyContaining, int statusCode) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
- .withRequestBody(containing(requestBodyContaining))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockPutGenericVnf(String vnfId, int statusCode) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockPutGenericVnf_Bad(String vnfId, int statusCode){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockPatchGenericVnf(String vnfId){
- stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
- /**
- * Vce Mock StubResponses below
- */
- public static void MockGetVceById(String vnfId, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetVceByName(String vnfName, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockDeleteVce(String vnfId, String resourceVersion, int statusCode){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockPutVce(String vnfId){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockGetGenericVceByNameWithDepth(String vnfName, int depth, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName + "[&]depth=" + depth))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetVceGenericQuery(String serviceInstanceName, int depth, int statusCode, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=service-instance.service-instance-name:" + serviceInstanceName + "[&]start-node-type=service-instance[&]include=vce[&]depth=" + depth))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- /**
- * Tenant Mock StubResponses below
- */
- public static void MockGetTenantGenericQuery(String customer, String serviceType, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=customer.global-customer-id:" + customer + "&key=service-subscription.service-type:" + serviceType + "&start-node-type=service-subscription&include=tenant&include=service-subscription&depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetTenant(String tenantId, String responseFile) {
- stubFor(get(urlEqualTo("/aai/v2/cloud-infrastructure/tenants/tenant/" + tenantId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- /**
- * Network Mock StubResponses below
- */
- public static void MockGetNetwork(String networkId, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkByIdWithDepth(String networkId, String responseFile, String depth) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "[?]depth=" + depth))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkCloudRegion(String responseFile, String cloudRegion) {
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"+cloudRegion))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkByName(String networkName, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkByName_404(String responseFile, String networkName) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkCloudRegion_404(String cloudRegion) {
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"+cloudRegion))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockPutNetwork(String networkId, int statusCode, String responseFile) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPutNetwork(String networkPolicyId, String responseFile, int statusCode) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicyId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkName(String networkPolicyName, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkPolicyName))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkVpnBinding(String responseFile, String vpnBinding) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/"+vpnBinding + "[?]depth=all"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkPolicy(String responseFile, String policy) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/"+policy + "[?]depth=all"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkVpnBinding(String networkBindingId, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + networkBindingId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkPolicy(String networkPolicy, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicy))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkTableReference(String responseFile, String tableReference) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/"+tableReference + "[?]depth=all"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPutNetworkIdWithDepth(String responseFile, String networkId, String depth) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/"+networkId+"[?]depth="+depth ))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkPolicyfqdn(String networkPolicy, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy[?]network-policy-fqdn=" + networkPolicy))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkRouteTable(String networkRouteId, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/" + networkRouteId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPatchVfModuleId(String vnfId, String vfModuleId) {
- stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- /////////////
-
- public static void MockVNFAdapterRestVfModule() {
- stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void MockDBUpdateVfModule(){
- stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/DBUpdateResponse.xml")));
- }
-
- // start of mocks used locally and by other VF Module unit tests
- public static void MockSDNCAdapterVfModule() {
- // simplified the implementation to return "success" for all requests
- stubFor(post(urlEqualTo("/SDNCAdapter"))
-// .withRequestBody(containing("SvcInstanceId><"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml")));
-
- }
-
- // start of mocks used locally and by other VF Module unit tests
- public static void MockAAIVfModule() {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool"))
- .atPriority(1)
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/VfModule-supercool.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/lukewarm"))
- .atPriority(2)
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/VfModule-lukewarm.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
- .atPriority(5)
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/VfModule-new.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/GenericVnf.xml")));
- stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool"))
-// .withRequestBody(containing("PCRF"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
-// .withRequestBody(containing("PCRF"))
- .willReturn(aResponse()
- .withStatus(200)));
- // HTTP PUT stub still used by CreateAAIvfModuleVolumeGroup
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
- .withRequestBody(containing("PCRF"))
- .willReturn(aResponse()
- .withStatus(200)));
- // HTTP PUT stub still used by DoCreateVfModuleTest
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
- .withRequestBody(containing("MODULELABEL"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/MDTWNJ21/volume-groups/volume-group/78987"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/VolumeGroup.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/volume-groups/volume-group/78987"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/VolumeGroup.xml")));
- stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group/78987[?]resource-version=0000020"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteCinderVolumeV1/DeleteVolumeId_AAIResponse_Success.xml")));
- stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/AddNetworkPolicy_AAIResponse_Success.xml")));
- stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/NEWvBNGModuleId"))
- .withRequestBody(containing("NEWvBNGModuleId"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
-
-
- //////////////
-
- /**
- * Cloud infrastructure below
- */
-
- public static void MockGetCloudRegion(String cloudRegionId, int statusCode, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- /**
- * Volume Group StubResponse below
- */
- public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile) {
- MockGetVolumeGroupById(cloudRegionId, volumeGroupId, responseFile, 200);
- }
-
- public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int responseCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))
- .willReturn(aResponse()
- .withStatus(responseCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPutVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int statusCode) {
- stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetVolumeGroupByName(String cloudRegionId, String volumeGroupName, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockDeleteVolumeGroupById(String cloudRegionId, String volumeGroupId, String resourceVersion, int statusCode) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockGetVolumeGroupByName_404(String cloudRegionId, String volumeGroupName) {
- stubFor(get(urlMatching("/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockDeleteVolumeGroup(String cloudRegionId, String volumeGroupId, String resourceVersion) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/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(String vnfId, String vfModuleId, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetVfModuleByNameWithDepth(String vnfId, String vfModuleName, int depth, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName + "[?]depth=" + depth))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetVfModuleByName(String vnfId, String vfModuleName, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")));
- }
-
- public static void MockPutVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId +"/vf-modules/vf-module/" +vfModuleId))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutVfModuleId(String vnfId, String vfModuleId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutVfModuleId(String vnfId, String vfModuleId, int returnCode) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(returnCode)));
- }
-
- public static void MockDeleteVfModuleId(String vnfId, String vfModuleId, String resourceVersion, int returnCode) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId + "/[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(returnCode)));
- }
-
- public static void MockAAIVfModuleBadPatch(String endpoint, int statusCode) {
- stubFor(patch(urlMatching(endpoint))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- /* AAI Pserver Queries */
- public static void MockGetPserverByVnfId(String vnfId, String responseFile, int statusCode) {
- stubFor(put(urlMatching("/aai/v1[0-9]/query.*"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfsByVnfId(String vnfId, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/json; charset=utf-8")
- .withBodyFile(responseFile)));
- }
-
- public static void MockSetInMaintFlagByVnfId(String vnfId, int statusCode) {
- stubFor(patch(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- ));
- }
-
- public static void MockSetInMaintFlagByVnfId(String vnfId, String responseFile, int statusCode) {
- stubFor(post(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withBodyFile(responseFile)
- ));
- }
-
- public static void MockGetDefaultCloudRegionByCloudRegionId(String cloudRegionId, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v1[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/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(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123?depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getVceResponse.xml")));
- }
- @Deprecated
- public static void MockGetVceByName(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=testVnfName123"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getVceByNameResponse.xml")));
- }
- @Deprecated
- public static void MockPutVce(){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
- @Deprecated
- public static void MockDeleteVce(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(204)));
- }
- @Deprecated
- public static void MockDeleteVce_404(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- @Deprecated
- public static void MockDeleteServiceSubscription(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234"))
- .willReturn(aResponse()
- .withStatus(204)));
- }
- @Deprecated
- public static void MockGetServiceSubscription(){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getServiceSubscription.xml")));
- }
- @Deprecated
- public static void MockGetServiceSubscription_200Empty(){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(" ")));
- }
- @Deprecated
- public static void MockGetServiceSubscription_404() {
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- @Deprecated
- public static void MockGetGenericVnfById(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml")));
- }
- @Deprecated
- public static void MockGetGenericVnfById_404(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(404)));
- }
- @Deprecated
- public static void MockGetGenericVnfByName(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getGenericVnfResponse.xml")));
- }
- @Deprecated
- public static void MockGetGenericVnfByName_hasRelationships(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
- }
- @Deprecated
- public static void MockGetGenericVnfById_hasRelationships(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
- }
- @Deprecated
- public static void MockGetGenericVnfById_500(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
- @Deprecated
- public static void MockGetGenericVnfByName_404(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
- .willReturn(aResponse()
- .withStatus(404)));
- }
- @Deprecated
- public static void MockPutGenericVnf(){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
- @Deprecated
- public static void MockPutGenericVnf_400(){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(400)));
- }
- @Deprecated
- public static void MockDeleteGenericVnf(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(204)));
- }
- @Deprecated
- public static void MockDeleteGenericVnf_404(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(404)));
- }
- @Deprecated
- public static void MockDeleteGenericVnf_500(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
- @Deprecated
- public static void MockDeleteGenericVnf_412(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[[?]]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(412)));
- }
+ 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")));
+ }
+
+ 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")));
+ }
+
+ 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) {
+ 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)));
+ }
}
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 58e7dcdaad..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,20 +16,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.mock;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.containing;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.patch;
import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import com.github.tomakehurst.wiremock.WireMockServer;
/**
* Reusable Mock StubResponses for Policy
@@ -37,29 +32,25 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
*/
public class StubResponseAPPC {
- public static void setupAllMocks() {
+ 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")));
+
+
+
+ }
- }
- // start of Policy mocks
- public static void MockAppcError() {
- stubFor(get(urlMatching("/events/.*"))
- // .withRequestBody(containing("APPC"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("APPC/appc_error.json")));
- stubFor(put(urlMatching("/events/.*"))
- // .withRequestBody(containing("APPC"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("APPC/appc_error.json")));
-
-
- }
-
-
-
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseDatabase.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseDatabase.java
index 6227b05d07..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
@@ -21,98 +21,82 @@
package org.onap.so.bpmn.mock;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.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(String fileName){
- stubFor(post(urlEqualTo("/services/RequestsDbAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(fileName)));
- }
-
- public static void mockUpdateRequestDB(int statusCode, String reponseFile) {
- stubFor(post(urlEqualTo("/services/RequestsDbAdapter"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(reponseFile)));
- }
+ public static void 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(String modelInvariantId, String responseFile){
- stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
+ public static void 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(String modelInvariantId, String responseFile){
- stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockGetVnfCatalogDataCustomizationUuid(String vnfModelCustomizationUuid, String responseFile){
- stubFor(get(urlEqualTo("/v2/serviceVnfs?vnfModelCustomizationUuid=" + vnfModelCustomizationUuid))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
+ public static void 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(String vfModuleModelName, String responseFile){
- stubFor(get(urlEqualTo("/v2/vfModules?vfModuleModelName=" + vfModuleModelName))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetServiceResourcesCatalogData(String serviceModelInvariantUuid, String serviceModelVersion, String responseFile){
- stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelInvariantUuid=" +
- serviceModelInvariantUuid +
- "&serviceModelVersion=" + serviceModelVersion))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetServiceResourcesCatalogData(String serviceModelInvariantUuid, String responseFile){
- stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelInvariantUuid=" + serviceModelInvariantUuid))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetServiceResourcesCatalogDataByModelUuid(String serviceModelUuid, String responseFile){
- stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelUuid=" + serviceModelUuid))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPostRequestDB(){
- stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")));
- }
+ 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 d88509cb57..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
@@ -22,11 +22,11 @@ package org.onap.so.bpmn.mock;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.containing;
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import com.github.tomakehurst.wiremock.WireMockServer;
/**
* Please describe the StubResponseNetwork.java class
@@ -34,82 +34,62 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
*/
public class StubResponseNetworkAdapter {
- private static final String EOL = "\n";
-
- public static void setupAllMocks() {
-
- }
-
-
- public static void MockNetworkAdapter() {
- stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockNetworkAdapter(String response) {
- stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(response)));
- }
-
- public static void MockNetworkAdapter_500() {
- stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockNetworkAdapterPost(String responseFile, String requestContaining) {
- stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNetworkAdapter(String networkId, int statusCode, String responseFile) {
- stubFor(delete(urlEqualTo("/networks/NetworkAdapter/" + networkId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNetworkAdapterContainingRequest(String requestContaining, int statusCode, String responseFile) {
- stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPutNetworkAdapter(String networkId, String requestContaining, int statusCode, String responseFile) {
- stubFor(put(urlEqualTo("/networks/NetworkAdapter/" + networkId))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNetworkAdapterRestRollbackDelete(String responseFile, String networkId) {
- stubFor(delete(urlEqualTo("/networks/NetworkAdapter/"+networkId+"/rollback"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNetworkAdapterRestPut(String responseFile, String networkId) {
- stubFor(put(urlEqualTo("/networks/NetworkAdapter/"+networkId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
+ 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 335fd94f5b..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
@@ -22,8 +22,8 @@ package org.onap.so.bpmn.mock;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import com.github.tomakehurst.wiremock.WireMockServer;
/**
* StubResponseOof.java class
@@ -34,33 +34,24 @@ public class StubResponseOof {
}
- public static void mockOof() {
- stubFor(post(urlEqualTo("/api/oof/v1/placement"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")));
+ public static void mockOof(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement"))
+ .willReturn(aResponse().withStatus(202).withHeader("Content-Type", "application/json")));
}
- public static void mockOof(String responseFile) {
- stubFor(post(urlEqualTo("/api/oof/v1/placement"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
+ public static void mockOof(WireMockServer wireMockServer, String 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() {
- stubFor(post(urlEqualTo("/api/oof/v1/placement"))
- .willReturn(aResponse()
- .withStatus(400)
- .withHeader("Content-Type", "application/json")));
+ public static void mockOof_400(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement"))
+ .willReturn(aResponse().withStatus(400).withHeader("Content-Type", "application/json")));
}
- public static void mockOof_500() {
- stubFor(post(urlEqualTo("/api/oof/v1/placement"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "application/json")));
+ public static void mockOof_500(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement"))
+ .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "application/json")));
}
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponsePolicy.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponsePolicy.java
index 809616dff0..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
@@ -22,14 +22,9 @@ package org.onap.so.bpmn.mock;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.containing;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.patch;
-import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import com.github.tomakehurst.wiremock.WireMockServer;
/**
* Reusable Mock StubResponses for Policy
@@ -37,89 +32,59 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
*/
public class StubResponsePolicy {
- public static void setupAllMocks() {
-
- }
-
- // start of Policy mocks
- public static void MockPolicyAbort() {
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("BB1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("policyAbortResponse.json")));
-
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("UPDVnfI"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("policyAbortResponse.json")));
-
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("RPLVnfI"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("policyAbortResponse.json")));
-
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("VnfIPU"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("policyAbortResponse.json")));
-
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("VnfCU"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("policyAbortResponse.json")));
-
-
-
- }
-
- public static void MockPolicySkip() {
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("BB1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("Policy/policySkipResponse.json")));
-
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("UPDVnfI"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("Policy/policySkipResponse.json")));
-
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("RPLVnfI"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("Policy/policySkipResponse.json")));
-
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("VnfIPU"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("Policy/policySkipResponse.json")));
-
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("VnfCU"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("Policy/policySkipResponse.json")));
-
-
- }
-
-
+ 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 e0c51b794c..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
@@ -23,127 +23,69 @@ package org.onap.so.bpmn.mock;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.containing;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import com.github.tomakehurst.wiremock.WireMockServer;
/**
* Please describe the StubResponseSDNC.java class
*/
public class StubResponseSDNCAdapter {
- public static void setupAllMocks() {
-
- }
-
- public static void mockSDNCAdapter_500() {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void mockSDNCAdapter_500(String requestContaining) {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void mockSDNCAdapter(int statusCode) {
- stubFor(post(urlMatching(".*/SDNCAdapter"))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void mockSDNCAdapter(String endpoint, int statusCode, String responseFile) {
- stubFor(post(urlEqualTo(endpoint))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void mockSDNCAdapter(String responseFile) {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void mockSDNCAdapter(String endpoint, String requestContaining, int statusCode, String responseFile) {
- stubFor(post(urlEqualTo(endpoint))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void mockSDNCAdapterSimulator(String responseFile) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("sdnc_delay", "300");
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/soap+xml")
- .withTransformers("sdnc-adapter-transformer")
- .withBodyFile(responseFile)));
- }
-
- public static void mockSDNCAdapterSimulator(String responseFile, String requestContaining) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("sdnc_delay", "300");
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/soap+xml")
- .withTransformers("sdnc-adapter-transformer")
- .withBodyFile(responseFile)));
- }
-
- public static void mockSDNCAdapterRest() {
- stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")));
- }
-
- public static void mockSDNCAdapterRest_500() {
- stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "application/json")));
- }
-
- public static void mockSDNCAdapterRest(String requestContaining) {
- stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")));
- }
-
- public static void mockSDNCAdapterRest_500(String requestContaining) {
- stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "application/json")));
- }
-
- public static void mockSDNCAdapterTopology(String responseFile, String requestContaining) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("sdnc_delay", "300");
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withTransformers("network-topology-operation-transformer")
- .withBodyFile(responseFile)));
- }
-
-
+ 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 22d3191821..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
@@ -22,8 +22,8 @@ package org.onap.so.bpmn.mock;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import com.github.tomakehurst.wiremock.WireMockServer;
/**
* Please describe the StubResponseSNIRO.java class
@@ -31,37 +31,28 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
*/
public class StubResponseSNIRO {
- public static void setupAllMocks() {
+ public static void setupAllMocks() {
- }
+ }
- public static void mockSNIRO() {
- stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")));
- }
+ public static void mockSNIRO(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
+ .willReturn(aResponse().withStatus(202).withHeader("Content-Type", "application/json")));
+ }
- public static void mockSNIRO(String responseFile) {
- stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
+ public static void mockSNIRO(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() {
- 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() {
- 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 91ecbd23b4..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
@@ -21,186 +21,113 @@
package org.onap.so.bpmn.mock;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.containing;
import static com.github.tomakehurst.wiremock.client.WireMock.delete;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import com.github.tomakehurst.wiremock.WireMockServer;
/**
* Please describe the StubResponseVNF.java class
*/
public class StubResponseVNFAdapter {
- public static void mockVNFAdapter() {
- stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void mockVNFAdapter(String responseFile) {
- stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void mockVNFAdapter_500() {
- stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void mockVNFAdapterTransformer(String transformer, String responseFile) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("vnf_delay", "300");
- stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/soap+xml")
- .withTransformers(transformer)
- .withBodyFile(responseFile)));
- }
-
- public static void mockVNFAdapterTransformer(String transformer, String responseFile, String requestContaining) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("vnf_delay", "300");
- stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/soap+xml")
- .withTransformers(transformer)
- .withBodyFile(responseFile)));
- }
-
- public static void mockVNFPost(String vfModuleId, int statusCode, String vnfId) {
- stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- stubFor(post(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockVNFPut(String vfModuleId, int statusCode) {
- stubFor(put(urlEqualTo("/services/rest/v1/vnfsvnfId/vf-modules" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- stubFor(put(urlEqualTo("/services/rest/v1/vnfs/vnfId/vf-modules" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockVNFPut(String vnfId, String vfModuleId, int statusCode) {
- stubFor(put(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- stubFor(put(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockVNFDelete(String vnfId, String vfModuleId, int statusCode) {
- stubFor(delete(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- stubFor(delete(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockVNFRollbackDelete(String vfModuleId, int statusCode) {
- stubFor(delete(urlEqualTo("/services/rest/v1/vnfsvnfId/vf-modules" + vfModuleId + "/rollback"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- stubFor(delete(urlEqualTo("/services/rest/v1/vnfs/vnfId/vf-modules" + vfModuleId + "/rollback"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockPutVNFVolumeGroup(String volumeGroupId, int statusCode) {
- stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/" + volumeGroupId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- stubFor(put(urlEqualTo("/vnfs/rest/v1/volume-groups/" + volumeGroupId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockPutVNFVolumeGroupRollback(String volumeGroupId, int statusCode) {
- stubFor(delete(urlMatching("/vnfs/v1/volume-groups/" + volumeGroupId + "/rollback"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/" + volumeGroupId + "/rollback"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
- public static void mockPostVNFVolumeGroup(int statusCode) {
- stubFor(post(urlEqualTo("/vnfs/v1/volume-groups"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- stubFor(post(urlEqualTo("/vnfs/rest/v1/volume-groups"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockVNFAdapterRest(String vnfId) {
- stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(post(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void mockVNFAdapterRest_500(String vnfId) {
- stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules"))
- .willReturn(aResponse()
- .withStatus(500)));
- stubFor(post(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void mockVfModuleDelete(String volumeGroupId) {
- stubFor(delete(urlMatching("/vnfs/v1/volume-groups/"+ volumeGroupId))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/"+ volumeGroupId))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockVfModuleDelete(String volumeGroupId, int statusCode) {
- stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
+ 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/mock/VnfAdapterAsyncTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java
deleted file mode 100644
index e190535e7e..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.BinaryFile;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-
-/**
- *
- * Simulates VNF Adapter Asynch Callback response.
- * This should work for any of the operations.
- *
- * This transformer uses the mapped message as the asynchronous response.
- * By definition, the async API sends a 202 (with no body) in the sync response.
- *
- */
-public class VnfAdapterAsyncTransformer extends ResponseDefinitionTransformer {
-
- public VnfAdapterAsyncTransformer() {
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-async";
- }
-
- /**
- * Grab the incoming request, extract properties to be copied to the response
- * (request id, vnf id, vf module ID, message ID). Then fetch the actual response
- * body from its FileSource, make the replacements.
- *
- * The sync response is an empty 202 response.
- * The transformed mapped response file is sent asynchronously after a delay.
- *
- * Mock Resource can be used to add dynamic properties. If vnf_delay is not in the list by
- * default waits for 5s before the callback response is sent
- */
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- // Note: Should recognize both XML and JSON. But current BPMN uses XML.
- String notificationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
-
- String vnfId = requestBody.substring(requestBody.indexOf("<vnfId>")+7, requestBody.indexOf("</vnfId>"));
- String vfModuleId = requestBody.substring(requestBody.indexOf("<vfModuleId>")+12, requestBody.indexOf("</vfModuleId>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String requestId = requestBody.substring(requestBody.indexOf("<requestId>")+11, requestBody.indexOf("</requestId>"));
-
- System.out.println("responseDefinition: " + responseDefinition);
-
- // For this mock, the mapped response body is the Async callback (since the sync response is generic for all requests)
- String vnfResponse = responseDefinition.getBody();
- System.out.println("VNF Response:" + vnfResponse);
-
- if (vnfResponse == null) {
- // Body wasn't specified. Check for a body file
- String bodyFileName = responseDefinition.getBodyFileName();
- System.out.println("bodyFileName" + bodyFileName);
- if (bodyFileName != null) {
- System.out.println("fileSource Class: " + fileSource.getClass().getName());
- BinaryFile bodyFile = fileSource.getBinaryFileNamed(bodyFileName);
- byte[] responseFile = bodyFile.readContents();
- vnfResponse = new String(responseFile);
- System.out.println("vnfResponse(2):" + vnfResponse);
- }
- }
-
- // Transform the SDNC response to escape < and >
- vnfResponse = vnfResponse.replaceAll ("VNF_ID", vnfId);
- vnfResponse = vnfResponse.replaceAll ("VF_MODULE_ID", vfModuleId);
- vnfResponse = vnfResponse.replaceAll ("REQUEST_ID", requestId);
- vnfResponse = vnfResponse.replaceAll ("MESSAGE_ID", messageId);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 5000;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- System.out.println("notification Url:" + notificationUrl + ":delay:" + delay);
- CallbackResponseThread calbackResponseThread = new CallbackResponseThread(notificationUrl,vnfResponse, delay);
- calbackResponseThread.start();
-
- //return 200 OK with empty body
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(202).withBody("").withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- /**
- *
- * Callback response thread which sends the callback response asynchronously
- *
- */
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
-
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java
deleted file mode 100644
index 362d9508d3..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Please describe the VnfAdapterCreateMockTransformer.java class
- *
- */
-public class VnfAdapterCreateMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterCreateMockTransformer.class);
-
- private String notifyCallbackResponse;
- private String ackResponse;
-
- public VnfAdapterCreateMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfCreateSimResponse.xml"); // default response
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-create-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- logger.debug("Exception :",ex);
- System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfCreateSimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- logger.info("response (mock) messageId : {}", responseMessageId);
- logger.info("request (replacement) messageId: {}", messageId);
-
- logger.info("vnf Response (before): {}", notifyCallbackResponse);
- logger.info("vnf Response (after): {}", updatedResponse);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("VnfAdapterCreateMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
-
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- @SuppressWarnings("deprecation")
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- logger.debug("Exception :",e1);
- }
- logger.debug("Sending callback response to url: {}", callbackUrl);
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- Response response = client.post(payLoad);
- logger.debug("Successfully posted callback? Status: {}", response.getStatus());
- } catch (Exception e) {
- // TODO Auto-generated catch block
- logger.debug("catch error in - request.post() ");
- logger.debug("Exception :", e);
- }
- }
-
- }
-
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java
deleted file mode 100644
index b67f3dcedd..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Please describe the VnfAdapterCreateMockTransformer.java class
- *
- */
-public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterDeleteMockTransformer.class);
-
- private String notifyCallbackResponse;
- private String ackResponse;
-
- public VnfAdapterDeleteMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfDeleteSimResponse.xml");
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-delete-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- logger.debug("Exception :",ex);
- logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfDeleteSimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- logger.info("response (mock) messageId : {}", responseMessageId);
- logger.info("request (replacement) messageId: {}", messageId);
-
- logger.info("vnf Response (before):{}", notifyCallbackResponse);
- logger.info("vnf Response (after):{}", updatedResponse);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("VnfAdapterDeleteMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
-
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- @SuppressWarnings("deprecation")
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- logger.debug("Exception :",e1);
- }
-
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- logger.info("catch error in - request.post() ");
- logger.debug("Exception :",e);
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java
deleted file mode 100644
index 48ced35810..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Please describe the VnfAdapterQueryMockTransformer.java class
- *
- */
-
-
-public class VnfAdapterQueryMockTransformer extends ResponseDefinitionTransformer{
-
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterQueryMockTransformer
- .class);
-
- private String notifyCallbackResponse;
- private String ackResponse;
- private String messageId;
-
- public VnfAdapterQueryMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfQuerySimResponse.xml");
- }
-
- public VnfAdapterQueryMockTransformer(String messageId) {
- this.messageId = messageId;
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-query-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
-
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- logger.debug("Exception :",ex);
- logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfQuerySimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- logger.info("response (mock) messageId : {}", responseMessageId);
- logger.info("request (replacement) messageId: {}", messageId);
-
- logger.info("vnf Response (before):{}", notifyCallbackResponse);
- logger.info("vnf Response (after):{}", updatedResponse);
-
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("VnfAdapterQueryMockTransformer notficationUrl: {}:delay: {}", notficationUrl, delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- logger.info("Inside Callback" );
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- logger.debug("Exception :",e1);
- }
-
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- logger.debug("Exception :",e);
- }
- }
-
- }
-
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java
deleted file mode 100644
index edf05422d1..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Please describe the VnfAdapterCreateMockTransformer.java class
- *
- */
-public class VnfAdapterRollbackMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterRollbackMockTransformer.class);
-
- private String notifyCallbackResponse;
- private String ackResponse;
- private String messageId;
-
- public VnfAdapterRollbackMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfRollbackSimResponse.xml");
- }
-
- public VnfAdapterRollbackMockTransformer(String messageId) {
- this.messageId = messageId;
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-rollback-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- logger.debug("Exception :",ex);
- logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfRollbackSimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- logger.info("response (mock) messageId : {}", responseMessageId);
- logger.info("request (replacement) messageId: {}", messageId);
-
- logger.info("vnf Response (before):{}", notifyCallbackResponse);
- logger.info("vnf Response (after):{}", updatedResponse);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("VnfAdapterRollbackMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
-
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- logger.debug("Exception :",e1);
- }
-
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- logger.info("catch error in - request.post() ");
- logger.debug("Exception :", e);
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java
deleted file mode 100644
index 5693877574..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Please describe the VnfAdapterUpdateMockTransformer.java class
- *
- */
-public class VnfAdapterUpdateMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterUpdateMockTransformer.class);
-
- private String notifyCallbackResponse;
- private String requestId;
- private String ackResponse;
-
- public VnfAdapterUpdateMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("vnfAdapter/vnfUpdateSimResponse.xml");
- }
-
- public VnfAdapterUpdateMockTransformer(String requestId) {
- this.requestId = requestId;
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-update-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- logger.debug("Exception :",ex);
- logger.info(" ******* Use default response file in 'vnfAdapter/vnfUpdateSimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- logger.info("response (mock) messageId : {}", responseMessageId);
- logger.info("request (replacement) messageId: {}", messageId);
-
- logger.info("vnf Response (before):{}", notifyCallbackResponse);
- logger.info("vnf Response (after):{}", updatedResponse);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("VnfAdapterUpdateMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
-
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- logger.debug("Exception :", e1);
- }
-
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- logger.info("catch error in - request.post() ");
- logger.debug("Exception :", e);
- }
- }
-
- }
-}
-
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBDecompPojoTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBDecompPojoTest.java
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 bc41b168ef..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,192 +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, "abc");
- assertEquals(extractServPend.getServiceInstanceId(), serviceInstancePend.getServiceInstanceId());
- GenericVnf extractVnfPend = extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, "abc");
- assertEquals(extractVnfPend.getVnfId(), vnfPend.getVnfId());
- L3Network extractNetworkPend = extractPojos.extractByKey(execution, ResourceKey.NETWORK_ID, "abc");
- assertEquals(extractNetworkPend.getNetworkId(), networkPend.getNetworkId());
- VolumeGroup extractVolumeGroupPend = extractPojos.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, "abc");
- assertEquals(extractVolumeGroupPend.getVolumeGroupId(), volumeGroupPend.getVolumeGroupId());
- AllottedResource extractallotedResourcePend = extractPojos.extractByKey(execution,
- ResourceKey.ALLOTTED_RESOURCE_ID, "abc");
- assertEquals(extractallotedResourcePend.getId(), allotedResourcePend.getId());
- Configuration extractConfigurationPend = extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID,
- "abc");
- assertEquals(extractConfigurationPend.getConfigurationId(), configurationPend.getConfigurationId());
- VpnBinding extractVpnBinding = extractPojos.extractByKey(execution, ResourceKey.VPN_ID, "abc");
- assertEquals(extractVpnBinding.getVpnId(), vpnBinding.getVpnId());
-
- VfModule extractVfModulePend = extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID, "abc");
- assertEquals(extractVfModulePend.getVfModuleId(), vfModulePend.getVfModuleId());
-
- VpnBondingLink extractVpnBondingLinkPend = extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID, "testVpnBondingLink");
- assertEquals(extractVpnBondingLinkPend.getVpnBondingLinkId(), vpnBondingLinkPend.getVpnBondingLinkId());
-
- InstanceGroup extractInstanceGroupPend = extractPojos.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, "test-instance-group-1");
- 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, "abc");
- }
-
- @Test
- public void vnfError() throws BBObjectNotFoundException {
- expectedException.expect(BBObjectNotFoundException.class);
-
- Customer customer = new Customer();
- customer.setServiceSubscription(new ServiceSubscription());
- ServiceInstance serviceInstance = new ServiceInstance();
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, "bbb");
- }
-
- @Test
- public void vfModuleError() throws BBObjectNotFoundException {
- expectedException.expect(BBObjectNotFoundException.class);
-
- Customer customer = new Customer();
- customer.setServiceSubscription(new ServiceSubscription());
- ServiceInstance serviceInstance = new ServiceInstance();
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID, "bbb");
- }
-
- @Test
- public void configurationError() throws BBObjectNotFoundException {
- expectedException.expect(BBObjectNotFoundException.class);
-
- Customer customer = new Customer();
- customer.setServiceSubscription(new ServiceSubscription());
- ServiceInstance serviceInstance = new ServiceInstance();
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID, "bbb");
- }
- @Test
- public void allotedError() throws BBObjectNotFoundException {
- expectedException.expect(BBObjectNotFoundException.class);
-
- Customer customer = new Customer();
- customer.setServiceSubscription(new ServiceSubscription());
- ServiceInstance serviceInstance = new ServiceInstance();
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.ALLOTTED_RESOURCE_ID, "bbb");
- }
- @Test
- public void vpnBindingError() throws BBObjectNotFoundException {
- expectedException.expect(BBObjectNotFoundException.class);
- Customer customer = new Customer();
- customer.setServiceSubscription(new ServiceSubscription());
- ServiceInstance serviceInstance = new ServiceInstance();
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.VPN_ID, "bbb");
- }
-
- @Test
- public void vpnBondingLinkError() throws BBObjectNotFoundException {
- expectedException.expect(BBObjectNotFoundException.class);
- Customer customer = new Customer();
- customer.setServiceSubscription(new ServiceSubscription());
- ServiceInstance serviceInstance = new ServiceInstance();
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID, "bbb");
- }
+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 ff592f5603..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;
@@ -69,6 +67,7 @@ import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.ConfigurationResource;
import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
+import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
@@ -76,651 +75,669 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
-import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
+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);
- VnfVfmoduleCvnfcConfigurationCustomization policyNameTable = new VnfVfmoduleCvnfcConfigurationCustomization();
- 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);
-
- VnfVfmoduleCvnfcConfigurationCustomization fabricCustomization = new VnfVfmoduleCvnfcConfigurationCustomization();
- 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 df9f2259a1..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
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -32,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;
@@ -41,8 +42,8 @@ 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;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -100,7 +101,7 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
-import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
+import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
@@ -113,2604 +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);
-
- VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization();
- 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);
- List<VnfcInstanceGroupCustomization> vnfcInstanceGroups = new ArrayList<>();
- VnfcInstanceGroupCustomization vnfcInstanceGroupCust = new VnfcInstanceGroupCustomization();
- vnfcInstanceGroupCust.setModelUUID("modelUUID");
- vnfcInstanceGroupCust.setFunction("function");
- vnfcInstanceGroupCust.setDescription("description");
- vnfcInstanceGroups.add(vnfcInstanceGroupCust);
- org.onap.so.db.catalog.beans.InstanceGroup instanceGroup = new org.onap.so.db.catalog.beans.InstanceGroup();
- instanceGroup.setModelUUID("modelUUID");
- 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));
- }
-
}
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
new file mode 100644
index 0000000000..f558932d33
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.client.cds;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+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;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.onap.so.client.exception.ExceptionBuilder;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AbstractCDSProcessingBBUtilsTest {
+ @InjectMocks
+ private AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils = new AbstractCDSProcessingBBUtils();
+ @InjectMocks
+ AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean();
+ @Mock
+ 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\"}}}";
+ String blueprintName = "blueprintName";
+ String blueprintVersion = "blueprintVersion";
+ String actionName = "actionName";
+ String mode = "mode";
+ String requestId = "123456";
+ String originatorId = "originatorId";
+ String subRequestId = UUID.randomUUID().toString();
+
+ abstractCDSPropertiesBean.setActionName(actionName);
+ abstractCDSPropertiesBean.setBlueprintName(blueprintName);
+ abstractCDSPropertiesBean.setBlueprintVersion(blueprintVersion);
+ abstractCDSPropertiesBean.setMode(mode);
+ abstractCDSPropertiesBean.setOriginatorId(originatorId);
+ abstractCDSPropertiesBean.setRequestId(requestId);
+ abstractCDSPropertiesBean.setRequestObject(requestObject);
+ abstractCDSPropertiesBean.setSubRequestId(subRequestId);
+ }
+
+ @Test
+ public void preProcessRequestTest() throws Exception {
+
+ DelegateExecution execution = mock(DelegateExecution.class);
+ when(execution.getVariable("executionObject")).thenReturn(abstractCDSPropertiesBean);
+
+ abstractCDSProcessingBBUtils.constructExecutionServiceInputObject(execution);
+ verify(exceptionUtil, times(0)).buildAndThrowWorkflowException(any(DelegateExecution.class), anyInt(),
+ any(Exception.class));
+ }
+
+ @Test
+ public void sendRequestToCDSClientTest() {
+
+ 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));
+
+ }
+
+}
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
new file mode 100644
index 0000000000..3eadd800ad
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnfTest.java
@@ -0,0 +1,68 @@
+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 {
+ ConfigAssignPropertiesForPnf configAssignPropertiesForPnf = new ConfigAssignPropertiesForPnf();
+ private Map<String, Object> userParam = new HashMap<String, Object>();
+ private String serviceInstanceId;
+ private String pnfId;
+ private String pnfName;
+ private String serviceModelUuid;
+ private String pnfCustomizationUuid;
+
+ @Test
+ public final void testConfigDeployPropertiesForPnfTest() {
+ userParam.put("Instance1", "instance1value");
+ userParam.put("Instance2", "instance2value");
+ configAssignPropertiesForPnf.setPnfCustomizationUuid("pnf-customization-uuid");
+ configAssignPropertiesForPnf.setPnfId("pnf-id");
+ configAssignPropertiesForPnf.setPnfName("pnf-name");
+ configAssignPropertiesForPnf.setServiceInstanceId("service-instance-id");
+ configAssignPropertiesForPnf.setServiceModelUuid("service-model-uuid");
+ configAssignPropertiesForPnf.setUserParam("Instance1", "instance1value");
+ configAssignPropertiesForPnf.setUserParam("Instance2", "instance2value");
+
+ assertNotNull(configAssignPropertiesForPnf.getPnfCustomizationUuid());
+ assertNotNull(configAssignPropertiesForPnf.getPnfId());
+ assertNotNull(configAssignPropertiesForPnf.getPnfName());
+ assertNotNull(configAssignPropertiesForPnf.getServiceInstanceId());
+ assertNotNull(configAssignPropertiesForPnf.getServiceModelUuid());
+ assertNotNull(configAssignPropertiesForPnf.getUserParam());
+
+ assertEquals("service-instance-id", configAssignPropertiesForPnf.getServiceInstanceId());
+ assertEquals("service-model-uuid", configAssignPropertiesForPnf.getServiceModelUuid());
+ assertEquals("pnf-customization-uuid", configAssignPropertiesForPnf.getPnfCustomizationUuid());
+ assertEquals("pnf-id", configAssignPropertiesForPnf.getPnfId());
+ assertEquals("pnf-name", configAssignPropertiesForPnf.getPnfName());
+ assertEquals(userParam, configAssignPropertiesForPnf.getUserParam());
+ }
+
+ @Test
+ public void testtoString() {
+ 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('}');
+ String Expexted = sb.toString();
+ assertEquals(Expexted, configAssignPropertiesForPnf.toString());
+
+ }
+}
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
new file mode 100644
index 0000000000..4b91cdf803
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnfTest.java
@@ -0,0 +1,66 @@
+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 {
+ ConfigAssignPropertiesForVnf configAssignPropertiesForVnf = new ConfigAssignPropertiesForVnf();
+ private Map<String, Object> userParam = new HashMap<String, Object>();
+ private String serviceInstanceId;
+ private String vnfId;
+ private String vnfName;
+ private String serviceModelUuid;
+ private String vnfCustomizationUuid;
+
+ @Test
+ public final void testConfigAssignPropertiesForVnfTest() {
+ userParam.put("Instance1", "instance1value");
+ configAssignPropertiesForVnf.setServiceInstanceId("service-instance-id");
+ configAssignPropertiesForVnf.setServiceModelUuid("service-model-uuid");
+ configAssignPropertiesForVnf.setVnfCustomizationUuid("vnf-customization-uuid");
+ configAssignPropertiesForVnf.setVnfId("vnf-id");
+ configAssignPropertiesForVnf.setVnfName("vnf-name");
+ configAssignPropertiesForVnf.setUserParam("Instance1", "instance1value");
+
+ assertNotNull(configAssignPropertiesForVnf.getServiceInstanceId());
+ assertNotNull(configAssignPropertiesForVnf.getServiceModelUuid());
+ assertNotNull(configAssignPropertiesForVnf.getVnfCustomizationUuid());
+ assertNotNull(configAssignPropertiesForVnf.getVnfId());
+ assertNotNull(configAssignPropertiesForVnf.getVnfName());
+ assertNotNull(configAssignPropertiesForVnf.getUserParam());
+
+ assertEquals("service-instance-id", configAssignPropertiesForVnf.getServiceInstanceId());
+ assertEquals("service-model-uuid", configAssignPropertiesForVnf.getServiceModelUuid());
+ assertEquals("vnf-customization-uuid", configAssignPropertiesForVnf.getVnfCustomizationUuid());
+ assertEquals("vnf-id", configAssignPropertiesForVnf.getVnfId());
+ assertEquals("vnf-name", configAssignPropertiesForVnf.getVnfName());
+ assertEquals(userParam, configAssignPropertiesForVnf.getUserParam());
+
+ }
+
+ @Test
+ public void testtoString() {
+ 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("\"");
+ 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('}');
+ String Expexted = sb.toString();
+ assertEquals(Expexted, configAssignPropertiesForVnf.toString());
+ }
+}
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
new file mode 100644
index 0000000000..da82721e5e
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnfTest.java
@@ -0,0 +1,46 @@
+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 {
+ ConfigAssignRequestPnf configAssignRequestPnf = new ConfigAssignRequestPnf();
+ ConfigAssignPropertiesForPnf configAssignPropertiesForPnf = new ConfigAssignPropertiesForPnf();
+ private Map<String, Object> userParam = new HashMap<String, Object>();
+ private String resolutionKey;
+
+ @Test
+ public final void testConfigAssignRequestPnfTest() {
+ configAssignRequestPnf.setResolutionKey("resolution-key");
+ configAssignRequestPnf.setConfigAssignPropertiesForPnf(configAssignPropertiesForPnf);
+ assertNotNull(configAssignRequestPnf.getResolutionKey());
+ assertNotNull(configAssignRequestPnf.getConfigAssignPropertiesForPnf());
+
+ assertEquals("resolution-key", configAssignRequestPnf.getResolutionKey());
+ assertEquals(configAssignPropertiesForPnf, configAssignRequestPnf.getConfigAssignPropertiesForPnf());
+ }
+
+ @Test
+ public void testtoString() {
+ userParam.put("Instance1", "instance1value");
+ configAssignPropertiesForPnf.setPnfCustomizationUuid("pnf-customization-uuid");
+ configAssignPropertiesForPnf.setPnfId("pnf-id");
+ configAssignPropertiesForPnf.setPnfName("pnf-name");
+ configAssignPropertiesForPnf.setServiceInstanceId("service-instance-id");
+ configAssignPropertiesForPnf.setServiceModelUuid("service-model-uuid");
+ configAssignPropertiesForPnf.setUserParam("user_params", userParam);
+ configAssignRequestPnf.setConfigAssignPropertiesForPnf(configAssignPropertiesForPnf);
+ 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('}');
+ String Expexted = sb.toString();
+
+ assertEquals(Expexted, configAssignRequestPnf.toString());
+
+ }
+}
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
new file mode 100644
index 0000000000..a73fa6c01e
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnfTest.java
@@ -0,0 +1,49 @@
+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 {
+ ConfigAssignRequestVnf configAssignRequestVnf = new ConfigAssignRequestVnf();
+ ConfigAssignPropertiesForVnf configAssignPropertiesForVnf = new ConfigAssignPropertiesForVnf();
+ private Map<String, Object> userParam = new HashMap<String, Object>();
+
+ private String resolutionKey;
+
+ @Test
+ public final void testConfigAssignRequestVnf() {
+ configAssignRequestVnf.setResolutionKey("resolution-key");
+ configAssignRequestVnf.setConfigAssignPropertiesForVnf(configAssignPropertiesForVnf);
+ assertNotNull(configAssignRequestVnf.getResolutionKey());
+ assertNotNull(configAssignRequestVnf.getConfigAssignPropertiesForVnf());
+
+ assertEquals("resolution-key", configAssignRequestVnf.getResolutionKey());
+ assertEquals(configAssignPropertiesForVnf, configAssignRequestVnf.getConfigAssignPropertiesForVnf());
+
+ }
+
+ @Test
+ public void testtoString() {
+ userParam.put("Instance1", "instance1value");
+ configAssignPropertiesForVnf.setServiceInstanceId("service-instance-id");
+ configAssignPropertiesForVnf.setServiceModelUuid("service-model-uuid");
+ configAssignPropertiesForVnf.setUserParam("user_params", userParam);
+ configAssignPropertiesForVnf.setVnfCustomizationUuid("vnf-customization-uuid");
+ configAssignPropertiesForVnf.setVnfId("vnf-id");
+ configAssignPropertiesForVnf.setVnfName("vnf-name");
+ configAssignRequestVnf.setConfigAssignPropertiesForVnf(configAssignPropertiesForVnf);
+
+ 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('}');
+
+ String Expexted = sb.toString();
+
+ assertEquals(Expexted, configAssignRequestVnf.toString());
+ }
+}
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
new file mode 100644
index 0000000000..771196d53c
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnfTest.java
@@ -0,0 +1,63 @@
+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;
+
+public class ConfigDeployPropertiesForPnfTest {
+
+ ConfigDeployPropertiesForPnf configDeployPropertiesForPnf = new ConfigDeployPropertiesForPnf();
+ private static final String TEST_SERVICE_MODEL_UUID = "service-model-uuid";
+ private static final String TEST_PNF_CUSTOMIZATION_UUID = "pnf-customization-uuid";
+ private static final String TEST_PNF_ID = "pnf-id";
+ private static final String TEST_PNF_NAME = "pnf-name";
+ private static final String TEST_PNF_IP_V4_ADDRESS = "1.1.1.1";
+ private static final String TEST_PNF_IP_V6_ADDRESS = "::/128";
+ private static final String TEST_SERVICE_INSTANCE_ID = "service-instance-id";
+
+ @Before
+ public void setUp() {
+ configDeployPropertiesForPnf.setServiceInstanceId(TEST_SERVICE_INSTANCE_ID);
+ configDeployPropertiesForPnf.setServiceModelUuid(TEST_SERVICE_MODEL_UUID);
+ configDeployPropertiesForPnf.setPnfCustomizationUuid(TEST_PNF_CUSTOMIZATION_UUID);
+ configDeployPropertiesForPnf.setPnfId(TEST_PNF_ID);
+ configDeployPropertiesForPnf.setPnfName(TEST_PNF_NAME);
+ configDeployPropertiesForPnf.setPnfIpV4Address(TEST_PNF_IP_V4_ADDRESS);
+ configDeployPropertiesForPnf.setPnfIpV6Address(TEST_PNF_IP_V6_ADDRESS);
+ }
+
+ @Test
+ public final void testConfigDeployPropertiesForPnfTest() {
+ assertNotNull(configDeployPropertiesForPnf.getServiceInstanceId());
+ assertNotNull(configDeployPropertiesForPnf.getServiceModelUuid());
+ assertNotNull(configDeployPropertiesForPnf.getPnfCustomizationUuid());
+ assertNotNull(configDeployPropertiesForPnf.getPnfId());
+ assertNotNull(configDeployPropertiesForPnf.getPnfName());
+
+ assertEquals(TEST_SERVICE_INSTANCE_ID, configDeployPropertiesForPnf.getServiceInstanceId());
+ assertEquals(TEST_SERVICE_MODEL_UUID, configDeployPropertiesForPnf.getServiceModelUuid());
+ assertEquals(TEST_PNF_CUSTOMIZATION_UUID, configDeployPropertiesForPnf.getPnfCustomizationUuid());
+ assertEquals(TEST_PNF_ID, configDeployPropertiesForPnf.getPnfId());
+ assertEquals(TEST_PNF_NAME, configDeployPropertiesForPnf.getPnfName());
+ assertEquals(TEST_PNF_IP_V4_ADDRESS, configDeployPropertiesForPnf.getPnfIpV4Address());
+ assertEquals(TEST_PNF_IP_V6_ADDRESS, configDeployPropertiesForPnf.getPnfIpV6Address());
+
+ }
+
+ @Test
+ public void testtoString() {
+ final StringBuilder sb = new StringBuilder("{");
+ sb.append("\"service-instance-id\":").append("\"").append(TEST_SERVICE_INSTANCE_ID).append("\"");
+ sb.append(", \"pnf-id\":").append("\"").append(TEST_PNF_ID).append("\"");
+ sb.append(", \"pnf-name\":").append("\"").append(TEST_PNF_NAME).append("\"");
+ sb.append(", \"pnf-ipv4-address\":").append("\"").append(TEST_PNF_IP_V4_ADDRESS).append("\"");
+ sb.append(", \"pnf-ipv6-address\":").append("\"").append(TEST_PNF_IP_V6_ADDRESS).append("\"");
+ sb.append(", \"service-model-uuid\":").append("\"").append(TEST_SERVICE_MODEL_UUID).append("\"");
+ sb.append(", \"pnf-customization-uuid\":").append("\"").append(TEST_PNF_CUSTOMIZATION_UUID).append("\"");
+ sb.append('}');
+ String Expexted = sb.toString();
+ assertEquals(Expexted, configDeployPropertiesForPnf.toString());
+ }
+
+}
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
new file mode 100644
index 0000000000..6039bd649c
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnfTest.java
@@ -0,0 +1,48 @@
+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 {
+ ConfigDeployPropertiesForVnf configDeployPropertiesForVnf = new ConfigDeployPropertiesForVnf();
+ private String serviceInstanceId;
+ private String vnfId;
+ private String vnfName;
+ private String serviceModelUuid;
+ private String vnfCustomizationUuid;
+
+ @Test
+ public final void testConfigDeployPropertiesForVnf() {
+ configDeployPropertiesForVnf.setServiceInstanceId("service-instance-id");
+ configDeployPropertiesForVnf.setServiceModelUuid("service-model-uuid");
+ configDeployPropertiesForVnf.setVnfCustomizationUuid("vnf-customization-uuid");
+ configDeployPropertiesForVnf.setVnfId("vnf-id");
+ configDeployPropertiesForVnf.setVnfName("vnf-name");
+ assertNotNull(configDeployPropertiesForVnf.getServiceInstanceId());
+ assertNotNull(configDeployPropertiesForVnf.getServiceModelUuid());
+ assertNotNull(configDeployPropertiesForVnf.getVnfCustomizationUuid());
+ assertNotNull(configDeployPropertiesForVnf.getVnfId());
+ assertNotNull(configDeployPropertiesForVnf.getVnfName());
+
+ assertEquals("service-instance-id", configDeployPropertiesForVnf.getServiceInstanceId());
+ assertEquals("service-model-uuid", configDeployPropertiesForVnf.getServiceModelUuid());
+ assertEquals("vnf-customization-uuid", configDeployPropertiesForVnf.getVnfCustomizationUuid());
+ assertEquals("vnf-id", configDeployPropertiesForVnf.getVnfId());
+ assertEquals("vnf-name", configDeployPropertiesForVnf.getVnfName());
+ }
+
+ @Test
+ public void testtoString() {
+ 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('}');
+ String Expexted = sb.toString();
+ assertEquals(Expexted, configDeployPropertiesForVnf.toString());
+
+ }
+}
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
new file mode 100644
index 0000000000..a977f8dd9e
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnfTest.java
@@ -0,0 +1,40 @@
+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 {
+ ConfigDeployRequestPnf configDeployRequestPnf = new ConfigDeployRequestPnf();
+ private String resolutionKey;
+ ConfigDeployPropertiesForPnf configDeployPropertiesForPnf = new ConfigDeployPropertiesForPnf();
+
+ @Test
+ public final void testConfigDeployRequestVnf() {
+ configDeployRequestPnf.setResolutionKey("resolution-key");
+ configDeployRequestPnf.setConfigDeployPropertiesForPnf(configDeployPropertiesForPnf);
+ assertNotNull(configDeployRequestPnf.getResolutionKey());
+ assertNotNull(configDeployRequestPnf.getConfigDeployPropertiesForPnf());
+ assertEquals("resolution-key", configDeployRequestPnf.getResolutionKey());
+ assertEquals(configDeployPropertiesForPnf, configDeployRequestPnf.getConfigDeployPropertiesForPnf());
+ }
+
+ @Test
+ public void testtoString() {
+ configDeployPropertiesForPnf.setServiceInstanceId("service-instance-id");
+ configDeployPropertiesForPnf.setServiceModelUuid("service-model-uuid");
+ configDeployPropertiesForPnf.setPnfCustomizationUuid("pnf-customization-uuid");
+ configDeployPropertiesForPnf.setPnfId("pnf-id");
+ configDeployPropertiesForPnf.setPnfName("pnf-name");
+ configDeployRequestPnf.setConfigDeployPropertiesForPnf(configDeployPropertiesForPnf);
+ 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('}');
+ String Expexted = sb.toString();
+
+ assertEquals(Expexted, configDeployRequestPnf.toString());
+ }
+
+}
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
new file mode 100644
index 0000000000..4b86eeb438
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnfTest.java
@@ -0,0 +1,41 @@
+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 {
+
+ ConfigDeployRequestVnf configDeployRequestVnf = new ConfigDeployRequestVnf();
+ private String resolutionKey;
+ ConfigDeployPropertiesForVnf configDeployPropertiesForVnf = new ConfigDeployPropertiesForVnf();
+
+ @Test
+ public final void testConfigDeployRequestVnf() {
+ configDeployRequestVnf.setResolutionKey("resolution-key");
+ configDeployRequestVnf.setConfigDeployPropertiesForVnf(configDeployPropertiesForVnf);
+ assertNotNull(configDeployRequestVnf.getResolutionKey());
+ assertNotNull(configDeployRequestVnf.getConfigDeployPropertiesForVnf());
+ assertEquals("resolution-key", configDeployRequestVnf.getResolutionKey());
+ assertEquals(configDeployPropertiesForVnf, configDeployRequestVnf.getConfigDeployPropertiesForVnf());
+ }
+
+ @Test
+ public void testtoString() {
+ configDeployPropertiesForVnf.setServiceInstanceId("service-instance-id");
+ configDeployPropertiesForVnf.setServiceModelUuid("service-model-uuid");
+ configDeployPropertiesForVnf.setVnfCustomizationUuid("vnf-customization-uuid");
+ configDeployPropertiesForVnf.setVnfId("vnf-id");
+ configDeployPropertiesForVnf.setVnfName("vnf-name");
+ configDeployRequestVnf.setConfigDeployPropertiesForVnf(configDeployPropertiesForVnf);
+ 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('}');
+ String Expexted = sb.toString();
+
+ assertEquals(Expexted, configDeployRequestVnf.toString());
+ }
+
+}
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/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfcInstanceGroupCustomization.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfcInstanceGroupCustomization.json
index 457b23f841..206403d83a 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfcInstanceGroupCustomization.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfcInstanceGroupCustomization.json
@@ -1,6 +1,5 @@
{
- "modelCustomizationUUID" : "modelCustomizationUUID",
- "modelUUID" : "modelUUID",
+ "id":1,
"vnfResourceCust" : {},
"instanceGroup" : {},
"function" : "function",