diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
33 files changed, 551 insertions, 269 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy index d85c387029..fe3686713a 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy @@ -22,25 +22,24 @@ package org.onap.so.bpmn.common.scripts -import org.onap.so.logger.LoggingAnchor -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper -import org.onap.logging.filter.base.ErrorCode - import static org.apache.commons.lang3.StringUtils.isBlank; - import javax.ws.rs.NotFoundException import javax.ws.rs.core.UriBuilder - import org.apache.commons.lang.StringUtils import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.AllottedResource -import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.client.PreconditionFailedException import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types +import org.onap.logging.filter.base.ErrorCode +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.client.PreconditionFailedException +import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -115,7 +114,7 @@ class AllottedResourceUtils { public boolean ifExistsAR(DelegateExecution execution, String allottedResourceId) { logger.trace("ifExistsAR ") try { - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId) + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(Types.ALLOTTED_RESOURCE.getFragment(allottedResourceId)) AAIResultWrapper wrapper = getAAIClient().get(resourceUri) Optional<AllottedResource> allottedResource = wrapper.asBean(AllottedResource.class) if(allottedResource.isPresent()) { @@ -150,7 +149,7 @@ class AllottedResourceUtils { Optional<AllottedResource> allottedResource = Optional.empty() try { logger.debug("GET AR Aai Path is: \n" + link) - AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(link).build()) + AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(Types.ALLOTTED_RESOURCE, UriBuilder.fromPath(link).build()) allottedResource = getAAIClient().get(AllottedResource.class,uri); if(allottedResource.isPresent()) { if (!isBlank(role)) { @@ -193,7 +192,7 @@ class AllottedResourceUtils { allottedResource.setOrchestrationStatus(status) logger.debug('AAI AR URI: ' + aaiARPath) - AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(aaiARPath).build()) + AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(Types.ALLOTTED_RESOURCE, UriBuilder.fromPath(aaiARPath).build()) getAAIClient().update(uri,allottedResource) }catch(Exception e){ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), @@ -208,7 +207,7 @@ class AllottedResourceUtils { logger.trace(" deleteAR - aaiARPath:" + aaiARPath) try { - AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(aaiARPath).build()) + AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(Types.ALLOTTED_RESOURCE, UriBuilder.fromPath(aaiARPath).build()) getAAIClient().delete(uri); }catch(NotFoundException ex){ logger.debug(" Delete AR Received a Not Found (404) Response") diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy index c5a0e46fe5..2f09ca2aa0 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy @@ -29,6 +29,8 @@ import org.onap.aai.domain.yang.VolumeGroup import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.onap.so.constants.Defaults import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.LoggingAnchor @@ -74,7 +76,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ execution.setVariable("CVGN_volumeGroupName", volumeGroupName) execution.setVariable("CVGN_aicCloudRegion", aicCloudRegion) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), aicCloudRegion, volumeGroupId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), aicCloudRegion).volumeGroup(volumeGroupId)) execution.setVariable("CVGN_volumeGroupGetEndpoint", uri) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy index f5cf541076..fce9286164 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy @@ -31,6 +31,7 @@ import org.onap.aaiclient.client.aai.entities.Relationships import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.onap.logging.filter.base.ErrorCode import org.onap.so.constants.Defaults import org.onap.so.logger.LoggingAnchor @@ -62,7 +63,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ String incomingGroupName = execution.getVariable("volumeGroupName") String incomingTenantId = execution.getVariable("tenantId") String aicCloudRegion = execution.getVariable("aicCloudRegion") - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), aicCloudRegion, volumeGroupId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), aicCloudRegion).volumeGroup(volumeGroupId)) AAIResultWrapper wrapper = getAAIClient().get(uri); Optional<VolumeGroup> volumeGroup = wrapper.asBean(VolumeGroup.class) Optional<Relationships> relationships = wrapper.getRelationships() @@ -70,7 +71,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ execution.setVariable("queryAAIVolumeGroupResponse", volumeGroup.get()) String volumeGroupTenantId = "" if(relationships.isPresent()){ - List<AAIResourceUri> tenantUris = relationships.get().getRelatedAAIUris(AAIObjectType.TENANT) + List<AAIResourceUri> tenantUris = relationships.get().getRelatedUris(Types.TENANT) for (AAIResourceUri tenantURI: tenantUris){ volumeGroupTenantId = tenantURI.getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId) } 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 9758c126a9..40b9388418 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 @@ -26,14 +26,13 @@ import org.apache.commons.lang.StringUtils import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.GenericVnfs -import org.onap.so.bpmn.core.RollbackData -import org.onap.aaiclient.client.aai.AAIObjectPlurals -import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder import org.onap.aaiclient.client.graphinventory.entities.uri.Depth -import org.onap.so.db.catalog.beans.OrchestrationStatus import org.onap.logging.filter.base.ErrorCode +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.db.catalog.beans.OrchestrationStatus import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum import org.slf4j.Logger @@ -154,9 +153,9 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ def vnfName = execution.getVariable("CAAIVfMod_vnfName") Optional<GenericVnf> genericVnfOp if (vnfId == null || vnfId.isEmpty()) { - genericVnfOp = getAAIClient().getFirst(GenericVnfs.class, GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE)) + genericVnfOp = getAAIClient().getFirst(GenericVnfs.class, GenericVnf.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()).queryParam("vnf-name", vnfName).depth(Depth.ONE)) } else { - genericVnfOp = getAAIClient().get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)) + genericVnfOp = getAAIClient().get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))) } try { if(genericVnfOp.isPresent()){ @@ -214,7 +213,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ genericVnf.setModelVersionId(execution.getVariable("CAAIVfMod_vnfPersonaVer")) try { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, newVnfId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(newVnfId)) getAAIClient().create(uri,genericVnf) execution.setVariable("CAAIVfMod_createGenericVnfResponseCode", 201) execution.setVariable("CAAIVfMod_createGenericVnfResponse", "Vnf Created") @@ -266,7 +265,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ try { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, newModuleId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(newModuleId)) getAAIClient().create(uri,vfModule) def statusCode = 201 execution.setVariable("CAAIVfMod_createVfModuleResponseCode", statusCode) 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 8a74307df6..511cd8d6e6 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 @@ -27,6 +27,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -111,7 +113,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor { def vnfId = execution.getVariable('CAAIVfModVG_vnfId') def vfModuleId = execution.getVariable('CAAIVfModVG_vfModuleId') try { - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId); + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)); Optional<org.onap.aai.domain.yang.VfModule> vfModule = getAAIClient().get(org.onap.aai.domain.yang.VfModule.class, resourceUri) if(vfModule.isPresent()){ execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', 200) @@ -164,8 +166,8 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor { def volumeGroupId = execution.getVariable('CAAIVfModVG_volumeGroupId') try { - AAIResourceUri vfModuleUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId,vfModuleId); - AAIResourceUri volumeGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwner, aicCloudRegion,volumeGroupId); + AAIResourceUri vfModuleUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)); + AAIResourceUri volumeGroupUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, aicCloudRegion).volumeGroup(volumeGroupId)); logger.debug("Creating relationship between Vf Module: " + vfModuleUri.build().toString() + " and Volume Group: " + volumeGroupUri.build().toString()) getAAIClient().connect(vfModuleUri,volumeGroupUri) execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', 200) 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 8c6ebefc49..02d0cd0287 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 @@ -28,6 +28,8 @@ import org.onap.aai.domain.yang.GenericVnf import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum @@ -83,7 +85,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ try { AaiUtil aaiUriUtil = new AaiUtil(this) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) uri.depth(Depth.ONE) Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class, uri) @@ -109,7 +111,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ try { String vnfId = execution.getVariable("DAAIVfMod_vnfId") - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) getAAIClient().delete(uri) execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode", 200) execution.setVariable("DAAIVfMod_deleteGenericVnfResponse", "Vnf Deleted") @@ -126,7 +128,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ String vnfId = execution.getVariable("DAAIVfMod_vnfId") String vfModuleId = execution.getVariable("DAAIVfMod_vfModuleId") - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)) getAAIClient().delete(uri) execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode", 200) 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 9593aa15be..63dd9af117 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 @@ -41,6 +41,8 @@ import org.onap.so.client.HttpClient import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.logger.MessageEnum @@ -85,7 +87,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{ def personaModelId = execution.getVariable('personaModelId') AaiUtil aaiUtil = new AaiUtil(this) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) uri.depth(Depth.ONE) String endPoint = aaiUtil.createAaiUri(uri) 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 040fc26f23..bd70ee79b7 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 @@ -22,6 +22,12 @@ package org.onap.so.bpmn.common.scripts +import org.onap.so.beans.nsmf.oof.NsiReqBody +import org.onap.so.beans.nsmf.oof.NssiReqBody +import org.onap.so.beans.nsmf.oof.RequestInfo +import org.onap.so.beans.nsmf.oof.SubnetCapability +import org.onap.so.beans.nsmf.oof.TemplateInfo + import static org.onap.so.bpmn.common.scripts.GenericUtils.* import javax.ws.rs.core.UriBuilder @@ -650,4 +656,65 @@ json.add("requestInfo", requestInfo) return json.toString() } + + public String buildSelectNSIRequest(String requestId, TemplateInfo nstInfo, List<TemplateInfo> nsstInfo, + String messageType, Map<String, Object> serviceProfile, + List<SubnetCapability> subnetCapabilities, Integer timeOut){ + + def transactionId = requestId + String correlator = requestId + logger.debug( "transactionId is: " + transactionId) + + String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator + + NsiReqBody nsiReqBody = new NsiReqBody() + + RequestInfo requestInfo = new RequestInfo() + requestInfo.setRequestId(requestId) + requestInfo.setTransactionId(transactionId) + requestInfo.setCallbackUrl(callbackUrl) + requestInfo.setSourceId("so") + requestInfo.setTimeout(timeOut) + //requestInfo.setNumSolutions() + + nsiReqBody.setRequestInfo(requestInfo) + nsiReqBody.setNSTInfo(nstInfo) + nsiReqBody.setServiceProfile(serviceProfile) + nsiReqBody.setSubnetCapabilities(subnetCapabilities) + nsiReqBody.setNSSTInfo(nsstInfo) + + + ObjectMapper objectMapper = new ObjectMapper() + + return objectMapper.writeValueAsString(nsiReqBody) + } + + public <T> String buildSelectNSSIRequest(String requestId, TemplateInfo nsstInfo, String messageType, + T sliceProfile, Integer timeOut){ + + def transactionId = requestId + String correlator = requestId + logger.debug( "transactionId is: " + transactionId) + + String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator + + NssiReqBody nssiReqBody = new NssiReqBody() + + RequestInfo requestInfo = new RequestInfo() + requestInfo.setRequestId(requestId) + requestInfo.setTransactionId(transactionId) + requestInfo.setCallbackUrl(callbackUrl) + requestInfo.setSourceId("so") + requestInfo.setTimeout(timeOut) + //requestInfo.setNumSolutions() + + nssiReqBody.setRequestInfo(requestInfo) + nssiReqBody.setSliceProfile(sliceProfile) + nssiReqBody.setNSSTInfo(nsstInfo) + + + ObjectMapper objectMapper = new ObjectMapper() + + return objectMapper.writeValueAsString(nssiReqBody) + } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy index 051f69381a..f7fbc3a371 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy @@ -35,6 +35,8 @@ import org.onap.aaiclient.client.aai.AAIResourcesClient import org.onap.aaiclient.client.aai.entities.AAIResultWrapper import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.springframework.web.util.UriUtils import org.onap.so.logger.MessageEnum @@ -123,7 +125,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { try { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) AAIResourcesClient resourceClient = new AAIResourcesClient() AAIResultWrapper wrapper = resourceClient.get(uri.depth(Depth.ONE), NotFoundException.class) GenericVnf responseData = wrapper.asBean(GenericVnf.class).get() @@ -167,7 +169,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { def vnfName = genericVnf.getVnfName() execution.setVariable('PUAAIVfMod_vnfName', vnfName) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)) AAIResourcesClient resourceClient = new AAIResourcesClient() @@ -224,7 +226,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { vfModule.setOrchestrationStatus(orchestrationStatus) AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)) client.update(uri, vfModule) execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', 200) // Set the output for this flow. The updated VfModule is an output, the generic VNF name, and for 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 9a78472540..b68bf7bfab 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 @@ -30,6 +30,8 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum @@ -134,7 +136,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { try { def vnfId = execution.getVariable('UAAIGenVnf_vnfId') - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) uri.depth(Depth.ONE) try { Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class,uri) @@ -223,7 +225,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { payload.setManagementV6Address(managementV6AddressEntry) payload.setOrchestrationStatus(orchestrationStatusEntry) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) try { getAAIClient().update(uri,payload) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy index 20f9721b2e..a8a289d4cb 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy @@ -30,6 +30,8 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -106,7 +108,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor { def vnfId = execution.getVariable('UAAIVfMod_vnfId') def vfModuleId = execution.getVariable('UAAIVfMod_vfModuleId') try { - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId); + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)); Optional<org.onap.aai.domain.yang.VfModule> vfModule = getAAIClient().get(org.onap.aai.domain.yang.VfModule.class, resourceUri) if (vfModule.isPresent()) { execution.setVariable('UAAIVfMod_getVfModuleResponseCode', 200) @@ -185,7 +187,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor { payload.setContrailServiceInstanceFqdn(contrailServiceInstanceFqdnEntry) try { - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId) + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)) getAAIClient().update(resourceUri, payload) execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', 200) execution.setVariable('UAAIVfMod_updateVfModuleResponse', "Success") 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 5a8244266b..8923051f84 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 @@ -35,12 +35,12 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.javatuples.Pair; import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; -import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.aaiclient.client.aai.entities.Relationships; import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.DelegateExecutionImpl; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @@ -54,6 +54,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; @@ -62,7 +63,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys; @@ -443,6 +443,17 @@ public class BBInputSetup implements JavaDelegate { protected void populateConfiguration(BBInputSetupParameter parameter) { Configuration configuration = null; + String replaceVnfModelCustomizationUUID = ""; + if (parameter.getRelatedInstanceList() != null) { + for (RelatedInstanceList relatedInstList : parameter.getRelatedInstanceList()) { + RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { + if (parameter.getIsReplace()) { + replaceVnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId(); + } + } + } + } for (Configuration configurationTemp : parameter.getServiceInstance().getConfigurations()) { if (parameter.getLookupKeyMap().get(ResourceKey.CONFIGURATION_ID) != null && configurationTemp.getConfigurationId() @@ -465,8 +476,17 @@ public class BBInputSetup implements JavaDelegate { if (configuration != null && parameter.getBbName().contains("Fabric")) { Vnfc vnfc = getVnfcToConfiguration(parameter.getConfigurationResourceKeys().getVnfcName()); configuration.setVnfc(vnfc); - this.mapCatalogConfiguration(configuration, parameter.getModelInfo(), parameter.getService(), - parameter.getConfigurationResourceKeys()); + if (!parameter.getBbName().contains("Delete")) { + if (parameter.getIsReplace()) { + parameter.getConfigurationResourceKeys() + .setVnfResourceCustomizationUUID(replaceVnfModelCustomizationUUID); + mapCatalogConfiguration(configuration, parameter.getModelInfo(), + parameter.getServiceModel().getNewService(), parameter.getConfigurationResourceKeys()); + } else { + mapCatalogConfiguration(configuration, parameter.getModelInfo(), + parameter.getServiceModel().getCurrentService(), parameter.getConfigurationResourceKeys()); + } + } } else if (configuration != null && parameter.getBbName().contains("Vrf")) { configuration.setModelInfoConfiguration(mapperLayer.mapCatalogConfigurationToConfiguration( findConfigurationResourceCustomization(parameter.getModelInfo(), parameter.getService()), null)); @@ -476,7 +496,7 @@ public class BBInputSetup implements JavaDelegate { } protected Vnfc getVnfcToConfiguration(String vnfcName) { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName); + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfcName)); Optional<org.onap.aai.domain.yang.Vnfc> vnfcOp = bbInputSetupUtils.getAAIResourceDepthOne(uri).asBean(org.onap.aai.domain.yang.Vnfc.class); if (vnfcOp.isPresent()) { @@ -1863,15 +1883,13 @@ public class BBInputSetup implements JavaDelegate { } private void mapRelationship(ServiceInstance serviceInstance, Relationships relationships) { - this.mapProject(relationships.getByType(AAIObjectType.PROJECT, uri -> uri.nodesOnly(true)), serviceInstance); - this.mapOwningEntity(relationships.getByType(AAIObjectType.OWNING_ENTITY, uri -> uri.nodesOnly(true)), - serviceInstance); - this.mapL3Networks(relationships.getRelatedAAIUris(AAIObjectType.L3_NETWORK), serviceInstance.getNetworks()); - this.mapGenericVnfs(relationships.getRelatedAAIUris(AAIObjectType.GENERIC_VNF), serviceInstance.getVnfs()); - this.mapPnfs(relationships.getRelatedAAIUris(AAIObjectType.PNF), serviceInstance.getPnfs()); - this.mapCollection(relationships.getByType(AAIObjectType.COLLECTION), serviceInstance); - this.mapConfigurations(relationships.getRelatedAAIUris(AAIObjectType.CONFIGURATION), - serviceInstance.getConfigurations()); + this.mapProject(relationships.getByType(Types.PROJECT, uri -> uri.nodesOnly(true)), serviceInstance); + this.mapOwningEntity(relationships.getByType(Types.OWNING_ENTITY, uri -> uri.nodesOnly(true)), serviceInstance); + this.mapL3Networks(relationships.getRelatedUris(Types.L3_NETWORK), serviceInstance.getNetworks()); + this.mapGenericVnfs(relationships.getRelatedUris(Types.GENERIC_VNF), serviceInstance.getVnfs()); + this.mapPnfs(relationships.getRelatedUris(Types.PNF), serviceInstance.getPnfs()); + this.mapCollection(relationships.getByType(Types.COLLECTION), serviceInstance); + this.mapConfigurations(relationships.getRelatedUris(Types.CONFIGURATION), serviceInstance.getConfigurations()); } protected void mapConfigurations(List<AAIResourceUri> relatedAAIUris, List<Configuration> configurations) { @@ -1910,11 +1928,10 @@ public class BBInputSetup implements JavaDelegate { 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))); + this.mapPlatform(relationships.getByType(Types.PLATFORM), genericVnf); + this.mapLineOfBusiness(relationships.getByType(Types.LINE_OF_BUSINESS), genericVnf); + genericVnf.getVolumeGroups().addAll(mapVolumeGroups(relationships.getByType(Types.VOLUME_GROUP))); + genericVnf.getInstanceGroups().addAll(mapInstanceGroups(relationships.getByType(Types.INSTANCE_GROUP))); } return genericVnf; @@ -2021,8 +2038,7 @@ public class BBInputSetup implements JavaDelegate { } private void setInstanceGroupForCollection(Collection collection, Relationships relationships) { - List<InstanceGroup> instanceGroupsList = - mapInstanceGroups(relationships.getByType(AAIObjectType.INSTANCE_GROUP)); + List<InstanceGroup> instanceGroupsList = mapInstanceGroups(relationships.getByType(Types.INSTANCE_GROUP)); if (!instanceGroupsList.isEmpty()) { collection.setInstanceGroup(instanceGroupsList.get(0)); } @@ -2059,9 +2075,8 @@ public class BBInputSetup implements JavaDelegate { 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), + this.mapNetworkPolicies(relationships.getByType(Types.NETWORK_POLICY), network.getNetworkPolicies()); + mapRouteTableReferences(relationships.getByType(Types.ROUTE_TABLE_REFERENCE), network.getContrailNetworkRouteTableReferences()); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java index 68161a8dd5..54922d4ea0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java @@ -34,6 +34,8 @@ final class BBInputSetupPnf { } static void populatePnfToServiceInstance(Pnfs pnfs, String pnfId, ServiceInstance serviceInstance) { + removePnfFromServiceIfExists(serviceInstance, pnfId); + Pnf pnf = new Pnf(); pnf.setPnfId(pnfId); pnf.setPnfName(pnfs.getInstanceName()); @@ -45,4 +47,9 @@ final class BBInputSetupPnf { serviceInstance.getPnfs().add(pnf); } + + private static void removePnfFromServiceIfExists(ServiceInstance serviceInstance, String pnfId) { + serviceInstance.getPnfs().stream().filter(pnf -> pnf.getPnfId().equals(pnfId)).findFirst() + .ifPresent(serviceInstance.getPnfs()::remove); + } } 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 4e0b5634ea..afd7f6433c 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 @@ -43,19 +43,20 @@ import org.onap.aai.domain.yang.VfModule; import org.onap.aai.domain.yang.VolumeGroup; import org.onap.aai.domain.yang.VolumeGroups; import org.onap.aai.domain.yang.VpnBinding; -import org.onap.so.bpmn.common.InjectionHelper; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; -import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; -import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException; -import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.aai.AAIResourcesClient; import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIFluentSingleType; import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException; +import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; @@ -86,7 +87,6 @@ import com.fasterxml.jackson.databind.type.TypeFactory; 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."; private static final String DATA_LOAD_ERROR = "Could not process loading data from database"; private static final String DATA_PARSE_ERROR = "Could not parse data"; @@ -189,7 +189,8 @@ public class BBInputSetupUtils { request.getOriginalRequestId(), PROCESSING_DATA_NAME_EXECUTION_FLOWS); try { ObjectMapper om = new ObjectMapper(); - TypeFactory typeFactory = objectMapper.getTypeFactory(); + TypeFactory typeFactory = om.getTypeFactory(); + om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); return om.readValue(requestProcessingData.getValue(), typeFactory.constructCollectionType(List.class, ExecuteBuildingBlock.class)); } catch (Exception e) { @@ -237,7 +238,7 @@ public class BBInputSetupUtils { } public Map<String, String> getURIKeysFromServiceInstance(String serviceInstanceId) { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)); return uri.getURIKeys(); } @@ -245,6 +246,8 @@ public class BBInputSetupUtils { if (requestId != null && !requestId.isEmpty()) { InfraActiveRequests activeRequest = this.getInfraActiveRequest(requestId); String requestBody = activeRequest.getRequestBody().replaceAll("\\\\", ""); + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); objectMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); objectMapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); return objectMapper.readValue(requestBody, RequestDetails.class); @@ -266,8 +269,10 @@ public class BBInputSetupUtils { 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)) + return injectionHelper.getAaiClient() + .get(CloudRegion.class, AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegionId)) + .depth(Depth.TWO)) .orElse(null); } else { @@ -279,13 +284,17 @@ public class BBInputSetupUtils { } public InstanceGroup getAAIInstanceGroup(String instanceGroupId) { - return injectionHelper.getAaiClient().get(InstanceGroup.class, - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId)).orElse(null); + return injectionHelper.getAaiClient() + .get(InstanceGroup.class, + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(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); + return injectionHelper.getAaiClient() + .get(org.onap.aai.domain.yang.Customer.class, + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId))) + .orElse(null); } public ServiceSubscription getAAIServiceSubscription(String globalSubscriberId, String subscriptionServiceType) { @@ -294,8 +303,9 @@ public class BBInputSetupUtils { || subscriptionServiceType.equals("")) { return null; } else { - return injectionHelper.getAaiClient().get(ServiceSubscription.class, AAIUriFactory - .createResourceUri(AAIObjectType.SERVICE_SUBSCRIPTION, globalSubscriberId, subscriptionServiceType)) + return injectionHelper + .getAaiClient().get(ServiceSubscription.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder + .business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType))) .orElse(null); } @@ -304,25 +314,25 @@ public class BBInputSetupUtils { public ServiceInstance getAAIServiceInstanceById(String serviceInstanceId) { return injectionHelper.getAaiClient() .get(ServiceInstance.class, AAIUriFactory - .createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId).depth(Depth.TWO)) + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(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); + return injectionHelper.getAaiClient().get(ServiceInstance.class, + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustomerId) + .serviceSubscription(serviceType).serviceInstance(serviceInstanceId)).depth(Depth.TWO)) + .orElse(null); } public org.onap.aai.domain.yang.ServiceInstance getAAIServiceInstanceByName(String serviceInstanceName, Customer customer) throws Exception { - Optional<org.onap.aai.domain.yang.ServiceInstance> aaiServiceInstance = - injectionHelper.getAaiClient() - .getOne(ServiceInstances.class, org.onap.aai.domain.yang.ServiceInstance.class, AAIUriFactory - .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer.getGlobalCustomerId(), - customer.getServiceSubscription().getServiceType()) - .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO)); + Optional<org.onap.aai.domain.yang.ServiceInstance> aaiServiceInstance = injectionHelper.getAaiClient().getOne( + ServiceInstances.class, org.onap.aai.domain.yang.ServiceInstance.class, + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId()) + .serviceSubscription(customer.getServiceSubscription().getServiceType()).serviceInstances()) + .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO)); return aaiServiceInstance.orElse(null); } @@ -331,7 +341,9 @@ public class BBInputSetupUtils { String serviceInstanceName) { return injectionHelper.getAaiClient().getOne(ServiceInstances.class, ServiceInstance.class, - AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, globalCustomerId, serviceType) + AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustomerId) + .serviceSubscription(serviceType).serviceInstances()) .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO)); } @@ -356,43 +368,46 @@ public class BBInputSetupUtils { } public Configuration getAAIConfiguration(String configurationId) { - return this.getConcreteAAIResource(Configuration.class, AAIObjectType.CONFIGURATION, configurationId); + return this.getConcreteAAIResource(Configuration.class, + AAIFluentTypeBuilder.network().configuration(configurationId)); } public GenericVnf getAAIGenericVnf(String vnfId) { - return getConcreteAAIResource(GenericVnf.class, AAIObjectType.GENERIC_VNF, vnfId); + return getConcreteAAIResource(GenericVnf.class, AAIFluentTypeBuilder.network().genericVnf(vnfId)); } public VpnBinding getAAIVpnBinding(String vpnBindingId) { - return getConcreteAAIResource(VpnBinding.class, AAIObjectType.VPN_BINDING, vpnBindingId); + return getConcreteAAIResource(VpnBinding.class, AAIFluentTypeBuilder.network().vpnBinding(vpnBindingId)); } public VolumeGroup getAAIVolumeGroup(String cloudOwnerId, String cloudRegionId, String volumeGroupId) { - return getConcreteAAIResource(VolumeGroup.class, AAIObjectType.VOLUME_GROUP, cloudOwnerId, cloudRegionId, - volumeGroupId); + return getConcreteAAIResource(VolumeGroup.class, AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudOwnerId, cloudRegionId).volumeGroup(volumeGroupId)); } public VfModule getAAIVfModule(String vnfId, String vfModuleId) { - return getConcreteAAIResource(VfModule.class, AAIObjectType.VF_MODULE, vnfId, vfModuleId); + return getConcreteAAIResource(VfModule.class, + AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)); } public L3Network getAAIL3Network(String networkId) { - return getConcreteAAIResource(L3Network.class, AAIObjectType.L3_NETWORK, networkId); + return getConcreteAAIResource(L3Network.class, AAIFluentTypeBuilder.network().l3Network(networkId)); } - private <T> T getConcreteAAIResource(Class<T> clazz, AAIObjectType objectType, Object... ids) { - return injectionHelper.getAaiClient() - .get(clazz, AAIUriFactory.createResourceUri(objectType, ids).depth(Depth.ONE)).orElseGet(() -> { - logger.debug("No resource of type: {} matched by ids: {}", objectType.typeName(), - Arrays.toString(ids)); + private <T> T getConcreteAAIResource(Class<T> clazz, AAIFluentSingleType type) { + return injectionHelper.getAaiClient().get(clazz, AAIUriFactory.createResourceUri(type).depth(Depth.ONE)) + .orElseGet(() -> { + logger.debug("No resource of type: {} matched by ids: {}", type.build().typeName(), + Arrays.toString(type.values())); return null; }); } public Optional<ServiceInstance> getRelatedServiceInstanceFromInstanceGroup(String instanceGroupId) throws Exception { - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId) - .relatedTo(AAIObjectPlurals.SERVICE_INSTANCE); + AAIPluralResourceUri uri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroupId)) + .relatedTo(Types.SERVICE_INSTANCES.getFragment()); Optional<ServiceInstances> serviceInstances = injectionHelper.getAaiClient().get(ServiceInstances.class, uri); ServiceInstance serviceInstance = null; if (!serviceInstances.isPresent()) { @@ -414,8 +429,9 @@ public class BBInputSetupUtils { public Optional<L3Network> getRelatedNetworkByNameFromServiceInstance(String serviceInstanceId, String networkName) throws MultipleObjectsFoundException { - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) - .relatedTo(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName); + AAIPluralResourceUri uri = + AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)) + .relatedTo(Types.L3_NETWORKS.getFragment()).queryParam("network-name", networkName); Optional<L3Networks> networks = injectionHelper.getAaiClient().get(L3Networks.class, uri); L3Network network = null; if (!networks.isPresent()) { @@ -435,34 +451,37 @@ public class BBInputSetupUtils { } public Optional<GenericVnf> getRelatedVnfByNameFromServiceInstance(String serviceInstanceId, String vnfName) { - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) - .relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName); + AAIPluralResourceUri uri = + AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)) + .relatedTo(Types.GENERIC_VNFS.getFragment()).queryParam("vnf-name", vnfName); return injectionHelper.getAaiClient().getOne(GenericVnfs.class, GenericVnf.class, uri); } public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVnf(String vnfId, String volumeGroupName) { - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) - .relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName); + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) + .relatedTo(Types.VOLUME_GROUPS.getFragment()).queryParam("volume-group-name", volumeGroupName); return injectionHelper.getAaiClient().getOne(VolumeGroups.class, VolumeGroup.class, uri); } public Optional<VolumeGroup> getRelatedVolumeGroupByIdFromVnf(String vnfId, String volumeGroupId) { - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) - .relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-id", volumeGroupId); + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) + .relatedTo(Types.VOLUME_GROUPS.getFragment()).queryParam("volume-group-id", volumeGroupId); return injectionHelper.getAaiClient().getOne(VolumeGroups.class, VolumeGroup.class, uri); } public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVfModule(String vnfId, String vfModuleId, String volumeGroupName) throws Exception { - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId) - .relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName); + AAIPluralResourceUri uri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)) + .relatedTo(Types.VOLUME_GROUPS.getFragment()).queryParam("volume-group-name", volumeGroupName); return injectionHelper.getAaiClient().getOne(VolumeGroups.class, VolumeGroup.class, uri); } public Optional<VolumeGroup> getRelatedVolumeGroupFromVfModule(String vnfId, String vfModuleId) throws Exception { - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId) - .relatedTo(AAIObjectPlurals.VOLUME_GROUP); + AAIPluralResourceUri uri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)) + .relatedTo(Types.VOLUME_GROUPS.getFragment()); return injectionHelper.getAaiClient().getOne(VolumeGroups.class, VolumeGroup.class, uri); } @@ -470,9 +489,9 @@ public class BBInputSetupUtils { org.onap.aai.domain.yang.L3Network aaiLocalNetwork) { AAIResultWrapper networkWrapper = new AAIResultWrapper(aaiLocalNetwork); if (networkWrapper.getRelationships().isPresent() - && !networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING).isEmpty()) { + && !networkWrapper.getRelationships().get().getRelatedUris(Types.VPN_BINDING).isEmpty()) { return getAAIResourceDepthOne( - networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING).get(0)) + networkWrapper.getRelationships().get().getRelatedUris(Types.VPN_BINDING).get(0)) .asBean(org.onap.aai.domain.yang.VpnBinding.class); } return Optional.empty(); @@ -481,7 +500,7 @@ public class BBInputSetupUtils { public ServiceInstances getAAIServiceInstancesGloballyByName(String serviceInstanceName) { return injectionHelper.getAaiClient() - .get(ServiceInstances.class, AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE) + .get(ServiceInstances.class, AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCES.getFragment()) .queryParam("service-instance-name", serviceInstanceName)) .orElseGet(() -> { logger.debug("No Service Instance matched by name"); @@ -491,26 +510,27 @@ public class BBInputSetupUtils { public boolean existsAAINetworksGloballyByName(String networkName) { - AAIPluralResourceUri l3networkUri = - AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName); + AAIPluralResourceUri l3networkUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Networks()) + .queryParam("network-name", networkName); AAIResourcesClient aaiRC = injectionHelper.getAaiClient(); return aaiRC.exists(l3networkUri); } public boolean existsAAIVfModuleGloballyByName(String vfModuleName) { AAIPluralResourceUri vfModuleUri = - AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE).queryParam("vf-module-name", vfModuleName); + AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment()).queryParam("vf-module-name", vfModuleName); return injectionHelper.getAaiClient().exists(vfModuleUri); } public boolean existsAAIConfigurationGloballyByName(String configurationName) { - AAIPluralResourceUri configUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION) - .queryParam("configuration-name", configurationName); + AAIPluralResourceUri configUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configurations()) + .queryParam("configuration-name", configurationName); return injectionHelper.getAaiClient().exists(configUri); } public boolean existsAAIVolumeGroupGloballyByName(String volumeGroupName) { - AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP) + AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(Types.VOLUME_GROUPS.getFragment()) .queryParam("volume-group-name", volumeGroupName); return injectionHelper.getAaiClient().exists(volumeGroupUri); } @@ -519,7 +539,7 @@ public class BBInputSetupUtils { return injectionHelper.getAaiClient() .get(GenericVnfs.class, - AAIUriFactory.createNodesUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName)) + AAIUriFactory.createNodesUri(Types.GENERIC_VNFS.getFragment()).queryParam("vnf-name", vnfName)) .orElseGet(() -> { logger.debug("No GenericVnfs matched by name"); return null; @@ -528,8 +548,9 @@ public class BBInputSetupUtils { public Optional<Configuration> getRelatedConfigurationByNameFromServiceInstance(String serviceInstanceId, String configurationName) { - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) - .relatedTo(AAIObjectPlurals.CONFIGURATION).queryParam("configuration-name", configurationName); + AAIPluralResourceUri uri = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)) + .relatedTo(Types.CONFIGURATIONS.getFragment()).queryParam("configuration-name", configurationName); return injectionHelper.getAaiClient().getOne(Configurations.class, Configuration.class, uri); } } 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 c7e3234a56..cae18a1da0 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,14 +24,14 @@ package org.onap.so.bpmn.servicedecomposition.tasks; import java.util.List; import java.util.Optional; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; -import org.onap.aaiclient.client.aai.entities.Relationships; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -88,8 +88,8 @@ public class CloudInfoFromAAI { 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); + List<AAIResultWrapper> cloudRegions = relationships.getByType(Types.CLOUD_REGION); + List<AAIResultWrapper> tenants = relationships.getByType(Types.TENANT); if (!cloudRegions.isEmpty()) { AAIResultWrapper cloudRegionWrapper = cloudRegions.get(0); Optional<org.onap.aai.domain.yang.CloudRegion> aaiCloudRegionOp = diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java index 51b1a218c8..55d76819fc 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java @@ -101,6 +101,7 @@ public class AbstractCDSProcessingBBUtils { ExecutionServiceInput executionServiceInput = prepareExecutionServiceInput(executionObject); execution.setVariable(EXEC_INPUT, executionServiceInput); + logger.debug("Input payload: " + executionServiceInput.getPayload()); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForPnf.java new file mode 100644 index 0000000000..0d79dbb375 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForPnf.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Nokia + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 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 com.google.gson.JsonObject; +import org.onap.so.client.exception.PayloadGenerationException; +import org.onap.so.serviceinstancebeans.Service; +import org.onap.so.serviceinstancebeans.Pnfs; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +@Component +public class ConfigureInstanceParamsForPnf { + + private ExtractServiceFromUserParameters extractServiceFromUserParameters; + + @Autowired + public ConfigureInstanceParamsForPnf(ExtractServiceFromUserParameters extractServiceFromUserParameters) { + this.extractServiceFromUserParameters = extractServiceFromUserParameters; + } + + /** + * Read instance parameters for PNF and put into JsonObject. + * + * @param jsonObject - JsonObject which will hold the payload to send to CDS. + * @param userParamsFromRequest - User parameters. + * @param modelCustomizationUuid - Unique ID for Pnf. + * @throws PayloadGenerationException if it doesn't able to populate instance parameters from SO payload. + */ + public void populateInstanceParams(JsonObject jsonObject, List<Map<String, Object>> userParamsFromRequest, + String modelCustomizationUuid) throws PayloadGenerationException { + try { + Service service = extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest); + List<Map<String, String>> instanceParamsList = getInstanceParamForPnf(service, modelCustomizationUuid); + + instanceParamsList.stream().flatMap(instanceParamsMap -> instanceParamsMap.entrySet().stream()) + .forEachOrdered(entry -> jsonObject.addProperty(entry.getKey(), entry.getValue())); + } catch (Exception exception) { + throw new PayloadGenerationException("Couldn't able to resolve instance parameters", exception); + } + } + + private List<Map<String, String>> getInstanceParamForPnf(Service service, String genericPnfModelCustomizationUuid) + throws PayloadGenerationException { + Optional<Pnfs> foundedPnfs = service.getResources().getPnfs().stream() + .filter(pnfs -> pnfs.getModelInfo().getModelCustomizationId().equals(genericPnfModelCustomizationUuid)) + .findFirst(); + if (foundedPnfs.isPresent()) { + return foundedPnfs.get().getInstanceParams(); + } else { + throw new PayloadGenerationException(String.format( + "Can not find pnf for genericPnfModelCustomizationUuid: %s", genericPnfModelCustomizationUuid)); + } + } +} 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 948c9326d8..843cca0848 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 @@ -30,6 +30,9 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.aai.domain.yang.LInterface; import org.onap.aai.domain.yang.Vserver; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.logging.filter.base.ErrorCode; import org.onap.logging.filter.base.ONAPComponents; import org.onap.logging.filter.base.ONAPComponentsList; import org.onap.so.bpmn.common.BuildingBlockExecution; @@ -38,9 +41,6 @@ import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; -import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.onap.so.objects.audit.AAIObjectAudit; @@ -280,20 +280,19 @@ public class ExceptionBuilder { + auditList.getAuditType() + "d in AAI: "); Stream<AAIObjectAudit> vServerLInterfaceAuditStream = auditList.getAuditList().stream() - .filter(auditObject -> auditObject.getAaiObjectType().equals(AAIObjectType.VSERVER.typeName()) - || auditObject.getAaiObjectType().equals(AAIObjectType.L_INTERFACE.typeName())); + .filter(auditObject -> auditObject.getAaiObjectType().equals(Types.VSERVER.typeName()) + || auditObject.getAaiObjectType().equals(Types.L_INTERFACE.typeName())); List<AAIObjectAudit> filteredAuditStream = vServerLInterfaceAuditStream.filter(a -> !a.isDoesObjectExist()).collect(Collectors.toList()); for (AAIObjectAudit object : filteredAuditStream) { - if (object.getAaiObjectType().equals(AAIObjectType.L_INTERFACE.typeName())) { + if (object.getAaiObjectType().equals(Types.L_INTERFACE.typeName())) { LInterface li = objectMapper.getMapper().convertValue(object.getAaiObject(), LInterface.class); - errorMessage = errorMessage - .append(AAIObjectType.L_INTERFACE.typeName() + " " + li.getInterfaceId() + ", "); + errorMessage = + errorMessage.append(Types.L_INTERFACE.typeName() + " " + li.getInterfaceId() + ", "); } else { Vserver vs = objectMapper.getMapper().convertValue(object.getAaiObject(), Vserver.class); - errorMessage = - errorMessage.append(AAIObjectType.VSERVER.typeName() + " " + vs.getVserverId() + ", "); + errorMessage = errorMessage.append(Types.VSERVER.typeName() + " " + vs.getVserverId() + ", "); } } diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy index f0b1bfe047..7509233ffa 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy @@ -20,30 +20,26 @@ package org.onap.so.bpmn.common.scripts -import org.camunda.bpm.engine.delegate.DelegateExecution +import static org.junit.Assert.assertEquals +import static org.junit.Assert.assertTrue +import static org.mockito.ArgumentMatchers.any +import static org.mockito.Mockito.atLeastOnce +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.spy +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.when +import javax.ws.rs.core.UriBuilder import org.junit.Before import org.junit.Ignore import org.junit.Test -import org.mockito.Mockito import org.mockito.internal.stubbing.answers.DoesNothing import org.onap.aai.domain.yang.AllottedResource import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.entities.AAIResultWrapper import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory -import javax.ws.rs.core.UriBuilder -import static org.junit.Assert.assertEquals -import static org.junit.Assert.assertTrue -import static org.mockito.ArgumentMatchers.any -import static org.mockito.ArgumentMatchers.anyObject -import static org.mockito.ArgumentMatchers.isA -import static org.mockito.Mockito.atLeastOnce -import static org.mockito.Mockito.doNothing -import static org.mockito.Mockito.doThrow -import static org.mockito.Mockito.mock -import static org.mockito.Mockito.spy -import static org.mockito.Mockito.verify -import static org.mockito.Mockito.when +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types class AllottedResourceUtilsTest extends MsoGroovyTest{ @@ -67,7 +63,7 @@ class AllottedResourceUtilsTest extends MsoGroovyTest{ expectedAllottedResource.setId("ID") expectedAllottedResource.setResourceVersion("1.2") when(client.get(any(AAIResourceUri.class))).thenReturn(new AAIResultWrapper(expectedAllottedResource)) - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId) + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(Types.ALLOTTED_RESOURCE.getFragment(allottedResourceId)) when(allottedResourceUtils.setExecutionVariables(mockExecution,expectedAllottedResource,resourceUri)).thenAnswer(new DoesNothing()) boolean allottedResource = allottedResourceUtils.ifExistsAR(mockExecution,allottedResourceId) assertTrue(allottedResource) @@ -79,7 +75,7 @@ class AllottedResourceUtilsTest extends MsoGroovyTest{ AllottedResource expectedAllottedResource = new AllottedResource() expectedAllottedResource.setId("ID") - AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(ALLOTTED_RESOURSE_URI).build()) + AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(Types.ALLOTTED_RESOURCE, UriBuilder.fromPath(ALLOTTED_RESOURSE_URI).build()) when(client.get(AllottedResource.class, uri)).thenReturn(Optional.of(expectedAllottedResource)) Optional<AllottedResource> allottedResource = allottedResourceUtils.getARbyLink(mockExecution, ALLOTTED_RESOURSE_URI,"") assertEquals(expectedAllottedResource.getId(),allottedResource.get().getId()) diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy index 8a80d79cf9..df4d371fa5 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy @@ -22,6 +22,13 @@ package org.onap.so.bpmn.common.scripts +import static org.assertj.core.api.Assertions.catchThrowableOfType +import static org.junit.Assert.assertEquals +import static org.junit.Assert.assertFalse +import static org.junit.Assert.assertTrue +import static org.mockito.Mockito.spy +import static org.mockito.Mockito.when +import javax.ws.rs.core.UriBuilder import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake @@ -31,29 +38,18 @@ import org.mockito.Mock import org.mockito.MockitoAnnotations import org.onap.aai.domain.yang.RelationshipList import org.onap.aai.domain.yang.VolumeGroup -import org.onap.so.bpmn.common.scripts.ConfirmVolumeGroupName -import org.onap.so.bpmn.common.scripts.ConfirmVolumeGroupNameFactory -import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.AAIResourcesClient import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.onap.so.constants.Defaults import org.springframework.http.HttpStatus -import javax.ws.rs.core.UriBuilder - -import static org.assertj.core.api.Assertions.catchThrowableOfType -import static org.junit.Assert.assertEquals -import static org.junit.Assert.assertFalse -import static org.junit.Assert.assertTrue -import static org.mockito.Mockito.spy -import static org.mockito.Mockito.when - class ConfirmVolumeGroupNameTest { private static final AAIResourceUri RESOURCE_URI = AAIUriFactory.createResourceFromExistingURI( - AAIObjectType.VOLUME_GROUP, UriBuilder.fromPath('/aai/test/volume-groups/volume-group/testVolumeGroup').build()) + Types.VOLUME_GROUP, UriBuilder.fromPath('/aai/test/volume-groups/volume-group/testVolumeGroup').build()) private ConfirmVolumeGroupName confirmVolumeGroupName @Mock @@ -79,7 +75,7 @@ class ConfirmVolumeGroupNameTest { String volumeGroupId = "volume-group-id-1" String volumeGroupName = "volume-group-name-1" String aicCloudRegion = "aic-cloud-region-1" - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER, aicCloudRegion, volumeGroupId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), aicCloudRegion).volumeGroup(volumeGroupId)) delegateExecution.setVariable("ConfirmVolumeGroupName_volumeGroupId", volumeGroupId) delegateExecution.setVariable("ConfirmVolumeGroupName_volumeGroupName", volumeGroupName) diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy index cd57434d5f..3b7179df6c 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy @@ -40,6 +40,8 @@ import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.entities.AAIResultWrapper import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.onap.so.constants.Defaults class ConfirmVolumeGroupTenantTest extends MsoGroovyTest { @@ -79,7 +81,7 @@ class ConfirmVolumeGroupTenantTest extends MsoGroovyTest { when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner') when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - AAIResourceUri arURI = AAIUriFactory. createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), "aicCloudRegionId","volumeGroupId") + AAIResourceUri arURI = AAIUriFactory. createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), "aicCloudRegionId").volumeGroup("volumeGroupId")) AAIResultWrapper wrapper = new AAIResultWrapper(expectedVolumeGroup) when(client.get(arURI)).thenReturn(wrapper) confirmVolumeGroupTenant.preProcessRequest(mockExecution) diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroupTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroupTest.groovy index 4f36aec827..cd9061cd19 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroupTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroupTest.groovy @@ -31,6 +31,8 @@ import org.mockito.Spy import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.onap.so.constants.Defaults class CreateAAIVfModuleVolumeGroupTest extends MsoGroovyTest{ @@ -50,7 +52,7 @@ class CreateAAIVfModuleVolumeGroupTest extends MsoGroovyTest{ when(mockExecution.getVariable("CAAIVfModVG_vfModuleId")).thenReturn("VfModule123") org.onap.aai.domain.yang.VfModule vfModuleExpected = new org.onap.aai.domain.yang.VfModule() vfModuleExpected.setVfModuleId("VfModule123") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "Vnf123", "VfModule123"); + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("Vnf123").vfModule("VfModule123")); when(client.get(org.onap.aai.domain.yang.VfModule.class,resourceUri)).thenReturn(Optional.of(vfModuleExpected)) createAAIVfModuleVolumeGroup.getVfModule(mockExecution) Mockito.verify(mockExecution).setVariable("CAAIVfModVG_getVfModuleResponseCode", 200) @@ -61,7 +63,7 @@ class CreateAAIVfModuleVolumeGroupTest extends MsoGroovyTest{ void testGetVfModuleNotFound (){ when(mockExecution.getVariable("CAAIVfModVG_vnfId")).thenReturn("Vnf123") when(mockExecution.getVariable("CAAIVfModVG_vfModuleId")).thenReturn("VfModule123") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "Vnf123", "VfModule123"); + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("Vnf123").vfModule("VfModule123")); when(client.get(org.onap.aai.domain.yang.VfModule.class,resourceUri)).thenReturn(Optional.empty()) createAAIVfModuleVolumeGroup.getVfModule(mockExecution) Mockito.verify(mockExecution).setVariable("CAAIVfModVG_getVfModuleResponseCode", 404) @@ -72,7 +74,7 @@ class CreateAAIVfModuleVolumeGroupTest extends MsoGroovyTest{ void testGetVfModuleException (){ when(mockExecution.getVariable("CAAIVfModVG_vnfId")).thenReturn("Vnf123") when(mockExecution.getVariable("CAAIVfModVG_vfModuleId")).thenReturn("VfModule123") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "Vnf123", "VfModule123"); + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("Vnf123").vfModule("VfModule123")); when(client.get(org.onap.aai.domain.yang.VfModule.class,resourceUri)).thenThrow(new NullPointerException("Error in AAI client")) createAAIVfModuleVolumeGroup.getVfModule(mockExecution) Mockito.verify(mockExecution).setVariable("CAAIVfModVG_getVfModuleResponseCode", 500) @@ -90,8 +92,8 @@ class CreateAAIVfModuleVolumeGroupTest extends MsoGroovyTest{ vfModuleExpected.setVfModuleId("VfModule123") vfModuleExpected.setResourceVersion("12345") when(mockExecution.getVariable("CAAIVfModVG_getVfModuleResponse")).thenReturn(vfModuleExpected) - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "Vnf123", "VfModule123"); - AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(),"CloudRegion1", "VolumeGroup1") + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("Vnf123").vfModule("VfModule123")); + AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), "CloudRegion1").volumeGroup("VolumeGroup1")) doNothing().when(client).connect(resourceUri ,resourceUri1 ) createAAIVfModuleVolumeGroup.updateVfModule(mockExecution) Mockito.verify(mockExecution).setVariable("CAAIVfModVG_updateVfModuleResponseCode", 200) @@ -109,8 +111,8 @@ class CreateAAIVfModuleVolumeGroupTest extends MsoGroovyTest{ vfModuleExpected.setResourceVersion("12345") when(mockExecution.getVariable("CAAIVfModVG_cloudOwner")).thenReturn("cloudOwner") when(mockExecution.getVariable("CAAIVfModVG_getVfModuleResponse")).thenReturn(vfModuleExpected) - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "Vnf123", "VfModule123"); - AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, 'cloudOwner',"CloudRegion1", "VolumeGroup1") + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("Vnf123").vfModule("VfModule123")); + AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion('cloudOwner', "CloudRegion1").volumeGroup("VolumeGroup1")) doThrow(new NullPointerException("Error in AAI client")).when(client).connect(resourceUri ,resourceUri1 ) createAAIVfModuleVolumeGroup.updateVfModule(mockExecution) Mockito.verify(mockExecution).setVariable("CAAIVfModVG_updateVfModuleResponseCode", 500) diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy index c8eeb0a957..77e4374921 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy @@ -31,16 +31,15 @@ import org.junit.rules.ExpectedException import org.junit.runner.RunWith import org.mockito.junit.MockitoJUnitRunner import org.onap.aai.domain.yang.GenericVnf -import org.onap.so.bpmn.mock.FileUtil -import org.onap.so.client.HttpClient -import org.onap.aaiclient.client.aai.AAIObjectPlurals -import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.AAIResourcesClient import org.onap.aaiclient.client.aai.entities.AAIResultWrapper import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder import org.onap.aaiclient.client.graphinventory.entities.uri.Depth +import org.onap.so.bpmn.mock.FileUtil +import org.onap.so.client.HttpClient import org.onap.so.constants.Defaults @RunWith(MockitoJUnitRunner.Silent.class) @@ -111,8 +110,8 @@ abstract class MsoGroovyTest { } protected Optional<GenericVnf> mockAAIGenericVnf(String vnfId,String file){ - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) - AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE) + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) + AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE) Optional<GenericVnf> genericVnf = getAAIObjectFromJson(GenericVnf.class,file); when(client.get(GenericVnf.class, resourceUri)).thenReturn(genericVnf) when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(genericVnf) @@ -120,8 +119,8 @@ abstract class MsoGroovyTest { } protected Optional<GenericVnf> mockAAIGenericVnfByName(String vnfName){ - AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName) - AAIPluralResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE) + AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()).queryParam("vnf-name", vnfName) + AAIPluralResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()).queryParam("vnf-name", vnfName).depth(Depth.ONE) Optional<GenericVnf> genericVnf = getAAIObjectFromJson(GenericVnf.class,"__files/aai/GenericVnf.json"); when(client.get(GenericVnf.class, resourceUri)).thenReturn(genericVnf) when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(genericVnf) @@ -129,21 +128,21 @@ abstract class MsoGroovyTest { } protected void mockAAIGenericVnfNotFound(String vnfId){ - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE) - AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE) + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE) + AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE) when(client.get(GenericVnf.class, resourceUri)).thenReturn(Optional.empty()) when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(Optional.empty()) } protected void mockAAIGenericVnfByNameNotFound(String vnfName){ - AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName) - AAIPluralResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE) + AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()).queryParam("vnf-name", vnfName) + AAIPluralResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()).queryParam("vnf-name", vnfName).depth(Depth.ONE) when(client.get(GenericVnf.class, resourceUri)).thenReturn(Optional.empty()) when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(Optional.empty()) } protected AAIResultWrapper mockVolumeGroupWrapper(String region, String volumeGroupId, String file){ - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, region,volumeGroupId) + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, region).volumeGroup(volumeGroupId)) String json = FileUtil.readResourceFile(file) AAIResultWrapper resultWrapper = new AAIResultWrapper(json) when(client.get(resourceUri)).thenReturn(resultWrapper) 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 1918d10fe7..94317f49ae 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 @@ -38,6 +38,8 @@ import org.mockito.Spy import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.onap.aai.domain.yang.VfModule import com.github.tomakehurst.wiremock.junit.WireMockRule @@ -67,7 +69,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest { when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool") VfModule vfModule = new VfModule() vfModule.setVfModuleId("supercool") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "skask", "supercool"); + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("skask").vfModule("supercool")); when(client.get(VfModule.class,resourceUri)).thenReturn(Optional.of(vfModule)) updateAAIVfModule.getVfModule(mockExecution) verify(mockExecution).setVariable(prefix + "getVfModuleResponseCode", 200) @@ -79,7 +81,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest { when(mockExecution.getVariable("prefix")).thenReturn(prefix) when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "skask", "supercool"); + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("skask").vfModule("supercool")); when(client.get(VfModule.class,resourceUri)).thenReturn(Optional.empty()) updateAAIVfModule.getVfModule(mockExecution) verify(mockExecution).setVariable(prefix + "getVfModuleResponseCode", 404) @@ -91,7 +93,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest { when(mockExecution.getVariable("prefix")).thenReturn(prefix) when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "skask", "supercool"); + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("skask").vfModule("supercool")); when(client.get(VfModule.class,resourceUri)).thenThrow(new NullPointerException("Error from AAI client")) updateAAIVfModule.getVfModule(mockExecution) verify(mockExecution).setVariable(prefix + "getVfModuleResponseCode", 500) 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 4755e58582..9195df0955 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 @@ -39,12 +39,12 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; @@ -80,6 +80,7 @@ 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.DeserializationFeature; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -87,10 +88,11 @@ public class BBInputSetupMapperLayerTest { BBInputSetupMapperLayer bbInputSetupMapperLayer = new BBInputSetupMapperLayer(); - ObjectMapper mapper = new ObjectMapper(); + ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/"; + @Test public void testMapOrchestrationStatusFromAAI() { OrchestrationStatus expected = OrchestrationStatus.INVENTORIED; 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 dd79d2772f..127253a72e 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 @@ -59,7 +59,6 @@ import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; -import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; @@ -69,12 +68,12 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; @@ -1337,6 +1336,10 @@ public class BBInputSetupTest { Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId"); String bbName = AssignFlows.FABRIC_CONFIGURATION.toString(); + + ServiceModel serviceModel = new ServiceModel(); + serviceModel.setCurrentService(service); + ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); configResourceKeys.setVnfcName(vnfcName); Vnfc vnfc = new Vnfc(); @@ -1348,7 +1351,8 @@ public class BBInputSetupTest { BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID) .setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance) .setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setInstanceName(instanceName) - .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails).build(); + .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails) + .setServiceModel(serviceModel).build(); SPY_bbInputSetup.populateConfiguration(parameter); verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys); @@ -1374,6 +1378,52 @@ public class BBInputSetupTest { } @Test + public void testPopulateConfigurationReplace() 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(); + + ServiceModel serviceModel = new ServiceModel(); + serviceModel.setNewService(service); + + ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); + configResourceKeys.setVnfcName(vnfcName); + Vnfc vnfc = new Vnfc(); + vnfc.setVnfcName(vnfcName); + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class); + doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service, + configResourceKeys); + doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName); + BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID) + .setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance) + .setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setInstanceName(instanceName) + .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails) + .setServiceModel(serviceModel).setIsReplace(true).build(); + SPY_bbInputSetup.populateConfiguration(parameter); + configResourceKeys.setVnfResourceCustomizationUUID("my-test-uuid"); + verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service, + configResourceKeys); + } + + @Test public void testMapCatalogConfiguration() { ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); L3Network network = new L3Network(); @@ -1420,6 +1470,9 @@ public class BBInputSetupTest { vnfc.setVnfcName(vnfcName); RequestDetails requestDetails = new RequestDetails(); + ServiceModel serviceModel = new ServiceModel(); + serviceModel.setCurrentService(service); + CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new CvnfcConfigurationCustomization(); ConfigurationResource configurationResource = new ConfigurationResource(); @@ -1432,7 +1485,8 @@ public class BBInputSetupTest { BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID) .setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance) .setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setInstanceName(instanceName) - .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails).build(); + .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails) + .setServiceModel(serviceModel).build(); SPY_bbInputSetup.populateConfiguration(parameter); verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys); @@ -1462,6 +1516,10 @@ public class BBInputSetupTest { lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId"); String bbName = AssignFlows.VNF.toString(); + + ServiceModel serviceModel = new ServiceModel(); + serviceModel.setCurrentService(service); + Platform expectedPlatform = new Platform(); LineOfBusiness expectedLineOfBusiness = new LineOfBusiness(); String resourceId = "123"; @@ -1481,7 +1539,8 @@ public class BBInputSetupTest { .setLineOfBusiness(lineOfBusiness).setService(service).setBbName(bbName) .setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap) .setRelatedInstanceList(requestDetails.getRelatedInstanceList()).setResourceId(resourceId) - .setVnfType(vnfType).setProductFamilyId(requestDetails.getRequestInfo().getProductFamilyId()).build(); + .setVnfType(vnfType).setProductFamilyId(requestDetails.getRequestInfo().getProductFamilyId()) + .setServiceModel(serviceModel).build(); SPY_bbInputSetup.populateGenericVnf(parameter); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); @@ -1770,7 +1829,8 @@ public class BBInputSetupTest { expectedAAI.setRelationshipList(relationshipList); Configuration expected = new Configuration(); - AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "configurationId"); + AAIResourceUri aaiResourceUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration("configurationId")); AAIResultWrapper configurationWrapper = new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); @@ -1794,7 +1854,8 @@ public class BBInputSetupTest { expectedAAI.setRelationshipList(relationshipList); GenericVnf expected = new GenericVnf(); - AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId"); + AAIResourceUri aaiResourceUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")); AAIResultWrapper vnfWrapper = new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); @@ -1824,7 +1885,7 @@ public class BBInputSetupTest { expectedAAI.setRelationshipList(relationshipList); Pnf expected = new Pnf(); - AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.PNF, "pnfId"); + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf("pnfId")); AAIResultWrapper pnfWrapper = new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); @@ -1948,7 +2009,8 @@ public class BBInputSetupTest { List<L3Network> l3Networks = new ArrayList<>(); AAIResultWrapper l3NetworksWrapper = new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); - AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, "networkId"); + AAIResourceUri aaiResourceUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network("networkId")); doReturn(l3NetworksWrapper).when(SPY_bbInputSetupUtils).getAAIResourceDepthTwo(aaiResourceUri); doReturn(expected).when(bbInputSetupMapperLayer).mapAAIL3Network(isA(org.onap.aai.domain.yang.L3Network.class)); @@ -3362,7 +3424,7 @@ public class BBInputSetupTest { String vnfcName = "vnfcName"; org.onap.aai.domain.yang.Configuration expectedAAI = new org.onap.aai.domain.yang.Configuration(); - AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName); + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfcName)); AAIResultWrapper configurationWrapper = new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); 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 b623475939..85774ec23c 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 @@ -24,7 +24,6 @@ package org.onap.so.bpmn.servicedecomposition.tasks; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; -import static org.hamcrest.CoreMatchers.containsString; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; @@ -43,6 +42,7 @@ import java.nio.file.Paths; import java.util.Arrays; import java.util.List; import java.util.Optional; +import com.fasterxml.jackson.databind.DeserializationFeature; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -65,33 +65,35 @@ import org.onap.aai.domain.yang.ServiceInstances; import org.onap.aai.domain.yang.VolumeGroup; import org.onap.aai.domain.yang.VolumeGroups; import org.onap.aai.domain.yang.VpnBinding; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.aai.AAIResourcesClient; -import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; -import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; -import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.beans.RequestProcessingData; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.RequestDetails; +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; @RunWith(MockitoJUnitRunner.class) public class BBInputSetupUtilsTest { - protected ObjectMapper mapper = new ObjectMapper(); + protected ObjectMapper mapper = + new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);; private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/"; @InjectMocks @@ -114,6 +116,7 @@ public class BBInputSetupUtilsTest { @Before public void setup() { + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); } @@ -178,8 +181,10 @@ public class BBInputSetupUtilsTest { Optional<CloudRegion> expected = Optional.of(new CloudRegion()); doReturn(expected).when(MOCK_aaiResourcesClient).get(CloudRegion.class, - AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudConfig.getCloudOwner(), - cloudConfig.getLcpCloudRegionId()).depth(Depth.TWO)); + AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudConfig.getCloudOwner(), cloudConfig.getLcpCloudRegionId())) + .depth(Depth.TWO)); assertThat(bbInputSetupUtils.getCloudRegion(cloudConfig), sameBeanAs(expected.get())); } @@ -207,7 +212,7 @@ public class BBInputSetupUtilsTest { expected.get().setId(instanceGroupId); doReturn(expected).when(MOCK_aaiResourcesClient).get(InstanceGroup.class, - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId)); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroupId))); assertThat(bbInputSetupUtils.getAAIInstanceGroup(instanceGroupId), sameBeanAs(expected.get())); } @@ -224,7 +229,7 @@ public class BBInputSetupUtilsTest { expected.get().setGlobalCustomerId(globalSubscriberId); doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.Customer.class, - AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId)); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId))); assertThat(bbInputSetupUtils.getAAICustomer(globalSubscriberId), sameBeanAs(expected.get())); } @@ -243,8 +248,8 @@ public class BBInputSetupUtilsTest { expected.get().setServiceType(subscriptionServiceType); doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.ServiceSubscription.class, - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_SUBSCRIPTION, globalSubscriberId, - subscriptionServiceType)); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId) + .serviceSubscription(subscriptionServiceType))); assertThat(bbInputSetupUtils.getAAIServiceSubscription(globalSubscriberId, subscriptionServiceType), sameBeanAs(expected.get())); @@ -285,9 +290,12 @@ public class BBInputSetupUtilsTest { ServiceInstance expected = new ServiceInstance(); expected.setServiceInstanceId(serviceInstanceId); - doReturn(Optional.of(expected)).when(MOCK_aaiResourcesClient).get(ServiceInstance.class, AAIUriFactory - .createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId, serviceType, serviceInstanceId) - .depth(Depth.TWO)); + doReturn(Optional.of(expected)).when(MOCK_aaiResourcesClient) + .get(ServiceInstance.class, + AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustomerId) + .serviceSubscription(serviceType).serviceInstance(serviceInstanceId)) + .depth(Depth.TWO)); assertThat(bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(globalCustomerId, serviceType, serviceInstanceId), sameBeanAs(expected)); @@ -319,8 +327,8 @@ public class BBInputSetupUtilsTest { serviceInstances.getServiceInstance().add(expectedServiceInstance); AAIPluralResourceUri expectedUri = AAIUriFactory - .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer.getGlobalCustomerId(), - customer.getServiceSubscription().getServiceType()) + .createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId()) + .serviceSubscription(customer.getServiceSubscription().getServiceType()).serviceInstances()) .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO); bbInputSetupUtils.getAAIServiceInstanceByName(serviceInstanceName, customer); @@ -401,14 +409,15 @@ public class BBInputSetupUtilsTest { mapper.readValue(new File(RESOURCE_PATH + "aaiGenericVnfInput.json"), GenericVnf.class); doReturn(Optional.of(expectedAaiVnf)).when(MOCK_aaiResourcesClient).get(isA(Class.class), - eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE))); + eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE))); assertThat(bbInputSetupUtils.getAAIGenericVnf(vnfId), sameBeanAs(expectedAaiVnf)); } @Test public void getAAIResourceDepthOneTest() { - AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "anyVnfId"); + AAIResourceUri aaiResourceUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("anyVnfId")); AAIResourceUri expectedUri = aaiResourceUri.clone().depth(Depth.ONE); AAIResourceUri aaiResourceUriClone = aaiResourceUri.clone(); @@ -420,7 +429,8 @@ public class BBInputSetupUtilsTest { @Test public void getAAIResourceDepthTwoTest() { - AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "anyVnfId"); + AAIResourceUri aaiResourceUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("anyVnfId")); AAIResourceUri expectedUri = aaiResourceUri.clone().depth(Depth.TWO); AAIResourceUri aaiResourceUriClone = aaiResourceUri.clone(); @@ -515,8 +525,8 @@ public class BBInputSetupUtilsTest { vnf.setVnfId(vnfId); vnf.setVnfName(vnfName); doReturn(Optional.of(vnf)).when(MOCK_aaiResourcesClient).getOne(GenericVnfs.class, GenericVnf.class, - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) - .relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName)); + AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)) + .relatedTo(Types.GENERIC_VNFS.getFragment()).queryParam("vnf-name", vnfName)); Optional<GenericVnf> actual = this.bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(serviceInstanceId, vnfName); assertTrue(actual.isPresent()); @@ -544,8 +554,8 @@ public class BBInputSetupUtilsTest { volumeGroup.setVolumeGroupId(volumeGroupId); volumeGroup.setVolumeGroupName(volumeGroupName); doReturn(Optional.of(volumeGroup)).when(MOCK_aaiResourcesClient).getOne(VolumeGroups.class, VolumeGroup.class, - AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) - .relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName)); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) + .relatedTo(Types.VOLUME_GROUPS.getFragment()).queryParam("volume-group-name", volumeGroupName)); Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(vnfId, volumeGroupName); assertEquals(volumeGroup.getVolumeGroupId(), actual.get().getVolumeGroupId()); @@ -571,8 +581,10 @@ public class BBInputSetupUtilsTest { volumeGroup.setVolumeGroupId("id123"); volumeGroup.setVolumeGroupName("name123"); doReturn(Optional.of(volumeGroup)).when(MOCK_aaiResourcesClient).getOne(VolumeGroups.class, VolumeGroup.class, - AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "vnf-id123", "vf-module-id123") - .relatedTo(AAIObjectPlurals.VOLUME_GROUP) + AAIUriFactory + .createResourceUri( + AAIFluentTypeBuilder.network().genericVnf("vnf-id123").vfModule("vf-module-id123")) + .relatedTo(Types.VOLUME_GROUPS.getFragment()) .queryParam("volume-group-name", "volume-group-name123")); Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("vnf-id123", "vf-module-id123", "volume-group-name123"); @@ -619,8 +631,10 @@ public class BBInputSetupUtilsTest { VolumeGroup volumeGroup = new VolumeGroup(); volumeGroup.setVolumeGroupId("id123"); doReturn(Optional.of(volumeGroup)).when(MOCK_aaiResourcesClient).getOne(VolumeGroups.class, VolumeGroup.class, - AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "vnf-id123", "vf-module-id123") - .relatedTo(AAIObjectPlurals.VOLUME_GROUP)); + AAIUriFactory + .createResourceUri( + AAIFluentTypeBuilder.network().genericVnf("vnf-id123").vfModule("vf-module-id123")) + .relatedTo(Types.VOLUME_GROUPS.getFragment())); Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupFromVfModule("vnf-id123", "vf-module-id123"); assertTrue(actual.isPresent()); @@ -678,8 +692,8 @@ public class BBInputSetupUtilsTest { configuration.setConfigurationId("id123"); doReturn(Optional.of(configuration)).when(MOCK_aaiResourcesClient).getOne(Configurations.class, Configuration.class, - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "service-instance-id123") - .relatedTo(AAIObjectPlurals.CONFIGURATION) + AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment("service-instance-id123")) + .relatedTo(Types.CONFIGURATIONS.getFragment()) .queryParam("configuration-name", "configuration-name123")); Optional<Configuration> actual = this.bbInputSetupUtils .getRelatedConfigurationByNameFromServiceInstance("service-instance-id123", "configuration-name123"); @@ -689,8 +703,8 @@ public class BBInputSetupUtilsTest { @Test public void existsAAIVfModuleGloballyByNameTest() { - AAIPluralResourceUri expectedUri = - AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE).queryParam("vf-module-name", "testVfModule"); + AAIPluralResourceUri expectedUri = AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment()) + .queryParam("vf-module-name", "testVfModule"); bbInputSetupUtils.existsAAIVfModuleGloballyByName("testVfModule"); verify(MOCK_aaiResourcesClient, times(1)).exists(expectedUri); @@ -698,8 +712,9 @@ public class BBInputSetupUtilsTest { @Test public void existsAAIConfigurationGloballyByNameTest() { - AAIPluralResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION) - .queryParam("configuration-name", "testConfig"); + AAIPluralResourceUri expectedUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configurations()) + .queryParam("configuration-name", "testConfig"); bbInputSetupUtils.existsAAIConfigurationGloballyByName("testConfig"); verify(MOCK_aaiResourcesClient, times(1)).exists(expectedUri); @@ -707,8 +722,8 @@ public class BBInputSetupUtilsTest { @Test public void existsAAINetworksGloballyByNameTest() { - AAIPluralResourceUri expectedUri = - AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "testNetwork"); + AAIPluralResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Networks()) + .queryParam("network-name", "testNetwork"); bbInputSetupUtils.existsAAINetworksGloballyByName("testNetwork"); verify(MOCK_aaiResourcesClient, times(1)).exists(expectedUri); @@ -716,7 +731,7 @@ public class BBInputSetupUtilsTest { @Test public void existsAAIVolumeGroupGloballyByNameTest() { - AAIPluralResourceUri expectedUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP) + AAIPluralResourceUri expectedUri = AAIUriFactory.createNodesUri(Types.VOLUME_GROUPS.getFragment()) .queryParam("volume-group-name", "testVoumeGroup"); bbInputSetupUtils.existsAAIVolumeGroupGloballyByName("testVoumeGroup"); 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 edd214f85f..4d034a19e8 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 @@ -23,7 +23,6 @@ package org.onap.so.bpmn.servicedecomposition.tasks; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doReturn; import java.io.File; @@ -38,14 +37,14 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.runners.MockitoJUnitRunner; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; -import org.onap.aaiclient.client.aai.entities.Relationships; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonMappingException; @@ -143,14 +142,14 @@ public class CloudInfoFromAAITest { new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(cloudRegion)); cloudRegions.add(cloudRegionWrapper); - doReturn(cloudRegions).when(relationships).getByType(AAIObjectType.CLOUD_REGION); + doReturn(cloudRegions).when(relationships).getByType(Types.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); + doReturn(tenants).when(relationships).getByType(Types.TENANT); Optional<CloudRegion> actual = SPY_CloudInfoFromAAI.getRelatedCloudRegionAndTenant(relationships); 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 e05a3bda8f..fff495f9a8 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 @@ -34,14 +34,14 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.Spy; import org.onap.aai.domain.yang.Vserver; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.so.BaseTest; import org.onap.so.bpmn.common.DelegateExecutionImpl; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.mock.FileUtil; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.so.objects.audit.AAIObjectAudit; import org.onap.so.objects.audit.AAIObjectAuditList; import org.springframework.beans.BeanUtils; @@ -71,7 +71,7 @@ public class ExceptionBuilderTest extends BaseTest { auditList.setAuditType("create"); auditList.setHeatStackName("testStackName"); AAIObjectAudit vserver = new AAIObjectAudit(); - vserver.setAaiObjectType(AAIObjectType.VSERVER.typeName()); + vserver.setAaiObjectType(Types.VSERVER.typeName()); vserver.setDoesObjectExist(false); Vserver vs = new Vserver(); vs.setVserverId("testVServerId"); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/FlowsToExecute.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/FlowsToExecute.json index fa271b9e8d..7bbc287bad 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/FlowsToExecute.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/FlowsToExecute.json @@ -58,7 +58,8 @@ "vnfResourceCustomizationUUID": "a80f05b8-d651-44af-b999-8ed78fb4582f", "cvnfcCustomizationUUID": "69cce457-9ffd-4359-962b-0596a1e83ad1", "vnfcName": "zauk51bmcmr01mcm001" - } + }, + "resume": null }, { "buildingBlock": { diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_withRelatedInstanceList.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_withRelatedInstanceList.json index bb1612b11d..cad8b91779 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_withRelatedInstanceList.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_withRelatedInstanceList.json @@ -15,5 +15,14 @@ "modelUuid":"modelUUID" } } + }, + { + "relatedInstance":{ + "instanceId":"instanceId", + "modelInfo": { + "modelType": "vnf", + "modelCustomizationId": "my-test-uuid" + } + } }] } diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json index 8e4e3632e9..0360c10d42 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json @@ -71,8 +71,7 @@ }, "aggregateRoutes": { "aggregateRoute": [ - { - "aggRouteId": "routeId", + { "networkStartAddress": "10.80.12.0", "cidrMask": "23", "ipVersion": "4" @@ -80,4 +79,4 @@ ] }, "relationshipList": null -}
\ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json index f65fe17a2e..7c83df91a2 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json @@ -53,8 +53,7 @@ } ], "aggregate-routes": [ - { - "route-id": "routeId", + { "network-start-address": "10.80.12.0", "cidr-mask": "23", "ip-version": "4" |