diff options
Diffstat (limited to 'bpmn')
199 files changed, 7592 insertions, 8707 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" diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn index 6cd2c20ab9..1dc371e054 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> - <bpmn:process id="Process_1" isExecutable="true"> + <bpmn:process id="CnfAdapterBB" name="CnfAdapterBB" isExecutable="true"> <bpmn:startEvent id="StartEvent_1"> <bpmn:outgoing>SequenceFlow_0xb4elc</bpmn:outgoing> </bpmn:startEvent> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationService.groovy index 8e3bef69de..11301587e2 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationService.groovy @@ -20,12 +20,20 @@ package org.onap.so.bpmn.infrastructure.scripts +import static org.apache.commons.lang3.StringUtils.isBlank +import javax.ws.rs.NotFoundException import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.Relationship import org.onap.aai.domain.yang.RelationshipData import org.onap.aai.domain.yang.RelationshipList import org.onap.aai.domain.yang.ServiceInstance +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.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils @@ -33,19 +41,10 @@ import org.onap.so.bpmn.common.scripts.RequestDBUtil import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.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.so.db.request.beans.OperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory -import javax.ws.rs.NotFoundException - -import static org.apache.commons.lang3.StringUtils.isBlank - class ActivateCommunicationService extends AbstractServiceTaskProcessor { String Prefix="ACS_" @@ -130,8 +129,7 @@ class ActivateCommunicationService extends AbstractServiceTaskProcessor { //check the cms status try { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, subscriptionServiceType, serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId)) if (!client.exists(uri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") @@ -394,8 +392,7 @@ class ActivateCommunicationService extends AbstractServiceTaskProcessor { // create service ServiceInstance csi = new ServiceInstance() csi.setOrchestrationStatus(orchestrationStatus) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, subscriptionServiceType, serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId)) client.update(uri, csi) } catch (BpmnError e) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy index 334f5b4e4f..36d579c7ab 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy @@ -20,11 +20,20 @@ package org.onap.so.bpmn.infrastructure.scripts -import com.google.gson.Gson -import com.google.gson.reflect.TypeToken +import static org.apache.commons.lang3.StringUtils.isBlank +import java.lang.reflect.Type +import javax.ws.rs.NotFoundException import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.* +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.generated.fluentbuilders.AAIFluentTypeBuilder.Types +import org.onap.logging.filter.base.ErrorCode import org.onap.so.beans.nsmf.NSSI import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -32,22 +41,13 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.RequestDBUtil import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -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.so.db.request.beans.OperationStatus -import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory - -import javax.ws.rs.NotFoundException -import java.lang.reflect.Type - -import static org.apache.commons.lang3.StringUtils.isBlank +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken /** * This groovy class supports the <class>ActivateSliceService.bpmn</class> process. @@ -248,8 +248,7 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { String subscriptionServiceType = execution.getVariable("subscriptionServiceType") AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, subscriptionServiceType, NSIServiceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(NSIServiceId)) if (!client.exists(uri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") } @@ -271,8 +270,7 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { } for (String snssi : SNSSIList) { AAIResourcesClient client01 = new AAIResourcesClient() - AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, subscriptionServiceType, snssi) + AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(snssi)) if (!client.exists(uri01)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") @@ -339,8 +337,7 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { try { AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalCustId, serviceType, serviceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(serviceId)) if (!client.exists(uri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") } @@ -392,8 +389,7 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { try { //get the TN NSSI id by NSI id, active NSSI TN slicing AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, subscriptionServiceType, NSIserviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(NSIserviceInstanceId)) if (!client.exists(uri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") } @@ -410,8 +406,7 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length()) AAIResourcesClient client01 = new AAIResourcesClient() - AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, subscriptionServiceType, nssiserviceid) + AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(nssiserviceid)) if (!client.exists(uri01)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") @@ -477,8 +472,7 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { try { try { AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, subscriptionServiceType, serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId)) if (!client.exists(uri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") @@ -516,8 +510,8 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { //get the allotted-resources by e2e slice id AAIResourcesClient client_allotted = new AAIResourcesClient() - AAIResourceUri uri_allotted = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE_ALL, - globalSubscriberId, subscriptionServiceType, serviceInstanceId) + AAIPluralResourceUri uri_allotted = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId).allottedResources() + ) if (!client_allotted.exists(uri_allotted)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") } @@ -536,8 +530,7 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { try { //get the NSI id by e2e slice id AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, subscriptionServiceType, nsiserviceid) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(nsiserviceid)) if (!client.exists(uri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy index d59f865b01..4108ccecff 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy @@ -20,6 +20,7 @@ package org.onap.so.bpmn.infrastructure.scripts + import com.google.gson.JsonArray import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution @@ -42,6 +43,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 javax.ws.rs.NotFoundException import org.onap.so.beans.nsmf.AllocateTnNssi import org.onap.so.beans.nsmf.DeAllocateNssi @@ -53,6 +56,7 @@ import org.onap.aai.domain.yang.SliceProfile import org.onap.aai.domain.yang.SliceProfiles import org.onap.aai.domain.yang.Relationship + class AnNssmfUtils { private static final Logger logger = LoggerFactory.getLogger(AnNssmfUtils.class) @@ -228,13 +232,13 @@ public void createSliceProfilesInAai(DelegateExecution execution) { try { AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri sliceProfileUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), ANNF_sliceProfileInstanceId) + AAIResourceUri sliceProfileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(ANNF_sliceProfileInstanceId)) client.create(sliceProfileUri, ANNF_sliceProfileInstance) - AAIResourceUri sliceProfileUri1 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), TNFH_sliceProfileInstanceId) + AAIResourceUri sliceProfileUri1 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(TNFH_sliceProfileInstanceId)) client.create(sliceProfileUri1, TNFH_sliceProfileInstance) - AAIResourceUri sliceProfileUri2 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), TNMH_sliceProfileInstanceId) + AAIResourceUri sliceProfileUri2 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(TNMH_sliceProfileInstanceId)) client.create(sliceProfileUri2, TNMH_sliceProfileInstance) } catch (BpmnError e) { @@ -303,10 +307,7 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe String msg AAIResourcesClient client = new AAIResourcesClient() try { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - execution.getVariable("globalSubscriberId"), - execution.getVariable("subscriptionServiceType"), - instanceId).relationshipAPI() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(instanceId).relationshipAPI()) client.create(uri, relationship) } catch (BpmnError e) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy index be5a029062..7b8b79f35f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy @@ -22,43 +22,28 @@ package org.onap.so.bpmn.infrastructure.scripts -import com.google.gson.JsonObject +import static org.apache.commons.lang3.StringUtils.* +import javax.ws.rs.core.Response +import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray import org.json.JSONObject -import org.json.XML -import org.onap.so.bpmn.common.scripts.ExternalAPIUtilFactory - -import static org.apache.commons.lang3.StringUtils.* -import groovy.xml.XmlUtil -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.onap.so.bpmn.common.scripts.ExternalAPIUtil -import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.aai.domain.yang.SpPartner -import org.onap.so.bpmn.common.recipe.ResourceInput -import org.onap.so.bpmn.common.resource.ResourceRequestBuilder -import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder -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.so.bpmn.common.scripts.SDNCAdapterUtils -import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory -import java.util.Map -import java.util.UUID -import javax.ws.rs.core.Response +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types +import org.onap.so.bpmn.common.recipe.ResourceInput +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.ExternalAPIUtil +import org.onap.so.bpmn.common.scripts.ExternalAPIUtilFactory +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.json.JsonUtils import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.camunda.bpm.engine.runtime.Execution -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64 - /** * This groovy class supports the <class>Create3rdONAPE2EServiceInstance.bpmn</class> process. @@ -604,12 +589,12 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso partner.setModelCustomizationId(resourceModelCustomizationUuid) AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SP_PARTNER, sppartnerId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().spPartner(sppartnerId)) logger.info("sending request to create sp-partner: " + uri.toString()) logger.info("requestbody: " + partner) client.create(uri, partner) - AAIResourceUri siUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) + AAIResourceUri siUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId)) client.connect(uri, siUri) } catch (Exception ex) { String msg = "Exception in Create3rdONAPE2EServiceInstance.saveSPPartnerInAAI. " + ex.getMessage() diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy index f8eafe7e98..e253855ab3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy @@ -20,12 +20,16 @@ package org.onap.so.bpmn.infrastructure.scripts -import groovy.json.JsonSlurper +import static org.apache.commons.lang3.StringUtils.isBlank import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONObject import org.onap.aai.domain.yang.Relationship import org.onap.aai.domain.yang.ServiceInstance +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.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils @@ -36,16 +40,11 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.ServiceInfo import org.onap.so.bpmn.core.domain.ServiceProxy import org.onap.so.bpmn.core.json.JsonUtils -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.so.db.request.beans.OperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils - -import static org.apache.commons.lang3.StringUtils.isBlank +import groovy.json.JsonSlurper /** * This groovy class supports the <class>DoCreateCommunicationService.bpmn</class> process. @@ -538,10 +537,7 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor { String msg try { String serviceInstanceId = execution.getVariable("serviceInstanceId") - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - execution.getVariable("globalSubscriberId"), - execution.getVariable("subscriptionServiceType"), - serviceInstanceId).relationshipAPI() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(serviceInstanceId)).relationshipAPI() client.create(uri, relationship) } catch (BpmnError e) { @@ -633,8 +629,7 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor { // create service ServiceInstance csi = new ServiceInstance() csi.setOrchestrationStatus(orchestrationStatus) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, subscriptionServiceType, serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId)) client.update(uri, csi) logger.debug(Prefix + "updateFinishStatusInAAI update communication service status to deactivated") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy index c9ad18b0be..b7edc026be 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy @@ -39,6 +39,8 @@ 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.logging.filter.base.ErrorCode import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum @@ -361,7 +363,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor si.setOrchestrationStatus("Pending") } AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)) client.update(uri, si) } catch (BpmnError e) { throw e diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index 2b9e43109c..eb67b8fa4c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -32,20 +32,19 @@ import org.onap.aai.domain.yang.ServiceInstance import org.onap.aai.domain.yang.ServiceInstances import org.onap.aai.domain.yang.v13.Metadata import org.onap.aai.domain.yang.v13.Metadatum +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.bpmn.common.recipe.ResourceInput import org.onap.so.bpmn.common.resource.ResourceRequestBuilder import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.domain.ModelInfo -import org.onap.so.bpmn.core.domain.ResourceType import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.aaiclient.client.aai.AAIObjectPlurals -import org.onap.aaiclient.client.aai.AAIResourcesClient -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.slf4j.Logger import org.slf4j.LoggerFactory @@ -142,8 +141,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { AAIResourcesClient client = new AAIResourcesClient() // think how AAI queried for PNF name using the name - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE_METADATA, - customerId, serviceType, serId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customerId).serviceSubscription(serviceType).serviceInstance(serId).metadata()) logger.debug("uri for pnf get:" + uri.toString()) Metadata metadata = client.get(uri).asBean(Metadata.class).get() @@ -265,6 +263,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.service-name", inputParameters.get("name")) resourceInputObj.setResourceParameters(uResourceInput) execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString()) + execution.setVariable("isAsyncRequired", "Yes") break case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : @@ -293,7 +292,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { AAIResourcesClient client = new AAIResourcesClient() logger.info("sending request to resolve vpn-name:" + vpnName) - AAIResourceUri uri = AAIUriFactory.createResourceUri(new AAIObjectPlurals("/nodes", "/service-instances", "queryByName")).queryParam("service-instance-name", parentServiceName) + AAIResourceUri uri = AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCES.getFragment()).queryParam("service-instance-name", parentServiceName) Optional<ServiceInstances> serviceInstancesOpt = client.get(ServiceInstances.class, uri) if(serviceInstancesOpt.isPresent()) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy index dcbaf746ea..65398eb658 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy @@ -2,54 +2,51 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + # Copyright (c) 2020, CMCC Technologies Co., Ltd. + # + # Licensed under the Apache License, Version 2.0 (the "License") + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. * ============LICENSE_END========================================================= */ package org.onap.so.bpmn.infrastructure.scripts -import com.fasterxml.jackson.databind.ObjectMapper +import static org.apache.commons.lang3.StringUtils.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.ServiceInstance -import org.onap.so.client.HttpClient -import org.onap.so.client.HttpClientFactory -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 javax.ws.rs.core.Response - -import static org.apache.commons.lang3.StringUtils.* -import org.springframework.web.util.UriUtils -import groovy.json.JsonSlurper -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.logging.filter.base.ONAPComponents +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types +import org.onap.logging.filter.base.ErrorCode import org.onap.so.beans.nsmf.SliceTaskParams -import org.onap.so.db.request.beans.OrchestrationTask +import org.onap.so.beans.nsmf.SliceTaskParamsAdapter +import org.onap.so.beans.nsmf.oof.TemplateInfo import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils import org.onap.so.bpmn.common.scripts.OofUtils import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.logging.filter.base.ErrorCode +import org.onap.so.db.request.beans.OrchestrationTask import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory +import org.springframework.web.util.UriUtils +import com.fasterxml.jackson.databind.ObjectMapper +import groovy.json.JsonSlurper public class CreateSliceService extends AbstractServiceTaskProcessor { String Prefix = "CRESS_" @@ -59,8 +56,10 @@ public class CreateSliceService extends AbstractServiceTaskProcessor { JsonSlurper jsonSlurper = new JsonSlurper() ObjectMapper objectMapper = new ObjectMapper() OofUtils oofUtils = new OofUtils() - private static final Logger logger = LoggerFactory.getLogger(CreateSliceService.class) + NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil) + AAIResourcesClient client = getAAIClient() + private static final Logger logger = LoggerFactory.getLogger(CreateSliceService.class) public void preProcessRequest(DelegateExecution execution) { logger.debug("Start preProcessRequest") @@ -150,7 +149,7 @@ public class CreateSliceService extends AbstractServiceTaskProcessor { logger.debug("User Input Parameters map: " + inputMap.toString()) String uuiRequest = inputMap.get("UUIRequest") - Map uuiReqMap = jsonSlurper.parseText(uuiRequest) + Map uuiReqMap = jsonSlurper.parseText(uuiRequest) as Map Map<String, Object> serviceObject = (Map<String, Object>) uuiReqMap.get("service") Map<String, Object> parameterObject = (Map<String, Object>) serviceObject.get("parameters") Map<String, Object> requestInputs = (Map<String, Object>) parameterObject.get("requestInputs") @@ -162,7 +161,8 @@ public class CreateSliceService extends AbstractServiceTaskProcessor { execution.setVariable("serviceInputParams", inputMap) execution.setVariable("uuiRequest", uuiRequest) - execution.setVariable("serviceProfile", serviceProfile) + execution.setVariable("se" + + "rviceProfile", serviceProfile) //TODO //execution.setVariable("serviceInputParams", jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams")) @@ -178,76 +178,69 @@ public class CreateSliceService extends AbstractServiceTaskProcessor { logger.debug("Finish preProcessRequest") } - public void prepareSelectNSTRequest(DelegateExecution execution) { - logger.debug("Start prepareSelectNSTRequest") - String requestId = execution.getVariable("msoRequestId") - String messageType = "NSTSelectionResponse" - Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") - execution.setVariable("nstSelectionUrl", "/api/oof/v1/selection/nst") - execution.setVariable("nstSelection_messageType",messageType) - execution.setVariable("nstSelection_correlator",requestId) - String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution); - execution.setVariable("nstSelection_timeout",timeout) - String oofRequest = oofUtils.buildSelectNSTRequest(requestId,messageType, serviceProfile) - execution.setVariable("nstSelection_oofRequest",oofRequest) - logger.debug("Finish prepareSelectNSTRequest") - - } - - public void processNSTSolutions(DelegateExecution execution) { - Map<String, Object> nstSolution - try { - logger.debug("Start processing NSTSolutions") - Map<String, Object> resMap = objectMapper.readValue(execution.getVariable("nstSelection_oofResponse"),Map.class) - List<Map<String, Object>> nstSolutions = (List<Map<String, Object>>) resMap.get("solutions") - nstSolution = nstSolutions.get(0) - execution.setVariable("nstSolution", nstSolution) - } catch (Exception ex) { - logger.debug( "Failed to get NST solution suggested by OOF.") - exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Failed to get NST solution suggested by OOF.") - } - - } - - public void prepareDecomposeService(DelegateExecution execution) { - logger.debug("Start prepareDecomposeService") - String uuiRequest = execution.getVariable("uuiRequest") - String ssModelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid") - String ssModelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid") - String ssServiceModelInfo = """{ - "modelInvariantUuid":"${ssModelInvariantUuid}", - "modelUuid":"${ssModelUuid}", - "modelVersion":"" - }""" - execution.setVariable("ssServiceModelInfo", ssServiceModelInfo) - - logger.debug("Finish prepareDecomposeService") - } - - public void processDecomposition(DelegateExecution execution) { - logger.debug("Start processDecomposition") - String uuiRequest = execution.getVariable("uuiRequest") - Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") - Map<String, Object> nstSolution = execution.getVariable("nstSolution") - - Map uuiReqMap = jsonSlurper.parseText(uuiRequest) - Map<String, Object> serviceObject = (Map<String, Object>) uuiReqMap.get("service") - String subscriptionServiceType = serviceObject.get("serviceType") + /** + * + * @param execution + */ + public void prepareInitServiceOperationStatus(DelegateExecution execution) { + logger.debug("Start prepareInitServiceOperationStatus") + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = "CREATE" + String userId = execution.getVariable("globalSubscriberId") + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service creation" + logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationType", operationType) - String serviceType = (String) serviceProfile.get("sST") - String resourceSharingLevel = (String) serviceProfile.get("resourceSharingLevel") - String nstModelUuid = (String) nstSolution.get("UUID") - String nstModelInvariantUuid = (String) nstSolution.get("invariantUUID") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint",execution) + execution.setVariable("CSSOS_dbAdapterEndpoint", dbAdapterEndpoint) + logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint) + def dbAdapterAuth = UrnPropertiesReader.getVariable("mso.requestDb.auth") + Map<String, String> CSSOS_headerMap = [:] + CSSOS_headerMap.put("content-type", "application/soap+xml") + CSSOS_headerMap.put("Authorization", dbAdapterAuth) + execution.setVariable("CSSOS_headerMap", CSSOS_headerMap) + logger.debug("DB Adapter Header is: " + CSSOS_headerMap) - execution.setVariable("subscriptionServiceType", subscriptionServiceType) - execution.setVariable("serviceType", serviceType) - execution.setVariable("resourceSharingLevel", resourceSharingLevel) - execution.setVariable("nstModelUuid", nstModelUuid) - execution.setVariable("nstModelInvariantUuid", nstModelInvariantUuid) + String payload = + """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:initServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb"> + <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId> + <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> + <operationType>${MsoUtils.xmlEscape(operationType)}</operationType> + <userId>${MsoUtils.xmlEscape(userId)}</userId> + <result>${MsoUtils.xmlEscape(result)}</result> + <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent> + <progress>${MsoUtils.xmlEscape(progress)}</progress> + <reason>${MsoUtils.xmlEscape(reason)}</reason> + </ns:initServiceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" - logger.debug("Finish processDecomposition") + payload = utils.formatXml(payload) + execution.setVariable("CSSOS_updateServiceOperStatusRequest", payload) + logger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload) + }catch(Exception e){ + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) + } + logger.debug("Finish prepareInitServiceOperationStatus") } + /** + * prepare create OrchestrationTask + * @param execution + */ public void prepareCreateOrchestrationTask(DelegateExecution execution) { logger.debug("Start createOrchestrationTask") String taskId = execution.getBusinessKey() @@ -265,21 +258,104 @@ public class CreateSliceService extends AbstractServiceTaskProcessor { execution.setVariable("CSSOT_isManual", isManual) execution.setVariable("CSSOT_requestMethod", requestMethod) - Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") + Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") as Map<String, Object> - SliceTaskParams sliceTaskParams = new SliceTaskParams() + SliceTaskParamsAdapter sliceTaskParams = new SliceTaskParamsAdapter() sliceTaskParams.setServiceId(serviceInstanceId) sliceTaskParams.setServiceName(serviceInstanceName) sliceTaskParams.setServiceProfile(serviceProfile) + execution.setVariable("sliceTaskParams", sliceTaskParams) - String paramJson = sliceTaskParams.convertToJson() - execution.setVariable("CSSOT_paramJson", paramJson) - logger.debug("CSSOT_paramJson: " + paramJson) + //todo:---------------------------------------- +// String paramJson = sliceTaskParams.convertToJson() +// execution.setVariable("CSSOT_paramJson", paramJson) + /*-------------------------------------------*/ logger.debug("Finish createOrchestrationTask") } + /** + * send sync response to csmf + * @param execution + */ + public void sendSyncResponse(DelegateExecution execution) { + logger.debug("Start sendSyncResponse") + try { + String operationId = execution.getVariable("operationId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + // RESTResponse for API Handler (APIH) Reply Task + String createServiceRestRequest = """ + { + "service": { + "serviceId":"${serviceInstanceId}", + "operationId":"${operationId}" + } + } + """.trim() + + logger.debug("sendSyncResponse to APIH:" + "\n" + createServiceRestRequest) + sendWorkflowResponse(execution, 202, createServiceRestRequest) + execution.setVariable("sentSyncResponse", true) + } catch (Exception e) { + String msg = "Exceptuion in sendSyncResponse:" + e.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug("Finish sendSyncResponse") + } + + public void prepareSelectNSTRequest(DelegateExecution execution) { + logger.debug("Start prepareSelectNSTRequest") + String requestId = execution.getVariable("msoRequestId") + String messageType = "NSTSelectionResponse" + Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") as Map<String, Object> + execution.setVariable("nstSelectionUrl", "/api/oof/v1/selection/nst") + execution.setVariable("nstSelection_messageType", messageType) + execution.setVariable("nstSelection_correlator", requestId) + String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution); + execution.setVariable("nstSelection_timeout", timeout) + String oofRequest = oofUtils.buildSelectNSTRequest(requestId, messageType, serviceProfile) + execution.setVariable("nstSelection_oofRequest", oofRequest) + logger.debug("Finish prepareSelectNSTRequest") + + } + + /** + * process async response of oof, put the {@solutions} at {@nstSolution} + * @param execution + */ + public void processNSTSolutions(DelegateExecution execution) { + Map<String, Object> nstSolution + try { + logger.debug("Start processing NSTSolutions") + Map<String, Object> resMap = + objectMapper.readValue(execution.getVariable("nstSelection_oofResponse") as String, + Map.class) + + List<Map<String, Object>> nstSolutions = (List<Map<String, Object>>) resMap.get("solutions") + nstSolution = nstSolutions.get(0) + execution.setVariable("nstSolution", nstSolution) + + //set nst info into sliceTaskParams + SliceTaskParamsAdapter sliceTaskParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + TemplateInfo nstInfo = new TemplateInfo() + nstInfo.setUUID(nstSolution.get("UUID") as String) + nstInfo.setInvariantUUID(nstSolution.get("invariantUUID") as String) + nstInfo.setName(nstSolution.get("name") as String) + + sliceTaskParams.setNSTInfo(nstInfo) + + execution.setVariable("sliceTaskParams", sliceTaskParams) + + } catch (Exception ex) { + logger.debug( "Failed to get NST solution suggested by OOF.") + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Failed to get NST solution suggested by OOF.") + } + + } + public void prepareUpdateOrchestrationTask(DelegateExecution execution) { logger.debug("Start prepareUpdateOrchestrationTask") String requestMethod = "PUT" @@ -292,6 +368,7 @@ public class CreateSliceService extends AbstractServiceTaskProcessor { logger.debug("Finish prepareUpdateOrchestrationTask") } + public void prepareGetUserOptions(DelegateExecution execution) { logger.debug("Start prepareGetUserOptions") String requestMethod = "GET" @@ -325,10 +402,10 @@ public class CreateSliceService extends AbstractServiceTaskProcessor { String orchStatus = execution.getVariable("orchestrationStatus") try { - ServiceInstance si = ServiceInstance si = new ServiceInstance() + ServiceInstance si = new ServiceInstance() si.setOrchestrationStatus(orchStatus) AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)) client.update(uri, si) } catch (BpmnError e) { throw e @@ -341,61 +418,6 @@ public class CreateSliceService extends AbstractServiceTaskProcessor { logger.debug("Finish updateAAIOrchStatus") } - public void prepareInitServiceOperationStatus(DelegateExecution execution) { - logger.debug("Start prepareInitServiceOperationStatus") - try{ - String serviceId = execution.getVariable("serviceInstanceId") - String operationId = execution.getVariable("operationId") - String operationType = "CREATE" - String userId = execution.getVariable("globalSubscriberId") - String result = "processing" - String progress = "0" - String reason = "" - String operationContent = "Prepare service creation" - logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) - serviceId = UriUtils.encode(serviceId,"UTF-8") - execution.setVariable("serviceInstanceId", serviceId) - execution.setVariable("operationType", operationType) - - def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint",execution) - execution.setVariable("CSSOS_dbAdapterEndpoint", dbAdapterEndpoint) - logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint) - def dbAdapterAuth = UrnPropertiesReader.getVariable("mso.requestDb.auth") - Map<String, String> CSSOS_headerMap = [:] - CSSOS_headerMap.put("content-type", "application/soap+xml") - CSSOS_headerMap.put("Authorization", dbAdapterAuth) - execution.setVariable("CSSOS_headerMap", CSSOS_headerMap) - logger.debug("DB Adapter Header is: " + CSSOS_headerMap) - - String payload = - """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:ns="http://org.onap.so/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <ns:initServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb"> - <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId> - <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> - <operationType>${MsoUtils.xmlEscape(operationType)}</operationType> - <userId>${MsoUtils.xmlEscape(userId)}</userId> - <result>${MsoUtils.xmlEscape(result)}</result> - <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent> - <progress>${MsoUtils.xmlEscape(progress)}</progress> - <reason>${MsoUtils.xmlEscape(reason)}</reason> - </ns:initServiceOperationStatus> - </soapenv:Body> - </soapenv:Envelope>""" - - payload = utils.formatXml(payload) - execution.setVariable("CSSOS_updateServiceOperStatusRequest", payload) - logger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload) - }catch(Exception e){ - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) - } - logger.debug("Finish prepareInitServiceOperationStatus") - } - public void prepareUpdateServiceOperationStatus(DelegateExecution execution) { logger.debug("Start preUpdateServiceOperationStatus") try{ @@ -438,23 +460,7 @@ public class CreateSliceService extends AbstractServiceTaskProcessor { logger.debug("Finish preUpdateServiceOperationStatus") } - public void sendSyncResponse(DelegateExecution execution) { - logger.debug("Start sendSyncResponse") - try { - String operationId = execution.getVariable("operationId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - // RESTResponse for API Handler (APIH) Reply Task - String createServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${operationId}"}}""".trim() - logger.debug("sendSyncResponse to APIH:" + "\n" + createServiceRestRequest) - sendWorkflowResponse(execution, 202, createServiceRestRequest) - execution.setVariable("sentSyncResponse", true) - } catch (Exception e) { - String msg = "Exceptuion in sendSyncResponse:" + e.getMessage() - logger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - logger.debug("Finish sendSyncResponse") - } + public void prepareCompletionRequest (DelegateExecution execution) { logger.trace("Start prepareCompletionRequest") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy index 80b6641bb7..4cebb9286f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy @@ -26,6 +26,8 @@ import org.onap.so.client.HttpClientFactory 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.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor @@ -245,8 +247,8 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { String serviceType = execution.getVariable("serviceType") String serviceId = execution.getVariable("serviceInstanceId") - AAIResourceUri nsUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,globalSubscriberId,serviceType,nsInstanceId) - AAIResourceUri relatedServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,globalSubscriberId,serviceType,serviceId) + AAIResourceUri nsUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nsInstanceId)) + AAIResourceUri relatedServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceId)) try{ getAAIClient().connect(nsUri,relatedServiceUri) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy index 1dfe13738e..4725f9a66d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy @@ -22,21 +22,21 @@ package org.onap.so.bpmn.infrastructure.scripts -import org.onap.so.logger.LoggingAnchor import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution +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.common.scripts.AbstractServiceTaskProcessor; import org.onap.so.bpmn.common.scripts.ExceptionUtil; import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException -import org.onap.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.logging.filter.base.ErrorCode +import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory - import groovy.json.JsonOutput import groovy.json.JsonSlurper @@ -324,7 +324,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { ExceptionUtil exceptionUtil = new ExceptionUtil() try { - AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectType.SERVICE_INSTANCE,serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)) if(getAAIClient().exists(uri)){ logger.debug('Service instance ' + serviceInstanceId + ' found in AAI.') }else{ diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy index 057863be28..3062b1ca32 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy @@ -45,6 +45,8 @@ 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.slf4j.Logger import org.slf4j.LoggerFactory @@ -473,7 +475,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String id = execution.getVariable(Prefix + "SppartnerId") AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SP_PARTNER, id) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().spPartner(id)) SpPartner sp = client.get(uri).asBean(SpPartner.class).get() logger.debug("GET sppartner Received a Good Response") @@ -508,7 +510,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String sppartnerId = execution.getVariable(Prefix + "SppartnerId") AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SP_PARTNER, sppartnerId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().spPartner(sppartnerId)) client.delete(uri) logger.debug("Delete sppartner Received a Good Response") execution.setVariable(Prefix + "SuccessIndicator", true) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy index 26936bfd71..8cab146006 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy @@ -20,12 +20,23 @@ package org.onap.so.bpmn.infrastructure.scripts +import static org.apache.commons.lang3.StringUtils.isBlank +import javax.ws.rs.NotFoundException +import javax.ws.rs.core.Response import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.aai.domain.yang.Relationship -import org.onap.aai.domain.yang.ServiceInstance import org.onap.aai.domain.yang.CommunicationServiceProfile import org.onap.aai.domain.yang.CommunicationServiceProfiles +import org.onap.aai.domain.yang.Relationship +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.aaiclient.client.aai.AAIObjectName +import org.onap.aaiclient.client.aai.AAIObjectType +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.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.onap.logging.filter.base.ONAPComponents import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -35,21 +46,10 @@ import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient -import org.onap.so.client.HttpClientFactory -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.so.db.request.beans.OperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory -import javax.ws.rs.NotFoundException -import javax.ws.rs.core.Response - -import static org.apache.commons.lang3.StringUtils.isBlank - class DeleteCommunicationService extends AbstractServiceTaskProcessor { private final String PREFIX ="DeleteCommunicationService" private final Long TIMEOUT = 60 * 60 * 1000 @@ -147,7 +147,7 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable("serviceInstanceId") String errorMsg = "query communication service from aai failed" - AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, serviceInstanceId, errorMsg) + AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, serviceInstanceId, errorMsg) Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) if(si.isPresent()) { @@ -177,16 +177,16 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor { /** * query AAI * @param execution - * @param aaiObjectType + * @param aaiObjectName * @param instanceId * @return AAIResultWrapper */ - private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectType aaiObjectType, String instanceId, String errorMsg) + private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectName aaiObjectName, String instanceId, String errorMsg) { String globalSubscriberId = execution.getVariable("globalSubscriberId") String serviceType = execution.getVariable("serviceType") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(aaiObjectType, globalSubscriberId, serviceType, instanceId) + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(instanceId)) if (!getAAIClient().exists(resourceUri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMsg) } @@ -310,7 +310,7 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor { String profileId try { - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_PROFILE_ALL, globalSubscriberId, serviceType, serviceInstanceId) + AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId).communicationServiceProfiles()) AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class) Optional<CommunicationServiceProfiles> csProfilesOpt = wrapper.asBean(CommunicationServiceProfiles.class) if(csProfilesOpt.isPresent()){ @@ -318,7 +318,7 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor { CommunicationServiceProfile csProfile = csProfiles.getCommunicationServiceProfile().get(0) profileId = csProfile ? csProfile.getProfileId() : "" } - resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_SERVICE_PROFILE, globalSubscriberId, serviceType, serviceInstanceId, profileId) + resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId).communicationServiceProfile(profileId)) if (!getAAIClient().exists(resourceUri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "communication service profile was not found in aai") } @@ -344,7 +344,7 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor { try { LOGGER.debug("start delete communication service from AAI") - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), execution.getVariable("serviceInstanceId")) + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("serviceType")).serviceInstance(execution.getVariable("serviceInstanceId"))) getAAIClient().delete(serviceInstanceUri) execution.setVariable("progress", "100") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy index 99289b85b1..036fa51482 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy @@ -41,6 +41,8 @@ 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.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils @@ -115,7 +117,7 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { String deviceId = execution.getVariable(Prefix + "DeviceId") AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.DEVICE, deviceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().device(deviceId)) Device dev = client.get(uri).asBean(Device.class).get() String devClass = dev.getClass () diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy index cc5b8cf1e8..6d699d351d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy @@ -43,6 +43,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.slf4j.Logger import org.slf4j.LoggerFactory @@ -149,7 +151,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { try { String parentServiceId = ""; AAIResourcesClient resourceClient = new AAIResourcesClient(); - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, globalCustId, serviceType, serviceInstanceId, allotedResourceId) + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId).allottedResource(allotedResourceId)) AAIResultWrapper aaiResult = resourceClient.get(serviceInstanceUri, NotFoundException.class) Optional<AllottedResource> si = aaiResult.asBean(AllottedResource.class) if((si.present) && (null != si.get().getRelationshipList()) && (null != si.get().getRelationshipList().getRelationship())) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy index d22ee5e82f..4c008a2eb9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy @@ -20,29 +20,28 @@ package org.onap.so.bpmn.infrastructure.scripts +import static org.apache.commons.lang3.StringUtils.isBlank +import javax.ws.rs.NotFoundException import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.ServiceProfile import org.onap.aai.domain.yang.ServiceProfiles +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.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.RequestDBUtil import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -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.so.db.request.beans.OperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory -import javax.ws.rs.NotFoundException - -import static org.apache.commons.lang3.StringUtils.isBlank - class DeleteSliceService extends AbstractServiceTaskProcessor { private final String PREFIX ="DeleteSliceService" @@ -122,7 +121,7 @@ class DeleteSliceService extends AbstractServiceTaskProcessor { LOGGER.trace("${PREFIX} Start deleteSliceServiceInstance") try { - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), execution.getVariable("serviceInstanceId")) + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("serviceType")).serviceInstance(execution.getVariable("serviceInstanceId"))) getAAIClient().delete(serviceInstanceUri) execution.setVariable("progress", "100") @@ -169,7 +168,7 @@ class DeleteSliceService extends AbstractServiceTaskProcessor { try { - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE_ALL, globalSubscriberId, serviceType, serviceInstanceId) + AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId).serviceProfiles()) AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class) Optional<ServiceProfiles> serviceProfilesOpt =wrapper.asBean(ServiceProfiles.class) if(serviceProfilesOpt.isPresent()){ @@ -177,7 +176,7 @@ class DeleteSliceService extends AbstractServiceTaskProcessor { ServiceProfile serviceProfile = serviceProfiles.getServiceProfile().get(0) profileId = serviceProfile ? serviceProfile.getProfileId() : "" } - resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE, globalSubscriberId, serviceType, serviceInstanceId, profileId) + resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId).serviceProfile(profileId)) if (!getAAIClient().exists(resourceUri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy index 005f0f3c6b..1bcf615cd2 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy @@ -31,6 +31,7 @@ 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.common.scripts.AaiUtil; import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; @@ -197,7 +198,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { AaiUtil aaiUtil = new AaiUtil(this) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion)) def queryCloudRegionRequest = aaiUtil.createAaiUri(uri) execution.setVariable("DELVfModVol_queryCloudRegionRequest", queryCloudRegionRequest) @@ -240,7 +241,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { String cloudRegion = execution.getVariable('DELVfModVol_aicCloudRegion') try { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion, volumeGroupId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion).volumeGroup(volumeGroupId)) AAIResultWrapper volumeGroupWrapper = getAAIClient().get(uri) if (!volumeGroupWrapper.isEmpty()) { @@ -249,7 +250,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { def heatStackId = volumeGroupOp.get().getHeatStackId() ?: "" execution.setVariable('DELVfModVol_volumeGroupHeatStackId', heatStackId) - if ( volumeGroupWrapper.getRelationships().isPresent() && !volumeGroupWrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.VF_MODULE).isEmpty()) { + if ( volumeGroupWrapper.getRelationships().isPresent() && !volumeGroupWrapper.getRelationships().get().getRelatedUris(Types.VF_MODULE).isEmpty()) { logger.debug('Volume Group ' + volumeGroupId + ' currently in use') exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} currently in use - found vf-module relationship.") } @@ -283,7 +284,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { */ private String getTenantIdFromVolumeGroup(AAIResultWrapper wrapper) { if(wrapper.getRelationships().isPresent()) { - List<AAIResourceUri> tenantURIList = wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.TENANT) + List<AAIResourceUri> tenantURIList = wrapper.getRelationships().get().getRelatedUris(Types.TENANT) if(!tenantURIList.isEmpty()){ return tenantURIList.get(0).getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId) } @@ -356,7 +357,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { ExceptionUtil exceptionUtil = new ExceptionUtil() try { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion, groupId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion).volumeGroup(groupId)) getAAIClient().delete(uri) logger.debug("Volume group $groupId deleted.") }catch(NotFoundException e){ diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy index 4d86fb4cd9..9ccc6951ea 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy @@ -19,7 +19,6 @@ */ package org.onap.so.bpmn.infrastructure.scripts - import static org.apache.commons.lang3.StringUtils.isBlank import javax.ws.rs.NotFoundException @@ -33,6 +32,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.so.beans.nsmf.ActDeActNssi import org.onap.so.beans.nsmf.EsrInfo import org.onap.so.beans.nsmf.ServiceInfo @@ -49,6 +50,7 @@ import org.slf4j.LoggerFactory import com.fasterxml.jackson.databind.ObjectMapper import com.google.gson.JsonObject + /** * Internal AN NSSMF to handle NSSI Activation/Deactivation * @@ -421,8 +423,7 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor { try { AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, subscriptionServiceType, serviceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceId)) if (!client.exists(uri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") } @@ -488,8 +489,7 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor { Map<String,ServiceInstance> relatedInstances = new HashMap<>() AAIResourcesClient client = getAAIClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, subscriptionServiceType, instanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(instanceId)) if (!client.exists(uri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai : ${instanceId}") } @@ -504,8 +504,7 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor { String relatioshipurl = relationship.getRelatedLink() String serviceInstanceId = relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length()) - uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, subscriptionServiceType, serviceInstanceId) + uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId)) if (!client.exists(uri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai: ${serviceInstanceId} related to ${instanceId}") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSI.groovy index 306c53a73c..5e50b9d52d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSI.groovy @@ -20,15 +20,31 @@ package org.onap.so.bpmn.infrastructure.scripts +import javax.ws.rs.NotFoundException +import javax.ws.rs.core.Response import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject +import org.onap.aai.domain.yang.GenericVnf +import org.onap.aai.domain.yang.RelatedToProperty +import org.onap.aai.domain.yang.Relationship +import org.onap.aai.domain.yang.RelationshipData +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.aaiclient.client.aai.AAIObjectName +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.ONAPComponents import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.CatalogDbUtils import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.RequestDBUtil +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.HttpClient +import org.onap.so.db.request.beans.ResourceOperationStatus import org.onap.so.serviceinstancebeans.CloudConfiguration import org.onap.so.serviceinstancebeans.LineOfBusiness import org.onap.so.serviceinstancebeans.ModelInfo @@ -36,37 +52,14 @@ import org.onap.so.serviceinstancebeans.ModelType import org.onap.so.serviceinstancebeans.OwningEntity import org.onap.so.serviceinstancebeans.Platform import org.onap.so.serviceinstancebeans.Project -import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.rest.catalog.beans.Vnf import org.onap.so.serviceinstancebeans.RequestDetails import org.onap.so.serviceinstancebeans.RequestInfo import org.onap.so.serviceinstancebeans.RequestParameters import org.onap.so.serviceinstancebeans.SubscriberInfo -import org.onap.aai.domain.yang.GenericVnf -import org.onap.aai.domain.yang.RelatedToProperty -import org.onap.aai.domain.yang.Relationship -import org.onap.aai.domain.yang.RelationshipData -import org.onap.aai.domain.yang.RelationshipList -import org.onap.aai.domain.yang.ServiceInstance -import org.onap.aai.domain.yang.v19.SliceProfile -import org.onap.aai.domain.yang.v19.SliceProfiles import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.client.HttpClient -import org.onap.so.client.HttpClientFactory -import org.onap.so.db.request.beans.OperationStatus -import org.onap.so.db.request.beans.ResourceOperationStatus -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 com.fasterxml.jackson.databind.ObjectMapper -import javax.ws.rs.NotFoundException -import javax.ws.rs.core.Response - class DoActivateCoreNSSI extends AbstractServiceTaskProcessor { String Prefix="DACTCNSSI_" private static final Logger logger = LoggerFactory.getLogger(DoActivateCoreNSSI.class); @@ -117,7 +110,7 @@ class DoActivateCoreNSSI extends AbstractServiceTaskProcessor { //NSSI Id as service Instance Id to get from Request String serviceInstanceId = execution.getVariable("serviceInstanceID") String errorMsg = "query Network Service Instance from AAI failed" - AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, serviceInstanceId, errorMsg) + AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, serviceInstanceId, errorMsg) Optional<ServiceInstance> nsi = wrapper.asBean(ServiceInstance.class) String networkServiceInstanceName = "" String networkServiceInstanceId ="" @@ -156,7 +149,7 @@ class DoActivateCoreNSSI extends AbstractServiceTaskProcessor { String errorSliceProfileMsg = "Slice Profile Service Instance was not found in aai" //Query Slice Profile Service Instance From AAI by sliceProfileServiceInstanceId - AAIResultWrapper sliceProfileInstanceWrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, sliceProfileServiceInstanceId, errorSliceProfileMsg) + AAIResultWrapper sliceProfileInstanceWrapper = queryAAI(execution, Types.SERVICE_INSTANCE, sliceProfileServiceInstanceId, errorSliceProfileMsg) Optional<ServiceInstance> sliceProfileServiceInstance = sliceProfileInstanceWrapper.asBean(ServiceInstance.class) if (sliceProfileServiceInstance.isPresent()) { String orchestrationStatus= sliceProfileServiceInstance.get().getOrchestrationStatus() @@ -205,7 +198,7 @@ class DoActivateCoreNSSI extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable("networkServiceInstanceId") logger.debug("**** serviceInstanceId :: getServiceInstanceRelationships :: "+serviceInstanceId) String errorMsg = "query Network Service Instance from AAI failed" - AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, serviceInstanceId, errorMsg) + AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, serviceInstanceId, errorMsg) Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) String networkServiceModelInvariantUuid = si.get().getModelInvariantId() @@ -251,7 +244,7 @@ class DoActivateCoreNSSI extends AbstractServiceTaskProcessor { logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: getVnfRelationships ****") String msg = "query Generic Vnf from AAI failed" try { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, execution.getVariable('vnfId')) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(execution.getVariable('vnfId'))) if (!getAAIClient().exists(uri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) } @@ -313,13 +306,13 @@ class DoActivateCoreNSSI extends AbstractServiceTaskProcessor { * @param instanceId * @return AAIResultWrapper */ - private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectType aaiObjectType, String instanceId, String errorMsg) { + private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectName aaiObjectName, String instanceId, String errorMsg) { logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: queryAAI ****") String globalSubscriberId = execution.getVariable("globalSubscriberId") String serviceType = execution.getVariable("serviceType") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(aaiObjectType, globalSubscriberId, serviceType, instanceId) + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(instanceId)) if (!getAAIClient().exists(resourceUri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMsg) } @@ -615,8 +608,7 @@ class DoActivateCoreNSSI extends AbstractServiceTaskProcessor { String sliceProfileInstanceId = si.getServiceInstanceId() si.setOrchestrationStatus(oStatus) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalCustId, serviceType, sliceProfileInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(sliceProfileInstanceId)) try { Response response = getAAIClient().update(uri, si) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy index 04fe161295..0900863a62 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy @@ -29,6 +29,8 @@ 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.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.RequestDBUtil @@ -37,6 +39,7 @@ import org.onap.so.db.request.beans.ResourceOperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory + public class DoActivateTnNssi extends AbstractServiceTaskProcessor { String Prefix = "TNACT_" @@ -124,7 +127,7 @@ public class DoActivateTnNssi extends AbstractServiceTaskProcessor { ServiceInstance si = new ServiceInstance() si.setOrchestrationStatus(orchStatus) AAIResourcesClient client = getAAIClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, tnNssiId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(tnNssiId)) client.update(uri, si) } catch (BpmnError e) { throw e diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy index 3df0d3d6f0..fc14da3a7d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy @@ -47,6 +47,8 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.ServiceInstance import org.onap.so.bpmn.core.domain.ServiceProxy 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.aai.AAINamespaceConstants import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aai.domain.yang.NetworkPolicy @@ -549,7 +551,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { try { AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri nssiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), execution.getVariable("RANServiceInstanceId")) + AAIResourceUri nssiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("RANServiceInstanceId"))) client.create(nssiServiceUri, ANServiceInstance) } catch (BpmnError e) { @@ -630,10 +632,10 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { try { AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri nssiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), execution.getVariable("RANServiceInstanceId")) + AAIResourceUri nssiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("RANServiceInstanceId"))) client.create(nssiServiceUri, ANServiceInstance) - AAIResourceUri nssiServiceUri1 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), execution.getVariable("RANNFServiceInstanceId")) + AAIResourceUri nssiServiceUri1 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("RANNFServiceInstanceId"))) client.create(nssiServiceUri1, ANNFServiceInstance) } catch (BpmnError e) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy index 2a31997cd5..b5e1e6b82a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy @@ -54,6 +54,8 @@ import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.entities.AAIResultWrapper import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel 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.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.ServiceProxy import org.onap.so.bpmn.core.json.JsonUtils @@ -125,7 +127,7 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { si.setEnvironmentContext(environmentContext) si.setWorkloadContext(workloadContext) logger.debug("AAI service Instance Request Payload : "+si.toString()) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), serviceType, serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(serviceType).serviceInstance(serviceInstanceId)) Response response = getAAIClient().create(uri, si) if(response.getStatus()!=200) { exceptionUtil.buildAndThrowWorkflowException(execution, response.getStatus(), "AAI instance creation failed") @@ -353,8 +355,7 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { ServiceInstance si = execution.getVariable("nssiServiceInstance") si.setOrchestrationStatus("activated") - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalCustId, serviceType, networkServiceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(networkServiceInstanceId)) try { getAAIClient().update(uri, si) } catch (Exception e) { @@ -364,10 +365,10 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { } //URI for NSSI - AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiId); + AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId)); //URI for Network Service Instance - AAIResourceUri networkServiceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, networkServiceInstanceId) + AAIResourceUri networkServiceInstanceUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(networkServiceInstanceId)) // Update Relationship in AAI Response response = getAAIClient().connect(nssiUri, networkServiceInstanceUri, AAIEdgeLabel.COMPOSED_OF); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy index 6367341228..5ecfc9a872 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy @@ -20,15 +20,32 @@ package org.onap.so.bpmn.infrastructure.scripts +import static org.apache.commons.lang3.StringUtils.isBlank +import javax.ws.rs.NotFoundException +import javax.ws.rs.core.Response import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject +import org.onap.aai.domain.yang.GenericVnf +import org.onap.aai.domain.yang.RelatedToProperty +import org.onap.aai.domain.yang.Relationship +import org.onap.aai.domain.yang.RelationshipData +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.aaiclient.client.aai.AAIObjectName +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.ONAPComponents import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.CatalogDbUtils import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.RequestDBUtil +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.HttpClient +import org.onap.so.db.request.beans.ResourceOperationStatus import org.onap.so.serviceinstancebeans.CloudConfiguration import org.onap.so.serviceinstancebeans.LineOfBusiness import org.onap.so.serviceinstancebeans.ModelInfo @@ -36,36 +53,14 @@ import org.onap.so.serviceinstancebeans.ModelType import org.onap.so.serviceinstancebeans.OwningEntity import org.onap.so.serviceinstancebeans.Platform import org.onap.so.serviceinstancebeans.Project -import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.rest.catalog.beans.Vnf import org.onap.so.serviceinstancebeans.RequestDetails import org.onap.so.serviceinstancebeans.RequestInfo import org.onap.so.serviceinstancebeans.RequestParameters import org.onap.so.serviceinstancebeans.SubscriberInfo -import org.onap.aai.domain.yang.GenericVnf -import org.onap.aai.domain.yang.RelatedToProperty -import org.onap.aai.domain.yang.Relationship -import org.onap.aai.domain.yang.RelationshipData -import org.onap.aai.domain.yang.RelationshipList -import org.onap.aai.domain.yang.ServiceInstance import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.client.HttpClient -import org.onap.so.client.HttpClientFactory -import org.onap.so.db.request.beans.OperationStatus -import org.onap.so.db.request.beans.ResourceOperationStatus -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 com.fasterxml.jackson.databind.ObjectMapper -import static org.apache.commons.lang3.StringUtils.isBlank - -import javax.ws.rs.NotFoundException -import javax.ws.rs.core.Response class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor { @@ -123,7 +118,7 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable("serviceInstanceID") String errorMsg = "query Network Service Instance from AAI failed" - AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, serviceInstanceId, errorMsg) + AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, serviceInstanceId, errorMsg) Optional<ServiceInstance> nsi = wrapper.asBean(ServiceInstance.class) String networkServiceInstanceName = "" @@ -163,7 +158,7 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor { String errorSliceProfileMsg = "Slice Profile Service Instance was not found in aai" //Query Slice Profile Service Instance From AAI by sliceProfileServiceInstanceId - AAIResultWrapper sliceProfileInstanceWrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, sliceProfileServiceInstanceId, errorSliceProfileMsg) + AAIResultWrapper sliceProfileInstanceWrapper = queryAAI(execution, Types.SERVICE_INSTANCE, sliceProfileServiceInstanceId, errorSliceProfileMsg) Optional<ServiceInstance> sliceProfileServiceInstance = sliceProfileInstanceWrapper.asBean(ServiceInstance.class) if (sliceProfileServiceInstance.isPresent()) { String orchestrationStatus= sliceProfileServiceInstance.get().getOrchestrationStatus() @@ -204,7 +199,7 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable("networkServiceInstanceId") String errorMsg = "query Network Service Instance from AAI failed" - AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, serviceInstanceId, errorMsg) + AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, serviceInstanceId, errorMsg) Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) String networkServiceModelInvariantUuid = si.get().getModelInvariantId() @@ -256,7 +251,7 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor { logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: getVnfRelationships ****") String msg = "query Generic Vnf from AAI failed" try { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, execution.getVariable('vnfId')) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(execution.getVariable('vnfId'))) if (!getAAIClient().exists(uri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) } @@ -313,15 +308,15 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor { /** * query AAI * @param execution - * @param aaiObjectType + * @param aaiObjectName * @param instanceId * @return AAIResultWrapper */ - private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectType aaiObjectType, String instanceId, String errorMsg) { + private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectName aaiObjectName, String instanceId, String errorMsg) { logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: queryAAI ****") String globalSubscriberId = execution.getVariable("globalSubscriberId") String serviceType = execution.getVariable("serviceType") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(aaiObjectType, globalSubscriberId, serviceType, instanceId) + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(instanceId)) if (!getAAIClient().exists(resourceUri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMsg) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy index 4a8469cc8d..d0c189cb04 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy @@ -2,56 +2,65 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + # Copyright (c) 2020, CMCC Technologies Co., Ltd. + # + # Licensed under the Apache License, Version 2.0 (the "License") + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. * ============LICENSE_END========================================================= */ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.so.beans.nsmf.oof.SubnetType +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import javax.ws.rs.NotFoundException import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.Relationship -import org.onap.aai.domain.yang.RelationshipList import org.onap.aai.domain.yang.ServiceInstance -import org.onap.so.beans.nsmf.SliceTaskParams -import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils -import org.onap.so.bpmn.core.domain.ServiceDecomposition -import org.onap.so.bpmn.core.domain.ServiceProxy -import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aai.domain.yang.SliceProfile 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.so.beans.nsmf.AllocateAnNssi +import org.onap.so.beans.nsmf.AllocateCnNssi +import org.onap.so.beans.nsmf.AllocateTnNssi +import org.onap.so.beans.nsmf.AnSliceProfile +import org.onap.so.beans.nsmf.CnSliceProfile +import org.onap.so.beans.nsmf.EsrInfo +import org.onap.so.beans.nsmf.NssiResponse +import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest +import org.onap.so.beans.nsmf.ResponseDescriptor +import org.onap.so.beans.nsmf.ServiceInfo +import org.onap.so.beans.nsmf.SliceTaskInfo +import org.onap.so.beans.nsmf.SliceTaskParamsAdapter +import org.onap.so.beans.nsmf.TnSliceProfile +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.json.JsonUtils import org.slf4j.Logger import org.slf4j.LoggerFactory - -import javax.ws.rs.NotFoundException - import static org.apache.commons.lang3.StringUtils.isBlank -class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor{ +class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ - private static final Logger logger = LoggerFactory.getLogger( DoAllocateNSIandNSSI.class); + private static final Logger logger = LoggerFactory.getLogger(DoAllocateNSIandNSSI.class); ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil) + AAIResourcesClient client = getAAIClient() /** * Pre Process the BPMN Flow Request @@ -72,165 +81,74 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi logger.trace("Exit preProcessRequest") } + /** + * Process NSI options + * @param execution + */ void retriveSliceOption(DelegateExecution execution) { logger.trace("Enter retriveSliceOption() of DoAllocateNSIandNSSI") - String uuiRequest = execution.getVariable("uuiRequest") - boolean isNSIOptionAvailable = false - List<String> nssiAssociated = new ArrayList<>() - SliceTaskParams sliceParams = execution.getVariable("sliceTaskParams") - try - { - Map<String, Object> nstSolution = execution.getVariable("nstSolution") as Map - String modelUuid = nstSolution.get("UUID") - String modelInvariantUuid = nstSolution.get("invariantUUID") - String serviceModelInfo = """{ - "modelInvariantUuid":"${modelInvariantUuid}", - "modelUuid":"${modelUuid}", - "modelVersion":"" - }""" - execution.setVariable("serviceModelInfo", serviceModelInfo) - //Params sliceParams = new Gson().fromJson(params, new TypeToken<Params>() {}.getType()); - execution.setVariable("sliceParams", sliceParams) - }catch (Exception ex) { - logger.debug( "Unable to get the task information from request DB: " + ex) - exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Unable to get task information from request DB.") - } - if(isBlank(sliceParams.getSuggestNsiId())) - { - isNSIOptionAvailable=false - } - else - { - isNSIOptionAvailable=true - execution.setVariable('nsiServiceInstanceId',sliceParams.getSuggestNsiId()) - execution.setVariable('nsiServiceInstanceName',sliceParams.getSuggestNsiName()) - } - execution.setVariable("isNSIOptionAvailable",isNSIOptionAvailable) - logger.trace("Exit retriveSliceOption() of DoAllocateNSIandNSSI") - } + boolean isNSIOptionAvailable - void updateRelationship(DelegateExecution execution) { - logger.debug("Enter update relationship in DoAllocateNSIandNSSI()") - String allottedResourceId = execution.getVariable("allottedResourceId") - //Need to check whether nsi exist : Begin - org.onap.aai.domain.yang.ServiceInstance nsiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance() - SliceTaskParams sliceParams = execution.getVariable("sliceParams") - String nsiServiceInstanceID = sliceParams.getSuggestNsiId() - - AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), nsiServiceInstanceID) - //AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.QUERY_ALLOTTED_RESOURCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), nsiServiceInstanceID) + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter - try { - AAIResultWrapper wrapper = resourceClient.get(nsiServiceuri, NotFoundException.class) - Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class) - nsiServiceInstance = si.get() - //allottedResourceId=nsiServiceInstance.getAllottedResources().getAllottedResource().get(0).getId() - -// if(resourceClient.exists(nsiServiceuri)){ -// execution.setVariable("nsi_resourceLink", nsiServiceuri.build().toString()) -// }else{ -// exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai to " + -// "associate for service :"+serviceInstanceId) -// } - - AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), execution.getVariable("sliceServiceInstanceId"), allottedResourceId) - getAAIClient().connect(allottedResourceUri,nsiServiceuri) - - List<String> nssiAssociated = new ArrayList<>() - RelationshipList relationshipList = nsiServiceInstance.getRelationshipList() - List<Relationship> relationships = relationshipList.getRelationship() - for(Relationship relationship in relationships) - { - if(relationship.getRelatedTo().equalsIgnoreCase("service-instance")) - { - String NSSIassociated = relationship.getRelatedLink().substring(relationship.getRelatedLink().lastIndexOf("/") + 1); - if(!NSSIassociated.equals(nsiServiceInstanceID)) - nssiAssociated.add(NSSIassociated) - } + if(isBlank(sliceParams.getSuggestNsiId())) { + isNSIOptionAvailable = false } - execution.setVariable("nssiAssociated",nssiAssociated) - execution.setVariable("nsiServiceInstanceName",nsiServiceInstance.getServiceInstanceName()) - }catch(BpmnError e) { - throw e - }catch (Exception ex){ - String msg = "NSI suggested in the option doesn't exist. " + nsiServiceInstanceID - logger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + else { + isNSIOptionAvailable = true + execution.setVariable('nsiServiceInstanceId', sliceParams.getSuggestNsiId()) + execution.setVariable('nsiServiceInstanceName', sliceParams.getSuggestNsiName()) } - logger.debug("Exit update relationship in DoAllocateNSIandNSSI()") + execution.setVariable("isNSIOptionAvailable", isNSIOptionAvailable) + logger.trace("Exit retriveSliceOption() of DoAllocateNSIandNSSI") } - void prepareNssiModelInfo(DelegateExecution execution){ - logger.trace("Enter prepareNssiModelInfo in DoAllocateNSIandNSSI()") - List<String> nssiAssociated = new ArrayList<>() - Map<String, Object> nssiMap = new HashMap<>() - nssiAssociated=execution.getVariable("nssiAssociated") - for(String nssiID in nssiAssociated) - { - try { - AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), nssiID) - AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) - Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class) - org.onap.aai.domain.yang.ServiceInstance nssi = si.get() - nssiMap.put(nssi.getEnvironmentContext(),"""{ - "serviceInstanceId":"${nssi.getServiceInstanceId()}", - "modelUuid":"${nssi.getModelVersionId()}" - }""") - - }catch(NotFoundException e) - { - logger.debug("NSSI Service Instance not found in AAI: " + nssiID) - }catch(Exception e) - { - logger.debug("NSSI Service Instance not found in AAI: " + nssiID) - } - execution.setVariable("nssiMap",nssiMap) - - } - logger.trace("Exit prepareNssiModelInfo in DoAllocateNSIandNSSI()") - } + /** + * create nsi instance in aai + * @param execution + */ void createNSIinAAI(DelegateExecution execution) { logger.debug("Enter CreateNSIinAAI in DoAllocateNSIandNSSI()") - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - org.onap.aai.domain.yang.ServiceInstance nsi = new ServiceInstance(); + String sliceInstanceId = UUID.randomUUID().toString() - execution.setVariable("sliceInstanceId",sliceInstanceId) - nsi.setServiceInstanceId(sliceInstanceId) + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + + //set new nsiId to sliceParams suggestNsiId + sliceParams.setSuggestNsiId(sliceInstanceId) + + ServiceInstance nsi = new ServiceInstance() + + String sliceInstanceName = "nsi_"+execution.getVariable("sliceServiceInstanceName") - nsi.setServiceInstanceName(sliceInstanceName) String serviceType = execution.getVariable("serviceType") - nsi.setServiceType(serviceType) String serviceStatus = "deactivated" + String modelInvariantUuid = sliceParams.getNSTInfo().invariantUUID + String modelUuid = sliceParams.getNSTInfo().UUID + + String uuiRequest = execution.getVariable("uuiRequest") + String serviceInstanceLocationid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.plmnIdList") + String serviceRole = "nsi" + + execution.setVariable("sliceInstanceId", sliceInstanceId) + nsi.setServiceInstanceId(sliceInstanceId) + nsi.setServiceInstanceName(sliceInstanceName) + nsi.setServiceType(serviceType) nsi.setOrchestrationStatus(serviceStatus) - String modelInvariantUuid = serviceDecomposition.getModelInfo().getModelInvariantUuid() - String modelUuid = serviceDecomposition.getModelInfo().getModelUuid() nsi.setModelInvariantId(modelInvariantUuid) nsi.setModelVersionId(modelUuid) - String uuiRequest = execution.getVariable("uuiRequest") - String serviceInstanceLocationid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.plmnIdList") nsi.setServiceInstanceLocationId(serviceInstanceLocationid) - //String snssai = jsonUtil.getJsonValue(uuiRequest, "service.requestInputs.snssai") - //nsi.setEnvironmentContext(snssai) - String serviceRole = "nsi" nsi.setServiceRole(serviceRole) - String msg = "" + String msg try { - AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), sliceInstanceId) + AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceInstanceId)) client.create(nsiServiceUri, nsi) - Relationship relationship = new Relationship() - logger.info("Creating Allotted resource relationship, nsiServiceUri: " + nsiServiceUri.build().toString()) - relationship.setRelatedLink(nsiServiceUri.build().toString()) - AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, - execution.getVariable("globalSubscriberId"),execution.getVariable("subscriptionServiceType"), - execution.getVariable("sliceServiceInstanceId"), execution.getVariable("allottedResourceId")).relationshipAPI() - client.create(allottedResourceUri, relationship) + execution.setVariable("nsiServiceUri", nsiServiceUri) } catch (BpmnError e) { throw e @@ -239,124 +157,592 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - Map<String, Object> nssiMap = new HashMap<>() - List<ServiceProxy> serviceProxyList = serviceDecomposition.getServiceProxy() - List<String> nsstModelInfoList = new ArrayList<>() - for(ServiceProxy serviceProxy : serviceProxyList) - { - //String nsstModelUuid = serviceProxy.getModelInfo().getModelUuid() - String nsstModelUuid = serviceProxy.getSourceModelUuid() - //String nsstModelInvariantUuid = serviceProxy.getModelInfo().getModelInvariantUuid() - String nsstServiceModelInfo = """{ - "modelInvariantUuid":"", - "modelUuid":"${nsstModelUuid}", - "modelVersion":"" - }""" - nsstModelInfoList.add(nsstServiceModelInfo) - } - int currentIndex=0 - int maxIndex=nsstModelInfoList.size() - if(maxIndex < 1) - { - msg = "Exception in DoAllocateNSIandNSSI. There is no NSST associated with NST " - logger.info(msg) + + logger.debug("Exit CreateNSIinAAI in DoAllocateNSIandNSSI()") + } + + + /** + * create relationship between nsi and service profile instance + * @param execution + */ + void createRelationship(DelegateExecution execution) { + //relation ship + String allottedResourceId = execution.getVariable("allottedResourceId") + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + + AAIResourceUri nsiServiceUri = execution.getVariable("nsiServiceUri") as AAIResourceUri + logger.info("Creating Allotted resource relationship, nsiServiceUri: " + nsiServiceUri) + + AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceParams.suggestNsiId).allottedResource(allottedResourceId)) + + client.connect(allottedResourceUri, nsiServiceUri) + } + + /** + * + * @param execution + */ + void updateRelationship(DelegateExecution execution) { + logger.debug("Enter update relationship in DoAllocateNSIandNSSI()") + //todo: allottedResourceId + String allottedResourceId = execution.getVariable("allottedResourceId") + //Need to check whether nsi exist : Begin + + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + + String nsiServiceInstanceID = sliceParams.getSuggestNsiId() + //sliceParams.setServiceId(nsiServiceInstanceID) + + AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(nsiServiceInstanceID)) + + try { + AAIResultWrapper wrapper = client.get(nsiServiceUri, NotFoundException.class) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + //todo: if exists + if (!si.ifPresent()) { + String msg = "NSI suggested in the option doesn't exist. " + nsiServiceInstanceID + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceParams.suggestNsiId).allottedResource(allottedResourceId)) + + client.connect(allottedResourceUri, nsiServiceUri) + + execution.setVariable("sliceTaskParams", sliceParams) + }catch(BpmnError e) { + throw e + }catch (Exception ex){ + String msg = "NSI suggested in the option doesn't exist. " + nsiServiceInstanceID + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - execution.setVariable("nsstModelInfoList",nsstModelInfoList) - execution.setVariable("currentIndex",currentIndex) - execution.setVariable("maxIndex",maxIndex) - execution.setVariable('nsiServiceInstanceId',sliceInstanceId) - execution.setVariable("nsiServiceInstanceName",sliceInstanceName) - logger.debug("Exit CreateNSIinAAI in DoAllocateNSIandNSSI()") + logger.debug("Exit update relationship in DoAllocateNSIandNSSI()") } - void getOneNsstInfo(DelegateExecution execution){ - List<String> nsstModelInfoList = new ArrayList<>() - nsstModelInfoList = execution.getVariable("nsstModelInfoList") - int currentIndex = execution.getVariable("currentIndex") - int maxIndex = execution.getVariable("maxIndex") - boolean isMoreNSSTtoProcess = true - String nsstServiceModelInfo = nsstModelInfoList.get(currentIndex) - execution.setVariable("serviceModelInfo", nsstServiceModelInfo) - execution.setVariable("currentIndex", currentIndex) - currentIndex = currentIndex+1 - if(currentIndex <= maxIndex ) - isMoreNSSTtoProcess = false - execution.setVariable("isMoreNSSTtoProcess", isMoreNSSTtoProcess) + /** + * create RAN Slice Profile Instance + * @param execution + */ + void createAnSliceProfileInstance(DelegateExecution execution) { + + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + String serviceInstanceId = UUID.randomUUID().toString() + execution.setVariable("ranSliceProfileInstanceId", serviceInstanceId) //todo: + + String serviceType = "" + String serviceRole = "slice-profile" + String oStatus = "deactivated" + + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo + sliceTaskInfo.setSliceInstanceId(serviceInstanceId) + + // create slice profile + ServiceInstance rspi = new ServiceInstance() + rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name) + rspi.setServiceType(serviceType) + rspi.setServiceRole(serviceRole) + rspi.setOrchestrationStatus(oStatus) + rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID) + rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID) + rspi.setInputParameters(uuiRequest) + rspi.setWorkloadContext(useInterval) + rspi.setEnvironmentContext(sNSSAI_id) + + //timestamp format YYYY-MM-DD hh:mm:ss + rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault())) + + execution.setVariable("communicationServiceInstance", rspi) + + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId)) + client.create(uri, rspi) + + execution.setVariable("sliceTaskParams", sliceParams) } - void createNSSTMap(DelegateExecution execution){ - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - String modelUuid= serviceDecomposition.getModelInfo().getModelUuid() - String content = serviceDecomposition.getServiceInfo().getServiceArtifact().get(0).getContent() - //String nsstID = jsonUtil.getJsonValue(content, "metadata.id") - //String vendor = jsonUtil.getJsonValue(content, "metadata.vendor") - //String type = jsonUtil.getJsonValue(content, "metadata.type") - String domain = jsonUtil.getJsonValue(content, "metadata.domainType") - - Map<String, Object> nssiMap = execution.getVariable("nssiMap") - String servicename = execution.getVariable("sliceServiceInstanceName") - String nsiname = "nsi_"+servicename - nssiMap.put(domain,"""{ - "serviceInstanceId":"", - "modelUuid":"${modelUuid}" - }""") - execution.setVariable("nssiMap",nssiMap) + /** + * create An Slice Profile + * @param execution + */ + void createAnSliceProfile(DelegateExecution execution) { + + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + //String serviceInstanceId = execution.getVariable("ranSliceProfileInstanceId") + + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo + AnSliceProfile anSliceProfile = sliceTaskInfo.sliceProfile + + String profileId = UUID.randomUUID().toString() + anSliceProfile.setSliceProfileId(profileId) + + SliceProfile sliceProfile = new SliceProfile() + sliceProfile.setProfileId(profileId) + sliceProfile.setCoverageAreaTAList(anSliceProfile.coverageAreaTAList as String) + //todo:... + AAIResourceUri uri = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.business().customer(globalSubscriberId) + .serviceSubscription(subscriptionServiceType) + .serviceInstance(sliceTaskInfo.sliceInstanceId) + .sliceProfile(profileId) + ) + client.create(uri, sliceProfile) + execution.setVariable("sliceTaskParams", sliceParams) } - void prepareNSSIList(DelegateExecution execution){ - logger.trace("Enter prepareNSSIList in DoAllocateNSIandNSSI()") - Map<String, Object> nssiMap = new HashMap<>() - Boolean isMoreNSSI = false - nssiMap = execution.getVariable("nssiMap") - List<String> keys=new ArrayList<String>(nssiMap.values()) - List<String> nsstSequence = execution.getVariable("nsstSequence") - Integer currentIndex=0; - execution.setVariable("currentNssiIndex",currentIndex) - Integer maxIndex=keys.size() - execution.setVariable("maxIndex",maxIndex) - if(maxIndex>0) - isMoreNSSI=true - execution.setVariable("isMoreNSSI",isMoreNSSI) - logger.trace("Exit prepareNSSIList in DoAllocateNSIandNSSI()") + /** + * prepare AllocateAnNssi + * @param execution + */ + void prepareAllocateAnNssi(DelegateExecution execution) { + + //todo: + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo + + NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest() + + AllocateAnNssi allocateAnNssi = new AllocateAnNssi() + allocateAnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID + allocateAnNssi.nssiId = sliceTaskInfo.NSSTInfo.UUID + allocateAnNssi.nssiName = sliceTaskInfo.NSSTInfo.name + allocateAnNssi.sliceProfile = sliceTaskInfo.sliceProfile + allocateAnNssi.nsiInfo.nsiId = sliceParams.suggestNsiId + + EsrInfo esrInfo = new EsrInfo() + //todo: vendor and network + esrInfo.setVendor(sliceTaskInfo.getVendor()) + esrInfo.setNetworkType(sliceTaskInfo.getNetworkType()) + + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + + //todo: service info + ServiceInfo serviceInfo = new ServiceInfo() + serviceInfo.globalSubscriberId = globalSubscriberId + serviceInfo.subscriptionServiceType = subscriptionServiceType + serviceInfo.nsiId = sliceParams.suggestNsiId + serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID + serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID + + nbiRequest.setServiceInfo(serviceInfo) + nbiRequest.setEsrInfo(esrInfo) + nbiRequest.setAllocateAnNssi(allocateAnNssi) + + execution.setVariable("AnAllocateNssiNbiRequest", nbiRequest) + execution.setVariable("anBHSliceTaskInfo", sliceTaskInfo) + execution.setVariable("anSubnetType", SubnetType.AN_NF) } - void getOneNSSIInfo(DelegateExecution execution){ - logger.trace("Enter getOneNSSIInfo in DoAllocateNSIandNSSI()") - - //ServiceDecomposition serviceDecompositionObj = execution.getVariable("serviceDecompositionObj") - Map<String, Object> nssiMap=execution.getVariable("nssiMap") - List<String> nsstSequence = execution.getVariable("nsstSequence") - String currentNSST= nsstSequence.get(execution.getVariable("currentNssiIndex")) - boolean isNSSIOptionAvailable = false - String nsstInput=nssiMap.get(currentNSST) - execution.setVariable("nsstInput",nsstInput) - String modelUuid = jsonUtil.getJsonValue(nsstInput, "modelUuid") - String nssiInstanceId = jsonUtil.getJsonValue(nsstInput, "serviceInstanceId") - String nssiserviceModelInfo = """{ - "modelInvariantUuid":"", - "modelUuid":"${modelUuid}", - "modelVersion":"" - }""" - Integer currentIndex = execution.getVariable("currentNssiIndex") - currentIndex=currentIndex+1; - execution.setVariable("currentNssiIndex",currentIndex) - execution.setVariable("nssiserviceModelInfo",nssiserviceModelInfo) - execution.setVariable("nssiInstanceId",nssiInstanceId) - logger.trace("Exit getOneNSSIInfo in DoAllocateNSIandNSSI()") + /** + * create RAN Slice Profile Instance + * @param execution + */ + void createCnSliceProfileInstance(DelegateExecution execution) { + + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + String serviceInstanceId = UUID.randomUUID().toString() + execution.setVariable("cnSliceProfileInstanceId", serviceInstanceId) //todo: + + String serviceType = "" + String serviceRole = "slice-profile" + String oStatus = "deactivated" + + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo + sliceTaskInfo.setSliceInstanceId(serviceInstanceId) + + // create slice profile + ServiceInstance rspi = new ServiceInstance() + rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name) + rspi.setServiceType(serviceType) + rspi.setServiceRole(serviceRole) + rspi.setOrchestrationStatus(oStatus) + rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID) + rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID) + rspi.setInputParameters(uuiRequest) + rspi.setWorkloadContext(useInterval) + rspi.setEnvironmentContext(sNSSAI_id) + + //timestamp format YYYY-MM-DD hh:mm:ss + rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault())) + + execution.setVariable("communicationServiceInstance", rspi) + + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId)) + client.create(uri, rspi) + execution.setVariable("sliceTaskParams", sliceParams) + } + + /** + * create Cn Slice Profile + * @param execution + */ + void createCnSliceProfile(DelegateExecution execution) { + + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + //String serviceInstanceId = execution.getVariable("ranSliceProfileInstanceId") + + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + + SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo + CnSliceProfile cnSliceProfile = sliceTaskInfo.sliceProfile + + String profileId = UUID.randomUUID().toString() + cnSliceProfile.setSliceProfileId(profileId) + + SliceProfile sliceProfile = new SliceProfile() + sliceProfile.setProfileId(profileId) + sliceProfile.setCoverageAreaTAList(cnSliceProfile.coverageAreaTAList as String) + //todo:... + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(sliceTaskInfo.sliceInstanceId).sliceProfile(profileId)) + client.create(uri, sliceProfile) + execution.setVariable("sliceTaskParams", sliceParams) + } + + /** + * prepare AllocateCnNssi + * @param execution + */ + void prepareAllocateCnNssi(DelegateExecution execution) { + + //todo: + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo + + NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest() + + AllocateCnNssi allocateCnNssi = new AllocateCnNssi() + allocateCnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID + allocateCnNssi.nssiId = sliceTaskInfo.suggestNssiId + allocateCnNssi.nssiName = sliceTaskInfo.NSSTInfo.name + allocateCnNssi.sliceProfile = sliceTaskInfo.sliceProfile + allocateCnNssi.nsiInfo.nsiId = sliceParams.suggestNsiId + + EsrInfo esrInfo = new EsrInfo() + //todo: vendor and network + esrInfo.setVendor(sliceTaskInfo.getVendor()) + esrInfo.setNetworkType(sliceTaskInfo.getNetworkType()) + + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + + //todo: service info + ServiceInfo serviceInfo = new ServiceInfo() + serviceInfo.globalSubscriberId = globalSubscriberId + serviceInfo.subscriptionServiceType = subscriptionServiceType + serviceInfo.nsiId = sliceParams.suggestNsiId + serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID + serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID + serviceInfo.nssiId = sliceTaskInfo.suggestNssiId //if shared + + nbiRequest.setServiceInfo(serviceInfo) + nbiRequest.setEsrInfo(esrInfo) + nbiRequest.setAllocateCnNssi(allocateCnNssi) + + execution.setVariable("CnAllocateNssiNbiRequest", nbiRequest) + execution.setVariable("cnSliceTaskInfo", sliceTaskInfo) + execution.setVariable("cnSubnetType", SubnetType.CN) + } + + + /** + * create TN Slice Profile Instance + * @param execution + */ + void createTnBHSliceProfileInstance(DelegateExecution execution) { + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + + String serviceType = "" + String serviceRole = "slice-profile" + String oStatus = "deactivated" + + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + + SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo + String serviceInstanceId = UUID.randomUUID().toString() + + sliceTaskInfo.setSliceInstanceId(serviceInstanceId) + //execution.setVariable("cnSliceProfileInstanceId", serviceInstanceId) //todo: + + // create slice profile + ServiceInstance rspi = new ServiceInstance() + rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name) + rspi.setServiceType(serviceType) + rspi.setServiceRole(serviceRole) + rspi.setOrchestrationStatus(oStatus) + rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID) + rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID) + rspi.setInputParameters(uuiRequest) + rspi.setWorkloadContext(useInterval) + rspi.setEnvironmentContext(sNSSAI_id) + + //timestamp format YYYY-MM-DD hh:mm:ss + rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault())) + + execution.setVariable("communicationServiceInstance", rspi) + + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId)) + client.create(uri, rspi) + + execution.setVariable("sliceTaskParams", sliceParams) + } + + /** + * create Tn Slice Profile + * @param execution + */ + void createTnBHSliceProfile(DelegateExecution execution) { + + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + + SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo + + TnSliceProfile tnSliceProfile = sliceTaskInfo.sliceProfile + String profileId = UUID.randomUUID().toString() + tnSliceProfile.setSliceProfileId(profileId) + + SliceProfile sliceProfile = new SliceProfile() + sliceProfile.setProfileId(profileId) + //todo:... + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(sliceTaskInfo.sliceInstanceId).sliceProfile(profileId)) + client.create(uri, sliceProfile) + + execution.setVariable("sliceTaskParams", sliceParams) + } + + /** + * prepare AllocateCnNssi + * @param execution + */ + void prepareAllocateTnBHNssi(DelegateExecution execution) { + + //todo: + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo + + NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest() + + AllocateTnNssi allocateTnNssi = new AllocateTnNssi() + //todo: AllocateTnNssi + //todo: endpointId -> set into tn + allocateTnNssi.setTransportSliceNetworks() + allocateTnNssi.setNetworkSliceInfos() + + + //allocateTnNssi.networkSliceInfos + + EsrInfo esrInfo = new EsrInfo() + esrInfo.setVendor(sliceTaskInfo.getVendor()) + esrInfo.setNetworkType(sliceTaskInfo.getNetworkType()) + + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + + ServiceInfo serviceInfo = new ServiceInfo() + serviceInfo.globalSubscriberId = globalSubscriberId + serviceInfo.subscriptionServiceType = subscriptionServiceType + serviceInfo.nsiId = sliceParams.suggestNsiId + serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID + serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID + serviceInfo.nssiId = sliceTaskInfo.suggestNssiId + + nbiRequest.setServiceInfo(serviceInfo) + nbiRequest.setEsrInfo(esrInfo) + nbiRequest.setAllocateTnNssi(allocateTnNssi) + + execution.setVariable("TnBHAllocateNssiNbiRequest", nbiRequest) + execution.setVariable("tnBHSliceTaskInfo", sliceTaskInfo) + execution.setVariable("tnBHSubnetType", SubnetType.TN_BH) + } + + /** + * Update relationship between + * 1. NSI and NSSI + * 2. Slice Profile and Service Profile + * 3. SliceProfile and NSSI + * 4. sliceProfile and endpoint + * + * @param execution + */ + public void updateAnRelationship(DelegateExecution execution) { + //todo: + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + + ResponseDescriptor result = execution.getVariable("anNssiAllocateResult") as ResponseDescriptor + String nssiId = result.getNssiId() + String nsiId = sliceParams.getSuggestNsiId() + String sliceProfileInstanceId = sliceParams.anSliceTaskInfo.sliceInstanceId + String serviceProfileInstanceId = sliceParams.serviceId + //nsi id + //todo: aai -> nssi -> relationship -> endpointId -> set into tn + String endPointId = getEndpointIdFromAAI(execution, nssiId) + execution.setVariable("endPointIdAn", endPointId) + + updateRelationship(execution, nsiId, nssiId) + + updateRelationship(execution, serviceProfileInstanceId, sliceProfileInstanceId) + + updateRelationship(execution, sliceProfileInstanceId, nssiId) + + sliceParams.anSliceTaskInfo.suggestNssiId = nssiId + execution.setVariable("sliceTaskParams", sliceParams) } - void updateCurrentIndex(DelegateExecution execution){ - logger.trace("Enter updateCurrentIndex in DoAllocateNSIandNSSI()") - Integer currentIndex = execution.getVariable("currentNssiIndex") - Integer maxIndex = execution.getVariable("maxIndex") - if(currentIndex>=maxIndex) - { - Boolean isMoreNSSI=false - execution.setVariable("isMoreNSSI",isMoreNSSI) + /** + * Update relationship between + * 1. NSI and NSSI + * 2. Slice Profile and Service Profile + * 3. SliceProfile and NSSI + * + * @param execution + */ + public void updateCnRelationship(DelegateExecution execution) { + //todo: + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + + NssiResponse result = execution.getVariable("cnNssiAllocateResult") as NssiResponse + String nssiId = result.getNssiId() + String nsiId = sliceParams.getSuggestNsiId() + String sliceProfileInstanceId = sliceParams.cnSliceTaskInfo.sliceInstanceId + String serviceProfileInstanceId = sliceParams.serviceId + //nsi id + //todo: aai -> nssi -> relationship -> endpointId -> set into tn + String endPointId = getEndpointIdFromAAI(execution, nssiId) + execution.setVariable("endPointIdCn", endPointId) + + updateRelationship(execution, nsiId, nssiId) + + updateRelationship(execution, serviceProfileInstanceId, sliceProfileInstanceId) + + updateRelationship(execution,sliceProfileInstanceId, nssiId) + + sliceParams.cnSliceTaskInfo.suggestNssiId = nssiId + execution.setVariable("sliceTaskParams", sliceParams) + } + + /** + * get endpoint Id from AAI by nssi id + * @param execution + * @param nssiId + * @return + */ + private String getEndpointIdFromAAI(DelegateExecution execution, String nssiId) { + logger.debug("Enter update relationship in DoAllocateNSIandNSSI()") + //todo: allottedResourceId + + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + + //sliceParams.setServiceId(nsiServiceInstanceID) + AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(nssiId)) + + String endpointId = null + + try { + AAIResultWrapper wrapper = client.get(nsiServiceUri, NotFoundException.class) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + //todo: if exists + if (!si.ifPresent()) { + String msg = "NSSI in the option doesn't exist. " + nssiId + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + if (si.ifPresent()) { + ServiceInstance nssiInstance = si.get() + //todo: handle relationship and return endpointId + for (Relationship relationship : nssiInstance.relationshipList.getRelationship()) { + if (relationship.relationshipLabel){ + endpointId = relationship //todo + } + } + + return endpointId + } + + }catch(BpmnError e) { + throw e + }catch (Exception ex){ + String msg = "NSSI suggested in the option doesn't exist. " + nssiId + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - logger.trace("Exit updateCurrentIndex in DoAllocateNSIandNSSI()") + logger.debug("Exit update relationship in DoAllocateNSIandNSSI()") } -}
\ No newline at end of file + + /** + * Update relationship between + * 1. NSI and NSSI + * 2. Slice Profile and Service Profile + * 3. SliceProfile and NSSI + * + * @param execution + */ + public void updateTnBHRelationship(DelegateExecution execution) { + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + + NssiResponse result = execution.getVariable("tnBHNssiAllocateResult") as NssiResponse + String nssiId = result.getNssiId() + String nsiId = sliceParams.getSuggestNsiId() + String sliceProfileInstanceId = sliceParams.tnBHSliceTaskInfo.sliceInstanceId + String serviceProfileInstanceId = sliceParams.serviceId + //nsi id + + updateRelationship(execution, nsiId, nssiId) + + updateRelationship(execution, serviceProfileInstanceId, sliceProfileInstanceId) + + updateRelationship(execution,sliceProfileInstanceId, nssiId) + + sliceParams.tnBHSliceTaskInfo.suggestNssiId = nssiId + execution.setVariable("sliceTaskParams", sliceParams) + } + + /** + * sourceId -> targetId + * @param execution + * @param sourceId + * @param targetId + */ + void updateRelationship(DelegateExecution execution, String sourceId, String targetId) { + //relation ship + Relationship relationship = new Relationship() + + AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(targetId)) + + logger.info("Creating Allotted resource relationship, nsiServiceUri: " + nsiServiceUri) + + relationship.setRelatedLink(nsiServiceUri.build().toString()) + + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sourceId).relationshipAPI()) + client.create(uri, relationship) + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSIV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSIV2.groovy deleted file mode 100644 index 924b42fe9f..0000000000 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSIV2.groovy +++ /dev/null @@ -1,613 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.infrastructure.scripts - -import org.apache.commons.lang3.StringUtils -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.aai.domain.yang.Relationship -import org.onap.aai.domain.yang.ServiceInstance -import org.onap.aai.domain.yang.SliceProfile -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.so.beans.nsmf.* -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils -import org.onap.so.bpmn.core.json.JsonUtils -import org.slf4j.Logger -import org.slf4j.LoggerFactory - -import javax.ws.rs.NotFoundException - -class DoAllocateNSIandNSSIV2 extends AbstractServiceTaskProcessor{ - - private static final Logger logger = LoggerFactory.getLogger( DoAllocateNSIandNSSIV2.class); - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - JsonUtils jsonUtil = new JsonUtils() - - private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil) - - AAIResourcesClient client = getAAIClient() - - /** - * Pre Process the BPMN Flow Request - * Inclouds: - * generate the nsOperationKey - * generate the nsParameters - */ - - void preProcessRequest (DelegateExecution execution) { - String msg = "" - logger.trace("Enter preProcessRequest()") - Map<String, Object> nssiMap = new HashMap<>() - execution.setVariable("nssiMap", nssiMap) - boolean isMoreNSSTtoProcess = true - execution.setVariable("isMoreNSSTtoProcess", isMoreNSSTtoProcess) - List<String> nsstSequence = new ArrayList<>(Arrays.asList("cn")) - execution.setVariable("nsstSequence", nsstSequence) - logger.trace("Exit preProcessRequest") - } - - /** - * Process NSI options - * @param execution - */ - void retriveSliceOption(DelegateExecution execution) { - logger.trace("Enter retriveSliceOption() of DoAllocateNSIandNSSI") - - boolean isNSIOptionAvailable - - SliceTaskParamsAdapter sliceParams = - execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter -// try -// { -// Map<String, Object> nstSolution = execution.getVariable("nstSolution") as Map -// String modelUuid = nstSolution.get("UUID") -// String modelInvariantUuid = nstSolution.get("invariantUUID") -// String serviceModelInfo = """{ -// "modelInvariantUuid":"${modelInvariantUuid}", -// "modelUuid":"${modelUuid}", -// "modelVersion":"" -// }""" -// execution.setVariable("serviceModelInfo", serviceModelInfo) -// -// execution.setVariable("sliceParams", sliceParams) -// }catch (Exception ex) { -// logger.debug( "Unable to get the task information from request DB: " + ex) -// exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Unable to get task information from request DB.") -// } - - if(StringUtils.isBlank(sliceParams.getSuggestNsiId())) { - isNSIOptionAvailable = false - } - else { - isNSIOptionAvailable = true - execution.setVariable('nsiServiceInstanceId', sliceParams.getSuggestNsiId()) - execution.setVariable('nsiServiceInstanceName', sliceParams.getSuggestNsiName()) - } - execution.setVariable("isNSIOptionAvailable", isNSIOptionAvailable) - logger.trace("Exit retriveSliceOption() of DoAllocateNSIandNSSI") - } - - - /** - * create nsi instance in aai - * @param execution - */ - void createNSIinAAI(DelegateExecution execution) { - logger.debug("Enter CreateNSIinAAI in DoAllocateNSIandNSSI()") - - String sliceInstanceId = UUID.randomUUID().toString() - SliceTaskParamsAdapter sliceParams = - execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter - - sliceParams.setServiceId(sliceInstanceId) - - ServiceInstance nsi = new ServiceInstance() - - - String sliceInstanceName = "nsi_"+execution.getVariable("sliceServiceInstanceName") - String serviceType = execution.getVariable("serviceType") - String serviceStatus = "deactivated" - String modelInvariantUuid = sliceParams.getNSTInfo().invariantUUID - String modelUuid = sliceParams.getNSTInfo().UUID - - String uuiRequest = execution.getVariable("uuiRequest") - String serviceInstanceLocationid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.plmnIdList") - String serviceRole = "nsi" - - execution.setVariable("sliceInstanceId", sliceInstanceId) - nsi.setServiceInstanceId(sliceInstanceId) - nsi.setServiceInstanceName(sliceInstanceName) - nsi.setServiceType(serviceType) - nsi.setOrchestrationStatus(serviceStatus) - nsi.setModelInvariantId(modelInvariantUuid) - nsi.setModelVersionId(modelUuid) - nsi.setServiceInstanceLocationId(serviceInstanceLocationid) - nsi.setServiceRole(serviceRole) - String msg - try { - - AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - execution.getVariable("globalSubscriberId"), - execution.getVariable("subscriptionServiceType"), - sliceInstanceId) - client.create(nsiServiceUri, nsi) - - execution.setVariable("nsiServiceUri", nsiServiceUri.build().toString()) - - } catch (BpmnError e) { - throw e - } catch (Exception ex) { - msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage() - logger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - - logger.debug("Exit CreateNSIinAAI in DoAllocateNSIandNSSI()") - } - - - /** - * create relationship between nsi and service profile instance - * @param execution - */ - void createRelationship(DelegateExecution execution) { - //relation ship - Relationship relationship = new Relationship() - String nsiServiceUri = execution.getVariable("nsiServiceUri") as String - logger.info("Creating Allotted resource relationship, nsiServiceUri: " + nsiServiceUri) - - relationship.setRelatedLink(nsiServiceUri) - - AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri( - AAIObjectType.ALLOTTED_RESOURCE, - execution.getVariable("globalSubscriberId"), - execution.getVariable("subscriptionServiceType"), - execution.getVariable("sliceServiceInstanceId"), - execution.getVariable("allottedResourceId")) - .relationshipAPI() - client.create(allottedResourceUri, relationship) - } - - /** - * - * @param execution - */ - void updateRelationship(DelegateExecution execution) { - logger.debug("Enter update relationship in DoAllocateNSIandNSSI()") - String allottedResourceId = execution.getVariable("allottedResourceId") - //Need to check whether nsi exist : Begin - - SliceTaskParamsAdapter sliceParams = - execution.getVariable("sliceParams") as SliceTaskParamsAdapter - - String nsiServiceInstanceID = sliceParams.getSuggestNsiId() - sliceParams.setServiceId(nsiServiceInstanceID) - - AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - execution.getVariable("globalSubscriberId"), - execution.getVariable("subscriptionServiceType"), - nsiServiceInstanceID) - - try { - AAIResultWrapper wrapper = client.get(nsiServiceUri, NotFoundException.class) - Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) - //todo: if exists - if (!si.ifPresent()) { - String msg = "NSI suggested in the option doesn't exist. " + nsiServiceInstanceID - logger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - - AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, - execution.getVariable("globalSubscriberId"), - execution.getVariable("subscriptionServiceType"), - execution.getVariable("sliceServiceInstanceId"), - allottedResourceId) - - client.connect(allottedResourceUri, nsiServiceUri) - - execution.setVariable("sliceParams", sliceParams) - }catch(BpmnError e) { - throw e - }catch (Exception ex){ - String msg = "NSI suggested in the option doesn't exist. " + nsiServiceInstanceID - logger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - logger.debug("Exit update relationship in DoAllocateNSIandNSSI()") - } - - /** - * create RAN Slice Profile Instance - * @param execution - */ - void createAnSliceProfileInstance(DelegateExecution execution) { - - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - String serviceInstanceId = UUID.randomUUID().toString() - execution.setVariable("ranSliceProfileInstanceId", serviceInstanceId) //todo: - - String serviceType = "" - String serviceRole = "slice-profile" - String oStatus = "deactivated" - - SliceTaskParamsAdapter sliceParams = - execution.getVariable("sliceParams") as SliceTaskParamsAdapter - SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo - sliceTaskInfo.setServiceInstanceId(serviceInstanceId) - - // create slice profile - ServiceInstance rspi = new ServiceInstance() - rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name) - rspi.setServiceType(serviceType) - rspi.setServiceRole(serviceRole) - rspi.setOrchestrationStatus(oStatus) - rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID) - rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID) - rspi.setInputParameters(uuiRequest) - rspi.setWorkloadContext(useInterval) - rspi.setEnvironmentContext(sNSSAI_id) - - //timestamp format YYYY-MM-DD hh:mm:ss - rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault())) - - execution.setVariable("communicationServiceInstance", rspi) - - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, - subscriptionServiceType, - serviceInstanceId) - client.create(uri, rspi) - - execution.setVariable("sliceParams", sliceParams) - } - - /** - * create An Slice Profile - * @param execution - */ - void createAnSliceProfile(DelegateExecution execution) { - - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - //String serviceInstanceId = execution.getVariable("ranSliceProfileInstanceId") - - SliceTaskParamsAdapter sliceParams = - execution.getVariable("sliceParams") as SliceTaskParamsAdapter - SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo - AnSliceProfile anSliceProfile = sliceTaskInfo.sliceProfile - - String profileId = UUID.randomUUID().toString() - anSliceProfile.setSliceProfileId(profileId) - - SliceProfile sliceProfile = new SliceProfile() - sliceProfile.setProfileId(profileId) - sliceProfile.setCoverageAreaTAList(anSliceProfile.coverageAreaTAList as String) - //todo:... - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, - globalSubscriberId, - subscriptionServiceType, - sliceTaskInfo.serviceInstanceId, - profileId - ) - client.create(uri, sliceProfile) - execution.setVariable("sliceParams", sliceParams) - } - - /** - * prepare AllocateAnNssi - * @param execution - */ - void prepareAllocateAnNssi(DelegateExecution execution) { - - //todo: - SliceTaskParamsAdapter sliceParams = - execution.getVariable("sliceParams") as SliceTaskParamsAdapter - SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo - - NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest() - - AllocateAnNssi allocateAnNssi = new AllocateAnNssi() - allocateAnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID - allocateAnNssi.nssiId = sliceTaskInfo.NSSTInfo.UUID - allocateAnNssi.nssiName = sliceTaskInfo.NSSTInfo.name - allocateAnNssi.sliceProfile = sliceTaskInfo.sliceProfile - allocateAnNssi.nsiInfo.nsiId = sliceParams - - EsrInfo esrInfo = new EsrInfo() - //todo: vendor and network - esrInfo.setVendor(sliceTaskInfo.getVendor()) - esrInfo.setNetworkType(sliceTaskInfo.getNetworkType()) - - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - - //todo: service info - ServiceInfo serviceInfo = new ServiceInfo() - serviceInfo.globalSubscriberId = globalSubscriberId - serviceInfo.subscriptionServiceType = subscriptionServiceType - serviceInfo.nsiId = sliceParams.serviceId - serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID - serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID - - nbiRequest.setServiceInfo(serviceInfo) - nbiRequest.setEsrInfo(esrInfo) - nbiRequest.setAllocateAnNssi(allocateAnNssi) - - execution.setVariable("AnAllocateNssiNbiRequest", nbiRequest) - execution.setVariable("anBHSliceTaskInfo", sliceTaskInfo) - } - - - /** - * create RAN Slice Profile Instance - * @param execution - */ - void createCnSliceProfileInstance(DelegateExecution execution) { - - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - String serviceInstanceId = UUID.randomUUID().toString() - execution.setVariable("cnSliceProfileInstanceId", serviceInstanceId) //todo: - - String serviceType = "" - String serviceRole = "slice-profile" - String oStatus = "deactivated" - - SliceTaskParamsAdapter sliceParams = - execution.getVariable("sliceParams") as SliceTaskParamsAdapter - SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo - sliceTaskInfo.setServiceInstanceId(serviceInstanceId) - - // create slice profile - ServiceInstance rspi = new ServiceInstance() - rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name) - rspi.setServiceType(serviceType) - rspi.setServiceRole(serviceRole) - rspi.setOrchestrationStatus(oStatus) - rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID) - rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID) - rspi.setInputParameters(uuiRequest) - rspi.setWorkloadContext(useInterval) - rspi.setEnvironmentContext(sNSSAI_id) - - //timestamp format YYYY-MM-DD hh:mm:ss - rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault())) - - execution.setVariable("communicationServiceInstance", rspi) - - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, - subscriptionServiceType, - serviceInstanceId) - client.create(uri, rspi) - execution.setVariable("sliceParams", sliceParams) - } - - /** - * create An Slice Profile - * @param execution - */ - void createCnSliceProfile(DelegateExecution execution) { - - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - //String serviceInstanceId = execution.getVariable("ranSliceProfileInstanceId") - - SliceTaskParamsAdapter sliceParams = - execution.getVariable("sliceParams") as SliceTaskParamsAdapter - - SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo - CnSliceProfile cnSliceProfile = sliceTaskInfo.sliceProfile - - String profileId = UUID.randomUUID().toString() - cnSliceProfile.setSliceProfileId(profileId) - - SliceProfile sliceProfile = new SliceProfile() - sliceProfile.setProfileId(profileId) - sliceProfile.setCoverageAreaTAList(cnSliceProfile.coverageAreaTAList as String) - //todo:... - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, - globalSubscriberId, - subscriptionServiceType, - sliceTaskInfo.serviceInstanceId, - profileId - ) - client.create(uri, sliceProfile) - execution.setVariable("sliceParams", sliceParams) - } - - /** - * prepare AllocateCnNssi - * @param execution - */ - void prepareAllocateCnNssi(DelegateExecution execution) { - - //todo: - SliceTaskParamsAdapter sliceParams = - execution.getVariable("sliceParams") as SliceTaskParamsAdapter - SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo - - NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest() - - AllocateCnNssi allocateCnNssi = new AllocateCnNssi() - allocateCnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID - allocateCnNssi.nssiId = sliceTaskInfo.NSSTInfo.UUID - allocateCnNssi.nssiName = sliceTaskInfo.NSSTInfo.name - allocateCnNssi.sliceProfile = sliceTaskInfo.sliceProfile - allocateCnNssi.nsiInfo.nsiId = sliceParams - - EsrInfo esrInfo = new EsrInfo() - //todo: vendor and network - esrInfo.setVendor(sliceTaskInfo.getVendor()) - esrInfo.setNetworkType(sliceTaskInfo.getNetworkType()) - - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - - //todo: service info - ServiceInfo serviceInfo = new ServiceInfo() - serviceInfo.globalSubscriberId = globalSubscriberId - serviceInfo.subscriptionServiceType = subscriptionServiceType - serviceInfo.nsiId = sliceParams.serviceId - serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID - serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID - - nbiRequest.setServiceInfo(serviceInfo) - nbiRequest.setEsrInfo(esrInfo) - nbiRequest.setAllocateCnNssi(allocateCnNssi) - - execution.setVariable("CnAllocateNssiNbiRequest", nbiRequest) - execution.setVariable("cnSliceTaskInfo", sliceTaskInfo) - } - - - /** - * create TN Slice Profile Instance - * @param execution - */ - void createTnBHSliceProfileInstance(DelegateExecution execution) { - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - - String serviceType = "" - String serviceRole = "slice-profile" - String oStatus = "deactivated" - - SliceTaskParamsAdapter sliceParams = - execution.getVariable("sliceParams") as SliceTaskParamsAdapter - - SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo - String serviceInstanceId = UUID.randomUUID().toString() - - sliceTaskInfo.setServiceInstanceId(serviceInstanceId) - //execution.setVariable("cnSliceProfileInstanceId", serviceInstanceId) //todo: - - // create slice profile - ServiceInstance rspi = new ServiceInstance() - rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name) - rspi.setServiceType(serviceType) - rspi.setServiceRole(serviceRole) - rspi.setOrchestrationStatus(oStatus) - rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID) - rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID) - rspi.setInputParameters(uuiRequest) - rspi.setWorkloadContext(useInterval) - rspi.setEnvironmentContext(sNSSAI_id) - - //timestamp format YYYY-MM-DD hh:mm:ss - rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault())) - - execution.setVariable("communicationServiceInstance", rspi) - - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, - subscriptionServiceType, - serviceInstanceId) - client.create(uri, rspi) - - execution.setVariable("sliceParams", sliceParams) - } - - /** - * create An Slice Profile - * @param execution - */ - void createTnBHSliceProfile(DelegateExecution execution) { - - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - String serviceInstanceId = execution.getVariable("ranSliceProfileInstanceId") - - SliceTaskParamsAdapter sliceParams = - execution.getVariable("sliceParams") as SliceTaskParamsAdapter - - SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo - - TnSliceProfile tnSliceProfile = sliceTaskInfo.sliceProfile - String profileId = UUID.randomUUID().toString() - tnSliceProfile.setSliceProfileId(profileId) - - SliceProfile sliceProfile = new SliceProfile() - sliceProfile.setProfileId(profileId) - //todo:... - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, - globalSubscriberId, - subscriptionServiceType, - serviceInstanceId, - profileId - ) - client.create(uri, sliceProfile) - - execution.setVariable("sliceParams", sliceParams) - } - - /** - * prepare AllocateCnNssi - * @param execution - */ - void prepareAllocateTnBHNssi(DelegateExecution execution) { - - //todo: - SliceTaskParamsAdapter sliceParams = - execution.getVariable("sliceParams") as SliceTaskParamsAdapter - SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo - - NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest() - - AllocateTnNssi allocateTnNssi = new AllocateTnNssi() - //todo: AllocateTnNssi - //allocateTnNssi.networkSliceInfos - - EsrInfo esrInfo = new EsrInfo() - //todo: vendor and network - esrInfo.setVendor(sliceTaskInfo.getVendor()) - esrInfo.setNetworkType(sliceTaskInfo.getNetworkType()) - - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - - //todo: service info - ServiceInfo serviceInfo = new ServiceInfo() - serviceInfo.globalSubscriberId = globalSubscriberId - serviceInfo.subscriptionServiceType = subscriptionServiceType - serviceInfo.nsiId = sliceParams.serviceId - serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID - serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID - - nbiRequest.setServiceInfo(serviceInfo) - nbiRequest.setEsrInfo(esrInfo) - nbiRequest.setAllocateTnNssi(allocateTnNssi) - - execution.setVariable("TnBHAllocateNssiNbiRequest", nbiRequest) - execution.setVariable("tnBHSliceTaskInfo", sliceTaskInfo) - } - -}
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy index 88edd79d6d..88014e7b54 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy @@ -1,713 +1,172 @@ package org.onap.so.bpmn.infrastructure.scripts -import org.camunda.bpm.engine.delegate.BpmnError +import com.fasterxml.jackson.databind.ObjectMapper +import org.apache.commons.lang3.StringUtils import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.aai.domain.yang.ServiceInstance -import org.onap.aai.domain.yang.SliceProfile -import org.onap.so.beans.nsmf.AllocateAnNssi -import org.onap.so.beans.nsmf.AllocateCnNssi -import org.onap.so.beans.nsmf.AllocateTnNssi -import org.onap.so.beans.nsmf.AnSliceProfile -import org.onap.so.beans.nsmf.CnSliceProfile import org.onap.so.beans.nsmf.EsrInfo -import org.onap.so.beans.nsmf.JobStatusRequest -import org.onap.so.beans.nsmf.NetworkType -import org.onap.so.beans.nsmf.NsiInfo -import org.onap.so.beans.nsmf.NssiAllocateRequest -import org.onap.so.beans.nsmf.PerfReq -import org.onap.so.beans.nsmf.PerfReqEmbb -import org.onap.so.beans.nsmf.PerfReqUrllc -import org.onap.so.beans.nsmf.ResourceSharingLevel -import org.onap.so.beans.nsmf.SliceTaskParams -import org.onap.so.beans.nsmf.TnSliceProfile -import org.onap.so.beans.nsmf.UeMobilityLevel +import org.onap.so.beans.nsmf.NssiResponse +import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest +import org.onap.so.beans.nsmf.ResponseDescriptor +import org.onap.so.beans.nsmf.ServiceInfo +import org.onap.so.beans.nsmf.SliceTaskInfo +import org.onap.so.beans.nsmf.SliceTaskParamsAdapter +import org.onap.so.beans.nsmf.oof.SubnetType +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils -import org.onap.so.bpmn.core.RollbackData -import org.onap.so.bpmn.core.domain.ModelInfo -import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.aaiclient.client.aai.AAIObjectType -import org.onap.aaiclient.client.aai.AAIResourcesClient -import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory -import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.http.ResponseEntity -import static org.apache.commons.lang3.StringUtils.isBlank +class DoAllocateNSSI extends AbstractServiceTaskProcessor { -class DoAllocateNSSI extends org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor{ - - private static final Logger logger = LoggerFactory.getLogger( DoAllocateNSSI.class); - private static final ObjectMapper MAPPER = new ObjectMapper(); + private static final Logger logger = LoggerFactory.getLogger(DoAllocateNSSI.class); ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil) - - /** - * Pre Process the BPMN Flow Request - * Inclouds: - * generate the nsOperationKey - * generate the nsParameters - */ - void preProcessRequest (DelegateExecution execution) { - logger.trace("Enter preProcessRequest()") - String msg = "" - String nssmfOperation = "" - String msoRequestId = execution.getVariable("msoRequestId") - String nsstInput = execution.getVariable("nsstInput") - String modelUuid = jsonUtil.getJsonValue(nsstInput, "modelUuid") - //modelUuid="2763777c-27bd-4df7-93b8-c690e23f4d3f" - String nssiInstanceId = jsonUtil.getJsonValue(nsstInput, "serviceInstanceId") - String serviceModelInfo = """{ - "modelInvariantUuid":"", - "modelUuid":"${modelUuid}", - "modelVersion":"" - }""" - execution.setVariable("serviceModelInfo",serviceModelInfo) - execution.setVariable("nssiInstanceId",nssiInstanceId) - String nssiProfileID = UUID.randomUUID().toString() - execution.setVariable("nssiProfileID",nssiProfileID) - if(isBlank(nssiInstanceId)) - { - nssmfOperation="create" - nssiInstanceId = UUID.randomUUID().toString() - }else { - nssmfOperation = "update" - } - execution.setVariable("nssmfOperation",nssmfOperation) - execution.setVariable("nssiInstanceId",nssiInstanceId) - - def isDebugLogEnabled ="false" - def isNSSICreated = false - execution.setVariable("isNSSICreated",isNSSICreated) - - int currentCycle = 0 - execution.setVariable("currentCycle", currentCycle) + ObjectMapper objectMapper = new ObjectMapper() - logger.trace("Exit preProcessRequest") - } - - - void getNSSTInfo(DelegateExecution execution){ - logger.trace("Enter getNSSTInfo in DoAllocateNSSI()") - ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition") - ModelInfo modelInfo = serviceDecomposition.getModelInfo() - String serviceRole = "nssi" - String nssiServiceInvariantUuid = serviceDecomposition.modelInfo.getModelInvariantUuid() - String nssiServiceUuid = serviceDecomposition.modelInfo.getModelUuid() - String nssiServiceType = serviceDecomposition.getServiceType() - String uuiRequest = execution.getVariable("uuiRequest") - String nssiServiceName = "nssi_"+jsonUtil.getJsonValue(uuiRequest, "service.name") - execution.setVariable("nssiServiceName",nssiServiceName) - execution.setVariable("nssiServiceType",nssiServiceType) - execution.setVariable("nssiServiceInvariantUuid",nssiServiceInvariantUuid) - execution.setVariable("nssiServiceUuid",nssiServiceUuid) - execution.setVariable("serviceRole",serviceRole) - - String content = serviceDecomposition.getServiceInfo().getServiceArtifact().get(0).getContent() - String nsstID = jsonUtil.getJsonValue(content, "metadata.id") - String nsstVendor = jsonUtil.getJsonValue(content, "metadata.vendor") - String nsstDomain = jsonUtil.getJsonValue(content, "metadata.domainType") - String nsstType = jsonUtil.getJsonValue(content, "metadata.type") - - execution.setVariable("nsstID",nsstID) - execution.setVariable("nsstVendor",nsstVendor) - execution.setVariable("nsstDomain",nsstDomain) - execution.setVariable("nssiServiceUuid",nssiServiceUuid) - execution.setVariable("nsstType",nsstType) - - String nsstContentInfo = """{ - "NsstID":"${nsstID}", - "Vendor":"${nsstVendor}", - "type":"${nsstType}" - }""" - - logger.trace("Exit getNSSTInfo in DoAllocateNSSI()") - } - - void timeDelay(DelegateExecution execution) { - logger.trace("Enter timeDelay in DoAllocateNSSI()") - try { - Thread.sleep(60000); - int currentCycle = execution.getVariable("currentCycle") - currentCycle=currentCycle+1 - if(currentCycle>60) - { - logger.trace("Completed all the retry times... but still nssmf havent completed the creation process...") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "NSSMF creation didnt complete by time...") - } - execution.setVariable("currentCycle",currentCycle) - } catch(InterruptedException e) { - logger.info("Time Delay exception" + e) - } - logger.trace("Exit timeDelay in DoAllocateNSSI()") - } + private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil) + private static final NSSMF_ALLOCATE_URL = "/api/rest/provMns/v1/NSS/SliceProfiles" - void sendUpdateRequestNSSMF(DelegateExecution execution) { - logger.debug("Enter sendUpdateRequestNSSMF in DoAllocateNSSI()") - String domain = execution.getVariable("nsstDomain") - String nssmfRequest = buildUpdateNSSMFRequest(execution, domain.toUpperCase()) + private static final NSSMF_QUERY_JOB_STATUS_URL = "/NSS/jobs/%s" - String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles" + @Override + void preProcessRequest(DelegateExecution execution) { + logger.trace("Enter preProcessRequest()") - String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest) + NssmfAdapterNBIRequest nbiRequest = execution.getVariable("nbiRequest") as NssmfAdapterNBIRequest - if (nssmfResponse != null) { - execution.setVariable("nssmfResponse", nssmfResponse) - String nssiId = jsonUtil.getJsonValue(nssmfResponse, "nssiId") - String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId") - execution.setVariable("nssiId",nssiId) - execution.setVariable("jobId",jobId) + execution.setVariable("currentCycle", 0) + boolean isNSIOptionAvailable = execution.getVariable("isNSIOptionAvailable") as Boolean + if (!isNSIOptionAvailable) { + nbiRequest.serviceInfo.setActionType("allocate") + } else if (StringUtils.isBlank(nbiRequest.serviceInfo.nssiId)){ + nbiRequest.serviceInfo.setActionType("allocate") } else { - logger.error("received error message from NSSMF : "+ nssmfResponse) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.") + nbiRequest.serviceInfo.setActionType("modify") } - logger.trace("Exit sendUpdateRequestNSSMF in DoAllocateNSSI()") + execution.setVariable("nbiRequest", nbiRequest) + logger.trace("Exit preProcessRequest") } + /** + * send Create Request NSSMF + * @param execution + */ void sendCreateRequestNSSMF(DelegateExecution execution) { - logger.debug("Enter sendCreateRequestNSSMF in DoAllocateNSSI()") - //Prepare auth for NSSMF - Begin - String domain = execution.getVariable("nsstDomain") - String nssmfRequest = buildCreateNSSMFRequest(execution, domain.toUpperCase()) - - String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles" - - String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest) - - if (nssmfResponse != null) { - execution.setVariable("nssmfResponse", nssmfResponse) - String nssiId = jsonUtil.getJsonValue(nssmfResponse, "nssiId") - String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId") - execution.setVariable("nssiId",nssiId) - execution.setVariable("jobId",jobId) - - } else { - logger.error("received error message from NSSMF : "+ nssmfResponse) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.") - } - - logger.debug("Exit sendCreateRequestNSSMF in DoAllocateNSSI()") - } - - void getNSSMFProgresss(DelegateExecution execution) { - logger.debug("Enter getNSSMFProgresss in DoAllocateNSSI()") - - String nssmfRequest = buildNSSMFProgressRequest(execution) - String strUrl="/api/rest/provMns/v1/NSS/jobs/" + execution.getVariable("jobId") - - String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, strUrl, nssmfRequest) - - if(nssmfResponse != null){ - Boolean isNSSICreated = false - execution.setVariable("nssmfResponse", nssmfResponse) - Integer progress = Integer.parseInt(jsonUtil.getJsonValue(nssmfResponse, "responseDescriptor.progress")) - String status = jsonUtil.getJsonValue(nssmfResponse, "responseDescriptor.status") - String statusDescription = jsonUtil.getJsonValue(nssmfResponse, "responseDescriptor.statusDescription") - execution.setVariable("nssmfProgress",progress) - execution.setVariable("nssmfStatus",status) - execution.setVariable("nddmfStatusDescription",statusDescription) - if(progress > 99) - isNSSICreated = true - execution.setVariable("isNSSICreated",isNSSICreated) - } else { - logger.error("received error message from NSSMF : "+ nssmfResponse) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.") - } - logger.debug("Exit getNSSMFProgresss in DoAllocateNSSI()") - } - - void updateRelationship(DelegateExecution execution) { - logger.debug("Enter updateRelationship in DoAllocateNSSI()") - String nssiInstanceId = execution.getVariable("nssiInstanceId") - String nsiInstanceId = execution.getVariable("nsiServiceInstanceId") - try{ - AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nsiInstanceId); - AAIResourceUri nssiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiInstanceId) - getAAIClient().connect(nsiServiceuri, nssiServiceUri, AAIEdgeLabel.COMPOSED_OF); - }catch(Exception ex) { - String msg = "Exception in DoAllocateNSSI InstantiateNSSI service while creating relationship " + ex.getMessage() - logger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - logger.debug("Exit updateRelationship in DoAllocateNSSI()") + NssmfAdapterNBIRequest nbiRequest = execution.getVariable("nbiRequest") as NssmfAdapterNBIRequest + String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, NSSMF_ALLOCATE_URL, + objectMapper.writeValueAsString(nbiRequest)) + ResponseEntity responseEntity = objectMapper.readValue(response, ResponseEntity.class) + String respBody = responseEntity.getBody() + NssiResponse result = objectMapper.readValue(respBody, NssiResponse.class) + //todo: if success + //todo: + execution.setVariable("serviceInfo", nbiRequest.getServiceInfo()) + execution.setVariable("esrInfo", nbiRequest.getEsrInfo()) } + /** + * query nssi allocate status + * @param execution + */ + void queryNSSIStatus(DelegateExecution execution) { + NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest() + NssiResponse nssiAllocateResult = execution.getVariable("nssiAllocateResult") as NssiResponse + String jobId = nssiAllocateResult.getJobId() + String nssiId = nssiAllocateResult.getNssiId() - void instantiateNSSIService(DelegateExecution execution) { - logger.trace("Enter instantiateNSSIService in DoAllocateNSSI()") - //String nssiInstanceId = execution.getVariable("nssiInstanceId") - String nssiInstanceId = execution.getVariable("nssiId") - execution.setVariable("nssiInstanceId",nssiInstanceId) - String sliceInstanceId = execution.getVariable("nsiServiceInstanceId") - try { - org.onap.aai.domain.yang.ServiceInstance nssi = new ServiceInstance(); - Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile") - - nssi.setServiceInstanceId(nssiInstanceId) - nssi.setServiceInstanceName(execution.getVariable("nssiServiceName")) - //nssi.setServiceType(execution.getVariable("nssiServiceType")) - nssi.setServiceType(serviceProfileMap.get("sST").toString()) - String serviceStatus = "deactivated" - nssi.setOrchestrationStatus(serviceStatus) - String modelInvariantUuid = execution.getVariable("nssiServiceInvariantUuid") - String modelUuid = execution.getVariable("nssiServiceUuid") - nssi.setModelInvariantId(modelInvariantUuid) - nssi.setModelVersionId(modelUuid) - String uuiRequest = execution.getVariable("uuiRequest") - String serviceInstanceLocationid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.plmnIdList") - nssi.setServiceInstanceLocationId(serviceInstanceLocationid) - //String snssai = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.sNSSAI") - String envContext=execution.getVariable("nsstDomain") - nssi.setEnvironmentContext(envContext) - nssi.setServiceRole(execution.getVariable("serviceRole")) - AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), nssiInstanceId) - client.create(uri, nssi) - } catch (BpmnError e) { - throw e - } catch (Exception ex) { - String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage() - logger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - try{ - AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, sliceInstanceId); - AAIResourceUri nssiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiInstanceId) - getAAIClient().connect(nsiServiceuri, nssiServiceUri, AAIEdgeLabel.COMPOSED_OF); - }catch(Exception ex) { - String msg = "Exception in DoAllocateNSSI InstantiateNSSI service while creating relationship " + ex.getMessage() - logger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - + ServiceInfo serviceInfo = execution.getVariable("serviceInfo") as ServiceInfo + serviceInfo.setNssiId(nssiId) + EsrInfo esrInfo = execution.getVariable("esrInfo") as EsrInfo + //nbiRequest.setResponseId(jobId) + nbiRequest.setServiceInfo(serviceInfo) + nbiRequest.setEsrInfo(esrInfo) - def rollbackData = execution.getVariable("RollbackData") - if (rollbackData == null) { - rollbackData = new RollbackData(); - } - //rollbackData.put("SERVICEINSTANCE", "disableRollback", idisableRollback.toStrng()) - rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true") - rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", nssiInstanceId) - rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType")) - rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId")) - execution.setVariable("rollbackData", rollbackData) - execution.setVariable("RollbackData", rollbackData) - logger.debug("RollbackData:" + rollbackData) - logger.trace("Exit instantiateNSSIService in DoAllocateNSSI()") - } + String endpoint = String.format(NSSMF_QUERY_JOB_STATUS_URL, jobId) + String response = + nssmfAdapterUtils.sendPostRequestNSSMF(execution, endpoint, objectMapper.writeValueAsString(nbiRequest)) - void createSliceProfile(DelegateExecution execution) { - logger.trace("Enter createSliceProfile in DoAllocateNSSI()") - String sliceserviceInstanceId = execution.getVariable("nssiInstanceId") - String nssiProfileID = execution.getVariable("nssiProfileID") - Map<String, Object> sliceProfileMap = execution.getVariable("sliceProfileCn") - Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile") - SliceProfile sliceProfile = new SliceProfile() - sliceProfile.setServiceAreaDimension("") - sliceProfile.setPayloadSize(0) - sliceProfile.setJitter(0) - sliceProfile.setSurvivalTime(0) - //sliceProfile.setCsAvailability() - //sliceProfile.setReliability() - sliceProfile.setExpDataRate(0) - sliceProfile.setTrafficDensity(0) - sliceProfile.setConnDensity(0) - sliceProfile.setSNssai(sliceProfileMap.get("sNSSAI").toString()) - sliceProfile.setExpDataRateUL(Integer.parseInt(sliceProfileMap.get("expDataRateUL").toString())) - sliceProfile.setExpDataRateDL(Integer.parseInt(sliceProfileMap.get("expDataRateDL").toString())) - sliceProfile.setActivityFactor(Integer.parseInt(sliceProfileMap.get("activityFactor").toString())) - sliceProfile.setResourceSharingLevel(sliceProfileMap.get("activityFactor").toString()) - sliceProfile.setUeMobilityLevel(serviceProfileMap.get("uEMobilityLevel").toString()) - sliceProfile.setCoverageAreaTAList(serviceProfileMap.get("coverageAreaTAList").toString()) - sliceProfile.setMaxNumberOfUEs(Integer.parseInt(sliceProfileMap.get("activityFactor").toString())) - sliceProfile.setLatency(Integer.parseInt(sliceProfileMap.get("latency").toString())) - sliceProfile.setProfileId(nssiProfileID) - sliceProfile.setE2ELatency(0) + ResponseEntity responseEntity = objectMapper.readValue(response, ResponseEntity.class) + String result = responseEntity.getBody() + //todo;if success + ResponseDescriptor responseDescriptor = objectMapper.readValue(result, ResponseDescriptor.class) - try { - AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, - execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), sliceserviceInstanceId, nssiProfileID) - client.create(uri, sliceProfile) - } catch (BpmnError e) { - throw e - } catch (Exception ex) { - String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage() - logger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - - def rollbackData = execution.getVariable("RollbackData") - if (rollbackData == null) { - rollbackData = new RollbackData(); - } - //rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString()) - rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true") - rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", sliceserviceInstanceId) - rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("serviceType")) - rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId")) - execution.setVariable("rollbackData", rollbackData) - execution.setVariable("RollbackData", rollbackData) - logger.debug("RollbackData:" + rollbackData) - logger.trace("Exit createSliceProfile in DoAllocateNSSI()") + //todo: handle status + execution.setVariable("nssiAllocateResult", responseDescriptor) } + void prepareUpdateOrchestrationTask(DelegateExecution execution) { + logger.debug("Start prepareUpdateOrchestrationTask progress") + String requestMethod = "PUT" - String buildCreateNSSMFRequest(DelegateExecution execution, String domain) { - - NssiAllocateRequest request = new NssiAllocateRequest() - String strRequest = "" - //String uuiRequest = execution.getVariable("uuiRequest") - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") - - switch (domain) { - case "AN": - EsrInfo esrInfo = new EsrInfo() - esrInfo.setNetworkType(execution.getVariable("networkType")) - esrInfo.setVendor(execution.getVariable("nsstVendor")) - - NsiInfo nsiInfo = new NsiInfo() - nsiInfo.setNsiId(execution.getVariable("nsiInstanceID")) - nsiInfo.setNsiName(execution.getVariable("nsiInstanceName")) - - AnSliceProfile anSliceProfile = new AnSliceProfile() - anSliceProfile.setLatency(execution.getVariable("latency")) - anSliceProfile.setCoverageAreaTAList(execution.getVariable("coverageAreaList")) - anSliceProfile.setQi(execution.getVariable("qi")) - - AllocateAnNssi allocateAnNssi = new AllocateAnNssi() - allocateAnNssi.setNsstId(execution.getVariable("nsstId")) - allocateAnNssi.setNssiName(execution.getVariable("nssiName")) - allocateAnNssi.setNsiInfo(nsiInfo) - allocateAnNssi.setSliceProfile(anSliceProfile) - String anScriptName = sliceTaskParams.getAnScriptName() - allocateAnNssi.setScriptName(anScriptName) - - request.setAllocateAnNssi(allocateAnNssi) - request.setEsrInfo(esrInfo) - break; - case "CN": - Map<String, Object> sliceProfileCn =execution.getVariable("sliceProfileCn") - Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") - NsiInfo nsiInfo = new NsiInfo() - nsiInfo.setNsiId(execution.getVariable("nsiServiceInstanceId")) - nsiInfo.setNsiName(execution.getVariable("nsiServiceInstanceName")) - - EsrInfo esrInfo = new EsrInfo() - esrInfo.setNetworkType(NetworkType.fromString(domain)) - esrInfo.setVendor(execution.getVariable("nsstVendor")) - execution.setVariable("esrInfo",esrInfo) - - - PerfReqEmbb perfReqEmbb = new PerfReqEmbb() - perfReqEmbb.setActivityFactor(sliceProfileCn.get("activityFactor")) - perfReqEmbb.setAreaTrafficCapDL(sliceProfileCn.get("areaTrafficCapDL")) - perfReqEmbb.setAreaTrafficCapUL(sliceProfileCn.get("areaTrafficCapUL")) - perfReqEmbb.setExpDataRateDL(sliceProfileCn.get("expDataRateDL")) - perfReqEmbb.setExpDataRateUL(sliceProfileCn.get("expDataRateUL")) - - List<PerfReqEmbb> listPerfReqEmbbList = new ArrayList<>() - listPerfReqEmbbList.add(perfReqEmbb) - - PerfReq perfReq = new PerfReq() - perfReq.setPerfReqEmbbList(listPerfReqEmbbList) - - PerfReqUrllc perfReqUrllc = new PerfReqUrllc() - perfReqUrllc.setConnDensity(0) - perfReqUrllc.setTrafficDensity(0) - perfReqUrllc.setExpDataRate(0) - perfReqUrllc.setReliability(0) - perfReqUrllc.setCsAvailability(0) - perfReqUrllc.setSurvivalTime(0) - perfReqUrllc.setJitter(0) - perfReqUrllc.setE2eLatency(0) - perfReqUrllc.setPayloadSize("0") - perfReqUrllc.setServiceAreaDimension("") - - List<PerfReqUrllc> perfReqUrllcList = new ArrayList<>() - perfReqUrllcList.add(perfReqUrllc) - perfReq.setPerfReqUrllcList(perfReqUrllcList) - - CnSliceProfile cnSliceProfile = new CnSliceProfile() - cnSliceProfile.setSliceProfileId(execution.getVariable("nssiProfileID")) - String plmnStr = serviceProfile.get("plmnIdList") - List<String> plmnIdList=Arrays.asList(plmnStr.split("\\|")) - cnSliceProfile.setPlmnIdList(plmnIdList) - - String resourceSharingLevel = serviceProfile.get("resourceSharingLevel").toString() - cnSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(resourceSharingLevel)) - - String coverageArea = serviceProfile.get("coverageAreaTAList") - List<String> coverageAreaList=Arrays.asList(coverageArea.split("\\|")) - cnSliceProfile.setCoverageAreaTAList(coverageAreaList) - - String ueMobilityLevel = serviceProfile.get("uEMobilityLevel").toString() - cnSliceProfile.setUeMobilityLevel(UeMobilityLevel.fromString(ueMobilityLevel)) - - int latency = serviceProfile.get("latency") - cnSliceProfile.setLatency(latency) - - int maxUE = serviceProfile.get("maxNumberofUEs") - cnSliceProfile.setMaxNumberofUEs(maxUE) - - String snssai = serviceProfile.get("sNSSAI") - List<String> snssaiList = Arrays.asList(snssai.split("\\|")) - cnSliceProfile.setSnssaiList(snssaiList) - - cnSliceProfile.setPerfReq(perfReq) - - AllocateCnNssi allocateCnNssi = new AllocateCnNssi() - allocateCnNssi.setNsstId(execution.getVariable("nsstid")) - allocateCnNssi.setNssiName(execution.getVariable("nssiName")) - allocateCnNssi.setSliceProfile(cnSliceProfile) - allocateCnNssi.setNsiInfo(nsiInfo) - String cnScriptName = sliceTaskParams.getCnScriptName() - allocateCnNssi.setScriptName(cnScriptName) - request.setAllocateCnNssi(allocateCnNssi) - request.setEsrInfo(esrInfo) - break; - case "TN": - EsrInfo esrInfo = new EsrInfo() - esrInfo.setNetworkType(execution.getVariable("networkType")) - esrInfo.setVendor(execution.getVariable("vendor")) + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + ResponseDescriptor response = execution.getVariable("nssiAllocateResult") as ResponseDescriptor + SubnetType subnetType = execution.getVariable("subnetType") as SubnetType - TnSliceProfile tnSliceProfile = new TnSliceProfile() - tnSliceProfile.setLatency(execution.getVariable("latency")) - tnSliceProfile.setBandwidth(execution.getVariable("bandWidth")) - NsiInfo nsiInfo = new NsiInfo() - nsiInfo.setNsiId(execution.getVariable("nsiInstanceID")) - nsiInfo.setNsiName(execution.getVariable("nsiInstanceName")) + SliceTaskInfo sliceTaskInfo = execution.getVariable("sliceTaskInfo") as SliceTaskInfo + sliceTaskInfo.progress = response.getProgress() + sliceTaskInfo.status = response.getStatus() + sliceTaskInfo.statusDescription = response.getStatusDescription() + updateNssiResult(sliceParams, subnetType, sliceTaskInfo) - AllocateTnNssi allocateTnNssi = new AllocateTnNssi() - allocateTnNssi.setSliceProfile(tnSliceProfile) - allocateTnNssi.setNsiInfo(nsiInfo) - allocateTnNssi.setNsstId(execution.getVariable("nsstid")) - String tnScriptName = sliceTaskParams.getTnScriptName() - allocateTnNssi.setScriptName(tnScriptName) + String paramJson = sliceParams.convertToJson() + execution.setVariable("CSSOT_paramJson", paramJson) + execution.setVariable("CSSOT_requestMethod", requestMethod) - request.setAllocateTnNssi(allocateTnNssi) - request.setEsrInfo(esrInfo) - break; - default: - break; - } - try { - strRequest = MAPPER.writeValueAsString(request); - } catch (IOException e) { - logger.error("Invalid get progress request bean to convert as string"); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string") - } - return strRequest + execution.setVariable("sliceTaskParams", sliceParams) + execution.setVariable("sliceTaskInfo", sliceTaskInfo) + logger.debug("Finish prepareUpdateOrchestrationTask progress") } - - String buildUpdateNSSMFRequest(DelegateExecution execution, String domain) { - NssiAllocateRequest request = new NssiAllocateRequest() - String nsstInput = execution.getVariable("nsstInput") - String nssiId = jsonUtil.getJsonValue(nsstInput, "serviceInstanceId") - String strRequest = "" - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") - switch (domain) { - case "AN": - EsrInfo esrInfo = new EsrInfo() - esrInfo.setNetworkType(execution.getVariable("nsstType")) - esrInfo.setVendor(execution.getVariable("vendor")) - - NsiInfo nsiInfo = new NsiInfo() - nsiInfo.setNsiId(execution.getVariable("nsiInstanceID")) - nsiInfo.setNsiName(execution.getVariable("nsiInstanceName")) - - AnSliceProfile anSliceProfile = new AnSliceProfile() - anSliceProfile.setLatency(execution.getVariable("latency")) - anSliceProfile.setCoverageAreaTAList(execution.getVariable("coverageAreaList")) - anSliceProfile.setQi(execution.getVariable("qi")) - - AllocateAnNssi allocateAnNssi = new AllocateAnNssi() - allocateAnNssi.setNsstId(execution.getVariable("nsstId")) - allocateAnNssi.setNssiName(execution.getVariable("nssiName")) - allocateAnNssi.setNsiInfo(nsiInfo) - allocateAnNssi.setSliceProfile(anSliceProfile) - String anScriptName = sliceTaskParams.getAnScriptName() - allocateAnNssi.setScriptName(anScriptName) - request.setAllocateAnNssi(allocateAnNssi) - request.setEsrInfo(esrInfo) - break; - case "CN": - Map<String, Object> sliceProfileCn =execution.getVariable("sliceProfileCn") - Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") - NsiInfo nsiInfo = new NsiInfo() - nsiInfo.setNsiId(execution.getVariable("nsiServiceInstanceId")) - nsiInfo.setNsiName(execution.getVariable("nsiServiceInstanceName")) - - EsrInfo esrInfo = new EsrInfo() - esrInfo.setNetworkType(NetworkType.fromString(domain)) - esrInfo.setVendor(execution.getVariable("nsstVendor")) - execution.setVariable("esrInfo",esrInfo) - - - PerfReqEmbb perfReqEmbb = new PerfReqEmbb() - perfReqEmbb.setActivityFactor(sliceProfileCn.get("activityFactor")) - perfReqEmbb.setAreaTrafficCapDL(sliceProfileCn.get("areaTrafficCapDL")) - perfReqEmbb.setAreaTrafficCapUL(sliceProfileCn.get("areaTrafficCapUL")) - perfReqEmbb.setExpDataRateDL(sliceProfileCn.get("expDataRateDL")) - perfReqEmbb.setExpDataRateUL(sliceProfileCn.get("expDataRateUL")) - - List<PerfReqEmbb> listPerfReqEmbbList = new ArrayList<>() - listPerfReqEmbbList.add(perfReqEmbb) - - PerfReq perfReq = new PerfReq() - perfReq.setPerfReqEmbbList(listPerfReqEmbbList) - - PerfReqUrllc perfReqUrllc = new PerfReqUrllc() - perfReqUrllc.setConnDensity(0) - perfReqUrllc.setTrafficDensity(0) - perfReqUrllc.setExpDataRate(0) - perfReqUrllc.setReliability(0) - perfReqUrllc.setCsAvailability(0) - perfReqUrllc.setSurvivalTime(0) - perfReqUrllc.setJitter(0) - perfReqUrllc.setE2eLatency(0) - perfReqUrllc.setPayloadSize("0") - perfReqUrllc.setServiceAreaDimension("") - - List<PerfReqUrllc> perfReqUrllcList = new ArrayList<>() - perfReqUrllcList.add(perfReqUrllc) - perfReq.setPerfReqUrllcList(perfReqUrllcList) - - CnSliceProfile cnSliceProfile = new CnSliceProfile() - cnSliceProfile.setSliceProfileId(execution.getVariable("nssiProfileID")) - String plmnStr = serviceProfile.get("plmnIdList") - List<String> plmnIdList=Arrays.asList(plmnStr.split("\\|")) - cnSliceProfile.setPlmnIdList(plmnIdList) - - String resourceSharingLevel = serviceProfile.get("resourceSharingLevel").toString() - cnSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(resourceSharingLevel)) - - String coverageArea = serviceProfile.get("coverageAreaTAList") - List<String> coverageAreaList=Arrays.asList(coverageArea.split("\\|")) - cnSliceProfile.setCoverageAreaTAList(coverageAreaList) - - String ueMobilityLevel = serviceProfile.get("uEMobilityLevel").toString() - cnSliceProfile.setUeMobilityLevel(UeMobilityLevel.fromString(ueMobilityLevel)) - - int latency = serviceProfile.get("latency") - cnSliceProfile.setLatency(latency) - - int maxUE = serviceProfile.get("maxNumberofUEs") - cnSliceProfile.setMaxNumberofUEs(maxUE) - - String snssai = serviceProfile.get("sNSSAI") - List<String> snssaiList = Arrays.asList(snssai.split("\\|")) - cnSliceProfile.setSnssaiList(snssaiList) - - cnSliceProfile.setPerfReq(perfReq) - - AllocateCnNssi allocateCnNssi = new AllocateCnNssi() - allocateCnNssi.setNsstId(execution.getVariable("nsstid")) - allocateCnNssi.setNssiName(execution.getVariable("nssiName")) - allocateCnNssi.setSliceProfile(cnSliceProfile) - allocateCnNssi.setNsiInfo(nsiInfo) - allocateCnNssi.setNssiId(nssiId) // need to check this - String cnScriptName = sliceTaskParams.getCnScriptName() - allocateCnNssi.setScriptName(cnScriptName) - request.setAllocateCnNssi(allocateCnNssi) - request.setEsrInfo(esrInfo) - break; - case "TN": - EsrInfo esrInfo = new EsrInfo() - esrInfo.setNetworkType(execution.getVariable("networkType")) - esrInfo.setVendor(execution.getVariable("vendor")) - - TnSliceProfile tnSliceProfile = new TnSliceProfile() - tnSliceProfile.setLatency(execution.getVariable("latency")) - tnSliceProfile.setBandwidth(execution.getVariable("bandWidth")) - - NsiInfo nsiInfo = new NsiInfo() - nsiInfo.setNsiId(execution.getVariable("nsiInstanceID")) - nsiInfo.setNsiName(execution.getVariable("nsiInstanceName")) - - AllocateTnNssi allocateTnNssi = new AllocateTnNssi() - allocateTnNssi.setSliceProfile(tnSliceProfile) - allocateTnNssi.setNsiInfo(nsiInfo) - allocateTnNssi.setNsstId(execution.getVariable("nsstid")) - String tnScriptName = sliceTaskParams.getTnScriptName() - allocateTnNssi.setScriptName(tnScriptName) - request.setAllocateTnNssi(allocateTnNssi) - request.setEsrInfo(esrInfo) - break; - default: - break; - } - try { - strRequest = MAPPER.writeValueAsString(request); - } catch (IOException e) { - logger.error("Invalid get progress request bean to convert as string"); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string") + private void updateNssiResult(SliceTaskParamsAdapter sliceTaskParams, SubnetType subnetType, + SliceTaskInfo sliceTaskInfo) { + switch (subnetType) { + case SubnetType.CN: + sliceTaskParams.cnSliceTaskInfo = sliceTaskInfo + break + case SubnetType.AN_NF: + sliceTaskParams.anSliceTaskInfo = sliceTaskInfo + break + case SubnetType.TN_BH: + sliceTaskParams.tnBHSliceTaskInfo = sliceTaskInfo + break + case SubnetType.TN_FH: + sliceTaskParams.tnFHSliceTaskInfo = sliceTaskInfo + break + case SubnetType.TN_MH: + sliceTaskParams.tnMHSliceTaskInfo = sliceTaskInfo + break } - return strRequest } - String buildNSSMFProgressRequest(DelegateExecution execution){ - JobStatusRequest request = new JobStatusRequest() - String strRequest = "" - EsrInfo esrInfo = execution.getVariable("esrInfo") - request.setNsiId(execution.getVariable("nsiServiceInstanceId")) - request.setNssiId(execution.getVariable("nssiId")) - request.setEsrInfo(esrInfo) - + void timeDelay(DelegateExecution execution) { + logger.trace("Enter timeDelay in DoAllocateNSSI()") try { - strRequest = MAPPER.writeValueAsString(request); - } catch (IOException e) { - logger.error("Invalid get progress request bean to convert as string"); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string") - } - return strRequest - } - - public void prepareUpdateOrchestrationTask(DelegateExecution execution) { - logger.debug("Start prepareUpdateOrchestrationTask progress") - String requestMethod = "PUT" - String progress = execution.getVariable("nssmfProgress") - String status = execution.getVariable("nssmfStatus") - String statusDescription=execution.getVariable("nddmfStatusDescription") - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") - String domain = execution.getVariable("nsstDomain") - switch (domain.toUpperCase()) { - case "AN": - sliceTaskParams.setAnProgress(progress) - sliceTaskParams.setAnStatus(status) - sliceTaskParams.setAnStatusDescription(statusDescription) - break; - case "CN": - sliceTaskParams.setCnProgress(progress) - sliceTaskParams.setCnStatus(status) - sliceTaskParams.setCnStatusDescription(statusDescription) - break; - case "TN": - sliceTaskParams.setTnProgress(progress) - sliceTaskParams.setTnStatus(status) - sliceTaskParams.setTnStatusDescription(statusDescription) - break; - default: - break; + Thread.sleep(60000) + int currentCycle = execution.getVariable("currentCycle") as Integer + currentCycle = currentCycle + 1 + if(currentCycle > 60) + { + logger.trace("Completed all the retry times... but still nssmf havent completed the creation process...") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "NSSMF creation didnt complete by time...") + } + execution.setVariable("currentCycle", currentCycle) + } catch(InterruptedException e) { + logger.info("Time Delay exception" + e) } - String paramJson = sliceTaskParams.convertToJson() - execution.setVariable("CSSOT_paramJson", paramJson) - execution.setVariable("CSSOT_requestMethod", requestMethod) - logger.debug("Finish prepareUpdateOrchestrationTask progress") + logger.trace("Exit timeDelay in DoAllocateNSSI()") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSIV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSIV2.groovy deleted file mode 100644 index 05bb53a61e..0000000000 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSIV2.groovy +++ /dev/null @@ -1,117 +0,0 @@ -package org.onap.so.bpmn.infrastructure.scripts - -import com.fasterxml.jackson.databind.ObjectMapper -import org.apache.commons.lang3.StringUtils -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.beans.nsmf.SliceTaskInfo -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils -import org.onap.so.bpmn.core.domain.ModelInfo -import org.onap.so.bpmn.core.domain.ServiceDecomposition -import org.onap.so.bpmn.core.json.JsonUtils -import org.slf4j.Logger -import org.slf4j.LoggerFactory - -class DoAllocateNSSIV2 extends AbstractServiceTaskProcessor { - - private static final Logger logger = LoggerFactory.getLogger( DoAllocateNSSIV2.class); - private static final ObjectMapper MAPPER = new ObjectMapper(); - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - JsonUtils jsonUtil = new JsonUtils() - - private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil) - - @Override - void preProcessRequest(DelegateExecution execution) { - logger.trace("Enter preProcessRequest()") - -// String nssmfOperation -// -// String nsstInput = execution.getVariable("nsstInput") -// String modelUuid = jsonUtil.getJsonValue(nsstInput, "modelUuid") -// //modelUuid="2763777c-27bd-4df7-93b8-c690e23f4d3f" -// String nssiInstanceId = jsonUtil.getJsonValue(nsstInput, "serviceInstanceId") -// String serviceModelInfo = """{ -// "modelInvariantUuid":"", -// "modelUuid":"${modelUuid}", -// "modelVersion":"" -// }""" -// execution.setVariable("serviceModelInfo", serviceModelInfo) -// execution.setVariable("nssiInstanceId", nssiInstanceId) -// String nssiProfileID = UUID.randomUUID().toString() -// execution.setVariable("nssiProfileID", nssiProfileID) -// if(isBlank(nssiInstanceId)) -// { -// nssmfOperation="create" -// nssiInstanceId = UUID.randomUUID().toString() -// }else { -// nssmfOperation = "update" -// } -// execution.setVariable("nssmfOperation",nssmfOperation) -// execution.setVariable("nssiInstanceId",nssiInstanceId) -// -// def isNSSICreated = false -// execution.setVariable("isNSSICreated",isNSSICreated) -// -// int currentCycle = 0 -// execution.setVariable("currentCycle", currentCycle) - - - SliceTaskInfo sliceTaskInfo = execution.getVariable("sliceTaskInfo") as SliceTaskInfo - if (StringUtils.isBlank(sliceTaskInfo.suggestNssiId)) { - execution.setVariable("nssmfOperation", "create") - } else { - execution.setVariable("nssmfOperation", "update") - } - logger.trace("Exit preProcessRequest") - } - - /** - * prepare nssi request - * @param execution - */ - void prepareNSSIReq(DelegateExecution execution) { - - } - - void getNSSTInfo(DelegateExecution execution){ - logger.trace("Enter getNSSTInfo in DoAllocateNSSI()") - ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition") - ModelInfo modelInfo = serviceDecomposition.getModelInfo() - String serviceRole = "nssi" - String nssiServiceInvariantUuid = serviceDecomposition.modelInfo.getModelInvariantUuid() - String nssiServiceUuid = serviceDecomposition.modelInfo.getModelUuid() - String nssiServiceType = serviceDecomposition.getServiceType() - String uuiRequest = execution.getVariable("uuiRequest") - String nssiServiceName = "nssi_"+jsonUtil.getJsonValue(uuiRequest, "service.name") - execution.setVariable("nssiServiceName",nssiServiceName) - execution.setVariable("nssiServiceType",nssiServiceType) - execution.setVariable("nssiServiceInvariantUuid",nssiServiceInvariantUuid) - execution.setVariable("nssiServiceUuid",nssiServiceUuid) - execution.setVariable("serviceRole",serviceRole) - - String content = serviceDecomposition.getServiceInfo().getServiceArtifact().get(0).getContent() - String nsstID = jsonUtil.getJsonValue(content, "metadata.id") - String nsstVendor = jsonUtil.getJsonValue(content, "metadata.vendor") - String nsstDomain = jsonUtil.getJsonValue(content, "metadata.domainType") - String nsstType = jsonUtil.getJsonValue(content, "metadata.type") - - execution.setVariable("nsstID",nsstID) - execution.setVariable("nsstVendor",nsstVendor) - execution.setVariable("nsstDomain",nsstDomain) - execution.setVariable("nssiServiceUuid",nssiServiceUuid) - execution.setVariable("nsstType",nsstType) - - String nsstContentInfo = """{ - "NsstID":"${nsstID}", - "Vendor":"${nsstVendor}", - "type":"${nsstType}" - }""" - - logger.trace("Exit getNSSTInfo in DoAllocateNSSI()") - } - -} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy new file mode 100644 index 0000000000..e225c360ed --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy @@ -0,0 +1,1014 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Telecom Italia + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import com.fasterxml.jackson.databind.ObjectMapper +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.CloudRegion +import org.onap.aai.domain.yang.GenericVnf +import org.onap.aai.domain.yang.ModelVer +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.aai.domain.yang.ServiceSubscription +import org.onap.aai.domain.yang.SliceProfile +import org.onap.aai.domain.yang.Tenant +import org.onap.aai.domain.yang.VfModule +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.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.ONAPComponents +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.RequestDBUtil +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.HttpClient +import org.onap.so.db.request.beans.OperationStatus +import org.onap.so.requestsdb.RequestsDbConstant +import org.onap.so.serviceinstancebeans.CloudConfiguration +import org.onap.so.serviceinstancebeans.LineOfBusiness +import org.onap.so.serviceinstancebeans.ModelInfo +import org.onap.so.serviceinstancebeans.ModelType +import org.onap.so.serviceinstancebeans.OwningEntity +import org.onap.so.serviceinstancebeans.Project +import org.onap.so.serviceinstancebeans.RequestDetails +import org.onap.so.serviceinstancebeans.RequestInfo +import org.onap.so.serviceinstancebeans.RequestParameters +import org.onap.so.serviceinstancebeans.Resources +import org.onap.so.serviceinstancebeans.Service +import org.onap.so.serviceinstancebeans.SubscriberInfo +import org.onap.so.serviceinstancebeans.VfModules +import org.onap.so.serviceinstancebeans.Vnfs +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +import javax.ws.rs.core.Response + + + class DoCommonCoreNSSI extends AbstractServiceTaskProcessor { + + private final String PREFIX ="DoCommonCoreNSSI" + + private static final Logger LOGGER = LoggerFactory.getLogger( DoCommonCoreNSSI.class) + + private JsonUtils jsonUtil = new JsonUtils() + private ExceptionUtil exceptionUtil = new ExceptionUtil() + private RequestDBUtil requestDBUtil = new RequestDBUtil() + + @Override + void preProcessRequest(DelegateExecution execution) { + LOGGER.trace("${getPrefix()} Start preProcessRequest") + + def currentNSSI = execution.getVariable("currentNSSI") + if (!currentNSSI) { + String msg = "currentNSSI is null" + LOGGER.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + LOGGER.trace("***** ${getPrefix()} Exit preProcessRequest") + } + + + /** + * Queries Network Service Instance in AAI + * @param execution + */ + void getNetworkServiceInstance(DelegateExecution execution) { + LOGGER.trace("${getPrefix()} Start getNetworkServiceInstance") + + AAIResourcesClient client = getAAIClient() + + def currentNSSI = execution.getVariable("currentNSSI") + + String nssiId = currentNSSI['nssiId'] + + AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId)) + Optional<ServiceInstance> nssiOpt = client.get(ServiceInstance.class, nssiUri) + + if (nssiOpt.isPresent()) { + ServiceInstance nssi = nssiOpt.get() + currentNSSI['nssi'] = nssi + + ServiceInstance networkServiceInstance = handleNetworkInstance(execution, nssiId, nssiUri, client) + currentNSSI['networkServiceInstance'] = networkServiceInstance + } + else { + String msg = String.format("NSSI %s not found in AAI", nssiId) + LOGGER.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + + LOGGER.trace("${getPrefix()} Exit getNetworkServiceInstance") + } + + + /** + * Handles Network Service + * @param nssiId + * @param nssiUri + * @param client + * @return Network Service Instance + */ + private ServiceInstance handleNetworkInstance(DelegateExecution execution, String nssiId, AAIResourceUri nssiUri, AAIResourcesClient client ) { + ServiceInstance networkServiceInstance = null + + def currentNSSI = execution.getVariable("currentNSSI") + + AAIResultWrapper wrapper = client.get(nssiUri) + Optional<Relationships> relationships = wrapper.getRelationships() + + if (relationships.isPresent()) { + for (AAIResourceUri networkServiceInstanceUri : relationships.get().getRelatedUris(Types.SERVICE_INSTANCE)) { + Optional<ServiceInstance> networkServiceInstanceOpt = client.get(ServiceInstance.class, networkServiceInstanceUri) + if (networkServiceInstanceOpt.isPresent()) { + networkServiceInstance = networkServiceInstanceOpt.get() + + if (networkServiceInstance.getServiceRole() == "Network Service") { // Network Service role + currentNSSI['networkServiceInstanceUri'] = networkServiceInstanceUri + break + } + } + else { + String msg = String.format("No Network Service Instance found for NSSI %s in AAI", nssiId) + LOGGER.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + } + else { + String msg = String.format("No relationship presented for NSSI %s in AAI", nssiId) + LOGGER.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + + if(networkServiceInstance == null) { + String msg = String.format("No Network Service Instance found for NSSI %s in AAI", nssiId) + LOGGER.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + + return networkServiceInstance + } + + + /** + * Queries constitute VNF from Network Service Instance + * @param execution + */ + void getConstituteVNFFromNetworkServiceInst(DelegateExecution execution) { + LOGGER.trace("${getPrefix()} Start getConstituteVNFFromNetworkServiceInst") + + def currentNSSI = execution.getVariable("currentNSSI") + + AAIResourcesClient client = getAAIClient() + + AAIResourceUri networkServiceInstanceUri = (AAIResourceUri)currentNSSI['networkServiceInstanceUri'] + AAIResultWrapper wrapper = client.get(networkServiceInstanceUri); + Optional<Relationships> relationships = wrapper.getRelationships() + if (relationships.isPresent()) { + for (AAIResourceUri constituteVnfUri : relationships.get().getRelatedUris(Types.GENERIC_VNF)) { + currentNSSI['constituteVnfUri'] = constituteVnfUri + Optional<GenericVnf> constituteVnfOpt = client.get(GenericVnf.class, constituteVnfUri) + if(constituteVnfOpt.isPresent()) { + GenericVnf constituteVnf = constituteVnfOpt.get() + currentNSSI['constituteVnf'] = constituteVnf + } + else { + String msg = String.format("No constitute VNF found for Network Service Instance %s in AAI", ((ServiceInstance)currentNSSI['networkServiceInstance']).getServiceInstanceId()) + LOGGER.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + + break // Should be only one constitute VNF + } + } + else { + String msg = String.format("No relationship presented for Network Service Instance %s in AAI", ((ServiceInstance)currentNSSI['networkServiceInstance']).getServiceInstanceId()) + LOGGER.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + + LOGGER.trace("${getPrefix()} Exit getConstituteVNFFromNetworkServiceInst") + + } + + + /** + * Retrieves NSSI associated profiles from AAI + * @param execution + */ + void getNSSIAssociatedProfiles(DelegateExecution execution) { + LOGGER.trace("${getPrefix()} Start getNSSIAssociatedProfiles") + + def currentNSSI = execution.getVariable("currentNSSI") + + ServiceInstance nssi = (ServiceInstance)currentNSSI['nssi'] + + List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile() + + if(associatedProfiles.isEmpty()) { + String msg = String.format("No associated profiles found for NSSI %s in AAI", nssi.getServiceInstanceId()) + LOGGER.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + else { + currentNSSI['associatedProfiles'] = associatedProfiles + } + + LOGGER.trace("${getPrefix()} Exit getNSSIAssociatedProfiles") + } + + + /** + * Calculates a final list of S-NSSAI + * @param execution + */ + void calculateSNSSAI(DelegateExecution execution) { + LOGGER.trace("${getPrefix()} Start calculateSNSSAI") + + def currentNSSI = execution.getVariable("currentNSSI") + + List<SliceProfile> associatedProfiles = (List<SliceProfile>)currentNSSI['associatedProfiles'] + + String currentSNSSAI = currentNSSI['S-NSSAI'] + + List<String> snssais = new ArrayList<>() + + String isCreateSliceProfileInstanceVar = execution.getVariable("isCreateSliceProfileInstance" ) + + boolean isCreateSliceProfileInstance = Boolean.parseBoolean(isCreateSliceProfileInstanceVar) + + if(isCreateSliceProfileInstance) { // Slice Profile Instance has to be created + for (SliceProfile associatedProfile : associatedProfiles) { + snssais.add(associatedProfile.getSNssai()) + } + + snssais.add(currentSNSSAI) + } + else { // Slice profile instance has to be deleted + for (SliceProfile associatedProfile : associatedProfiles) { + if (!associatedProfile.getSNssai().equals(currentSNSSAI)) { // not current S-NSSAI + snssais.add(associatedProfile.getSNssai()) + } else { + currentNSSI['sliceProfileS-NSSAI'] = associatedProfile + } + } + } + + currentNSSI['S-NSSAIs'] = snssais + + LOGGER.trace("${getPrefix()} Exit calculateSNSSAI") + } + + + /** + * Invoke PUT Service Instance API + * @param execution + */ + void invokePUTServiceInstance(DelegateExecution execution) { + LOGGER.trace("${getPrefix()} Start invokePUTServiceInstance") + + def currentNSSI = execution.getVariable("currentNSSI") + + try { + //url:/onap/so/infra/serviceInstantiation/v7/serviceInstances/{serviceInstanceId}/vnfs/{vnfId}" + def nsmfЕndpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution) // ??? + + ServiceInstance networkServiceInstance = (ServiceInstance)currentNSSI['networkServiceInstance'] + + GenericVnf constituteVnf = (GenericVnf)currentNSSI['constituteVnf'] + + String url = String.format("${nsmfЕndpoint}/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s", networkServiceInstance.getServiceInstanceId(), constituteVnf.getVnfId()) + + String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution) + String basicAuth = UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution) + + def authHeader = "" + String basicAuthValue = encryptBasicAuth(basicAuth, msoKey) //utils.encrypt(basicAuth, msoKey) + String responseAuthHeader = getAuthHeader(execution, basicAuthValue, msoKey) //utils.getBasicAuth(basicAuthValue, msoKey) + + String errorCode = jsonUtil.getJsonValue(responseAuthHeader, "errorCode") + if(errorCode == null || errorCode.isEmpty()) { // No error + authHeader = responseAuthHeader + } + else { + exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(responseAuthHeader, "errorMessage")) + } + + def requestDetails = "" + String prepareRequestDetailsResponse = prepareRequestDetails(execution) + errorCode = jsonUtil.getJsonValue(prepareRequestDetailsResponse, "errorCode") + if(errorCode == null || errorCode.isEmpty()) { // No error + requestDetails = prepareRequestDetailsResponse + } + else { + exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(prepareRequestDetailsResponse, "errorMessage")) + } + + String callPUTServiceInstanceResponse = callPUTServiceInstance(url, authHeader, requestDetails) + String putServiceInstanceResponse = "" + + if(errorCode == null || errorCode.isEmpty()) { // No error + putServiceInstanceResponse = callPUTServiceInstanceResponse // check the response ??? + } + else { + LOGGER.error(jsonUtil.getJsonValue(callPUTServiceInstanceResponse, "errorMessage")) + exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(callPUTServiceInstanceResponse, "errorMessage")) + } + + } catch (any) { + String msg = "Exception in ${getPrefix()}.invokePUTServiceInstance. " + any.getCause() + LOGGER.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + LOGGER.trace("${getPrefix()} Exit invokePUTServiceInstance") + } + + + String callPUTServiceInstance(String url, String authHeader, String requestDetailsStr) { + String errorCode = "" + String errorMessage = "" + String response + + try { + HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.EXTERNAL) + httpClient.addAdditionalHeader("Authorization", authHeader) + httpClient.addAdditionalHeader("Accept", "application/json") + + Response httpResponse = httpClient.put(requestDetailsStr) // check http code ??? + + + if (httpResponse.hasEntity()) { + response = httpResponse.readEntity(String.class) + } + else { + errorCode = 500 + errorMessage = "No response received." + + response = "{\n" + + " \"errorCode\": \"${errorCode}\",\n" + + " \"errorMessage\": \"${errorMessage}\"\n" + + "}" + } + } + catch (any) { + String msg = "Exception in ${getPrefix()}.invokePUTServiceInstance. " + any.getCause() + LOGGER.error(msg) + + response = "{\n" + + " \"errorCode\": \"7000\",\n" + + " \"errorMessage\": \"${msg}\"\n" + + "}" + + } + + return response + + } + + + /** + * Prepare model info + * @param execution + * @param requestDetails + * @return ModelInfo + */ + ModelInfo prepareModelInfo(DelegateExecution execution) { + + def currentNSSI = execution.getVariable("currentNSSI") + ServiceInstance networkServiceInstance = (ServiceInstance)currentNSSI['networkServiceInstance'] + + ModelInfo modelInfo = new ModelInfo() + + modelInfo.setModelType(ModelType.service) + modelInfo.setModelInvariantId(networkServiceInstance.getModelInvariantId()) + + AAIResourcesClient client = getAAIClient() + + AAIResourceUri modelVerUrl = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation().model(networkServiceInstance.getModelInvariantId()).modelVer(networkServiceInstance.getModelVersionId())) + Optional<ModelVer> modelVerOpt = client.get(ModelVer.class, modelVerUrl) + + if (modelVerOpt.isPresent()) { + modelInfo.setModelVersionId(modelVerOpt.get().getModelVersionId()) + modelInfo.setModelName(modelVerOpt.get().getModelName()) + modelInfo.setModelVersion(modelVerOpt.get().getModelVersion()) + } + + return modelInfo + } + + + /** + * Prepares subscriber info + * @param execution + * @return SubscriberInfo + */ + SubscriberInfo prepareSubscriberInfo(DelegateExecution execution) { + def currentNSSI = execution.getVariable("currentNSSI") + + String globalSubscriberId = currentNSSI['globalSubscriberId'] + + String subscriberName = currentNSSI['subscriberName'] + + SubscriberInfo subscriberInfo = new SubscriberInfo() + subscriberInfo.setGlobalSubscriberId(globalSubscriberId) + subscriberInfo.setSubscriberName(subscriberName) + + /* + AAIResourcesClient client = getAAIClient() + + Customer customer = null + + AAIResourceUri networkServiceInstanceUri = currentNSSI['networkServiceInstanceUri'] + AAIResultWrapper wrapper = client.get(networkServiceInstanceUri) + Optional<Relationships> serviceSubscriptionRelationshipsOps = wrapper.getRelationships() + if(serviceSubscriptionRelationshipsOps.isPresent()) { + List<AAIResourceUri> serviceSubscriptionRelatedAAIUris = serviceSubscriptionRelationshipsOps.get().getRelatedUris(Types.SERVICE_SUBSCRIPTION) + if(!(serviceSubscriptionRelatedAAIUris == null || serviceSubscriptionRelatedAAIUris.isEmpty())) { + AAIResourceUri serviceSubscriptionUri = serviceSubscriptionRelatedAAIUris.get(0) // Many-To-One relation + Optional<ServiceSubscription> serviceSubscriptionOpt = client.get(ServiceSubscription.class, serviceSubscriptionUri) + + if(serviceSubscriptionOpt.isPresent()) { + currentNSSI['serviceSubscription'] = serviceSubscriptionOpt.get() + } + + wrapper = client.get(serviceSubscriptionUri) + Optional<Relationships> customerRelationshipsOps = wrapper.getRelationships() + if(customerRelationshipsOps.isPresent()) { + List<AAIResourceUri> customerRelatedAAIUris = customerRelationshipsOps.get().getRelatedUris(Types.CUSTOMER) + if(!(customerRelatedAAIUris == null || customerRelatedAAIUris.isEmpty())) { + Optional<Customer> customerOpt = client.get(Customer.class, customerRelatedAAIUris.get(0)) // Many-To-One relation + if(customerOpt.isPresent()) { + customer = customerOpt.get() + subscriberInfo.setSubscriberName(customer.getSubscriberName()) + } + } + } + } + + } */ + + return subscriberInfo + } + + + /** + * Prepares Request Info + * @param execution + * @return RequestInfo + */ + RequestInfo prepareRequestInfo(DelegateExecution execution, ServiceInstance networkServiceInstance) { + def currentNSSI = execution.getVariable("currentNSSI") + + String serviceId = currentNSSI['serviceId'] + + RequestInfo requestInfo = new RequestInfo() + + requestInfo.setInstanceName(networkServiceInstance.getServiceInstanceName()) + requestInfo.setSource("VID") + requestInfo.setProductFamilyId(serviceId) + requestInfo.setRequestorId("NBI") + + return requestInfo + } + + + /** + * Prepares Model Info + * @param networkServiceInstance + * @param modelInfo + * @return ModelInfo + */ + ModelInfo prepareServiceModelInfo(ServiceInstance networkServiceInstance, ModelInfo modelInfo) { + + ModelInfo serviceModelInfo = new ModelInfo() + serviceModelInfo.setModelType(ModelType.service) + serviceModelInfo.setModelInvariantId(networkServiceInstance.getModelInvariantId()) + + serviceModelInfo.setModelVersionId(modelInfo.getModelVersionId()) + serviceModelInfo.setModelName(modelInfo.getModelName()) + serviceModelInfo.setModelVersion(modelInfo.getModelVersion()) + + return serviceModelInfo + } + + + /** + * Prepares Cloud configuration + * @param execution + * @return CloudConfiguration + */ + CloudConfiguration prepareCloudConfiguration(DelegateExecution execution) { + def currentNSSI = execution.getVariable("currentNSSI") + + CloudConfiguration cloudConfiguration = new CloudConfiguration() + + AAIResourcesClient client = getAAIClient() + + AAIResourceUri constituteVnfUri = currentNSSI['constituteVnfUri'] + AAIResultWrapper wrapper = client.get(constituteVnfUri) + Optional<Relationships> cloudRegionRelationshipsOps = wrapper.getRelationships() + + if(cloudRegionRelationshipsOps.isPresent()) { + List<AAIResourceUri> cloudRegionRelatedAAIUris = cloudRegionRelationshipsOps.get().getRelatedUris(Types.CLOUD_REGION) + if (!(cloudRegionRelatedAAIUris == null || cloudRegionRelatedAAIUris.isEmpty())) { + AAIResourceUri cloudRegionRelatedAAIUri = cloudRegionRelatedAAIUris.get(0) + currentNSSI['cloudRegionRelatedAAIUri'] = cloudRegionRelatedAAIUri + + Optional<CloudRegion> cloudRegionrOpt = client.get(CloudRegion.class, cloudRegionRelatedAAIUris.get(0)) + CloudRegion cloudRegion = null + if (cloudRegionrOpt.isPresent()) { + cloudRegion = cloudRegionrOpt.get() + cloudConfiguration.setLcpCloudRegionId(cloudRegion.getCloudRegionId()) + for (Tenant tenant : cloudRegion.getTenants().getTenant()) { + cloudConfiguration.setTenantId(tenant.getTenantId()) + break // only one is required + } + + cloudConfiguration.setCloudOwner(cloudRegion.getCloudOwner()) + } + } + } + + return cloudConfiguration + } + + + /** + * Prepares a list of VF Modules + * @param execution + * @param constituteVnf + * @return List<VfModules> + */ + List<VfModules> prepareVfModules(DelegateExecution execution, GenericVnf constituteVnf) { + + AAIResourcesClient client = getAAIClient() + + List<VfModules> vfModuless = new ArrayList<>() + for (VfModule vfModule : constituteVnf.getVfModules().getVfModule()) { + VfModules vfmodules = new VfModules() + + ModelInfo vfModuleModelInfo = new ModelInfo() + vfModuleModelInfo.setModelInvariantUuid(vfModule.getModelInvariantId()) + vfModuleModelInfo.setModelCustomizationId(vfModule.getModelCustomizationId()) + + AAIResourceUri vfModuleUrl = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation().model(vfModule.getModelInvariantId()).modelVer(vfModule.getModelVersionId())) + + Optional<ModelVer> vfModuleModelVerOpt = client.get(ModelVer.class, vfModuleUrl) + + if (vfModuleModelVerOpt.isPresent()) { + vfModuleModelInfo.setModelVersionId(vfModuleModelVerOpt.get().getModelVersionId()) + vfModuleModelInfo.setModelName(vfModuleModelVerOpt.get().getModelName()) + vfModuleModelInfo.setModelVersion(vfModuleModelVerOpt.get().getModelVersion()) + } + vfmodules.setModelInfo(vfModuleModelInfo) + + vfmodules.setInstanceName(vfModule.getVfModuleName()) + + vfModuless.add(vfmodules) + } + + return vfModuless + } + + + /** + * prepares VNF Model Info + * @param execution + * @param constituteVnf + * @return ModelInfo + */ + ModelInfo prepareVNFModelInfo(DelegateExecution execution, GenericVnf constituteVnf) { + ModelInfo vnfModelInfo = new ModelInfo() + + AAIResourcesClient client = getAAIClient() + + vnfModelInfo.setModelInvariantUuid(constituteVnf.getModelInvariantId()) + vnfModelInfo.setModelCustomizationId(constituteVnf.getModelCustomizationId()) + vnfModelInfo.setModelInstanceName(constituteVnf.getVnfName()) + + AAIResourceUri vnfModelUrl = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation().model(constituteVnf.getModelInvariantId()).modelVer(constituteVnf.getModelVersionId())) + + Optional<ModelVer> vnfModelVerOpt = client.get(ModelVer.class, vnfModelUrl) + + if (vnfModelVerOpt.isPresent()) { + vnfModelInfo.setModelVersionId(vnfModelVerOpt.get().getModelVersionId()) + vnfModelInfo.setModelName(vnfModelVerOpt.get().getModelName()) + vnfModelInfo.setModelVersion(vnfModelVerOpt.get().getModelVersion()) + } + + return vnfModelInfo + } + + + List<Map<String, Object>> prepareInstanceParams(DelegateExecution execution) { + def currentNSSI = execution.getVariable("currentNSSI") + + List<Map<String, Object>> instanceParams = new ArrayList<>() + Map<String, Object> instanceParamsMap = new HashMap<>() + + // Supported S-NSSAI + List<String> snssais = (List<String>) currentNSSI['S-NSSAIs'] + + ServiceInstance nssi = (ServiceInstance) currentNSSI['nssi'] + + String orchStatus = nssi.getOrchestrationStatus() + + + List<Map<String, String>> snssaiList = new ArrayList<>() + + for(String snssai:snssais) { + Map<String, String> snssaisMap = new HashMap<>() + snssaisMap.put("snssai", snssai) + snssaisMap.put("status", orchStatus) + snssaiList.add(snssaisMap) + } + + // Map<String, List<Map<String, String>>> supportedNssaiDetails = new HashMap<>() + // supportedNssaiDetails.put("sNssai", supportedNssaiDetails) + + ObjectMapper mapper = new ObjectMapper() + + String supportedNssaiDetailsStr = mapper.writeValueAsString(snssaiList) + + + instanceParamsMap.put("k8s-rb-profile-name", "default") // ??? + instanceParamsMap.put("config-type", "day2") // ??? + instanceParamsMap.put("supportedNssai", supportedNssaiDetailsStr) + instanceParams.add(instanceParamsMap) + + return instanceParams + } + + /** + * Prepares Resources + * @param execution + * @return Resources + */ + Resources prepareResources(DelegateExecution execution) { + def currentNSSI = execution.getVariable("currentNSSI") + + Resources resources = new Resources() + + // VNFs + List<Vnfs> vnfs = new ArrayList<>() + // VNF + Vnfs vnf = new Vnfs() + + // Line of Business + LineOfBusiness lob = new LineOfBusiness() + lob.setLineOfBusinessName("VNF") + vnf.setLineOfBusiness(lob) + + // Product family ID + GenericVnf constituteVnf = (GenericVnf)currentNSSI['constituteVnf'] + vnf.setProductFamilyId(constituteVnf.getServiceId()) + + // Cloud configuration + vnf.setCloudConfiguration(prepareCloudConfiguration(execution)) + + // VF Modules + vnf.setVfModules(prepareVfModules(execution, constituteVnf)) + + // Model Info + vnf.setModelInfo(prepareVNFModelInfo(execution, constituteVnf)) + + // Instance name + vnf.setInstanceName(constituteVnf.getVnfName()) + + // Instance params + vnf.setInstanceParams(prepareInstanceParams(execution)) + + // No platform data + + vnfs.add(vnf) + resources.setVnfs(vnfs) + + return resources + } + + + /** + * Prepare Service + * @return Service + */ + Service prepareService(DelegateExecution execution, ServiceInstance networkServiceInstance, ModelInfo modelInfo) { + Service service = new Service() + + // Model Info + service.setModelInfo(prepareServiceModelInfo(networkServiceInstance, modelInfo)) + + service.setInstanceName(networkServiceInstance.getServiceInstanceName()) + + // Resources + service.setResources(prepareResources(execution)) + + return service + + } + + + /** + * Prepares request parameters + * @param execution + * @return RequestParameters + */ + RequestParameters prepareRequestParameters(DelegateExecution execution, ServiceInstance networkServiceInstance, ModelInfo modelInfo) { + def currentNSSI = execution.getVariable("currentNSSI") + + RequestParameters requestParameters = new RequestParameters() + + ServiceSubscription serviceSubscription = (ServiceSubscription)currentNSSI['serviceSubscription'] + + if(serviceSubscription != null) { + requestParameters.setSubscriptionServiceType(serviceSubscription.getServiceType()) + } + + // User params + List<Map<String, Object>> userParams = new ArrayList<>() + + Map<String, Object> userParam = new HashMap<>() + userParam.put("Homing_Solution", "none") + userParams.add(userParam) + + // Service + Map<String, Object> serviceMap = new HashMap<>() + serviceMap.put("service", prepareService(execution, networkServiceInstance, modelInfo)) + userParams.add(serviceMap) + requestParameters.setUserParams(userParams) + + return requestParameters + } + + + /** + * Prepare Owning Entity + * @param execution + * @return OwningEntity + */ + OwningEntity prepareOwningEntity(DelegateExecution execution) { + def currentNSSI = execution.getVariable("currentNSSI") + + AAIResourcesClient client = getAAIClient() + + AAIResourceUri networkServiceInstanceUri = (AAIResourceUri)currentNSSI['networkServiceInstanceUri'] + + OwningEntity owningEntity = new OwningEntity() + AAIResultWrapper wrapper = client.get(networkServiceInstanceUri) + Optional<Relationships> owningEntityRelationshipsOps = wrapper.getRelationships() + if (owningEntityRelationshipsOps.isPresent()) { + List<AAIResourceUri> owningEntityRelatedAAIUris = owningEntityRelationshipsOps.get().getRelatedUris(Types.OWNING_ENTITY) + + if (!(owningEntityRelatedAAIUris == null || owningEntityRelatedAAIUris.isEmpty())) { + Optional<org.onap.aai.domain.yang.OwningEntity> owningEntityOpt = client.get(org.onap.aai.domain.yang.OwningEntity.class, owningEntityRelatedAAIUris.get(0)) // Many-To-One relation + if (owningEntityOpt.isPresent()) { + owningEntity.setOwningEntityId(owningEntityOpt.get().getOwningEntityId()) + owningEntity.setOwningEntityName(owningEntityOpt.get().getOwningEntityName()) + + } + } + } + + return owningEntity + } + + + /** + * Prepares Project + * @param execution + * @return Project + */ + Project prepareProject(DelegateExecution execution) { + def currentNSSI = execution.getVariable("currentNSSI") + + AAIResourcesClient client = getAAIClient() + + Project project = new Project() + + AAIResourceUri cloudRegionRelatedAAIUri = (AAIResourceUri)currentNSSI['cloudRegionRelatedAAIUri'] + + if (cloudRegionRelatedAAIUri != null) { + AAIResultWrapper wrapper = client.get(cloudRegionRelatedAAIUri) + Optional<Relationships> cloudRegionOps = wrapper.getRelationships() + if (cloudRegionOps.isPresent()) { + List<AAIResourceUri> projectAAIUris = cloudRegionOps.get().getRelatedUris(Types.PROJECT) + if (!(projectAAIUris == null || projectAAIUris.isEmpty())) { + Optional<org.onap.aai.domain.yang.Project> projectOpt = client.get(org.onap.aai.domain.yang.Project.class, projectAAIUris.get(0)) + if (projectOpt.isPresent()) { + project.setProjectName(projectOpt.get().getProjectName()) + } + } + } + } + + return project + } + + + /** + * Prepares RequestDetails object + * @param execution + * @return + */ + String prepareRequestDetails(DelegateExecution execution) { + String errorCode = "" + String errorMessage = "" + String response + + RequestDetails requestDetails = new RequestDetails() + + def currentNSSI = execution.getVariable("currentNSSI") + + ServiceInstance networkServiceInstance = (ServiceInstance)currentNSSI['networkServiceInstance'] + + try { + // Model Info + ModelInfo modelInfo = prepareModelInfo(execution) + requestDetails.setModelInfo(modelInfo) + + // Subscriber Info + requestDetails.setSubscriberInfo(prepareSubscriberInfo(execution)) + + // Request Info + requestDetails.setRequestInfo(prepareRequestInfo(execution, networkServiceInstance)) + + // Request Parameters + requestDetails.setRequestParameters(prepareRequestParameters(execution, networkServiceInstance, modelInfo)) + + // Cloud configuration + requestDetails.setCloudConfiguration(prepareCloudConfiguration(execution)) + + // Owning entity + requestDetails.setOwningEntity(prepareOwningEntity(execution)) + + // Project + requestDetails.setProject(prepareProject(execution)) + + ObjectMapper mapper = new ObjectMapper() + + response = mapper.writeValueAsString(requestDetails) + } + catch (any) { + String msg = "Exception in ${getPrefix()}.prepareRequestDetails. " + any.getCause() + LOGGER.error(msg) + + response = "{\n" + + " \"errorCode\": \"7000\",\n" + + " \"errorMessage\": \"${msg}\"\n" + + "}" + + } + + return response + } + + + String getAuthHeader(DelegateExecution execution, String basicAuthValue, String msokey) { + String response = "" + String errorCode = "" + String errorMessage = "" + + LOGGER.debug("Obtained BasicAuth username and password for OOF: " + basicAuthValue) + try { + response = utils.getBasicAuth(basicAuthValue, msokey) + } catch (Exception ex) { + LOGGER.error("Unable to encode username and password string: ", ex) + + errorCode = "401" + errorMessage = "Internal Error - Unable to encode username and password string" + + response = "{\n" + + " \"errorCode\": \"${errorCode}\",\n" + + " \"errorMessage\": \"${errorMessage}\"\n" + + "}" + } + + return response + } + + + String encryptBasicAuth(String basicAuth, String msoKey) { + return utils.encrypt(basicAuth, msoKey) + } + + + /** + * Removes Slice Profile association with NSSI + * @param execution + */ + void removeSPAssociationWithNSSI(DelegateExecution execution) { + LOGGER.trace("${getPrefix()} Start removeSPAssociationWithNSSI") + + AAIResourcesClient client = getAAIClient() + + def currentNSSI = execution.getVariable("currentNSSI") + + ServiceInstance nssi = (ServiceInstance)currentNSSI['nssi'] + + String nssiId = currentNSSI['nssiId'] + AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId)) + + List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile() + + String currentSNSSAI = currentNSSI['S-NSSAI'] + + associatedProfiles.removeIf({ associatedProfile -> (associatedProfile.getSNssai().equals(currentSNSSAI)) }) + + try { + getAAIClient().update(nssiUri, nssi) + }catch(Exception e){ + exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile association with NSSI update call: " + e.getMessage()) + } + + LOGGER.trace("${getPrefix()} Exit removeSPAssociationWithNSSI") + } + + + /** + * Deletes Slice Profile Instance + * @param execution + */ + void deleteSliceProfileInstance(DelegateExecution execution) { + LOGGER.trace("${getPrefix()} Start deleteSliceProfileInstance") + + AAIResourcesClient client = getAAIClient() + + def currentNSSI = execution.getVariable("currentNSSI") + + SliceProfile sliceProfileContainsSNSSAI = (SliceProfile)currentNSSI['sliceProfileS-NSSAI'] + + String globalSubscriberId = currentNSSI['globalSubscriberId'] + String serviceType = currentNSSI['serviceType'] + String nssiId = currentNSSI['nssiId'] + + // global-customer-id, service-type, service-instance-id, profile-id + AAIResourceUri sliceProfileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiId).sliceProfile(sliceProfileContainsSNSSAI.getProfileId())) + + try { + getAAIClient().delete(sliceProfileUri) + }catch(Exception e){ + exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile Instance delete call: " + e.getMessage()) + } + + LOGGER.trace("${getPrefix()} Exit deleteSliceProfileInstance") + } + + + /** + * Updates operation status + * @param execution + */ + void updateServiceOperationStatus(DelegateExecution execution) { + LOGGER.trace("${getPrefix()} Start updateServiceOperationStatus") + + def currentNSSI = execution.getVariable("currentNSSI") + + OperationStatus operationStatus = new OperationStatus() + operationStatus.setServiceId(currentNSSI['e2eServiceInstanceId'] as String) + operationStatus.setOperationId(currentNSSI['operationId'] as String) + operationStatus.setOperation(currentNSSI['operationType'] as String) + operationStatus.setResult(RequestsDbConstant.Status.FINISHED) + + requestDBUtil.prepareUpdateOperationStatus(execution, operationStatus) + + LOGGER.trace("${getPrefix()} Exit updateServiceOperationStatus") + } + + + /** + * Returns AAI client + * @return AAI client + */ + AAIResourcesClient getAAIClient() { + return new AAIResourcesClient() + } + + + String getPrefix() { + return PREFIX + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy index 8cd9dee011..47e059c665 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy @@ -42,6 +42,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.slf4j.Logger import org.slf4j.LoggerFactory @@ -142,7 +144,7 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce String serviceType = execution.getVariable('serviceType') AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId)) AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationService.groovy index 7cdb084b7f..9f2ad5b537 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationService.groovy @@ -31,6 +31,8 @@ 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.slf4j.Logger import org.slf4j.LoggerFactory @@ -123,12 +125,7 @@ class DoCreateCommunicationService extends AbstractServiceTaskProcessor{ execution.setVariable("communicationServiceInstanceProfile", csp) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_SERVICE_PROFILE, - globalSubscriberId, - subscriptionServiceType, - serviceInstanceId, - profileId - ) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId).communicationServiceProfile(profileId)) client.create(uri, csp) @@ -188,7 +185,7 @@ class DoCreateCommunicationService extends AbstractServiceTaskProcessor{ execution.setVariable("communicationServiceInstance", csi) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, subscriptionServiceType, serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId)) client.create(uri, csi) } catch (BpmnError e) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index b90a34ea94..d1e61ac174 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -22,40 +22,36 @@ */ package org.onap.so.bpmn.infrastructure.scripts -import com.fasterxml.jackson.databind.ObjectMapper -import com.fasterxml.jackson.databind.SerializationFeature - -import org.onap.so.logger.LoggingAnchor -import org.onap.logging.filter.base.ErrorCode - import static org.apache.commons.lang3.StringUtils.* - import javax.ws.rs.NotFoundException - import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.Relationship import org.onap.aai.domain.yang.ServiceInstance +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.logging.filter.base.ErrorCode import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.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.so.bpmn.infrastructure.workflow.service.ServicePluginFactory -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory - import org.springframework.web.util.UriUtils -import org.onap.so.bpmn.core.UrnPropertiesReader +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.SerializationFeature /** * This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process. @@ -272,7 +268,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { org.onap.aai.domain.yang.ServiceInstance si = execution.getVariable("serviceInstanceData") AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("serviceType")).serviceInstance(serviceInstanceId)) client.create(uri, si) } catch (BpmnError e) { @@ -345,7 +341,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { try { String serviceInstanceId = execution.getVariable("serviceInstanceId") AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), serviceInstanceId).relationshipAPI() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("serviceType")).serviceInstance(serviceInstanceId)).relationshipAPI() client.create(uri, relationship) } catch (BpmnError e) { @@ -402,7 +398,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { String serviceType = execution.getVariable('subscriptionServiceType') AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId)) AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy index 3638d89faa..bb6697bfc9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy @@ -40,6 +40,8 @@ import org.onap.so.logger.MessageEnum import org.onap.so.bpmn.common.scripts.ExceptionUtil; 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.aai.AAIObjectType import org.onap.aaiclient.client.aai.AAIResourcesClient @@ -190,7 +192,7 @@ public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProce String serviceInstanceId = execution.getVariable("serviceInstanceId") AAIResourcesClient resourceClient = new AAIResourcesClient(); - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId) + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId)) resourceClient.delete(serviceInstanceUri) logger.trace("Completed Delete Service Instance") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy index 22e5819068..cc142ca36d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy @@ -33,7 +33,6 @@ import org.onap.aai.domain.yang.RouteTableReference import org.onap.aai.domain.yang.RouteTarget import org.onap.aai.domain.yang.Subnet import org.onap.aai.domain.yang.VpnBinding -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 @@ -42,6 +41,7 @@ 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.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor @@ -335,7 +335,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable('CRENWKI_serviceInstanceId') AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)) if(!resourceClient.exists(uri)){ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai") @@ -367,7 +367,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String networkName = utils.getNodeText(networkInputs, "network-name") AAIResourcesClient client = new AAIResourcesClient() - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Networks()).queryParam("network-name", networkName) L3Networks networks = client.get(uri, NotFoundException.class).asBean(L3Networks.class).get() L3Network network = networks.getL3Network().get(0) @@ -405,7 +405,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { // Prepare AA&I url AaiUtil aaiUtil = new AaiUtil(this) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion)) def queryCloudRegionRequest = aaiUtil.createAaiUri(uri) execution.setVariable(Prefix + "queryCloudRegionRequest", queryCloudRegionRequest) @@ -478,7 +478,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "networkName", networkName) AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ONE) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)).depth(Depth.ONE) L3Network network = client.get(uri, NotFoundException.class).asBean(L3Network.class).get() execution.setVariable(Prefix + "queryIdAAIResponse", network) @@ -514,7 +514,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String netId = networkId AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ONE) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)).depth(Depth.ONE) L3Network network = client.get(uri, NotFoundException.class).asBean(L3Network.class).get() execution.setVariable(Prefix + "aaiRequeryIdReturnCode", "200") @@ -553,10 +553,10 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { try { AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, execution.getVariable(Prefix + "networkId")) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(execution.getVariable(Prefix + "networkId"))) Optional<Relationships> relationships = client.get(uri, NotFoundException.class).getRelationships() if(relationships.isPresent()){ - List<AAIResourceUri> uris = relationships.get().getRelatedAAIUris(AAIObjectType.VPN_BINDING) + List<AAIResourceUri> uris = relationships.get().getRelatedUris(Types.VPN_BINDING) logger.debug(Prefix + "vpnCount - " + uris.size()) @@ -625,10 +625,10 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { try { AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, execution.getVariable(Prefix + "networkId")) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(execution.getVariable(Prefix + "networkId"))) Optional<Relationships> relationships = client.get(uri, NotFoundException.class).getRelationships() if(relationships.isPresent()){ - List<AAIResourceUri> uris = relationships.get().getRelatedAAIUris(AAIObjectType.NETWORK_POLICY) + List<AAIResourceUri> uris = relationships.get().getRelatedUris(Types.NETWORK_POLICY) execution.setVariable(Prefix + "networkPolicyCount", uris.size()) logger.debug(Prefix + "networkPolicyCount - " + uris.size()) @@ -692,10 +692,10 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { try { AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, execution.getVariable(Prefix + "networkId")) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(execution.getVariable(Prefix + "networkId"))) Optional<Relationships> relationships = client.get(uri, NotFoundException.class).getRelationships() if(relationships.isPresent()){ - List<AAIResourceUri> uris = relationships.get().getRelatedAAIUris(AAIObjectType.ROUTE_TABLE_REFERENCE) + List<AAIResourceUri> uris = relationships.get().getRelatedUris(Types.ROUTE_TABLE_REFERENCE) execution.setVariable(Prefix + "networkTableRefCount", uris.size()) logger.debug(Prefix + "networkTableRefCount - " + uris.size()) @@ -791,7 +791,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { logger.debug("Updating l3-network in AAI" ) AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)) client.update(uri, l3Network) if(requeryIdAAIResponse.getSubnets() != null){ @@ -807,7 +807,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } logger.debug("Updating subnet in AAI" ) - AAIResourceUri subUri = AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, networkId, subnetId) + AAIResourceUri subUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId).subnet(subnetId)) client.update(subUri, subnet) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy index fce12e56b0..94aca5f72f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy @@ -44,6 +44,8 @@ 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.slf4j.Logger import org.slf4j.LoggerFactory @@ -291,7 +293,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { String globalCustomerId = execution.getVariable("globalSubscriberId") //VID to AAI name map logger.debug(" ***** getAAICustomerById ***** globalCustomerId:" + globalCustomerId) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalCustomerId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustomerId)) if(!getAAIClient().exists(uri)){ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "GlobalCustomerId:" + globalCustomerId + " not found (404) in AAI") } @@ -352,7 +354,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { si.setWorkloadContext(workloadContext) AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(serviceInstanceId)) client.create(uri, si) } catch (BpmnError e) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy index b71379449e..f64f5e8ebf 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy @@ -1,32 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2020, CMCC Technologies Co., Ltd. + # + # Licensed under the Apache License, Version 2.0 (the "License") + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + * ============LICENSE_END========================================================= + */ package org.onap.so.bpmn.infrastructure.scripts -import org.onap.aai.domain.yang.AllottedResource - -import static org.apache.commons.lang3.StringUtils.*; - import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.aai.domain.yang.OwningEntity +import org.onap.aai.domain.yang.AllottedResource +import org.onap.aai.domain.yang.ServiceInstance import org.onap.aai.domain.yang.ServiceProfile; +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.so.beans.nsmf.SliceTaskParamsAdapter import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.common.scripts.CatalogDbUtils -import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.onap.so.bpmn.common.scripts.MsoUtils -import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.RollbackData -import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.ModelInfo import org.onap.so.bpmn.core.domain.ServiceDecomposition -import org.onap.so.bpmn.core.domain.ServiceInstance import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources -import org.onap.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.slf4j.Logger import org.slf4j.LoggerFactory @@ -34,13 +43,13 @@ import org.slf4j.LoggerFactory class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ - private static final Logger logger = LoggerFactory.getLogger( DoCreateSliceServiceInstance.class); + private static final Logger logger = LoggerFactory.getLogger( DoCreateSliceServiceInstance.class) + JsonUtils jsonUtil = new JsonUtils() ExceptionUtil exceptionUtil = new ExceptionUtil() - CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create() - + AAIResourcesClient client = getAAIClient() /** * Pre Process the BPMN Flow Request * Inclouds: @@ -48,86 +57,54 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ * generate the nsParameters */ void preProcessRequest (DelegateExecution execution) { - String msg = "" logger.trace("Enter preProcessRequest()") - //Need update - //1. Prepare service parameter. - //2. Prepare slice profile parameters. + //here modelVersion is not set, we use modelUuid to decompose the service. + def isDebugLogEnabled = true + execution.setVariable("isDebugLogEnabled", isDebugLogEnabled) + + logger.trace("Exit preProcessRequest") + } - String sliceserviceInstanceId = execution.getVariable("serviceInstanceId") - String allottedResourceId = UUID.randomUUID().toString() - execution.setVariable("sliceserviceInstanceId", sliceserviceInstanceId) - execution.setVariable("allottedResourceId", allottedResourceId) + /** + * prepare decompose service profile instance template + * @param execution + */ + public void prepareDecomposeService(DelegateExecution execution) { String uuiRequest = execution.getVariable("uuiRequest") String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid") String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid") - //here modelVersion is not set, we use modelUuid to decompose the service. - def isDebugLogEnabled = true - execution.setVariable("serviceInstanceId",sliceserviceInstanceId) - execution.setVariable("isDebugLogEnabled",isDebugLogEnabled) String serviceModelInfo = """{ "modelInvariantUuid":"${modelInvariantUuid}", "modelUuid":"${modelUuid}", "modelVersion":"" }""" execution.setVariable("serviceModelInfo", serviceModelInfo) - - logger.trace("Exit preProcessRequest") } + /** + * create service-profile instance in aai + * @param execution + */ + void createServiceProfileInstance(DelegateExecution execution) { - void createServiceProfile(DelegateExecution execution) { - - String sliceserviceInstanceId = execution.getVariable("sliceserviceInstanceId") - Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile") - String serviceProfileID = UUID.randomUUID().toString() - ServiceProfile serviceProfile = new ServiceProfile(); - serviceProfile.setProfileId(serviceProfileID) - serviceProfile.setLatency(Integer.parseInt(serviceProfileMap.get("latency").toString())) - serviceProfile.setMaxNumberOfUEs(Integer.parseInt(serviceProfileMap.get("maxNumberofUEs").toString())) - serviceProfile.setCoverageAreaTAList(serviceProfileMap.get("coverageAreaTAList").toString()) - serviceProfile.setUeMobilityLevel(serviceProfileMap.get("uEMobilityLevel").toString()) - serviceProfile.setResourceSharingLevel(serviceProfileMap.get("resourceSharingLevel").toString()) - serviceProfile.setExpDataRateUL(Integer.parseInt(serviceProfileMap.get("expDataRateUL").toString())) - serviceProfile.setExpDataRateDL(Integer.parseInt(serviceProfileMap.get("expDataRateDL").toString())) - serviceProfile.setAreaTrafficCapUL(Integer.parseInt(serviceProfileMap.get("areaTrafficCapUL").toString())) - serviceProfile.setAreaTrafficCapDL(Integer.parseInt(serviceProfileMap.get("areaTrafficCapDL").toString())) - serviceProfile.setActivityFactor(Integer.parseInt(serviceProfileMap.get("activityFactor").toString())) - - serviceProfile.setJitter(0) - serviceProfile.setSurvivalTime(0) - serviceProfile.setCsAvailability(new Object()) - serviceProfile.setReliability(new Object()) - serviceProfile.setExpDataRate(0) - serviceProfile.setTrafficDensity(0) - serviceProfile.setConnDensity(0) - try { - AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE, execution.getVariable("globalSubscriberId"), - execution.getVariable("subscriptionServiceType"), sliceserviceInstanceId, serviceProfileID) - client.create(uri, serviceProfile) - - } catch (BpmnError e) { - throw e - } catch (Exception ex) { - String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage() - logger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - } - - void instantiateSliceService(DelegateExecution execution) { + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter - ServiceDecomposition serviceDecomposition= execution.getVariable("sliceServiceDecomposition") - String uuiRequest = execution.getVariable("uuiRequest") + ServiceDecomposition serviceDecomposition = + execution.getVariable("serviceProfileDecomposition") as ServiceDecomposition ModelInfo modelInfo = serviceDecomposition.getModelInfo() - String serviceRole = "e2eslice-service" + //String serviceRole = "e2eslice-service" + /** + * todo: ServiceProfile params changed + * todo: role + */ + String serviceRole = "service-profile" String serviceType = execution.getVariable("serviceType") - Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") + Map<String, Object> serviceProfile = sliceParams.getServiceProfile() String ssInstanceId = execution.getVariable("serviceInstanceId") try { - org.onap.aai.domain.yang.ServiceInstance ss = new org.onap.aai.domain.yang.ServiceInstance() + ServiceInstance ss = new ServiceInstance() ss.setServiceInstanceId(ssInstanceId) String sliceInstanceName = execution.getVariable("serviceInstanceName") ss.setServiceInstanceName(sliceInstanceName) @@ -143,8 +120,8 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ String snssai = serviceProfile.get("sNSSAI") ss.setEnvironmentContext(snssai) ss.setServiceRole(serviceRole) - AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), ssInstanceId) + + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(ssInstanceId)) client.create(uri, ss) } catch (BpmnError e) { throw e @@ -157,7 +134,7 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ def rollbackData = execution.getVariable("RollbackData") if (rollbackData == null) { - rollbackData = new RollbackData(); + rollbackData = new RollbackData() } //rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString()) rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true") @@ -170,57 +147,96 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ } + /** + * create service profile in aai + * @param execution + */ + void createServiceProfile(DelegateExecution execution) { + + /** + * todo: ServiceProfile params changed + */ + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + Map<String, Object> serviceProfileMap = sliceParams.getServiceProfile() - void createAllottedResource(DelegateExecution execution) { - String serviceInstanceId = execution.getVariable('sliceserviceInstanceId') - - AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri ssServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) - -// try { -// -// if(resourceClient.exists(ssServiceuri)){ -// execution.setVariable("ssi_resourceLink", uri.build().toString()) -// }else{ -// exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai to " + -// "associate allotted resource for service :"+serviceInstanceId) -// } -// }catch(BpmnError e) { -// throw e; -// }catch (Exception ex){ -// String msg = "Exception in getServiceInstance. " + ex.getMessage() -// logger.debug(msg) -// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) -// } + String serviceProfileInstanceId = execution.getVariable("serviceInstanceId") + String serviceProfileId = UUID.randomUUID().toString() + sliceParams.serviceProfile.put("profileId", serviceProfileId) + + ServiceProfile serviceProfile = new ServiceProfile() + serviceProfile.setProfileId(serviceProfileId) + serviceProfile.setLatency(Integer.parseInt(serviceProfileMap.get("latency").toString())) + serviceProfile.setMaxNumberOfUEs(Integer.parseInt(serviceProfileMap.get("maxNumberofUEs").toString())) + serviceProfile.setCoverageAreaTAList(serviceProfileMap.get("coverageAreaTAList").toString()) + serviceProfile.setUeMobilityLevel(serviceProfileMap.get("uEMobilityLevel").toString()) + serviceProfile.setResourceSharingLevel(serviceProfileMap.get("resourceSharingLevel").toString()) + serviceProfile.setExpDataRateUL(Integer.parseInt(serviceProfileMap.get("expDataRateUL").toString())) + serviceProfile.setExpDataRateDL(Integer.parseInt(serviceProfileMap.get("expDataRateDL").toString())) + serviceProfile.setAreaTrafficCapUL(Integer.parseInt(serviceProfileMap.get("areaTrafficCapUL").toString())) + serviceProfile.setAreaTrafficCapDL(Integer.parseInt(serviceProfileMap.get("areaTrafficCapDL").toString())) + serviceProfile.setActivityFactor(Integer.parseInt(serviceProfileMap.get("activityFactor").toString())) + + serviceProfile.setJitter(0) + serviceProfile.setSurvivalTime("0") + serviceProfile.setCsAvailability(new Object()) + serviceProfile.setReliability("") + serviceProfile.setExpDataRate(0) + serviceProfile.setTrafficDensity(0) + serviceProfile.setConnDensity(0) + try { + AAIResourceUri uri = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")) + .serviceSubscription(execution.getVariable("subscriptionServiceType")) + .serviceInstance(serviceProfileInstanceId) + .serviceProfile(serviceProfileId)) + client.create(uri, serviceProfile) + execution.setVariable("sliceTaskParams", sliceParams) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + /** + * create allotted resource + * todo: unfinished + * @param execution + */ + public void createAllottedResource(DelegateExecution execution) { try { - String allottedResourceId = execution.getVariable("allottedResourceId") - ServiceDecomposition serviceDecomposition = execution.getVariable("sliceServiceDecomposition") + + ServiceDecomposition serviceDecomposition = + execution.getVariable("serviceProfileDecomposition") as ServiceDecomposition + List<org.onap.so.bpmn.core.domain.AllottedResource> allottedResourceList = serviceDecomposition.getAllottedResources() - for(org.onap.so.bpmn.core.domain.AllottedResource allottedResource : allottedResourceList) - { - //AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceFromParentURI(ssServiceuri, AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId) - AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, - execution.getVariable("globalSubscriberId"),execution.getVariable("subscriptionServiceType"), - execution.getVariable("sliceserviceInstanceId"), allottedResourceId) + for(org.onap.so.bpmn.core.domain.AllottedResource allottedResource : allottedResourceList) { + String allottedResourceId = UUID.randomUUID().toString() + + AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("serviceInstanceId")).allottedResource(allottedResourceId)) + execution.setVariable("allottedResourceUri", allottedResourceUri) String arType = allottedResource.getAllottedResourceType() String arRole = allottedResource.getAllottedResourceRole() String modelInvariantId = allottedResource.getModelInfo().getModelInvariantUuid() String modelVersionId = allottedResource.getModelInfo().getModelUuid() - org.onap.aai.domain.yang.AllottedResource resource = new org.onap.aai.domain.yang.AllottedResource() + AllottedResource resource = new AllottedResource() resource.setId(allottedResourceId) resource.setType(arType) resource.setAllottedResourceName("Allotted_"+ execution.getVariable("serviceInstanceName")) resource.setRole(arRole) resource.setModelInvariantId(modelInvariantId) resource.setModelVersionId(modelVersionId) - getAAIClient().create(allottedResourceUri, resource) - //AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath(ssServiceuri).build()) - //getAAIClient().connect(allottedResourceUri,ssServiceuri) + + client.create(allottedResourceUri, resource) + } - //execution.setVariable("aaiARPath", allottedResourceUri.build().toString()); }catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in createAaiAR " + ex.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy index 9b78afba03..079a31be94 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # Copyright (c) 2020, CMCC Technologies Co., Ltd. # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License. @@ -20,37 +20,34 @@ package org.onap.so.bpmn.infrastructure.scripts -import com.fasterxml.jackson.core.type.TypeReference import com.fasterxml.jackson.databind.ObjectMapper -import groovy.json.JsonSlurper import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.logging.filter.base.ONAPComponents -import org.onap.so.beans.nsmf.SliceTaskParams +import org.onap.so.beans.nsmf.AnSliceProfile +import org.onap.so.beans.nsmf.CnSliceProfile +import org.onap.so.beans.nsmf.EsrInfo +import org.onap.so.beans.nsmf.NetworkType +import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest +import org.onap.so.beans.nsmf.SliceTaskParamsAdapter +import org.onap.so.beans.nsmf.TnSliceProfile +import org.onap.so.beans.nsmf.oof.SubnetCapability +import org.onap.so.beans.nsmf.oof.SubnetType +import org.onap.so.beans.nsmf.oof.TemplateInfo import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils import org.onap.so.bpmn.common.scripts.OofUtils import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.domain.AllottedResource +import org.onap.so.bpmn.core.domain.ModelInfo import org.onap.so.bpmn.core.domain.ServiceDecomposition -import org.onap.so.bpmn.core.domain.ServiceProxy import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.HttpClient -import org.onap.so.client.HttpClientFactory -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.slf4j.Logger import org.slf4j.LoggerFactory - -import javax.ws.rs.NotFoundException -import javax.ws.rs.core.Response - -import static org.apache.commons.lang3.StringUtils.isBlank +import org.springframework.http.ResponseEntity class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ - private static final Logger logger = LoggerFactory.getLogger( DoCreateSliceServiceOption.class) + private static final Logger logger = LoggerFactory.getLogger(DoCreateSliceServiceOption.class) ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -58,426 +55,624 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ OofUtils oofUtils = new OofUtils() - ObjectMapper objectMapper = new ObjectMapper() + private static final ObjectMapper objectMapper = new ObjectMapper() + + private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil) + + private static final String QUERY_SUB_NET_CAPABILITY = "/api/rest/provMns/v1/NSS/subnetCapabilityQuery" + + private static final String QUERY_NSSI_SELECTION_CAPABILITY = "/api/rest/provMns/v1/NSS/NSSISelectionCapability" void preProcessRequest (DelegateExecution execution) { } + /** + * prepare the params for decompose nst + * @param execution + */ + public void prepareDecomposeNST(DelegateExecution execution) { - void prepareSelectNSIRequest(DelegateExecution execution) { + SliceTaskParamsAdapter sliceTaskParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter - String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) - logger.debug( "get NSI option OOF Url: " + urlString) - - boolean isNSISuggested = true - execution.setVariable("isNSISuggested",isNSISuggested) - String requestId = execution.getVariable("msoRequestId") - String messageType = "NSISelectionResponse" - - Map<String, Object> profileInfo = execution.getVariable("serviceProfile") - Map<String, Object> nstSolution = execution.getVariable("nstSolution") - logger.debug("Get NST selection from OOF: " + nstSolution.toString()) - String nstInfo = """{ - "modelInvariantId":"${nstSolution.invariantUUID}", - "modelVersionId":"${nstSolution.UUID}", - "modelName":"${nstSolution.NSTName}" - }""" - - execution.setVariable("nsiSelectionUrl", "/api/oof/selection/nsi/v1") - execution.setVariable("nsiSelection_messageType",messageType) - execution.setVariable("nsiSelection_correlator",requestId) - String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution); - execution.setVariable("nsiSelection_timeout",timeout) - String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo,messageType, profileInfo) - execution.setVariable("nsiSelection_oofRequest",oofRequest) - logger.debug("Sending request to OOF: " + oofRequest) - } + String modelUuid = sliceTaskParams.getNSTInfo().getUUID() + String modelInvariantUuid = sliceTaskParams.getNSTInfo().getInvariantUUID() - void processOOFResponse(Response httpResponse, DelegateExecution execution) { - int responseCode = httpResponse.getStatus() - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") - String OOFResponse = execution.getVariable("nsiSelection_oofResponse") - logger.debug("NSI OOFResponse is: " + OOFResponse) - execution.setVariable("OOFResponse", OOFResponse) - //This needs to be changed to derive a value when we add policy to decide the solution options. - Map OOFResponseObject = new JsonSlurper().parseText(OOFResponse) - Map solutions = OOFResponseObject.get("solutions") - - String resourceSharingLevel = execution.getVariable("resourceSharingLevel") - Boolean isSharable = resourceSharingLevel.equals("shared") - - if (solutions != null) { - if (isSharable && hasSharedNSIsolutions(solutions)) { - //sharedNSISolution - processSharedNSISolutions(solutions, execution) - } - else if(solutions.containsKey("newNSISolutions")) { - processNewNSISolutions(solutions, execution) - } - } - execution.setVariable("sliceTaskParams", sliceTaskParams) - logger.debug("sliceTaskParams: "+sliceTaskParams.convertToJson()) - logger.debug("*** Completed options Call to OOF ***") - //解析sliceProfile - logger.debug("start parseServiceProfile") - parseServiceProfile(execution) - logger.debug("end parseServiceProfile") + String serviceModelInfo = """{ + "modelInvariantUuid":"${modelInvariantUuid}", + "modelUuid":"${modelUuid}", + "modelVersion":"" + }""" + execution.setVariable("nstServiceModelInfo", serviceModelInfo) } - private boolean hasSharedNSIsolutions( Map solutions){ - if(solutions.containsKey("sharedNSISolutions")){ - List sharedNSIsolutions = solutions.get("sharedNSISolutions") - if (sharedNSIsolutions != null && !sharedNSIsolutions.isEmpty()) { - return true - } + /** + * process the result of NST Decomposition + * @param execution + */ + public void processDecompositionNST(DelegateExecution execution) { + + List<TemplateInfo> nsstInfos = new ArrayList<>() + ServiceDecomposition nstServiceDecomposition = + execution.getVariable("nstServiceDecomposition") as ServiceDecomposition + //todo: + List<AllottedResource> allottedResources = nstServiceDecomposition.getAllottedResources() + for (AllottedResource allottedResource : allottedResources) { + TemplateInfo nsstInfo = new TemplateInfo() + nsstInfo.setUUID(allottedResource.getProvidingServiceModelUuid()) + nsstInfo.setInvariantUUID(allottedResource.getProvidingServiceModelInvariantUuid()) + nsstInfo.setName(allottedResource.getProvidingServiceModelName()) + nsstInfos.add(nsstInfo) } - return false + execution.setVariable("nsstInfos", nsstInfos) + + execution.setVariable("maxNsstIndex", allottedResources.size() - 1) + execution.setVariable("currentNsstIndex", 0) + + List<ServiceDecomposition> nsstServiceDecompositions = new ArrayList<>() + execution.setVariable("nsstServiceDecompositions", nsstServiceDecompositions) } - private void processNewNSISolutions(Map solutions, DelegateExecution execution) { - int index = 0 - List<Map> newNSISolutions = solutions.get("newNSISolutions") - List<Map> NSSImap = new ArrayList<>() - if (newNSISolutions != null && newNSISolutions.size() > 0) { - NSSImap = newNSISolutions.get(index).get("NSSISolutions") as List<Map> - for (Map nssi : NSSImap) { - Map oofSliceProfile = nssi.get("sliceProfile") - String domain = oofSliceProfile.getOrDefault("domainType","") - logger.debug("OOF newNSISolutions SliceProfile: " +oofSliceProfile.toString()+",domain:${domain}") - if(null != domain){ - //TODO -// def nssiSolution = nssi.get("NSSISolution") as Map<String, ?> -// String nssiName = nssiSolution.getOrDefault("NSSIName", "") -// String nssiId = nssiSolution.getOrDefault("NSSIId", "") -// saveNSSIId(nssi, sliceTaskParams) - Map<String, Object> sliceProfile = getSliceProfile(domain, execution, oofSliceProfile) - saveSliceProfile(execution, domain, sliceProfile) - - } - } - } + /** + * prepare the params for decompose nsst + * @param execution + */ + public void prepareDecomposeNSST(DelegateExecution execution) { + + List<TemplateInfo> nsstInfos = execution.getVariable("nsstInfos") as List<TemplateInfo> + int index = execution.getVariable("currentNsstIndex") as Integer + + String modelUuid = nsstInfos.get(index).getUUID() + String modelInvariantUuid = nsstInfos.get(index).getInvariantUUID() + + String serviceModelInfo = """{ + "modelInvariantUuid":"${modelInvariantUuid}", + "modelUuid":"${modelUuid}", + "modelVersion":"" + }""" + execution.setVariable("nsstServiceModelInfo", serviceModelInfo) + } - private void processSharedNSISolutions(Map solutions, DelegateExecution execution) { - String nsiName, nsiInstanceId, nssiId, nssiName - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") - - Map sharedNSIsolution = ((List) solutions.get("sharedNSISolutions"))?.get(0) - nsiInstanceId = sharedNSIsolution.getOrDefault("NSIId", "") - nsiName = sharedNSIsolution.getOrDefault("NSIName", "") - sliceTaskParams.setSuggestNsiId(nsiInstanceId) - sliceTaskParams.setSuggestNsiName(nsiName) - - //Temporary modification - List NSSIs = sharedNSIsolution.get("NSSIs") - for(Map nssi : NSSIs){ - Map oofSliceProfile = ((List)nssi.get("sliceProfile"))?.get(0) - String domain = oofSliceProfile.getOrDefault("domainType","") - nssiId = nssi.getOrDefault("NSSIId","") - nssiName = nssi.getOrDefault("NSSIName","") - saveNSSIId(domain, nssiId, nssiName,execution) - Map<String, Object> sliceProfile = getSliceProfile(domain, execution, oofSliceProfile) - saveSliceProfile(execution, domain, sliceProfile) - logger.debug("OOF sharedNSISolution SliceProfile:"+oofSliceProfile.toString()+",domain:${domain}") - logger.debug("OOF sharedNSISolution nsiInstanceId:${nsiInstanceId}, nsiName:${nsiName}, nssiId:${nssiId}, nssiName:${nssiName}") + /** + * process the result of NSST Decomposition + * @param execution + */ + public void processDecompositionNSST(DelegateExecution execution) { + + List<ServiceDecomposition> nsstServiceDecompositions = + execution.getVariable("nsstServiceDecompositions") as List<ServiceDecomposition> + + ServiceDecomposition nsstServiceDecomposition = + execution.getVariable("nsstServiceDecomposition") as ServiceDecomposition + + nsstServiceDecompositions.add(nsstServiceDecomposition) + + execution.setVariable("nsstServiceDecompositions", nsstServiceDecompositions) + + + + + int num = execution.getVariable("maxNsstIndex") as Integer + int index = execution.getVariable("currentNsstIndex") as Integer + + execution.setVariable("currentNsstIndex", index + 1) + + if (index >= num) { + execution.setVariable("nsstHandleContinue", false) + } else { + execution.setVariable("nsstHandleContinue", true) } + } - private void parseServiceProfile(DelegateExecution execution) { - logger.debug("Start parseServiceProfile") - String serviceType = execution.getVariable("serviceType") - Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") - // set sliceProfile for three domains - if(!sliceTaskParams.getSliceProfileAn()){ - Map<String, Object> sliceProfileAn = getSliceProfile( "AN", execution,null) - saveSliceProfile(execution,"AN",sliceProfileAn) - } + /** + * set nsst info to sliceTaskParams by type + * @param execution + */ + public void handleNsstByType(DelegateExecution execution) { - if(!sliceTaskParams.getSliceProfileTn()){ - Map<String, Object> sliceProfileTn = getSliceProfile( "TN", execution,null) - saveSliceProfile(execution,"TN",sliceProfileTn) - } + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter - if(!sliceTaskParams.getSliceProfileCn()){ - Map<String, Object> sliceProfileCn = getSliceProfile( "CN", execution,null, ) - saveSliceProfile(execution,"CN",sliceProfileCn) + List<ServiceDecomposition> nsstServiceDecompositions = + execution.getVariable("nsstServiceDecompositions") as List<ServiceDecomposition> + + List<SubnetCapability> subnetCapabilities = new ArrayList<>() + + + + for (ServiceDecomposition serviceDecomposition : nsstServiceDecompositions) { + SubnetCapability subnetCapability = new SubnetCapability() + handleByType(execution, serviceDecomposition, sliceParams, subnetCapability) + subnetCapabilities.add(subnetCapability) } - logger.debug("Finish parseServiceProfile") + execution.setVariable("sliceTaskParams", sliceParams) + execution.setVariable("subnetCapabilities", subnetCapabilities) } - private void saveSliceProfile(DelegateExecution execution, String domain, Map<String, Object> sliceProfile){ - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") - if(domain.equalsIgnoreCase("AN")){ - execution.setVariable("sliceProfileAn", sliceProfile) - sliceTaskParams.setSliceProfileAn(sliceProfile) - logger.debug("sliceProfileAn: " + sliceProfile) + private void handleByType(DelegateExecution execution, ServiceDecomposition serviceDecomposition, + SliceTaskParamsAdapter sliceParams, SubnetCapability subnetCapability) { + //todo: + String domainType = "" + ModelInfo modelInfo = serviceDecomposition.getModelInfo() + String vendor = serviceDecomposition.getServiceRole() + SubnetType subnetType + + switch (domainType) { + case "tn_bh": + subnetType = SubnetType.TN_BH + sliceParams.tnBHSliceTaskInfo.vendor = vendor + sliceParams.tnBHSliceTaskInfo.subnetType = subnetType + sliceParams.tnBHSliceTaskInfo.networkType = subnetType.networkType + sliceParams.tnBHSliceTaskInfo.NSSTInfo.UUID = modelInfo.getModelUuid() + sliceParams.tnBHSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid() + sliceParams.tnBHSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName() + + break + case "tn_mh": + subnetType = SubnetType.TN_MH + sliceParams.tnMHSliceTaskInfo.vendor = vendor + sliceParams.tnMHSliceTaskInfo.subnetType = subnetType + sliceParams.tnMHSliceTaskInfo.networkType = subnetType.networkType + sliceParams.tnMHSliceTaskInfo.NSSTInfo.UUID = modelInfo.getModelUuid() + sliceParams.tnMHSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid() + sliceParams.tnMHSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName() + + break + case "an_nf": + subnetType = SubnetType.AN_NF + sliceParams.anSliceTaskInfo.vendor = vendor + sliceParams.anSliceTaskInfo.subnetType = subnetType + sliceParams.anSliceTaskInfo.networkType = subnetType.networkType + sliceParams.anSliceTaskInfo.NSSTInfo.UUID = modelInfo.getModelUuid() + sliceParams.anSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid() + sliceParams.anSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName() + break + case "cn": + subnetType = SubnetType.CN + sliceParams.cnSliceTaskInfo.vendor = vendor + sliceParams.cnSliceTaskInfo.subnetType = subnetType + sliceParams.cnSliceTaskInfo.networkType = subnetType.networkType + sliceParams.cnSliceTaskInfo.NSSTInfo.UUID = modelInfo.getModelUuid() + sliceParams.cnSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid() + sliceParams.cnSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName() + break + default: + subnetType = null + break + + //todo + } - else if(domain.equalsIgnoreCase("TN")){ - execution.setVariable("sliceProfileTn", sliceProfile) - sliceTaskParams.setSliceProfileTn(sliceProfile) - logger.debug("sliceProfileTn: " + sliceProfile) + if (subnetType == null) { + //todo: throw error + return } - else if(domain.equalsIgnoreCase("CN")){ - execution.setVariable("sliceProfileCn", sliceProfile) - sliceTaskParams.setSliceProfileCn(sliceProfile) - logger.debug("sliceProfileCn: " + sliceProfile) + String response = querySubnetCapability(execution, vendor, subnetType) + ResponseEntity responseEntity = objectMapper.readValue(response, ResponseEntity.class) + + Map<String, Object> result = responseEntity.getBody() as Map + for (Map.Entry<String, Object> entry : result.entrySet()) { + subnetCapability.setDomainType(entry.getKey()) + subnetCapability.setCapabilityDetails(entry.getValue()) } } - private void saveNSSIId(String domain, String nssiId, String nssiName, DelegateExecution execution) { - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") - if(domain.equalsIgnoreCase("AN")){ - sliceTaskParams.setAnSuggestNssiId(nssiId) - sliceTaskParams.setAnSuggestNssiName(nssiName) - } - else if(domain.equalsIgnoreCase("CN")){ - sliceTaskParams.setCnSuggestNssiId(nssiId) - sliceTaskParams.setCnSuggestNssiName(nssiName) - } - else if(domain.equalsIgnoreCase("TN")){ - sliceTaskParams.setTnSuggestNssiId(nssiId) - sliceTaskParams.setTnSuggestNssiName(nssiName) - } + /** + * query Subnet Capability of TN AN CN + * @param execution + */ + private String querySubnetCapability(DelegateExecution execution, String vendor, SubnetType subnetType) { + + String strRequest = objectMapper.writeValueAsString(buildQuerySubnetCapRequest(vendor, subnetType)) + + String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_SUB_NET_CAPABILITY, strRequest) + return response } - private Map getSliceProfile(String domain, DelegateExecution execution, Map<String, Object> oofSliceProfile) { - String profileMapStr - Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") - Integer domainLatency = (Integer) serviceProfile.get("latency")/3 - - if(domain.equalsIgnoreCase("AN")){ - profileMapStr = """ { - "latency": ${domainLatency}, - "sNSSAI": "sNSSAI", - "uEMobilityLevel": "uEMobilityLevel", - "coverageAreaTAList": "coverageAreaTAList", - "5QI": 100 - }""" - } - else if(domain.equalsIgnoreCase("TN")){ - profileMapStr =""" { - "latency":${domainLatency}, - "sNSSAI":"sNSSAI", - "e2eLatency":"latency", - "bandwidth": 100 - }""" - } - else if(domain.equalsIgnoreCase("CN")){ - profileMapStr = """ { - "areaTrafficCapDL":"areaTrafficCapDL", - "maxNumberofUEs":"maxNumberofUEs", - "latency":${domainLatency}, - "expDataRateUL":"expDataRateUL", - "sNSSAI":"sNSSAI", - "areaTrafficCapUL":"areaTrafficCapUL", - "uEMobilityLevel":"uEMobilityLevel", - "expDataRateDL":"expDataRateDL", - "activityFactor":"activityFactor", - "resourceSharingLevel":"resourceSharingLevel" - }""" - } + /** + * build request body for querying Subnet Capability + * @param vendor + * @param subnetTypes + * @param networkType + * @return + */ + private static String buildQuerySubnetCapRequest(String vendor, SubnetType subnetType) { + NssmfAdapterNBIRequest request = new NssmfAdapterNBIRequest() + + List<String> subnetTypes = new ArrayList<>() + subnetTypes.add(subnetType.subnetType) + Map<String, Object> paramMap = new HashMap() + paramMap.put("subnetTypes", subnetTypes) - logger.debug("Profile map for " + domain + " : " + profileMapStr) - Map<String, Object> profileMaps = objectMapper.readValue(profileMapStr.trim().replaceAll(" ", ""), new TypeReference<Map<String, String>>(){}) - Map<String, Object> sliceProfile = [:] - for (Map.Entry<String, String> profileMap : profileMaps) { - String key = profileMap.key - String value = profileMaps.get(key) - if(null != oofSliceProfile && oofSliceProfile.keySet().contains(key)){ - sliceProfile.put(key, oofSliceProfile.get(key)) - logger.debug("Get from oof, key:${key}, value: ${oofSliceProfile.get(key)}") + request.setSubnetCapabilityQuery(objectMapper.writeValueAsString(paramMap)) + + EsrInfo esrInfo = new EsrInfo() + esrInfo.setVendor(vendor) + esrInfo.setNetworkType(subnetType.networkType) + + request.setEsrInfo(esrInfo) + + String strRequest = objectMapper.writeValueAsString(request) + + return strRequest + } + + /** + * todo: need rewrite + * prepare select nsi request + * @param execution + */ + public void preNSIRequest(DelegateExecution execution) { + + String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) + logger.debug( "get NSI option OOF Url: " + urlString) + + + String requestId = execution.getVariable("msoRequestId") + String messageType = "NSISelectionResponse" + + execution.setVariable("nsiSelectionUrl", "/api/oof/selection/nsi/v1") + execution.setVariable("nsiSelection_messageType", messageType) + execution.setVariable("nsiSelection_correlator", requestId) + String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution) + execution.setVariable("nsiSelection_timeout", timeout) + + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + + Map<String, Object> profileInfo = sliceParams.getServiceProfile() + TemplateInfo nstInfo = sliceParams.getNSTInfo() + + List<TemplateInfo> nsstInfos = execution.getVariable("nsstInfos") as List<TemplateInfo> + + List<SubnetCapability> subnetCapabilities = + execution.getVariable("subnetCapabilities") as List<SubnetCapability> + + String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo, nsstInfos, + messageType, profileInfo, subnetCapabilities, timeout as Integer) + + execution.setVariable("nsiSelection_oofRequest", oofRequest) + logger.debug("Sending request to OOF: " + oofRequest) + } + + /** + * todo: need rewrite + * process select nsi response + * @param execution + */ + public void processNSIResp(DelegateExecution execution) { + + SliceTaskParamsAdapter sliceTaskParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + + String OOFResponse = execution.getVariable("nsiSelection_oofResponse") + logger.debug("NSI OOFResponse is: " + OOFResponse) + execution.setVariable("OOFResponse", OOFResponse) + //This needs to be changed to derive a value when we add policy to decide the solution options. + + Map<String, Object> resMap = objectMapper.readValue(OOFResponse, Map.class) + List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions") + Map<String, Object> solution = nsiSolutions.get(0) + + String resourceSharingLevel = execution.getVariable("resourceSharingLevel") + Boolean isSharable = resourceSharingLevel == "shared" + + if (solution != null) { + if (isSharable && solution.get("existingNSI")) { + //sharedNSISolution + processSharedNSI(solution, sliceTaskParams) } - else if(serviceProfile.keySet().contains(value)){ - sliceProfile.put(key, serviceProfile.get(value)) + else if(solution.containsKey("newNSISolution")) { + processNewNSI(solution, sliceTaskParams) } - else{ - sliceProfile.put(key, profileMaps.get(key)) + } + execution.setVariable("sliceTaskParams", sliceTaskParams) + //logger.debug("sliceTaskParams: " + sliceTaskParams.convertToJson()) + logger.debug("*** Completed options Call to OOF ***") + } + + private void processSharedNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) { + Map<String, Object> sharedNSISolution = solution.get("sharedNSISolution") as Map + + String nsiId = sharedNSISolution.get("NSIId") + String nsiName = sharedNSISolution.get("NSIName") + sliceParams.setSuggestNsiId(nsiId) + sliceParams.setSuggestNsiName(nsiName) + } + + private void processNewNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) { + Map<String, Object> newNSISolution = solution.get("newNSISolution") as Map + List<Map> sliceProfiles = newNSISolution.get("sliceProfiles") as List<Map> + for (Map sliceProfile : sliceProfiles) { + String domainType = sliceProfile.get("domainType") + switch (domainType.toLowerCase()) { + case "tn-bh": + sliceParams.tnBHSliceTaskInfo.sliceProfile = sliceProfile as TnSliceProfile + break + case "an-nf": + sliceParams.anSliceTaskInfo.sliceProfile = sliceProfile as AnSliceProfile + break + case "cn": + sliceParams.cnSliceTaskInfo.sliceProfile = sliceProfile as CnSliceProfile + break + default: + break } + + //todo + } - return sliceProfile } - void processDecomposition(DelegateExecution execution){ - logger.debug("Start processDecomposition") + /** + * get NSSI Selection Capability for AN + * @param execution + */ + public void getNSSISelectionCap4AN(DelegateExecution execution) { + + def vendor = execution.getVariable("vendor") as String + + String strRequest = buildNSSISelectionReq(vendor, NetworkType.ACCESS) + + String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_NSSI_SELECTION_CAPABILITY, strRequest) + + Map<String, Object> resMap = objectMapper.readValue(response, Map.class) + + String selection = resMap.get("selection") - ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition") - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") - String nstName = serviceDecomposition.getModelInfo().getModelName() - String nstId = serviceDecomposition.getModelInfo().getModelUuid() - sliceTaskParams.setNstName(nstName) - sliceTaskParams.setNstId(nstId) - logger.debug("End processDecomposition") + if ("NSMF".equalsIgnoreCase(selection)) { + execution.setVariable("NEED_AN_NSSI_SELECTION", true) + } } + /** + * get NSSI Selection Capability for TN + * @param execution + */ + public void getNSSISelectionCap4TN(DelegateExecution execution) { - void prepareNSTDecompose(DelegateExecution execution) { + def vendor = execution.getVariable("vendor") as String - String modelUuid = execution.getVariable("nstModelUuid") - String modelInvariantUuid = execution.getVariable("nstModelInvariantUuid") + String strRequest = buildNSSISelectionReq(vendor, NetworkType.TRANSPORT) - String serviceModelInfo = """{ - "modelInvariantUuid":"${modelInvariantUuid}", - "modelUuid":"${modelUuid}", - "modelVersion":"" - }""" - execution.setVariable("serviceModelInfo", serviceModelInfo) + String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_NSSI_SELECTION_CAPABILITY, strRequest) + + Map<String, Object> resMap = objectMapper.readValue(response, Map.class) + + String selection = resMap.get("selection") + + if ("NSMF".equalsIgnoreCase(selection)) { + execution.setVariable("NEED_TN_NSSI_SELECTION", true) + } } - void prepareNSSTDecompose(DelegateExecution execution) { - Boolean isMoreNSSTtoProcess = false - Integer maxNSST = execution.getVariable("maxNSST") - Integer currentNSST=execution.getVariable("currentNSST") - List<String> nsstModelUUIDList = new ArrayList<>() - nsstModelUUIDList = execution.getVariable("nsstModelUUIDList") - String modelUuid = nsstModelUUIDList.get(currentNSST) - String serviceModelInfo = """{ - "modelInvariantUuid":"", - "modelUuid":"${modelUuid}", - "modelVersion":"" - }""" - execution.setVariable("serviceModelInfo", serviceModelInfo) - currentNSST=currentNSST+1 - if(currentNSST<maxNSST) - isMoreNSSTtoProcess=true - execution.setVariable("isMoreNSSTtoProcess",isMoreNSSTtoProcess) - execution.setVariable("maxNSST",maxNSST) - execution.setVariable("currentNSST",currentNSST) + /** + * get NSSI Selection Capability for CN + * @param execution + */ + public void getNSSISelectionCap4CN(DelegateExecution execution) { + + def vendor = execution.getVariable("vendor") as String + + String strRequest = buildNSSISelectionReq(vendor, NetworkType.CORE) + + String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_NSSI_SELECTION_CAPABILITY, strRequest) + + Map<String, Object> resMap = objectMapper.readValue(response, Map.class) + + String selection = resMap.get("selection") + + if ("NSMF".equalsIgnoreCase(selection)) { + execution.setVariable("NEED_CN_NSSI_SELECTION", true) + } + } + + /** + * build NSSI Selection Capability Request body to nssmf adapter + * @param vendor + * @param networkType + * @return + */ + private static String buildNSSISelectionReq(String vendor, NetworkType networkType) { + NssmfAdapterNBIRequest request = new NssmfAdapterNBIRequest() + EsrInfo esrInfo = new EsrInfo() + esrInfo.setVendor(vendor) + esrInfo.setNetworkType(networkType) + request.setEsrInfo(esrInfo) + + return objectMapper.writeValueAsString(request) } + /** + * if exist nssi need to select? + * @param execution + */ + public void handleNssiSelect(DelegateExecution execution) { + + SliceTaskParamsAdapter sliceTaskParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + + //todo + boolean needCnNssiSelection = execution.getVariable("NEED_CN_NSSI_SELECTION") as Boolean + boolean needAnNssiSelection = execution.getVariable("NEED_AN_NSSI_SELECTION") as Boolean + boolean needTnNssiSelection = execution.getVariable("NEED_TN_NSSI_SELECTION") as Boolean + + /** + * [ + * { + * "subType": subtype, + * "nsstInfo": object, + * "sliceProfile": object + * }, + * { + * "subType": subtype, + * "nsstInfo": object, + * "sliceProfile": object + * } + * ] + */ + List<Map> nssiNeedHandlerInfos = new ArrayList<>() + Map<String, Object> nssiNeedHandlerMap = new HashMap() + + //List<TemplateInfo> nssiNeedHandlers = new ArrayList<>() + //List<Object> nssiProfileNeedHandlers = new ArrayList<>() + if (needCnNssiSelection) { + nssiNeedHandlerMap.put("subnetType", sliceTaskParams.cnSliceTaskInfo.subnetType) + nssiNeedHandlerMap.put("nsstInfo", sliceTaskParams.cnSliceTaskInfo.NSSTInfo) + nssiNeedHandlerMap.put("sliceProfile", sliceTaskParams.cnSliceTaskInfo.sliceProfile) + nssiNeedHandlerInfos.add(nssiNeedHandlerMap) + } + if (needAnNssiSelection) { + nssiNeedHandlerMap.clear() + nssiNeedHandlerMap.put("subnetType", sliceTaskParams.anSliceTaskInfo.subnetType) + nssiNeedHandlerMap.put("nsstInfo", sliceTaskParams.anSliceTaskInfo.NSSTInfo) + nssiNeedHandlerMap.put("sliceProfile", sliceTaskParams.anSliceTaskInfo.sliceProfile) + nssiNeedHandlerInfos.add(nssiNeedHandlerMap) + } + if (needTnNssiSelection) { + nssiNeedHandlerMap.clear() + nssiNeedHandlerMap.put("subnetType", sliceTaskParams.tnBHSliceTaskInfo.subnetType) + nssiNeedHandlerMap.put("nsstInfo", sliceTaskParams.tnBHSliceTaskInfo.NSSTInfo) + nssiNeedHandlerMap.put("sliceProfile", sliceTaskParams.tnBHSliceTaskInfo.sliceProfile) + nssiNeedHandlerInfos.add(nssiNeedHandlerMap) + + nssiNeedHandlerMap.clear() + nssiNeedHandlerMap.put("subnetType", sliceTaskParams.tnMHSliceTaskInfo.subnetType) + nssiNeedHandlerMap.put("nsstInfo", sliceTaskParams.tnMHSliceTaskInfo.NSSTInfo) + nssiNeedHandlerMap.put("sliceProfile", sliceTaskParams.tnMHSliceTaskInfo.sliceProfile) + nssiNeedHandlerInfos.add(nssiNeedHandlerMap) + + nssiNeedHandlerMap.clear() + nssiNeedHandlerMap.put("subnetType", sliceTaskParams.tnFHSliceTaskInfo.subnetType) + nssiNeedHandlerMap.put("nsstInfo", sliceTaskParams.tnFHSliceTaskInfo.NSSTInfo) + nssiNeedHandlerMap.put("sliceProfile", sliceTaskParams.tnFHSliceTaskInfo.sliceProfile) + nssiNeedHandlerInfos.add(nssiNeedHandlerMap) + + } - void prepareNSSTlistfromNST(DelegateExecution execution) { - //Need to update this part from decomposition. - logger.trace("Enter prepareNSSTlistfromNST()") - Boolean isMoreNSSTtoProcess = false - ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition") - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") - String nstName = serviceDecomposition.getModelInfo().getModelName() - sliceTaskParams.setNstName(nstName) - String nstId = serviceDecomposition.getModelInfo().getModelUuid() - sliceTaskParams.setNstId(nstId) - execution.setVariable("sliceTaskParams",sliceTaskParams) - - List<ServiceProxy> proxyList = serviceDecomposition.getServiceProxy() - List<String> nsstModelUUIDList = new ArrayList<>() - for(ServiceProxy serviceProxy:proxyList) - nsstModelUUIDList.add(serviceProxy.getSourceModelUuid()) - execution.setVariable("nsstModelUUIDList",nsstModelUUIDList) - Integer maxNSST = nsstModelUUIDList.size() - Integer currentNSST=0 - execution.setVariable("maxNSST",maxNSST) - execution.setVariable("currentNSST",currentNSST) - if(currentNSST<maxNSST) - isMoreNSSTtoProcess=true - execution.setVariable("isMoreNSSTtoProcess",isMoreNSSTtoProcess) - logger.trace("Exit prepareNSSTlistfromNST()") + if (nssiNeedHandlerInfos.size() > 0) { + execution.setVariable("needSelectNssi", true) + execution.setVariable("currNssiIndex", 0) + execution.setVariable("nssiNeedHandlerInfos", nssiNeedHandlerInfos) + } else { + execution.setVariable("needSelectNssi", false) + } + execution.setVariable("sliceTaskParams", sliceTaskParams) } - void getNSSTOption(DelegateExecution execution) { - ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition") + /** + * prepare select nssi request + * @param execution + */ + public void preNSSIRequest(DelegateExecution execution) { + + List<Map> nssiNeedHandlerInfos = + execution.getVariable("nssiNeedHandlerInfos") as List<Map> + + int currNssiIndex = execution.getVariable("currNssiIndex") as Integer + Map nssiNeedHandlerInfo = nssiNeedHandlerInfos.get(currNssiIndex) as Map + + TemplateInfo nsstInfo = nssiNeedHandlerInfo.get("nsstInfo") as TemplateInfo + Object profileInfo = nssiNeedHandlerInfo.get("sliceProfile") + String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String serviceType = execution.getVariable("subscriptionServiceType") - String nssiInstanceId ="" - String nssiName ="" - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") logger.debug( "get NSI option OOF Url: " + urlString) - boolean isNSISuggested = false - execution.setVariable("isNSISuggested",isNSISuggested) - - //Prepare auth for OOF - Begin - def authHeader = "" - String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution) - String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution) - - String basicAuthValue = utils.encrypt(basicAuth, msokey) - if (basicAuthValue != null) { - logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue) - try { - authHeader = utils.getBasicAuth(basicAuthValue, msokey) - execution.setVariable("BasicAuthHeaderValue", authHeader) - } catch (Exception ex) { - logger.debug( "Unable to encode username and password string: " + ex) - exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " + - "encode username and password string") - } - } else { - logger.debug( "Unable to obtain BasicAuth - BasicAuth value null") - exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " + - "value null") - } - //Prepare auth for OOF - End - //Prepare send request to OOF - Begin + String requestId = execution.getVariable("msoRequestId") - Map<String, Object> profileInfo = execution.getVariable("serviceProfile") - String nsstModelInvariantUuid = serviceDecomposition.getModelInfo().getModelInvariantUuid() - String nsstModelUuid = serviceDecomposition.getModelInfo().getModelUuid() - String nsstInfo = """"NSSTInfo": { - "invariantUUID":"${nsstModelInvariantUuid}", - "UUID":"${nsstModelUuid}" - }""" - String oofRequest = oofUtils.buildSelectNSSIRequest(execution, requestId, nsstInfo ,profileInfo) - - - URL url = new URL(urlString+"/api/oof/v1/selectnssi") - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF) - httpClient.addAdditionalHeader("Authorization", authHeader) - Response httpResponse = httpClient.post(oofRequest) - - int responseCode = httpResponse.getStatus() - logger.debug("OOF sync response code is: " + responseCode) - - if(responseCode != 200){ - exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.") + String messageType = "NSSISelectionResponse" + + execution.setVariable("nssiSelectionUrl", "/api/oof/selection/nssi/v1") + execution.setVariable("nssiSelection_messageType", messageType) + execution.setVariable("nssiSelection_correlator", requestId) + String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution) + execution.setVariable("nssiSelection_timeout", timeout) + + String oofRequest = oofUtils.buildSelectNSSIRequest(requestId, nsstInfo, messageType, + profileInfo, timeout as Integer) + + execution.setVariable("nssiSelection_oofRequest", oofRequest) + logger.debug("Sending request to OOF: " + oofRequest) + } + + /** + * process select nssi response + * @param execution + */ + public void processNSSIResp(DelegateExecution execution) { + + List<Map> nssiNeedHandlerInfos = + execution.getVariable("nssiNeedHandlerInfos") as List<Map> + + int currNssiIndex = execution.getVariable("currNssiIndex") as Integer + Map nssiNeedHandlerInfo = nssiNeedHandlerInfos.get(currNssiIndex) as Map + SubnetType subnetType = nssiNeedHandlerInfo.get("subnetType") as SubnetType + + SliceTaskParamsAdapter sliceTaskParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + + + String OOFResponse = execution.getVariable("nssiSelection_oofResponse") + logger.debug("NSI OOFResponse is: " + OOFResponse) + execution.setVariable("OOFResponse", OOFResponse) + //This needs to be changed to derive a value when we add policy to decide the solution options. + + Map<String, Object> resMap = objectMapper.readValue(OOFResponse, Map.class) + List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions") + Map<String, Object> solution = nsiSolutions.get(0) + + String resourceSharingLevel = execution.getVariable("resourceSharingLevel") + Boolean isSharable = resourceSharingLevel == "shared" //todo + + if (isSharable && solution != null) { + processNssiResult(sliceTaskParams, subnetType, solution) } - if(httpResponse.hasEntity()){ - String OOFResponse = httpResponse.readEntity(String.class) - execution.setVariable("OOFResponse", OOFResponse) - nssiInstanceId = jsonUtil.getJsonValue(OOFResponse, "NSSIIInfo.NSSIID") - nssiName = jsonUtil.getJsonValue(OOFResponse, "NSSIInfo.NSSIName") - execution.setVariable("nssiInstanceId",nssiInstanceId) - execution.setVariable("nssiName",nssiName) + execution.setVariable("sliceTaskParams", sliceTaskParams) + //logger.debug("sliceTaskParams: "+ sliceTaskParams.convertToJson()) + logger.debug("*** Completed options Call to OOF ***") + + logger.debug("start parseServiceProfile") + //parseServiceProfile(execution) + logger.debug("end parseServiceProfile") + + if (currNssiIndex >= nssiNeedHandlerInfos.size() - 1) { + execution.setVariable("needSelectNssi", false) + } else { + execution.setVariable("currNssiIndex", currNssiIndex + 1) + execution.setVariable("needSelectNssi", true) } - if(isBlank(nssiInstanceId)){ - logger.debug( "There is no valid NSST suggested by OOF.") - }else - { - try { - AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nssiInstanceId) - AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) - Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class) - org.onap.aai.domain.yang.ServiceInstance nssi = si.get() - - String domain = nssi.getEnvironmentContext().toString().toUpperCase() - switch (domain) { - case "AN": - sliceTaskParams.setAnSuggestNssiId(nssi.getServiceInstanceId()) - sliceTaskParams.setAnSuggestNssiName(nssi.getServiceInstanceName()) - break - case "CN": - sliceTaskParams.setCnSuggestNssiId(nssi.getServiceInstanceId()) - sliceTaskParams.setCnSuggestNssiName(nssi.getServiceInstanceName()) - break - case "TN": - sliceTaskParams.setTnSuggestNssiId(nssi.getServiceInstanceId()) - sliceTaskParams.setTnSuggestNssiName(nssi.getServiceInstanceName()) - break - default: - break - } - }catch(NotFoundException e) - { - logger.debug("NSSI Service Instance not found in AAI: " + nssiInstanceId) - }catch(Exception e) - { - logger.debug("NSSI Service Instance not found in AAI: " + nssiInstanceId) - } + + } + + private void processNssiResult(SliceTaskParamsAdapter sliceTaskParams, SubnetType subnetType, + Map<String, Object> solution) { + switch (subnetType) { + case SubnetType.CN: + sliceTaskParams.cnSliceTaskInfo.suggestNssiId = solution.get("NSSIId") + sliceTaskParams.cnSliceTaskInfo.suggestNssiName = solution.get("NSSIName") + break + case SubnetType.AN_NF: + sliceTaskParams.anSliceTaskInfo.suggestNssiId = solution.get("NSSIId") + sliceTaskParams.anSliceTaskInfo.suggestNssiName = solution.get("NSSIName") + break + case SubnetType.TN_BH: + sliceTaskParams.tnBHSliceTaskInfo.suggestNssiId = solution.get("NSSIId") + sliceTaskParams.tnBHSliceTaskInfo.suggestNssiName = solution.get("NSSIName") + break + case SubnetType.TN_FH: + sliceTaskParams.tnFHSliceTaskInfo.suggestNssiId = solution.get("NSSIId") + sliceTaskParams.tnFHSliceTaskInfo.suggestNssiName = solution.get("NSSIName") + break + case SubnetType.TN_MH: + sliceTaskParams.tnMHSliceTaskInfo.suggestNssiId = solution.get("NSSIId") + sliceTaskParams.tnMHSliceTaskInfo.suggestNssiName = solution.get("NSSIName") + break } - logger.debug("Prepare NSSI option completed ") } + } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOptionV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOptionV2.groovy deleted file mode 100644 index ca262172d0..0000000000 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOptionV2.groovy +++ /dev/null @@ -1,907 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - # Copyright (c) 2019, CMCC Technologies Co., Ltd. - # - # Licensed under the Apache License, Version 2.0 (the "License") - # you may not use this file except in compliance with the License. - # You may obtain a copy of the License at - # - # http://www.apache.org/licenses/LICENSE-2.0 - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - # See the License for the specific language governing permissions and - # limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.infrastructure.scripts - -import com.fasterxml.jackson.core.type.TypeReference -import com.fasterxml.jackson.databind.ObjectMapper -import org.apache.commons.lang3.StringUtils -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.aai.domain.yang.ServiceInstance -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.logging.filter.base.ONAPComponents -import org.onap.so.beans.nsmf.* -import org.onap.so.beans.nsmf.oof.SubnetCapability -import org.onap.so.beans.nsmf.oof.TemplateInfo -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils -import org.onap.so.bpmn.common.scripts.OofUtils -import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.bpmn.core.domain.ServiceDecomposition -import org.onap.so.bpmn.core.domain.ServiceProxy -import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.HttpClient -import org.onap.so.client.HttpClientFactory -import org.slf4j.Logger -import org.slf4j.LoggerFactory - -import javax.ws.rs.NotFoundException -import javax.ws.rs.core.Response - -class DoCreateSliceServiceOptionV2 extends AbstractServiceTaskProcessor{ - - private static final Logger logger = LoggerFactory.getLogger( DoCreateSliceServiceOptionV2.class) - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - JsonUtils jsonUtil = new JsonUtils() - - OofUtils oofUtils = new OofUtils() - - ObjectMapper objectMapper = new ObjectMapper() - - void preProcessRequest (DelegateExecution execution) { - } - - - /** - * prepare select nsi request - * @param execution - */ - void prepareSelectNSIRequest(DelegateExecution execution) { - - String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) - logger.debug( "get NSI option OOF Url: " + urlString) - - boolean isNSISuggested = true - execution.setVariable("isNSISuggested",isNSISuggested) - String requestId = execution.getVariable("msoRequestId") - String messageType = "NSISelectionResponse" - - Map<String, Object> profileInfo = execution.getVariable("serviceProfile") - Map<String, Object> nstSolution = execution.getVariable("nstSolution") - logger.debug("Get NST selection from OOF: " + nstSolution.toString()) - String nstInfo = """{ - "modelInvariantId":"${nstSolution.invariantUUID}", - "modelVersionId":"${nstSolution.UUID}", - "modelName":"${nstSolution.NSTName}" - }""" - - execution.setVariable("nsiSelectionUrl", "/api/oof/selection/nsi/v1") - execution.setVariable("nsiSelection_messageType",messageType) - execution.setVariable("nsiSelection_correlator",requestId) - String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution); - execution.setVariable("nsiSelection_timeout",timeout) - String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo,messageType, profileInfo) - execution.setVariable("nsiSelection_oofRequest",oofRequest) - logger.debug("Sending request to OOF: " + oofRequest) - } - - /** - * process select nsi response - * @param execution - */ - void processOOFResponse(DelegateExecution execution) { - - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") as SliceTaskParams - String OOFResponse = execution.getVariable("nsiSelection_oofResponse") - logger.debug("NSI OOFResponse is: " + OOFResponse) - execution.setVariable("OOFResponse", OOFResponse) - //This needs to be changed to derive a value when we add policy to decide the solution options. - - Map<String, Object> resMap = objectMapper.readValue(OOFResponse, Map.class) - List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions") - Map<String, Object> solutions = nsiSolutions.get(0) - - String resourceSharingLevel = execution.getVariable("resourceSharingLevel") - Boolean isSharable = resourceSharingLevel == "shared" - - if (solutions != null) { - if (isSharable && solutions.get("existingNSI")) { - //sharedNSISolution - processSharedNSISolutions(solutions, execution) - } - else if(solutions.containsKey("newNSISolution")) { - processNewNSISolutions(solutions, execution) - } - } - execution.setVariable("sliceTaskParams", sliceTaskParams) - logger.debug("sliceTaskParams: "+sliceTaskParams.convertToJson()) - logger.debug("*** Completed options Call to OOF ***") - - logger.debug("start parseServiceProfile") - parseServiceProfile(execution) - logger.debug("end parseServiceProfile") - } - - - private void processNewNSISolutions(Map solutions, DelegateExecution execution) { - int index = 0 - List<Map> newNSISolutions = solutions.get("newNSISolution") - List<Map> NSSImap = new ArrayList<>() - if (newNSISolutions != null && newNSISolutions.size() > 0) { - NSSImap = newNSISolutions.get(index).get("NSSISolutions") as List<Map> - for (Map nssi : NSSImap) { - Map oofSliceProfile = nssi.get("sliceProfile") - String domain = oofSliceProfile.getOrDefault("domainType","") - logger.debug("OOF newNSISolutions SliceProfile: " +oofSliceProfile.toString()+",domain:${domain}") - if(null != domain){ - //TODO -// def nssiSolution = nssi.get("NSSISolution") as Map<String, ?> -// String nssiName = nssiSolution.getOrDefault("NSSIName", "") -// String nssiId = nssiSolution.getOrDefault("NSSIId", "") -// saveNSSIId(nssi, sliceTaskParams) - Map<String, Object> sliceProfile = getSliceProfile(domain, execution, oofSliceProfile) - saveSliceProfile(execution, domain, sliceProfile) - - } - } - } - } - - private void processSharedNSISolutions(Map solutions, DelegateExecution execution) { - String nsiName, nsiInstanceId, nssiId, nssiName - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") - - Map sharedNSIsolution = ((List) solutions.get("sharedNSISolutions"))?.get(0) - nsiInstanceId = sharedNSIsolution.getOrDefault("NSIId", "") - nsiName = sharedNSIsolution.getOrDefault("NSIName", "") - sliceTaskParams.setSuggestNsiId(nsiInstanceId) - sliceTaskParams.setSuggestNsiName(nsiName) - - //Temporary modification - List NSSIs = sharedNSIsolution.get("NSSIs") - for(Map nssi : NSSIs){ - Map oofSliceProfile = ((List)nssi.get("sliceProfile"))?.get(0) - String domain = oofSliceProfile.getOrDefault("domainType","") - nssiId = nssi.getOrDefault("NSSIId","") - nssiName = nssi.getOrDefault("NSSIName","") - saveNSSIId(domain, nssiId, nssiName,execution) - Map<String, Object> sliceProfile = getSliceProfile(domain, execution, oofSliceProfile) - saveSliceProfile(execution, domain, sliceProfile) - logger.debug("OOF sharedNSISolution SliceProfile:"+oofSliceProfile.toString()+",domain:${domain}") - logger.debug("OOF sharedNSISolution nsiInstanceId:${nsiInstanceId}, nsiName:${nsiName}, nssiId:${nssiId}, nssiName:${nssiName}") - } - } - - private void parseServiceProfile(DelegateExecution execution) { - logger.debug("Start parseServiceProfile") - String serviceType = execution.getVariable("serviceType") - Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") - // set sliceProfile for three domains - if(!sliceTaskParams.getSliceProfileAn()){ - Map<String, Object> sliceProfileAn = getSliceProfile( "AN", execution,null) - saveSliceProfile(execution,"AN",sliceProfileAn) - } - - if(!sliceTaskParams.getSliceProfileTn()){ - Map<String, Object> sliceProfileTn = getSliceProfile( "TN", execution,null) - saveSliceProfile(execution,"TN",sliceProfileTn) - } - - if(!sliceTaskParams.getSliceProfileCn()){ - Map<String, Object> sliceProfileCn = getSliceProfile( "CN", execution,null, ) - saveSliceProfile(execution,"CN",sliceProfileCn) - } - - logger.debug("Finish parseServiceProfile") - } - - private void saveSliceProfile(DelegateExecution execution, String domain, Map<String, Object> sliceProfile){ - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") - if(domain.equalsIgnoreCase("AN")){ - execution.setVariable("sliceProfileAn", sliceProfile) - sliceTaskParams.setSliceProfileAn(sliceProfile) - logger.debug("sliceProfileAn: " + sliceProfile) - } - else if(domain.equalsIgnoreCase("TN")){ - execution.setVariable("sliceProfileTn", sliceProfile) - sliceTaskParams.setSliceProfileTn(sliceProfile) - logger.debug("sliceProfileTn: " + sliceProfile) - } - else if(domain.equalsIgnoreCase("CN")){ - execution.setVariable("sliceProfileCn", sliceProfile) - sliceTaskParams.setSliceProfileCn(sliceProfile) - logger.debug("sliceProfileCn: " + sliceProfile) - } - } - - private void saveNSSIId(String domain, String nssiId, String nssiName, DelegateExecution execution) { - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") - if(domain.equalsIgnoreCase("AN")){ - sliceTaskParams.setAnSuggestNssiId(nssiId) - sliceTaskParams.setAnSuggestNssiName(nssiName) - } - else if(domain.equalsIgnoreCase("CN")){ - sliceTaskParams.setCnSuggestNssiId(nssiId) - sliceTaskParams.setCnSuggestNssiName(nssiName) - } - else if(domain.equalsIgnoreCase("TN")){ - sliceTaskParams.setTnSuggestNssiId(nssiId) - sliceTaskParams.setTnSuggestNssiName(nssiName) - } - } - - private Map getSliceProfile(String domain, DelegateExecution execution, Map<String, Object> oofSliceProfile) { - String profileMapStr - Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") - Integer domainLatency = (Integer) serviceProfile.get("latency")/3 - - if(domain.equalsIgnoreCase("AN")){ - profileMapStr = """ { - "latency": ${domainLatency}, - "sNSSAI": "sNSSAI", - "uEMobilityLevel": "uEMobilityLevel", - "coverageAreaTAList": "coverageAreaTAList", - "5QI": 100 - }""" - } - else if(domain.equalsIgnoreCase("TN")){ - profileMapStr =""" { - "latency":${domainLatency}, - "sNSSAI":"sNSSAI", - "e2eLatency":"latency", - "bandwidth": 100 - }""" - } - else if(domain.equalsIgnoreCase("CN")){ - profileMapStr = """ { - "areaTrafficCapDL":"areaTrafficCapDL", - "maxNumberofUEs":"maxNumberofUEs", - "latency":${domainLatency}, - "expDataRateUL":"expDataRateUL", - "sNSSAI":"sNSSAI", - "areaTrafficCapUL":"areaTrafficCapUL", - "uEMobilityLevel":"uEMobilityLevel", - "expDataRateDL":"expDataRateDL", - "activityFactor":"activityFactor", - "resourceSharingLevel":"resourceSharingLevel" - }""" - } - - logger.debug("Profile map for " + domain + " : " + profileMapStr) - Map<String, Object> profileMaps = objectMapper.readValue(profileMapStr.trim().replaceAll(" ", ""), new TypeReference<Map<String, String>>(){}) - Map<String, Object> sliceProfile = [:] - for (Map.Entry<String, String> profileMap : profileMaps) { - String key = profileMap.key - String value = profileMaps.get(key) - if(null != oofSliceProfile && oofSliceProfile.keySet().contains(key)){ - sliceProfile.put(key, oofSliceProfile.get(key)) - logger.debug("Get from oof, key:${key}, value: ${oofSliceProfile.get(key)}") - } - else if(serviceProfile.keySet().contains(value)){ - sliceProfile.put(key, serviceProfile.get(value)) - } - else{ - sliceProfile.put(key, profileMaps.get(key)) - } - } - return sliceProfile - } - - void processDecomposition(DelegateExecution execution){ - logger.debug("Start processDecomposition") - - ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition") - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") - String nstName = serviceDecomposition.getModelInfo().getModelName() - String nstId = serviceDecomposition.getModelInfo().getModelUuid() - sliceTaskParams.setNstName(nstName) - sliceTaskParams.setNstId(nstId) - - logger.debug("End processDecomposition") - } - - - void prepareNSTDecompose(DelegateExecution execution) { - - String modelUuid = execution.getVariable("nstModelUuid") - String modelInvariantUuid = execution.getVariable("nstModelInvariantUuid") - - String serviceModelInfo = """{ - "modelInvariantUuid":"${modelInvariantUuid}", - "modelUuid":"${modelUuid}", - "modelVersion":"" - }""" - execution.setVariable("serviceModelInfo", serviceModelInfo) - } - - void prepareNSSTDecompose(DelegateExecution execution) { - Boolean isMoreNSSTtoProcess = false - Integer maxNSST = execution.getVariable("maxNSST") - Integer currentNSST=execution.getVariable("currentNSST") - List<String> nsstModelUUIDList = new ArrayList<>() - nsstModelUUIDList = execution.getVariable("nsstModelUUIDList") - String modelUuid = nsstModelUUIDList.get(currentNSST) - String serviceModelInfo = """{ - "modelInvariantUuid":"", - "modelUuid":"${modelUuid}", - "modelVersion":"" - }""" - execution.setVariable("serviceModelInfo", serviceModelInfo) - currentNSST=currentNSST+1 - if(currentNSST<maxNSST) - isMoreNSSTtoProcess=true - execution.setVariable("isMoreNSSTtoProcess",isMoreNSSTtoProcess) - execution.setVariable("maxNSST",maxNSST) - execution.setVariable("currentNSST",currentNSST) - } - - - void prepareNSSTlistfromNST(DelegateExecution execution) { - //Need to update this part from decomposition. - logger.trace("Enter prepareNSSTlistfromNST()") - Boolean isMoreNSSTtoProcess = false - ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition") - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") - String nstName = serviceDecomposition.getModelInfo().getModelName() - sliceTaskParams.setNstName(nstName) - String nstId = serviceDecomposition.getModelInfo().getModelUuid() - sliceTaskParams.setNstId(nstId) - execution.setVariable("sliceTaskParams",sliceTaskParams) - - List<ServiceProxy> proxyList = serviceDecomposition.getServiceProxy() - List<String> nsstModelUUIDList = new ArrayList<>() - for(ServiceProxy serviceProxy:proxyList) - nsstModelUUIDList.add(serviceProxy.getSourceModelUuid()) - execution.setVariable("nsstModelUUIDList",nsstModelUUIDList) - Integer maxNSST = nsstModelUUIDList.size() - Integer currentNSST=0 - execution.setVariable("maxNSST",maxNSST) - execution.setVariable("currentNSST",currentNSST) - if(currentNSST<maxNSST) - isMoreNSSTtoProcess=true - execution.setVariable("isMoreNSSTtoProcess",isMoreNSSTtoProcess) - logger.trace("Exit prepareNSSTlistfromNST()") - - } - - void getNSSTOption(DelegateExecution execution) { - ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition") - String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String serviceType = execution.getVariable("subscriptionServiceType") - String nssiInstanceId ="" - String nssiName ="" - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") - logger.debug( "get NSI option OOF Url: " + urlString) - boolean isNSISuggested = false - execution.setVariable("isNSISuggested",isNSISuggested) - - //Prepare auth for OOF - Begin - def authHeader = "" - String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution) - String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution) - - String basicAuthValue = utils.encrypt(basicAuth, msokey) - if (basicAuthValue != null) { - logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue) - try { - authHeader = utils.getBasicAuth(basicAuthValue, msokey) - execution.setVariable("BasicAuthHeaderValue", authHeader) - } catch (Exception ex) { - logger.debug( "Unable to encode username and password string: " + ex) - exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " + - "encode username and password string") - } - } else { - logger.debug( "Unable to obtain BasicAuth - BasicAuth value null") - exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " + - "value null") - } - //Prepare auth for OOF - End - //Prepare send request to OOF - Begin - String requestId = execution.getVariable("msoRequestId") - Map<String, Object> profileInfo = execution.getVariable("serviceProfile") - String nsstModelInvariantUuid = serviceDecomposition.getModelInfo().getModelInvariantUuid() - String nsstModelUuid = serviceDecomposition.getModelInfo().getModelUuid() - String nsstInfo = """"NSSTInfo": { - "invariantUUID":"${nsstModelInvariantUuid}", - "UUID":"${nsstModelUuid}" - }""" - String oofRequest = oofUtils.buildSelectNSSIRequest(execution, requestId, nsstInfo ,profileInfo) - - - URL url = new URL(urlString+"/api/oof/v1/selectnssi") - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF) - httpClient.addAdditionalHeader("Authorization", authHeader) - Response httpResponse = httpClient.post(oofRequest) - - int responseCode = httpResponse.getStatus() - logger.debug("OOF sync response code is: " + responseCode) - - if(responseCode != 200){ - exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.") - } - - if(httpResponse.hasEntity()){ - String OOFResponse = httpResponse.readEntity(String.class) - execution.setVariable("OOFResponse", OOFResponse) - nssiInstanceId = jsonUtil.getJsonValue(OOFResponse, "NSSIIInfo.NSSIID") - nssiName = jsonUtil.getJsonValue(OOFResponse, "NSSIInfo.NSSIName") - execution.setVariable("nssiInstanceId",nssiInstanceId) - execution.setVariable("nssiName",nssiName) - } - if(StringUtils.isBlank(nssiInstanceId)){ - logger.debug( "There is no valid NSST suggested by OOF.") - }else - { - try { - AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nssiInstanceId) - AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) - Optional<ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class) - org.onap.aai.domain.yang.ServiceInstance nssi = si.get() - - String domain = nssi.getEnvironmentContext().toString().toUpperCase() - switch (domain) { - case "AN": - sliceTaskParams.setAnSuggestNssiId(nssi.getServiceInstanceId()) - sliceTaskParams.setAnSuggestNssiName(nssi.getServiceInstanceName()) - break - case "CN": - sliceTaskParams.setCnSuggestNssiId(nssi.getServiceInstanceId()) - sliceTaskParams.setCnSuggestNssiName(nssi.getServiceInstanceName()) - break - case "TN": - sliceTaskParams.setTnSuggestNssiId(nssi.getServiceInstanceId()) - sliceTaskParams.setTnSuggestNssiName(nssi.getServiceInstanceName()) - break - default: - break - } - }catch(NotFoundException e) - { - logger.debug("NSSI Service Instance not found in AAI: " + nssiInstanceId) - }catch(Exception e) - { - logger.debug("NSSI Service Instance not found in AAI: " + nssiInstanceId) - } - } - logger.debug("Prepare NSSI option completed ") - } - - - /** - * new - */ - - private static final ObjectMapper MAPPER = new ObjectMapper() - - private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil) - - private static final String QUERY_SUB_NET_CAPABILITY = "/api/rest/provMns/v1/NSS/subnetCapabilityQuery" - - private static final String QUERY_NSSI_SELECTION_CAPABILITY = "/api/rest/provMns/v1/NSS/NSSISelectionCapability" - - /** - * query Subnet Capability of TN - * @param execution - */ - public void queryTNSubnetCapability(DelegateExecution execution) { - - String vendor = execution.getVariable("vendor") - - List<String> subnetTypes = new ArrayList<>() - subnetTypes.add("TN_FH") - subnetTypes.add("TN_MH") - subnetTypes.add("TN_BH") - - String strRequest = MAPPER.writeValueAsString( - buildQuerySubnetCapRequest(vendor, subnetTypes, NetworkType.TRANSPORT)) - - String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_SUB_NET_CAPABILITY, strRequest) - execution.setVariable("subnetCapabilityOfTN", response) - } - - /** - * query Subnet Capability of CN - * @param execution - */ - public void queryCNSubnetCapability(DelegateExecution execution) { - - String vendor = execution.getVariable("vendor") - - List<String> subnetTypes = new ArrayList<>() - subnetTypes.add("CN") - - String strRequest = MAPPER.writeValueAsString(buildQuerySubnetCapRequest(vendor, subnetTypes, NetworkType.CORE)) - - String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_SUB_NET_CAPABILITY, strRequest) - - execution.setVariable("subnetCapabilityOfCN", response) - } - - /** - * query Subnet Capability of AN - * @param execution - */ - public void queryANSubnetCapability(DelegateExecution execution) { - - String vendor = execution.getVariable("vendor") - - List<String> subnetTypes = new ArrayList<>() - subnetTypes.add("AN-NF") - - String strRequest = MAPPER.writeValueAsString(buildQuerySubnetCapRequest(vendor, subnetTypes, NetworkType.ACCESS)) - - String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_SUB_NET_CAPABILITY, strRequest) - - execution.setVariable("subnetCapabilityOfAN", response) - } - - /** - * build request body for querying Subnet Capability - * @param vendor - * @param subnetTypes - * @param networkType - * @return - */ - private static String buildQuerySubnetCapRequest(String vendor, List<String> subnetTypes, NetworkType networkType) { - NssmfAdapterNBIRequest request = new NssmfAdapterNBIRequest() - - Map<String, Object> paramMap = new HashMap() - paramMap.put("subnetTypes", subnetTypes) - - request.setSubnetCapabilityQuery(MAPPER.writeValueAsString(paramMap)) - - EsrInfo esrInfo = new EsrInfo() - esrInfo.setVendor(vendor) - esrInfo.setNetworkType(networkType) - - request.setEsrInfo(esrInfo) - - String strRequest = MAPPER.writeValueAsString(request) - - return strRequest - } - - /** - * handle response of Subnet Capability, generate SubnetCapabilities Info for request to oof - * @param execution - */ - public void generateSubnetCapabilities(DelegateExecution execution) { - //todo: - execution.setVariable("subnetCapabilities", []) - } - - /** - * prepare the params for decompose nst - * @param execution - */ - public void prepareDecomposeNST(DelegateExecution execution) { - - String modelUuid = execution.getVariable("nstModelUuid") - String modelInvariantUuid = execution.getVariable("nstModelInvariantUuid") - - String serviceModelInfo = """{ - "modelInvariantUuid":"${modelInvariantUuid}", - "modelUuid":"${modelUuid}", - "modelVersion":"" - }""" - execution.setVariable("nstServiceModelInfo", serviceModelInfo) - } - - /** - * process the result of NST Decomposition - * @param execution - */ - public void processDecompositionNST(DelegateExecution execution) { - - ServiceDecomposition nstServiceDecomposition = execution.getVariable("nstServiceDecomposition") - //todo: - - } - - - /** - * prepare the params for decompose nsst - * @param execution - */ - public void prepareDecomposeNSST(DelegateExecution execution) { - Boolean isMoreNSSTtoProcess = false - def maxNSST = execution.getVariable("maxNSST") as Integer - def currentNSST = execution.getVariable("currentNSST") as Integer - def nsstModelUUIDList = execution.getVariable("nsstModelUUIDList") as List - String modelUuid = nsstModelUUIDList.get(currentNSST) - String serviceModelInfo = """{ - "modelInvariantUuid":"", - "modelUuid":"${modelUuid}", - "modelVersion":"" - }""" - execution.setVariable("nsstServiceModelInfo", serviceModelInfo) - currentNSST = currentNSST + 1 - - if(currentNSST < maxNSST) { - isMoreNSSTtoProcess = true - } - - execution.setVariable("isMoreNSSTtoProcess", isMoreNSSTtoProcess) - execution.setVariable("maxNSST", maxNSST) - execution.setVariable("currentNSST", currentNSST) - - //todo: - } - - /** - * process the result of NSST Decomposition - * @param execution - */ - public void processDecompositionNSST(DelegateExecution execution) { - ServiceDecomposition nsstServiceDecomposition = execution.getVariable("nsstServiceDecomposition") - //todo: - } - - /** - * todo: need rewrite - * prepare select nsi request - * @param execution - */ - public void preNSIRequest(DelegateExecution execution) { - - String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) - logger.debug( "get NSI option OOF Url: " + urlString) - - boolean isNSISuggested = true - execution.setVariable("isNSISuggested", isNSISuggested) - String requestId = execution.getVariable("msoRequestId") - String messageType = "NSISelectionResponse" - - ServiceProfile profileInfo = execution.getVariable("serviceProfile") as ServiceProfile - Map<String, Object> nstSolution = execution.getVariable("nstSolution") as Map - logger.debug("Get NST selection from OOF: " + nstSolution.toString()) - - execution.setVariable("nsiSelectionUrl", "/api/oof/selection/nsi/v1") - execution.setVariable("nsiSelection_messageType", messageType) - execution.setVariable("nsiSelection_correlator", requestId) - String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution) - execution.setVariable("nsiSelection_timeout", timeout) - - - TemplateInfo nstInfo = new TemplateInfo() - nstInfo.setInvariantUUID(nstSolution.get("invariantUUID") as String) - nstInfo.setUUID(nstSolution.get("UUID") as String) - nstInfo.setName(nstSolution.get("NSTName") as String) - - execution.setVariable("NSTInfo", nstInfo) - - List<TemplateInfo> nsstInfos = execution.getVariable("NSSTInfos") as List<TemplateInfo> - - List<SubnetCapability> subnetCapabilities = execution.getVariable("subnetCapabilities") as List<SubnetCapability> - - String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo, nsstInfos, - messageType, profileInfo, subnetCapabilities, timeout as Integer) - - execution.setVariable("nsiSelection_oofRequest", oofRequest) - logger.debug("Sending request to OOF: " + oofRequest) - } - - /** - * todo: need rewrite - * process select nsi response - * @param execution - */ - public void processNSIResp(DelegateExecution execution) { - - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") as SliceTaskParams - String OOFResponse = execution.getVariable("nsiSelection_oofResponse") - logger.debug("NSI OOFResponse is: " + OOFResponse) - execution.setVariable("OOFResponse", OOFResponse) - //This needs to be changed to derive a value when we add policy to decide the solution options. - - Map<String, Object> resMap = objectMapper.readValue(OOFResponse, Map.class) - List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions") - Map<String, Object> solutions = nsiSolutions.get(0) - - String resourceSharingLevel = execution.getVariable("resourceSharingLevel") - Boolean isSharable = resourceSharingLevel == "shared" - - if (solutions != null) { - if (isSharable && solutions.get("existingNSI")) { - //sharedNSISolution - processSharedNSISolutions(solutions, execution) - } - else if(solutions.containsKey("newNSISolution")) { - processNewNSISolutions(solutions, execution) - } - } - execution.setVariable("sliceTaskParams", sliceTaskParams) - logger.debug("sliceTaskParams: " + sliceTaskParams.convertToJson()) - logger.debug("*** Completed options Call to OOF ***") - - logger.debug("start parseServiceProfile") - parseServiceProfile(execution) - logger.debug("end parseServiceProfile") - } - - /** - * get NSSI Selection Capability for AN - * @param execution - */ - public void getNSSISelectionCap4AN(DelegateExecution execution) { - - def vendor = execution.getVariable("vendor") as String - - String strRequest = buildNSSISelectionReq(vendor, NetworkType.ACCESS) - - String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_NSSI_SELECTION_CAPABILITY, strRequest) - - Map<String, Object> resMap = objectMapper.readValue(response, Map.class) - - String selection = resMap.get("selection") - - - if ("NSMF".equalsIgnoreCase(selection)) { - execution.setVariable("NEED_AN_NSSI_SELECTION", true) - } - } - - /** - * get NSSI Selection Capability for TN - * @param execution - */ - public void getNSSISelectionCap4TN(DelegateExecution execution) { - - def vendor = execution.getVariable("vendor") as String - - String strRequest = buildNSSISelectionReq(vendor, NetworkType.TRANSPORT) - - String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_NSSI_SELECTION_CAPABILITY, strRequest) - - Map<String, Object> resMap = objectMapper.readValue(response, Map.class) - - String selection = resMap.get("selection") - - if ("NSMF".equalsIgnoreCase(selection)) { - execution.setVariable("NEED_TN_NSSI_SELECTION", true) - } - } - - /** - * get NSSI Selection Capability for CN - * @param execution - */ - public void getNSSISelectionCap4CN(DelegateExecution execution) { - - def vendor = execution.getVariable("vendor") as String - - String strRequest = buildNSSISelectionReq(vendor, NetworkType.CORE) - - String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_NSSI_SELECTION_CAPABILITY, strRequest) - - Map<String, Object> resMap = objectMapper.readValue(response, Map.class) - - String selection = resMap.get("selection") - - if ("NSMF".equalsIgnoreCase(selection)) { - execution.setVariable("NEED_CN_NSSI_SELECTION", true) - } - } - - /** - * build NSSI Selection Capability Request body to nssmf adapter - * @param vendor - * @param networkType - * @return - */ - private static String buildNSSISelectionReq(String vendor, NetworkType networkType) { - NssmfAdapterNBIRequest request = new NssmfAdapterNBIRequest() - EsrInfo esrInfo = new EsrInfo() - esrInfo.setVendor(vendor) - esrInfo.setNetworkType(networkType) - request.setEsrInfo(esrInfo) - - return MAPPER.writeValueAsString(request) - } - - /** - * if exist nssi need to select? - * @param execution - */ - public void handleNssiSelect(DelegateExecution execution) { - - SliceTaskParamsAdapter sliceTaskParams = - execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter - - execution.setVariable() - } - - /** - * todo: need rewrite - * prepare select nssi request - * @param execution - */ - public void preNSSIRequest(DelegateExecution execution) { - - String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) - logger.debug( "get NSI option OOF Url: " + urlString) - - boolean isNSISuggested = true - execution.setVariable("isNSISuggested", isNSISuggested) - String requestId = execution.getVariable("msoRequestId") - String messageType = "NSISelectionResponse" - - Map<String, Object> profileInfo = execution.getVariable("serviceProfile") as Map - Map<String, Object> nstSolution = execution.getVariable("nstSolution") as Map - logger.debug("Get NST selection from OOF: " + nstSolution.toString()) - String nstInfo = """{ - "modelInvariantId":"${nstSolution.invariantUUID}", - "modelVersionId":"${nstSolution.UUID}", - "modelName":"${nstSolution.NSTName}" - }""" - - execution.setVariable("nsiSelectionUrl", "/api/oof/selection/nsi/v1") - execution.setVariable("nsiSelection_messageType", messageType) - execution.setVariable("nsiSelection_correlator", requestId) - String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution) - execution.setVariable("nsiSelection_timeout", timeout) - - //todo - String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo, messageType, profileInfo) - - execution.setVariable("nsiSelection_oofRequest", oofRequest) - logger.debug("Sending request to OOF: " + oofRequest) - } - - /** - * process select nssi response - * @param execution - */ - public void processNSSIResp(DelegateExecution execution) { - - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") as SliceTaskParams - String OOFResponse = execution.getVariable("nsiSelection_oofResponse") - logger.debug("NSI OOFResponse is: " + OOFResponse) - execution.setVariable("OOFResponse", OOFResponse) - //This needs to be changed to derive a value when we add policy to decide the solution options. - - Map<String, Object> resMap = objectMapper.readValue(OOFResponse, Map.class) - List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions") - Map<String, Object> solutions = nsiSolutions.get(0) - - String resourceSharingLevel = execution.getVariable("resourceSharingLevel") - Boolean isSharable = resourceSharingLevel == "shared" - - if (solutions != null) { - if (isSharable && solutions.get("existingNSI")) { - //sharedNSISolution - processSharedNSISolutions(solutions, execution) - } - else if(solutions.containsKey("newNSISolution")) { - processNewNSISolutions(solutions, execution) - } - } - execution.setVariable("sliceTaskParams", sliceTaskParams) - logger.debug("sliceTaskParams: "+sliceTaskParams.convertToJson()) - logger.debug("*** Completed options Call to OOF ***") - - logger.debug("start parseServiceProfile") - parseServiceProfile(execution) - logger.debug("end parseServiceProfile") - } - - -} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy index 534467f6ab..0f1bf0d8b4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy @@ -27,6 +27,8 @@ 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.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.core.json.JsonUtils @@ -81,9 +83,7 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { sliceProfile.setReliability(new Object()) try { AAIResourcesClient client = getAAIClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, execution.getVariable - ("globalSubscriberId"), - execution.getVariable("subscriptionServiceType"), sliceserviceInstanceId, sliceProfileId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceserviceInstanceId).sliceProfile(sliceProfileId)) client.create(uri, sliceProfile) } catch (BpmnError e) { @@ -120,7 +120,7 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { ss.setEnvironmentContext(snssai) ss.setServiceRole(serviceRole) AAIResourcesClient client = getAAIClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), ssInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(ssInstanceId)) client.create(uri, ss) } catch (BpmnError e) { throw e @@ -136,16 +136,14 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable('sliceServiceInstanceId') AAIResourcesClient resourceClient = getAAIClient() - AAIResourceUri ssServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + AAIResourceUri ssServiceuri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)) try { List<String> networkStrList = jsonUtil.StringArrayToList(execution.getVariable("transportSliceNetworks")) for (String networkStr : networkStrList) { String allottedResourceId = UUID.randomUUID().toString() - AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, - execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), - execution.getVariable("sliceserviceInstanceId"), allottedResourceId) + AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("sliceserviceInstanceId")).allottedResource(allottedResourceId)) execution.setVariable("allottedResourceUri", allottedResourceUri) String modelInvariantId = execution.getVariable("modelInvariantUuid") String modelVersionId = execution.getVariable("modelUuid") @@ -157,7 +155,7 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { resource.setModelInvariantId(modelInvariantId) resource.setModelVersionId(modelVersionId) getAAIClient().create(allottedResourceUri, resource) - //AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath(ssServiceuri).build()) + //AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(Types.SERVICE_INSTANCE, UriBuilder.fromPath(ssServiceuri).build()) //getAAIClient().connect(allottedResourceUri,ssServiceuri) //execution.setVariable("aaiARPath", allottedResourceUri.build().toString()); @@ -191,7 +189,7 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { resource.setModelInvariantId(modelInvariantId) resource.setModelVersionId(modelVersionId) - AAIResourceUri logicalLinkUri = AAIUriFactory.createResourceUri(AAIObjectType.LOGICAL_LINK, logicalLinkId) + AAIResourceUri logicalLinkUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLink(logicalLinkId)) getAAIClient().create(logicalLinkUri, resource) } } catch (Exception ex) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy index d5469c81a2..8eded75e44 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy @@ -26,7 +26,9 @@ import org.onap.so.logger.LoggingAnchor import org.onap.so.client.HttpClientFactory 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.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor @@ -228,8 +230,8 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces String serviceType = execution.getVariable("serviceType") String serviceId = execution.getVariable("serviceId") - AAIResourceUri nsUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,globalSubscriberId,serviceType,nsInstanceId) - AAIResourceUri relatedServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,globalSubscriberId,serviceType,serviceId) + AAIResourceUri nsUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nsInstanceId)) + AAIResourceUri relatedServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceId)) try{ getAAIClient().connect(nsUri,relatedServiceUri) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index 366cdfdb09..f19d064c8e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -32,6 +32,14 @@ import org.json.JSONArray import org.json.JSONObject import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.NetworkPolicy +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.generated.fluentbuilders.AAIFluentTypeBuilder.Types +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.logging.filter.base.ErrorCode import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.bpmn.common.scripts.AaiUtil @@ -51,14 +59,6 @@ import org.onap.so.bpmn.core.json.DecomposeJsonUtil import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -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.graphinventory.entities.uri.Depth import org.onap.so.constants.Defaults import org.onap.so.db.catalog.beans.HomingInstance import org.onap.so.logger.LoggingAnchor @@ -303,7 +303,7 @@ public class DoCreateVfModule extends VfModuleBase { } try{ - AAIResourceUri serviceInstanceURI = AAIUriFactory.create(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,serviceType,serviceInstanceId) + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId)) AAIResourcesClient aaiRC = new AAIResourcesClient() AAIResultWrapper aaiRW = aaiRC.get(serviceInstanceURI) Map<String, Object> aaiJson = aaiRW.asMap() @@ -690,7 +690,7 @@ public class DoCreateVfModule extends VfModuleBase { def vfModuleId = execution.getVariable('DCVFM_vfModuleId') AaiUtil aaiUriUtil = new AaiUtil(this) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE) String endPoint = aaiUriUtil.createAaiUri(uri) try { @@ -774,7 +774,7 @@ public class DoCreateVfModule extends VfModuleBase { def vfModuleName = execution.getVariable('DCVFM_vfModuleName') AaiUtil aaiUriUtil = new AaiUtil(this) - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, vnfId).queryParam("vf-module-name",vfModuleName) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModules()).queryParam("vf-module-name",vfModuleName) String endPoint = aaiUriUtil.createAaiUri(uri) HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), ONAPComponents.AAI) @@ -909,7 +909,7 @@ public class DoCreateVfModule extends VfModuleBase { String serviceOperation = "" if (element.equals("vnf")) { AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, execution.getVariable('DCVFM_vnfId')) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(execution.getVariable('DCVFM_vnfId'))) AAIResultWrapper wrapper = resourceClient.get(uri) Optional<GenericVnf> vnf = wrapper.asBean(GenericVnf.class) @@ -1792,7 +1792,7 @@ public class DoCreateVfModule extends VfModuleBase { // Prepare AA&I url AaiUtil aaiUtil = new AaiUtil(this) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion)) def queryCloudRegionRequest = aaiUtil.createAaiUri(uri) execution.setVariable("DCVFM_queryCloudRegionRequest", queryCloudRegionRequest) @@ -1923,7 +1923,7 @@ public class DoCreateVfModule extends VfModuleBase { String fqdn = fqdnList[i] // Query AAI for this network policy FQDN - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies()) uri.queryParam("network-policy-fqdn", fqdn) AAIResourcesClient resourceClient = new AAIResourcesClient() @@ -1944,8 +1944,8 @@ public class DoCreateVfModule extends VfModuleBase { policy.setNetworkPolicyId(networkPolicyId) policy.setNetworkPolicyFqdn(fqdn) policy.setHeatStackId(execution.getVariable("DCVFM_heatStackId")) - - AAIResourceUri netUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId) + + AAIResourceUri netUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicyId)) resourceClient.create(netUri, policy) rollbackData.put("VFMODULE", "rollbackCreateNetworkPoliciesAAI", "true") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy index b3c4698ab8..4b495e314e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy @@ -34,11 +34,12 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException -import org.onap.aaiclient.client.aai.AAIObjectPlurals import org.onap.aaiclient.client.aai.AAIObjectType 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.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger @@ -507,7 +508,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ try { // Query AAI for this network policy FQDN - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies()) uri.queryParam("network-policy-fqdn", fqdn) Optional<NetworkPolicies> networkPolicies = getAAIClient().get(NetworkPolicies.class, uri) @@ -516,7 +517,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ NetworkPolicy networkPolicy = networkPolicies.get().getNetworkPolicy().get(0) try{ - AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicy.getNetworkPolicyId()) + AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicy.getNetworkPolicyId())) getAAIClient().delete(delUri) execution.setVariable(Prefix + "aaiDeleteNetworkPolicyReturnCode", 200) logger.debug("AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + 200) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy index 80f6e0edb2..0e153b73e6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy @@ -23,24 +23,24 @@ package org.onap.so.bpmn.infrastructure.scripts +import javax.ws.rs.NotFoundException import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.VolumeGroups +import org.onap.aaiclient.client.aai.AAIObjectType +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.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.aaiclient.client.aai.AAIObjectPlurals -import org.onap.aaiclient.client.aai.AAIObjectType -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.so.constants.Defaults import org.slf4j.Logger import org.slf4j.LoggerFactory -import javax.ws.rs.NotFoundException - public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor { private static final Logger logger = LoggerFactory.getLogger( DoCreateVfModuleVolumeRollback.class); @@ -133,7 +133,7 @@ public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor volumeGroupName = testVolumeGroupName } - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion).queryParam("volume-group-name", volumeGroupName) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion).volumeGroups()).queryParam("volume-group-name", volumeGroupName) try { Optional<VolumeGroups> volumeGroups = getAAIClient().get(VolumeGroups.class, uri) if (volumeGroups.isPresent()) { @@ -154,7 +154,7 @@ public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor String cloudRegion = execution.getVariable("DCVFMODVOLRBK_lcpCloudRegionId") String volumeGroupId = callRESTQueryAAIVolGrpName(execution, cloudRegion) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion, volumeGroupId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion).volumeGroup(volumeGroupId)) try { getAAIClient().delete(uri) }catch(NotFoundException ignored){ diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy index b1d909b6b4..d65f144b3d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy @@ -28,6 +28,12 @@ import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.VolumeGroup import org.onap.aai.domain.yang.VolumeGroups +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.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils @@ -36,11 +42,6 @@ import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.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.AAIResourceUri -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import org.onap.so.db.catalog.beans.OrchestrationStatus import org.slf4j.Logger @@ -148,7 +149,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { String serviceInstanceId = execution.getVariable('serviceInstanceId') AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)) if(!resourceClient.exists(uri)){ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai") @@ -174,7 +175,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { AaiUtil aaiUtil = new AaiUtil(this) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion)) def queryCloudRegionRequest = aaiUtil.createAaiUri(uri) cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) @@ -215,7 +216,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { def cloudRegion = execution.getVariable('lcpCloudRegionId') try { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion).queryParam("volume-group-name", volumeGroupName) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion).volumeGroups()).queryParam("volume-group-name", volumeGroupName) Optional<VolumeGroups> volumeGroups = getAAIClient().get(VolumeGroups.class,uri) if(volumeGroups.isPresent()){ VolumeGroup volumeGroup = volumeGroups.get().getVolumeGroup().get(0); @@ -292,9 +293,9 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { logger.debug("volumeGroupId to be used: " + volumeGroupId) - AAIResourceUri volumeGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwner, cloudRegion, volumeGroupId) - AAIResourceUri tenantUri = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegion, tenantId) - AAIResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri volumeGroupUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).volumeGroup(volumeGroupId)) + AAIResourceUri tenantUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)) + AAIResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) try { getAAIClient().create(volumeGroupUri, volumeGroup) getAAIClient().connect(volumeGroupUri, vnfUri) @@ -504,7 +505,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { String cloudOwner = execution.getVariable('cloudOwner') String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse") def heatStackID = utils.getNodeText(createVnfAResponse, "volumeGroupStackId") - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwner, cloudRegion, volumeGroupId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).volumeGroup(volumeGroupId)) execution.setVariable(prefix+"heatStackId", heatStackID) @@ -534,7 +535,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { public void callRESTQueryAAIGenericVnf(DelegateExecution execution, isDebugEnabled) { def vnfId = execution.getVariable('vnfId') - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) try { Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class, uri) if (genericVnf.isPresent()) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy index 488f2d85ac..1bb5ad1787 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy @@ -30,6 +30,7 @@ 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.logging.filter.base.ErrorCode import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -109,7 +110,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { String vnfName = execution.getVariable("vnfName") if (vnfName.equals("") || vnfName.equals("null")) { AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, execution.getVariable("vnfId")) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(execution.getVariable("vnfId"))) if(resourceClient.exists(uri)){ exceptionUtil.buildWorkflowException(execution, 5000, "Generic Vnf Already Exist.") } @@ -281,7 +282,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable('DoCVNF_serviceInstanceId') AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)) if(resourceClient.exists(uri)){ Map<String, String> keys = uri.getURIKeys() @@ -355,10 +356,10 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { payload.put("nf-naming-code", nfNamingCode); AAIResourcesClient resourceClient = new AAIResourcesClient(); - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) resourceClient.create(uri, payload) - AAIResourceUri siUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId) + AAIResourceUri siUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId)) resourceClient.connect(uri, siUri) }catch(Exception ex) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy index 76629dd1ba..4a555503a3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy @@ -52,6 +52,8 @@ import org.w3c.dom.NodeList import org.xml.sax.InputSource 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.aai.AAIObjectType import org.onap.aaiclient.client.aai.AAIResourcesClient @@ -453,7 +455,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess String serviceInstanceId = execution.getVariable("serviceInstanceId") AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId) + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId)) resourceClient.delete(serviceInstanceUri) logger.trace("Exited deleteServiceInstance") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy index 53a98c2ec6..b9a3eab28a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy @@ -22,35 +22,32 @@ */ package org.onap.so.bpmn.infrastructure.scripts -import org.onap.so.logger.LoggingAnchor -import org.onap.aai.domain.yang.AllottedResource -import org.onap.logging.filter.base.ErrorCode - -import javax.ws.rs.core.UriBuilder - import static org.apache.commons.lang3.StringUtils.*; - +import javax.ws.rs.NotFoundException +import javax.ws.rs.core.UriBuilder import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray +import org.json.JSONObject +import org.onap.aai.domain.yang.AllottedResource +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.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils -import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory - import org.springframework.web.util.UriUtils; -import org.onap.aaiclient.client.aai.AAIResourcesClient -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.json.JSONObject -import javax.ws.rs.NotFoundException import groovy.json.* @@ -174,7 +171,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce String serviceType = execution.getVariable('serviceType') AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId)) AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) String json = wrapper.getJson() @@ -582,7 +579,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce private Optional<AllottedResource> getAaiAr(DelegateExecution execution, String relink) { def method = getClass().getSimpleName() + '.getAaiAr(' +'execution=' + execution.getId() +')' logger.info("Entered " + method) - AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(relink).build()) + AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(Types.ALLOTTED_RESOURCE, UriBuilder.fromPath(relink).build()) return getAAIClient().get(AllottedResource.class,uri) } /** diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy index 2ca0da4cbb..10a559475f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy @@ -33,6 +33,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.logging.filter.base.ONAPComponents import org.onap.so.beans.nsmf.DeAllocateNssi import org.onap.so.beans.nsmf.EsrInfo @@ -54,6 +56,7 @@ import org.slf4j.LoggerFactory import com.fasterxml.jackson.databind.ObjectMapper import com.google.gson.JsonObject + /** * Internal AN NSSMF to handle NSSI Deallocation */ @@ -274,8 +277,7 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor { String subscriptionServiceType = execution.getVariable("subscriptionServiceType") AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, subscriptionServiceType, anNfNssiId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(anNfNssiId)) if (!client.exists(uri)) { logger.debug("AN NF Service Instance was not found in aai : ${anNfNssiId}") }else { @@ -294,8 +296,7 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor { String subscriptionServiceType = execution.getVariable("subscriptionServiceType") AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, subscriptionServiceType, anNfNssiId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(anNfNssiId)) if (!client.exists(uri)) { logger.debug("AN NF Service Instance was not found in aai : ${anNfNssiId}") }else { @@ -455,8 +456,7 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor { Map<String,ServiceInstance> relatedInstances = new HashMap<>() AAIResourcesClient client = getAAIClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, subscriptionServiceType, instanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(instanceId)) if (!client.exists(uri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai : ${instanceId}") } @@ -470,8 +470,7 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor { String relatioshipurl = relationship.getRelatedLink() String serviceInstanceId = relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length()) - uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, subscriptionServiceType, serviceInstanceId) + uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId)) if (!client.exists(uri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai: ${serviceInstanceId} related to ${instanceId}") @@ -545,7 +544,7 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor { private void deleteServiceInstanceInAAI(DelegateExecution execution,String instanceId) { try { - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), instanceId) + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("serviceType")).serviceInstance(instanceId)) getAAIClient().delete(serviceInstanceUri) logger.debug("${Prefix} Exited deleteServiceInstance") }catch(Exception e){ diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy index fcb3b52322..c94e2dd67d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Telecom Italia + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.bpmn.infrastructure.scripts import com.fasterxml.jackson.databind.ObjectMapper @@ -12,12 +32,14 @@ import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.ServiceInstance import org.onap.aai.domain.yang.Tenant import org.onap.aai.domain.yang.VfModule -import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIClient import org.onap.aaiclient.client.aai.AAIResourcesClient 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.logging.filter.base.ONAPComponents import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -30,6 +52,7 @@ import org.onap.so.client.HttpClientFactory import org.onap.so.db.request.beans.OperationStatus import org.onap.so.requestsdb.RequestsDbConstant import org.onap.so.serviceinstancebeans.CloudConfiguration +import org.onap.so.serviceinstancebeans.LineOfBusiness import org.onap.so.serviceinstancebeans.ModelInfo import org.onap.so.serviceinstancebeans.ModelType import org.onap.so.serviceinstancebeans.OwningEntity @@ -47,7 +70,7 @@ import org.slf4j.LoggerFactory import javax.ws.rs.core.Response -class DoDeallocateCoreNSSI extends AbstractServiceTaskProcessor { +class DoDeallocateCoreNSSI extends DoCommonCoreNSSI { private final String PREFIX ="DoDeallocateCoreNSSI" private ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -57,31 +80,13 @@ class DoDeallocateCoreNSSI extends AbstractServiceTaskProcessor { private static final Logger LOGGER = LoggerFactory.getLogger( DoDeallocateCoreNSSI.class) - @Override - void preProcessRequest(DelegateExecution execution) { - LOGGER.trace("${PREFIX} Start preProcessRequest") - - def currentNSSI = execution.getVariable("currentNSSI") - if (!currentNSSI) { - String msg = "currentNSSI is null" - LOGGER.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - LOGGER.trace("***** ${PREFIX} Exit preProcessRequest") - } - - - /** +/** * Queries OOF for NSSI termination * @param execution */ void executeTerminateNSSIQuery(DelegateExecution execution) { - // TO DO: Unit test LOGGER.trace("${PREFIX} Start executeTerminateNSSIQuery") - def currentNSSI = execution.getVariable("currentNSSI") - String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) //Prepare auth for OOF @@ -89,19 +94,18 @@ class DoDeallocateCoreNSSI extends AbstractServiceTaskProcessor { String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution) String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution) - String basicAuthValue = utils.encrypt(basicAuth, msokey) + String basicAuthValue = encryptBasicAuth(basicAuth, msokey) if (basicAuthValue != null) { - logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue) - try { - authHeader = utils.getBasicAuth(basicAuthValue, msokey) - execution.setVariable("BasicAuthHeaderValue", authHeader) - } catch (Exception ex) { - logger.debug( "Unable to encode username and password string: " + ex) - exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " + - "encode username and password string") + String responseAuthHeader = getAuthHeader(execution, basicAuthValue, msokey) + String errorCode = jsonUtil.getJsonValue(responseAuthHeader, "errorCode") + if(errorCode == null || errorCode.isEmpty()) { // No error + authHeader = responseAuthHeader + } + else { + exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(responseAuthHeader, "errorMessage")) } } else { - logger.debug( "Unable to obtain BasicAuth - BasicAuth value null") + LOGGER.error( "Unable to obtain BasicAuth - BasicAuth value null") exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " + "value null") } @@ -109,587 +113,233 @@ class DoDeallocateCoreNSSI extends AbstractServiceTaskProcessor { //Prepare send request to OOF String oofRequest = buildOOFRequest(execution) - URL url = new URL(urlString+"/api/oof/terminate/nxi/v1") - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF) - httpClient.addAdditionalHeader("Authorization", authHeader) - httpClient.addAdditionalHeader("Accept", "application/json") - httpClient.addAdditionalHeader("Content-Type", "application/json") - - Response httpResponse = httpClient.post(oofRequest) - - int responseCode = httpResponse.getStatus() - logger.debug("OOF sync response code is: " + responseCode) - - if(responseCode != 202){ // Accepted - exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.") - } - - if(httpResponse.hasEntity()){ - String OOFResponse = httpResponse.readEntity(Boolean.class) - String isTerminateNSSI = jsonUtil.getJsonValue(OOFResponse, "terminateResponse") + String callOOFResponse = callOOF(urlString, authHeader, oofRequest) + String errorCode = jsonUtil.getJsonValue(callOOFResponse, "errorCode") + if(errorCode == null || errorCode.isEmpty()) { // No error + String oofResponse = callOOFResponse + String isTerminateNSSI = jsonUtil.getJsonValue(oofResponse, "terminateResponse") execution.setVariable("isTerminateNSSI", Boolean.parseBoolean(isTerminateNSSI)) } - - LOGGER.trace("${PREFIX} Exit executeTerminateNSSIQuery") - } - - - /** - * Builds OOF request - * @param execution - * @return - */ - private String buildOOFRequest(DelegateExecution execution) { - - def currentNSSI = execution.getVariable("currentNSSI") - - String nssiId = currentNSSI['nssiId'] - String requestId = execution.getVariable("mso-request-id") - - String request = "{\n" + - " \"type\": \"NSSI\",\n" + - " \"NxIId\": \"${nssiId}\",\n" + - " \"requestInfo\": {\n" + - " \"transactionId\": \"${requestId}\",\n" + - " \"requestId\": \"${requestId}\",\n" + - " \"sourceId\": \"so\",\n" + - " }\n" + - "}" - - return request - } - - - - /** - * Queries Network Service Instance in AAI - * @param execution - */ - void getNetworkServiceInstance(DelegateExecution execution) { - LOGGER.trace("${PREFIX} Start getNetworkServiceInstance") - - AAIResourcesClient client = getAAIClient() - - def currentNSSI = execution.getVariable("currentNSSI") - - String globalSubscriberId = currentNSSI['globalSubscriberId'] - String serviceType = currentNSSI['serviceType'] - String nssiId = currentNSSI['nssiId'] - - AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiId) //AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nssiId) - Optional<ServiceInstance> nssiOpt = client.get(ServiceInstance.class, nssiUri) - - if (nssiOpt.isPresent()) { - ServiceInstance nssi = nssiOpt.get() - currentNSSI['nssi'] = nssi - - ServiceInstance networkServiceInstance = handleNetworkInstance(execution, nssiId, nssiUri, client) - currentNSSI['networkServiceInstance'] = networkServiceInstance - } - else { - String msg = String.format("NSSI %s not found in AAI", nssiId) - LOGGER.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - - LOGGER.trace("${PREFIX} Exit getNetworkServiceInstance") - } - - - /** - * Handles Network Service - * @param nssiId - * @param nssiUri - * @param client - * @return Network Service Instance - */ - private ServiceInstance handleNetworkInstance(DelegateExecution execution, String nssiId, AAIResourceUri nssiUri, AAIResourcesClient client ) { - ServiceInstance networkServiceInstance = null - - def currentNSSI = execution.getVariable("currentNSSI") - - AAIResultWrapper wrapper = client.get(nssiUri) - Optional<Relationships> relationships = wrapper.getRelationships() - - if (relationships.isPresent()) { - for (AAIResourceUri networkServiceInstanceUri : relationships.get().getRelatedAAIUris(AAIObjectType.SERVICE_INSTANCE)) { - Optional<ServiceInstance> networkServiceInstanceOpt = client.get(ServiceInstance.class, networkServiceInstanceUri) - if (networkServiceInstanceOpt.isPresent()) { - networkServiceInstance = networkServiceInstanceOpt.get() - - if (networkServiceInstance.getServiceRole().equals("Network Service")) { // Network Service role - currentNSSI['networkServiceInstanceUri'] = networkServiceInstanceUri - break - } - } - else { - String msg = String.format("No Network Service Instance found for NSSI %s in AAI", nssiId) - LOGGER.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - } else { - String msg = String.format("No relationship presented for NSSI %s in AAI", nssiId) - LOGGER.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + LOGGER.error(jsonUtil.getJsonValue(callOOFResponse, "errorMessage")) + exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(callOOFResponse, "errorMessage")) } - if(networkServiceInstance == null) { - String msg = String.format("No Network Service Instance found for NSSI %s in AAI", nssiId) - LOGGER.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - return networkServiceInstance + LOGGER.trace("${PREFIX} Exit executeTerminateNSSIQuery") } /** - * Invokes deleteServiceOrder external API - * @param execution + * Executes sync call to OOF + * @return OOF response */ - void deleteServiceOrder(DelegateExecution execution) { - // TO DO: Unit test - LOGGER.trace("${PREFIX} Start deleteServiceOrder") - - def currentNSSI = execution.getVariable("currentNSSI") + String callOOF(String urlString, String authHeader, String oofRequest) { + String errorCode = "" + String errorMessage = "" + String response = "" try { - //url:/nbi/api/v4/serviceOrder/" - def nbiEndpointUrl = UrnPropertiesReader.getVariable("nbi.endpoint.url", execution) // ??? - - ServiceInstance networkServiceInstance = (ServiceInstance)currentNSSI['networkServiceInstance'] - - String url = String.format("${nbiEndpointUrl}/api/v4/serviceOrder/%s", networkServiceInstance.getServiceInstanceId()) // Service Order ID = Network Service Instance ID ??? - - String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution) - String basicAuth = UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution) - String basicAuthValue = utils.encrypt(basicAuth, msoKey) - String encodeString = utils.getBasicAuth(basicAuthValue, msoKey) - - HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.EXTERNAL) - httpClient.addAdditionalHeader("Authorization", encodeString) + URL url = new URL(urlString + "/api/oof/terminate/nxi/v1") + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF) + httpClient.addAdditionalHeader("Authorization", authHeader) httpClient.addAdditionalHeader("Accept", "application/json") - Response httpResponse = httpClient.delete() // check http code ??? - } catch (any) { - String msg = "Exception in DoDeallocateCoreNSSI.deleteServiceOrder. " + any.getCause() - LOGGER.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } + httpClient.addAdditionalHeader("Content-Type", "application/json") - LOGGER.trace("${PREFIX} Exit deleteServiceOrder") - } + Response httpResponse = httpClient.post(oofRequest) + int responseCode = httpResponse.getStatus() + LOGGER.debug("OOF sync response code is: " + responseCode) - /** - * Queries constitute VNF from Network Service Instance - * @param execution - */ - void getConstituteVNFFromNetworkServiceInst(DelegateExecution execution) { - LOGGER.trace("${PREFIX} Start getConstituteVNFFromNetworkServiceInst") - - def currentNSSI = execution.getVariable("currentNSSI") - - AAIResourcesClient client = getAAIClient() + if (responseCode != 202) { // Accepted + errorCode = responseCode + errorMessage = "Received a Bad Sync Response from OOF." - AAIResourceUri networkServiceInstanceUri = (AAIResourceUri)currentNSSI['networkServiceInstanceUri'] - AAIResultWrapper wrapper = client.get(networkServiceInstanceUri); - Optional<Relationships> relationships = wrapper.getRelationships() - if (relationships.isPresent()) { - for (AAIResourceUri constituteVnfUri : relationships.get().getRelatedAAIUris(AAIObjectType.GENERIC_VNF)) { // ??? - execution.setVariable("constituteVnfUri", constituteVnfUri) - Optional<GenericVnf> constituteVnfOpt = client.get(GenericVnf.class, constituteVnfUri) - if(constituteVnfOpt.isPresent()) { - GenericVnf constituteVnf = constituteVnfOpt.get() - execution.setVariable("constituteVnf", constituteVnf) - } - else { - String msg = String.format("No constitute VNF found for Network Service Instance %s in AAI", ((ServiceInstance)currentNSSI['networkServiceInstance']).getServiceInstanceId()) - LOGGER.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } + response = "{\n" + + " \"errorCode\": \"${errorCode}\",\n" + + " \"errorMessage\": \"${errorMessage}\"\n" + + "}" + //exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.") + } - break // Should be only one constitute VNF + if (httpResponse.hasEntity()) { + response = httpResponse.readEntity(String.class) + } + else { + errorCode = 500 + errorMessage = "No response received from OOF." + + response = "{\n" + + " \"errorCode\": \"${errorCode}\",\n" + + " \"errorMessage\": \"${errorMessage}\"\n" + + "}" } } - else { - String msg = String.format("No relationship presented for Network Service Instance %s in AAI", ((ServiceInstance)currentNSSI['networkServiceInstance']).getServiceInstanceId()) - LOGGER.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + catch(Exception e) { + errorCode = 400 + errorMessage = e.getMessage() + + response = "{\n" + + " \"errorCode\": \"${errorCode}\",\n" + + " \"errorMessage\": \"${errorMessage}\"\n" + + "}" } - LOGGER.trace("${PREFIX} Exit getConstituteVNFFromNetworkServiceInst") + return response } - /** - * Retrieves NSSI associated profiles from AAI - * @param execution - */ - void getNSSIAssociatedProfiles(DelegateExecution execution) { - LOGGER.trace("${PREFIX} Start getNSSIAssociatedProfiles") + String encryptBasicAuth(String basicAuth, String msoKey) { + return utils.encrypt(basicAuth, msoKey) + } - def currentNSSI = execution.getVariable("currentNSSI") - ServiceInstance nssi = (ServiceInstance)currentNSSI['nssi'] + String getAuthHeader(DelegateExecution execution, String basicAuthValue, String msokey) { + String response = "" + String errorCode = "" + String errorMessage = "" + + LOGGER.debug("Obtained BasicAuth username and password for OOF: " + basicAuthValue) + try { + response = utils.getBasicAuth(basicAuthValue, msokey) + } catch (Exception ex) { + LOGGER.error("Unable to encode username and password string: ", ex) - List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile() + errorCode = "401" + errorMessage = "Internal Error - Unable to encode username and password string" - if(associatedProfiles.isEmpty()) { - String msg = String.format("No associated profiles found for NSSI %s in AAI", nssi.getServiceInstanceId()) - LOGGER.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - else { - execution.setVariable("associatedProfiles", associatedProfiles) + response = "{\n" + + " \"errorCode\": \"${errorCode}\",\n" + + " \"errorMessage\": \"${errorMessage}\"\n" + + "}" } - LOGGER.trace("${PREFIX} Exit getNSSIAssociatedProfiles") + return response } + /** - * Calculates a final list of S-NSSAI + * Builds OOF request * @param execution + * @return */ - void calculateSNSSAI(DelegateExecution execution) { - LOGGER.trace("${PREFIX} Start calculateSNSSAI") - - List<SliceProfile> associatedProfiles = (List<SliceProfile>)execution.getVariable("associatedProfiles") + private String buildOOFRequest(DelegateExecution execution) { def currentNSSI = execution.getVariable("currentNSSI") - String currentSNSSAI = currentNSSI['S-NSSAI'] - - List<String> snssais = new ArrayList<>() - - for(SliceProfile associatedProfile:associatedProfiles) { - if(!associatedProfile.getSNssai().equals(currentNSSI)) { // not current S-NSSAI - snssais.add(associatedProfile.getSNssai()) - } - } + String nssiId = currentNSSI['nssiId'] + String requestId = execution.getVariable("mso-request-id") - execution.setVariable("S-NSSAIs", snssais) + String request = "{\n" + + " \"type\": \"NSSI\",\n" + + " \"NxIId\": \"${nssiId}\",\n" + + " \"requestInfo\": {\n" + + " \"transactionId\": \"${requestId}\",\n" + + " \"requestId\": \"${requestId}\",\n" + + " \"sourceId\": \"so\",\n" + + " }\n" + + "}" - LOGGER.trace("${PREFIX} Exit calculateSNSSAI") + return request } + /** - * Invoke PUT Service Instance API + * Invokes deleteServiceOrder external API * @param execution */ - void invokePUTServiceInstance(DelegateExecution execution) { - LOGGER.trace("${PREFIX} Start invokePUTServiceInstance") + void deleteServiceOrder(DelegateExecution execution) { + LOGGER.trace("${PREFIX} Start deleteServiceOrder") def currentNSSI = execution.getVariable("currentNSSI") try { - //url:/onap/so/infra/serviceInstantiation/v7/serviceInstances/{serviceInstanceId}/vnfs/{vnfId}" - def nsmfЕndpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution) // ??? + //url:/nbi/api/v4/serviceOrder/" + def nbiEndpointUrl = UrnPropertiesReader.getVariable("nbi.endpoint.url", execution) ServiceInstance networkServiceInstance = (ServiceInstance)currentNSSI['networkServiceInstance'] - GenericVnf constituteVnf = (GenericVnf)execution.getVariable("constituteVnf") - - String url = String.format("${nsmfЕndpoint}/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s", networkServiceInstance.getServiceInstanceId(), constituteVnf.getVnfId()) // ??? + String url = String.format("${nbiEndpointUrl}/api/v4/serviceOrder/%s", networkServiceInstance.getServiceInstanceId()) // Service Order ID = Network Service Instance ID String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution) String basicAuth = UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution) - String basicAuthValue = utils.encrypt(basicAuth, msoKey) - String encodeString = utils.getBasicAuth(basicAuthValue, msoKey) - HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.EXTERNAL) - httpClient.addAdditionalHeader("Authorization", encodeString) - httpClient.addAdditionalHeader("Accept", "application/json") + String basicAuthValue = encryptBasicAuth(basicAuth, msoKey) + def authHeader = "" + if (basicAuthValue != null) { + String responseAuthHeader = getAuthHeader(execution, basicAuthValue, msoKey) + String errorCode = jsonUtil.getJsonValue(responseAuthHeader, "errorCode") + if(errorCode == null || errorCode.isEmpty()) { // No error + authHeader = responseAuthHeader + } + else { + exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(responseAuthHeader, "errorMessage")) + } + } else { + LOGGER.error( "Unable to obtain BasicAuth - BasicAuth value null") + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " + + "value null") + } - RequestDetails requestDetails = prepareRequestDetails(execution) - ObjectMapper mapper = new ObjectMapper() - String requestDetailsStr = mapper.writeValueAsString(requestDetails) + String callDeleteServiceOrderResponse = callDeleteServiceOrder(execution, url, authHeader) + String errorCode = jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "errorCode") + String deleteServcieResponse = "" - Response httpResponse = httpClient.put(requestDetailsStr) // check http code ??? + if(errorCode == null || errorCode.isEmpty()) { // No error + deleteServcieResponse = callDeleteServiceOrderResponse // check the response ??? + } + else { + LOGGER.error(jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "errorMessage")) + exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "errorMessage")) + } } catch (any) { String msg = "Exception in DoDeallocateCoreNSSI.deleteServiceOrder. " + any.getCause() LOGGER.error(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - LOGGER.trace("${PREFIX} Exit invokePUTServiceInstance") + LOGGER.trace("${PREFIX} Exit deleteServiceOrder") } - /** - * Prepare model info - * @param execution - * @param requestDetails - * @return - */ - private ModelInfo prepareModelInfo(DelegateExecution execution) { - ModelInfo modelInfo = new ModelInfo() - - modelInfo.setModelType(ModelType.service) - modelInfo.setModelInvariantId(networkServiceInstance.getModelInvariantId()) - - AAIResourceUri modelVerUrl = AAIUriFactory.createResourceUri(AAIObjectType.MODEL_VER, networkServiceInstance.getModelInvariantId()) // model of Network Service Instance ??? - Optional<ModelVer> modelVerOpt = client.get(ModelVer.class, modelVerUrl) - - if (modelVerOpt.isPresent()) { - modelInfo.setModelVersionId(modelVerOpt.get().getModelVersionId()) - modelInfo.setModelName(modelVerOpt.get().getModelName()) - modelInfo.setModelVersion(modelVerOpt.get().getModelVersion()) - } - - - return modelInfo - } - + String callDeleteServiceOrder(DelegateExecution execution, String urlString, String authHeader) { + String errorCode = "" + String errorMessage = "" + String response = "" - /** - * Prepares RequestDetails object - * @param execution - * @return - */ - private RequestDetails prepareRequestDetails(DelegateExecution execution) { - RequestDetails requestDetails = new RequestDetails() - - def currentNSSI = execution.getVariable("currentNSSI") - - String globalSubscriberId = currentNSSI['globalSubscriberId'] - - ServiceInstance networkServiceInstance = (ServiceInstance)currentNSSI['networkServiceInstance'] - - - AAIResourcesClient client = getAAIClient() - - // Model Info - requestDetails.setModelInfo(prepareModelInfo(execution)) - - // Subscriber Info - SubscriberInfo subscriberInfo = new SubscriberInfo() - subscriberInfo.setGlobalSubscriberId(globalSubscriberId) - - Customer customer = null - ServiceSubscription serviceSubscription = null - - AAIResourceUri networkServiceInstanceUri = currentNSSI['networkServiceInstanceUri'] - AAIResultWrapper wrapper = client.get(networkServiceInstanceUri) - Optional<Relationships> serviceSubscriptionRelationshipsOps = wrapper.getRelationships() - if(serviceSubscriptionRelationshipsOps.isPresent()) { - List<AAIResourceUri> serviceSubscriptionRelatedAAIUris = serviceSubscriptionRelationshipsOps.get().getRelatedAAIUris(AAIObjectType.SERVICE_SUBSCRIPTION) - if(!(serviceSubscriptionRelatedAAIUris == null || serviceSubscriptionRelatedAAIUris.isEmpty())) { - AAIResourceUri serviceSubscriptionUri = serviceSubscriptionRelatedAAIUris.get(0) // Many-To-One relation - Optional<ServiceSubscription> serviceSubscriptionOpt = client.get(ServiceSubscription.class, serviceSubscriptionUri) - if(serviceSubscriptionOpt.isPresent()) { - serviceSubscription = serviceSubscriptionOpt.get() - } + try { + HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(urlString), ONAPComponents.EXTERNAL) + httpClient.addAdditionalHeader("Authorization", authHeader) + httpClient.addAdditionalHeader("Accept", "application/json") + Response httpResponse = httpClient.delete() - wrapper = client.get(serviceSubscriptionUri) - Optional<Relationships> customerRelationshipsOps = wrapper.getRelationships() - if(customerRelationshipsOps.isPresent()) { - List<AAIResourceUri> customerRelatedAAIUris = customerRelationshipsOps.get().getRelatedAAIUris(AAIObjectType.CUSTOMER) - if(!(customerRelatedAAIUris == null || customerRelatedAAIUris.isEmpty())) { - Optional<Customer> customerOpt = client.get(Customer.class, customerRelatedAAIUris.get(0)) // Many-To-One relation - if(customerOpt.isPresent()) { - customer = customerOpt.get() - subscriberInfo.setSubscriberName(customer.getSubscriberName()) - } - } - } + if (httpResponse.hasEntity()) { + response = httpResponse.readEntity(String.class) } - - } - requestDetails.setSubscriberInfo(subscriberInfo) - - // Request Info - RequestInfo requestInfo = new RequestInfo() - requestInfo.setInstanceName(networkServiceInstance.getServiceInstanceName()) - - /* No found data to provide ??? - requestInfo.setSource() - requestInfo.setSuppressRollback() - requestInfo.setRequestorId() - requestInfo.setProductFamilyId() - */ - - requestDetails.setRequestInfo(requestInfo) - - - // Request Parameters - RequestParameters requestParameters = new RequestParameters() - - // No found data to provide ??? requestParameters.setaLaCarte() - requestParameters.setSubscriptionServiceType(serviceSubscription.getServiceType()) - - // User params - List<Map<String, Object>> userParams = new ArrayList<>() - // Service - Service service = new Service() - // Model Info - ModelInfo serviceModelInfo = new ModelInfo() - serviceModelInfo.setModelType(ModelType.service) - serviceModelInfo.setModelInvariantId(networkServiceInstance.getModelInvariantId()) - - serviceModelInfo.setModelVersionId(modelInfo.get().getModelVersionId()) - serviceModelInfo.setModelName(modelInfo.get().getModelName()) - serviceModelInfo.setModelVersion(modelInfo.get().getModelVersion()) - - service.setModelInfo(serviceModelInfo) - - // Resources - Resources resources = new Resources() - - CloudRegion cloudRegion = null - AAIResourceUri cloudRegionRelatedAAIUri = null - // VNFs - List<Vnfs> vnfs = new ArrayList<>() - // VNF - Vnfs vnf = new Vnfs() - - // Cloud configuration - CloudConfiguration cloudConfiguration = new CloudConfiguration() - - AAIResourceUri constituteVnfUri = (AAIResourceUri)execution.getVariable("constituteVnfUri") - wrapper = client.get(constituteVnfUri) - Optional<Relationships> constituteVnfOps = wrapper.getRelationships() - if(constituteVnfOps.isPresent()) { - List<AAIResourceUri> cloudRegionRelatedAAIUris = serviceSubscriptionRelationshipsOps.get().getRelatedAAIUris(AAIObjectType.CLOUD_REGION) - if(!(cloudRegionRelatedAAIUris == null || cloudRegionRelatedAAIUris.isEmpty())) { - cloudRegionRelatedAAIUri = cloudRegionRelatedAAIUris.get(0) - Optional<CloudRegion> cloudRegionrOpt = client.get(CloudRegion.class, cloudRegionRelatedAAIUris.get(0)) - if(cloudRegionrOpt.isPresent()) { - cloudRegion = cloudRegionrOpt.get() - cloudConfiguration.setLcpCloudRegionId(cloudRegion.getCloudRegionId()) - for(Tenant tenant:cloudRegion.getTenants()) { - cloudConfiguration.setTenantId(tenant.getTenantId()) - break // only one is required - } - - cloudConfiguration.setCloudOwner(cloudRegion.getCloudOwner()) - } - } - } - - vnf.setCloudConfiguration(cloudConfiguration) - - // VF Modules - GenericVnf constituteVnf = execution.getVariable("constituteVnf") - List<VfModules> vfModuless = new ArrayList<>() - for(VfModule vfModule:constituteVnf.getVfModules()) { - VfModules vfmodules = new VfModules() - - ModelInfo vfModuleModelInfo = new ModelInfo() - vfModuleModelInfo.setModelInvariantUuid(vfModule.getModelInvariantId()) - - AAIResourceUri vfModuleUrl = AAIUriFactory.createResourceUri(AAIObjectType.MODEL_VER, vfModule.getModelInvariantId()) // ??? - Optional<ModelVer> vfModuleModelVerOpt = client.get(ModelVer.class, vfModuleUrl) - - if (vfModuleModelVerOpt.isPresent()) { - vfModuleModelInfo.setModelVersionId(vfModuleModelVerOpt.get().getModelVersionId()) - vfModuleModelInfo.setModelName(vfModuleModelVerOpt.get().getModelName()) - vfModuleModelInfo.setModelVersion(vfModuleModelVerOpt.get().getModelVersion()) - - // No model customization ID - } - vfmodules.setModelInfo(vfModuleModelInfo) - - vfmodules.setInstanceName(vfModule.getVfModuleName()) // ??? - - vfModuless.add(vfmodules) - } - vnf.setVfModules(vfModuless) - - // Model Info - ModelInfo vnfModelInfo = new ModelInfo() - vnfModelInfo.setModelInvariantUuid(constituteVnf.getModelInvariantId()) - AAIResourceUri vnfModelUrl = AAIUriFactory.createResourceUri(AAIObjectType.MODEL_VER, constituteVnf.getModelInvariantId()) // ??? - Optional<ModelVer> vnfModelVerOpt = client.get(ModelVer.class, vnfModelUrl) - - if (vnfModelVerOpt.isPresent()) { - vnfModelInfo.setModelVersionId(vnfModelVerOpt.get().getModelVersionId()) - vnfModelInfo.setModelName(vnfModelVerOpt.get().getModelName()) - vnfModelInfo.setModelVersion(vnfModelVerOpt.get().getModelVersion()) - - // No model customization ID - // No model instance name - } - - vnf.setModelInfo(vnfModelInfo) - - // Instance name - vnf.setInstanceName(constituteVnf.getVnfInstanceId()) - - // Instance params - List<Map<String, Object>> instanceParams = new ArrayList<>() - Map<String, Object> supporrtedNSSAIMap = new HashMap<>() - - // Supported S-NSSAI - List<String> snssais = ( List<String>)execution.getVariable("S-NSSAIs") - supporrtedNSSAIMap.put("supporrtedNSSAI", snssais) // remaining S-NSSAIs ??? there is no status for each s-nssai - instanceParams.add(supporrtedNSSAIMap) - - // No other instance params, e.g. config-type - - vnf.setInstanceParams(instanceParams) - - // No platform data - - vnfs.add(vnf) - resources.setVnfs(vnfs) - - service.setResources(resources) - - Map<String, Object> serviceMap = new HashMap<>() - serviceMap.put("service", service) - userParams.add(serviceMap) - requestParameters.setUserParams(userParams) - - // No other user params - - requestDetails.setRequestParameters(requestParameters) - - // No other request params - - // Cloud configuration - requestDetails.setCloudConfiguration(cloudConfiguration) - - // Owning entity - OwningEntity owningEntity = new OwningEntity() - wrapper = client.get(networkServiceInstanceUri) - Optional<Relationships> owningEntityRelationshipsOps = wrapper.getRelationships() - if(owningEntityRelationshipsOps.isPresent()) { - List<AAIResourceUri> owningEntityRelatedAAIUris = owningEntityRelationshipsOps.get().getRelatedAAIUris(AAIObjectType.OWNING_ENTITY) - - if(!(owningEntityRelatedAAIUris == null || owningEntityRelatedAAIUris.isEmpty())) { - Optional<org.onap.aai.domain.yang.OwningEntity> owningEntityOpt = client.get(org.onap.aai.domain.yang.OwningEntity.class, owningEntityRelatedAAIUris.get(0)) // Many-To-One relation - if(owningEntityOpt.isPresent()) { - owningEntity.setOwningEntityId(owningEntityOpt.get().getOwningEntityId()) - owningEntity.setOwningEntityName(owningEntityOpt.get().getOwningEntityName()) - requestDetails.setOwningEntity(owningEntity) - } + else { + errorCode = 500 + errorMessage = "No response received." + + response = "{\n" + + " \"errorCode\": \"${errorCode}\",\n" + + " \"errorMessage\": \"${errorMessage}\"\n" + + "}" } } + catch (any) { + String msg = "Exception in DoDeallocateCoreNSSI.deleteServiceOrder. " + any.getCause() - // Project - Project project = new Project() - if(cloudRegionRelatedAAIUri != null) { - wrapper = client.get(cloudRegionRelatedAAIUri) - Optional<Relationships> cloudRegionOps = wrapper.getRelationships() - if(cloudRegionOps.isPresent()) { - List<AAIResourceUri> projectAAIUris = cloudRegionOps.get().getRelatedAAIUris(AAIObjectType.PROJECT) - if (!(projectAAIUris == null || projectAAIUris.isEmpty())) { - Optional<org.onap.aai.domain.yang.Project> projectOpt = client.get(org.onap.aai.domain.yang.Project.class, projectAAIUris.get(0)) - if(projectOpt.isPresent()) { - project.setProjectName(projectOpt.get().getProjectName()) - } - } - } + response = "{\n" + + " \"errorCode\": \"7000\",\n" + + " \"errorMessage\": \"${msg}\"\n" + + "}" } - requestDetails.setProject(project) - return requestDetails + return response } @@ -704,14 +354,14 @@ class DoDeallocateCoreNSSI extends AbstractServiceTaskProcessor { def currentNSSI = execution.getVariable("currentNSSI") - String nssiId = currentNSSI['nssiServiceInstanceId'] + String nssiId = currentNSSI['nssiId'] String nsiId = currentNSSI['nsiId'] - AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiId) - AAIResourceUri nsiUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nsiId) + AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId)) + AAIResourceUri nsiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nsiId)) try { - getAAIClient().disconnect(nssiUri, nsiUri) + client.disconnect(nssiUri, nsiUri) }catch(Exception e){ exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while NSSI association with NSI disconnect call: " + e.getMessage()) } @@ -721,74 +371,6 @@ class DoDeallocateCoreNSSI extends AbstractServiceTaskProcessor { /** - * Removes Slice Profile association with NSSI - * @param execution - */ - void removeSPAssociationWithNSSI(DelegateExecution execution) { - LOGGER.trace("${PREFIX} Start removeSPAssociationWithNSSI") - - AAIResourcesClient client = getAAIClient() - - def currentNSSI = execution.getVariable("currentNSSI") - - ServiceInstance nssi = (ServiceInstance)currentNSSI['nssi'] - - String nssiId = currentNSSI['nssiServiceInstanceId'] - AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiId) - - List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile() - - String currentSNSSAI = currentNSSI['S-NSSAI'] - - associatedProfiles.removeIf({ associatedProfile -> (associatedProfile.getSNssai().equals(currentSNSSAI)) }) - - try { - getAAIClient().update(nssiUri, nssi) - }catch(Exception e){ - exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile association with NSSI update call: " + e.getMessage()) - } - - LOGGER.trace("${PREFIX} Exit removeSPAssociationWithNSSI") - } - - - /** - * Deletes Slice Profile Instance - * @param execution - */ - void deleteSliceProfileInstance(DelegateExecution execution) { - LOGGER.trace("${PREFIX} Start deleteSliceProfileInstance") - - AAIResourcesClient client = getAAIClient() - - def currentNSSI = execution.getVariable("currentNSSI") - - ServiceInstance nssi = (ServiceInstance)currentNSSI['nssi'] - - List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile() - - String currentSNSSAI = currentNSSI['S-NSSAI'] - - AAIResourceUri sliceProfileUri = null - - for(SliceProfile associatedProfile:associatedProfiles) { - if(!associatedProfile.getSNssai().equals(currentNSSI)) { // not current S-NSSAI - sliceProfileUri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, associatedProfile.getProfileId()) - break - } - } - - try { - getAAIClient().delete(sliceProfileUri) - }catch(Exception e){ - exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile Instance delete call: " + e.getMessage()) - } - - LOGGER.trace("${PREFIX} Exit deleteSliceProfileInstance") - } - - - /** * Delets NSSI Service Instance * @param execution */ @@ -799,8 +381,8 @@ class DoDeallocateCoreNSSI extends AbstractServiceTaskProcessor { def currentNSSI = execution.getVariable("currentNSSI") - String nssiId = currentNSSI['nssiServiceInstanceId'] - AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiId) + String nssiId = currentNSSI['nssiId'] + AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId)) try { getAAIClient().delete(nssiUri) @@ -812,33 +394,10 @@ class DoDeallocateCoreNSSI extends AbstractServiceTaskProcessor { } - /** - * Updates operation status - * @param execution - */ - void updateServiceOperationStatus(DelegateExecution execution) { - LOGGER.trace("${PREFIX} Start updateServiceOperationStatus") - - def currentNSSI = execution.getVariable("currentNSSI") - - OperationStatus operationStatus = new OperationStatus() - operationStatus.setServiceId(currentNSSI['e2eServiceInstanceId'] as String) - operationStatus.setOperationId(currentNSSI['operationId'] as String) - operationStatus.setOperation(currentNSSI['operationType'] as String) - operationStatus.setResult(RequestsDbConstant.Status.FINISHED) - - requestDBUtil.prepareUpdateOperationStatus(execution, operationStatus) - - LOGGER.trace("${PREFIX} Exit updateServiceOperationStatus") - } - - /** - * Returns AAI client - * @return AAI client - */ - AAIResourcesClient getAAIClient() { - return new AAIResourcesClient() + @Override + String getPrefix() { + return PREFIX } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy index 0c795b3bd1..9d6c4a1b2a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy @@ -19,34 +19,26 @@ */ package org.onap.so.bpmn.infrastructure.scripts -import com.fasterxml.jackson.databind.ObjectMapper import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.logging.filter.base.ONAPComponents +import org.json.JSONObject +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.so.beans.nsmf.DeAllocateNssi -import org.onap.so.beans.nsmf.ServiceInfo import org.onap.so.beans.nsmf.EsrInfo -import org.onap.so.beans.nsmf.JobStatusRequest -import org.onap.so.beans.nsmf.JobStatusResponse import org.onap.so.beans.nsmf.NetworkType -import org.onap.so.beans.nsmf.NssiDeAllocateRequest import org.onap.so.beans.nsmf.NssiResponse +import org.onap.so.beans.nsmf.ServiceInfo import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils import org.onap.so.bpmn.common.scripts.RequestDBUtil -import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.domain.ServiceArtifact import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.json.JsonUtils -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.so.db.request.beans.OperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.json.JSONObject -import javax.ws.rs.core.Response class DoDeallocateNSSI extends AbstractServiceTaskProcessor @@ -322,7 +314,8 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor try { LOGGER.debug("delete nssiServiceInstanceId:${nssiServiceInstanceId}, profileId:${profileId}") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, globalSubscriberId, serviceType, nssiServiceInstanceId, profileId) + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiServiceInstanceId).sliceProfile(profileId)) if (!getAAIClient().exists(resourceUri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy index 7681bf9346..a410b93d16 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy @@ -29,6 +29,8 @@ 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.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.RequestDBUtil @@ -111,10 +113,7 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor { void deleteServiceInstance(DelegateExecution execution) { try { AAIResourcesClient client = getAAIClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - execution.getVariable("globalSubscriberId"), - execution.getVariable("subscriptionServiceType"), - execution.getVariable("serviceInstanceID")) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("serviceInstanceID"))) client.delete(uri) } catch (BpmnError e) { throw e @@ -134,7 +133,7 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor { ServiceInstance si = new ServiceInstance() si.setOrchestrationStatus(orchStatus) AAIResourcesClient client = getAAIClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, tnNssiId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(tnNssiId)) client.update(uri, si) } catch (BpmnError e) { throw e diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index 0a7753e9e5..ef94ff1d16 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -52,6 +52,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.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.logging.filter.base.ONAPComponents; @@ -176,7 +178,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String globalSubscriberId = execution.getVariable('globalSubscriberId') String serviceType = execution.getVariable('serviceType') AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId)) if (!resourceClient.exists(serviceInstanceUri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") } @@ -658,7 +660,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable("serviceInstanceId") AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId) + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId)) resourceClient.delete(serviceInstanceUri) logger.trace("Exited deleteServiceInstance") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy index bee9ad260b..02200284df 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy @@ -32,6 +32,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.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.logging.filter.base.ErrorCode import org.onap.logging.filter.base.ONAPComponents; @@ -256,7 +257,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { ExceptionUtil exceptionUtil = new ExceptionUtil() Boolean isVfRelationshipExist = false try { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ALL) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)).depth(Depth.ALL) Optional<L3Network> l3Network = getAAIClient().get(L3Network.class,uri); AAIResultWrapper wrapper = getAAIClient().get(uri); Optional<Relationships> relationships = wrapper.getRelationships() @@ -266,13 +267,13 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "queryAAIResponse", l3Network.get()) execution.setVariable(Prefix + "isAAIGood", true) if (relationships.isPresent()){ - if(!relationships.get().getRelatedAAIUris(AAIObjectType.VF_MODULE).isEmpty()){ + if(!relationships.get().getRelatedUris(Types.VF_MODULE).isEmpty()){ execution.setVariable(Prefix + "isVfRelationshipExist", true) isVfRelationshipExist = true String relationshipMessage = "AAI Query Success Response but 'vf-module' relationship exist, not allowed to delete: network Id: " + networkId exceptionUtil.buildWorkflowException(execution, 2500, relationshipMessage) }else{ - List<AAIResourceUri> tenantURIList = relationships.get().getRelatedAAIUris(AAIObjectType.TENANT) + List<AAIResourceUri> tenantURIList = relationships.get().getRelatedUris(Types.TENANT) for(AAIResourceUri tenantURI: tenantURIList){ if(execution.getVariable(Prefix + "tenantId") == null) { String tenantId = tenantURI.getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId) @@ -280,7 +281,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { logger.debug(" Get AAI getTenantId() : " + tenantId) } } - List<AAIResourceUri> cloudRegionURIList = relationships.get().getRelatedAAIUris(AAIObjectType.CLOUD_REGION) + List<AAIResourceUri> cloudRegionURIList = relationships.get().getRelatedUris(Types.CLOUD_REGION) for(AAIResourceUri tenantURI: cloudRegionURIList){ if(execution.getVariable(Prefix + "lcpCloudRegion") == null) { String lcpCloudRegion = tenantURI.getURIKeys().get(AAIFluentTypeBuilder.Types.CLOUD_REGION.getUriParams().cloudRegionId) @@ -322,7 +323,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { // Prepare AA&I url AaiUtil aaiUtil = new AaiUtil(this) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion)) def queryCloudRegionRequest = aaiUtil.createAaiUri(uri) execution.setVariable(Prefix + "queryCloudRegionRequest", queryCloudRegionRequest) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy index cda7c321ac..85cbf32989 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy @@ -32,6 +32,7 @@ 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.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils @@ -285,7 +286,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable('serviceInstanceId') AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)) if(resourceClient.exists(uri)){ execution.setVariable("GENGS_FoundIndicator", true) @@ -307,9 +308,9 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { AAIResultWrapper wrapper = resourceClient.get(uri) if(wrapper.getRelationships().isPresent()){ - List<AAIResourceUri> uriList = wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.ALLOTTED_RESOURCE) - uriList.addAll(wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.GENERIC_VNF)) - uriList.addAll(wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.L3_NETWORK)) + List<AAIResourceUri> uriList = wrapper.getRelationships().get().getRelatedUris(Types.ALLOTTED_RESOURCE) + uriList.addAll(wrapper.getRelationships().get().getRelatedUris(Types.GENERIC_VNF)) + uriList.addAll(wrapper.getRelationships().get().getRelatedUris(Types.L3_NETWORK)) if(uriList.isEmpty()){ Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) @@ -372,7 +373,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable("serviceInstanceId") AAIResourcesClient resourceClient = new AAIResourcesClient(); - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId) + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId)) resourceClient.delete(serviceInstanceUri) logger.trace("Exited deleteServiceInstance") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy index 2f78c3d551..c4321220fd 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy @@ -19,6 +19,9 @@ */ package org.onap.so.bpmn.infrastructure.scripts +import static org.apache.commons.lang3.StringUtils.isBlank +import javax.ws.rs.NotFoundException +import javax.ws.rs.core.Response import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.AllottedResource @@ -27,21 +30,20 @@ import org.onap.aai.domain.yang.Relationship import org.onap.aai.domain.yang.ServiceInstance import org.onap.aai.domain.yang.ServiceProfile import org.onap.aai.domain.yang.ServiceProfiles +import org.onap.aaiclient.client.aai.AAIObjectName +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +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.ONAPComponents import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.OofUtils -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.so.bpmn.core.UrnPropertiesReader import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory -import javax.ws.rs.core.Response -import javax.ws.rs.NotFoundException - -import static org.apache.commons.lang3.StringUtils.isBlank /** * This groovy class supports the <class>DoDeleteSliceService.bpmn</class> process. @@ -104,7 +106,7 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { try { String errorMsg = "query e2e slice service from aai failed" - AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, serviceInstanceId, errorMsg) + AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, serviceInstanceId, errorMsg) Optional<ServiceInstance> si =wrapper.asBean(ServiceInstance.class) if(si.isPresent()) { @@ -121,7 +123,7 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { if (relatedTo.toLowerCase() == "service-instance") { String relatioshipurl = relationship.getRelatedLink() String instanceId = relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length()) - AAIResultWrapper wrapper1 = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, instanceId, errorMsg) + AAIResultWrapper wrapper1 = queryAAI(execution, Types.SERVICE_INSTANCE, instanceId, errorMsg) Optional<ServiceInstance> serviceInstance = wrapper1.asBean(ServiceInstance.class) if (serviceInstance.isPresent()) { ServiceInstance instance = serviceInstance.get() @@ -156,7 +158,7 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { try { String errorMsg = "query allotted resource from aai failed." - AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.ALLOTTED_RESOURCE_ALL, serviceInstanceId, errorMsg) + AAIResultWrapper wrapper = queryAAI(execution, Types.ALLOTTED_RESOURCES, serviceInstanceId, errorMsg) Optional<AllottedResources> ars = wrapper?.asBean(AllottedResources.class) if(ars.isPresent() && ars.get().getAllottedResource()) { @@ -191,7 +193,7 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { try { String errorMsg = "query nsi from aai failed." - AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, nsiId, errorMsg) + AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, nsiId, errorMsg) Optional<ServiceInstance> si =wrapper.asBean(ServiceInstance.class) List<String> nssiIdList = [] String msg = "nsiId:${nsiId},nssiIdList:" @@ -205,7 +207,7 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { { String relatedLink = relationship.getRelatedLink()?:"" String instanceId = relatedLink ? relatedLink.substring(relatedLink.lastIndexOf("/") + 1,relatedLink.length()) : "" - AAIResultWrapper wrapper1 = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, instanceId, errorMsg) + AAIResultWrapper wrapper1 = queryAAI(execution, Types.SERVICE_INSTANCE, instanceId, errorMsg) Optional<ServiceInstance> serviceInstance = wrapper1.asBean(ServiceInstance.class) if (serviceInstance.isPresent()) { ServiceInstance instance = serviceInstance.get() @@ -245,7 +247,7 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { String errorMsg = "query nssi list from aai failed" for(String nssiId : nssiIdList) { - AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, nssiId, errorMsg) + AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, nssiId, errorMsg) Optional<ServiceInstance> si =wrapper.asBean(ServiceInstance.class) if(si.isPresent()) { @@ -329,21 +331,30 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { /** * query AAI * @param execution - * @param aaiObjectType + * @param aaiObjectName * @param instanceId * @return AAIResultWrapper */ - private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectType aaiObjectType, String instanceId, String errorMsg) + private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectName aaiObjectName, String instanceId, String errorMsg) { LOGGER.trace(" *****${PREFIX} Start queryAAI *****") String globalSubscriberId = execution.getVariable("globalSubscriberId") String serviceType = execution.getVariable("serviceType") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(aaiObjectType, globalSubscriberId, serviceType, instanceId) - if (!getAAIClient().exists(resourceUri)) { + org.onap.aaiclient.client.generated.fluentbuilders.ServiceInstance serviceInstanceType = AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(instanceId) + def type + if (aaiObjectName == Types.ALLOTTED_RESOURCES) { + type = serviceInstanceType.allottedResources() + } else if (aaiObjectName == Types.SLICE_PROFILES) { + type = serviceInstanceType.sliceProfiles() + } else { + type = serviceInstanceType + } + def uri = AAIUriFactory.createResourceUri(type) + if (!getAAIClient().exists(uri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMsg) } - AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class) + AAIResultWrapper wrapper = getAAIClient().get(uri, NotFoundException.class) LOGGER.trace(" *****${PREFIX} Exit queryAAI *****") return wrapper } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy index 42f4cb7bd7..1ec11c67e9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy @@ -32,6 +32,8 @@ import org.onap.so.client.HttpClientFactory 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 import org.onap.logging.filter.base.ONAPComponents; @@ -121,8 +123,8 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces String globalSubscriberId = execution.getVariable("globalSubscriberId") String serviceType = execution.getVariable("serviceType") String serviceId = execution.getVariable("serviceId") - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceId) - AAIResourceUri nsServiceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nsInstanceId) + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceId)) + AAIResourceUri nsServiceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nsInstanceId)) try { getAAIClient().disconnect(serviceInstanceUri, nsServiceInstanceUri) }catch(Exception e){ diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy index 33a1ece091..3bc8daa98c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy @@ -39,11 +39,12 @@ import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.aaiclient.client.aai.AAIObjectPlurals import org.onap.aaiclient.client.aai.AAIObjectType 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.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -486,7 +487,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ for (i in 0..fqdnCount-1) { String fqdn = fqdnList[i] // Query AAI for this network policy FQDN - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies()) uri.queryParam("network-policy-fqdn", fqdn) try { Optional<NetworkPolicies> networkPolicies = getAAIClient().get(NetworkPolicies.class, uri) @@ -498,7 +499,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ def networkPolicyId = networkPolicy.getNetworkPolicyId() logger.debug("Deleting network-policy with network-policy-id " + networkPolicyId) try { - AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId) + AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicyId)) getAAIClient().delete(delUri) execution.setVariable("DoDVfMod_aaiDeleteNetworkPolicyReturnCode", 200) } catch (Exception e) { @@ -606,7 +607,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ def vnfId = execution.getVariable('vnfId') def vfModuleId = execution.getVariable('vfModuleId') - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)) try { Optional<org.onap.aai.domain.yang.VfModule> vfModule = getAAIClient().get(org.onap.aai.domain.yang.VfModule.class, uri); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy index 786cd3d747..00bebdf54a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy @@ -41,11 +41,12 @@ import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.aaiclient.client.graphinventory.entities.uri.Depth -import org.onap.aaiclient.client.aai.AAIObjectPlurals import org.onap.aaiclient.client.aai.AAIObjectType 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.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -142,7 +143,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { try { def vnfId = execution.getVariable('vnfId') - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE) try { Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class,uri) @@ -514,7 +515,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { // Query AAI for this network policy FQDN - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies()) uri.queryParam("network-policy-fqdn", fqdn) try { @@ -530,7 +531,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { // Retrieve the resource version for this network policy try { - AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId) + AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicyId)) getAAIClient().delete(delUri) execution.setVariable("DDVFMV_aaiDeleteNetworkPolicyReturnCode", 200) logger.debug(" ***** AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + 200) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy index 355b5f77c0..22b16d0e82 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy @@ -32,6 +32,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.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -122,7 +123,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{ String cloudRegion = execution.getVariable('lcpCloudRegionId') AaiUtil aaiUtil = new AaiUtil(this) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion)) def queryCloudRegionRequest = aaiUtil.createAaiUri(uri) cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) @@ -159,7 +160,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{ String cloudRegion = execution.getVariable(prefix+'aicCloudRegion') try { - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP , Defaults.CLOUD_OWNER.toString(), cloudRegion,volumeGroupId) + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion).volumeGroup(volumeGroupId)) Optional<VolumeGroup> volumeGroupOps = getAAIClient().get(VolumeGroup.class,resourceUri) if(volumeGroupOps.present) { VolumeGroup volumeGroup = volumeGroupOps.get() @@ -173,11 +174,11 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{ String volumeGroupTenantId = null if(relationships.isPresent()){ - if(relationships.get().getRelatedAAIUris(AAIObjectType.VF_MODULE)){ + if(relationships.get().getRelatedUris(Types.VF_MODULE)){ logger.debug('Volume Group ' + volumeGroupId + ' currently in use') exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} currently in use - found vf-module relationship.") } - for(AAIResourceUri aaiResourceUri: relationships.get().getRelatedAAIUris(AAIObjectType.TENANT)){ + for(AAIResourceUri aaiResourceUri: relationships.get().getRelatedUris(Types.TENANT)){ volumeGroupTenantId = aaiResourceUri.getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId) } } @@ -264,7 +265,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{ String cloudRegion = execution.getVariable(prefix+'aicCloudRegion') try { - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,Defaults.CLOUD_OWNER.toString(), cloudRegion, volumeGroupId) + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion).volumeGroup(volumeGroupId)) getAAIClient().delete(resourceUri) logger.debug("Volume group $volumeGroupId deleted.") }catch (NotFoundException ex) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy index 25fbc93c0a..181e62ee4c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.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.w3c.dom.Document import org.w3c.dom.Element import org.w3c.dom.Node @@ -104,14 +106,14 @@ class DoDeleteVnf extends AbstractServiceTaskProcessor { try { AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, execution.getVariable('vnfId')) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(execution.getVariable('vnfId'))) if(resourceClient.exists(uri)){ execution.setVariable("GENGV_FoundIndicator", true) AAIResultWrapper wrapper = resourceClient.get(uri.depth(Depth.ONE)) if(wrapper.getRelationships().isPresent()){ - List<AAIResourceUri> relationships = wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.CLOUD_REGION) - relationships.addAll(wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.L3_NETWORK)) + List<AAIResourceUri> relationships = wrapper.getRelationships().get().getRelatedUris(Types.CLOUD_REGION) + relationships.addAll(wrapper.getRelationships().get().getRelatedUris(Types.L3_NETWORK)) if(!relationships.isEmpty()){ execution.setVariable("DoDVNF_vnfInUse", true) }else{ @@ -148,7 +150,7 @@ class DoDeleteVnf extends AbstractServiceTaskProcessor { String vnfId = execution.getVariable("DoDVNF_vnfId") AAIResourcesClient resourceClient = new AAIResourcesClient(); - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) resourceClient.delete(uri) logger.trace("COMPLETED deleteVnf") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy index 2a0cb5e610..5d1e2a2eae 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy @@ -44,6 +44,8 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.aaiclient.client.graphinventory.entities.uri.Depth 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.aai.AAIObjectType import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum @@ -263,7 +265,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { try { def vnfId = execution.getVariable('vnfId') - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE) try { Optional<GenericVnf> genericVnfOp = getAAIClient().get(GenericVnf.class,uri) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy index 2e7e728b44..f591855b5c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy @@ -51,6 +51,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 javax.ws.rs.NotFoundException class DoModifyAccessNSSI extends AbstractServiceTaskProcessor { @@ -588,8 +590,7 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor { Map<String,ServiceInstance> relatedInstances = new HashMap<>() AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, subscriptionServiceType, instanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(instanceId)) if (!client.exists(uri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai : ${instanceId}") } @@ -605,8 +606,7 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor { relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length()) AAIResourcesClient client01 = new AAIResourcesClient() - AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, subscriptionServiceType, serviceInstanceId) + AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId)) if (!client.exists(uri01)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai: ${serviceInstanceId} related to ${instanceId}") @@ -631,8 +631,7 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor { String subscriptionServiceType = execution.getVariable("subscriptionServiceType") ServiceInstance serviceInstance = new ServiceInstance() AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalSubscriberId, subscriptionServiceType, instanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(instanceId)) if (!client.exists(uri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai : ${instanceId}") } @@ -646,7 +645,7 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor { } private void deleteServiceInstanceInAAI(DelegateExecution execution,String instanceId) { try { - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), instanceId) + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("serviceType")).serviceInstance(instanceId)) getAAIClient().delete(serviceInstanceUri) logger.debug("${Prefix} Exited deleteServiceInstance") }catch(Exception e){ diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSI.groovy index 6c12a656f4..ebeab3eb7d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSI.groovy @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Telecom Italia + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.bpmn.infrastructure.scripts import com.fasterxml.jackson.databind.ObjectMapper @@ -19,6 +39,8 @@ 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.logging.filter.base.ONAPComponents import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -47,7 +69,7 @@ import org.slf4j.LoggerFactory import javax.ws.rs.core.Response -class DoModifyCoreNSSI extends AbstractServiceTaskProcessor { +class DoModifyCoreNSSI extends DoCommonCoreNSSI { private final String PREFIX ="DoModifyCoreNSSI" @@ -58,502 +80,6 @@ class DoModifyCoreNSSI extends AbstractServiceTaskProcessor { private static final Logger LOGGER = LoggerFactory.getLogger( DoModifyCoreNSSI.class) - @Override - void preProcessRequest(DelegateExecution execution) { - LOGGER.trace("${PREFIX} Start preProcessRequest") - - def currentNSSI = execution.getVariable("currentNSSI") - if (!currentNSSI) { - String msg = "currentNSSI is null" - LOGGER.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - LOGGER.trace("***** ${PREFIX} Exit preProcessRequest") - } - - - /** - * Queries Network Service Instance in AAI - * @param execution - */ - void getNetworkServiceInstance(DelegateExecution execution) { - LOGGER.trace("${PREFIX} Start getNetworkServiceInstance") - - AAIResourcesClient client = getAAIClient() - - def currentNSSI = execution.getVariable("currentNSSI") - - String globalSubscriberId = currentNSSI['globalSubscriberId'] - String serviceType = currentNSSI['serviceType'] - String nssiId = currentNSSI['nssiServiceInstanceId'] - - AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiId) //AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nssiId) - Optional<ServiceInstance> nssiOpt = client.get(ServiceInstance.class, nssiUri) - - if (nssiOpt.isPresent()) { - ServiceInstance nssi = nssiOpt.get() - execution.setVariable("nssi", nssi) - - execution.setVariable("nssiUri", nssiUrl) - - // Network Service Instance - AAIResultWrapper wrapper = client.get(nssiUri); - Optional<Relationships> relationships = wrapper.getRelationships() - if (relationships.isPresent()) { - for(AAIResourceUri networkServiceInstanceUri: relationships.get().getRelatedAAIUris(AAIObjectType.SERVICE_INSTANCE)){ // ??? - Optional<ServiceInstance> networkServiceInstanceOpt = client.get(ServiceInstance.class, networkServiceInstanceUri) - if(networkServiceInstanceOpt.isPresent()) { - ServiceInstance networkServiceInstance = networkServiceInstanceOpt.get() - - if(networkServiceInstance.getServiceRole().equals("Network Service")) { // Network Service - execution.setVariable("networkServiceInstance", networkServiceInstance) - - execution.setVariable("networkServiceInstanceUri", networkServiceInstanceUri) - break // Should be only one Network Service Instance - } - } - else { - String msg = String.format("No Network Service Instance found for NSSI %s in AAI", nssiId) - LOGGER.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - - } - } - else { - String msg = String.format("No relationship presented for NSSI %s in AAI", nssiId) - LOGGER.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - else { - String msg = String.format("NSSI %s not found in AAI", nssiId) - LOGGER.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - - - LOGGER.trace("***** ${PREFIX} Exit getNetworkServiceInstance") - } - - - /** - * Queries constitute VNF from Network Service Instance - * @param execution - */ - void getConstituteVNFFromNetworkServiceInst(DelegateExecution execution) { - LOGGER.trace("${PREFIX} Start getConstituteVNFFromNetworkServiceInst") - - AAIResourcesClient client = getAAIClient() - - AAIResourceUri networkServiceInstanceUri = (AAIResourceUri)execution.getVariable("networkServiceInstanceUri") - AAIResultWrapper wrapper = client.get(networkServiceInstanceUri); - Optional<Relationships> relationships = wrapper.getRelationships() - if (relationships.isPresent()) { - for (AAIResourceUri constituteVnfUri : relationships.get().getRelatedAAIUris(AAIObjectType.GENERIC_VNF)) { // ??? - execution.setVariable("constituteVnfUri", constituteVnfUri) - Optional<GenericVnf> constituteVnfOpt = client.get(GenericVnf.class, constituteVnfUri) - if(constituteVnfOpt.isPresent()) { - GenericVnf constituteVnf = constituteVnfOpt.get() - execution.setVariable("constituteVnf", constituteVnf) - } - else { - String msg = String.format("No constitute VNF found for Network Service Instance %s in AAI", ((ServiceInstance)execution.getVariable("networkServiceInstance")).getServiceInstanceId()) - LOGGER.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - - execution.setVariable("networkServiceInstanceUri", networkServiceInstanceUri) - break // Should be only one constitute VNF - } - } - else { - String msg = String.format("No relationship presented for Network Service Instance %s in AAI", ((ServiceInstance)execution.getVariable("networkServiceInstance")).getServiceInstanceId()) - LOGGER.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - - LOGGER.trace("${PREFIX} Exit getConstituteVNFFromNetworkServiceInst") - - } - - - /** - * Retrieves NSSI associated profiles from AAI - * @param execution - */ - void getNSSIAssociatedProfiles(DelegateExecution execution) { - LOGGER.trace("${PREFIX} Start getNSSIAssociatedProfiles") - - AAIResourcesClient client = getAAIClient() - - ServiceInstance nssi = (ServiceInstance)execution.getVariable("nssi") - - List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile() - - if(associatedProfiles.isEmpty()) { - String msg = String.format("No associated profiles found for NSSI %s in AAI", nssi.getServiceInstanceId()) - LOGGER.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - else { - execution.setVariable("associatedProfiles", associatedProfiles) - } - - LOGGER.trace("${PREFIX} Exit getNSSIAssociatedProfiles") - } - - - /** - * Calculates a final list of S-NSSAI - * @param execution - */ - void calculateSNSSAI(DelegateExecution execution) { - LOGGER.trace("${PREFIX} Start calculateSNSSAI") - - List<SliceProfile> associatedProfiles = (List<SliceProfile>)execution.getVariable("associatedProfiles") - - def currentNSSI = execution.getVariable("currentNSSI") - - String currentSNSSAI = currentNSSI['S-NSSAI'] - - List<String> snssais = new ArrayList<>() - - if((Boolean)execution.getVariable("isCreateSliceProfileInstance" ).equals(Boolean.TRUE)) { // Slice Profile Instance has to be created - for (SliceProfile associatedProfile : associatedProfiles) { - snssais.add(associatedProfile.getSNssai()) - } - - snssais.add(currentSNSSAI) - } - else { // Slice profile instance has to be deleted - for (SliceProfile associatedProfile : associatedProfiles) { - if (!associatedProfile.getSNssai().equals(currentNSSI)) { // not current S-NSSAI - snssais.add(associatedProfile.getSNssai()) - } - } - } - - execution.setVariable("S-NSSAIs", snssais) - - LOGGER.trace("${PREFIX} Exit calculateSNSSAI") - } - - - /** - * Invoke PUT Service Instance API - * @param execution - */ - void invokePUTServiceInstance(DelegateExecution execution) { - LOGGER.trace("${PREFIX} Start invokePUTServiceInstance") - - try { - //url:/onap/so/infra/serviceInstantiation/v7/serviceInstances/{serviceInstanceId}/vnfs/{vnfId}" - def nsmfЕndpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution) // ??? - - ServiceInstance networkServiceInstance = (ServiceInstance)execution.getVariable("networkServiceInstance") - - GenericVnf constituteVnf = (GenericVnf)execution.getVariable("constituteVnf") - - String url = String.format("${nsmfЕndpoint}/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s", networkServiceInstance.getServiceInstanceId(), constituteVnf.getVnfId()) // ??? - - String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution) - String basicAuth = UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution) - String basicAuthValue = utils.encrypt(basicAuth, msoKey) - String encodeString = utils.getBasicAuth(basicAuthValue, msoKey) - - HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.EXTERNAL) - httpClient.addAdditionalHeader("Authorization", encodeString) - httpClient.addAdditionalHeader("Accept", "application/json") - - RequestDetails requestDetails = prepareRequestDetails(execution) - ObjectMapper mapper = new ObjectMapper() - String requestDetailsStr = mapper.writeValueAsString(requestDetails) - - Response httpResponse = httpClient.put(requestDetailsStr) // check http code ??? - } catch (any) { - String msg = "Exception in DoDeallocateCoreNSSI.deleteServiceOrder. " + any.getCause() - LOGGER.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - - LOGGER.trace("${PREFIX} Exit invokePUTServiceInstance") - } - - - /** - * Prepare model info - * @param execution - * @param requestDetails - * @return - */ - private ModelInfo prepareModelInfo(DelegateExecution execution) { - ModelInfo modelInfo = new ModelInfo() - - modelInfo.setModelType(ModelType.service) - modelInfo.setModelInvariantId(networkServiceInstance.getModelInvariantId()) - - AAIResourceUri modelVerUrl = AAIUriFactory.createResourceUri(AAIObjectType.MODEL_VER, networkServiceInstance.getModelInvariantId()) // model of Network Service Instance ??? - Optional<ModelVer> modelVerOpt = client.get(ModelVer.class, modelVerUrl) - - if (modelVerOpt.isPresent()) { - modelInfo.setModelVersionId(modelVerOpt.get().getModelVersionId()) - modelInfo.setModelName(modelVerOpt.get().getModelName()) - modelInfo.setModelVersion(modelVerOpt.get().getModelVersion()) - } - - - return modelInfo - } - - - /** - * Prepares RequestDetails object - * @param execution - * @return - */ - private RequestDetails prepareRequestDetails(DelegateExecution execution) { - RequestDetails requestDetails = new RequestDetails() - - def currentNSSI = execution.getVariable("currentNSSI") - - String globalSubscriberId = currentNSSI['globalSubscriberId'] - - ServiceInstance networkServiceInstance = (ServiceInstance)execution.getVariable("networkServiceInstance") - - - AAIResourcesClient client = getAAIClient() - - // Model Info - requestDetails.setModelInfo(prepareModelInfo(execution)) - - // Subscriber Info - SubscriberInfo subscriberInfo = new SubscriberInfo() - subscriberInfo.setGlobalSubscriberId(globalSubscriberId) - - Customer customer = null - ServiceSubscription serviceSubscription = null - - AAIResourceUri networkServiceInstanceUri = execution.getVariable("networkServiceInstanceUri") - AAIResultWrapper wrapper = client.get(networkServiceInstanceUri) - Optional<Relationships> serviceSubscriptionRelationshipsOps = wrapper.getRelationships() - if(serviceSubscriptionRelationshipsOps.isPresent()) { - List<AAIResourceUri> serviceSubscriptionRelatedAAIUris = serviceSubscriptionRelationshipsOps.get().getRelatedAAIUris(AAIObjectType.SERVICE_SUBSCRIPTION) - if(!(serviceSubscriptionRelatedAAIUris == null || serviceSubscriptionRelatedAAIUris.isEmpty())) { - AAIResourceUri serviceSubscriptionUri = serviceSubscriptionRelatedAAIUris.get(0) // Many-To-One relation - Optional<ServiceSubscription> serviceSubscriptionOpt = client.get(ServiceSubscription.class, serviceSubscriptionUri) - if(serviceSubscriptionOpt.isPresent()) { - serviceSubscription = serviceSubscriptionOpt.get() - } - - wrapper = client.get(serviceSubscriptionUri) - Optional<Relationships> customerRelationshipsOps = wrapper.getRelationships() - if(customerRelationshipsOps.isPresent()) { - List<AAIResourceUri> customerRelatedAAIUris = customerRelationshipsOps.get().getRelatedAAIUris(AAIObjectType.CUSTOMER) - if(!(customerRelatedAAIUris == null || customerRelatedAAIUris.isEmpty())) { - Optional<Customer> customerOpt = client.get(Customer.class, customerRelatedAAIUris.get(0)) // Many-To-One relation - if(customerOpt.isPresent()) { - customer = customerOpt.get() - subscriberInfo.setSubscriberName(customer.getSubscriberName()) - } - } - } - } - - } - requestDetails.setSubscriberInfo(subscriberInfo) - - // Request Info - RequestInfo requestInfo = new RequestInfo() - requestInfo.setInstanceName(networkServiceInstance.getServiceInstanceName()) - - /* No found data to provide ??? - requestInfo.setSource() - requestInfo.setSuppressRollback() - requestInfo.setRequestorId() - requestInfo.setProductFamilyId() - */ - - requestDetails.setRequestInfo(requestInfo) - - - // Request Parameters - RequestParameters requestParameters = new RequestParameters() - - // No found data to provide ??? requestParameters.setaLaCarte() - requestParameters.setSubscriptionServiceType(serviceSubscription.getServiceType()) - - // User params - List<Map<String, Object>> userParams = new ArrayList<>() - // Service - Service service = new Service() - // Model Info - ModelInfo serviceModelInfo = new ModelInfo() - serviceModelInfo.setModelType(ModelType.service) - serviceModelInfo.setModelInvariantId(networkServiceInstance.getModelInvariantId()) - - serviceModelInfo.setModelVersionId(modelInfo.get().getModelVersionId()) - serviceModelInfo.setModelName(modelInfo.get().getModelName()) - serviceModelInfo.setModelVersion(modelInfo.get().getModelVersion()) - - service.setModelInfo(serviceModelInfo) - - // Resources - Resources resources = new Resources() - - CloudRegion cloudRegion = null - AAIResourceUri cloudRegionRelatedAAIUri = null - // VNFs - List<Vnfs> vnfs = new ArrayList<>() - // VNF - Vnfs vnf = new Vnfs() - - // Cloud configuration - CloudConfiguration cloudConfiguration = new CloudConfiguration() - - AAIResourceUri constituteVnfUri = (AAIResourceUri)execution.getVariable("constituteVnfUri") - wrapper = client.get(constituteVnfUri) - Optional<Relationships> constituteVnfOps = wrapper.getRelationships() - if(constituteVnfOps.isPresent()) { - List<AAIResourceUri> cloudRegionRelatedAAIUris = serviceSubscriptionRelationshipsOps.get().getRelatedAAIUris(AAIObjectType.CLOUD_REGION) - if(!(cloudRegionRelatedAAIUris == null || cloudRegionRelatedAAIUris.isEmpty())) { - cloudRegionRelatedAAIUri = cloudRegionRelatedAAIUris.get(0) - Optional<CloudRegion> cloudRegionrOpt = client.get(CloudRegion.class, cloudRegionRelatedAAIUris.get(0)) - if(cloudRegionrOpt.isPresent()) { - cloudRegion = cloudRegionrOpt.get() - cloudConfiguration.setLcpCloudRegionId(cloudRegion.getCloudRegionId()) - for(Tenant tenant:cloudRegion.getTenants()) { - cloudConfiguration.setTenantId(tenant.getTenantId()) - break // only one is required - } - - cloudConfiguration.setCloudOwner(cloudRegion.getCloudOwner()) - } - } - } - - vnf.setCloudConfiguration(cloudConfiguration) - - // VF Modules - GenericVnf constituteVnf = execution.getVariable("constituteVnf") - List<VfModules> vfModuless = new ArrayList<>() - for(VfModule vfModule:constituteVnf.getVfModules()) { - VfModules vfmodules = new VfModules() - - ModelInfo vfModuleModelInfo = new ModelInfo() - vfModuleModelInfo.setModelInvariantUuid(vfModule.getModelInvariantId()) - - AAIResourceUri vfModuleUrl = AAIUriFactory.createResourceUri(AAIObjectType.MODEL_VER, vfModule.getModelInvariantId()) // ??? - Optional<ModelVer> vfModuleModelVerOpt = client.get(ModelVer.class, vfModuleUrl) - - if (vfModuleModelVerOpt.isPresent()) { - vfModuleModelInfo.setModelVersionId(vfModuleModelVerOpt.get().getModelVersionId()) - vfModuleModelInfo.setModelName(vfModuleModelVerOpt.get().getModelName()) - vfModuleModelInfo.setModelVersion(vfModuleModelVerOpt.get().getModelVersion()) - - // No model customization ID - } - vfmodules.setModelInfo(vfModuleModelInfo) - - vfmodules.setInstanceName(vfModule.getVfModuleName()) // ??? - - vfModuless.add(vfmodules) - } - vnf.setVfModules(vfModuless) - - // Model Info - ModelInfo vnfModelInfo = new ModelInfo() - vnfModelInfo.setModelInvariantUuid(constituteVnf.getModelInvariantId()) - AAIResourceUri vnfModelUrl = AAIUriFactory.createResourceUri(AAIObjectType.MODEL_VER, constituteVnf.getModelInvariantId()) // ??? - Optional<ModelVer> vnfModelVerOpt = client.get(ModelVer.class, vnfModelUrl) - - if (vnfModelVerOpt.isPresent()) { - vnfModelInfo.setModelVersionId(vnfModelVerOpt.get().getModelVersionId()) - vnfModelInfo.setModelName(vnfModelVerOpt.get().getModelName()) - vnfModelInfo.setModelVersion(vnfModelVerOpt.get().getModelVersion()) - - // No model customization ID - // No model instance name - } - - vnf.setModelInfo(vnfModelInfo) - - // Instance name - vnf.setInstanceName(constituteVnf.getVnfInstanceId()) - - // Instance params - List<Map<String, Object>> instanceParams = new ArrayList<>() - Map<String, Object> supporrtedNSSAIMap = new HashMap<>() - - // Supported S-NSSAI - List<String> snssais = ( List<String>)execution.getVariable("S-NSSAIs") - supporrtedNSSAIMap.put("supporrtedNSSAI", snssais) // remaining S-NSSAIs ??? there is no status for each s-nssai - instanceParams.add(supporrtedNSSAIMap) - - // No other instance params, e.g. config-type - - vnf.setInstanceParams(instanceParams) - - // No platform data - - vnfs.add(vnf) - resources.setVnfs(vnfs) - - service.setResources(resources) - - Map<String, Object> serviceMap = new HashMap<>() - serviceMap.put("service", service) - userParams.add(serviceMap) - requestParameters.setUserParams(userParams) - - // No other user params - - requestDetails.setRequestParameters(requestParameters) - - // No other request params - - // Cloud configuration - requestDetails.setCloudConfiguration(cloudConfiguration) - - // Owning entity - OwningEntity owningEntity = new OwningEntity() - wrapper = client.get(networkServiceInstanceUri) - Optional<Relationships> owningEntityRelationshipsOps = wrapper.getRelationships() - if(owningEntityRelationshipsOps.isPresent()) { - List<AAIResourceUri> owningEntityRelatedAAIUris = owningEntityRelationshipsOps.get().getRelatedAAIUris(AAIObjectType.OWNING_ENTITY) - - if(!(owningEntityRelatedAAIUris == null || owningEntityRelatedAAIUris.isEmpty())) { - Optional<org.onap.aai.domain.yang.OwningEntity> owningEntityOpt = client.get(org.onap.aai.domain.yang.OwningEntity.class, owningEntityRelatedAAIUris.get(0)) // Many-To-One relation - if(owningEntityOpt.isPresent()) { - owningEntity.setOwningEntityId(owningEntityOpt.get().getOwningEntityId()) - owningEntity.setOwningEntityName(owningEntityOpt.get().getOwningEntityName()) - requestDetails.setOwningEntity(owningEntity) - } - } - } - - // Project - Project project = new Project() - if(cloudRegionRelatedAAIUri != null) { - wrapper = client.get(cloudRegionRelatedAAIUri) - Optional<Relationships> cloudRegionOps = wrapper.getRelationships() - if(cloudRegionOps.isPresent()) { - List<AAIResourceUri> projectAAIUris = cloudRegionOps.get().getRelatedAAIUris(AAIObjectType.PROJECT) - if (!(projectAAIUris == null || projectAAIUris.isEmpty())) { - Optional<org.onap.aai.domain.yang.Project> projectOpt = client.get(org.onap.aai.domain.yang.Project.class, projectAAIUris.get(0)) - if(projectOpt.isPresent()) { - project.setProjectName(projectOpt.get().getProjectName()) - } - } - } - } - requestDetails.setProject(project) - - return requestDetails - } - - /** * Creates Slice Profile Instance * @param execution @@ -561,10 +87,16 @@ class DoModifyCoreNSSI extends AbstractServiceTaskProcessor { void createSliceProfileInstance(DelegateExecution execution) { LOGGER.trace("${PREFIX} Start createSliceProfileInstance") + def currentNSSI = execution.getVariable("currentNSSI") + String sliceProfileID = execution.getVariable("sliceProfileID") Map<String, Object> sliceProfileMap = execution.getVariable("sliceProfileCn") Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile") + String globalSubscriberId = currentNSSI['globalSubscriberId'] + String serviceType = currentNSSI['serviceType'] + String nssiId = currentNSSI['nssiId'] + SliceProfile sliceProfile = new SliceProfile() sliceProfile.setServiceAreaDimension("") sliceProfile.setPayloadSize(0) @@ -587,10 +119,10 @@ class DoModifyCoreNSSI extends AbstractServiceTaskProcessor { try { AAIResourcesClient client = getAAIClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, sliceProfileID) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiId).sliceProfile(sliceProfileID)) client.create(uri, sliceProfile) - execution.setVariable("createdSliceProfile", sliceProfile) + currentNSSI['createdSliceProfile'] = sliceProfile } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile create call:" + ex.getMessage()) } @@ -610,20 +142,22 @@ class DoModifyCoreNSSI extends AbstractServiceTaskProcessor { def currentNSSI = execution.getVariable("currentNSSI") - String nssiId = currentNSSI['nssiServiceInstanceId'] + String globalSubscriberId = currentNSSI['globalSubscriberId'] + String serviceType = currentNSSI['serviceType'] + String nssiId = currentNSSI['nssiId'] - AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiId) - AAIResourceUri sliceProfileUri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, sliceProfileID) + AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId)) + AAIResourceUri sliceProfileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiId).sliceProfile(sliceProfileID)) try { - SliceProfile createdSliceProfile = (SliceProfile)execution.getVariable("createdSliceProfile") - ServiceInstance nssi = (ServiceInstance)execution.getVariable("nssi") + SliceProfile createdSliceProfile = (SliceProfile)currentNSSI['createdSliceProfile'] + ServiceInstance nssi = (ServiceInstance)currentNSSI['nssi'] List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile() associatedProfiles.add(createdSliceProfile) getAAIClient().update(nssiUri, nssi) - getAAIClient().connect(sliceProfileUri, nsiUri, AAIEdgeLabel.BELONGS_TO) + getAAIClient().connect(sliceProfileUri, nssiUri, AAIEdgeLabel.BELONGS_TO) }catch(Exception e){ exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile association with NSSI disconnect call: " + e.getMessage()) } @@ -632,101 +166,9 @@ class DoModifyCoreNSSI extends AbstractServiceTaskProcessor { } - /** - * Removes Slice Profile association with NSSI - * @param execution - */ - void removeSPAssociationWithNSSI(DelegateExecution execution) { - LOGGER.trace("${PREFIX} Start removeSPAssociationWithNSSI") - - AAIResourcesClient client = getAAIClient() - - def currentNSSI = execution.getVariable("currentNSSI") - - ServiceInstance nssi = (ServiceInstance)execution.getVariable("nssi") - - String nssiId = currentNSSI['nssiServiceInstanceId'] - AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiId) - - List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile() - - String currentSNSSAI = currentNSSI['S-NSSAI'] - - associatedProfiles.removeIf({ associatedProfile -> (associatedProfile.getSNssai().equals(currentSNSSAI)) }) - - try { - getAAIClient().update(nssiUri, nssi) - }catch(Exception e){ - exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile association with NSSI update call: " + e.getMessage()) - } - - LOGGER.trace("${PREFIX} Exit removeSPAssociationWithNSSI") - } - - - /** - * Deletes Slice Profile Instance - * @param execution - */ - void deleteSliceProfileInstance(DelegateExecution execution) { - LOGGER.trace("${PREFIX} Start deleteSliceProfileInstance") - - AAIResourcesClient client = getAAIClient() - - def currentNSSI = execution.getVariable("currentNSSI") - - ServiceInstance nssi = (ServiceInstance)execution.getVariable("nssi") - - List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile() - - String currentSNSSAI = currentNSSI['S-NSSAI'] - - AAIResourceUri sliceProfileUri = null - - for(SliceProfile associatedProfile:associatedProfiles) { - if(!associatedProfile.getSNssai().equals(currentNSSI)) { // not current S-NSSAI - sliceProfileUri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, associatedProfile.getProfileId()) - break - } - } - - try { - getAAIClient().delete(sliceProfileUri) - }catch(Exception e){ - exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile Instance delete call: " + e.getMessage()) - } - - LOGGER.trace("${PREFIX} Exit deleteSliceProfileInstance") - } - - - /** - * Updates operation status - * @param execution - */ - void updateServiceOperationStatus(DelegateExecution execution) { - LOGGER.trace("${PREFIX} Start updateServiceOperationStatus") - - def currentNSSI = execution.getVariable("currentNSSI") - - OperationStatus operationStatus = new OperationStatus() - operationStatus.setServiceId(currentNSSI['e2eServiceInstanceId'] as String) - operationStatus.setOperationId(currentNSSI['operationId'] as String) - operationStatus.setOperation(currentNSSI['operationType'] as String) - operationStatus.setResult(RequestsDbConstant.Status.FINISHED) - - requestDBUtil.prepareUpdateOperationStatus(execution, operationStatus) - - LOGGER.trace("${PREFIX} Exit updateServiceOperationStatus") - } - - - /** - * Returns AAI client - * @return AAI client - */ - AAIResourcesClient getAAIClient() { - return new AAIResourcesClient() + @Override + String getPrefix() { + return PREFIX } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy index 0b7a5ff59b..03a726c52c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy @@ -30,6 +30,8 @@ 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.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.RequestDBUtil @@ -132,10 +134,7 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor { void deleteServiceInstance(DelegateExecution execution) { try { AAIResourcesClient client = getAAIClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - execution.getVariable("globalSubscriberId"), - execution.getVariable("subscriptionServiceType"), - execution.getVariable("serviceInstanceID")) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("serviceInstanceID"))) client.delete(uri) } catch (BpmnError e) { throw e @@ -151,7 +150,7 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable("serviceInstanceID") AAIResourcesClient resourceClient = getAAIClient() - AAIResourceUri ssServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + AAIResourceUri ssServiceuri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)) try { if (resourceClient.exists(ssServiceuri)) { @@ -214,7 +213,7 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor { ss.setEnvironmentContext(snssai) ss.setServiceRole(serviceRole) AAIResourcesClient client = getAAIClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), ssInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(ssInstanceId)) client.update(uri, ss) } catch (BpmnError e) { throw e @@ -243,9 +242,7 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor { sliceProfile.setReliability(new Object()) try { AAIResourcesClient client = getAAIClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, execution.getVariable - ("globalSubscriberId"), - execution.getVariable("subscriptionServiceType"), sliceserviceInstanceId, sliceProfileId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceserviceInstanceId).sliceProfile(sliceProfileId)) client.update(uri, sliceProfile) } catch (BpmnError e) { @@ -263,9 +260,7 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor { List<String> arIdList = execution.getVariable("arIdList") try { for (String arId : arIdList) { - AAIResourceUri arUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, - execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), - serviceInstanceId, arId) + AAIResourceUri arUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(serviceInstanceId).allottedResource(arId)) getAAIClient().delete(arUri) } @@ -274,9 +269,7 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor { for (String networkStr : networkStrList) { String allottedResourceId = UUID.randomUUID().toString() - AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, - execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), - execution.getVariable("sliceserviceInstanceId"), allottedResourceId) + AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("sliceserviceInstanceId")).allottedResource(allottedResourceId)) execution.setVariable("allottedResourceUri", allottedResourceUri) String modelInvariantId = execution.getVariable("modelInvariantUuid") String modelVersionId = execution.getVariable("modelUuid") @@ -319,7 +312,7 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor { resource.setModelInvariantId(modelInvariantId) resource.setModelVersionId(modelVersionId) - AAIResourceUri logicalLinkUri = AAIUriFactory.createResourceUri(AAIObjectType.LOGICAL_LINK, logicalLinkId) + AAIResourceUri logicalLinkUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLink(logicalLinkId)) getAAIClient().create(logicalLinkUri, resource) } } catch (Exception ex) { @@ -365,7 +358,7 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor { ServiceInstance si = new ServiceInstance() si.setOrchestrationStatus(orchStatus) AAIResourcesClient client = getAAIClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, sliceServiceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(sliceServiceInstanceId)) client.update(uri, si) } catch (BpmnError e) { throw e diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy index 6b91fec03e..615afcb8d7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy @@ -41,6 +41,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.springframework.web.util.UriUtils; import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -315,7 +317,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { org.onap.aai.domain.yang.ServiceInstance si = execution.getVariable("serviceInstanceData") AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)) client.update(uri, si) } catch (BpmnError e) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy index 154de6b887..5b16838c6a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy @@ -37,6 +37,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.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.bpmn.common.scripts.ExceptionUtil; @@ -241,7 +243,7 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce org.onap.aai.domain.yang.ServiceInstance si = execution.getVariable("serviceInstanceData") AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)) client.update(uri, si) } catch (BpmnError e) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy index cf7bb22442..be82562898 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy @@ -37,6 +37,7 @@ 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.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor @@ -328,7 +329,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable('serviceInstanceId') AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)) if(!resourceClient.exists(uri)){ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Service Instance not found in aai") @@ -361,7 +362,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) AaiUtil aaiUtil = new AaiUtil(this) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion)) def queryCloudRegionRequest = aaiUtil.createAaiUri(uri) execution.setVariable(Prefix + "queryCloudRegionRequest", queryCloudRegionRequest) @@ -409,7 +410,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "networkId", networkId) AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ONE) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)).depth(Depth.ONE) AAIResultWrapper network = client.get(uri, NotFoundException.class) execution.setVariable(Prefix + "aaiIdReturnCode", "200") @@ -442,7 +443,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String networkId = utils.getNodeText(networkRequest, "network-id") AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ONE) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)).depth(Depth.ONE) AAIResultWrapper network = client.get(uri, NotFoundException.class) execution.setVariable(Prefix + "aaiRequeryIdReturnCode", "200") @@ -483,7 +484,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { // get variables AAIResultWrapper queryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") if(queryIdAAIResponse.getRelationships().isPresent()){ - List<AAIResourceUri> uris = queryIdAAIResponse.getRelationships().get().getRelatedAAIUris(AAIObjectType.VPN_BINDING) + List<AAIResourceUri> uris = queryIdAAIResponse.getRelationships().get().getRelatedUris(Types.VPN_BINDING) logger.debug(Prefix + "vpnCount - " + uris.size()) @@ -555,7 +556,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { // get variables AAIResultWrapper queryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") if(queryIdAAIResponse.getRelationships().isPresent()){ - List<AAIResourceUri> uris = queryIdAAIResponse.getRelationships().get().getRelatedAAIUris(AAIObjectType.NETWORK_POLICY) + List<AAIResourceUri> uris = queryIdAAIResponse.getRelationships().get().getRelatedUris(Types.NETWORK_POLICY) execution.setVariable(Prefix + "networkPolicyCount", uris.size()) logger.debug(Prefix + "networkPolicyCount - " + uris.size()) @@ -620,7 +621,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { try { AAIResultWrapper queryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") if(queryIdAAIResponse.getRelationships().isPresent()){ - List<AAIResourceUri> uris = queryIdAAIResponse.getRelationships().get().getRelatedAAIUris(AAIObjectType.ROUTE_TABLE_REFERENCE) + List<AAIResourceUri> uris = queryIdAAIResponse.getRelationships().get().getRelatedUris(Types.ROUTE_TABLE_REFERENCE) execution.setVariable(Prefix + "networkTableRefCount", uris.size()) logger.debug(Prefix + "networkTableRefCount - " + uris.size()) @@ -717,7 +718,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)) client.update(uri, l3Network) List<Subnet> subnets = oldL3Network.getSubnets().getSubnet() @@ -734,7 +735,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { subnet.setOrchestrationStatus("Active") } - AAIResourceUri subUri = AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, networkId, subnetId) + AAIResourceUri subUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId).subnet(subnetId)) client.update(subUri, subnet) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy index 00cf2a3ff1..b7bbbf91a5 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy @@ -25,6 +25,14 @@ package org.onap.so.bpmn.infrastructure.scripts import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf +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.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.logging.filter.base.ErrorCode import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.CatalogDbUtils @@ -37,12 +45,6 @@ import org.onap.so.bpmn.common.scripts.VfModuleBase import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils; -import org.onap.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.graphinventory.entities.uri.Depth import org.onap.so.constants.Defaults import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum @@ -273,7 +275,7 @@ public class DoUpdateVfModule extends VfModuleBase { } try{ - AAIResourceUri serviceInstanceURI = AAIUriFactory.create(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,serviceType,serviceInstanceId) + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId)) AAIResourcesClient aaiRC = new AAIResourcesClient() AAIResultWrapper aaiRW = aaiRC.get(serviceInstanceURI) Map<String, Object> aaiJson = aaiRW.asMap() @@ -411,7 +413,7 @@ public class DoUpdateVfModule extends VfModuleBase { // Prepare AA&I url AaiUtil aaiUtil = new AaiUtil(this) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion)) def queryCloudRegionRequest = aaiUtil.createAaiUri(uri) execution.setVariable(prefix + "queryCloudRegionRequest", queryCloudRegionRequest) @@ -1018,7 +1020,7 @@ public class DoUpdateVfModule extends VfModuleBase { try { def vnfId = execution.getVariable('DOUPVfMod_vnfId') - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE) try { Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class,uri) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy index 7e180ca542..0285ae219c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy @@ -41,7 +41,9 @@ import org.onap.aaiclient.client.graphinventory.entities.uri.Depth 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.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.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -159,7 +161,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { def vnfId = execution.getVariable('vnfId') AaiUtil aaiUriUtil = new AaiUtil(this) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE) String endPoint = aaiUriUtil.createAaiUri(uri) logger.debug("AAI endPoint: " + endPoint) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy index 3367920064..7d2e536af9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy @@ -31,6 +31,8 @@ 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.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.RequestDBUtil @@ -302,7 +304,7 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor { ServiceInstance si = new ServiceInstance() si.setOrchestrationStatus(orchStatus) AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, sliceServiceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(sliceServiceInstanceId)) client.update(uri, si) } catch (BpmnError e) { throw e diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy index 282e9611fd..3a199216da 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy @@ -44,6 +44,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.springframework.web.util.UriUtils import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -178,7 +180,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor String serviceType = execution.getVariable('serviceType') AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId)) AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy index 148ab1898f..a50f96adab 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy @@ -33,6 +33,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.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils @@ -185,7 +186,7 @@ class UpdateVfModuleVolume extends VfModuleBase { try { def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') def aicCloudRegion = execution.getVariable('UPDVfModVol_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) if(volumeGroup.isPresent()){ @@ -193,7 +194,7 @@ class UpdateVfModuleVolume extends VfModuleBase { execution.setVariable('UPDVfModVol_volumeGroupHeatStackId', heatStackId) Optional<Relationships> relationships = wrapper.getRelationships() if(relationships.isPresent()){ - List<AAIResourceUri> resourceUriList = relationships.get().getRelatedAAIUris(AAIObjectType.TENANT) + List<AAIResourceUri> resourceUriList = relationships.get().getRelatedUris(Types.TENANT) if(CollectionUtils.isNotEmpty(resourceUriList)){ AAIResourceUri tenantUri = resourceUriList.get(0) String volumeGroupTenantId = tenantUri.getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy index b6873a19fe..b7757715e9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy @@ -29,12 +29,12 @@ import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.VfModule import org.onap.aai.domain.yang.VolumeGroup -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.logging.filter.base.ErrorCode import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils @@ -207,14 +207,14 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') try { - 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) if (volumeGroup.isPresent()) { execution.setVariable('UPDVfModVol_aaiVolumeGroupResponse', volumeGroup.get()) Optional<Relationships> relationships = wrapper.getRelationships() if (relationships.isPresent()) { - List<AAIResourceUri> tenantURIList = relationships.get().getRelatedAAIUris(AAIObjectType.TENANT) + List<AAIResourceUri> tenantURIList = relationships.get().getRelatedUris(Types.TENANT) if (!isEmpty(tenantURIList)) { String volumeGroupTenantId = tenantURIList.get(0).getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId) execution.setVariable('UPDVfModVol_volumeGroupTenantId', volumeGroupTenantId) @@ -224,7 +224,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Could not find Tenant Id element in Volume Group with Volume Group Id " + volumeGroupId + ", AIC Cloud Region " + aicCloudRegion) } - execution.setVariable('UPDVfModVol_relatedVfModuleLink', relationships.get().getRelatedLinks(AAIObjectType.VF_MODULE).get(0)) + execution.setVariable('UPDVfModVol_relatedVfModuleLink', relationships.get().getRelatedLinks(Types.VF_MODULE).get(0)) } else { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Could not find Tenant Id element in Volume Group with Volume Group Id " + volumeGroupId @@ -249,7 +249,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { def vnfId = execution.getVariable('vnfId') - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) try { Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class, uri) if (genericVnf.isPresent()) { @@ -273,7 +273,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { String queryAAIVfModuleRequest = execution.getVariable('UPDVfModVol_relatedVfModuleLink') execution.setVariable('UPDVfModVol_personaModelId', '') - AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.VF_MODULE, UriBuilder.fromPath(queryAAIVfModuleRequest).build()) + AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(Types.VF_MODULE, UriBuilder.fromPath(queryAAIVfModuleRequest).build()) try{ Optional<VfModule> vfModule = getAAIClient().get(VfModule.class,uri) if(vfModule.isPresent()){ diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy index aa3512379a..c797f924b7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy @@ -32,6 +32,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.appc.client.lcm.model.Action import org.onap.appc.client.lcm.model.ActionIdentifiers import org.onap.appc.client.lcm.model.Flags @@ -218,7 +219,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { logger.debug("cloudRegionId is: {}", cloudRegionId) AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) // Check if this VNF exists if (!client.exists(genericVnfUri)) { logger.debug("VNF with vnfId {} does not exist in A&AI", vnfId) @@ -243,7 +244,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { Relationships relationships = aaiRW.getRelationships().get() if (relationships != null) { - List<AAIResourceUri> vserverUris = relationships.getRelatedAAIUris(AAIObjectType.VSERVER) + List<AAIResourceUri> vserverUris = relationships.getRelatedUris(Types.VSERVER) JSONArray vserverIds = new JSONArray() JSONArray vserverSelfLinks = new JSONArray() @@ -436,7 +437,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { def vnfId = execution.getVariable("vnfId") logger.debug("vnfId is: {}", vnfId) AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) AAIResultWrapper aaiRW = client.get(genericVnfUri) Map<String, Object> result = aaiRW.asMap() boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false) @@ -488,7 +489,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { def transactionLoggingUuid = UUID.randomUUID().toString() def vnfId = execution.getVariable("vnfId") AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) Map<String, Boolean> request = new HashMap<>() request.put("is-closed-loop-disabled", setDisabled) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy index ddc80f6a50..ee173caeb1 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy @@ -32,6 +32,8 @@ import org.onap.aaiclient.client.aai.* 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.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -360,7 +362,7 @@ public class VnfConfigUpdate extends VnfCmBase { def vnfId = execution.getVariable("vnfId") logger.debug("vnfId is: {}", vnfId) AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) AAIResultWrapper aaiRW = client.get(genericVnfUri) Map<String, Object> result = aaiRW.asMap() boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false) @@ -412,7 +414,7 @@ public class VnfConfigUpdate extends VnfCmBase { def transactionLoggingUuid = UUID.randomUUID().toString() def vnfId = execution.getVariable("vnfId") AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) Map<String, Boolean> request = new HashMap<>() request.put("is-closed-loop-disabled", setDisabled) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy index 603d5e4dd9..4fad3c33b4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy @@ -35,6 +35,8 @@ import org.onap.aaiclient.client.aai.* 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.client.appc.ApplicationControllerClient import org.onap.so.client.appc.ApplicationControllerSupport import org.onap.so.logger.LoggingAnchor @@ -380,7 +382,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { def vnfId = execution.getVariable("vnfId") logger.debug("vnfId is: " + vnfId) AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) AAIResultWrapper aaiRW = client.get(genericVnfUri) Map<String, Object> result = aaiRW.asMap() boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false) @@ -431,7 +433,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { def transactionLoggingUuid = UUID.randomUUID().toString() def vnfId = execution.getVariable("vnfId") AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) Map<String, Boolean> request = new HashMap<>() request.put("is-closed-loop-disabled", setDisabled) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy index dd1dae6edd..236e9d6266 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.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.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -205,7 +206,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable('serviceInstanceId') AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)) if(resourceClient.exists(uri)){ AAIResultWrapper wrapper = resourceClient.get(uri, NotFoundException.class) @@ -217,13 +218,13 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { if(relationships.isPresent()){ - List<AAIResourceUri> vnfUris = relationships.get().getRelatedAAIUris(AAIObjectType.GENERIC_VNF) + List<AAIResourceUri> vnfUris = relationships.get().getRelatedUris(Types.GENERIC_VNF) for(AAIResourceUri u:vnfUris){ Map<String, String> keys = u.getURIKeys() String vnfId = keys.get(AAIFluentTypeBuilder.Types.GENERIC_VNF.getUriParams().vnfId) relatedVnfIdList.add(vnfId) } - List<AAIResourceUri> arUris = relationships.get().getRelatedAAIUris(AAIObjectType.ALLOTTED_RESOURCE) + List<AAIResourceUri> arUris = relationships.get().getRelatedUris(Types.ALLOTTED_RESOURCE) for(AAIResourceUri u:arUris){ String ar = resourceClient.get(u).getJson() diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy index 683b82e4a7..87c2f673ff 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy @@ -27,16 +27,17 @@ import javax.ws.rs.core.UriBuilder import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.AllottedResource +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.logging.filter.base.ErrorCode import org.onap.so.bpmn.common.scripts.* import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.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.logging.filter.base.ErrorCode import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum import org.slf4j.Logger @@ -168,7 +169,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ String serviceInstanceId = execution.getVariable('serviceInstanceId') AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)) if(resourceClient.exists(uri)){ execution.setVariable("CSI_resourceLink", uri.build().toString()) @@ -230,7 +231,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ String serviceInstanceId = execution.getVariable('parentServiceInstanceId') AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)) //just to make sure the serviceInstance exists if (resourceClient.exists(uri)) { @@ -265,7 +266,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ AAIResourceUri siResourceLink= execution.getVariable("PSI_resourceLink") - AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceFromParentURI(siResourceLink, AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId) + AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceFromParentURI(siResourceLink, Types.ALLOTTED_RESOURCE.getFragment(allottedResourceId)) execution.setVariable("aaiARPath", allottedResourceUri.build().toString()); String arType = execution.getVariable("allottedResourceType") @@ -283,7 +284,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ resource.setModelInvariantId(modelInvariantId) resource.setModelVersionId(modelVersionId) getAAIClient().create(allottedResourceUri, resource) - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath(CSI_resourceLink).build()) + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(Types.SERVICE_INSTANCE, UriBuilder.fromPath(CSI_resourceLink).build()) getAAIClient().connect(allottedResourceUri,serviceInstanceUri) }catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in createAaiAR " + ex.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy index 9782440e85..69ce713b71 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy @@ -22,26 +22,26 @@ package org.onap.so.bpmn.vcpe.scripts -import org.onap.so.logger.LoggingAnchor +import static org.apache.commons.lang3.StringUtils.isBlank +import javax.ws.rs.core.UriBuilder import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.AllottedResource +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.common.scripts.*; import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.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.logging.filter.base.ErrorCode +import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import javax.ws.rs.core.UriBuilder -import static org.apache.commons.lang3.StringUtils.isBlank - /** * This groovy class supports the <class>DoCreateAllottedResourceTXC.bpmn</class> process. * @@ -206,7 +206,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ AAIResourceUri siResourceLink= execution.getVariable("PSI_resourceLink") - AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceFromParentURI(siResourceLink, AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId) + AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceFromParentURI(siResourceLink, Types.ALLOTTED_RESOURCE.getFragment(allottedResourceId)) execution.setVariable("aaiARPath", allottedResourceUri.build().toString()); String arType = execution.getVariable("allottedResourceType") @@ -224,7 +224,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ resource.setModelInvariantId(modelInvariantId) resource.setModelVersionId(modelVersionId) getAAIClient().create(allottedResourceUri, resource) - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath(CSI_resourceLink).build()) + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(Types.SERVICE_INSTANCE, UriBuilder.fromPath(CSI_resourceLink).build()) getAAIClient().connect(allottedResourceUri,serviceInstanceUri) }catch (Exception ex) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java index 1cc68953f8..3021852734 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java @@ -23,11 +23,12 @@ package org.onap.so.bpmn.infrastructure.aai; import java.util.HashMap; import java.util.Map; import java.util.Optional; -import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; -import org.onap.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.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -36,17 +37,19 @@ public class AAICreateResources extends AAIResource { private static final Logger logger = LoggerFactory.getLogger(AAICreateResources.class); public void createAAIProject(String projectName, String serviceInstance) { - AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName); + AAIResourceUri projectURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().project(projectName)); AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance)); getAaiClient().createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI); } public void createAAIOwningEntity(String owningEntityId, String owningEntityName, String serviceInstance) { - AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri owningEntityURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntityId)); AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance)); Map<String, String> hashMap = new HashMap<>(); hashMap.put("owning-entity-name", owningEntityName); getAaiClient().createIfNotExists(owningEntityURI, Optional.of(hashMap)).connect(owningEntityURI, @@ -54,39 +57,44 @@ public class AAICreateResources extends AAIResource { } public boolean existsOwningEntity(String owningEntityId) { - AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri owningEntityURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntityId)); return getAaiClient().exists(owningEntityURI); } public void connectOwningEntityandServiceInstance(String owningEntityId, String serviceInstance) { - AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri owningEntityURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntityId)); AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance)); getAaiClient().connect(owningEntityURI, serviceInstanceURI); } public void createAAIPlatform(String platformName, String vnfId) { - AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName); - AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + AAIResourceUri platformURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().platform(platformName)); + AAIResourceUri genericVnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)); getAaiClient().createIfNotExists(platformURI, Optional.empty()).connect(platformURI, genericVnfURI); } public void createAAILineOfBusiness(String lineOfBusiness, String vnfId) { AAIResourceUri lineOfBusinessURI = - AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness); - AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().lineOfBusiness(lineOfBusiness)); + AAIResourceUri genericVnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)); getAaiClient().createIfNotExists(lineOfBusinessURI, Optional.empty()).connect(lineOfBusinessURI, genericVnfURI); } public void createAAIServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId) { - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalCustomerId, serviceType, serviceInstanceId); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(globalCustomerId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId)); getAaiClient().createIfNotExists(serviceInstanceURI, Optional.empty()); } public Optional<GenericVnf> getVnfInstance(String vnfId) { try { - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)); AAIResultWrapper aaiResponse = getAaiClient().get(vnfURI); Optional<GenericVnf> vnf = aaiResponse.asBean(GenericVnf.class); return vnf; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java index 22166483b1..97adc4d25f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java @@ -22,10 +22,10 @@ package org.onap.so.bpmn.infrastructure.aai; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; -import org.onap.so.bpmn.common.scripts.ExceptionUtil; -import org.onap.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.Types; +import org.onap.so.bpmn.common.scripts.ExceptionUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -43,7 +43,7 @@ public class AAIDeleteServiceInstance extends AAIResource implements JavaDelegat try { String serviceInstanceId = (String) execution.getVariable("serviceInstanceId"); AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)); getAaiClient().delete(serviceInstanceURI); execution.setVariable("GENDS_SuccessIndicator", true); } catch (Exception ex) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java index c2e2a3c258..cc7eefcbd9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java @@ -27,11 +27,11 @@ import java.util.Map; import java.util.Optional; import org.onap.aai.domain.yang.OwningEntities; import org.onap.aai.domain.yang.OwningEntity; -import org.onap.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.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; @@ -40,18 +40,20 @@ public class AAICreateResources { private static final Logger logger = LoggerFactory.getLogger(AAICreateResources.class); public void createAAIProject(String projectName, String serviceInstance) { - AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName); + AAIResourceUri projectURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().project(projectName)); AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance)); AAIResourcesClient aaiRC = new AAIResourcesClient(); aaiRC.createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI); } public void createAAIOwningEntity(String owningEntityId, String owningEntityName, String serviceInstance) { - AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri owningEntityURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntityId)); AAIResourceUri serviceInstanceURI = - AAIUriFactory.createNodesUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance)); Map<String, String> hashMap = new HashMap<>(); hashMap.put("owning-entity-name", owningEntityName); AAIResourcesClient aaiRC = new AAIResourcesClient(); @@ -59,7 +61,8 @@ public class AAICreateResources { } public boolean existsOwningEntity(String owningEntityId) { - AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri owningEntityURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntityId)); AAIResourcesClient aaiRC = new AAIResourcesClient(); return aaiRC.exists(owningEntityURI); } @@ -67,8 +70,10 @@ public class AAICreateResources { protected OwningEntities getOwningEntityName(String owningEntityName) { AAIResourcesClient aaiRC = new AAIResourcesClient(); - return aaiRC.get(OwningEntities.class, AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY) - .queryParam("owning-entity-name", owningEntityName)).orElseGet(() -> { + return aaiRC.get(OwningEntities.class, + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntities()) + .queryParam("owning-entity-name", owningEntityName)) + .orElseGet(() -> { logger.debug("No Owning Entity matched by name"); return null; }); @@ -91,31 +96,35 @@ public class AAICreateResources { } public void connectOwningEntityandServiceInstance(String owningEntityId, String serviceInstance) { - AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri owningEntityURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntityId)); AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance)); AAIResourcesClient aaiRC = new AAIResourcesClient(); aaiRC.connect(owningEntityURI, serviceInstanceURI); } public void createAAIPlatform(String platformName, String vnfId) { - AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName); - AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + AAIResourceUri platformURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().platform(platformName)); + AAIResourceUri genericVnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)); AAIResourcesClient aaiRC = new AAIResourcesClient(); aaiRC.createIfNotExists(platformURI, Optional.empty()).connect(platformURI, genericVnfURI); } public void createAAILineOfBusiness(String lineOfBusiness, String vnfId) { AAIResourceUri lineOfBusinessURI = - AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness); - AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().lineOfBusiness(lineOfBusiness)); + AAIResourceUri genericVnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)); AAIResourcesClient aaiRC = new AAIResourcesClient(); aaiRC.createIfNotExists(lineOfBusinessURI, Optional.empty()).connect(lineOfBusinessURI, genericVnfURI); } public void createAAIServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId) { - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalCustomerId, serviceType, serviceInstanceId); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(globalCustomerId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId)); AAIResourcesClient aaiRC = new AAIResourcesClient(); aaiRC.createIfNotExists(serviceInstanceURI, Optional.empty()); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java index bb7415da93..df42e961bb 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java @@ -22,11 +22,11 @@ package org.onap.so.bpmn.infrastructure.aai.groovyflows; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; -import org.onap.so.bpmn.common.scripts.ExceptionUtil; -import org.onap.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.Types; +import org.onap.so.bpmn.common.scripts.ExceptionUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,7 +42,7 @@ public class AAIDeleteServiceInstance implements JavaDelegate { try { String serviceInstanceId = (String) execution.getVariable("serviceInstanceId"); AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)); AAIResourcesClient aaiRC = new AAIResourcesClient(); aaiRC.delete(serviceInstanceURI); execution.setVariable("GENDS_SuccessIndicator", true); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java index 001e166893..03ff55b90e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java @@ -22,11 +22,12 @@ package org.onap.so.bpmn.infrastructure.pnf.management; import java.util.Optional; import org.onap.aai.domain.yang.Pnf; -import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.aai.AAIResourcesClient; import org.onap.aaiclient.client.aai.AAIRestClientImpl; 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.springframework.stereotype.Component; @Component @@ -52,8 +53,8 @@ public class PnfManagementImpl implements PnfManagement { @Override public void createRelation(String serviceInstanceId, String pnfName) { AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); - AAIResourceUri pnfUri = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfName); + AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)); + AAIResourceUri pnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnfName)); new AAIResourcesClient().connect(serviceInstanceURI, pnfUri); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java index 99ed7b1e91..d1fc0a6353 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java @@ -54,19 +54,19 @@ import org.onap.aai.domain.yang.LogicalLinks; import org.onap.aai.domain.yang.PInterface; import org.onap.aai.domain.yang.Pnf; import org.onap.aai.domain.yang.Relationship; -import org.onap.logging.filter.base.ErrorCode; -import org.onap.so.bpmn.core.UrnPropertiesReader; -import org.onap.so.bpmn.core.domain.Resource; -import org.onap.so.bpmn.core.domain.ServiceDecomposition; -import org.onap.so.bpmn.core.json.JsonUtils; -import org.onap.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.Relationships; 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.logging.filter.base.ErrorCode; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.bpmn.core.domain.Resource; +import org.onap.so.bpmn.core.domain.ServiceDecomposition; +import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -448,7 +448,7 @@ public class ServicePluginFactory { public Map getTPsfromAAI(String serviceName) { Map<String, Object> tpInfo = new HashMap<>(); - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.LOGICAL_LINK); + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLinks()); AAIResourcesClient client = new AAIResourcesClient(); Optional<LogicalLinks> result = client.get(LogicalLinks.class, uri); @@ -464,10 +464,10 @@ public class ServicePluginFactory { List<AAIResourceUri> pInterfaces = new ArrayList<>(); if (optRelationships.isPresent()) { Relationships relationships = optRelationships.get(); - if (!relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty()) { + if (!relationships.getRelatedUris(Types.EXT_AAI_NETWORK).isEmpty()) { isRemoteLink = true; } - pInterfaces.addAll(relationships.getRelatedAAIUris(AAIObjectType.P_INTERFACE)); + pInterfaces.addAll(relationships.getRelatedUris(Types.P_INTERFACE)); if (isRemoteLink) { // find remote p interface AAIResourceUri localTP = null; @@ -502,8 +502,8 @@ public class ServicePluginFactory { tpInfo.put("local-access-node-id", localNodeId); logger.info("Get info for local TP :{}", localNodeId); - Optional<Pnf> optLocalPnf = - client.get(Pnf.class, AAIUriFactory.createResourceUri(AAIObjectType.PNF, localNodeId)); + Optional<Pnf> optLocalPnf = client.get(Pnf.class, + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(localNodeId))); getTpInfoFromLocalTp(tpInfo, optLocalPnf); @@ -523,8 +523,8 @@ public class ServicePluginFactory { logger.info("Get info for remote TP:{}", remoteNodeId); String[] networkRefRemote = intfRemote.getNetworkRef().split("-"); - Optional<Pnf> optRemotePnf = - client.get(Pnf.class, AAIUriFactory.createResourceUri(AAIObjectType.PNF, remoteNodeId)); + Optional<Pnf> optRemotePnf = client.get(Pnf.class, + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(remoteNodeId))); getTpInfoFromRemoteTp(tpInfo, networkRefRemote, optRemotePnf); @@ -584,14 +584,14 @@ public class ServicePluginFactory { if (uriString != null) { // get the pnfname String[] token = uriString.split("/"); - AAIResourceUri parent = AAIUriFactory.createResourceUri(AAIObjectType.PNF, token[4]); + AAIResourceUri parent = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(token[4])); AAIResultWrapper wrapper = client.get(parent); Optional<Relationships> optRelationships = wrapper.getRelationships(); if (optRelationships.isPresent()) { Relationships relationships = optRelationships.get(); - return !relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty(); + return !relationships.getRelatedUris(Types.EXT_AAI_NETWORK).isEmpty(); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy index 46f061d89c..01f4d6b97b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy @@ -160,45 +160,6 @@ class CreateSliceServiceTest extends MsoGroovyTest { } @Test - void testPrepareDecomposeService() { - when(mockExecution.getVariable("uuiRequest")).thenReturn(uuiRequest) - when(mockExecution.getVariable("serviceProfile")).thenReturn(serviceProfile) - CreateSliceService sliceService = new CreateSliceService() - sliceService.prepareDecomposeService(mockExecution) - - String serviceModelInfoExcept = """{ - "modelInvariantUuid":"123456", - "modelUuid":"123456", - "modelVersion":"" - }""" - Mockito.verify(mockExecution, times(1)).setVariable(eq("ssServiceModelInfo"), captor.capture()) - String serviceModelInfo = captor.getValue() - assertEquals(serviceModelInfoExcept.replaceAll("\\s+", ""), - serviceModelInfo.replaceAll("\\s+", "")) - } - - @Test - void testProcessDecomposition() { - when(mockExecution.getVariable("uuiRequest")).thenReturn(uuiRequest) - when(mockExecution.getVariable("serviceProfile")).thenReturn(serviceProfile) - when(mockExecution.getVariable("nstSolution")).thenReturn(nstSolution) - - CreateSliceService sliceService = new CreateSliceService() - sliceService.processDecomposition(mockExecution) - - Mockito.verify(mockExecution, times(1)).setVariable(eq("subscriptionServiceType"), captor.capture()) - assertEquals(captor.getValue(), "5G") - Mockito.verify(mockExecution, times(1)).setVariable(eq("serviceType"), captor.capture()) - assertEquals(captor.getValue(), "embb") - Mockito.verify(mockExecution, times(1)).setVariable(eq("resourceSharingLevel"), captor.capture()) - assertEquals(captor.getValue(), "shared") - Mockito.verify(mockExecution, times(1)).setVariable(eq("nstModelUuid"), captor.capture()) - assertEquals(captor.getValue(), "aaaaaa") - Mockito.verify(mockExecution, times(1)).setVariable(eq("nstModelInvariantUuid"), captor.capture()) - assertEquals(captor.getValue(), "bbbbbb") - } - - @Test void testPrepareCreateOrchestrationTask() { when(mockExecution.getVariable("serviceInstanceId")).thenReturn("123456") when(mockExecution.getVariable("serviceInstanceName")).thenReturn("test") diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResourceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResourceTest.groovy index 1551533e53..61b4957310 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResourceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResourceTest.groovy @@ -30,6 +30,8 @@ import org.onap.so.bpmn.common.scripts.MsoGroovyTest 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 javax.ws.rs.NotFoundException @@ -59,8 +61,8 @@ class CreateVFCNSResourceTest extends MsoGroovyTest{ when(mockExecution.getVariable("nsInstanceId")).thenReturn("nsInstanceId") doNothing().when(client).connect(isA(AAIResourceUri.class),isA(AAIResourceUri.class)) createVFCNSResource.addNSRelationship(mockExecution) - AAIResourceUri nsUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,"globalSubscriberId1","serviceType","nsInstanceId") - AAIResourceUri relatedServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,"globalSubscriberId1","serviceType","serviceInstanceId") + AAIResourceUri nsUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("globalSubscriberId1").serviceSubscription("serviceType").serviceInstance("nsInstanceId")) + AAIResourceUri relatedServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("globalSubscriberId1").serviceSubscription("serviceType").serviceInstance("serviceInstanceId")) Mockito.verify(client).connect(nsUri,relatedServiceUri) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy index 09b17701a6..c19cdfdb04 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy @@ -38,6 +38,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 static org.junit.Assert.assertEquals import static org.mockito.Mockito.* diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy index 39d0334bef..51d64af550 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy @@ -19,29 +19,29 @@ */ package org.onap.so.bpmn.infrastructure.scripts +import static org.junit.Assert.assertEquals +import static org.junit.Assert.assertNotNull +import static org.mockito.Mockito.* +import javax.ws.rs.NotFoundException +import javax.ws.rs.core.Response import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity import org.junit.Before import org.junit.Test import org.mockito.ArgumentCaptor import org.mockito.Captor import org.mockito.Mockito +import org.onap.aaiclient.client.aai.AAIObjectType +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.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.onap.logging.filter.base.ONAPComponents import org.onap.so.bpmn.common.scripts.MsoGroovyTest import org.onap.so.bpmn.core.WorkflowException import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -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.NotFoundException -import javax.ws.rs.core.Response - -import static org.junit.Assert.assertEquals -import static org.junit.Assert.assertNotNull -import static org.mockito.ArgumentMatchers.eq -import static org.mockito.Mockito.* class DeleteCommunicationServiceTest extends MsoGroovyTest { @@ -96,7 +96,7 @@ class DeleteCommunicationServiceTest extends MsoGroovyTest { when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") when(mockExecution.getVariable("serviceType")).thenReturn("5G") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be") + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be")) DeleteCommunicationService obj = spy(DeleteCommunicationService.class) AAIResultWrapper wrapper = new AAIResultWrapper(mockQueryCommunicationServiceReturn()) @@ -126,8 +126,8 @@ class DeleteCommunicationServiceTest extends MsoGroovyTest { when(mockExecution.getVariable("serviceType")).thenReturn("5G") AAIResultWrapper wrapper = new AAIResultWrapper(mockQueryCommunicationServiceProfile()) - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_PROFILE_ALL, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be") - AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_SERVICE_PROFILE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be", "5G-111111") + AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be").communicationServiceProfiles()) + AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be").communicationServiceProfile("5G-111111")) DeleteCommunicationService obj = spy(DeleteCommunicationService.class) when(obj.getAAIClient()).thenReturn(client) @@ -162,7 +162,7 @@ class DeleteCommunicationServiceTest extends MsoGroovyTest { when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") when(mockExecution.getVariable("serviceType")).thenReturn("5G") - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be") + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be")) DeleteCommunicationService obj = spy(DeleteCommunicationService.class) when(obj.getAAIClient()).thenReturn(client) doNothing().when(client).delete(serviceInstanceUri) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceServiceTest.groovy index 1a9c6bb474..75b606c630 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceServiceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceServiceTest.groovy @@ -19,29 +19,27 @@ */ package org.onap.so.bpmn.infrastructure.scripts +import static org.junit.Assert.assertNotNull +import static org.mockito.ArgumentMatchers.eq +import static org.mockito.Mockito.doNothing +import static org.mockito.Mockito.spy +import static org.mockito.Mockito.times +import static org.mockito.Mockito.when +import javax.ws.rs.NotFoundException import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity import org.junit.Before import org.junit.Test import org.mockito.ArgumentCaptor import org.mockito.Captor import org.mockito.Mockito -import org.onap.so.bpmn.common.scripts.MsoGroovyTest -import org.onap.so.bpmn.core.WorkflowException -import org.onap.aaiclient.client.aai.AAIObjectType 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 javax.ws.rs.NotFoundException - -import static org.junit.Assert.assertNotNull -import static org.mockito.ArgumentMatchers.eq -import static org.mockito.Mockito.doNothing -import static org.mockito.Mockito.spy -import static org.mockito.Mockito.times -import static org.mockito.Mockito.when -import static org.mockito.Mockito.when -import static org.mockito.Mockito.when +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types +import org.onap.so.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.bpmn.core.WorkflowException class DeleteSliceServiceTest extends MsoGroovyTest { @Before @@ -86,7 +84,7 @@ class DeleteSliceServiceTest extends MsoGroovyTest { when(mockExecution.getVariable("progress")).thenReturn("100") when(mockExecution.getVariable("operationContent")).thenReturn("NSMF completes slicing service termination.") - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be") + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be")) DeleteSliceService obj = spy(DeleteSliceService.class) when(obj.getAAIClient()).thenReturn(client) doNothing().when(client).delete(serviceInstanceUri) @@ -104,8 +102,8 @@ class DeleteSliceServiceTest extends MsoGroovyTest { when(mockExecution.getVariable("serviceType")).thenReturn("5G") AAIResultWrapper wrapper = new AAIResultWrapper(mockQuerySliceServiceProfile()) - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE_ALL, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be") - AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be", "5G-2222222") + AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be").serviceProfiles()) + AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be").serviceProfile("5G-2222222")) DeleteSliceService obj = spy(DeleteSliceService.class) when(obj.getAAIClient()).thenReturn(client) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy index 7137799433..0f0946dca2 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy @@ -39,6 +39,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.aaiclient.client.graphinventory.exceptions.GraphInventoryUriComputationException import javax.ws.rs.NotFoundException @@ -251,7 +253,7 @@ class DeleteVfModuleVolumeInfraV1Test extends MsoGroovyTest { volumeGroup.setVolumeGroupId("volumeGroupId1") when(mockExecution.getVariable("DELVfModVol_queryAAIVolGrpResponse")).thenReturn(volumeGroup) when(mockExecution.getVariable("DELVfModVol_aicCloudRegion")).thenReturn("region1") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "region1","volumeGroupId1") + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "region1").volumeGroup("volumeGroupId1")) doNothing().when(client).delete(resourceUri) deleteVfModuleVolumeInfraV1.deleteVolGrpId(mockExecution, true) verify(client).delete(resourceUri) @@ -263,7 +265,7 @@ class DeleteVfModuleVolumeInfraV1Test extends MsoGroovyTest { volumeGroup.setVolumeGroupId("volumeGroupId1") when(mockExecution.getVariable("DELVfModVol_queryAAIVolGrpResponse")).thenReturn(volumeGroup) when(mockExecution.getVariable("DELVfModVol_aicCloudRegion")).thenReturn("region1") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "region1","volumeGroupId1") + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "region1").volumeGroup("volumeGroupId1")) doThrow(new NotFoundException("Not Found")).when(client).delete(resourceUri) try { deleteVfModuleVolumeInfraV1.deleteVolGrpId(mockExecution, true) @@ -282,7 +284,7 @@ class DeleteVfModuleVolumeInfraV1Test extends MsoGroovyTest { volumeGroup.setVolumeGroupId("volumeGroupId1") when(mockExecution.getVariable("DELVfModVol_queryAAIVolGrpResponse")).thenReturn(volumeGroup) when(mockExecution.getVariable("DELVfModVol_aicCloudRegion")).thenReturn("region1") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "region1","volumeGroupId1") + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "region1").volumeGroup("volumeGroupId1")) doThrow(new GraphInventoryUriComputationException("Error")).when(client).delete(resourceUri) try { deleteVfModuleVolumeInfraV1.deleteVolGrpId(mockExecution, true) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSITest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSITest.groovy index a39ca04d71..69780939ef 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSITest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSITest.groovy @@ -34,6 +34,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 static org.mockito.Mockito.spy import static org.mockito.Mockito.times @@ -81,7 +83,7 @@ class DoActivateCoreNSSITest extends MsoGroovyTest { DoActivateCoreNSSI obj = spy(DoActivateCoreNSSI.class) when(obj.getAAIClient()).thenReturn(client) - AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX") + AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX")) when(client.exists(resourceUri1)).thenReturn(true) AAIResultWrapper wrapper1 = new AAIResultWrapper(mockQuerySliceServiceReturn()) when(client.get(resourceUri1, NotFoundException.class)).thenReturn(wrapper1) @@ -89,14 +91,14 @@ class DoActivateCoreNSSITest extends MsoGroovyTest { //networkServiceInstanceId when(mockExecution.getVariable("networkServiceInstanceId")).thenReturn("206535e7-77c9-4036-9387-3f1cf57b4379") - AAIResourceUri resourceUri2 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "206535e7-77c9-4036-9387-3f1cf57b4379") + AAIResourceUri resourceUri2 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("206535e7-77c9-4036-9387-3f1cf57b4379")) when(client.exists(resourceUri2)).thenReturn(true) AAIResultWrapper wrapper2 = new AAIResultWrapper(mockQueryNS()) when(client.get(resourceUri2, NotFoundException.class)).thenReturn(wrapper2) //Check Vnf when(mockExecution.getVariable("vnfId")).thenReturn("eeb66c6f-36bd-47ad-8294-48f46b1aa912") - AAIResourceUri resourceUri3 = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "eeb66c6f-36bd-47ad-8294-48f46b1aa912") + AAIResourceUri resourceUri3 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("eeb66c6f-36bd-47ad-8294-48f46b1aa912")) when(client.exists(resourceUri3)).thenReturn(true) AAIResultWrapper wrapper3 = new AAIResultWrapper(mockQueryVnf()) when(client.get(resourceUri3, NotFoundException.class)).thenReturn(wrapper3) @@ -104,14 +106,14 @@ class DoActivateCoreNSSITest extends MsoGroovyTest { //Allotted Resources-1 //when(mockExecution.getVariable("vnfId")).thenReturn("eeb66c6f-36bd-47ad-8294-48f46b1aa912") - AAIResourceUri resourceUri4 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "0d3d3cce-46a8-486d-816a-954e71697c4e") + AAIResourceUri resourceUri4 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("0d3d3cce-46a8-486d-816a-954e71697c4e")) when(client.exists(resourceUri4)).thenReturn(true) AAIResultWrapper wrapper4 = new AAIResultWrapper(mockServiceProfile1()) when(client.get(resourceUri4, NotFoundException.class)).thenReturn(wrapper4) //Allotted Resources-2 //when(mockExecution.getVariable("vnfId")).thenReturn("eeb66c6f-36bd-47ad-8294-48f46b1aa912") - AAIResourceUri resourceUri5 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "1c7046f2-a5a3-4d7f-9da8-388ee641a795") + AAIResourceUri resourceUri5 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("1c7046f2-a5a3-4d7f-9da8-388ee641a795")) when(client.exists(resourceUri5)).thenReturn(true) AAIResultWrapper wrapper5 = new AAIResultWrapper(mockServiceProfile2()) when(client.get(resourceUri5, NotFoundException.class)).thenReturn(wrapper5) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy index e5799eca66..0ac48ad189 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy @@ -20,8 +20,6 @@ package org.onap.so.bpmn.infrastructure.scripts -import static org.junit.Assert.* - import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity import org.junit.Before import org.junit.Test @@ -33,6 +31,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 static org.mockito.Mockito.spy import static org.mockito.Mockito.times @@ -137,7 +137,7 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest { DoAllocateCoreSharedSlice obj = spy(DoAllocateCoreSharedSlice.class) when(obj.getAAIClient()).thenReturn(client) - AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX") + AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX")) when(client.exists(resourceUri1)).thenReturn(true) AAIResultWrapper wrapper1 = new AAIResultWrapper(mockQuerySliceServiceReturn()) when(client.get(resourceUri1, NotFoundException.class)).thenReturn(wrapper1) @@ -145,27 +145,27 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest { //networkServiceInstanceId when(mockExecution.getVariable("networkServiceInstanceId")).thenReturn("206535e7-77c9-4036-9387-3f1cf57b4379") - AAIResourceUri resourceUri2 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "206535e7-77c9-4036-9387-3f1cf57b4379") + AAIResourceUri resourceUri2 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("206535e7-77c9-4036-9387-3f1cf57b4379")) when(client.exists(resourceUri2)).thenReturn(true) AAIResultWrapper wrapper2 = new AAIResultWrapper(mockQueryNS()) when(client.get(resourceUri2, NotFoundException.class)).thenReturn(wrapper2) //Check Vnf when(mockExecution.getVariable("vnfId")).thenReturn("eeb66c6f-36bd-47ad-8294-48f46b1aa912") - AAIResourceUri resourceUri3 = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "eeb66c6f-36bd-47ad-8294-48f46b1aa912") + AAIResourceUri resourceUri3 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("eeb66c6f-36bd-47ad-8294-48f46b1aa912")) when(client.exists(resourceUri3)).thenReturn(true) AAIResultWrapper wrapper3 = new AAIResultWrapper(mockQueryVnf()) when(client.get(resourceUri3, NotFoundException.class)).thenReturn(wrapper3) //Allotted Resources-1 - AAIResourceUri resourceUri4 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "0d3d3cce-46a8-486d-816a-954e71697c4e") + AAIResourceUri resourceUri4 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("0d3d3cce-46a8-486d-816a-954e71697c4e")) when(client.exists(resourceUri4)).thenReturn(true) AAIResultWrapper wrapper4 = new AAIResultWrapper(mockServiceProfile1()) when(client.get(resourceUri4, NotFoundException.class)).thenReturn(wrapper4) //Allotted Resources-2 - AAIResourceUri resourceUri5 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "1c7046f2-a5a3-4d7f-9da8-388ee641a795") + AAIResourceUri resourceUri5 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("1c7046f2-a5a3-4d7f-9da8-388ee641a795")) when(client.exists(resourceUri5)).thenReturn(true) AAIResultWrapper wrapper5 = new AAIResultWrapper(mockServiceProfile2()) when(client.get(resourceUri5, NotFoundException.class)).thenReturn(wrapper5) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateTnNssiTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateTnNssiTest.groovy index 33110b6e5b..6ea2be8e55 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateTnNssiTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateTnNssiTest.groovy @@ -29,6 +29,8 @@ import org.mockito.Mockito 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.bpmn.common.scripts.MsoGroovyTest import static org.junit.Assert.assertNotNull @@ -82,7 +84,7 @@ class DoAllocateTnNssiTest extends MsoGroovyTest { // String sliceProfile = jsonUtil.getJsonValue(mockSliceParams(), "sliceProfile") // when(mockExecution.getVariable("sliceProfile")).thenReturn(sliceProfile) - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be") + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be")) DoCreateTnNssiInstance obj = spy(DoCreateTnNssiInstance.class) when(obj.getAAIClient()).thenReturn(client) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSITest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSITest.groovy new file mode 100644 index 0000000000..2c943ffc7c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSITest.groovy @@ -0,0 +1,585 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Telecom Italia + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.Before +import org.junit.Test +import org.mockito.Mockito +import org.onap.aai.domain.yang.* +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.AAISimpleUri +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.aai.entities.uri.ServiceInstanceUri +import org.onap.so.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.serviceinstancebeans.RequestDetails + +import static org.junit.Assert.assertNotNull +import static org.junit.Assert.assertTrue +import static org.mockito.Mockito.* + +class DoCommonCoreNSSITest extends MsoGroovyTest { + @Before + void init() throws IOException { + super.init("DoCommonCoreNSSITest") + } + + + @Test + void testPreProcessRequest() { + def currentNSSI = [:] + currentNSSI.put("nssiId","5G-999") + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + DoCommonCoreNSSI dcnssi = new DoCommonCoreNSSI() + dcnssi.preProcessRequest(mockExecution) + Mockito.verify(mockExecution,times(1)).getVariable("currentNSSI") + } + + + @Test + void testGetNetworkServiceInstance() { + def currentNSSI = [:] + currentNSSI.put("nssiId","5G-999") + + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment("5G-999")) + AAIResourceUri networkServiceInstanceUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment("NS-777")) + + ServiceInstance nssi = new ServiceInstance() + nssi.setServiceInstanceId("5G-999") + + ServiceInstance networkServiceInstance = new ServiceInstance() + networkServiceInstance.setServiceInstanceId("NS-777") + networkServiceInstance.setServiceRole("Network Service") + + Optional<ServiceInstance> nssiOpt = Optional.of(nssi) + Optional<ServiceInstance> networkServiceInstaneOpt = Optional.of(networkServiceInstance) + + DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class) + when(spy.getAAIClient()).thenReturn(client) + + when(client.get(ServiceInstance.class, nssiUri)).thenReturn(nssiOpt) + + //String json = FileUtil.readResourceFile("__files/AAI/ServiceInstanceWithAR.json") + AAIResultWrapper wrapperMock = mock(AAIResultWrapper.class) //new AAIResultWrapper(json) + Relationships rsMock = mock(Relationships.class) + Optional<Relationships> orsMock = Optional.of(rsMock) + List<AAIResourceUri> arus = new ArrayList<>() + AAIResourceUri aru = new ServiceInstanceUri(networkServiceInstanceUri) + arus.add(aru) + + when(client.get(nssiUri)).thenReturn(wrapperMock) + when(wrapperMock.getRelationships()).thenReturn(orsMock) + + when(rsMockgetRelatedUris(Types.SERVICE_INSTANCE)).thenReturn(arus) + when(client.get(ServiceInstance.class, aru)).thenReturn(networkServiceInstaneOpt) + + spy.getNetworkServiceInstance(mockExecution) + + assertTrue("Either NSSI doesn't exist or unexpected NSSI Service Instance ID", + currentNSSI.get("nssi") != null && ((ServiceInstance)currentNSSI.get("nssi")).getServiceInstanceId().equals(nssi.getServiceInstanceId())) + + assertTrue("Either Network Service Instance doesn't exist or unexpected Network Service Instance ID", + currentNSSI.get("networkServiceInstance") != null && ((ServiceInstance)currentNSSI.get("networkServiceInstance")).getServiceInstanceId().equals(networkServiceInstance.getServiceInstanceId())) + + assertNotNull("networkServiceInstanceUri doesn't exist", currentNSSI.get("networkServiceInstanceUri")) + } + + + @Test + void getConstituteVNFFromNetworkServiceInst() { + def currentNSSI = [:] + + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class) + when(spy.getAAIClient()).thenReturn(client) + + ServiceInstance networkServiceInstance = new ServiceInstance() + networkServiceInstance.setServiceInstanceId("NS-777") + networkServiceInstance.setServiceRole("Network Service") + + GenericVnf genericVNF = new GenericVnf() + genericVNF.setVnfId("VNF-1") + + AAIResourceUri networkServiceInstanceUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(networkServiceInstance.getServiceInstanceId())) + + Optional<GenericVnf> genericVnfOpt = Optional.of(genericVNF) + AAIResourceUri genericVNFUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVNF.getVnfId())) + + currentNSSI.put("networkServiceInstanceUri", networkServiceInstanceUri) + currentNSSI.put("networkServiceInstance", networkServiceInstance) + + AAIResultWrapper wrapperMock = mock(AAIResultWrapper.class) //new AAIResultWrapper(json) + Relationships rsMock = mock(Relationships.class) + Optional<Relationships> orsMock = Optional.of(rsMock) + List<AAIResourceUri> arus = new ArrayList<>() + AAIResourceUri aru = new AAISimpleUri(genericVNFUri) + arus.add(aru) + + when(client.get(networkServiceInstanceUri)).thenReturn(wrapperMock) + when(wrapperMock.getRelationships()).thenReturn(orsMock) + + when(rsMockgetRelatedUris(Types.GENERIC_VNF)).thenReturn(arus) + when(client.get(GenericVnf.class, genericVNFUri)).thenReturn(genericVnfOpt) + + spy.getConstituteVNFFromNetworkServiceInst(mockExecution) + + assertNotNull("constituteVnfUri doesn't exist", currentNSSI.get("constituteVnfUri")) + + assertTrue("Either Constitute VNF doesn't exist or unexpected VNF ID", + currentNSSI.get("constituteVnf") != null && ((GenericVnf)currentNSSI.get("constituteVnf")).getVnfId().equals(genericVNF.getVnfId())) + } + + + @Test + void testGetNSSIAssociatedProfiles() { + def currentNSSI = [:] + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + ServiceInstance nssi = new ServiceInstance() + nssi.setServiceInstanceId("5G-999") + + SliceProfiles sliceProfiles = new SliceProfiles() + + List<SliceProfile> slProfiles = sliceProfiles.getSliceProfile() + slProfiles.add(new SliceProfile()) + slProfiles.add(new SliceProfile()) + + nssi.setSliceProfiles(sliceProfiles) + currentNSSI.put("nssi", nssi) + + DoCommonCoreNSSI obj = new DoCommonCoreNSSI() + obj.getNSSIAssociatedProfiles(mockExecution) + + List<SliceProfile> associatedProfiles = (List<SliceProfile>)currentNSSI.get("associatedProfiles") + assertTrue("Either associatedProfiles doesn't exist or size is incorrect", (associatedProfiles != null && associatedProfiles.size() == 2)) + } + + + @Test + void testInvokePUTServiceInstance() { + def currentNSSI = [:] + + ServiceInstance networkServiceInstance = new ServiceInstance() + networkServiceInstance.setServiceInstanceId("NS-777") + networkServiceInstance.setServiceRole("Network Service") + + GenericVnf constituteVnf = new GenericVnf() + constituteVnf.setVnfId("VNF-1") + + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + currentNSSI.put("networkServiceInstance", networkServiceInstance) + currentNSSI.put("constituteVnf", constituteVnf) + + when(mockExecution.getVariable("mso.infra.endpoint.url")).thenReturn("http://mso.onap:8088") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("mso.msoKey") + when(mockExecution.getVariable("mso.infra.endpoint.auth")).thenReturn("mso.infra.endpoint.auth") + + DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class) + when(spy.getAAIClient()).thenReturn(client) + + when(spy.encryptBasicAuth("mso.infra.endpoint.auth", "mso.msoKey")).thenReturn("auth-value") + + String authHeaderResponse = "auth-header" + + when(spy.getAuthHeader(mockExecution, "auth-value", "mso.msoKey")).thenReturn(authHeaderResponse) + + String urlString = String.format("http://mso.onap:8088/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s", networkServiceInstance.getServiceInstanceId(), constituteVnf.getVnfId()) + + String callPUTServiceInstanceResponse = "put" + + RequestDetails requestDetails = new RequestDetails() + ObjectMapper mapper = new ObjectMapper() + String requestDetailsStr = mapper.writeValueAsString(requestDetails) + + when(spy.prepareRequestDetails(mockExecution)).thenReturn(requestDetailsStr) + + when(spy.callPUTServiceInstance(urlString, "auth-header", requestDetailsStr)).thenReturn(callPUTServiceInstanceResponse) + + spy.invokePUTServiceInstance(mockExecution) + } + + + @Test + void testRemoveSPAssociationWithNSSI() { + def currentNSSI = [:] + + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + String nssiId = "5G-999" + currentNSSI.put("nssiId", nssiId) + ServiceInstance nssi = new ServiceInstance() + nssi.setServiceInstanceId(nssiId) + nssi.setSliceProfiles(new SliceProfiles()) + + currentNSSI.put("nssi", nssi) + + AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId)) + + DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class) + + when(spy.getAAIClient()).thenReturn(client) + + String theSNSSAI = "theS-NSSAI" + currentNSSI.put("S-NSSAI", theSNSSAI) + + List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile() + + SliceProfile sliceProfile1 = new SliceProfile() + sliceProfile1.setSNssai("snssai1") + + SliceProfile sliceProfile2 = new SliceProfile() + sliceProfile2.setSNssai(theSNSSAI) + + SliceProfile sliceProfile3 = new SliceProfile() + sliceProfile3.setSNssai("snssai3") + + associatedProfiles.add(sliceProfile1) + associatedProfiles.add(sliceProfile2) + associatedProfiles.add(sliceProfile3) + + int sizeBefore = associatedProfiles.size() + + doNothing().when(client).update(nssiUri, nssi) + + spy.removeSPAssociationWithNSSI(mockExecution) + + assertTrue("Association between slice profile and NSSI wasn't removed", ((ServiceInstance)currentNSSI.get("nssi")).getSliceProfiles().getSliceProfile().size() == (sizeBefore - 1)) + } + + + @Test + void testDeleteSliceProfileInstance() { + def currentNSSI = [:] + + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + String globalSubscriberId = "global-id" + String serviceType = "service" + String nssiId = "5G-999" + + currentNSSI.put("globalSubscriberId", globalSubscriberId) + currentNSSI.put("serviceType", serviceType) + currentNSSI.put("nssiId", nssiId) + + String theSNSSAI = "theS-NSSAI" + + SliceProfile sliceProfile = new SliceProfile() + sliceProfile.setSNssai(theSNSSAI) + sliceProfile.setProfileId("prof-id") + + AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId)) + + currentNSSI.put("sliceProfileS-NSSAI", sliceProfile) + + DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class) + + when(spy.getAAIClient()).thenReturn(client) + + doNothing().when(client).delete(nssiUri) + + spy.deleteSliceProfileInstance(mockExecution) + + } + + + @Test + void testUpdateServiceOperationStatus() { + def currentNSSI = [:] + + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + String nssiId = "5G-999" + + currentNSSI.put("nssiId", nssiId) + currentNSSI.put("e2eServiceInstanceId", "e2eServiceInstanceId") + currentNSSI.put("operationId", "operationId") + currentNSSI.put("operationType", "operationType") + + DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class) + + spy.updateServiceOperationStatus(mockExecution) + + } + + + @Test + void testPrepareRequestDetails() { + def currentNSSI = [:] + + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + ServiceInstance networkServiceInstance = new ServiceInstance() + networkServiceInstance.setServiceInstanceId("NS-777") + networkServiceInstance.setServiceRole("Network Service") + networkServiceInstance.setModelInvariantId("model-invariant-id") + networkServiceInstance.setServiceInstanceName("service-instance-name") + + ServiceInstance nssi = new ServiceInstance() + nssi.setServiceInstanceId("5G-999") + nssi.setOrchestrationStatus("orchestration-status") + + AAIResourceUri networkServiceInstanceUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(networkServiceInstance.getServiceInstanceId())) + + AAIResourceUri cloudRegionAAIUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion("cloud-owner", "cloud-region-id")) + + currentNSSI.put("networkServiceInstanceUri", networkServiceInstanceUri) + + currentNSSI.put("networkServiceInstance", networkServiceInstance) + + currentNSSI.put("globalSubscriberId", "globalSubscriberId") + + currentNSSI.put("subscriberName", "subscriber-name") + + currentNSSI.put("serviceId", "service-id") + + currentNSSI.put("nssi", nssi) + + List<SliceProfile> associatedProfiles = new ArrayList<>() + SliceProfile sliceProfile1 = new SliceProfile() + sliceProfile1.setSNssai("snssai1") + + SliceProfile sliceProfile2 = new SliceProfile() + sliceProfile2.setSNssai("snssai2") + + associatedProfiles.add(sliceProfile1) + associatedProfiles.add(sliceProfile2) + + List<String> snssais = new ArrayList<>() + snssais.add(sliceProfile1.getSNssai()) + snssais.add(sliceProfile2.getSNssai()) + + currentNSSI.put("S-NSSAIs", snssais) + + + ServiceSubscription serviceSubscription = new ServiceSubscription() + serviceSubscription.setServiceType("service-type") + + currentNSSI.put("serviceSubscription", serviceSubscription) + + GenericVnf genericVnf = new GenericVnf() + genericVnf.setServiceId("service-id") + genericVnf.setVnfName("vnf-name") + genericVnf.setModelInvariantId("model-invariant-id") + genericVnf.setModelCustomizationId("model-customization-id") + genericVnf.setVnfName("vnf-name") + genericVnf.setVnfId("vnf-id") + + VfModule vfModule = new VfModule() + vfModule.setModelInvariantId("model-invariant-id") + vfModule.setModelCustomizationId("model-customization-id") + vfModule.setModelVersionId("model-version-id") + vfModule.setVfModuleName("vf-module-name") + + VfModules vfModules = new VfModules() + vfModules.getVfModule().add(vfModule) + genericVnf.setVfModules(vfModules) + + currentNSSI.put("constituteVnf", genericVnf) + + AAIResourceUri constituteVNFURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnf.getVnfId())) + + currentNSSI.put("constituteVnfUri", constituteVNFURI) + + DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class) + + when(spy.getAAIClient()).thenReturn(client) + + prepareModelVer(networkServiceInstance) + + //prepareSubscriberInfo(networkServiceInstanceUri) + + prepareCloudConfiguration(constituteVNFURI, cloudRegionAAIUri) + + prepareModelVer(genericVnf) + + prepareModelVer(vfModule) + + prepareOwningEntity(networkServiceInstanceUri) + + prepareProject(cloudRegionAAIUri) + + String requestDetails = spy.prepareRequestDetails(mockExecution) + + } + + + void prepareProject(AAIResourceUri cloudRegionAAIUri) { + Project project = new Project() + project.setProjectName("project-name") + + AAIResultWrapper wrapperMock = mock(AAIResultWrapper.class) + Relationships rsMock = mock(Relationships.class) + Optional<Relationships> orsMock = Optional.of(rsMock) + + when(client.get(cloudRegionAAIUri)).thenReturn(wrapperMock) + when(wrapperMock.getRelationships()).thenReturn(orsMock) + + List<AAIResourceUri> arus = new ArrayList<>() + AAIResourceUri aru = new AAISimpleUri(cloudRegionAAIUri) + arus.add(aru) + + when(rsMockgetRelatedUris(Types.PROJECT)).thenReturn(arus) + + Optional<Project> projectOpt = Optional.of(project) + + when(client.get(Project.class, aru)).thenReturn(projectOpt) + } + + + void prepareOwningEntity(AAIResourceUri networkServiceInstanceUri) { + OwningEntity owningEntity = new OwningEntity() + + owningEntity.setOwningEntityId("owning-entity-id") + owningEntity.setOwningEntityName("owning-entity-name") + + AAIResultWrapper wrapperMock = mock(AAIResultWrapper.class) + + Relationships rsMock = mock(Relationships.class) + Optional<Relationships> orsMock = Optional.of(rsMock) + + when(client.get(networkServiceInstanceUri)).thenReturn(wrapperMock) + when(wrapperMock.getRelationships()).thenReturn(orsMock) + + List<AAIResourceUri> arus = new ArrayList<>() + AAIResourceUri aru = new AAISimpleUri(networkServiceInstanceUri) + arus.add(aru) + + when(rsMockgetRelatedUris(Types.OWNING_ENTITY)).thenReturn(arus) + + Optional<OwningEntity> owningEntityOpt = Optional.of(owningEntity) + + when(client.get(OwningEntity.class, aru)).thenReturn(owningEntityOpt) + } + + + + void prepareCloudConfiguration(AAIResourceUri constituteVNFURI, cloudRegionAAIUri) { + AAIResultWrapper wrapperMock = mock(AAIResultWrapper.class) + + Relationships rsMock = mock(Relationships.class) + Optional<Relationships> orsMock = Optional.of(rsMock) + + when(client.get(constituteVNFURI)).thenReturn(wrapperMock) + when(wrapperMock.getRelationships()).thenReturn(orsMock) + + List<AAIResourceUri> arus = new ArrayList<>() + AAIResourceUri aru = new AAISimpleUri(cloudRegionAAIUri) + arus.add(aru) + + when(rsMockgetRelatedUris(Types.CLOUD_REGION)).thenReturn(arus) + + CloudRegion cloudRegion = new CloudRegion() + cloudRegion.setCloudRegionId("cloud-region-id") + cloudRegion.setCloudOwner("cloud-owner") + Tenant tenant = new Tenant() + tenant.setTenantId("tenant-id") + + Tenants tenants = new Tenants() + tenants.getTenant().add(tenant) + cloudRegion.setTenants(tenants) + Optional<CloudRegion> cloudRegionOpt = Optional.of(cloudRegion) + + when(client.get(CloudRegion.class, aru)).thenReturn(cloudRegionOpt) + } + + + void prepareSubscriberInfo( AAIResourceUri networkServiceInstanceUri) { + AAIResultWrapper wrapperMock = mock(AAIResultWrapper.class) + + Relationships rsMock = mock(Relationships.class) + Optional<Relationships> orsMock = Optional.of(rsMock) + + when(client.get(networkServiceInstanceUri)).thenReturn(wrapperMock) + when(wrapperMock.getRelationships()).thenReturn(orsMock) + + AAIResourceUri serviceSubscriptionUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("global-customer-id").serviceSubscription("service-type")) + + AAIResourceUri customerUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("global-customer-id")) + List<AAIResourceUri> arus = new ArrayList<>() + + arus.add(serviceSubscriptionUri) + + when(rsMockgetRelatedUris(Types.SERVICE_SUBSCRIPTION)).thenReturn(arus) + + ServiceSubscription serviceSubscription = new ServiceSubscription() + serviceSubscription.setServiceType("service-type") + Optional<ServiceSubscription> serviceSubscriptionOpt = Optional.of(serviceSubscription) + + when(client.get(ServiceSubscription.class, serviceSubscriptionUri)).thenReturn(serviceSubscriptionOpt) + + when(client.get(networkServiceInstanceUri)).thenReturn(wrapperMock) + + when(rsMockgetRelatedUris(Types.CUSTOMER)).thenReturn(arus) + + Customer customer = new Customer() + customer.setSubscriberName("subscriber-name") + Optional<Customer> customerOpt = Optional.of(customer) + + when(client.get(Customer.class, customerUri)).thenReturn(customerOpt) + } + + + void prepareModelVer(ServiceInstance networkServiceInstance) { + ModelVer modelVer = new ModelVer() + modelVer.setModelVersionId("model-version-id") + modelVer.setModelName("model-name") + modelVer.setModelVersion("model-version") + + Optional<ModelVer> modelVerOpt = Optional.of(modelVer) + + AAIResourceUri modelVerUrl = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation().model(networkServiceInstance.getModelInvariantId()).modelVer(networkServiceInstance.getModelVersionId())) + when(client.get(ModelVer.class, modelVerUrl)).thenReturn(modelVerOpt) + } + + void prepareModelVer(GenericVnf genericVnf) { + ModelVer modelVer = new ModelVer() + modelVer.setModelVersionId("model-version-id") + modelVer.setModelName("model-name") + modelVer.setModelVersion("model-version") + + Optional<ModelVer> modelVerOpt = Optional.of(modelVer) + + AAIResourceUri modelVerUrl = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation().model(genericVnf.getModelInvariantId()).modelVer(genericVnf.getModelVersionId())) + when(client.get(ModelVer.class, modelVerUrl)).thenReturn(modelVerOpt) + } + + void prepareModelVer(VfModule vfModule) { + ModelVer modelVer = new ModelVer() + modelVer.setModelVersionId("model-version-id") + modelVer.setModelName("model-name") + modelVer.setModelVersion("model-version") + + Optional<ModelVer> modelVerOpt = Optional.of(modelVer) + + AAIResourceUri modelVerUrl = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation().model(vfModule.getModelInvariantId()).modelVer(vfModule.getModelVersionId())) + when(client.get(ModelVer.class, modelVerUrl)).thenReturn(modelVerOpt) + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy index 32ebf09531..0de2c8c575 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy @@ -35,6 +35,8 @@ import org.onap.so.bpmn.common.scripts.MsoGroovyTest 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 javax.ws.rs.NotFoundException import static org.junit.Assert.assertEquals import static org.mockito.ArgumentMatchers.isA @@ -65,8 +67,8 @@ class DoCreateVFCNetworkServiceInstanceTest extends MsoGroovyTest { when(mockExecution.getVariable("serviceId")).thenReturn("SER12345") doNothing().when(client).connect(isA(AAIResourceUri.class),isA(AAIResourceUri.class)) doCreateVFCNetworkServiceInstance.addNSRelationship(mockExecution); - AAIResourceUri nsUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,"MSO_dev","MSO-dev-service-type","NS12345") - AAIResourceUri relatedServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,"MSO_dev","MSO-dev-service-type","SER12345") + AAIResourceUri nsUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("MSO_dev").serviceSubscription("MSO-dev-service-type").serviceInstance("NS12345")) + AAIResourceUri relatedServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("MSO_dev").serviceSubscription("MSO-dev-service-type").serviceInstance("SER12345")) Mockito.verify(client).connect(nsUri,relatedServiceUri) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy index b2573f1b51..1a15f0eb14 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy @@ -43,11 +43,12 @@ import org.onap.so.bpmn.common.scripts.utils.XmlComparator import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.mock.FileUtil -import org.onap.aaiclient.client.aai.AAIObjectPlurals import org.onap.aaiclient.client.aai.AAIObjectType 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.exceptions.GraphInventoryUriComputationException import javax.ws.rs.NotFoundException @@ -169,7 +170,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{ fqdnList.add("test") when(mockExecution.getVariable(prefix + "createdNetworkPolicyFqdnList")).thenReturn(fqdnList) - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies()) uri.queryParam("network-policy-fqdn", "test") NetworkPolicies networkPolicies = new NetworkPolicies(); NetworkPolicy networkPolicy = new NetworkPolicy(); @@ -177,7 +178,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{ networkPolicies.getNetworkPolicy().add(networkPolicy) when(client.get(NetworkPolicies.class, uri)).thenReturn(Optional.of(networkPolicies)) - AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicy.getNetworkPolicyId()) + AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicy.getNetworkPolicyId())) doNothing().when(client).delete(delUri) doCreateVfModuleRollback.deleteNetworkPoliciesFromAAI(mockExecution) @@ -199,7 +200,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{ fqdnList.add("test") when(mockExecution.getVariable(prefix + "createdNetworkPolicyFqdnList")).thenReturn(fqdnList) - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies()) uri.queryParam("network-policy-fqdn", "test") NetworkPolicies networkPolicies = new NetworkPolicies(); NetworkPolicy networkPolicy = new NetworkPolicy(); @@ -207,7 +208,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{ networkPolicies.getNetworkPolicy().add(networkPolicy) when(client.get(NetworkPolicies.class, uri)).thenReturn(Optional.of(networkPolicies)) - AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicy.getNetworkPolicyId()) + AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicy.getNetworkPolicyId())) doThrow(new NotFoundException("Not Found!")).when(client).delete(delUri) doCreateVfModuleRollback.deleteNetworkPoliciesFromAAI(mockExecution) @@ -229,7 +230,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{ fqdnList.add("test") when(mockExecution.getVariable(prefix + "createdNetworkPolicyFqdnList")).thenReturn(fqdnList) - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies()) uri.queryParam("network-policy-fqdn", "test") NetworkPolicies networkPolicies = new NetworkPolicies(); NetworkPolicy networkPolicy = new NetworkPolicy(); @@ -237,7 +238,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{ networkPolicies.getNetworkPolicy().add(networkPolicy) when(client.get(NetworkPolicies.class, uri)).thenReturn(Optional.of(networkPolicies)) - AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicy.getNetworkPolicyId()) + AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicy.getNetworkPolicyId())) doThrow(new GraphInventoryUriComputationException("Error!")).when(client).delete(delUri) try { doCreateVfModuleRollback.deleteNetworkPoliciesFromAAI(mockExecution) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollbackTest.groovy index cc522544de..1bc6fc5f66 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollbackTest.groovy @@ -20,21 +20,19 @@ package org.onap.so.bpmn.infrastructure.scripts; +import static org.mockito.Mockito.spy +import static org.mockito.Mockito.when; import org.junit.Before; import org.junit.Test -import org.onap.aai.domain.yang.VfModule import org.onap.aai.domain.yang.VolumeGroup import org.onap.aai.domain.yang.VolumeGroups; -import org.onap.so.bpmn.common.scripts.MsoGroovyTest -import org.onap.aaiclient.client.aai.AAIObjectPlurals 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.so.bpmn.common.scripts.MsoGroovyTest import org.onap.so.constants.Defaults -import static org.mockito.Mockito.spy -import static org.mockito.Mockito.when; - public class DoCreateVfModuleVolumeRollbackTest extends MsoGroovyTest { private DoCreateVfModuleVolumeRollback doCreateVfModuleVolumeRollback; @@ -51,7 +49,7 @@ public class DoCreateVfModuleVolumeRollbackTest extends MsoGroovyTest { String cloudRegionId = "cloudRegionId" when(mockExecution.getVariable("DCVFMODVOLRBK_volumeGroupName")).thenReturn(volumeGroupName) when(mockExecution.getVariable("DCVFMODVOLRBK_lcpCloudRegionId")).thenReturn(cloudRegionId) - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegionId).queryParam("volume-group-name", volumeGroupName) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegionId).volumeGroups()).queryParam("volume-group-name", volumeGroupName) VolumeGroup volumeGroup = new VolumeGroup(); volumeGroup.setVolumeGroupId("volumeGroupId") VolumeGroups groups = new VolumeGroups(); diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy index 7aa162cae7..d417abc671 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy @@ -20,39 +20,34 @@ package org.onap.so.bpmn.infrastructure.scripts +import static org.junit.Assert.assertEquals +import static org.junit.Assert.assertNotNull +import static org.mockito.ArgumentMatchers.anyObject +import static org.mockito.Mockito.spy +import static org.mockito.Mockito.times +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.when import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity import org.junit.Before -import org.junit.Rule import org.junit.Test -import org.junit.rules.ExpectedException -import org.junit.runner.RunWith import org.mockito.ArgumentCaptor import org.mockito.Captor import org.mockito.Mockito import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner import org.onap.aai.domain.yang.GenericVnf -import org.onap.aai.domain.yang.Volume import org.onap.aai.domain.yang.VolumeGroup import org.onap.aai.domain.yang.VolumeGroups -import org.onap.so.bpmn.common.scripts.MsoGroovyTest -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.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.so.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.bpmn.core.RollbackData import org.onap.so.constants.Defaults -import static org.junit.Assert.assertEquals -import static org.junit.Assert.assertNotNull -import static org.mockito.ArgumentMatchers.anyObject -import static org.mockito.Mockito.spy -import static org.mockito.Mockito.times -import static org.mockito.Mockito.verify -import static org.mockito.Mockito.when - class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest { @@ -161,7 +156,7 @@ class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest { String lcpCloudRegionId = "lcpCloudRegionId" when(mockExecution.getVariable(volumeGroupName)).thenReturn(volumeGroupName) when(mockExecution.getVariable(lcpCloudRegionId)).thenReturn(lcpCloudRegionId) - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), lcpCloudRegionId).queryParam("volume-group-name", volumeGroupName) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), lcpCloudRegionId).volumeGroups()).queryParam("volume-group-name", volumeGroupName) VolumeGroups volumeGroups = new VolumeGroups(); VolumeGroup volumeGroup = new VolumeGroup() volumeGroup.setVolumeGroupId("volumeGroupId") @@ -177,7 +172,7 @@ class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest { String lcpCloudRegionId = "lcpCloudRegionId" when(mockExecution.getVariable(volumeGroupName)).thenReturn(volumeGroupName) when(mockExecution.getVariable(lcpCloudRegionId)).thenReturn(lcpCloudRegionId) - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), lcpCloudRegionId).queryParam("volume-group-name", volumeGroupName) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), lcpCloudRegionId).volumeGroups()).queryParam("volume-group-name", volumeGroupName) when(client.get(VolumeGroup.class,uri)).thenReturn(Optional.empty()) thrown.expect(BpmnError.class) doCreateVfModuleVolumeV2.callRESTQueryAAIVolGrpName(mockExecution,null) @@ -215,7 +210,7 @@ class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest { void testcallRESTQueryAAIGenericVnf(){ String vnfId = "vnfId" when(mockExecution.getVariable(vnfId)).thenReturn(vnfId) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) GenericVnf genericVnf = new GenericVnf() genericVnf.setVnfId(vnfId) when(client.get(GenericVnf.class,uri)).thenReturn(Optional.of(genericVnf)) @@ -227,7 +222,7 @@ class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest { void testcallRESTQueryAAIGenericVnf_NotFound(){ String vnfId = "vnfId" when(mockExecution.getVariable(vnfId)).thenReturn(vnfId) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) when(client.get(GenericVnf.class,uri)).thenReturn(Optional.empty()) thrown.expect(BpmnError.class) doCreateVfModuleVolumeV2.callRESTQueryAAIGenericVnf(mockExecution,null) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2Test.groovy index a3b2a1c8b9..2cb351c2b9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2Test.groovy @@ -20,19 +20,20 @@ package org.onap.so.bpmn.infrastructure.scripts +import static org.mockito.Mockito.times +import static org.mockito.Mockito.when +import javax.ws.rs.core.UriBuilder import org.junit.Before import org.junit.Test import org.mockito.Mockito import org.mockito.Spy import org.onap.aai.domain.yang.AllottedResource -import org.onap.so.bpmn.common.scripts.MsoGroovyTest -import org.onap.so.bpmn.mock.FileUtil -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 javax.ws.rs.core.UriBuilder -import static org.mockito.Mockito.times -import static org.mockito.Mockito.when +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types +import org.onap.so.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.bpmn.mock.FileUtil class DoCustomDeleteE2EServiceInstanceV2Test extends MsoGroovyTest { @@ -49,7 +50,7 @@ class DoCustomDeleteE2EServiceInstanceV2Test extends MsoGroovyTest { void testPrepareServiceDeleteResource(){ when(mockExecution.getVariable("serviceInstance")).thenReturn(FileUtil.readResourceFile("__files/AAI/ServiceInstanceWithAR.json")) def relink = "/aai/v11/business/customers/customer/testCustIdInfra/service-subscriptions/service-subscription/HNPORTAL/service-instances/service-instance/testServiceInstanceIdPortalPri/allotted-resources/allotted-resource/testAllottedResourceIdPortalPri" - AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(relink).build()) + AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(Types.ALLOTTED_RESOURCE, UriBuilder.fromPath(relink).build()) AllottedResource ar = new AllottedResource(); ar.setId("ar1") ar.setType("ar") diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy new file mode 100644 index 0000000000..eae788666d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy @@ -0,0 +1,266 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Telecom Italia + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + + +import org.junit.Before +import org.junit.Test +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.aai.domain.yang.SliceProfile +import org.onap.aai.domain.yang.SliceProfiles +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.bpmn.common.scripts.MsoGroovyTest + +import static org.junit.Assert.assertNotNull +import static org.junit.Assert.assertTrue +import static org.mockito.Mockito.* + +class DoDeallocateCoreNSSITest extends MsoGroovyTest { + + @Before + void init() throws IOException { + super.init("DoDeallocateNSSITest") + } + + + @Test + void testExecuteTerminateNSSIQuery() { + + def currentNSSI = [:] + currentNSSI.put("nssiId","5G-999") + + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + when(mockExecution.getVariable("mso.oof.endpoint")).thenReturn("http://oof.onap:8088") + when(mockExecution.getVariable("mso.oof.auth")).thenReturn("mso.oof.auth") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("mso.msoKey") + when(mockExecution.getVariable("mso-request-id")).thenReturn("mso-request-id") + + DoDeallocateCoreNSSI spy = spy(DoDeallocateCoreNSSI.class) + when(spy.getAAIClient()).thenReturn(client) + + when(spy.encryptBasicAuth("mso.oof.auth", "mso.msoKey")).thenReturn("auth-value") + + String authHeaderResponse = "auth-header" + + /* String authHeaderResponse = "{\n" + + " \"errorCode\": \"401\",\n" + + " \"errorMessage\": \"Bad request\"\n" + + "}" */ + + when(spy.getAuthHeader(mockExecution, "auth-value", "mso.msoKey")).thenReturn(authHeaderResponse) + + String urlString = "http://oof.onap:8088" + + String httpRequest = "{\n" + + " \"type\": \"NSSI\",\n" + + " \"NxIId\": \"5G-999\",\n" + + " \"requestInfo\": {\n" + + " \"transactionId\": \"mso-request-id\",\n" + + " \"requestId\": \"mso-request-id\",\n" + + " \"sourceId\": \"so\",\n" + + " }\n" + + "}" + + boolean terminateResponse = true + + String oofResponse = "{\n" + + " \"requestId\": \"mso-request-id\",\n" + + " \"transactionId\": \"mso-request-id\",\n" + + " \"statusMessage\": \"\",\n" + + " \"requestStatus\": \"accepted\",\n" + + " \"terminateResponse\": \"${terminateResponse}\",\n" + + " \"reason\": \"\"\n" + + " }\n" + + String oofCallResponse = oofResponse + + /* String oofCallResponse = "{\n" + + " \"errorCode\": \"401\",\n" + + " \"errorMessage\": \"Exception during the call\"\n" + + "}" */ + + when(spy.callOOF(urlString, "auth-header", httpRequest)).thenReturn(oofCallResponse) + + spy.executeTerminateNSSIQuery(mockExecution) + + verify(mockExecution).setVariable("isTerminateNSSI", terminateResponse) + + } + + + @Test + void testDeleteServiceOrder() { + def currentNSSI = [:] + currentNSSI.put("nssiId","5G-999") + + ServiceInstance networkServiceInstance = new ServiceInstance() + networkServiceInstance.setServiceInstanceId("NS-777") + networkServiceInstance.setServiceRole("Network Service") + + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + currentNSSI.put("networkServiceInstance", networkServiceInstance) + + when(mockExecution.getVariable("nbi.endpoint.url")).thenReturn("http://nbi.onap:8088") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("mso.msoKey") + when(mockExecution.getVariable("mso.infra.endpoint.auth")).thenReturn("mso.infra.endpoint.auth") + + DoDeallocateCoreNSSI spy = spy(DoDeallocateCoreNSSI.class) + when(spy.getAAIClient()).thenReturn(client) + + when(spy.encryptBasicAuth("mso.infra.endpoint.auth", "mso.msoKey")).thenReturn("auth-value") + + String authHeaderResponse = "auth-header" + + /* String authHeaderResponse = "{\n" + + " \"errorCode\": \"401\",\n" + + " \"errorMessage\": \"Bad request\"\n" + + "}" */ + + when(spy.getAuthHeader(mockExecution, "auth-value", "mso.msoKey")).thenReturn(authHeaderResponse) + + String urlString = String.format("http://nbi.onap:8088/api/v4/serviceOrder/%s", networkServiceInstance.getServiceInstanceId()) + + String callDeleteServiceOrderResponse = "deleted" + + when(spy.callDeleteServiceOrder(mockExecution, urlString, "auth-header")).thenReturn(callDeleteServiceOrderResponse) + + spy.deleteServiceOrder(mockExecution) + } + + + @Test + void testGetNSSIAssociatedProfiles() { + def currentNSSI = [:] + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + ServiceInstance nssi = new ServiceInstance() + nssi.setServiceInstanceId("5G-999") + + SliceProfiles sliceProfiles = new SliceProfiles() + + List<SliceProfile> slProfiles = sliceProfiles.getSliceProfile() + slProfiles.add(new SliceProfile()) + slProfiles.add(new SliceProfile()) + + nssi.setSliceProfiles(sliceProfiles) + currentNSSI.put("nssi", nssi) + + DoDeallocateCoreNSSI obj = new DoDeallocateCoreNSSI() + obj.getNSSIAssociatedProfiles(mockExecution) + + List<SliceProfile> associatedProfiles = (List<SliceProfile>)currentNSSI.get("associatedProfiles") + assertTrue("Either associatedProfiles doesn't exist or size is incorrect", (associatedProfiles != null && associatedProfiles.size() == 2)) + } + + + @Test + void testCalculateSNSSAI() { + def currentNSSI = [:] + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + String theSNSSAI = "theS-NSSAI" + + currentNSSI.put("S-NSSAI", theSNSSAI) + + List<SliceProfile> associatedProfiles = new ArrayList<>() + SliceProfile sliceProfile1 = new SliceProfile() + sliceProfile1.setSNssai("snssai1") + + SliceProfile sliceProfile2 = new SliceProfile() + sliceProfile2.setSNssai(theSNSSAI) + + SliceProfile sliceProfile3 = new SliceProfile() + sliceProfile3.setSNssai("snssai3") + + associatedProfiles.add(sliceProfile1) + associatedProfiles.add(sliceProfile2) + associatedProfiles.add(sliceProfile3) + + int sizeBefore = associatedProfiles.size() + + currentNSSI.put("associatedProfiles", associatedProfiles) + + DoDeallocateCoreNSSI obj = new DoDeallocateCoreNSSI() + obj.calculateSNSSAI(mockExecution) + + List<SliceProfile> snssais = (List<SliceProfile>)currentNSSI.get("S-NSSAIs") + SliceProfile sliceProfileContainsSNSSAI = (SliceProfile)currentNSSI.get("sliceProfileS-NSSAI") + + assertTrue("Either snssais doesn't exist or size is incorrect", (snssais != null && snssais.size() == (sizeBefore - 1))) + assertNotNull("Slice Profile which contains given S-NSSAI not found", sliceProfileContainsSNSSAI) + assertTrue("Wrong Slice Profile", sliceProfileContainsSNSSAI.getSNssai().equals(theSNSSAI)) + } + + + @Test + void testRemoveNSSIAssociationWithNSI() { + def currentNSSI = [:] + + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + DoDeallocateCoreNSSI spy = spy(DoDeallocateCoreNSSI.class) + + when(spy.getAAIClient()).thenReturn(client) + + String nssiId = "5G-999" + String nsiId = "5G-99" + currentNSSI.put("nssiId", nssiId) + currentNSSI.put("nsiId", nsiId) + + AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId)) + AAIResourceUri nsiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nsiId)) + + doNothing().when(client).disconnect(nssiUri, nsiUri) + + spy.removeNSSIAssociationWithNSI(mockExecution) + + } + + + @Test + void testDeleteNSSIServiceInstance() { + def currentNSSI = [:] + + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + String nssiId = "5G-999" + + currentNSSI.put("nssiId", nssiId) + + AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId)) + + DoDeallocateCoreNSSI spy = spy(DoDeallocateCoreNSSI.class) + + when(spy.getAAIClient()).thenReturn(client) + + doNothing().when(client).delete(nssiUri) + + spy.deleteNSSIServiceInstance(mockExecution) + } + + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSITest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSITest.groovy index 88140d83ce..852f053f11 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSITest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSITest.groovy @@ -38,6 +38,8 @@ import org.onap.so.client.HttpClientFactory 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 javax.ws.rs.core.Response @@ -137,7 +139,7 @@ class DoDeallocateNSSITest extends MsoGroovyTest { currentNSSI.put("serviceType","5G") when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) - AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, "5GCustomer", "5G", "5G-999", "ddf57704-fe8d-417b-882d-2f2a12ddb225") + AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5G-999").sliceProfile("ddf57704-fe8d-417b-882d-2f2a12ddb225")) DoDeallocateNSSI obj = spy(DoDeallocateNSSI.class) when(obj.getAAIClient()).thenReturn(client) when(client.exists(profileUri)).thenReturn(true) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssiTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssiTest.groovy index eac79a9473..31bd3b56f5 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssiTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssiTest.groovy @@ -29,12 +29,15 @@ import org.mockito.Mockito 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.bpmn.common.scripts.MsoGroovyTest import static org.junit.Assert.assertNotNull import static org.mockito.ArgumentMatchers.eq import static org.mockito.Mockito.* + class DoDeallocateTnNssiTest extends MsoGroovyTest { @Before void init() throws IOException { @@ -124,7 +127,7 @@ class DoDeallocateTnNssiTest extends MsoGroovyTest { when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G") - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be") + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be")) DoDeallocateTnNssi obj = spy(DoDeallocateTnNssi.class) when(obj.getAAIClient()).thenReturn(client) doNothing().when(client).delete(serviceInstanceUri) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy index 3b172f3015..85106111d0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy @@ -45,6 +45,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.so.constants.Defaults @@ -1609,7 +1611,7 @@ String sdncAdapterWorkflowFormattedResponse_404 = Relationship relationship = new Relationship(); relationship.setRelatedTo("vf-module") l3Network.getRelationshipList().getRelationship().add(relationship) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ALL) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)).depth(Depth.ALL) when(client.get(L3Network.class,uri)).thenReturn(Optional.of(l3Network)) doDeleteNetworkInstance.callRESTQueryAAI(mockExecution) @@ -1643,7 +1645,7 @@ String sdncAdapterWorkflowFormattedResponse_404 = DoDeleteNetworkInstance doDeleteNetworkInstance = spy(DoDeleteNetworkInstance.class) when(doDeleteNetworkInstance.getAAIClient()).thenReturn(client) L3Network l3Network = getL3Network() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ALL) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)).depth(Depth.ALL) when(client.get(L3Network.class,uri)).thenReturn(Optional.of(l3Network)) doDeleteNetworkInstance.callRESTQueryAAI(mockExecution) @@ -1681,7 +1683,7 @@ String sdncAdapterWorkflowFormattedResponse_404 = relationship.setRelatedLink("http://localhost:18080/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER.toString() + "/lcpCloudRegion/") relationshipList.getRelationship().add(relationship) l3Network.setRelationshipList(relationshipList) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ALL) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)).depth(Depth.ALL) when(client.get(L3Network.class,uri)).thenReturn(Optional.of(l3Network)) doDeleteNetworkInstance.callRESTQueryAAI(mockExecution) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceServiceTest.groovy index 9dbb6a5a56..7b65d169a2 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceServiceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceServiceTest.groovy @@ -19,6 +19,14 @@ */ package org.onap.so.bpmn.infrastructure.scripts +import static org.junit.Assert.assertNotNull +import static org.junit.Assert.assertTrue +import static org.mockito.ArgumentMatchers.eq +import static org.mockito.Mockito.spy +import static org.mockito.Mockito.times +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.when +import javax.ws.rs.NotFoundException import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity import org.junit.Before import org.junit.Test @@ -26,23 +34,13 @@ import org.mockito.ArgumentCaptor import org.mockito.Captor import org.mockito.Mockito import org.onap.aai.domain.yang.ServiceInstance -import org.onap.so.bpmn.common.scripts.MsoGroovyTest -import org.onap.aaiclient.client.aai.AAIObjectType 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 javax.ws.rs.NotFoundException - -import static org.junit.Assert.assertEquals -import static org.junit.Assert.assertNotNull -import static org.junit.Assert.assertTrue -import static org.mockito.ArgumentMatchers.eq -import static org.mockito.Mockito.doNothing -import static org.mockito.Mockito.spy -import static org.mockito.Mockito.times -import static org.mockito.Mockito.verify -import static org.mockito.Mockito.when +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types +import org.onap.so.bpmn.common.scripts.MsoGroovyTest class DoDeleteSliceServiceTest extends MsoGroovyTest { @Before @@ -73,7 +71,7 @@ class DoDeleteSliceServiceTest extends MsoGroovyTest { when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") when(mockExecution.getVariable("serviceType")).thenReturn("5G") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be") + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be")) DoDeleteSliceService obj = spy(DoDeleteSliceService.class) AAIResultWrapper wrapper = new AAIResultWrapper(mockQuerySliceServiceReturn()) @@ -92,8 +90,9 @@ class DoDeleteSliceServiceTest extends MsoGroovyTest { when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") when(mockExecution.getVariable("serviceType")).thenReturn("5G") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE_ALL, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be") - DoDeleteSliceService obj = spy(DoDeleteSliceService.class) + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be").allottedResources()) + DoDeleteSliceService obj = spy(DoDeleteSliceService.class) AAIResultWrapper wrapper = new AAIResultWrapper(mockQueryAllottedResource()) when(obj.getAAIClient()).thenReturn(client) @@ -111,7 +110,7 @@ class DoDeleteSliceServiceTest extends MsoGroovyTest { when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") when(mockExecution.getVariable("serviceType")).thenReturn("5G") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5G-888") + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5G-888")) DoDeleteSliceService obj = spy(DoDeleteSliceService.class) AAIResultWrapper wrapper = new AAIResultWrapper(mockNSIReturn()) @@ -133,7 +132,7 @@ class DoDeleteSliceServiceTest extends MsoGroovyTest { when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") when(mockExecution.getVariable("serviceType")).thenReturn("5G") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5G-999") + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5G-999")) DoDeleteSliceService obj = spy(DoDeleteSliceService.class) AAIResultWrapper wrapper = new AAIResultWrapper(mockNSSIReturn()) @@ -181,7 +180,8 @@ class DoDeleteSliceServiceTest extends MsoGroovyTest { when(mockExecution.getVariable("serviceType")).thenReturn("5G") AAIResultWrapper wrapper = new AAIResultWrapper(mockSliceProfile()) - AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE_ALL, "5GCustomer", "5G", "5G-999") + AAIPluralResourceUri profileUri = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5G-999").sliceProfiles()) DoDeleteSliceService obj = spy(DoDeleteSliceService.class) when(obj.getAAIClient()).thenReturn(client) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstanceTest.groovy index 0251eab668..3780d42efb 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstanceTest.groovy @@ -20,24 +20,17 @@ package org.onap.so.bpmn.infrastructure.scripts +import static org.mockito.ArgumentMatchers.isA +import static org.mockito.Mockito.doThrow +import static org.mockito.Mockito.spy +import static org.mockito.Mockito.when import org.camunda.bpm.engine.delegate.BpmnError import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.rules.ExpectedException -import org.onap.aai.domain.yang.VolumeGroup -import org.onap.aai.domain.yang.VolumeGroups -import org.onap.so.bpmn.common.scripts.MsoGroovyTest -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.so.constants.Defaults - -import static org.mockito.ArgumentMatchers.isA -import static org.mockito.Mockito.doThrow -import static org.mockito.Mockito.spy -import static org.mockito.Mockito.when +import org.onap.so.bpmn.common.scripts.MsoGroovyTest public class DoDeleteVFCNetworkServiceInstanceTest extends MsoGroovyTest { diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy index daf005eabf..da68a213b0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy @@ -42,11 +42,12 @@ import org.onap.aai.domain.yang.NetworkPolicies import org.onap.aai.domain.yang.NetworkPolicy import org.onap.so.bpmn.common.scripts.MsoGroovyTest import org.onap.so.bpmn.core.WorkflowException -import org.onap.aaiclient.client.aai.AAIObjectPlurals import org.onap.aaiclient.client.aai.AAIObjectType 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 static com.github.tomakehurst.wiremock.client.WireMock.* @@ -106,7 +107,7 @@ class DoDeleteVfModuleFromVnfTest extends MsoGroovyTest { List fqdnList = new ArrayList() fqdnList.add("test") when(mockExecution.getVariable("DDVFMV_contrailNetworkPolicyFqdnList")).thenReturn(fqdnList) - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies()) uri.queryParam("network-policy-fqdn", "test") NetworkPolicies networkPolicies = new NetworkPolicies(); NetworkPolicy networkPolicy = new NetworkPolicy(); @@ -114,7 +115,7 @@ class DoDeleteVfModuleFromVnfTest extends MsoGroovyTest { networkPolicies.getNetworkPolicy().add(networkPolicy) when(client.get(NetworkPolicies.class, uri)).thenReturn(Optional.of(networkPolicies)) - AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicy.getNetworkPolicyId()) + AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicy.getNetworkPolicyId())) doNothing().when(client).delete(delUri) deleteVfModuleFromVnf.deleteNetworkPoliciesFromAAI(mockExecution) @@ -128,7 +129,7 @@ class DoDeleteVfModuleFromVnfTest extends MsoGroovyTest { List fqdnList = new ArrayList() fqdnList.add("test") when(mockExecution.getVariable("DDVFMV_contrailNetworkPolicyFqdnList")).thenReturn(fqdnList) - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies()) uri.queryParam("network-policy-fqdn", "test") when(client.get(NetworkPolicies.class, uri)).thenReturn(Optional.empty()) deleteVfModuleFromVnf.deleteNetworkPoliciesFromAAI(mockExecution) @@ -142,7 +143,7 @@ class DoDeleteVfModuleFromVnfTest extends MsoGroovyTest { void testQueryAAIForVfModule() { ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable("vnfId")).thenReturn("12345") - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "12345").depth(Depth.ONE) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("12345")).depth(Depth.ONE) GenericVnf genericVnf = new GenericVnf() genericVnf.setVnfId("test1") when(client.get(GenericVnf.class, uri)).thenReturn(Optional.of(genericVnf)) @@ -156,7 +157,7 @@ class DoDeleteVfModuleFromVnfTest extends MsoGroovyTest { void testQueryAAIForVfModuleNotFound() { ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable("vnfId")).thenReturn("12345") - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "12345").depth(Depth.ONE) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("12345")).depth(Depth.ONE) when(client.get(GenericVnf.class, uri)).thenReturn(Optional.empty()) deleteVfModuleFromVnf.queryAAIForVfModule(mockExecution) Mockito.verify(mockExecution, atLeastOnce()).setVariable("DDVMFV_getVnfResponseCode", 404) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy index 0e47958249..5882f73ce9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy @@ -20,15 +20,14 @@ package org.onap.so.bpmn.infrastructure.scripts -import com.github.tomakehurst.wiremock.junit.WireMockRule +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* +import javax.ws.rs.NotFoundException import org.camunda.bpm.engine.ProcessEngineServices import org.camunda.bpm.engine.RepositoryService import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity import org.camunda.bpm.engine.repository.ProcessDefinition -import org.junit.Assert import org.junit.Before -import org.junit.Ignore -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentCaptor @@ -40,21 +39,13 @@ import org.mockito.runners.MockitoJUnitRunner import org.onap.aai.domain.yang.NetworkPolicies import org.onap.aai.domain.yang.NetworkPolicy import org.onap.aai.domain.yang.VfModule -import org.onap.aai.domain.yang.VfModules -import org.onap.so.bpmn.common.scripts.MsoGroovyTest -import org.onap.so.bpmn.common.scripts.utils.XmlComparator -import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.bpmn.mock.FileUtil -import org.onap.aaiclient.client.aai.AAIObjectPlurals -import org.onap.aaiclient.client.aai.AAIObjectType 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 javax.ws.rs.NotFoundException - -import static com.github.tomakehurst.wiremock.client.WireMock.* -import static org.mockito.Mockito.* +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.so.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.bpmn.common.scripts.utils.XmlComparator +import org.onap.so.bpmn.mock.FileUtil @RunWith(MockitoJUnitRunner.class) class DoDeleteVfModuleTest extends MsoGroovyTest{ @@ -105,7 +96,7 @@ class DoDeleteVfModuleTest extends MsoGroovyTest{ NetworkPolicy networkPolicy = new NetworkPolicy() networkPolicy.setNetworkPolicyId("NP1") networkPolicies.getNetworkPolicy().add(networkPolicy) - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies()) uri.queryParam("network-policy-fqdn", "test") when(client.get(NetworkPolicies.class, uri)).thenReturn(Optional.of(networkPolicies)) doDeleteVfModule.deleteNetworkPoliciesFromAAI(mockExecution) @@ -121,10 +112,10 @@ class DoDeleteVfModuleTest extends MsoGroovyTest{ NetworkPolicy networkPolicy = new NetworkPolicy() networkPolicy.setNetworkPolicyId("NP1") networkPolicies.getNetworkPolicy().add(networkPolicy) - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies()) uri.queryParam("network-policy-fqdn", "test") when(client.get(NetworkPolicies.class, uri)).thenReturn(Optional.of(networkPolicies)) - AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, "NP1") + AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy("NP1")) doThrow(new NotFoundException(("Not Found !"))).when(client).delete(delUri) doDeleteVfModule.deleteNetworkPoliciesFromAAI(mockExecution) Mockito.verify(client).delete(delUri) @@ -135,7 +126,7 @@ class DoDeleteVfModuleTest extends MsoGroovyTest{ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("vnfId")).thenReturn("12345") when(mockExecution.getVariable("vfModuleId")).thenReturn("module-0") - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE,"12345","module-0") + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("12345").vfModule("module-0")) VfModule vfModule = new VfModule() vfModule.setOrchestrationStatus("Created") when(client.get(VfModule.class, uri)).thenReturn(Optional.of(vfModule)) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy index dd8601fb43..84d88ffaf9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy @@ -53,6 +53,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.aaiclient.client.graphinventory.exceptions.GraphInventoryUriComputationException import org.springframework.core.env.Environment import org.springframework.mock.env.MockEnvironment @@ -182,7 +184,7 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{ when(mockExecution.getVariable("tenantId")).thenReturn("Tenant123") when(mockExecution.getVariable("volumeGroupId")).thenReturn("VolumeGroup123") when(mockExecution.getVariable("DDVMV_aicCloudRegion")).thenReturn("Region1") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "Region1","VolumeGroup123") + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "Region1").volumeGroup("VolumeGroup123")) Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/AAI/VolumeGroupWithTenant.json"); when(client.get(VolumeGroup.class,resourceUri)).thenReturn(volumeGroup) when(client.get(resourceUri)).thenReturn( @@ -197,7 +199,7 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{ when(mockExecution.getVariable("tenantId")).thenReturn("Tenant123") when(mockExecution.getVariable("volumeGroupId")).thenReturn("VolumeGroup123") when(mockExecution.getVariable("DDVMV_aicCloudRegion")).thenReturn("Region1") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "Region1","VolumeGroup123") + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "Region1").volumeGroup("VolumeGroup123")) Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/aai/VolumeGroup.json"); when(client.get(VolumeGroup.class,resourceUri)).thenReturn(volumeGroup) try { @@ -212,7 +214,7 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{ when(mockExecution.getVariable("tenantId")).thenReturn("Tenant12345") when(mockExecution.getVariable("volumeGroupId")).thenReturn("VolumeGroup123") when(mockExecution.getVariable("DDVMV_aicCloudRegion")).thenReturn("Region1") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "Region1","VolumeGroup123") + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "Region1").volumeGroup("VolumeGroup123")) Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/AAI/VolumeGroupWithTenant.json"); when(client.get(VolumeGroup.class,resourceUri)).thenReturn(volumeGroup) try { @@ -227,7 +229,7 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{ when(mockExecution.getVariable("tenantId")).thenReturn("Tenant123") when(mockExecution.getVariable("volumeGroupId")).thenReturn("VolumeGroup123") when(mockExecution.getVariable("DDVMV_aicCloudRegion")).thenReturn("Region1") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "Region1","VolumeGroup123") + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "Region1").volumeGroup("VolumeGroup123")) when(client.get(VolumeGroup.class,resourceUri)).thenReturn(Optional.empty()) try { deleteVfModuleVolumeV2.callRESTQueryAAIForVolumeGroup(mockExecution, "true") @@ -241,7 +243,7 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{ when(mockExecution.getVariable("tenantId")).thenReturn("Tenant123") when(mockExecution.getVariable("volumeGroupId")).thenReturn("VolumeGroup123") when(mockExecution.getVariable("DDVMV_aicCloudRegion")).thenReturn("Region1") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "Region1","VolumeGroup123") + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "Region1").volumeGroup("VolumeGroup123")) Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/aai/VolumeGroupWithVfModule.json"); when(client.get(VolumeGroup.class,resourceUri)).thenReturn(volumeGroup) try { @@ -256,7 +258,7 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{ Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/aai/VolumeGroup.json"); when(mockExecution.getVariable("DDVMV_queryAAIVolGrpResponse")).thenReturn(volumeGroup.get()) when(mockExecution.getVariable("DDVMV_aicCloudRegion")).thenReturn("Region1") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "Region1","VolumeGroup123") + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "Region1").volumeGroup("VolumeGroup123")) doNothing().when(client).delete(resourceUri) deleteVfModuleVolumeV2.callRESTDeleteAAIVolumeGroup(mockExecution,"true") } @@ -266,7 +268,7 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{ Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/aai/VolumeGroupWithVfModule.json"); when(mockExecution.getVariable("DDVMV_queryAAIVolGrpResponse")).thenReturn(volumeGroup.get()) when(mockExecution.getVariable("DDVMV_aicCloudRegion")).thenReturn("Region1") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "Region1",volumeGroup.get().getVolumeGroupId()) + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "Region1").volumeGroup(volumeGroup.get()).getVolumeGroupId()) doThrow(new GraphInventoryUriComputationException("Error")).when(client).delete(resourceUri) try { deleteVfModuleVolumeV2.callRESTDeleteAAIVolumeGroup(mockExecution, "true") @@ -280,7 +282,7 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{ Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/aai/VolumeGroup.json"); when(mockExecution.getVariable("DDVMV_queryAAIVolGrpResponse")).thenReturn(volumeGroup.get()) when(mockExecution.getVariable("DDVMV_aicCloudRegion")).thenReturn("Region1") - AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "Region1","VolumeGroup123") + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "Region1").volumeGroup("VolumeGroup123")) doThrow(new NotFoundException("VolumeGroup Not found")).when(client).delete(resourceUri) try { deleteVfModuleVolumeV2.callRESTDeleteAAIVolumeGroup(mockExecution, "true") diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy index 2da6eca84e..e85b81327f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy @@ -42,6 +42,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.aaiclient.client.graphinventory.exceptions.GraphInventoryUriComputationException import static com.github.tomakehurst.wiremock.client.WireMock.* @@ -99,7 +101,7 @@ public class DoDeleteVnfAndModulesTest extends MsoGroovyTest{ @Test public void testQueryAAIVfModuleNullEndPoint() { when(mockExecution.getVariable("vnfId")).thenReturn("12345") - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "12345").depth(Depth.ONE) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("12345")).depth(Depth.ONE) doThrow(new GraphInventoryUriComputationException("Error in AAI")).when(client).get(GenericVnf.class,uri) try { doDeleteVnfAndModules.queryAAIVfModule(mockExecution) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSITest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSITest.groovy new file mode 100644 index 0000000000..bbc237f1f9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSITest.groovy @@ -0,0 +1,244 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Telecom Italia + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + + +import org.junit.Before +import org.junit.Test +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.aai.domain.yang.SliceProfile +import org.onap.aai.domain.yang.SliceProfiles +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel +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.scripts.MsoGroovyTest + +import static org.junit.Assert.assertNotNull +import static org.junit.Assert.assertTrue +import static org.mockito.Mockito.* + +class DoModifyCoreNSSITest extends MsoGroovyTest { + + @Before + void init() throws IOException { + super.init("DoModifyCoreNSSITest") + } + + + @Test + void testGetNSSIAssociatedProfiles() { + def currentNSSI = [:] + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + ServiceInstance nssi = new ServiceInstance() + nssi.setServiceInstanceId("5G-999") + + SliceProfiles sliceProfiles = new SliceProfiles() + + List<SliceProfile> slProfiles = sliceProfiles.getSliceProfile() + slProfiles.add(new SliceProfile()) + slProfiles.add(new SliceProfile()) + + nssi.setSliceProfiles(sliceProfiles) + currentNSSI.put("nssi", nssi) + + DoModifyCoreNSSI obj = new DoModifyCoreNSSI() + obj.getNSSIAssociatedProfiles(mockExecution) + + List<SliceProfile> associatedProfiles = (List<SliceProfile>)currentNSSI.get("associatedProfiles") + assertTrue("Either associatedProfiles doesn't exist or size is incorrect", (associatedProfiles != null && associatedProfiles.size() == 2)) + } + + + @Test + void testCalculateSNSSAISliceProfileInstanceHasToBeDeleted() { + def currentNSSI = [:] + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + when(mockExecution.getVariable("isCreateSliceProfileInstance")).thenReturn("false") + + String theSNSSAI = "theS-NSSAI" + + currentNSSI.put("S-NSSAI", theSNSSAI) + + List<SliceProfile> associatedProfiles = new ArrayList<>() + SliceProfile sliceProfile1 = new SliceProfile() + sliceProfile1.setSNssai("snssai1") + + SliceProfile sliceProfile2 = new SliceProfile() + sliceProfile2.setSNssai(theSNSSAI) + + SliceProfile sliceProfile3 = new SliceProfile() + sliceProfile3.setSNssai("snssai2") + + associatedProfiles.add(sliceProfile1) + associatedProfiles.add(sliceProfile2) + associatedProfiles.add(sliceProfile3) + + int sizeBefore = associatedProfiles.size() + + currentNSSI.put("associatedProfiles", associatedProfiles) + + DoModifyCoreNSSI obj = new DoModifyCoreNSSI() + obj.calculateSNSSAI(mockExecution) + + List<SliceProfile> snssais = (List<SliceProfile>)currentNSSI.get("S-NSSAIs") + SliceProfile sliceProfileContainsSNSSAI = (SliceProfile)currentNSSI.get("sliceProfileS-NSSAI") + + assertTrue("Either snssais doesn't exist or size is incorrect", (snssais != null && snssais.size() == (sizeBefore - 1))) + assertNotNull("Slice Profile which contains given S-NSSAI not found", sliceProfileContainsSNSSAI) + assertTrue("Wrong Slice Profile", sliceProfileContainsSNSSAI.getSNssai().equals(theSNSSAI)) + } + + + @Test + void testCalculateSNSSAISliceProfileInstanceHasToBeCreated() { + def currentNSSI = [:] + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + when(mockExecution.getVariable("isCreateSliceProfileInstance")).thenReturn("true") + + String theSNSSAI = "theS-NSSAI" + + currentNSSI.put("S-NSSAI", theSNSSAI) + + List<SliceProfile> associatedProfiles = new ArrayList<>() + SliceProfile sliceProfile1 = new SliceProfile() + sliceProfile1.setSNssai("snssai1") + + SliceProfile sliceProfile2 = new SliceProfile() + sliceProfile2.setSNssai("snssai2") + + associatedProfiles.add(sliceProfile1) + associatedProfiles.add(sliceProfile2) + + int sizeBefore = associatedProfiles.size() + + currentNSSI.put("associatedProfiles", associatedProfiles) + + DoModifyCoreNSSI obj = new DoModifyCoreNSSI() + obj.calculateSNSSAI(mockExecution) + + List<SliceProfile> snssais = (List<SliceProfile>)currentNSSI.get("S-NSSAIs") + + assertTrue("Either snssais doesn't exist or size is incorrect", (snssais != null && snssais.size() == (sizeBefore + 1))) + + } + + + @Test + void testCreateSliceProfileInstance() { + def currentNSSI = [:] + + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + String sliceProfileId = "sliceProfileId" + + when(mockExecution.getVariable("sliceProfileID")).thenReturn(sliceProfileId) + + Map<String, Object> sliceProfileMap = new HashMap<>() + sliceProfileMap.put("expDataRateUL", "12") + sliceProfileMap.put("expDataRateDL", 5) + sliceProfileMap.put("activityFactor", 2) + sliceProfileMap.put("latency", 10) + + when(mockExecution.getVariable("sliceProfileCn")).thenReturn(sliceProfileMap) + + + Map<String, Object> serviceProfileMap = new HashMap<>() + when(mockExecution.getVariable("serviceProfile")).thenReturn(serviceProfileMap) + + + DoModifyCoreNSSI spy = spy(DoModifyCoreNSSI.class) + when(spy.getAAIClient()).thenReturn(client) + + String globalSubscriberId = "globalSubscriberId" + String serviceType = "serviceType" + String nssiId = "nssiId" + + currentNSSI.put("globalSubscriberId", globalSubscriberId) + currentNSSI.put("serviceType", serviceType) + currentNSSI.put("nssiId", nssiId) + currentNSSI.put("sliceProfileId", sliceProfileId) + + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiId).sliceProfile(sliceProfileId)) + + SliceProfile sliceProfile = new SliceProfile() + sliceProfile.setProfileId(sliceProfileId) + + doNothing().when(client).create(uri, sliceProfile) + + spy.createSliceProfileInstance(mockExecution) + + assertNotNull("Slice Profile doesn't exist", currentNSSI.get("createdSliceProfile")) + assertTrue("Unexpected Slice Profile Id", ((SliceProfile)currentNSSI.get("createdSliceProfile")).getProfileId().equals(sliceProfile.getProfileId())) + } + + + @Test + void testAssociateSliceProfileInstanceWithNSSI() { + def currentNSSI = [:] + + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + DoModifyCoreNSSI spy = spy(DoModifyCoreNSSI.class) + when(spy.getAAIClient()).thenReturn(client) + + String sliceProfileId = "sliceProfileId" + + when(mockExecution.getVariable("sliceProfileID")).thenReturn(sliceProfileId) + + String nssiId = "5G-999" + currentNSSI.put("nssiId", nssiId) + + String globalSubscriberId = "globalSubscriberId" + String serviceType = "serviceType" + + AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId)) + AAIResourceUri sliceProfileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiId).sliceProfile(sliceProfileId)) + + currentNSSI.put("globalSubscriberId", globalSubscriberId) + currentNSSI.put("serviceType", serviceType) + currentNSSI.put("sliceProfileId", sliceProfileId) + + SliceProfile sliceProfile = new SliceProfile() + currentNSSI.put("createdSliceProfile", sliceProfile) + + ServiceInstance nssi = new ServiceInstance() + nssi.setServiceInstanceId(nssiId) + nssi.setSliceProfiles(new SliceProfiles()) + currentNSSI.put("nssi", nssi) + + int sizeBelore = nssi.getSliceProfiles().getSliceProfile().size() + + doNothing().when(client).update(nssiUri, nssi) + doNothing().when(client).connect(sliceProfileUri, nssiUri, AAIEdgeLabel.BELONGS_TO) + + spy.associateSliceProfileInstanceWithNSSI(mockExecution) + + assertTrue("Wrong number of associated slice profiles", ((ServiceInstance)currentNSSI.get("nssi")).getSliceProfiles().getSliceProfile().size() == (sizeBelore + 1)) + } + + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssiTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssiTest.groovy index bbbec3bb46..ef106f8064 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssiTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssiTest.groovy @@ -29,12 +29,15 @@ import org.mockito.Mockito 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.bpmn.common.scripts.MsoGroovyTest import static org.junit.Assert.assertNotNull import static org.mockito.ArgumentMatchers.eq import static org.mockito.Mockito.* + class DoModifyTnNssiTest extends MsoGroovyTest { @Before void init() throws IOException { @@ -80,7 +83,7 @@ class DoModifyTnNssiTest extends MsoGroovyTest { when(mockExecution.getVariable("modelUuid")).thenReturn("36a3a8ea-49a6-4ac8-b06c-89a54544b9b6") when(mockExecution.getVariable("sliceProfile")).thenReturn(mockSliceProfile()) - AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be") + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be")) DoModifyTnNssi obj = spy(DoModifyTnNssi.class) when(obj.getAAIClient()).thenReturn(client) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy index bf877bd725..e2010ce047 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy @@ -23,6 +23,8 @@ package org.onap.so.bpmn.infrastructure.scripts +import static org.mockito.Mockito.* +import javax.ws.rs.core.UriBuilder import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity import org.junit.Assert @@ -38,18 +40,16 @@ import org.mockito.junit.MockitoJUnitRunner import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.VfModule import org.onap.aai.domain.yang.VolumeGroup -import org.onap.so.bpmn.common.scripts.MsoGroovyTest -import org.onap.so.bpmn.mock.FileUtil 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.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.bpmn.mock.FileUtil import org.onap.so.constants.Defaults -import javax.ws.rs.core.UriBuilder - -import static org.mockito.Mockito.* - @RunWith(MockitoJUnitRunner.Silent.class) class UpdateVfModuleVolumeInfraV1Test extends MsoGroovyTest{ @@ -79,7 +79,7 @@ class UpdateVfModuleVolumeInfraV1Test extends MsoGroovyTest{ UpdateVfModuleVolumeInfraV1 obj = spy(UpdateVfModuleVolumeInfraV1.class) when(obj.getAAIClient()).thenReturn(client) - AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.VF_MODULE, UriBuilder.fromPath("/aai/v8/network/generic-vnfs/generic-vnf/12345/vf-modules/vf-module/12345").build()) + AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(Types.VF_MODULE, UriBuilder.fromPath("/aai/v8/network/generic-vnfs/generic-vnf/12345/vf-modules/vf-module/12345").build()) VfModule vfModule = new VfModule(); vfModule.setVfModuleId("12345") vfModule.setModelInvariantId("ff5256d2-5a33-55df-13ab-12abad84e7ff") @@ -98,7 +98,7 @@ class UpdateVfModuleVolumeInfraV1Test extends MsoGroovyTest{ UpdateVfModuleVolumeInfraV1 obj = spy(UpdateVfModuleVolumeInfraV1.class) when(obj.getAAIClient()).thenReturn(client) - 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)) VolumeGroup volumeGroup = new VolumeGroup(); volumeGroup.setVolumeGroupId(volumeGroupId) @@ -116,7 +116,7 @@ class UpdateVfModuleVolumeInfraV1Test extends MsoGroovyTest{ UpdateVfModuleVolumeInfraV1 obj = spy(UpdateVfModuleVolumeInfraV1.class) when(obj.getAAIClient()).thenReturn(client) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) GenericVnf genericVnf = new GenericVnf() genericVnf.setVnfId(vnfId) genericVnf.setVnfName("testvnfName") @@ -133,7 +133,7 @@ class UpdateVfModuleVolumeInfraV1Test extends MsoGroovyTest{ UpdateVfModuleVolumeInfraV1 obj = spy(UpdateVfModuleVolumeInfraV1.class) when(obj.getAAIClient()).thenReturn(client) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)) when(client.get(GenericVnf.class,uri)).thenReturn(Optional.empty()) thrown.expect(BpmnError.class) obj.queryAAIForGenericVnf(mockExecution, "true") diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeTest.groovy index 6a8465e2b6..a505a7c8b8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeTest.groovy @@ -42,6 +42,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 import javax.ws.rs.core.UriBuilder @@ -75,7 +77,7 @@ class UpdateVfModuleVolumeTest extends MsoGroovyTest{ UpdateVfModuleVolume obj = spy(UpdateVfModuleVolume.class) when(obj.getAAIClient()).thenReturn(client) - 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)) VolumeGroup volumeGroup = new VolumeGroup(); volumeGroup.setVolumeGroupId(volumeGroupId) @@ -94,7 +96,7 @@ class UpdateVfModuleVolumeTest extends MsoGroovyTest{ UpdateVfModuleVolume obj = spy(UpdateVfModuleVolume.class) when(obj.getAAIClient()).thenReturn(client) - 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)) VolumeGroup volumeGroup = new VolumeGroup(); volumeGroup.setVolumeGroupId(volumeGroupId) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy index d7f7547459..a3851435c0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy @@ -22,27 +22,26 @@ package org.onap.so.bpmn.vcpe.scripts -import com.github.tomakehurst.wiremock.junit.WireMockRule +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse +import static com.github.tomakehurst.wiremock.client.WireMock.put +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching +import static org.junit.Assert.* +import static org.mockito.Mockito.* +import static org.onap.so.bpmn.mock.StubResponseAAI.* +import javax.ws.rs.core.UriBuilder import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity import org.junit.* import org.mockito.MockitoAnnotations +import org.onap.aaiclient.client.aai.AAIResourcesClient +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.core.RollbackData import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.mock.FileUtil -import org.onap.aaiclient.client.aai.AAIObjectType -import org.onap.aaiclient.client.aai.AAIResourcesClient -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory - -import javax.ws.rs.core.UriBuilder - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse -import static com.github.tomakehurst.wiremock.client.WireMock.put -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching -import static org.junit.Assert.* -import static org.mockito.Mockito.* -import static org.onap.so.bpmn.mock.StubResponseAAI.* +import com.github.tomakehurst.wiremock.junit.WireMockRule class DoCreateAllottedResourceBRGTest extends GroovyTestBase { @@ -157,7 +156,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { public void createAaiAR() { ExecutionEntity mockExecution = setupMock() AAIResourcesClient client = mock(AAIResourcesClient.class) - when(mockExecution.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath("/aai/v9/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST).build())) + when(mockExecution.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(Types.SERVICE_INSTANCE, UriBuilder.fromPath("/aai/v9/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST).build())) when(mockExecution.getVariable("CSI_resourceLink")).thenReturn("/aai/v9/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST) when(mockExecution.getVariable("allottedResourceModelInfo")).thenReturn("{\n" + " \"modelInvariantUuid\":\"modelInvariantUuid\",\n" + @@ -843,7 +842,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { when(mex.getVariable("allottedResourceId")).thenReturn(ARID) when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx) when(mex.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.namespace")) - when(mex.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST).build())) + when(mex.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(Types.SERVICE_INSTANCE, UriBuilder.fromPath("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST).build())) when(mex.getVariable("allottedResourceType")).thenReturn("BRGt") when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr") when(mex.getVariable("CSI_resourceLink")).thenReturn(aaiUriPfx + "/aai/v9/mycsi") diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy index 2a6894785e..0e2c01a200 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy @@ -22,28 +22,25 @@ package org.onap.so.bpmn.vcpe.scripts -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.junit.* -import org.mockito.MockitoAnnotations -import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.bpmn.mock.FileUtil -import org.onap.aaiclient.client.aai.AAIObjectType -import org.onap.aaiclient.client.aai.AAIResourcesClient -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory - -import javax.ws.rs.core.UriBuilder - import static org.junit.Assert.* import static org.mockito.Mockito.* import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource_500 - +import javax.ws.rs.core.UriBuilder +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.* +import org.mockito.MockitoAnnotations +import org.onap.aaiclient.client.aai.AAIResourcesClient +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.core.RollbackData - +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.FileUtil import com.github.tomakehurst.wiremock.junit.WireMockRule class DoCreateAllottedResourceTXCTest extends GroovyTestBase { @@ -157,7 +154,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { public void createAaiAR() { ExecutionEntity mex = setupMock() initCreateAaiAr(mex) - when(mex.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath("/aai/v9/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST).build())) + when(mex.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(Types.SERVICE_INSTANCE, UriBuilder.fromPath("/aai/v9/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST).build())) when(mex.getVariable("CSI_resourceLink")).thenReturn("/aai/v9/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST) when(mex.getVariable("allottedResourceModelInfo")).thenReturn("{\n" + " \"modelInvariantUuid\":\"modelInvariantUuid\",\n" + @@ -788,7 +785,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { when(mex.getVariable("allottedResourceId")).thenReturn(ARID) when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx) when(mex.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.namespace")) - when(mex.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST).build())) + when(mex.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(Types.SERVICE_INSTANCE, UriBuilder.fromPath("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST).build())) when(mex.getVariable("allottedResourceType")).thenReturn("TXCt") when(mex.getVariable("allottedResourceRole")).thenReturn("TXCr") when(mex.getVariable("CSI_resourceLink")).thenReturn(aaiUriPfx + "/aai/v9/mycsi") diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java index 978814be7f..ddc30f8262 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java @@ -35,12 +35,12 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; -import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; -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.so.bpmn.servicedecomposition.bbobjects.GenericVnf; @RunWith(MockitoJUnitRunner.class) public class AAICreateResourcesTest { @@ -87,7 +87,8 @@ public class AAICreateResourcesTest { aaiCreateResources.createAAIProject(projectName, serviceInstanceId); - AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName); + AAIResourceUri projectURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().project(projectName)); verify(aaiResourcesClient, times(1)).createIfNotExists(projectURI, Optional.empty()); verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); @@ -103,7 +104,8 @@ public class AAICreateResourcesTest { HashMap<String, String> owningEntityMap = new HashMap<>(); owningEntityMap.put("owning-entity-name", owningEntityName); - AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri owningEntityURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntityId)); verify(aaiResourcesClient, times(1)).createIfNotExists(owningEntityURI, Optional.of(owningEntityMap)); verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); @@ -115,7 +117,8 @@ public class AAICreateResourcesTest { boolean expectedBoolean = aaiCreateResources.existsOwningEntity(owningEntityId); - AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri owningEntityURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntityId)); verify(aaiResourcesClient, times(1)).exists(owningEntityURI); assertTrue(expectedBoolean); @@ -138,7 +141,8 @@ public class AAICreateResourcesTest { aaiCreateResources.createAAIPlatform(platformName, vnfId); - AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName); + AAIResourceUri platformURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().platform(platformName)); verify(aaiResourcesClient, times(1)).createIfNotExists(platformURI, Optional.empty()); verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); @@ -153,7 +157,7 @@ public class AAICreateResourcesTest { aaiCreateResources.createAAILineOfBusiness(lineOfBusiness, vnfId); AAIResourceUri lineOfBusinessURI = - AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().lineOfBusiness(lineOfBusiness)); verify(aaiResourcesClient, times(1)).createIfNotExists(lineOfBusinessURI, Optional.empty()); verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); @@ -166,8 +170,8 @@ public class AAICreateResourcesTest { aaiCreateResources.createAAIServiceInstance(globalCustomerId, serviceType, serviceInstanceId); - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - globalCustomerId, serviceType, serviceInstanceId); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(globalCustomerId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId)); verify(aaiResourcesClient, times(1)).createIfNotExists(serviceInstanceURI, Optional.empty()); } @@ -180,7 +184,7 @@ public class AAICreateResourcesTest { Optional<GenericVnf> actualVnf = aaiCreateResources.getVnfInstance(vnfId); - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)); verify(aaiResourcesClient, times(1)).get(vnfURI); assertEquals(actualVnf, aaiResultWrapper.asBean(GenericVnf.class)); @@ -192,7 +196,7 @@ public class AAICreateResourcesTest { Optional<GenericVnf> actualVnf = aaiCreateResources.getVnfInstance(vnfId); - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)); verify(aaiResourcesClient, times(1)).get(vnfURI); assertEquals(actualVnf, Optional.empty()); diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn index 5a4b3ac348..a1f70333e3 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.16.2"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> <bpmn:process id="CreateSDNCNetworkResource" name="CreateSDNCNetworkResource" isExecutable="true"> <bpmn:startEvent id="createNS_StartEvent" name="createNS_StartEvent"> <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> @@ -26,7 +26,7 @@ dcsi.prepareSDNCRequest(execution)</bpmn:script> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_15mvedq</bpmn:incoming> + <bpmn:incoming>SequenceFlow_11i5vrt</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0u8d8j5</bpmn:outgoing> </bpmn:callActivity> <bpmn:sequenceFlow id="SequenceFlow_0w2es8j" sourceRef="Task_1dlrfiw" targetRef="Task_13sx2bp" /> @@ -46,7 +46,7 @@ def dcsi = new CreateSDNCNetworkResource() dcsi.preProcessRequest(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_1mz0vdx" sourceRef="Task_0tezqd4" targetRef="Task_18tomkl" /> - <bpmn:sequenceFlow id="SequenceFlow_15mvedq" sourceRef="Task_18tomkl" targetRef="CallActivity_1600xlj" /> + <bpmn:sequenceFlow id="SequenceFlow_15mvedq" sourceRef="Task_18tomkl" targetRef="ExclusiveGateway_08sinju" /> <bpmn:scriptTask id="Task_0tezqd4" name="Create progress update parameters before create" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1mz0vdx</bpmn:outgoing> @@ -155,157 +155,210 @@ dcsi.updateResourceInput(execution)</bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_0oqe2oa" sourceRef="Task_1czbh37" targetRef="ExclusiveGateway_0cdulnk" /> <bpmn:scriptTask id="Task_1czbh37" name="post SDNC create call" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0u8d8j5</bpmn:incoming> + <bpmn:incoming>SequenceFlow_06wc3j9</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0oqe2oa</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new CreateSDNCNetworkResource() dcsi.afterCreateSDNCCall(execution)</bpmn:script> </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_08sinju" name="is Async Required" default="SequenceFlow_11i5vrt"> + <bpmn:incoming>SequenceFlow_15mvedq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_11i5vrt</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1r9zpux</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_11i5vrt" name="No" sourceRef="ExclusiveGateway_08sinju" targetRef="CallActivity_1600xlj" /> + <bpmn:callActivity id="CallActivity_12vwqrq" name="Call SDNC Service Create Adapter V2 " calledElement="SDNCAdapterRestV2"> + <bpmn:extensionElements> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="sdncAdapterResponse" target="CRENWKI_createSDNCResponse" /> + <camunda:out source="SDNCA_ResponseCode" target="CRESDNCRES_sdncCreateReturnCode" /> + <camunda:out source="SDNCA_SuccessIndicator" target="CRESDNCRES_SuccessIndicator" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1r9zpux</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_06wc3j9</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1r9zpux" name="Yes" sourceRef="ExclusiveGateway_08sinju" targetRef="CallActivity_12vwqrq"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isAsyncRequired") == "Yes")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_06wc3j9" sourceRef="CallActivity_12vwqrq" targetRef="Task_1czbh37" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateSDNCNetworkResource"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createNS_StartEvent"> - <dc:Bounds x="-188" y="111" width="36" height="36" /> + <dc:Bounds x="182" y="111" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-214" y="147" width="89" height="27" /> + <dc:Bounds x="159" y="147" width="84" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> - <di:waypoint x="-152" y="129" /> - <di:waypoint x="-96" y="129" /> + <di:waypoint x="218" y="129" /> + <di:waypoint x="274" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="-87.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> - <di:waypoint x="513" y="129" /> - <di:waypoint x="573" y="129" /> + <di:waypoint x="883" y="129" /> + <di:waypoint x="943" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="391.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> - <dc:Bounds x="413" y="89" width="100" height="80" /> + <dc:Bounds x="783" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> - <dc:Bounds x="1046" y="317" width="36" height="36" /> + <dc:Bounds x="1416" y="317" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1009" y="359" width="84" height="27" /> + <dc:Bounds x="1379" y="359" width="85" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_1600xlj_di" bpmnElement="CallActivity_1600xlj"> - <dc:Bounds x="-10" y="295" width="100" height="80" /> + <dc:Bounds x="380" y="295" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0w2es8j_di" bpmnElement="SequenceFlow_0w2es8j"> - <di:waypoint x="4" y="129" /> - <di:waypoint x="67" y="129" /> + <di:waypoint x="374" y="129" /> + <di:waypoint x="437" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="74" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb"> - <di:waypoint x="167" y="129" /> - <di:waypoint x="231" y="129" /> + <di:waypoint x="537" y="129" /> + <di:waypoint x="601" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="235.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0lc6l7a_di" bpmnElement="Task_1dlrfiw"> - <dc:Bounds x="-96" y="89" width="100" height="80" /> + <dc:Bounds x="274" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp"> - <dc:Bounds x="67" y="89" width="100" height="80" /> + <dc:Bounds x="437" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1mz0vdx_di" bpmnElement="SequenceFlow_1mz0vdx"> - <di:waypoint x="673" y="129" /> - <di:waypoint x="738" y="129" /> + <di:waypoint x="1043" y="129" /> + <di:waypoint x="1108" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="608" y="123" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_15mvedq_di" bpmnElement="SequenceFlow_15mvedq"> - <di:waypoint x="788" y="169" /> - <di:waypoint x="788" y="218" /> - <di:waypoint x="-89" y="218" /> - <di:waypoint x="-89" y="335" /> - <di:waypoint x="-17" y="335" /> + <di:waypoint x="1158" y="169" /> + <di:waypoint x="1158" y="218" /> + <di:waypoint x="220" y="218" /> + <di:waypoint x="220" y="335" /> + <di:waypoint x="265" y="335" /> <bpmndi:BPMNLabel> <dc:Bounds x="349" y="197" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1kqf4ge_di" bpmnElement="Task_0tezqd4"> - <dc:Bounds x="573" y="89" width="100" height="80" /> + <dc:Bounds x="943" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1q6ssz7_di" bpmnElement="Task_18tomkl"> - <dc:Bounds x="738" y="89" width="100" height="80" /> + <dc:Bounds x="1108" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1cm8iwr_di" bpmnElement="ServiceTask_1cm8iwr"> - <dc:Bounds x="720" y="295" width="100" height="80" /> + <dc:Bounds x="1090" y="295" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1g5zyi6_di" bpmnElement="ScriptTask_1g5zyi6"> - <dc:Bounds x="890" y="295" width="100" height="80" /> + <dc:Bounds x="1260" y="295" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0cdulnk_di" bpmnElement="ExclusiveGateway_0cdulnk" isMarkerVisible="true"> - <dc:Bounds x="371" y="310" width="50" height="50" /> + <dc:Bounds x="741" y="310" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="365" y="273" width="63" height="27" /> + <dc:Bounds x="735" y="273" width="63" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1dww8ye_di" bpmnElement="SequenceFlow_1dww8ye"> - <di:waypoint x="396" y="360" /> - <di:waypoint x="396" y="471" /> - <di:waypoint x="440" y="471" /> + <di:waypoint x="766" y="360" /> + <di:waypoint x="766" y="471" /> + <di:waypoint x="810" y="471" /> <bpmndi:BPMNLabel> - <dc:Bounds x="403" y="391" width="18" height="14" /> + <dc:Bounds x="774" y="391" width="17" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0hu4lhm_di" bpmnElement="Task_0uwlr22"> - <dc:Bounds x="553" y="295" width="100" height="80" /> + <dc:Bounds x="923" y="295" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_05m2j56_di" bpmnElement="SequenceFlow_05m2j56"> - <di:waypoint x="421" y="335" /> - <di:waypoint x="553" y="335" /> + <di:waypoint x="791" y="335" /> + <di:waypoint x="923" y="335" /> <bpmndi:BPMNLabel> - <dc:Bounds x="480" y="317" width="15" height="14" /> + <dc:Bounds x="850" y="317" width="15" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_05niqbf_di" bpmnElement="SequenceFlow_05niqbf"> - <di:waypoint x="540" y="471" /> - <di:waypoint x="603" y="471" /> - <di:waypoint x="603" y="375" /> + <di:waypoint x="910" y="471" /> + <di:waypoint x="973" y="471" /> + <di:waypoint x="973" y="375" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1cd8ujq_di" bpmnElement="SequenceFlow_1cd8ujq"> - <di:waypoint x="653" y="335" /> - <di:waypoint x="720" y="335" /> + <di:waypoint x="1023" y="335" /> + <di:waypoint x="1090" y="335" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0auvfvm_di" bpmnElement="SequenceFlow_0auvfvm"> - <di:waypoint x="990" y="335" /> - <di:waypoint x="1046" y="335" /> + <di:waypoint x="1360" y="335" /> + <di:waypoint x="1416" y="335" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_0aywvn3_di" bpmnElement="Task_0bga3e8"> - <dc:Bounds x="440" y="431" width="100" height="80" /> + <dc:Bounds x="810" y="431" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0svppaq_di" bpmnElement="SequenceFlow_0svppaq"> - <di:waypoint x="331" y="129" /> - <di:waypoint x="413" y="129" /> + <di:waypoint x="701" y="129" /> + <di:waypoint x="783" y="129" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1kzr9lu_di" bpmnElement="Task_1mbzgl7"> - <dc:Bounds x="231" y="89" width="100" height="80" /> + <dc:Bounds x="601" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0drbyvd_di" bpmnElement="SequenceFlow_0drbyvd"> - <di:waypoint x="820" y="335" /> - <di:waypoint x="890" y="335" /> + <di:waypoint x="1190" y="335" /> + <di:waypoint x="1260" y="335" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0u8d8j5_di" bpmnElement="SequenceFlow_0u8d8j5"> - <di:waypoint x="90" y="335" /> - <di:waypoint x="185" y="335" /> + <di:waypoint x="480" y="335" /> + <di:waypoint x="555" y="335" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0oqe2oa_di" bpmnElement="SequenceFlow_0oqe2oa"> - <di:waypoint x="285" y="335" /> - <di:waypoint x="371" y="335" /> + <di:waypoint x="655" y="335" /> + <di:waypoint x="741" y="335" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1njkyn8_di" bpmnElement="Task_1czbh37"> - <dc:Bounds x="185" y="295" width="100" height="80" /> + <dc:Bounds x="555" y="295" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_08sinju_di" bpmnElement="ExclusiveGateway_08sinju" isMarkerVisible="true"> + <dc:Bounds x="265" y="310" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="247" y="273" width="89" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_11i5vrt_di" bpmnElement="SequenceFlow_11i5vrt"> + <di:waypoint x="315" y="335" /> + <di:waypoint x="380" y="335" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="340" y="317" width="15" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_12vwqrq_di" bpmnElement="CallActivity_12vwqrq"> + <dc:Bounds x="380" y="431" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1r9zpux_di" bpmnElement="SequenceFlow_1r9zpux"> + <di:waypoint x="290" y="360" /> + <di:waypoint x="290" y="471" /> + <di:waypoint x="380" y="471" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="296" y="413" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_06wc3j9_di" bpmnElement="SequenceFlow_06wc3j9"> + <di:waypoint x="480" y="471" /> + <di:waypoint x="605" y="471" /> + <di:waypoint x="605" y="375" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn index 27bd01bda9..9656c86ae5 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> <bpmn:process id="CreateSliceService" name="CreateSliceService" isExecutable="true"> <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Slice Service Creation Flow"> <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing> </bpmn:startEvent> <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0vilb24" name="Waiting for confirmation"> - <bpmn:outgoing>SequenceFlow_1fk37v7</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_060j650</bpmn:outgoing> <bpmn:linkEventDefinition id="LinkEventDefinition_197u5pe" name="WaitingForConfirmation" /> </bpmn:intermediateCatchEvent> <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy"> @@ -16,7 +16,7 @@ def css= new CreateSliceService() css.preProcessRequest(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:scriptTask id="ScriptTask_1jgtb0y" name="Process User Options" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1cv0wop</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1whq7vc</bpmn:incoming> <bpmn:outgoing>SequenceFlow_197cm2e</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def css = new CreateSliceService() @@ -27,50 +27,29 @@ css.processUserOptions(execution)</bpmn:script> <bpmn:outgoing>SequenceFlow_12t5exy</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_038lb9m</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:scriptTask id="ScriptTask_0l3d1ai" name="Process Decomposition" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1t19ips</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0jrclmc</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def css = new CreateSliceService() -css.processDecomposition(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_1eo3m4q" name="Prepare NST Selection" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_046irye</bpmn:incoming> - <bpmn:outgoing>Flow_1l8mfej</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def css = new CreateSliceService() -css.prepareSelectNSTRequest(execution)</bpmn:script> - </bpmn:scriptTask> <bpmn:callActivity id="CallActivity_139l55g" name="Call DoCreateSliceServiceInstance " calledElement="DoCreateSliceServiceInstance"> <bpmn:extensionElements> <camunda:in source="msoRequestId" target="msoRequestId" /> <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> <camunda:in source="serviceInstanceName" target="serviceInstanceName" /> - <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> - <camunda:in source="productFamilyId" target="productFamilyId" /> - <camunda:in source="serviceInputParams" target="serviceInputParams" /> <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> <camunda:in source="serviceType" target="serviceType" /> <camunda:in source="uuiRequest" target="uuiRequest" /> - <camunda:in source="requestAction" target="operationType" /> <camunda:in source="operationId" target="operationId" /> - <camunda:in source="serviceProfile" target="serviceProfile" /> - <camunda:in source="sliceProfileTn" target="sliceProfileTn" /> - <camunda:in source="sliceProfileCn" target="sliceProfileCn" /> - <camunda:in source="sliceProfileAn" target="sliceProfileAn" /> - <camunda:in source="sliceServiceDecomposition" target="sliceServiceDecomposition" /> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:out source="rollbackData" target="rollbackData" /> <camunda:out source="rolledBack" target="rolledBack" /> - <camunda:out source="allottedResourceId" target="allottedResourceId" /> <camunda:out source="serviceInstanceData" target="serviceInstanceData" /> + <camunda:in source="sliceTaskParams" target="sliceTaskParams" /> + <camunda:in source="sliceTaskParams" target="sliceTaskParams" /> + <camunda:out source="sliceTaskParams" target="sliceTaskParams" /> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1p8vxo5</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1g8m7tq</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_1dfon41</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0jhqtls</bpmn:outgoing> </bpmn:callActivity> <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1v96asi" name="Goto Waiting for Confirmation"> - <bpmn:incoming>SequenceFlow_0it2g9j</bpmn:incoming> + <bpmn:incoming>SequenceFlow_00kcej9</bpmn:incoming> <bpmn:linkEventDefinition id="LinkEventDefinition_0uj34dx" name="WaitingForConfirmation" /> </bpmn:intermediateThrowEvent> <bpmn:scriptTask id="ScriptTask_0gb975b" name="Prepare Update Orchestration Task" scriptFormat="groovy"> @@ -126,14 +105,6 @@ css.prepareUpdateOrchestrationTask(execution)</bpmn:script> def css = new CreateSliceService() css.prepareInitServiceOperationStatus(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1ex8ke9" name="Goto Create Slice Service"> - <bpmn:incoming>SequenceFlow_0jrclmc</bpmn:incoming> - <bpmn:linkEventDefinition id="LinkEventDefinition_0de65en" name="CreateSliceService" /> - </bpmn:intermediateThrowEvent> - <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_1wii8im" name="Create Slice Service"> - <bpmn:outgoing>SequenceFlow_1o1tu0f</bpmn:outgoing> - <bpmn:linkEventDefinition id="LinkEventDefinition_1krpcdk" name="CreateSliceService" /> - </bpmn:intermediateCatchEvent> <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Service Oper Status((finish)" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0lbdfmt</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing> @@ -161,34 +132,8 @@ css.prepareUpdateServiceOperationStatus(execution)</bpmn:script> </camunda:connector> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0t094g7</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_046irye</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0xmvg4v</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:callActivity id="CallActivity_1bnkmaz" name="Call Decompose Service" calledElement="DecomposeService"> - <bpmn:extensionElements> - <camunda:in source="msoRequestId" target="msoRequestId" /> - <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> - <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> - <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> - <camunda:out source="serviceDecomposition" target="sliceServiceDecomposition" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0q7yc2c</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1t19ips</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:scriptTask id="ScriptTask_0o2r07o" name="Prepare Decompose Service " scriptFormat="groovy"> - <bpmn:incoming>Flow_1u4srgq</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0q7yc2c</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi= new CreateSliceService() -dcsi.prepareDecomposeService(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_0b7senu" name="Prepare Create OrchestrationTask" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1o1tu0f</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1sq6kp6</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def css= new CreateSliceService() -css.prepareCreateOrchestrationTask(execution)</bpmn:script> - </bpmn:scriptTask> <bpmn:callActivity id="CallActivity_0h88mep" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask"> <bpmn:extensionElements> <camunda:out source="statusCode" target="CSSOT_dbResponseCode" /> @@ -201,8 +146,8 @@ css.prepareCreateOrchestrationTask(execution)</bpmn:script> <camunda:in source="CSSOT_paramJson" target="paramJson" /> <camunda:in source="CSSOT_requestMethod" target="method" /> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1sq6kp6</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1p8vxo5</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_1x4n7an</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1dfon41</bpmn:outgoing> </bpmn:callActivity> <bpmn:callActivity id="CallActivity_0n47zoh" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask"> <bpmn:extensionElements> @@ -217,7 +162,7 @@ css.prepareCreateOrchestrationTask(execution)</bpmn:script> <camunda:in source="CSSOT_requestMethod" target="method" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_18kur12</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0it2g9j</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_00kcej9</bpmn:outgoing> </bpmn:callActivity> <bpmn:scriptTask id="ScriptTask_12h8542" name="Prepare Update Orchestration Task" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_12t5exy</bpmn:incoming> @@ -242,28 +187,6 @@ css.prepareUpdateOrchestrationTask(execution)</bpmn:script> <bpmn:incoming>SequenceFlow_0thd6ny</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0477975</bpmn:outgoing> </bpmn:callActivity> - <bpmn:callActivity id="CallActivity_0g98b71" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask"> - <bpmn:extensionElements> - <camunda:out source="statusCode" target="CSSOT_dbResponseCode" /> - <camunda:out source="response" target="CSSOT_dbResponse" /> - <camunda:in source="CSSOT_taskId" target="taskId" /> - <camunda:in source="msoRequestId" target="requestId" /> - <camunda:in source="CSSOT_name" target="taskName" /> - <camunda:in source="CSSOT_status" target="taskStatus" /> - <camunda:in source="CSSOT_isManual" target="isManual" /> - <camunda:in source="CSSOT_paramJson" target="paramJson" /> - <camunda:in source="CSSOT_requestMethod" target="method" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0h2oree</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1cv0wop</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:scriptTask id="ScriptTask_08wim95" name="Prepare Get User Options" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_16uz2t9</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0h2oree</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def css = new CreateSliceService() -css.prepareGetUserOptions(execution)</bpmn:script> - </bpmn:scriptTask> <bpmn:callActivity id="CallActivity_0jdzpem" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask"> <bpmn:extensionElements> <camunda:out source="statusCode" target="CSSOT_dbResponseCode" /> @@ -332,13 +255,6 @@ css.prepareUpdateOrchestrationTask(execution)</bpmn:script> <bpmn:incoming>SequenceFlow_1qv8qw1</bpmn:incoming> <bpmn:outgoing>SequenceFlow_11rbv41</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:scriptTask id="ScriptTask_1jj846g" name="Send Sync Ack Response" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1g8m7tq</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1ey6m1e</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def css = new CreateSliceService() -css.sendSyncResponse(execution)</bpmn:script> - </bpmn:scriptTask> <bpmn:callActivity id="CallActivity_0cxst1i" name="Call DoAllocateNSIandNSSI " calledElement="DoAllocateNSIandNSSI"> <bpmn:extensionElements> <camunda:in source="msoRequestId" target="msoRequestId" /> @@ -354,42 +270,28 @@ css.sendSyncResponse(execution)</bpmn:script> <camunda:in source="uuiRequest" target="uuiRequest" /> <camunda:in source="requestAction" target="operationType" /> <camunda:in source="operationId" target="operationId" /> - <camunda:in source="serviceProfile" target="serviceProfile" /> - <camunda:in source="sliceProfileTn" target="sliceProfileTn" /> - <camunda:in source="sliceProfileCn" target="sliceProfileCn" /> - <camunda:in source="sliceProfileAn" target="sliceProfileAn" /> <camunda:in source="sliceTaskParams" target="sliceTaskParams" /> <camunda:in source="CSSOT_taskId" target="taskId" /> <camunda:in source="CSSOT_name" target="taskName" /> <camunda:in source="CSSOT_status" target="taskStatus" /> <camunda:in source="CSSOT_isManual" target="isManual" /> <camunda:in source="resourceSharingLevel" target="resourceSharingLevel" /> - <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:out source="rollbackData" target="rollbackData" /> <camunda:out source="rolledBack" target="rolledBack" /> <camunda:in source="allottedResourceId" target="allottedResourceId" /> - <camunda:in source="nstSolution" target="nstSolution" /> + <camunda:out source="sliceTaskParams" target="sliceTaskParams" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1bevt3a</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0mlrlbv</bpmn:outgoing> </bpmn:callActivity> - <bpmn:endEvent id="EndEvent_0bh0kwx"> - <bpmn:incoming>SequenceFlow_12qt5ci</bpmn:incoming> - <bpmn:errorEventDefinition id="ErrorEventDefinition_1xa66sx" errorRef="Error_0p2naox" /> - </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" /> <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="ScriptTask_1xxag1o" /> - <bpmn:sequenceFlow id="SequenceFlow_1cv0wop" sourceRef="CallActivity_0g98b71" targetRef="ScriptTask_1jgtb0y" /> <bpmn:sequenceFlow id="SequenceFlow_197cm2e" sourceRef="ScriptTask_1jgtb0y" targetRef="ExclusiveGateway_0elbczl" /> <bpmn:sequenceFlow id="SequenceFlow_12t5exy" name="continue" sourceRef="ExclusiveGateway_0elbczl" targetRef="ScriptTask_12h8542"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("taskAction") == "commit"}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_038lb9m" name="abort" sourceRef="ExclusiveGateway_0elbczl" targetRef="ScriptTask_1mscu5w" /> - <bpmn:sequenceFlow id="SequenceFlow_1t19ips" sourceRef="CallActivity_1bnkmaz" targetRef="ScriptTask_0l3d1ai" /> - <bpmn:sequenceFlow id="SequenceFlow_1p8vxo5" sourceRef="CallActivity_0h88mep" targetRef="CallActivity_139l55g" /> - <bpmn:sequenceFlow id="SequenceFlow_1g8m7tq" sourceRef="CallActivity_139l55g" targetRef="ScriptTask_1jj846g" /> - <bpmn:sequenceFlow id="SequenceFlow_0it2g9j" sourceRef="CallActivity_0n47zoh" targetRef="IntermediateThrowEvent_1v96asi" /> <bpmn:sequenceFlow id="SequenceFlow_18kur12" sourceRef="ScriptTask_0gb975b" targetRef="CallActivity_0n47zoh" /> <bpmn:sequenceFlow id="SequenceFlow_0mlrlbv" sourceRef="CallActivity_0cxst1i" targetRef="ExclusiveGateway_18eld2o" /> <bpmn:sequenceFlow id="SequenceFlow_1c6ka9h" name="No" sourceRef="ExclusiveGateway_18eld2o" targetRef="EndEvent_0x406rw" /> @@ -399,36 +301,15 @@ css.sendSyncResponse(execution)</bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_0klb3ey" sourceRef="ScriptTask_1ef3voz" targetRef="CallActivity_15pl4ld" /> <bpmn:sequenceFlow id="SequenceFlow_11rbv41" sourceRef="ServiceTask_0esr949" targetRef="EndEvent_05h01gx" /> <bpmn:sequenceFlow id="SequenceFlow_0t094g7" sourceRef="ScriptTask_1xxag1o" targetRef="ServiceTask_0kd6p6p" /> - <bpmn:sequenceFlow id="SequenceFlow_1o1tu0f" sourceRef="IntermediateCatchEvent_1wii8im" targetRef="ScriptTask_0b7senu" /> <bpmn:sequenceFlow id="SequenceFlow_0lbdfmt" sourceRef="CallActivity_15pl4ld" targetRef="ScriptTask_1ssh2l9" /> <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="ServiceTask_0esr949" /> - <bpmn:sequenceFlow id="SequenceFlow_0q7yc2c" sourceRef="ScriptTask_0o2r07o" targetRef="CallActivity_1bnkmaz" /> - <bpmn:sequenceFlow id="SequenceFlow_1sq6kp6" sourceRef="ScriptTask_0b7senu" targetRef="CallActivity_0h88mep" /> <bpmn:sequenceFlow id="SequenceFlow_0thd6ny" sourceRef="ScriptTask_12h8542" targetRef="CallActivity_0o89wmf" /> <bpmn:sequenceFlow id="SequenceFlow_0477975" sourceRef="CallActivity_0o89wmf" targetRef="IntermediateThrowEvent_0ktwpki" /> - <bpmn:sequenceFlow id="SequenceFlow_0h2oree" sourceRef="ScriptTask_08wim95" targetRef="CallActivity_0g98b71" /> <bpmn:sequenceFlow id="SequenceFlow_19lsayh" sourceRef="ScriptTask_1mscu5w" targetRef="CallActivity_0jdzpem" /> <bpmn:sequenceFlow id="SequenceFlow_10ng1vx" sourceRef="CallActivity_0jdzpem" targetRef="EndEvent_1oouvuh" /> <bpmn:sequenceFlow id="SequenceFlow_1bevt3a" sourceRef="IntermediateCatchEvent_0pkvfun" targetRef="CallActivity_0cxst1i" /> - <bpmn:sequenceFlow id="SequenceFlow_1ey6m1e" sourceRef="ScriptTask_1jj846g" targetRef="CallActivity_0v4mw2x" /> - <bpmn:receiveTask id="Task_1b5t88h" name="Waiting for confirmation" messageRef="Message_0c4b2r5"> - <bpmn:incoming>SequenceFlow_1fk37v7</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_16uz2t9</bpmn:outgoing> - </bpmn:receiveTask> - <bpmn:sequenceFlow id="SequenceFlow_1fk37v7" sourceRef="IntermediateCatchEvent_0vilb24" targetRef="Task_1b5t88h" /> - <bpmn:sequenceFlow id="SequenceFlow_16uz2t9" sourceRef="Task_1b5t88h" targetRef="ScriptTask_08wim95" /> - <bpmn:boundaryEvent id="BoundaryEvent_0clo9pv" attachedToRef="Task_1b5t88h"> - <bpmn:outgoing>SequenceFlow_12qt5ci</bpmn:outgoing> - <bpmn:timerEventDefinition> - <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT2H</bpmn:timeDuration> - </bpmn:timerEventDefinition> - </bpmn:boundaryEvent> - <bpmn:sequenceFlow id="SequenceFlow_12qt5ci" sourceRef="BoundaryEvent_0clo9pv" targetRef="EndEvent_0bh0kwx" /> <bpmn:callActivity id="CallActivity_0v4mw2x" name="Call DoCreateSliceServiceOption " calledElement="DoCreateSliceServiceOption"> <bpmn:extensionElements> - <camunda:in source="nstModelUuid" target="nstModelUuid" /> - <camunda:in source="nstModelInvariantUuid" target="nstModelInvariantUuid" /> - <camunda:in source="serviceProfile" target="serviceProfile" /> <camunda:in source="msoRequestId" target="msoRequestId" /> <camunda:in source="sliceTaskParams" target="sliceTaskParams" /> <camunda:in source="resourceSharingLevel" target="resourceSharingLevel" /> @@ -436,17 +317,11 @@ css.sendSyncResponse(execution)</bpmn:script> <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> <camunda:in source="serviceType" target="serviceType" /> - <camunda:in source="nstSolution" target="nstSolution" /> - <camunda:out source="sliceProfileTn" target="sliceProfileTn" /> - <camunda:out source="sliceProfileCn" target="sliceProfileCn" /> - <camunda:out source="sliceProfileAn" target="sliceProfileAn" /> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1ey6m1e</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1f6dyxo</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1aaozcg</bpmn:outgoing> </bpmn:callActivity> <bpmn:sequenceFlow id="SequenceFlow_1aaozcg" sourceRef="CallActivity_0v4mw2x" targetRef="ScriptTask_0gb975b" /> - <bpmn:sequenceFlow id="SequenceFlow_046irye" sourceRef="ServiceTask_0kd6p6p" targetRef="ScriptTask_1eo3m4q" /> - <bpmn:sequenceFlow id="SequenceFlow_0jrclmc" sourceRef="ScriptTask_0l3d1ai" targetRef="IntermediateThrowEvent_1ex8ke9" /> <bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0n4xku8</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing> @@ -456,8 +331,81 @@ def css = new CreateSliceService() css.updateAAIOrchStatus(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ef3voz" /> - <bpmn:sequenceFlow id="Flow_1l8mfej" sourceRef="ScriptTask_1eo3m4q" targetRef="Activity_1ge49xu" /> - <bpmn:callActivity id="Activity_1ge49xu" name="Handle NST Selection OOF request" calledElement="DoHandleOofRequest"> + <bpmn:scriptTask id="ScriptTask_09mxr0w" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0jhqtls</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_12wo878</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def css = new CreateSliceService() +css.sendSyncResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_1ac05ww" name="Prepare Create OrchestrationTask" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0xmvg4v</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1x4n7an</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def css= new CreateSliceService() +css.prepareCreateOrchestrationTask(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0xmvg4v" sourceRef="ServiceTask_0kd6p6p" targetRef="ScriptTask_1ac05ww" /> + <bpmn:sequenceFlow id="SequenceFlow_1x4n7an" sourceRef="ScriptTask_1ac05ww" targetRef="CallActivity_0h88mep" /> + <bpmn:sequenceFlow id="SequenceFlow_1dfon41" sourceRef="CallActivity_0h88mep" targetRef="CallActivity_139l55g" /> + <bpmn:sequenceFlow id="SequenceFlow_0jhqtls" sourceRef="CallActivity_139l55g" targetRef="ScriptTask_09mxr0w" /> + <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0gceuxu" name="Create Slice Service"> + <bpmn:outgoing>SequenceFlow_14c2tav</bpmn:outgoing> + <bpmn:linkEventDefinition id="LinkEventDefinition_0wnloof" name="CreateSliceService" /> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="SequenceFlow_14c2tav" sourceRef="IntermediateCatchEvent_0gceuxu" targetRef="ScriptTask_1ayg9y8" /> + <bpmn:sequenceFlow id="SequenceFlow_00kcej9" sourceRef="CallActivity_0n47zoh" targetRef="IntermediateThrowEvent_1v96asi" /> + <bpmn:sequenceFlow id="SequenceFlow_060j650" sourceRef="IntermediateCatchEvent_0vilb24" targetRef="ScriptTask_04qudo2" /> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0lpvnze" name="Goto Create Slice Service"> + <bpmn:incoming>SequenceFlow_12wo878</bpmn:incoming> + <bpmn:linkEventDefinition id="LinkEventDefinition_1oxsvp3" name="CreateSliceService" /> + </bpmn:intermediateThrowEvent> + <bpmn:sequenceFlow id="SequenceFlow_12wo878" sourceRef="ScriptTask_09mxr0w" targetRef="IntermediateThrowEvent_0lpvnze" /> + <bpmn:scriptTask id="ScriptTask_13roglo" name="Process NST Solutions" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1r2jtal</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1f6dyxo</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def css = new CreateSliceService() +css.processNSTSolutions(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1f6dyxo" sourceRef="ScriptTask_13roglo" targetRef="CallActivity_0v4mw2x" /> + <bpmn:receiveTask id="ReceiveTask_02qzb6i" name="Waiting for confirmation" /> + <bpmn:endEvent id="EndEvent_0bz8a65"> + <bpmn:incoming>SequenceFlow_1vesvto</bpmn:incoming> + <bpmn:errorEventDefinition id="ErrorEventDefinition_1hni1r1" errorRef="Error_0p2naox" /> + </bpmn:endEvent> + <bpmn:boundaryEvent id="BoundaryEvent_0p4swyp" attachedToRef="ReceiveTask_02qzb6i"> + <bpmn:outgoing>SequenceFlow_1vesvto</bpmn:outgoing> + <bpmn:timerEventDefinition id="TimerEventDefinition_112p48l"> + <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT2H</bpmn:timeDuration> + </bpmn:timerEventDefinition> + </bpmn:boundaryEvent> + <bpmn:sequenceFlow id="SequenceFlow_1vesvto" sourceRef="BoundaryEvent_0p4swyp" targetRef="EndEvent_0bz8a65" /> + <bpmn:scriptTask id="ScriptTask_04qudo2" name="Prepare Get User Options" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_060j650</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ti386y</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def css = new CreateSliceService() +css.prepareGetUserOptions(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0ti386y" sourceRef="ScriptTask_04qudo2" targetRef="CallActivity_1vu3zcv" /> + <bpmn:callActivity id="CallActivity_1vu3zcv" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask"> + <bpmn:extensionElements> + <camunda:out source="statusCode" target="CSSOT_dbResponseCode" /> + <camunda:out source="response" target="CSSOT_dbResponse" /> + <camunda:in source="CSSOT_taskId" target="taskId" /> + <camunda:in source="msoRequestId" target="requestId" /> + <camunda:in source="CSSOT_name" target="taskName" /> + <camunda:in source="CSSOT_status" target="taskStatus" /> + <camunda:in source="CSSOT_isManual" target="isManual" /> + <camunda:in source="CSSOT_paramJson" target="paramJson" /> + <camunda:in source="CSSOT_requestMethod" target="method" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0ti386y</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1whq7vc</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1whq7vc" sourceRef="CallActivity_1vu3zcv" targetRef="ScriptTask_1jgtb0y" /> + <bpmn:callActivity id="CallActivity_0xf2g6c" name="Handle NST Selection OOF request" calledElement="DoHandleOofRequest"> <bpmn:extensionElements> <camunda:in source="nstSelectionUrl" target="apiPath" /> <camunda:in source="nstSelection_correlator" target="correlator" /> @@ -467,18 +415,18 @@ css.updateAAIOrchStatus(execution)</bpmn:script> <camunda:out source="asyncCallbackResponse" target="nstSelection_oofResponse" /> <camunda:in source="nstSelection_oofRequest" target="oofRequest" /> </bpmn:extensionElements> - <bpmn:incoming>Flow_1l8mfej</bpmn:incoming> - <bpmn:outgoing>Flow_0vq2rmw</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_02sve8o</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1r2jtal</bpmn:outgoing> </bpmn:callActivity> - <bpmn:sequenceFlow id="Flow_0vq2rmw" sourceRef="Activity_1ge49xu" targetRef="Activity_12v8ykp" /> - <bpmn:scriptTask id="Activity_12v8ykp" name="Process NST Solutions" scriptFormat="groovy"> - <bpmn:incoming>Flow_0vq2rmw</bpmn:incoming> - <bpmn:outgoing>Flow_1u4srgq</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_1r2jtal" sourceRef="CallActivity_0xf2g6c" targetRef="ScriptTask_13roglo" /> + <bpmn:scriptTask id="ScriptTask_1ayg9y8" name="Prepare NST Selection" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_14c2tav</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_02sve8o</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def css = new CreateSliceService() -css.processNSTSolutions(execution)</bpmn:script> +css.prepareSelectNSTRequest(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="Flow_1u4srgq" sourceRef="Activity_12v8ykp" targetRef="ScriptTask_0o2r07o" /> + <bpmn:sequenceFlow id="SequenceFlow_02sve8o" sourceRef="ScriptTask_1ayg9y8" targetRef="CallActivity_0xf2g6c" /> </bpmn:process> <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" /> <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> @@ -486,360 +434,334 @@ css.processNSTSolutions(execution)</bpmn:script> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateSliceService"> <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj"> - <di:waypoint x="745" y="801" /> - <di:waypoint x="823" y="801" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0jrclmc_di" bpmnElement="SequenceFlow_0jrclmc"> - <di:waypoint x="1540" y="121" /> - <di:waypoint x="1584" y="121" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_046irye_di" bpmnElement="SequenceFlow_046irye"> - <di:waypoint x="650" y="121" /> - <di:waypoint x="685" y="121" /> + <di:waypoint x="684" y="965" /> + <di:waypoint x="764" y="965" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1aaozcg_di" bpmnElement="SequenceFlow_1aaozcg"> - <di:waypoint x="1115" y="289" /> - <di:waypoint x="1193" y="289" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_12qt5ci_di" bpmnElement="SequenceFlow_12qt5ci"> - <di:waypoint x="335" y="514" /> - <di:waypoint x="335" y="611" /> - <di:waypoint x="335" y="593" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_16uz2t9_di" bpmnElement="SequenceFlow_16uz2t9"> - <di:waypoint x="385" y="456" /> - <di:waypoint x="467" y="456" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1fk37v7_di" bpmnElement="SequenceFlow_1fk37v7"> - <di:waypoint x="214" y="456" /> - <di:waypoint x="285" y="456" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1ey6m1e_di" bpmnElement="SequenceFlow_1ey6m1e"> - <di:waypoint x="930" y="289" /> - <di:waypoint x="1015" y="289" /> + <di:waypoint x="980" y="350" /> + <di:waypoint x="1060" y="350" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1bevt3a_di" bpmnElement="SequenceFlow_1bevt3a"> - <di:waypoint x="214" y="801" /> - <di:waypoint x="285" y="801" /> + <di:waypoint x="213" y="965" /> + <di:waypoint x="274" y="965" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_10ng1vx_di" bpmnElement="SequenceFlow_10ng1vx"> - <di:waypoint x="1471" y="645" /> - <di:waypoint x="1584" y="645" /> + <di:waypoint x="1294" y="805" /> + <di:waypoint x="1396" y="805" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_19lsayh_di" bpmnElement="SequenceFlow_19lsayh"> - <di:waypoint x="1293" y="645" /> - <di:waypoint x="1371" y="645" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0h2oree_di" bpmnElement="SequenceFlow_0h2oree"> - <di:waypoint x="567" y="456" /> - <di:waypoint x="645" y="456" /> + <di:waypoint x="1124" y="805" /> + <di:waypoint x="1194" y="805" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0477975_di" bpmnElement="SequenceFlow_0477975"> - <di:waypoint x="1471" y="456" /> - <di:waypoint x="1584" y="456" /> + <di:waypoint x="1294" y="620" /> + <di:waypoint x="1396" y="620" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0thd6ny_di" bpmnElement="SequenceFlow_0thd6ny"> - <di:waypoint x="1293" y="456" /> - <di:waypoint x="1371" y="456" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1sq6kp6_di" bpmnElement="SequenceFlow_1sq6kp6"> - <di:waypoint x="385" y="289" /> - <di:waypoint x="467" y="289" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0q7yc2c_di" bpmnElement="SequenceFlow_0q7yc2c"> - <di:waypoint x="1240" y="121" /> - <di:waypoint x="1280" y="121" /> + <di:waypoint x="1124" y="620" /> + <di:waypoint x="1194" y="620" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1"> - <di:waypoint x="1297" y="801" /> - <di:waypoint x="1375" y="801" /> + <di:waypoint x="1174" y="965" /> + <di:waypoint x="1244" y="965" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0lbdfmt_di" bpmnElement="SequenceFlow_0lbdfmt"> - <di:waypoint x="1105" y="801" /> - <di:waypoint x="1197" y="801" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1o1tu0f_di" bpmnElement="SequenceFlow_1o1tu0f"> - <di:waypoint x="214" y="289" /> - <di:waypoint x="285" y="289" /> + <di:waypoint x="1034" y="965" /> + <di:waypoint x="1074" y="965" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0t094g7_di" bpmnElement="SequenceFlow_0t094g7"> - <di:waypoint x="510" y="121" /> - <di:waypoint x="550" y="121" /> + <di:waypoint x="510" y="122" /> + <di:waypoint x="564" y="122" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_11rbv41_di" bpmnElement="SequenceFlow_11rbv41"> - <di:waypoint x="1475" y="801" /> - <di:waypoint x="1585" y="801" /> + <di:waypoint x="1344" y="965" /> + <di:waypoint x="1396" y="965" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0klb3ey_di" bpmnElement="SequenceFlow_0klb3ey"> - <di:waypoint x="923" y="801" /> - <di:waypoint x="1005" y="801" /> + <di:waypoint x="864" y="965" /> + <di:waypoint x="934" y="965" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0n4xku8_di" bpmnElement="SequenceFlow_0n4xku8"> - <di:waypoint x="538" y="801" /> - <di:waypoint x="645" y="801" /> + <di:waypoint x="489" y="965" /> + <di:waypoint x="584" y="965" /> <bpmndi:BPMNLabel> - <dc:Bounds x="584" y="783" width="18" height="14" /> + <dc:Bounds x="529" y="947" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1c6ka9h_di" bpmnElement="SequenceFlow_1c6ka9h"> - <di:waypoint x="513" y="826" /> - <di:waypoint x="513" y="926" /> + <di:waypoint x="464" y="990" /> + <di:waypoint x="464" y="1090" /> <bpmndi:BPMNLabel> - <dc:Bounds x="521" y="832" width="15" height="14" /> + <dc:Bounds x="472" y="998" width="15" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0mlrlbv_di" bpmnElement="SequenceFlow_0mlrlbv"> - <di:waypoint x="385" y="801" /> - <di:waypoint x="488" y="801" /> + <di:waypoint x="374" y="965" /> + <di:waypoint x="439" y="965" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_18kur12_di" bpmnElement="SequenceFlow_18kur12"> - <di:waypoint x="1293" y="289" /> - <di:waypoint x="1371" y="289" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0it2g9j_di" bpmnElement="SequenceFlow_0it2g9j"> - <di:waypoint x="1471" y="289" /> - <di:waypoint x="1584" y="289" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1g8m7tq_di" bpmnElement="SequenceFlow_1g8m7tq"> - <di:waypoint x="745" y="289" /> - <di:waypoint x="830" y="289" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1p8vxo5_di" bpmnElement="SequenceFlow_1p8vxo5"> - <di:waypoint x="567" y="289" /> - <di:waypoint x="645" y="289" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1t19ips_di" bpmnElement="SequenceFlow_1t19ips"> - <di:waypoint x="1380" y="121" /> - <di:waypoint x="1440" y="121" /> + <di:waypoint x="1160" y="350" /> + <di:waypoint x="1220" y="350" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_038lb9m_di" bpmnElement="SequenceFlow_038lb9m"> - <di:waypoint x="1065" y="481" /> - <di:waypoint x="1065" y="645" /> - <di:waypoint x="1193" y="645" /> + <di:waypoint x="884" y="645" /> + <di:waypoint x="884" y="805" /> + <di:waypoint x="1024" y="805" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1067" y="560" width="27" height="14" /> + <dc:Bounds x="886" y="722" width="27" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_12t5exy_di" bpmnElement="SequenceFlow_12t5exy"> - <di:waypoint x="1090" y="456" /> - <di:waypoint x="1193" y="456" /> + <di:waypoint x="909" y="620" /> + <di:waypoint x="1024" y="620" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1121.5" y="438" width="42" height="14" /> + <dc:Bounds x="911" y="602" width="42" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_197cm2e_di" bpmnElement="SequenceFlow_197cm2e"> - <di:waypoint x="930" y="456" /> - <di:waypoint x="1040" y="456" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1cv0wop_di" bpmnElement="SequenceFlow_1cv0wop"> - <di:waypoint x="745" y="456" /> - <di:waypoint x="830" y="456" /> + <di:waypoint x="804" y="620" /> + <di:waypoint x="859" y="620" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt"> - <di:waypoint x="350" y="121" /> - <di:waypoint x="410" y="121" /> + <di:waypoint x="350" y="122" /> + <di:waypoint x="410" y="122" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c"> - <di:waypoint x="214" y="121" /> - <di:waypoint x="250" y="121" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1l8mfej_di" bpmnElement="Flow_1l8mfej"> - <di:waypoint x="785" y="121" /> - <di:waypoint x="830" y="121" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0vq2rmw_di" bpmnElement="Flow_0vq2rmw"> - <di:waypoint x="930" y="121" /> - <di:waypoint x="1000" y="121" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1u4srgq_di" bpmnElement="Flow_1u4srgq"> - <di:waypoint x="1100" y="121" /> - <di:waypoint x="1140" y="121" /> + <di:waypoint x="214" y="122" /> + <di:waypoint x="250" y="122" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd"> - <dc:Bounds x="178" y="103" width="36" height="36" /> + <dc:Bounds x="178" y="104" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="156" y="146" width="82" height="40" /> + <dc:Bounds x="156" y="147" width="82" height="40" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateCatchEvent_0vilb24_di" bpmnElement="IntermediateCatchEvent_0vilb24"> - <dc:Bounds x="178" y="438" width="36" height="36" /> + <dc:Bounds x="177" y="602" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="168" y="481" width="60" height="27" /> + <dc:Bounds x="167" y="645" width="60" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1jgtb0y_di" bpmnElement="ScriptTask_1jgtb0y"> - <dc:Bounds x="830" y="416" width="100" height="80" /> + <dc:Bounds x="704" y="580" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0elbczl_di" bpmnElement="ExclusiveGateway_0elbczl" isMarkerVisible="true"> - <dc:Bounds x="1040" y="431" width="50" height="50" /> + <dc:Bounds x="859" y="595" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1027" y="413" width="78" height="14" /> + <dc:Bounds x="846" y="577" width="78" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_139l55g_di" bpmnElement="CallActivity_139l55g"> - <dc:Bounds x="645" y="249" width="100" height="80" /> + <dc:Bounds x="1060" y="84" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_1v96asi_di" bpmnElement="IntermediateThrowEvent_1v96asi"> - <dc:Bounds x="1584" y="271" width="36" height="36" /> + <dc:Bounds x="1402" y="332" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1567" y="312" width="81" height="27" /> + <dc:Bounds x="1385" y="373" width="81" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0gb975b_di" bpmnElement="ScriptTask_0gb975b"> - <dc:Bounds x="1193" y="249" width="100" height="80" /> + <dc:Bounds x="1060" y="310" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_18eld2o_di" bpmnElement="ExclusiveGateway_18eld2o" isMarkerVisible="true"> - <dc:Bounds x="488" y="776" width="50" height="50" /> + <dc:Bounds x="439" y="940" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="483" y="746" width="60" height="27" /> + <dc:Bounds x="434" y="910" width="60" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0x406rw_di" bpmnElement="EndEvent_0x406rw"> - <dc:Bounds x="495" y="926" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0l3d1ai_di" bpmnElement="ScriptTask_0l3d1ai"> - <dc:Bounds x="1440" y="81" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_1bnkmaz_di" bpmnElement="CallActivity_1bnkmaz"> - <dc:Bounds x="1280" y="81" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0o2r07o_di" bpmnElement="ScriptTask_0o2r07o"> - <dc:Bounds x="1140" y="81" width="100" height="80" /> + <dc:Bounds x="446" y="1090" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge"> - <dc:Bounds x="250" y="81" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0yce5sp_di" bpmnElement="Activity_12v8ykp"> - <dc:Bounds x="1000" y="81" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0uymgnp_di" bpmnElement="Activity_1ge49xu"> - <dc:Bounds x="830" y="81" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1eo3m4q_di" bpmnElement="ScriptTask_1eo3m4q"> - <dc:Bounds x="685" y="81" width="100" height="80" /> + <dc:Bounds x="250" y="82" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0kd6p6p_di" bpmnElement="ServiceTask_0kd6p6p"> - <dc:Bounds x="550" y="81" width="100" height="80" /> + <dc:Bounds x="564" y="82" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1xxag1o_di" bpmnElement="ScriptTask_1xxag1o"> - <dc:Bounds x="410" y="81" width="100" height="80" /> + <dc:Bounds x="410" y="82" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true"> - <dc:Bounds x="685" y="1080" width="781" height="196" /> + <dc:Bounds x="688" y="1072" width="781" height="196" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz"> - <di:waypoint x="1079" y="1184" /> - <di:waypoint x="1353" y="1184" /> + <di:waypoint x="1082" y="1176" /> + <di:waypoint x="1356" y="1176" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s"> - <di:waypoint x="751" y="1184" /> - <di:waypoint x="979" y="1184" /> + <di:waypoint x="754" y="1176" /> + <di:waypoint x="982" y="1176" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56"> - <dc:Bounds x="715" y="1166" width="36" height="36" /> + <dc:Bounds x="718" y="1158" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026"> - <dc:Bounds x="1353" y="1166" width="36" height="36" /> + <dc:Bounds x="1356" y="1158" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw"> - <dc:Bounds x="979" y="1144" width="100" height="80" /> + <dc:Bounds x="982" y="1136" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1ef3voz_di" bpmnElement="ScriptTask_1ef3voz"> - <dc:Bounds x="823" y="761" width="100" height="80" /> + <dc:Bounds x="764" y="925" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx"> - <dc:Bounds x="1585" y="783" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1593" y="826" width="20" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="IntermediateThrowEvent_1ex8ke9_di" bpmnElement="IntermediateThrowEvent_1ex8ke9"> - <dc:Bounds x="1584" y="103" width="36" height="36" /> + <dc:Bounds x="1396" y="947" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1564" y="144" width="87" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="IntermediateCatchEvent_1wii8im_di" bpmnElement="IntermediateCatchEvent_1wii8im"> - <dc:Bounds x="178" y="271" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="171" y="314" width="60" height="27" /> + <dc:Bounds x="1404" y="990" width="20" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9"> - <dc:Bounds x="1197" y="761" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0b7senu_di" bpmnElement="ScriptTask_0b7senu"> - <dc:Bounds x="285" y="249" width="100" height="80" /> + <dc:Bounds x="1074" y="925" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0h88mep_di" bpmnElement="CallActivity_0h88mep"> - <dc:Bounds x="467" y="249" width="100" height="80" /> + <dc:Bounds x="890" y="82" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0n47zoh_di" bpmnElement="CallActivity_0n47zoh"> - <dc:Bounds x="1371" y="249" width="100" height="80" /> + <dc:Bounds x="1220" y="310" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_12h8542_di" bpmnElement="ScriptTask_12h8542"> - <dc:Bounds x="1193" y="416" width="100" height="80" /> + <dc:Bounds x="1024" y="580" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0o89wmf_di" bpmnElement="CallActivity_0o89wmf"> - <dc:Bounds x="1371" y="416" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_0g98b71_di" bpmnElement="CallActivity_0g98b71"> - <dc:Bounds x="645" y="416" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_08wim95_di" bpmnElement="ScriptTask_08wim95"> - <dc:Bounds x="467" y="416" width="100" height="80" /> + <dc:Bounds x="1194" y="580" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0jdzpem_di" bpmnElement="CallActivity_0jdzpem"> - <dc:Bounds x="1371" y="605" width="100" height="80" /> + <dc:Bounds x="1194" y="765" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1mscu5w_di" bpmnElement="ScriptTask_1mscu5w"> - <dc:Bounds x="1193" y="605" width="100" height="80" /> + <dc:Bounds x="1024" y="765" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateCatchEvent_0pkvfun_di" bpmnElement="IntermediateCatchEvent_0pkvfun"> - <dc:Bounds x="178" y="783" width="36" height="36" /> + <dc:Bounds x="177" y="947" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="168" y="826" width="66" height="14" /> + <dc:Bounds x="167" y="990" width="66" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_0ktwpki_di" bpmnElement="IntermediateThrowEvent_0ktwpki"> - <dc:Bounds x="1584" y="438" width="36" height="36" /> + <dc:Bounds x="1396" y="602" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1577" y="479" width="67" height="27" /> + <dc:Bounds x="1389" y="643" width="67" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_15pl4ld_di" bpmnElement="CallActivity_15pl4ld"> - <dc:Bounds x="1005" y="761" width="100" height="80" /> + <dc:Bounds x="934" y="925" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1oouvuh_di" bpmnElement="EndEvent_1oouvuh"> - <dc:Bounds x="1584" y="627" width="36" height="36" /> + <dc:Bounds x="1396" y="787" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1592" y="670" width="20" height="14" /> + <dc:Bounds x="1404" y="830" width="20" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0esr949_di" bpmnElement="ServiceTask_0esr949"> - <dc:Bounds x="1375" y="761" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1jj846g_di" bpmnElement="ScriptTask_1jj846g"> - <dc:Bounds x="830" y="249" width="100" height="80" /> + <dc:Bounds x="1244" y="925" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0cxst1i_di" bpmnElement="CallActivity_0cxst1i"> - <dc:Bounds x="285" y="761" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_0bh0kwx_di" bpmnElement="EndEvent_0bh0kwx"> - <dc:Bounds x="317" y="593" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ReceiveTask_0zkpdpa_di" bpmnElement="Task_1b5t88h"> - <dc:Bounds x="285" y="416" width="100" height="80" /> + <dc:Bounds x="274" y="925" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0v4mw2x_di" bpmnElement="CallActivity_0v4mw2x"> - <dc:Bounds x="1015" y="249" width="100" height="80" /> + <dc:Bounds x="880" y="310" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8"> - <dc:Bounds x="645" y="761" width="100" height="80" /> + <dc:Bounds x="584" y="925" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BoundaryEvent_15igwk2_di" bpmnElement="BoundaryEvent_0clo9pv"> - <dc:Bounds x="317" y="478" width="36" height="36" /> + <bpmndi:BPMNShape id="ScriptTask_09mxr0w_di" bpmnElement="ScriptTask_09mxr0w"> + <dc:Bounds x="1230" y="84" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1ac05ww_di" bpmnElement="ScriptTask_1ac05ww"> + <dc:Bounds x="720" y="82" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0xmvg4v_di" bpmnElement="SequenceFlow_0xmvg4v"> + <di:waypoint x="664" y="122" /> + <di:waypoint x="720" y="122" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1x4n7an_di" bpmnElement="SequenceFlow_1x4n7an"> + <di:waypoint x="820" y="122" /> + <di:waypoint x="890" y="122" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1dfon41_di" bpmnElement="SequenceFlow_1dfon41"> + <di:waypoint x="990" y="122" /> + <di:waypoint x="1060" y="122" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0jhqtls_di" bpmnElement="SequenceFlow_0jhqtls"> + <di:waypoint x="1160" y="124" /> + <di:waypoint x="1230" y="124" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateCatchEvent_0gceuxu_di" bpmnElement="IntermediateCatchEvent_0gceuxu"> + <dc:Bounds x="168" y="332" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="161" y="375" width="60" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_14c2tav_di" bpmnElement="SequenceFlow_14c2tav"> + <di:waypoint x="204" y="350" /> + <di:waypoint x="310" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_00kcej9_di" bpmnElement="SequenceFlow_00kcej9"> + <di:waypoint x="1320" y="350" /> + <di:waypoint x="1402" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_060j650_di" bpmnElement="SequenceFlow_060j650"> + <di:waypoint x="213" y="620" /> + <di:waypoint x="394" y="620" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_0lpvnze_di" bpmnElement="IntermediateThrowEvent_0lpvnze"> + <dc:Bounds x="1402" y="106" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1382" y="147" width="87" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_12wo878_di" bpmnElement="SequenceFlow_12wo878"> + <di:waypoint x="1330" y="124" /> + <di:waypoint x="1402" y="124" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_13roglo_di" bpmnElement="ScriptTask_13roglo"> + <dc:Bounds x="710" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1f6dyxo_di" bpmnElement="SequenceFlow_1f6dyxo"> + <di:waypoint x="810" y="350" /> + <di:waypoint x="880" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ReceiveTask_02qzb6i_di" bpmnElement="ReceiveTask_02qzb6i"> + <dc:Bounds x="254" y="580" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0bz8a65_di" bpmnElement="EndEvent_0bz8a65"> + <dc:Bounds x="286" y="757" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BoundaryEvent_0p4swyp_di" bpmnElement="BoundaryEvent_0p4swyp"> + <dc:Bounds x="286" y="642" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1vesvto_di" bpmnElement="SequenceFlow_1vesvto"> + <di:waypoint x="304" y="678" /> + <di:waypoint x="304" y="757" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_04qudo2_di" bpmnElement="ScriptTask_04qudo2"> + <dc:Bounds x="394" y="580" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ti386y_di" bpmnElement="SequenceFlow_0ti386y"> + <di:waypoint x="494" y="620" /> + <di:waypoint x="534" y="620" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1vu3zcv_di" bpmnElement="CallActivity_1vu3zcv"> + <dc:Bounds x="534" y="580" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1whq7vc_di" bpmnElement="SequenceFlow_1whq7vc"> + <di:waypoint x="634" y="620" /> + <di:waypoint x="704" y="620" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0xf2g6c_di" bpmnElement="CallActivity_0xf2g6c"> + <dc:Bounds x="520" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1r2jtal_di" bpmnElement="SequenceFlow_1r2jtal"> + <di:waypoint x="620" y="350" /> + <di:waypoint x="710" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1ayg9y8_di" bpmnElement="ScriptTask_1ayg9y8"> + <dc:Bounds x="310" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_02sve8o_di" bpmnElement="SequenceFlow_02sve8o"> + <di:waypoint x="410" y="350" /> + <di:waypoint x="520" y="350" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn index 9c090e0594..9090bf2fab 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn @@ -1,361 +1,490 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> <bpmn:process id="DoAllocateNSIandNSSI" name="DoAllocateNSIandNSSI" isExecutable="true"> - <bpmn:scriptTask id="Task_09nzhwk" name="Generate NSI and create NSI in AAI with E2ESS and NSI relationship" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1e40h52</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1uiz85h</bpmn:outgoing> + <bpmn:startEvent id="StartEvent_1ym3sha" name="Start"> + <bpmn:outgoing>SequenceFlow_0xgfj7z</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_0xgfj7z" sourceRef="StartEvent_1ym3sha" targetRef="Task_027u6m6" /> + <bpmn:scriptTask id="Task_027u6m6" name="Preprocess Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0xgfj7z</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_00aukg6</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.createNSIinAAI(execution)</bpmn:script> +def dansi = new DoAllocateNSIandNSSI() +dansi.preProcessRequest(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_0b9d9l0" name="Is nsi option available?" default="SequenceFlow_1h5bw41"> - <bpmn:incoming>SequenceFlow_0dj0jvq</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1h5bw41</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0ueeeca</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_0qorxd9" name="Process NSI options" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_00aukg6</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ggo6s5</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dansi = new DoAllocateNSIandNSSI() +dansi.retriveSliceOption(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_00aukg6" sourceRef="Task_027u6m6" targetRef="ScriptTask_0qorxd9" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_00pt1ek" name="Is nsi option available?" default="SequenceFlow_0c986i9"> + <bpmn:incoming>SequenceFlow_1ggo6s5</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0c986i9</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_03ye8m4</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:scriptTask id="ScriptTask_1ehyrsg" name="Update AAI relationship for E2ESS and NSI" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0ueeeca</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0xfhbqw</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_1ggo6s5" sourceRef="ScriptTask_0qorxd9" targetRef="ExclusiveGateway_00pt1ek" /> + <bpmn:sequenceFlow id="SequenceFlow_0c986i9" sourceRef="ExclusiveGateway_00pt1ek" targetRef="ScriptTask_1tizl6b" /> + <bpmn:scriptTask id="ScriptTask_1tizl6b" name="create NSI in AAI and Update relationship" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0c986i9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1k3cspv</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new DoAllocateNSIandNSSI() -dcsi.updateRelationship(execution)</bpmn:script> +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.createNSIinAAI(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:callActivity id="CallActivity_1s23hty" name="Call Decompose Service" calledElement="DecomposeService"> + <bpmn:sequenceFlow id="SequenceFlow_1k3cspv" sourceRef="ScriptTask_1tizl6b" targetRef="ScriptTask_1r6kuwy" /> + <bpmn:sequenceFlow id="SequenceFlow_03ye8m4" sourceRef="ExclusiveGateway_00pt1ek" targetRef="ScriptTask_07sgklo"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSIOptionAvailable" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0fx1nyj" name="GoTo Create Slice Profile"> + <bpmn:incoming>SequenceFlow_0t0wddg</bpmn:incoming> + <bpmn:incoming>SequenceFlow_05ovikm</bpmn:incoming> + <bpmn:linkEventDefinition name="CreateSliceProfile" /> + </bpmn:intermediateThrowEvent> + <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_0k54pph" name="Create Slice Profile"> + <bpmn:outgoing>SequenceFlow_0ct8yh4</bpmn:outgoing> + <bpmn:linkEventDefinition name="CreateSliceProfile" /> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="SequenceFlow_0ct8yh4" sourceRef="IntermediateThrowEvent_0k54pph" targetRef="ExclusiveGateway_00ufetn" /> + <bpmn:parallelGateway id="ExclusiveGateway_00ufetn"> + <bpmn:incoming>SequenceFlow_0ct8yh4</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1m68yca</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0k5iu2n</bpmn:outgoing> + </bpmn:parallelGateway> + <bpmn:sequenceFlow id="SequenceFlow_1m68yca" sourceRef="ExclusiveGateway_00ufetn" targetRef="Task_1tv7jy5" /> + <bpmn:sequenceFlow id="SequenceFlow_0k5iu2n" sourceRef="ExclusiveGateway_00ufetn" targetRef="Task_1en3luv" /> + <bpmn:callActivity id="CallActivity_1yh9tiq" name="Call DoAllocateNSSI(RAN)" calledElement="DoAllocateNSSI"> <bpmn:extensionElements> <camunda:in source="msoRequestId" target="msoRequestId" /> - <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> - <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> - <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> - <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="nsstInput" target="nsstInput" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> + <camunda:in source="uuiRequest" target="uuiRequest" /> + <camunda:in source="sliceTaskParams" target="sliceTaskParams" /> + <camunda:in source="taskId" target="CSSOT_taskId" /> + <camunda:in source="taskName" target="CSSOT_name" /> + <camunda:in source="taskStatus" target="CSSOT_status" /> + <camunda:in source="isManual" target="CSSOT_isManual" /> + <camunda:in source="isNSIOptionAvailable" target="isNSIOptionAvailable" /> + <camunda:in source="anSliceTaskInfo" target="sliceTaskInfo" /> + <camunda:out source="nssiAllocateResult" target="anNssiAllocateResult" /> + <camunda:in source="AnAllocateNssiNbiRequest" target="nbiRequest" /> + <camunda:out source="sliceTaskParams" target="sliceTaskParams" /> + <camunda:in source="anSubnetType" target="subnetType" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0npsyye</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1xb5nx1</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1hfjn79" sourceRef="Task_1tv7jy5" targetRef="ScriptTask_1r2li91" /> + <bpmn:callActivity id="CallActivity_1ixah3o" name="Call DoAllocateNSSI(Core)" calledElement="DoAllocateNSSI"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="nsstInput" target="nsstInput" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> + <camunda:in source="uuiRequest" target="uuiRequest" /> + <camunda:in source="sliceTaskParams" target="sliceTaskParams" /> + <camunda:in source="taskId" target="CSSOT_taskId" /> + <camunda:in source="taskName" target="CSSOT_name" /> + <camunda:in source="taskStatus" target="CSSOT_status" /> + <camunda:in source="isManual" target="CSSOT_isManual" /> + <camunda:in source="isNSIOptionAvailable" target="isNSIOptionAvailable" /> + <camunda:in source="cnSliceTaskInfo" target="sliceTaskInfo" /> + <camunda:in source="domainType" target="domainType" /> + <camunda:out source="nssiAllocateResult" target="cnNssiAllocateResult" /> + <camunda:in source="CnAllocateNssiNbiRequest" target="nbiRequest" /> + <camunda:out source="sliceTaskParams" target="sliceTaskParams" /> + <camunda:in source="cnSubnetType" target="subnetType" /> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1h5bw41</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1e40h52</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_0cwbtmr</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1l74seh</bpmn:outgoing> </bpmn:callActivity> - <bpmn:scriptTask id="ScriptTask_1q3ftu4" name="Prepare NSSI model info and instance id" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0xfhbqw</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0uhaps2</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_0f36cu2" sourceRef="Task_1en3luv" targetRef="Task_1g8n8iz" /> + <bpmn:sequenceFlow id="SequenceFlow_1xb5nx1" sourceRef="CallActivity_1yh9tiq" targetRef="ScriptTask_0mls87v" /> + <bpmn:parallelGateway id="ExclusiveGateway_19ru3hp"> + <bpmn:incoming>SequenceFlow_0xx5bwa</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0jqxxjq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ax2c4p</bpmn:outgoing> + </bpmn:parallelGateway> + <bpmn:scriptTask id="ScriptTask_07sgklo" name="Update relationship between NSI and Service Profile" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_03ye8m4</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0t0wddg</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new DoAllocateNSIandNSSI() -dcsi.prepareNssiModelInfo(execution)</bpmn:script> +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.updateRelationship(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:startEvent id="allocateslice_StartEvent" name="allocatensi_StartEvent"> - <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> - </bpmn:startEvent> - <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_0t0wddg" sourceRef="ScriptTask_07sgklo" targetRef="IntermediateThrowEvent_0fx1nyj" /> + <bpmn:scriptTask id="ScriptTask_1r6kuwy" name="create relationship between nsi and SP" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1k3cspv</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_05ovikm</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoAllocateNSIandNSSI() -dcso.preProcessRequest(execution)</bpmn:script> +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.createRelationship(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_0o93dvp" name="read NSI options from request DB" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0dj0jvq</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_05ovikm" sourceRef="ScriptTask_1r6kuwy" targetRef="IntermediateThrowEvent_0fx1nyj" /> + <bpmn:scriptTask id="Task_1tv7jy5" name="Create RAN Slice Profile Instance" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1m68yca</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1hfjn79</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dansi = new DoAllocateNSIandNSSI() -dansi.retriveSliceOption(execution)</bpmn:script> +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.createAnSliceProfileInstance(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:callActivity id="CallActivity_1k1oonn" name="Call Decompose Service" calledElement="DecomposeService"> - <bpmn:extensionElements> - <camunda:in source="msoRequestId" target="msoRequestId" /> - <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> - <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> - <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> - <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1dhpkhd</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0hxky5e</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:scriptTask id="ScriptTask_0gunols" name="Get one NSST Info" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1uiz85h</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1ui528w</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1dhpkhd</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_1r2li91" name="Create RAN Slice Profile" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1hfjn79</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0zbd2tq</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.getOneNsstInfo(execution)</bpmn:script> +dcnsio.createAnSliceProfile(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_1lpgn98" name="prepare NSST Info" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0hxky5e</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_19jztxv</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_0zbd2tq" sourceRef="ScriptTask_1r2li91" targetRef="ScriptTask_0s8vhha" /> + <bpmn:scriptTask id="Task_1en3luv" name="Create Core Slice Profile Instance" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0k5iu2n</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0f36cu2</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.createNSSTMap(execution)</bpmn:script> +dcnsio.createCnSliceProfileInstance(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:endEvent id="EndEvent_1x6k78c"> - <bpmn:incoming>SequenceFlow_0u8fycy</bpmn:incoming> - </bpmn:endEvent> - <bpmn:scriptTask id="finishNSCreate_Task" name="Get a NSSI to process" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_16nvnxi</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0cq2q6g</bpmn:outgoing> + <bpmn:scriptTask id="Task_1g8n8iz" name="Create Core Slice Profile" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0f36cu2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1wffel4</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new DoAllocateNSIandNSSI() -dcsi.getOneNSSIInfo(execution)</bpmn:script> +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.createCnSliceProfile(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_07qkrrb" name="Is there more NSSI to process?" default="SequenceFlow_0u8fycy"> - <bpmn:incoming>SequenceFlow_0g5bwvl</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1jaxstd</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_16nvnxi</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0u8fycy</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:callActivity id="CallActivity_130tuxn" name="Call DoAllocateNSSI" calledElement="DoAllocateNSSI"> + <bpmn:sequenceFlow id="SequenceFlow_0ax2c4p" sourceRef="ExclusiveGateway_19ru3hp" targetRef="EndEvent_02c8wsp" /> + <bpmn:scriptTask id="ScriptTask_0stnvp3" name="Create TN (BH) Slice Profile" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0paqrtx</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1d48cil</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.createTnBHSliceProfileInstance(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_1f4o46q" name="Create TN(BH) Slice Profile" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1d48cil</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_00dexhy</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.createTnBHSliceProfile(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_0b28wlb" name="Call DoAllocateNSSI(TN)" calledElement="DoAllocateNSSI"> <bpmn:extensionElements> <camunda:in source="msoRequestId" target="msoRequestId" /> - <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:in source="nsstInput" target="nsstInput" /> - <camunda:in source="serviceProfile" target="serviceProfile" /> - <camunda:in source="sliceProfileTn" target="sliceProfileTn" /> - <camunda:in source="sliceProfileCn" target="sliceProfileCn" /> - <camunda:in source="sliceProfileAn" target="sliceProfileAn" /> <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> <camunda:in source="uuiRequest" target="uuiRequest" /> - <camunda:in source="nsiServiceInstanceId" target="nsiServiceInstanceId" /> - <camunda:in source="nsiServiceInstanceName" target="nsiServiceInstanceName" /> - <camunda:in source="nssiserviceModelInfo" target="nssiserviceModelInfo" /> <camunda:in source="sliceTaskParams" target="sliceTaskParams" /> <camunda:in source="taskId" target="CSSOT_taskId" /> <camunda:in source="taskName" target="CSSOT_name" /> <camunda:in source="taskStatus" target="CSSOT_status" /> <camunda:in source="isManual" target="CSSOT_isManual" /> <camunda:in source="isNSIOptionAvailable" target="isNSIOptionAvailable" /> + <camunda:in source="tnBHSliceTaskInfo" target="sliceTaskInfo" /> + <camunda:out source="nssiAllocateResult" target="tnBHNssiAllocateResult" /> + <camunda:in source="TnBHAllocateNssiNbiRequest" target="nbiRequest" /> + <camunda:out source="sliceTaskParams" target="sliceTaskParams" /> + <camunda:in source="tnBHSubnetType" target="subnetType" /> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0cq2q6g</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_00b8ryw</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_01isn2q</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1omynpt</bpmn:outgoing> </bpmn:callActivity> - <bpmn:scriptTask id="ScriptTask_0anyn7v" name="Update current Index" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_00b8ryw</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1jaxstd</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_1d48cil" sourceRef="ScriptTask_0stnvp3" targetRef="ScriptTask_1f4o46q" /> + <bpmn:sequenceFlow id="SequenceFlow_00dexhy" sourceRef="ScriptTask_1f4o46q" targetRef="ScriptTask_0ci5g6y" /> + <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_08wpvhs" name="Create Tn SliceProfile"> + <bpmn:outgoing>SequenceFlow_0paqrtx</bpmn:outgoing> + <bpmn:linkEventDefinition id="LinkEventDefinition_1beugxy" name="CreateTnSliceProfile" /> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="SequenceFlow_0paqrtx" sourceRef="IntermediateCatchEvent_08wpvhs" targetRef="ScriptTask_0stnvp3" /> + <bpmn:scriptTask id="ScriptTask_0sssiii" name="Update relationship between NSI and NSSI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1omynpt</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_150xio1</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new DoAllocateNSIandNSSI() -dcsi.updateCurrentIndex(execution)</bpmn:script> +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.updateTnBHRelationship(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="instantiate_NSTask" name="Prepare NSSI list (with and without shared NSSI)" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0uhaps2</bpmn:incoming> - <bpmn:incoming>SequenceFlow_04yx9ii</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0g5bwvl</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_150xio1" sourceRef="ScriptTask_0sssiii" targetRef="EndEvent_0elqlhv" /> + <bpmn:scriptTask id="ScriptTask_0mls87v" name="Update relationship between NSI and NSSI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1xb5nx1</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0xx5bwa</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoAllocateNSIandNSSI() -dcso.prepareNSSIList(execution)</bpmn:script> +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.updateAnRelationship(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_1jg3el3" name="Is NSST available?" default="SequenceFlow_04yx9ii"> - <bpmn:incoming>SequenceFlow_19jztxv</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_04yx9ii</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1ui528w</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_0uhaps2" sourceRef="ScriptTask_1q3ftu4" targetRef="instantiate_NSTask" /> - <bpmn:sequenceFlow id="SequenceFlow_1e40h52" sourceRef="CallActivity_1s23hty" targetRef="Task_09nzhwk" /> - <bpmn:sequenceFlow id="SequenceFlow_0xfhbqw" sourceRef="ScriptTask_1ehyrsg" targetRef="ScriptTask_1q3ftu4" /> - <bpmn:sequenceFlow id="SequenceFlow_0dj0jvq" sourceRef="ScriptTask_0o93dvp" targetRef="ExclusiveGateway_0b9d9l0" /> - <bpmn:sequenceFlow id="SequenceFlow_0ueeeca" name="Yes" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="ScriptTask_1ehyrsg"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSIOptionAvailable" ) == true)}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1h5bw41" name="No" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="CallActivity_1s23hty" /> - <bpmn:sequenceFlow id="SequenceFlow_1uiz85h" sourceRef="Task_09nzhwk" targetRef="ScriptTask_0gunols" /> - <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="allocateslice_StartEvent" targetRef="PreprocessIncomingRequest_task" /> - <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="ScriptTask_0o93dvp" /> - <bpmn:sequenceFlow id="SequenceFlow_0g5bwvl" sourceRef="instantiate_NSTask" targetRef="ExclusiveGateway_07qkrrb" /> - <bpmn:sequenceFlow id="SequenceFlow_0hxky5e" sourceRef="CallActivity_1k1oonn" targetRef="ScriptTask_1lpgn98" /> - <bpmn:sequenceFlow id="SequenceFlow_1dhpkhd" sourceRef="ScriptTask_0gunols" targetRef="CallActivity_1k1oonn" /> - <bpmn:sequenceFlow id="SequenceFlow_19jztxv" sourceRef="ScriptTask_1lpgn98" targetRef="ExclusiveGateway_1jg3el3" /> - <bpmn:sequenceFlow id="SequenceFlow_0u8fycy" name="No" sourceRef="ExclusiveGateway_07qkrrb" targetRef="EndEvent_1x6k78c" /> - <bpmn:sequenceFlow id="SequenceFlow_16nvnxi" name="Yes" sourceRef="ExclusiveGateway_07qkrrb" targetRef="finishNSCreate_Task"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isMoreNSSI" ) == true)}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_0cq2q6g" sourceRef="finishNSCreate_Task" targetRef="CallActivity_130tuxn" /> - <bpmn:sequenceFlow id="SequenceFlow_1jaxstd" sourceRef="ScriptTask_0anyn7v" targetRef="ExclusiveGateway_07qkrrb" /> - <bpmn:sequenceFlow id="SequenceFlow_00b8ryw" sourceRef="CallActivity_130tuxn" targetRef="ScriptTask_0anyn7v" /> - <bpmn:sequenceFlow id="SequenceFlow_04yx9ii" name="No" sourceRef="ExclusiveGateway_1jg3el3" targetRef="instantiate_NSTask" /> - <bpmn:sequenceFlow id="SequenceFlow_1ui528w" sourceRef="ExclusiveGateway_1jg3el3" targetRef="ScriptTask_0gunols"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isMoreNSSTtoProcess" ) == true)}</bpmn:conditionExpression> - </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0xx5bwa" sourceRef="ScriptTask_0mls87v" targetRef="ExclusiveGateway_19ru3hp" /> + <bpmn:scriptTask id="ScriptTask_0z9x5uh" name="Update relationship between NSI and NSSI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1l74seh</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0jqxxjq</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.updateCnRelationship(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1l74seh" sourceRef="CallActivity_1ixah3o" targetRef="ScriptTask_0z9x5uh" /> + <bpmn:sequenceFlow id="SequenceFlow_0jqxxjq" sourceRef="ScriptTask_0z9x5uh" targetRef="ExclusiveGateway_19ru3hp" /> + <bpmn:sequenceFlow id="SequenceFlow_1omynpt" sourceRef="CallActivity_0b28wlb" targetRef="ScriptTask_0sssiii" /> + <bpmn:endEvent id="EndEvent_0elqlhv"> + <bpmn:incoming>SequenceFlow_150xio1</bpmn:incoming> + </bpmn:endEvent> + <bpmn:intermediateThrowEvent id="EndEvent_02c8wsp" name="GoTo Create Tn SliceProfile"> + <bpmn:incoming>SequenceFlow_0ax2c4p</bpmn:incoming> + <bpmn:linkEventDefinition name="CreateTnSliceProfile" /> + </bpmn:intermediateThrowEvent> + <bpmn:scriptTask id="ScriptTask_0s8vhha" name="prepare Allocate An Nssi" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0zbd2tq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0npsyye</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.prepareAllocateAnNssi(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0npsyye" sourceRef="ScriptTask_0s8vhha" targetRef="CallActivity_1yh9tiq" /> + <bpmn:scriptTask id="ScriptTask_0z0ec5b" name="prepare Allocate Cn Nssi" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1wffel4</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0cwbtmr</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.prepareAllocateCnNssi(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0cwbtmr" sourceRef="ScriptTask_0z0ec5b" targetRef="CallActivity_1ixah3o" /> + <bpmn:sequenceFlow id="SequenceFlow_1wffel4" sourceRef="Task_1g8n8iz" targetRef="ScriptTask_0z0ec5b" /> + <bpmn:scriptTask id="ScriptTask_0ci5g6y" name="prepare Allocate Tn-BH Nssi" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_00dexhy</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01isn2q</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.prepareAllocateTnBHNssi(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_01isn2q" sourceRef="ScriptTask_0ci5g6y" targetRef="CallActivity_0b28wlb" /> </bpmn:process> + <bpmn:message id="Message_1i10pf1" name="Message_2mc69tg" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSIandNSSI"> - <bpmndi:BPMNEdge id="SequenceFlow_0uhaps2_di" bpmnElement="SequenceFlow_0uhaps2"> - <di:waypoint x="978" y="350" /> - <di:waypoint x="1736" y="350" /> - <di:waypoint x="1736" y="487" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1e40h52_di" bpmnElement="SequenceFlow_1e40h52"> - <di:waypoint x="799" y="527" /> - <di:waypoint x="878" y="527" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0xfhbqw_di" bpmnElement="SequenceFlow_0xfhbqw"> - <di:waypoint x="799" y="350" /> - <di:waypoint x="878" y="350" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0dj0jvq_di" bpmnElement="SequenceFlow_0dj0jvq"> - <di:waypoint x="520" y="527" /> - <di:waypoint x="583" y="527" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0ueeeca_di" bpmnElement="SequenceFlow_0ueeeca"> - <di:waypoint x="608" y="502" /> - <di:waypoint x="608" y="350" /> - <di:waypoint x="699" y="350" /> + <bpmndi:BPMNShape id="StartEvent_1ym3sha_di" bpmnElement="StartEvent_1ym3sha"> + <dc:Bounds x="138" y="122" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="584" y="422" width="19" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1h5bw41_di" bpmnElement="SequenceFlow_1h5bw41"> - <di:waypoint x="633" y="527" /> - <di:waypoint x="699" y="527" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="630" y="509" width="14" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1uiz85h_di" bpmnElement="SequenceFlow_1uiz85h"> - <di:waypoint x="978" y="527" /> - <di:waypoint x="1036" y="527" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="631" y="108" width="0" height="12" /> + <dc:Bounds x="144" y="165" width="25" height="14" /> </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0xgfj7z_di" bpmnElement="SequenceFlow_0xgfj7z"> + <di:waypoint x="174" y="140" /> + <di:waypoint x="224" y="140" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> - <di:waypoint x="210" y="527" /> - <di:waypoint x="268" y="527" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="266" y="123" width="0" height="12" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNShape id="ScriptTask_0q0td74_di" bpmnElement="Task_027u6m6"> + <dc:Bounds x="224" y="100" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0qorxd9_di" bpmnElement="ScriptTask_0qorxd9"> + <dc:Bounds x="404" y="100" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_00aukg6_di" bpmnElement="SequenceFlow_00aukg6"> + <di:waypoint x="324" y="140" /> + <di:waypoint x="404" y="140" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> - <di:waypoint x="368" y="527" /> - <di:waypoint x="420" y="527" /> + <bpmndi:BPMNShape id="ExclusiveGateway_00pt1ek_di" bpmnElement="ExclusiveGateway_00pt1ek" isMarkerVisible="true"> + <dc:Bounds x="609" y="115" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="436" y="108" width="0" height="12" /> + <dc:Bounds x="604" y="78" width="59" height="27" /> </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ggo6s5_di" bpmnElement="SequenceFlow_1ggo6s5"> + <di:waypoint x="504" y="140" /> + <di:waypoint x="609" y="140" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0g5bwvl_di" bpmnElement="SequenceFlow_0g5bwvl"> - <di:waypoint x="1786" y="527" /> - <di:waypoint x="1871" y="527" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0hxky5e_di" bpmnElement="SequenceFlow_0hxky5e"> - <di:waypoint x="1300" y="527" /> - <di:waypoint x="1388" y="527" /> + <bpmndi:BPMNEdge id="SequenceFlow_0c986i9_di" bpmnElement="SequenceFlow_0c986i9"> + <di:waypoint x="659" y="140" /> + <di:waypoint x="800" y="140" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1dhpkhd_di" bpmnElement="SequenceFlow_1dhpkhd"> - <di:waypoint x="1136" y="527" /> - <di:waypoint x="1200" y="527" /> + <bpmndi:BPMNShape id="ScriptTask_1tizl6b_di" bpmnElement="ScriptTask_1tizl6b"> + <dc:Bounds x="800" y="100" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1k3cspv_di" bpmnElement="SequenceFlow_1k3cspv"> + <di:waypoint x="900" y="140" /> + <di:waypoint x="970" y="140" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_19jztxv_di" bpmnElement="SequenceFlow_19jztxv"> - <di:waypoint x="1488" y="527" /> - <di:waypoint x="1564" y="527" /> + <bpmndi:BPMNEdge id="SequenceFlow_03ye8m4_di" bpmnElement="SequenceFlow_03ye8m4"> + <di:waypoint x="634" y="165" /> + <di:waypoint x="634" y="260" /> + <di:waypoint x="930" y="260" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0u8fycy_di" bpmnElement="SequenceFlow_0u8fycy"> - <di:waypoint x="1896" y="502" /> - <di:waypoint x="1896" y="409" /> + <bpmndi:BPMNShape id="IntermediateThrowEvent_0zuxkap_di" bpmnElement="IntermediateThrowEvent_0fx1nyj"> + <dc:Bounds x="1412" y="122" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1904" y="453" width="14" height="14" /> + <dc:Bounds x="1388" y="92" width="90" height="27" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_16nvnxi_di" bpmnElement="SequenceFlow_16nvnxi"> - <di:waypoint x="1921" y="527" /> - <di:waypoint x="1991" y="527" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateCatchEvent_1u7g80x_di" bpmnElement="IntermediateThrowEvent_0k54pph"> + <dc:Bounds x="138" y="502" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1942" y="500" width="19" height="14" /> + <dc:Bounds x="126" y="545" width="60" height="27" /> </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ct8yh4_di" bpmnElement="SequenceFlow_0ct8yh4"> + <di:waypoint x="174" y="520" /> + <di:waypoint x="239" y="520" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0cq2q6g_di" bpmnElement="SequenceFlow_0cq2q6g"> - <di:waypoint x="2091" y="527" /> - <di:waypoint x="2197" y="527" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="556.5" y="574" width="90" height="12" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNShape id="ParallelGateway_0q9h79n_di" bpmnElement="ExclusiveGateway_00ufetn"> + <dc:Bounds x="239" y="495" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1m68yca_di" bpmnElement="SequenceFlow_1m68yca"> + <di:waypoint x="264" y="495" /> + <di:waypoint x="264" y="440" /> + <di:waypoint x="310" y="440" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1jaxstd_di" bpmnElement="SequenceFlow_1jaxstd"> - <di:waypoint x="1991" y="665" /> - <di:waypoint x="1896" y="665" /> - <di:waypoint x="1896" y="552" /> + <bpmndi:BPMNEdge id="SequenceFlow_0k5iu2n_di" bpmnElement="SequenceFlow_0k5iu2n"> + <di:waypoint x="264" y="545" /> + <di:waypoint x="264" y="630" /> + <di:waypoint x="310" y="630" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_00b8ryw_di" bpmnElement="SequenceFlow_00b8ryw"> - <di:waypoint x="2247" y="567" /> - <di:waypoint x="2247" y="665" /> - <di:waypoint x="2091" y="665" /> + <bpmndi:BPMNShape id="CallActivity_1yh9tiq_di" bpmnElement="CallActivity_1yh9tiq"> + <dc:Bounds x="930" y="400" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1hfjn79_di" bpmnElement="SequenceFlow_1hfjn79"> + <di:waypoint x="410" y="440" /> + <di:waypoint x="530" y="440" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_04yx9ii_di" bpmnElement="SequenceFlow_04yx9ii"> - <di:waypoint x="1614" y="527" /> - <di:waypoint x="1686" y="527" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1643" y="509" width="14" height="14" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNShape id="CallActivity_1ixah3o_di" bpmnElement="CallActivity_1ixah3o"> + <dc:Bounds x="930" y="590" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0f36cu2_di" bpmnElement="SequenceFlow_0f36cu2"> + <di:waypoint x="410" y="630" /> + <di:waypoint x="530" y="630" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1ui528w_di" bpmnElement="SequenceFlow_1ui528w"> - <di:waypoint x="1589" y="552" /> - <di:waypoint x="1589" y="671" /> - <di:waypoint x="1086" y="671" /> - <di:waypoint x="1086" y="567" /> + <bpmndi:BPMNEdge id="SequenceFlow_1xb5nx1_di" bpmnElement="SequenceFlow_1xb5nx1"> + <di:waypoint x="1030" y="440" /> + <di:waypoint x="1140" y="440" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk"> - <dc:Bounds x="878" y="487" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0b9d9l0_di" bpmnElement="ExclusiveGateway_0b9d9l0" isMarkerVisible="true"> - <dc:Bounds x="583" y="502" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="578" y="559" width="60" height="27" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNShape id="ParallelGateway_15vgf7c_di" bpmnElement="ExclusiveGateway_19ru3hp"> + <dc:Bounds x="1325" y="505" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1ehyrsg_di" bpmnElement="ScriptTask_1ehyrsg"> - <dc:Bounds x="699" y="310" width="100" height="80" /> + <bpmndi:BPMNShape id="ScriptTask_07sgklo_di" bpmnElement="ScriptTask_07sgklo"> + <dc:Bounds x="930" y="220" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_1s23hty_di" bpmnElement="CallActivity_1s23hty"> - <dc:Bounds x="699" y="487" width="100" height="80" /> + <bpmndi:BPMNEdge id="SequenceFlow_0t0wddg_di" bpmnElement="SequenceFlow_0t0wddg"> + <di:waypoint x="1030" y="260" /> + <di:waypoint x="1430" y="260" /> + <di:waypoint x="1430" y="158" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1r6kuwy_di" bpmnElement="ScriptTask_1r6kuwy"> + <dc:Bounds x="970" y="100" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1q3ftu4_di" bpmnElement="ScriptTask_1q3ftu4"> - <dc:Bounds x="878" y="310" width="100" height="80" /> + <bpmndi:BPMNEdge id="SequenceFlow_05ovikm_di" bpmnElement="SequenceFlow_05ovikm"> + <di:waypoint x="1070" y="140" /> + <di:waypoint x="1412" y="140" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_17cq3xj_di" bpmnElement="Task_1tv7jy5"> + <dc:Bounds x="310" y="400" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="allocateslice_StartEvent"> - <dc:Bounds x="174" y="509" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="152" y="545" width="82" height="27" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNShape id="ScriptTask_1r2li91_di" bpmnElement="ScriptTask_1r2li91"> + <dc:Bounds x="530" y="400" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> - <dc:Bounds x="268" y="487" width="100" height="80" /> + <bpmndi:BPMNEdge id="SequenceFlow_0zbd2tq_di" bpmnElement="SequenceFlow_0zbd2tq"> + <di:waypoint x="630" y="440" /> + <di:waypoint x="730" y="440" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_01n5nmt_di" bpmnElement="Task_1en3luv"> + <dc:Bounds x="310" y="590" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0o93dvp_di" bpmnElement="ScriptTask_0o93dvp"> - <dc:Bounds x="420" y="487" width="100" height="80" /> + <bpmndi:BPMNShape id="ScriptTask_0juh1xy_di" bpmnElement="Task_1g8n8iz"> + <dc:Bounds x="530" y="590" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_1k1oonn_di" bpmnElement="CallActivity_1k1oonn"> - <dc:Bounds x="1200" y="487" width="100" height="80" /> + <bpmndi:BPMNEdge id="SequenceFlow_0ax2c4p_di" bpmnElement="SequenceFlow_0ax2c4p"> + <di:waypoint x="1375" y="530" /> + <di:waypoint x="1412" y="530" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0stnvp3_di" bpmnElement="ScriptTask_0stnvp3"> + <dc:Bounds x="310" y="840" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0gunols_di" bpmnElement="ScriptTask_0gunols"> - <dc:Bounds x="1036" y="487" width="100" height="80" /> + <bpmndi:BPMNShape id="ScriptTask_1f4o46q_di" bpmnElement="ScriptTask_1f4o46q"> + <dc:Bounds x="530" y="840" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1lpgn98_di" bpmnElement="ScriptTask_1lpgn98"> - <dc:Bounds x="1388" y="487" width="100" height="80" /> + <bpmndi:BPMNShape id="CallActivity_0b28wlb_di" bpmnElement="CallActivity_0b28wlb"> + <dc:Bounds x="930" y="840" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> - <dc:Bounds x="1878" y="373" width="36" height="36" /> + <bpmndi:BPMNEdge id="SequenceFlow_1d48cil_di" bpmnElement="SequenceFlow_1d48cil"> + <di:waypoint x="410" y="880" /> + <di:waypoint x="530" y="880" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_00dexhy_di" bpmnElement="SequenceFlow_00dexhy"> + <di:waypoint x="630" y="880" /> + <di:waypoint x="730" y="880" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateCatchEvent_08wpvhs_di" bpmnElement="IntermediateCatchEvent_08wpvhs"> + <dc:Bounds x="138" y="862" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="412" y="617" width="90" height="12" /> + <dc:Bounds x="129" y="905" width="56" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0xxyfku_di" bpmnElement="finishNSCreate_Task"> - <dc:Bounds x="1991" y="487" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_07qkrrb_di" bpmnElement="ExclusiveGateway_07qkrrb" isMarkerVisible="true"> - <dc:Bounds x="1871" y="502" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1853" y="575" width="86" height="27" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNEdge id="SequenceFlow_0paqrtx_di" bpmnElement="SequenceFlow_0paqrtx"> + <di:waypoint x="174" y="880" /> + <di:waypoint x="310" y="880" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0sssiii_di" bpmnElement="ScriptTask_0sssiii"> + <dc:Bounds x="1140" y="840" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_130tuxn_di" bpmnElement="CallActivity_130tuxn"> - <dc:Bounds x="2197" y="487" width="100" height="80" /> + <bpmndi:BPMNEdge id="SequenceFlow_150xio1_di" bpmnElement="SequenceFlow_150xio1"> + <di:waypoint x="1240" y="880" /> + <di:waypoint x="1412" y="880" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0mls87v_di" bpmnElement="ScriptTask_0mls87v"> + <dc:Bounds x="1140" y="400" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0anyn7v_di" bpmnElement="ScriptTask_0anyn7v"> - <dc:Bounds x="1991" y="625" width="100" height="80" /> + <bpmndi:BPMNEdge id="SequenceFlow_0xx5bwa_di" bpmnElement="SequenceFlow_0xx5bwa"> + <di:waypoint x="1240" y="440" /> + <di:waypoint x="1350" y="440" /> + <di:waypoint x="1350" y="505" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0z9x5uh_di" bpmnElement="ScriptTask_0z9x5uh"> + <dc:Bounds x="1140" y="590" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="instantiate_NSTask"> - <dc:Bounds x="1686" y="487" width="100" height="80" /> + <bpmndi:BPMNEdge id="SequenceFlow_1l74seh_di" bpmnElement="SequenceFlow_1l74seh"> + <di:waypoint x="1030" y="630" /> + <di:waypoint x="1140" y="630" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0jqxxjq_di" bpmnElement="SequenceFlow_0jqxxjq"> + <di:waypoint x="1240" y="630" /> + <di:waypoint x="1350" y="630" /> + <di:waypoint x="1350" y="555" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1omynpt_di" bpmnElement="SequenceFlow_1omynpt"> + <di:waypoint x="1030" y="880" /> + <di:waypoint x="1140" y="880" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_0elqlhv_di" bpmnElement="EndEvent_0elqlhv"> + <dc:Bounds x="1412" y="862" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_1jg3el3_di" bpmnElement="ExclusiveGateway_1jg3el3" isMarkerVisible="true"> - <dc:Bounds x="1564" y="502" width="50" height="50" /> + <bpmndi:BPMNShape id="IntermediateThrowEvent_0gz4vi6_di" bpmnElement="EndEvent_02c8wsp"> + <dc:Bounds x="1412" y="512" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1564" y="465" width="50" height="27" /> + <dc:Bounds x="1392" y="555" width="79" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0s8vhha_di" bpmnElement="ScriptTask_0s8vhha"> + <dc:Bounds x="730" y="400" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0npsyye_di" bpmnElement="SequenceFlow_0npsyye"> + <di:waypoint x="830" y="440" /> + <di:waypoint x="930" y="440" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0z0ec5b_di" bpmnElement="ScriptTask_0z0ec5b"> + <dc:Bounds x="730" y="590" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0cwbtmr_di" bpmnElement="SequenceFlow_0cwbtmr"> + <di:waypoint x="830" y="630" /> + <di:waypoint x="930" y="630" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1wffel4_di" bpmnElement="SequenceFlow_1wffel4"> + <di:waypoint x="630" y="630" /> + <di:waypoint x="730" y="630" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0ci5g6y_di" bpmnElement="ScriptTask_0ci5g6y"> + <dc:Bounds x="730" y="840" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_01isn2q_di" bpmnElement="SequenceFlow_01isn2q"> + <di:waypoint x="830" y="880" /> + <di:waypoint x="930" y="880" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSIV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSIV2.bpmn deleted file mode 100644 index 071960a972..0000000000 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSIV2.bpmn +++ /dev/null @@ -1,598 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> - <bpmn:process id="DoAllocateNSIandNSSIV2" name="DoAllocateNSIandNSSIV2" isExecutable="true"> - <bpmn:startEvent id="StartEvent_1ym3sha" name="Start"> - <bpmn:outgoing>SequenceFlow_0xgfj7z</bpmn:outgoing> - </bpmn:startEvent> - <bpmn:sequenceFlow id="SequenceFlow_0xgfj7z" sourceRef="StartEvent_1ym3sha" targetRef="Task_027u6m6" /> - <bpmn:scriptTask id="Task_027u6m6" name="Preprocess Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0xgfj7z</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_00aukg6</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dansi = new DoAllocateNSIandNSSI() -dansi.preProcessRequest(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_0qorxd9" name="Process NSI options" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_00aukg6</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1ggo6s5</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dansi = new DoAllocateNSIandNSSI() -dansi.retriveSliceOption(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_00aukg6" sourceRef="Task_027u6m6" targetRef="ScriptTask_0qorxd9" /> - <bpmn:exclusiveGateway id="ExclusiveGateway_00pt1ek" name="Is nsi option available?" default="SequenceFlow_0c986i9"> - <bpmn:incoming>SequenceFlow_1ggo6s5</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0c986i9</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_03ye8m4</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_1ggo6s5" sourceRef="ScriptTask_0qorxd9" targetRef="ExclusiveGateway_00pt1ek" /> - <bpmn:sequenceFlow id="SequenceFlow_0c986i9" sourceRef="ExclusiveGateway_00pt1ek" targetRef="ScriptTask_1tizl6b" /> - <bpmn:scriptTask id="ScriptTask_1tizl6b" name="create NSI in AAI and Update relationship" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0c986i9</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1k3cspv</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.createNSIinAAI(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_1k3cspv" sourceRef="ScriptTask_1tizl6b" targetRef="ScriptTask_1r6kuwy" /> - <bpmn:sequenceFlow id="SequenceFlow_03ye8m4" sourceRef="ExclusiveGateway_00pt1ek" targetRef="ScriptTask_07sgklo"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSIOptionAvailable" ) == true)}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0fx1nyj" name="GoTo Create Slice Profile"> - <bpmn:incoming>SequenceFlow_0t0wddg</bpmn:incoming> - <bpmn:incoming>SequenceFlow_05ovikm</bpmn:incoming> - <bpmn:linkEventDefinition name="CreateSliceProfile" /> - </bpmn:intermediateThrowEvent> - <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_0k54pph" name="Create Slice Profile"> - <bpmn:outgoing>SequenceFlow_0ct8yh4</bpmn:outgoing> - <bpmn:linkEventDefinition name="CreateSliceProfile" /> - </bpmn:intermediateCatchEvent> - <bpmn:sequenceFlow id="SequenceFlow_0ct8yh4" sourceRef="IntermediateThrowEvent_0k54pph" targetRef="ExclusiveGateway_00ufetn" /> - <bpmn:parallelGateway id="ExclusiveGateway_00ufetn"> - <bpmn:incoming>SequenceFlow_0ct8yh4</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1m68yca</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0k5iu2n</bpmn:outgoing> - </bpmn:parallelGateway> - <bpmn:sequenceFlow id="SequenceFlow_1m68yca" sourceRef="ExclusiveGateway_00ufetn" targetRef="Task_1tv7jy5" /> - <bpmn:sequenceFlow id="SequenceFlow_0k5iu2n" sourceRef="ExclusiveGateway_00ufetn" targetRef="Task_1en3luv" /> - <bpmn:callActivity id="CallActivity_1yh9tiq" name="Call DoAllocateNSSI(RAN)" calledElement="DoAllocateNSSI"> - <bpmn:extensionElements> - <camunda:in source="msoRequestId" target="msoRequestId" /> - <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:in source="nsstInput" target="nsstInput" /> - <camunda:in source="serviceProfile" target="serviceProfile" /> - <camunda:in source="sliceProfileTn" target="sliceProfileTn" /> - <camunda:in source="sliceProfileCn" target="sliceProfileCn" /> - <camunda:in source="sliceProfileAn" target="sliceProfileAn" /> - <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> - <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> - <camunda:in source="uuiRequest" target="uuiRequest" /> - <camunda:in source="nsiServiceInstanceId" target="nsiServiceInstanceId" /> - <camunda:in source="nsiServiceInstanceName" target="nsiServiceInstanceName" /> - <camunda:in source="nssiserviceModelInfo" target="nssiserviceModelInfo" /> - <camunda:in source="sliceTaskParams" target="sliceTaskParams" /> - <camunda:in source="taskId" target="CSSOT_taskId" /> - <camunda:in source="taskName" target="CSSOT_name" /> - <camunda:in source="taskStatus" target="CSSOT_status" /> - <camunda:in source="isManual" target="CSSOT_isManual" /> - <camunda:in source="isNSIOptionAvailable" target="isNSIOptionAvailable" /> - <camunda:in source="anSliceTaskInfo" target="sliceTaskInfo" /> - <camunda:out source="nssiAllocateResult" target="nssiAllocateResult" /> - <camunda:in source="AnAllocateNssiNbiRequest" target="nbiRequest" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0npsyye</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1xb5nx1</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_1hfjn79" sourceRef="Task_1tv7jy5" targetRef="ScriptTask_1r2li91" /> - <bpmn:callActivity id="CallActivity_1ixah3o" name="Call DoAllocateNSSI(Core)" calledElement="DoAllocateNSSI"> - <bpmn:extensionElements> - <camunda:in source="msoRequestId" target="msoRequestId" /> - <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:in source="nsstInput" target="nsstInput" /> - <camunda:in source="serviceProfile" target="serviceProfile" /> - <camunda:in source="sliceProfileTn" target="sliceProfileTn" /> - <camunda:in source="sliceProfileCn" target="sliceProfileCn" /> - <camunda:in source="sliceProfileAn" target="sliceProfileAn" /> - <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> - <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> - <camunda:in source="uuiRequest" target="uuiRequest" /> - <camunda:in source="nsiServiceInstanceId" target="nsiServiceInstanceId" /> - <camunda:in source="nsiServiceInstanceName" target="nsiServiceInstanceName" /> - <camunda:in source="nssiserviceModelInfo" target="nssiserviceModelInfo" /> - <camunda:in source="sliceTaskParams" target="sliceTaskParams" /> - <camunda:in source="taskId" target="CSSOT_taskId" /> - <camunda:in source="taskName" target="CSSOT_name" /> - <camunda:in source="taskStatus" target="CSSOT_status" /> - <camunda:in source="isManual" target="CSSOT_isManual" /> - <camunda:in source="isNSIOptionAvailable" target="isNSIOptionAvailable" /> - <camunda:in source="cnSliceTaskInfo" target="sliceTaskInfo" /> - <camunda:in source="domainType" target="domainType" /> - <camunda:out source="nssiAllocateResult" target="nssiAllocateResult" /> - <camunda:in source="CnAllocateNssiNbiRequest" target="nbiRequest" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0cwbtmr</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1l74seh</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_0f36cu2" sourceRef="Task_1en3luv" targetRef="Task_1g8n8iz" /> - <bpmn:sequenceFlow id="SequenceFlow_1xb5nx1" sourceRef="CallActivity_1yh9tiq" targetRef="ScriptTask_0mls87v" /> - <bpmn:parallelGateway id="ExclusiveGateway_19ru3hp"> - <bpmn:incoming>SequenceFlow_1gkb7iy</bpmn:incoming> - <bpmn:incoming>SequenceFlow_03zglrh</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0ax2c4p</bpmn:outgoing> - </bpmn:parallelGateway> - <bpmn:scriptTask id="ScriptTask_07sgklo" name="Update relationship between NSI and Service Profile" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_03ye8m4</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0t0wddg</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.updateRelationship(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_0t0wddg" sourceRef="ScriptTask_07sgklo" targetRef="IntermediateThrowEvent_0fx1nyj" /> - <bpmn:scriptTask id="ScriptTask_1r6kuwy" name="create relationship between nsi and SP" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1k3cspv</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_05ovikm</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.createRelationship(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_05ovikm" sourceRef="ScriptTask_1r6kuwy" targetRef="IntermediateThrowEvent_0fx1nyj" /> - <bpmn:scriptTask id="Task_1tv7jy5" name="Create RAN Slice Profile Instance" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1m68yca</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1hfjn79</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.createAnSliceProfileInstance(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_1r2li91" name="Create RAN Slice Profile" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1hfjn79</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0zbd2tq</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.createAnSliceProfile(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_0zbd2tq" sourceRef="ScriptTask_1r2li91" targetRef="ScriptTask_0s8vhha" /> - <bpmn:scriptTask id="Task_1en3luv" name="Create Core Slice Profile Instance" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0k5iu2n</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0f36cu2</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.createCnSliceProfileInstance(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="Task_1g8n8iz" name="Create Core Slice Profile" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0f36cu2</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1wffel4</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.createCnSliceProfile(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_0ax2c4p" sourceRef="ExclusiveGateway_19ru3hp" targetRef="EndEvent_02c8wsp" /> - <bpmn:scriptTask id="ScriptTask_0stnvp3" name="Create TN (BH) Slice Profile" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0paqrtx</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1d48cil</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.createTnBHSliceProfileInstance(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_1f4o46q" name="Create TN(BH) Slice Profile" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1d48cil</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_00dexhy</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.createTnBHSliceProfile(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:callActivity id="CallActivity_0b28wlb" name="Call DoAllocateNSSI(TN)" calledElement="DoAllocateNSSI"> - <bpmn:extensionElements> - <camunda:in source="msoRequestId" target="msoRequestId" /> - <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:in source="nsstInput" target="nsstInput" /> - <camunda:in source="serviceProfile" target="serviceProfile" /> - <camunda:in source="sliceProfileTn" target="sliceProfileTn" /> - <camunda:in source="sliceProfileCn" target="sliceProfileCn" /> - <camunda:in source="sliceProfileAn" target="sliceProfileAn" /> - <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> - <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> - <camunda:in source="uuiRequest" target="uuiRequest" /> - <camunda:in source="nsiServiceInstanceId" target="nsiServiceInstanceId" /> - <camunda:in source="nsiServiceInstanceName" target="nsiServiceInstanceName" /> - <camunda:in source="nssiserviceModelInfo" target="nssiserviceModelInfo" /> - <camunda:in source="sliceTaskParams" target="sliceTaskParams" /> - <camunda:in source="taskId" target="CSSOT_taskId" /> - <camunda:in source="taskName" target="CSSOT_name" /> - <camunda:in source="taskStatus" target="CSSOT_status" /> - <camunda:in source="isManual" target="CSSOT_isManual" /> - <camunda:in source="isNSIOptionAvailable" target="isNSIOptionAvailable" /> - <camunda:in source="tnBHSliceTaskInfo" target="sliceTaskInfo" /> - <camunda:out source="nssiAllocateResult" target="nssiAllocateResult" /> - <camunda:in source="TnBHAllocateNssiNbiRequest" target="nbiRequest" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_01isn2q</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1omynpt</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_1d48cil" sourceRef="ScriptTask_0stnvp3" targetRef="ScriptTask_1f4o46q" /> - <bpmn:sequenceFlow id="SequenceFlow_00dexhy" sourceRef="ScriptTask_1f4o46q" targetRef="ScriptTask_0ci5g6y" /> - <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_08wpvhs" name="Create Tn SliceProfile"> - <bpmn:outgoing>SequenceFlow_0paqrtx</bpmn:outgoing> - <bpmn:linkEventDefinition id="LinkEventDefinition_1beugxy" name="CreateTnSliceProfile" /> - </bpmn:intermediateCatchEvent> - <bpmn:sequenceFlow id="SequenceFlow_0paqrtx" sourceRef="IntermediateCatchEvent_08wpvhs" targetRef="ScriptTask_0stnvp3" /> - <bpmn:scriptTask id="ScriptTask_0sssiii" name="Update relationship between NSI and NSSI" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1omynpt</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_150xio1</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.prepareAllocateAnNssi(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_1me5mt6" name="Update relationship between Slice Profile and Service Profile" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_150xio1</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_040fu80</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.prepareAllocateAnNssi(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_0vrzjir" name="Update RelationShip between SliceProfile and NSSI" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_040fu80</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1uti8ls</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.prepareAllocateAnNssi(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_150xio1" sourceRef="ScriptTask_0sssiii" targetRef="ScriptTask_1me5mt6" /> - <bpmn:sequenceFlow id="SequenceFlow_040fu80" sourceRef="ScriptTask_1me5mt6" targetRef="ScriptTask_0vrzjir" /> - <bpmn:scriptTask id="ScriptTask_0mls87v" name="Update relationship between NSI and NSSI" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1xb5nx1</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0xx5bwa</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.prepareAllocateAnNssi(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_0xx5bwa" sourceRef="ScriptTask_0mls87v" targetRef="ScriptTask_0g8dgo6" /> - <bpmn:scriptTask id="ScriptTask_0g8dgo6" name="Update relationship between Slice Profile and Service Profile" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0xx5bwa</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1sckufj</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.prepareAllocateAnNssi(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_1sckufj" sourceRef="ScriptTask_0g8dgo6" targetRef="ScriptTask_0blxroa" /> - <bpmn:scriptTask id="ScriptTask_0blxroa" name="Update RelationShip between SliceProfile and NSSI" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1sckufj</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1gkb7iy</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.prepareAllocateAnNssi(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_1gkb7iy" sourceRef="ScriptTask_0blxroa" targetRef="ExclusiveGateway_19ru3hp" /> - <bpmn:scriptTask id="ScriptTask_0z9x5uh" name="Update relationship between NSI and NSSI" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1l74seh</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0jqxxjq</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.prepareAllocateAnNssi(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_09197ms" name="Update relationship between Slice Profile and Service Profile" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0jqxxjq</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_02qun80</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.prepareAllocateAnNssi(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_127nizg" name="Update RelationShip between SliceProfile and NSSI" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_02qun80</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_03zglrh</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.prepareAllocateAnNssi(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_1l74seh" sourceRef="CallActivity_1ixah3o" targetRef="ScriptTask_0z9x5uh" /> - <bpmn:sequenceFlow id="SequenceFlow_0jqxxjq" sourceRef="ScriptTask_0z9x5uh" targetRef="ScriptTask_09197ms" /> - <bpmn:sequenceFlow id="SequenceFlow_02qun80" sourceRef="ScriptTask_09197ms" targetRef="ScriptTask_127nizg" /> - <bpmn:sequenceFlow id="SequenceFlow_03zglrh" sourceRef="ScriptTask_127nizg" targetRef="ExclusiveGateway_19ru3hp" /> - <bpmn:sequenceFlow id="SequenceFlow_1omynpt" sourceRef="CallActivity_0b28wlb" targetRef="ScriptTask_0sssiii" /> - <bpmn:endEvent id="EndEvent_0elqlhv"> - <bpmn:incoming>SequenceFlow_1uti8ls</bpmn:incoming> - </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_1uti8ls" sourceRef="ScriptTask_0vrzjir" targetRef="EndEvent_0elqlhv" /> - <bpmn:intermediateThrowEvent id="EndEvent_02c8wsp" name="GoTo Create Tn SliceProfile"> - <bpmn:incoming>SequenceFlow_0ax2c4p</bpmn:incoming> - <bpmn:linkEventDefinition name="CreateTnSliceProfile" /> - </bpmn:intermediateThrowEvent> - <bpmn:scriptTask id="ScriptTask_0s8vhha" name="prepare Allocate An Nssi" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0zbd2tq</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0npsyye</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.prepareAllocateAnNssi(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_0npsyye" sourceRef="ScriptTask_0s8vhha" targetRef="CallActivity_1yh9tiq" /> - <bpmn:scriptTask id="ScriptTask_0z0ec5b" name="prepare Allocate An Nssi" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1wffel4</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0cwbtmr</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.prepareAllocateCnNssi(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_0cwbtmr" sourceRef="ScriptTask_0z0ec5b" targetRef="CallActivity_1ixah3o" /> - <bpmn:sequenceFlow id="SequenceFlow_1wffel4" sourceRef="Task_1g8n8iz" targetRef="ScriptTask_0z0ec5b" /> - <bpmn:scriptTask id="ScriptTask_0ci5g6y" name="prepare Allocate Tn-BH Nssi" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_00dexhy</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_01isn2q</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnsio = new DoAllocateNSIandNSSI() -dcnsio.prepareAllocateTnBHNssi(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_01isn2q" sourceRef="ScriptTask_0ci5g6y" targetRef="CallActivity_0b28wlb" /> - </bpmn:process> - <bpmn:message id="Message_1i10pf1" name="Message_2mc69tg" /> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSIandNSSIV2"> - <bpmndi:BPMNShape id="StartEvent_1ym3sha_di" bpmnElement="StartEvent_1ym3sha"> - <dc:Bounds x="138" y="122" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="144" y="165" width="25" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0xgfj7z_di" bpmnElement="SequenceFlow_0xgfj7z"> - <di:waypoint x="174" y="140" /> - <di:waypoint x="224" y="140" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0q0td74_di" bpmnElement="Task_027u6m6"> - <dc:Bounds x="224" y="100" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0qorxd9_di" bpmnElement="ScriptTask_0qorxd9"> - <dc:Bounds x="404" y="100" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_00aukg6_di" bpmnElement="SequenceFlow_00aukg6"> - <di:waypoint x="324" y="140" /> - <di:waypoint x="404" y="140" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_00pt1ek_di" bpmnElement="ExclusiveGateway_00pt1ek" isMarkerVisible="true"> - <dc:Bounds x="609" y="115" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="604" y="78" width="59" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1ggo6s5_di" bpmnElement="SequenceFlow_1ggo6s5"> - <di:waypoint x="504" y="140" /> - <di:waypoint x="609" y="140" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0c986i9_di" bpmnElement="SequenceFlow_0c986i9"> - <di:waypoint x="659" y="140" /> - <di:waypoint x="800" y="140" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1tizl6b_di" bpmnElement="ScriptTask_1tizl6b"> - <dc:Bounds x="800" y="100" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1k3cspv_di" bpmnElement="SequenceFlow_1k3cspv"> - <di:waypoint x="900" y="140" /> - <di:waypoint x="970" y="140" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_03ye8m4_di" bpmnElement="SequenceFlow_03ye8m4"> - <di:waypoint x="634" y="165" /> - <di:waypoint x="634" y="260" /> - <di:waypoint x="930" y="260" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="IntermediateThrowEvent_0zuxkap_di" bpmnElement="IntermediateThrowEvent_0fx1nyj"> - <dc:Bounds x="1412" y="122" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1388" y="92" width="90" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="IntermediateCatchEvent_1u7g80x_di" bpmnElement="IntermediateThrowEvent_0k54pph"> - <dc:Bounds x="138" y="502" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="126" y="545" width="60" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0ct8yh4_di" bpmnElement="SequenceFlow_0ct8yh4"> - <di:waypoint x="174" y="520" /> - <di:waypoint x="239" y="520" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ParallelGateway_0q9h79n_di" bpmnElement="ExclusiveGateway_00ufetn"> - <dc:Bounds x="239" y="495" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1m68yca_di" bpmnElement="SequenceFlow_1m68yca"> - <di:waypoint x="264" y="495" /> - <di:waypoint x="264" y="440" /> - <di:waypoint x="310" y="440" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0k5iu2n_di" bpmnElement="SequenceFlow_0k5iu2n"> - <di:waypoint x="264" y="545" /> - <di:waypoint x="264" y="630" /> - <di:waypoint x="310" y="630" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_1yh9tiq_di" bpmnElement="CallActivity_1yh9tiq"> - <dc:Bounds x="730" y="400" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1hfjn79_di" bpmnElement="SequenceFlow_1hfjn79"> - <di:waypoint x="410" y="440" /> - <di:waypoint x="440" y="440" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_1ixah3o_di" bpmnElement="CallActivity_1ixah3o"> - <dc:Bounds x="730" y="590" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0f36cu2_di" bpmnElement="SequenceFlow_0f36cu2"> - <di:waypoint x="410" y="630" /> - <di:waypoint x="440" y="630" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1xb5nx1_di" bpmnElement="SequenceFlow_1xb5nx1"> - <di:waypoint x="830" y="440" /> - <di:waypoint x="880" y="440" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ParallelGateway_15vgf7c_di" bpmnElement="ExclusiveGateway_19ru3hp"> - <dc:Bounds x="1325" y="505" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_07sgklo_di" bpmnElement="ScriptTask_07sgklo"> - <dc:Bounds x="930" y="220" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0t0wddg_di" bpmnElement="SequenceFlow_0t0wddg"> - <di:waypoint x="1030" y="260" /> - <di:waypoint x="1430" y="260" /> - <di:waypoint x="1430" y="158" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1r6kuwy_di" bpmnElement="ScriptTask_1r6kuwy"> - <dc:Bounds x="970" y="100" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_05ovikm_di" bpmnElement="SequenceFlow_05ovikm"> - <di:waypoint x="1070" y="140" /> - <di:waypoint x="1412" y="140" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_17cq3xj_di" bpmnElement="Task_1tv7jy5"> - <dc:Bounds x="310" y="400" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1r2li91_di" bpmnElement="ScriptTask_1r2li91"> - <dc:Bounds x="440" y="400" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0zbd2tq_di" bpmnElement="SequenceFlow_0zbd2tq"> - <di:waypoint x="540" y="440" /> - <di:waypoint x="584" y="440" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_01n5nmt_di" bpmnElement="Task_1en3luv"> - <dc:Bounds x="310" y="590" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0juh1xy_di" bpmnElement="Task_1g8n8iz"> - <dc:Bounds x="440" y="590" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0ax2c4p_di" bpmnElement="SequenceFlow_0ax2c4p"> - <di:waypoint x="1375" y="530" /> - <di:waypoint x="1412" y="530" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0stnvp3_di" bpmnElement="ScriptTask_0stnvp3"> - <dc:Bounds x="310" y="840" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1f4o46q_di" bpmnElement="ScriptTask_1f4o46q"> - <dc:Bounds x="440" y="840" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_0b28wlb_di" bpmnElement="CallActivity_0b28wlb"> - <dc:Bounds x="730" y="840" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1d48cil_di" bpmnElement="SequenceFlow_1d48cil"> - <di:waypoint x="410" y="880" /> - <di:waypoint x="440" y="880" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_00dexhy_di" bpmnElement="SequenceFlow_00dexhy"> - <di:waypoint x="540" y="880" /> - <di:waypoint x="584" y="880" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="IntermediateCatchEvent_08wpvhs_di" bpmnElement="IntermediateCatchEvent_08wpvhs"> - <dc:Bounds x="138" y="862" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="129" y="905" width="56" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0paqrtx_di" bpmnElement="SequenceFlow_0paqrtx"> - <di:waypoint x="174" y="880" /> - <di:waypoint x="310" y="880" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0sssiii_di" bpmnElement="ScriptTask_0sssiii"> - <dc:Bounds x="880" y="840" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1me5mt6_di" bpmnElement="ScriptTask_1me5mt6"> - <dc:Bounds x="1050" y="840" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0vrzjir_di" bpmnElement="ScriptTask_0vrzjir"> - <dc:Bounds x="1210" y="840" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_150xio1_di" bpmnElement="SequenceFlow_150xio1"> - <di:waypoint x="980" y="880" /> - <di:waypoint x="1050" y="880" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_040fu80_di" bpmnElement="SequenceFlow_040fu80"> - <di:waypoint x="1150" y="880" /> - <di:waypoint x="1210" y="880" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0mls87v_di" bpmnElement="ScriptTask_0mls87v"> - <dc:Bounds x="880" y="400" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0xx5bwa_di" bpmnElement="SequenceFlow_0xx5bwa"> - <di:waypoint x="980" y="440" /> - <di:waypoint x="1040" y="440" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0g8dgo6_di" bpmnElement="ScriptTask_0g8dgo6"> - <dc:Bounds x="1040" y="400" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1sckufj_di" bpmnElement="SequenceFlow_1sckufj"> - <di:waypoint x="1140" y="440" /> - <di:waypoint x="1190" y="440" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0blxroa_di" bpmnElement="ScriptTask_0blxroa"> - <dc:Bounds x="1190" y="400" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1gkb7iy_di" bpmnElement="SequenceFlow_1gkb7iy"> - <di:waypoint x="1290" y="440" /> - <di:waypoint x="1350" y="440" /> - <di:waypoint x="1350" y="505" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0z9x5uh_di" bpmnElement="ScriptTask_0z9x5uh"> - <dc:Bounds x="880" y="590" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_09197ms_di" bpmnElement="ScriptTask_09197ms"> - <dc:Bounds x="1040" y="590" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_127nizg_di" bpmnElement="ScriptTask_127nizg"> - <dc:Bounds x="1190" y="590" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1l74seh_di" bpmnElement="SequenceFlow_1l74seh"> - <di:waypoint x="830" y="630" /> - <di:waypoint x="880" y="630" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0jqxxjq_di" bpmnElement="SequenceFlow_0jqxxjq"> - <di:waypoint x="980" y="630" /> - <di:waypoint x="1040" y="630" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_02qun80_di" bpmnElement="SequenceFlow_02qun80"> - <di:waypoint x="1140" y="630" /> - <di:waypoint x="1190" y="630" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_03zglrh_di" bpmnElement="SequenceFlow_03zglrh"> - <di:waypoint x="1290" y="630" /> - <di:waypoint x="1350" y="630" /> - <di:waypoint x="1350" y="555" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1omynpt_di" bpmnElement="SequenceFlow_1omynpt"> - <di:waypoint x="830" y="880" /> - <di:waypoint x="880" y="880" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_0elqlhv_di" bpmnElement="EndEvent_0elqlhv"> - <dc:Bounds x="1412" y="862" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1uti8ls_di" bpmnElement="SequenceFlow_1uti8ls"> - <di:waypoint x="1310" y="880" /> - <di:waypoint x="1412" y="880" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="IntermediateThrowEvent_0gz4vi6_di" bpmnElement="EndEvent_02c8wsp"> - <dc:Bounds x="1412" y="512" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1392" y="555" width="79" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0s8vhha_di" bpmnElement="ScriptTask_0s8vhha"> - <dc:Bounds x="584" y="400" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0npsyye_di" bpmnElement="SequenceFlow_0npsyye"> - <di:waypoint x="684" y="440" /> - <di:waypoint x="730" y="440" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0z0ec5b_di" bpmnElement="ScriptTask_0z0ec5b"> - <dc:Bounds x="584" y="590" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0cwbtmr_di" bpmnElement="SequenceFlow_0cwbtmr"> - <di:waypoint x="684" y="630" /> - <di:waypoint x="730" y="630" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1wffel4_di" bpmnElement="SequenceFlow_1wffel4"> - <di:waypoint x="540" y="630" /> - <di:waypoint x="584" y="630" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0ci5g6y_di" bpmnElement="ScriptTask_0ci5g6y"> - <dc:Bounds x="584" y="840" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_01isn2q_di" bpmnElement="SequenceFlow_01isn2q"> - <di:waypoint x="684" y="880" /> - <di:waypoint x="730" y="880" /> - </bpmndi:BPMNEdge> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn index 445c9378af..58795056d4 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn @@ -1,144 +1,42 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> <bpmn:process id="DoAllocateNSSI" name="DoAllocateNSSI" isExecutable="true"> - <bpmn:startEvent id="allocatenssi_StartEvent" name="allocatenssi_StartEvent"> - <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> + <bpmn:startEvent id="StartEvent_0zs8ezi" name="Start"> + <bpmn:outgoing>SequenceFlow_07xkshs</bpmn:outgoing> </bpmn:startEvent> - <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="allocatenssi_StartEvent" targetRef="PreprocessIncomingRequest_task" /> - <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="CallActivity_09l7bhc" /> - <bpmn:scriptTask id="Task_09nzhwk" name="send create request to NSSMF adapter" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1h5bw41</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1uiz85h</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnssi = new DoAllocateNSSI() -dcnssi.sendCreateRequestNSSMF(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_0n2z0z7" name="Preprocess Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_07xkshs</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0h6mn7j</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcnssi = new DoAllocateNSSI() dcnssi.preProcessRequest(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="instantiate_NSTask" name="create slice profile" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0yie00u</bpmn:incoming> - <bpmn:incoming>SequenceFlow_0kzlbeh</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1r8qkgf</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_09pv5lu</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_07xkshs" sourceRef="StartEvent_0zs8ezi" targetRef="ScriptTask_0n2z0z7" /> + <bpmn:scriptTask id="ScriptTask_15a7mua" name="send request to NSSMF adapter" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0h6mn7j</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1wclf50</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcnssi = new DoAllocateNSSI() -dcnssi.createSliceProfile(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:endEvent id="EndEvent_1x6k78c"> - <bpmn:incoming>SequenceFlow_09pv5lu</bpmn:incoming> - </bpmn:endEvent> - <bpmn:scriptTask id="finishNSCreate_Task" name="Get NSSI progress" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1smrx3b</bpmn:incoming> - <bpmn:incoming>SequenceFlow_08xcz0v</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1lpxjvi</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnssi = new DoAllocateNSSI() -dcnssi.getNSSMFProgresss(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_1uiz85h" sourceRef="Task_09nzhwk" targetRef="ExclusiveGateway_0xz0xx2" /> - <bpmn:exclusiveGateway id="ExclusiveGateway_0b9d9l0" name="Is NSSI sharable?" default="SequenceFlow_0ueeeca"> - <bpmn:incoming>SequenceFlow_0dj0jvq</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1h5bw41</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0ueeeca</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_1h5bw41" name="No" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="Task_09nzhwk"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" ) == "create")}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:scriptTask id="ScriptTask_1ehyrsg" name="send update request to NSSMF adapter" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0ueeeca</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0xfhbqw</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnssi = new DoAllocateNSSI() -dcnssi.sendUpdateRequestNSSMF(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_0ueeeca" name="Yes" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="ScriptTask_1ehyrsg" /> - <bpmn:scriptTask id="ScriptTask_0o93dvp" name="Get NSST from Catalog DB" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_03bz6dh</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0dj0jvq</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnssi = new DoAllocateNSSI() -dcnssi.getNSSTInfo(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_0dj0jvq" sourceRef="ScriptTask_0o93dvp" targetRef="ExclusiveGateway_0b9d9l0" /> - <bpmn:sequenceFlow id="SequenceFlow_0xfhbqw" sourceRef="ScriptTask_1ehyrsg" targetRef="ExclusiveGateway_0xz0xx2" /> - <bpmn:scriptTask id="ScriptTask_1mv1npn" name="create NSSI and update relationship" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_07azk0i</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0yie00u</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnssi = new DoAllocateNSSI() -dcnssi.instantiateNSSIService(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_1lpxjvi" sourceRef="finishNSCreate_Task" targetRef="ScriptTask_1fvkcir" /> - <bpmn:callActivity id="CallActivity_09l7bhc" name="Call Decompose Service" calledElement="DecomposeService"> - <bpmn:extensionElements> - <camunda:in source="msoRequestId" target="msoRequestId" /> - <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> - <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> - <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> - <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_03bz6dh</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_03bz6dh" sourceRef="CallActivity_09l7bhc" targetRef="ScriptTask_0o93dvp" /> - <bpmn:exclusiveGateway id="ExclusiveGateway_1cgffe3" name="Completed"> - <bpmn:incoming>SequenceFlow_1xzq95u</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1kxwt7k</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0stj4cv</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:scriptTask id="ScriptTask_1escji6" name="Time delay" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0stj4cv</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_08xcz0v</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnssi = new DoAllocateNSSI() -dcnssi.timeDelay(execution)</bpmn:script> +dcnssi.sendCreateRequestNSSMF(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_08xcz0v" sourceRef="ScriptTask_1escji6" targetRef="finishNSCreate_Task" /> - <bpmn:exclusiveGateway id="ExclusiveGateway_0xz0xx2"> - <bpmn:incoming>SequenceFlow_0xfhbqw</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1uiz85h</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1smrx3b</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_1kxwt7k" name="true" sourceRef="ExclusiveGateway_1cgffe3" targetRef="ExclusiveGateway_09hoejm"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSSICreated" ) == true)}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_0stj4cv" name="false" sourceRef="ExclusiveGateway_1cgffe3" targetRef="ScriptTask_1escji6"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSSICreated" ) == false)}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1smrx3b" sourceRef="ExclusiveGateway_0xz0xx2" targetRef="finishNSCreate_Task" /> - <bpmn:sequenceFlow id="SequenceFlow_0yie00u" sourceRef="ScriptTask_1mv1npn" targetRef="instantiate_NSTask" /> - <bpmn:sequenceFlow id="SequenceFlow_09pv5lu" sourceRef="instantiate_NSTask" targetRef="EndEvent_1x6k78c" /> - <bpmn:exclusiveGateway id="ExclusiveGateway_09hoejm" name="Is NSSI sharable?" default="SequenceFlow_0c2o5zl2"> - <bpmn:incoming>SequenceFlow_1kxwt7k</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_07azk0i</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0c2o5zl2</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_07azk0i" sourceRef="ExclusiveGateway_09hoejm" targetRef="ScriptTask_1mv1npn"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" ) == "create")}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:scriptTask id="ScriptTask_0y2xmwi" name="Update relationship" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_14lzy4o</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0kzlbeh</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_1wclf50" sourceRef="ScriptTask_15a7mua" targetRef="Task_1ym947s" /> + <bpmn:sequenceFlow id="SequenceFlow_0h6mn7j" sourceRef="ScriptTask_0n2z0z7" targetRef="ScriptTask_15a7mua" /> + <bpmn:scriptTask id="Task_1ym947s" name="Query NSSI progress from adapter" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0gpgxw4</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1wclf50</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0p9gd2n</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcnssi = new DoAllocateNSSI() -dcnssi.updateRelationship(execution)</bpmn:script> +dcnssi.queryNSSIStatus(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_0c2o5zl2" sourceRef="ExclusiveGateway_09hoejm" targetRef="ScriptTask_0y2xmwi" /> - <bpmn:sequenceFlow id="SequenceFlow_0kzlbeh" sourceRef="ScriptTask_0y2xmwi" targetRef="instantiate_NSTask" /> - <bpmn:scriptTask id="ScriptTask_1fvkcir" name="Prepare Update Orchestration Task" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1lpxjvi</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0jjbci8</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_0ki1c4k" name="Prepare Update Orchestration Task" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0p9gd2n</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ozi7ed</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcnssi = new DoAllocateNSSI() dcnssi.prepareUpdateOrchestrationTask(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:callActivity id="CallActivity_11d0poc" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask"> + <bpmn:callActivity id="CallActivity_0knipxf" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask"> <bpmn:extensionElements> <camunda:out source="statusCode" target="CSSOT_dbResponseCode" /> <camunda:out source="response" target="CSSOT_dbResponse" /> @@ -150,215 +48,111 @@ dcnssi.prepareUpdateOrchestrationTask(execution)</bpmn:script> <camunda:in source="CSSOT_paramJson" target="paramJson" /> <camunda:in source="CSSOT_requestMethod" target="method" /> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0jjbci8</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1xzq95u</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_1ozi7ed</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0hgv9c5</bpmn:outgoing> </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_0jjbci8" sourceRef="ScriptTask_1fvkcir" targetRef="CallActivity_11d0poc" /> - <bpmn:sequenceFlow id="SequenceFlow_1xzq95u" sourceRef="CallActivity_11d0poc" targetRef="ExclusiveGateway_1cgffe3" /> - <bpmn:exclusiveGateway id="ExclusiveGateway_19tascw" name="Is NSI option available?" default="SequenceFlow_14lzy4o"> - <bpmn:incoming>SequenceFlow_0c2o5zl2</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_14lzy4o</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1r8qkgf</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_1ozi7ed" sourceRef="ScriptTask_0ki1c4k" targetRef="CallActivity_0knipxf" /> + <bpmn:sequenceFlow id="SequenceFlow_0p9gd2n" sourceRef="Task_1ym947s" targetRef="ScriptTask_0ki1c4k" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_11gv703" name="Completed" default="SequenceFlow_0y5jr25"> + <bpmn:incoming>SequenceFlow_0hgv9c5</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0y5jr25</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_170frn3</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_14lzy4o" sourceRef="ExclusiveGateway_19tascw" targetRef="ScriptTask_0y2xmwi" /> - <bpmn:sequenceFlow id="SequenceFlow_1r8qkgf" sourceRef="ExclusiveGateway_19tascw" targetRef="instantiate_NSTask"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSIOptionAvailable" ) == true)}</bpmn:conditionExpression> + <bpmn:sequenceFlow id="SequenceFlow_0hgv9c5" sourceRef="CallActivity_0knipxf" targetRef="ExclusiveGateway_11gv703" /> + <bpmn:scriptTask id="ScriptTask_1s7bt3s" name="Time delay" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0y5jr25</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0gpgxw4</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.timeDelay(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0y5jr25" name="false" sourceRef="ExclusiveGateway_11gv703" targetRef="ScriptTask_1s7bt3s" /> + <bpmn:sequenceFlow id="SequenceFlow_0gpgxw4" sourceRef="ScriptTask_1s7bt3s" targetRef="Task_1ym947s" /> + <bpmn:sequenceFlow id="SequenceFlow_170frn3" name="yes" sourceRef="ExclusiveGateway_11gv703" targetRef="IntermediateThrowEvent_10xe1qh"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("jobFinished" ) == true)}</bpmn:conditionExpression> </bpmn:sequenceFlow> + <bpmn:endEvent id="IntermediateThrowEvent_10xe1qh"> + <bpmn:incoming>SequenceFlow_170frn3</bpmn:incoming> + </bpmn:endEvent> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSSI"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="allocatenssi_StartEvent"> - <dc:Bounds x="175" y="509" width="36" height="36" /> + <bpmndi:BPMNShape id="StartEvent_0zs8ezi_di" bpmnElement="StartEvent_0zs8ezi"> + <dc:Bounds x="147" y="112" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="152" y="545" width="85" height="27" /> + <dc:Bounds x="152" y="153" width="25" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> - <di:waypoint x="211" y="527" /> - <di:waypoint x="269" y="527" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="266" y="123" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> - <di:waypoint x="369" y="527" /> - <di:waypoint x="444" y="527" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="436" y="108" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk"> - <dc:Bounds x="887" y="659" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> - <dc:Bounds x="269" y="487" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="instantiate_NSTask"> - <dc:Bounds x="2286" y="467" width="100" height="80" /> + <bpmndi:BPMNShape id="ScriptTask_0n2z0z7_di" bpmnElement="ScriptTask_0n2z0z7"> + <dc:Bounds x="270" y="90" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> - <dc:Bounds x="2482" y="489" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="412" y="617" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0xxyfku_di" bpmnElement="finishNSCreate_Task"> - <dc:Bounds x="1238" y="467" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1uiz85h_di" bpmnElement="SequenceFlow_1uiz85h"> - <di:waypoint x="987" y="699" /> - <di:waypoint x="1103" y="699" /> - <di:waypoint x="1103" y="532" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="631" y="108" width="0" height="12" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNEdge id="SequenceFlow_07xkshs_di" bpmnElement="SequenceFlow_07xkshs"> + <di:waypoint x="183" y="130" /> + <di:waypoint x="270" y="130" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_0b9d9l0_di" bpmnElement="ExclusiveGateway_0b9d9l0" isMarkerVisible="true"> - <dc:Bounds x="778" y="502" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="838" y="520" width="90" height="14" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNShape id="ScriptTask_15a7mua_di" bpmnElement="ScriptTask_15a7mua"> + <dc:Bounds x="460" y="90" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1h5bw41_di" bpmnElement="SequenceFlow_1h5bw41"> - <di:waypoint x="803" y="552" /> - <di:waypoint x="803" y="699" /> - <di:waypoint x="883" y="699" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="836" y="681" width="14" height="14" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNEdge id="SequenceFlow_1wclf50_di" bpmnElement="SequenceFlow_1wclf50"> + <di:waypoint x="560" y="130" /> + <di:waypoint x="670" y="130" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1ehyrsg_di" bpmnElement="ScriptTask_1ehyrsg"> - <dc:Bounds x="894" y="310" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0ueeeca_di" bpmnElement="SequenceFlow_0ueeeca"> - <di:waypoint x="803" y="502" /> - <di:waypoint x="803" y="350" /> - <di:waypoint x="894" y="350" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="831" y="358" width="19" height="14" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNEdge id="SequenceFlow_0h6mn7j_di" bpmnElement="SequenceFlow_0h6mn7j"> + <di:waypoint x="370" y="130" /> + <di:waypoint x="460" y="130" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0o93dvp_di" bpmnElement="ScriptTask_0o93dvp"> - <dc:Bounds x="618" y="487" width="100" height="80" /> + <bpmndi:BPMNShape id="ScriptTask_0bt5d96_di" bpmnElement="Task_1ym947s"> + <dc:Bounds x="670" y="90" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0dj0jvq_di" bpmnElement="SequenceFlow_0dj0jvq"> - <di:waypoint x="718" y="527" /> - <di:waypoint x="778" y="527" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0xfhbqw_di" bpmnElement="SequenceFlow_0xfhbqw"> - <di:waypoint x="994" y="350" /> - <di:waypoint x="1103" y="350" /> - <di:waypoint x="1103" y="482" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1mv1npn_di" bpmnElement="ScriptTask_1mv1npn"> - <dc:Bounds x="2089" y="467" width="100" height="80" /> + <bpmndi:BPMNShape id="ScriptTask_0ki1c4k_di" bpmnElement="ScriptTask_0ki1c4k"> + <dc:Bounds x="840" y="90" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1lpxjvi_di" bpmnElement="SequenceFlow_1lpxjvi"> - <di:waypoint x="1338" y="507" /> - <di:waypoint x="1411" y="507" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_09l7bhc_di" bpmnElement="CallActivity_09l7bhc"> - <dc:Bounds x="444" y="487" width="100" height="80" /> + <bpmndi:BPMNShape id="CallActivity_0knipxf_di" bpmnElement="CallActivity_0knipxf"> + <dc:Bounds x="1040" y="90" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_03bz6dh_di" bpmnElement="SequenceFlow_03bz6dh"> - <di:waypoint x="544" y="527" /> - <di:waypoint x="618" y="527" /> + <bpmndi:BPMNEdge id="SequenceFlow_1ozi7ed_di" bpmnElement="SequenceFlow_1ozi7ed"> + <di:waypoint x="940" y="130" /> + <di:waypoint x="1040" y="130" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0p9gd2n_di" bpmnElement="SequenceFlow_0p9gd2n"> + <di:waypoint x="770" y="130" /> + <di:waypoint x="840" y="130" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_1cgffe3_di" bpmnElement="ExclusiveGateway_1cgffe3" isMarkerVisible="true"> - <dc:Bounds x="1773" y="482" width="50" height="50" /> + <bpmndi:BPMNShape id="ExclusiveGateway_11gv703_di" bpmnElement="ExclusiveGateway_11gv703" isMarkerVisible="true"> + <dc:Bounds x="1245" y="105" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1771" y="458" width="54" height="14" /> + <dc:Bounds x="1243" y="81" width="54" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1escji6_di" bpmnElement="ScriptTask_1escji6"> - <dc:Bounds x="1748" y="624" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_08xcz0v_di" bpmnElement="SequenceFlow_08xcz0v"> - <di:waypoint x="1748" y="664" /> - <di:waypoint x="1288" y="664" /> - <di:waypoint x="1288" y="547" /> + <bpmndi:BPMNEdge id="SequenceFlow_0hgv9c5_di" bpmnElement="SequenceFlow_0hgv9c5"> + <di:waypoint x="1140" y="130" /> + <di:waypoint x="1245" y="130" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_0xz0xx2_di" bpmnElement="ExclusiveGateway_0xz0xx2" isMarkerVisible="true"> - <dc:Bounds x="1078" y="482" width="50" height="50" /> + <bpmndi:BPMNShape id="ScriptTask_1s7bt3s_di" bpmnElement="ScriptTask_1s7bt3s"> + <dc:Bounds x="1220" y="230" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1kxwt7k_di" bpmnElement="SequenceFlow_1kxwt7k"> - <di:waypoint x="1823" y="507" /> - <di:waypoint x="1928" y="507" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1866" y="489" width="19" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0stj4cv_di" bpmnElement="SequenceFlow_0stj4cv"> - <di:waypoint x="1798" y="532" /> - <di:waypoint x="1798" y="624" /> + <bpmndi:BPMNEdge id="SequenceFlow_0y5jr25_di" bpmnElement="SequenceFlow_0y5jr25"> + <di:waypoint x="1270" y="155" /> + <di:waypoint x="1270" y="230" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1801" y="575" width="24" height="14" /> + <dc:Bounds x="1251" y="195" width="23" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1smrx3b_di" bpmnElement="SequenceFlow_1smrx3b"> - <di:waypoint x="1128" y="507" /> - <di:waypoint x="1238" y="507" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0yie00u_di" bpmnElement="SequenceFlow_0yie00u"> - <di:waypoint x="2189" y="507" /> - <di:waypoint x="2286" y="507" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_09pv5lu_di" bpmnElement="SequenceFlow_09pv5lu"> - <di:waypoint x="2386" y="507" /> - <di:waypoint x="2482" y="507" /> + <bpmndi:BPMNEdge id="SequenceFlow_0gpgxw4_di" bpmnElement="SequenceFlow_0gpgxw4"> + <di:waypoint x="1220" y="270" /> + <di:waypoint x="720" y="270" /> + <di:waypoint x="720" y="170" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_09hoejm_di" bpmnElement="ExclusiveGateway_09hoejm" isMarkerVisible="true"> - <dc:Bounds x="1928" y="482" width="50" height="50" /> + <bpmndi:BPMNEdge id="SequenceFlow_170frn3_di" bpmnElement="SequenceFlow_170frn3"> + <di:waypoint x="1295" y="130" /> + <di:waypoint x="1372" y="130" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1908" y="542" width="90" height="14" /> + <dc:Bounds x="1325" y="112" width="17" height="14" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_07azk0i_di" bpmnElement="SequenceFlow_07azk0i"> - <di:waypoint x="1978" y="507" /> - <di:waypoint x="2089" y="507" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0y2xmwi_di" bpmnElement="ScriptTask_0y2xmwi"> - <dc:Bounds x="2089" y="310" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0kzlbeh_di" bpmnElement="SequenceFlow_0kzlbeh"> - <di:waypoint x="2189" y="350" /> - <di:waypoint x="2336" y="350" /> - <di:waypoint x="2336" y="467" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1fvkcir_di" bpmnElement="ScriptTask_1fvkcir"> - <dc:Bounds x="1411" y="467" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_11d0poc_di" bpmnElement="CallActivity_11d0poc"> - <dc:Bounds x="1587" y="467" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0jjbci8_di" bpmnElement="SequenceFlow_0jjbci8"> - <di:waypoint x="1511" y="507" /> - <di:waypoint x="1587" y="507" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1xzq95u_di" bpmnElement="SequenceFlow_1xzq95u"> - <di:waypoint x="1687" y="507" /> - <di:waypoint x="1773" y="507" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_19tascw_di" bpmnElement="ExclusiveGateway_19tascw" isMarkerVisible="true"> - <dc:Bounds x="1928" y="325" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1854" y="337" width="64" height="27" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNShape id="EndEvent_1q1vntz_di" bpmnElement="IntermediateThrowEvent_10xe1qh"> + <dc:Bounds x="1372" y="112" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0c2o5zl_di" bpmnElement="SequenceFlow_0c2o5zl2"> - <di:waypoint x="1953" y="482" /> - <di:waypoint x="1953" y="375" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_14lzy4o_di" bpmnElement="SequenceFlow_14lzy4o"> - <di:waypoint x="1978" y="350" /> - <di:waypoint x="2089" y="350" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1r8qkgf_di" bpmnElement="SequenceFlow_1r8qkgf"> - <di:waypoint x="1953" y="325" /> - <di:waypoint x="1953" y="205" /> - <di:waypoint x="2336" y="205" /> - <di:waypoint x="2336" y="465" /> - </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions> +</bpmn:definitions>
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSIV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSIV2.bpmn deleted file mode 100644 index bcb48a60e6..0000000000 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSIV2.bpmn +++ /dev/null @@ -1,233 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> - <bpmn:process id="DoAllocateNSSIV2" name="DoAllocateNSSIV2" isExecutable="true"> - <bpmn:startEvent id="StartEvent_0zs8ezi" name="Start"> - <bpmn:outgoing>SequenceFlow_07xkshs</bpmn:outgoing> - </bpmn:startEvent> - <bpmn:scriptTask id="ScriptTask_0n2z0z7" name="Preprocess Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_07xkshs</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0h6mn7j</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnssi = new DoAllocateNSSI() -dcnssi.preProcessRequest(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_07xkshs" sourceRef="StartEvent_0zs8ezi" targetRef="ScriptTask_0n2z0z7" /> - <bpmn:scriptTask id="ScriptTask_15a7mua" name="send allocate request to NSSMF adapter" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1iw5oad</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1wclf50</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnssi = new DoAllocateNSSI() -dcnssi.sendCreateRequestNSSMF(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_11w6bb3" name="Is NSSI sharable?"> - <bpmn:incoming>SequenceFlow_0ib27f2</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1iw5oad</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0haiyzv</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:scriptTask id="ScriptTask_16zhp9e" name="send modify request to NSSMF adapter" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0haiyzv</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1ellzst</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnssi = new DoAllocateNSSI() -dcnssi.sendUpdateRequestNSSMF(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_0jx00mv"> - <bpmn:incoming>SequenceFlow_1wclf50</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1ellzst</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0ejdefw</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_1iw5oad" name="No" sourceRef="ExclusiveGateway_11w6bb3" targetRef="ScriptTask_15a7mua"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" ) == "create")}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1wclf50" sourceRef="ScriptTask_15a7mua" targetRef="ExclusiveGateway_0jx00mv" /> - <bpmn:sequenceFlow id="SequenceFlow_0haiyzv" name="yes" sourceRef="ExclusiveGateway_11w6bb3" targetRef="ScriptTask_16zhp9e"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" ) == "update")}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1ellzst" sourceRef="ScriptTask_16zhp9e" targetRef="ExclusiveGateway_0jx00mv" /> - <bpmn:sequenceFlow id="SequenceFlow_0h6mn7j" sourceRef="ScriptTask_0n2z0z7" targetRef="ScriptTask_1e7tchy" /> - <bpmn:scriptTask id="ScriptTask_1e7tchy" name="Prepare NSSI Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0h6mn7j</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0ib27f2</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnssi = new DoAllocateNSSI() -dcnssi.getNSSTInfo(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_0ib27f2" sourceRef="ScriptTask_1e7tchy" targetRef="ExclusiveGateway_11w6bb3" /> - <bpmn:sequenceFlow id="SequenceFlow_0ejdefw" sourceRef="ExclusiveGateway_0jx00mv" targetRef="Task_1ym947s" /> - <bpmn:scriptTask id="Task_1ym947s" name="Query NSSI progress from adapter" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0ejdefw</bpmn:incoming> - <bpmn:incoming>SequenceFlow_0gpgxw4</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0p9gd2n</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnssi = new DoAllocateNSSI() -dcnssi.queryNSSIStatus(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_0ki1c4k" name="Prepare Update Orchestration Task" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0p9gd2n</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1ozi7ed</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnssi = new DoAllocateNSSI() -dcnssi.prepareUpdateOrchestrationTask(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:callActivity id="CallActivity_0knipxf" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask"> - <bpmn:extensionElements> - <camunda:out source="statusCode" target="CSSOT_dbResponseCode" /> - <camunda:out source="response" target="CSSOT_dbResponse" /> - <camunda:in source="CSSOT_taskId" target="taskId" /> - <camunda:in source="msoRequestId" target="requestId" /> - <camunda:in source="CSSOT_name" target="taskName" /> - <camunda:in source="CSSOT_status" target="taskStatus" /> - <camunda:in source="CSSOT_isManual" target="isManual" /> - <camunda:in source="CSSOT_paramJson" target="paramJson" /> - <camunda:in source="CSSOT_requestMethod" target="method" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1ozi7ed</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0hgv9c5</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_1ozi7ed" sourceRef="ScriptTask_0ki1c4k" targetRef="CallActivity_0knipxf" /> - <bpmn:sequenceFlow id="SequenceFlow_0p9gd2n" sourceRef="Task_1ym947s" targetRef="ScriptTask_0ki1c4k" /> - <bpmn:exclusiveGateway id="ExclusiveGateway_11gv703" name="Completed"> - <bpmn:incoming>SequenceFlow_0hgv9c5</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0y5jr25</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_170frn3</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_0hgv9c5" sourceRef="CallActivity_0knipxf" targetRef="ExclusiveGateway_11gv703" /> - <bpmn:scriptTask id="ScriptTask_1s7bt3s" name="Time delay" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0y5jr25</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0gpgxw4</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcnssi = new DoAllocateNSSI() -dcnssi.timeDelay(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_0y5jr25" name="false" sourceRef="ExclusiveGateway_11gv703" targetRef="ScriptTask_1s7bt3s" /> - <bpmn:sequenceFlow id="SequenceFlow_0gpgxw4" sourceRef="ScriptTask_1s7bt3s" targetRef="Task_1ym947s" /> - <bpmn:sequenceFlow id="SequenceFlow_170frn3" sourceRef="ExclusiveGateway_11gv703" targetRef="IntermediateThrowEvent_10xe1qh"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" ) == "update")}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:endEvent id="IntermediateThrowEvent_10xe1qh"> - <bpmn:incoming>SequenceFlow_170frn3</bpmn:incoming> - </bpmn:endEvent> - </bpmn:process> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSSIV2"> - <bpmndi:BPMNShape id="StartEvent_0zs8ezi_di" bpmnElement="StartEvent_0zs8ezi"> - <dc:Bounds x="147" y="272" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="152" y="313" width="25" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0n2z0z7_di" bpmnElement="ScriptTask_0n2z0z7"> - <dc:Bounds x="235" y="250" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_07xkshs_di" bpmnElement="SequenceFlow_07xkshs"> - <di:waypoint x="183" y="290" /> - <di:waypoint x="235" y="290" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_15a7mua_di" bpmnElement="ScriptTask_15a7mua"> - <dc:Bounds x="660" y="430" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_11w6bb3_di" bpmnElement="ExclusiveGateway_11w6bb3" isMarkerVisible="true"> - <dc:Bounds x="591" y="265" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="645" y="283" width="89" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_16zhp9e_di" bpmnElement="ScriptTask_16zhp9e"> - <dc:Bounds x="660" y="81" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0jx00mv_di" bpmnElement="ExclusiveGateway_0jx00mv" isMarkerVisible="true"> - <dc:Bounds x="785" y="265" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1iw5oad_di" bpmnElement="SequenceFlow_1iw5oad"> - <di:waypoint x="616" y="315" /> - <di:waypoint x="616" y="470" /> - <di:waypoint x="660" y="470" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="631" y="393" width="15" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1wclf50_di" bpmnElement="SequenceFlow_1wclf50"> - <di:waypoint x="760" y="470" /> - <di:waypoint x="810" y="470" /> - <di:waypoint x="810" y="315" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0haiyzv_di" bpmnElement="SequenceFlow_0haiyzv"> - <di:waypoint x="616" y="265" /> - <di:waypoint x="616" y="121" /> - <di:waypoint x="660" y="121" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="635" y="173" width="17" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1ellzst_di" bpmnElement="SequenceFlow_1ellzst"> - <di:waypoint x="760" y="121" /> - <di:waypoint x="810" y="121" /> - <di:waypoint x="810" y="265" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0h6mn7j_di" bpmnElement="SequenceFlow_0h6mn7j"> - <di:waypoint x="335" y="290" /> - <di:waypoint x="410" y="290" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1e7tchy_di" bpmnElement="ScriptTask_1e7tchy"> - <dc:Bounds x="410" y="250" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0ib27f2_di" bpmnElement="SequenceFlow_0ib27f2"> - <di:waypoint x="510" y="290" /> - <di:waypoint x="591" y="290" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0ejdefw_di" bpmnElement="SequenceFlow_0ejdefw"> - <di:waypoint x="835" y="290" /> - <di:waypoint x="910" y="290" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0bt5d96_di" bpmnElement="Task_1ym947s"> - <dc:Bounds x="910" y="250" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0ki1c4k_di" bpmnElement="ScriptTask_0ki1c4k"> - <dc:Bounds x="1090" y="250" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_0knipxf_di" bpmnElement="CallActivity_0knipxf"> - <dc:Bounds x="1238" y="250" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1ozi7ed_di" bpmnElement="SequenceFlow_1ozi7ed"> - <di:waypoint x="1190" y="290" /> - <di:waypoint x="1238" y="290" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0p9gd2n_di" bpmnElement="SequenceFlow_0p9gd2n"> - <di:waypoint x="1010" y="290" /> - <di:waypoint x="1090" y="290" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_11gv703_di" bpmnElement="ExclusiveGateway_11gv703" isMarkerVisible="true"> - <dc:Bounds x="1395" y="265" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1393" y="241" width="54" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0hgv9c5_di" bpmnElement="SequenceFlow_0hgv9c5"> - <di:waypoint x="1338" y="290" /> - <di:waypoint x="1395" y="290" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1s7bt3s_di" bpmnElement="ScriptTask_1s7bt3s"> - <dc:Bounds x="1370" y="390" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0y5jr25_di" bpmnElement="SequenceFlow_0y5jr25"> - <di:waypoint x="1420" y="315" /> - <di:waypoint x="1420" y="390" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1401" y="355" width="23" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0gpgxw4_di" bpmnElement="SequenceFlow_0gpgxw4"> - <di:waypoint x="1370" y="430" /> - <di:waypoint x="960" y="430" /> - <di:waypoint x="960" y="330" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_170frn3_di" bpmnElement="SequenceFlow_170frn3"> - <di:waypoint x="1445" y="290" /> - <di:waypoint x="1522" y="290" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_1q1vntz_di" bpmnElement="IntermediateThrowEvent_10xe1qh"> - <dc:Bounds x="1522" y="272" width="36" height="36" /> - </bpmndi:BPMNShape> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn index 894f7d39dc..9d47888b14 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> <bpmn:process id="DoCreateSliceServiceInstance" name="DoCreateSliceServiceInstance" isExecutable="true"> <bpmn:startEvent id="createNS_StartEvent" name="createNS_StartEvent"> <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> </bpmn:startEvent> <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="createNS_StartEvent" targetRef="PreprocessIncomingRequest_task" /> - <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="instantiate_NSTask" /> + <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="ScriptTask_1g378se" /> <bpmn:scriptTask id="Task_09nzhwk" name="Create service profile" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_17u69c4</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1uiz85h</bpmn:outgoing> @@ -21,7 +21,7 @@ def dcsi = new DoCreateSliceServiceInstance() dcsi.preProcessRequest(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:scriptTask id="instantiate_NSTask" name="create Slice Service in AAI" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming> + <bpmn:incoming>SequenceFlow_11gmz7e</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0g5bwvl</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DoCreateSliceServiceInstance() @@ -40,6 +40,27 @@ def dcsi = new DoCreateSliceServiceInstance() dcsi.createAllottedResource(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_17u69c4" sourceRef="ScriptTask_18rzwzb" targetRef="Task_09nzhwk" /> + <bpmn:scriptTask id="ScriptTask_1g378se" name="Prepare ServiceProfile Decompose Service " scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1wafqwa</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi= new CreateSliceService() +dcsi.prepareDecomposeService(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_0svmkxh" name="Call Decompose Service" calledElement="DecomposeService"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:out source="serviceDecomposition" target="serviceProfileDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1wafqwa</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_11gmz7e</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1wafqwa" sourceRef="ScriptTask_1g378se" targetRef="CallActivity_0svmkxh" /> + <bpmn:sequenceFlow id="SequenceFlow_11gmz7e" sourceRef="CallActivity_0svmkxh" targetRef="instantiate_NSTask" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateSliceServiceInstance"> @@ -60,44 +81,58 @@ dcsi.createAllottedResource(execution)</bpmn:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> <di:waypoint x="393" y="129" /> - <di:waypoint x="474" y="129" /> + <di:waypoint x="440" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="436" y="108" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk"> - <dc:Bounds x="851" y="89" width="100" height="80" /> + <dc:Bounds x="1120" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> <dc:Bounds x="293" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="instantiate_NSTask"> - <dc:Bounds x="474" y="89" width="100" height="80" /> + <dc:Bounds x="790" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> - <dc:Bounds x="1049" y="111" width="36" height="36" /> + <dc:Bounds x="1292" y="111" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="412" y="617" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1uiz85h_di" bpmnElement="SequenceFlow_1uiz85h"> - <di:waypoint x="951" y="129" /> - <di:waypoint x="1049" y="129" /> + <di:waypoint x="1220" y="129" /> + <di:waypoint x="1292" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="631" y="108" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0g5bwvl_di" bpmnElement="SequenceFlow_0g5bwvl"> - <di:waypoint x="574" y="129" /> - <di:waypoint x="658" y="129" /> + <di:waypoint x="890" y="129" /> + <di:waypoint x="960" y="129" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_18rzwzb_di" bpmnElement="ScriptTask_18rzwzb"> - <dc:Bounds x="658" y="89" width="100" height="80" /> + <dc:Bounds x="960" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_17u69c4_di" bpmnElement="SequenceFlow_17u69c4"> - <di:waypoint x="758" y="129" /> - <di:waypoint x="851" y="129" /> + <di:waypoint x="1060" y="129" /> + <di:waypoint x="1120" y="129" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1g378se_di" bpmnElement="ScriptTask_1g378se"> + <dc:Bounds x="440" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0svmkxh_di" bpmnElement="CallActivity_0svmkxh"> + <dc:Bounds x="610" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1wafqwa_di" bpmnElement="SequenceFlow_1wafqwa"> + <di:waypoint x="540" y="129" /> + <di:waypoint x="610" y="129" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_11gmz7e_di" bpmnElement="SequenceFlow_11gmz7e"> + <di:waypoint x="710" y="129" /> + <di:waypoint x="790" y="129" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions> +</bpmn:definitions>
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn index 3ed1999d9a..b16ceee0d3 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn @@ -1,117 +1,144 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> <bpmn:process id="DoCreateSliceServiceOption" name="DoCreateSliceServiceOption" isExecutable="true"> - <bpmn:startEvent id="createNS_StartEvent" name="createOption_StartEvent"> - <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> - </bpmn:startEvent> - <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="createNS_StartEvent" targetRef="PreprocessIncomingRequest_task" /> - <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="Task_09nzhwk" /> - <bpmn:scriptTask id="Task_09nzhwk" name="Prepare OOF Select NSI options request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming> - <bpmn:outgoing>Flow_15c2jcx</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_11rb2ju" name="prepare NST decomposition" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_067xdx1</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1kzy63m</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcso = new DoCreateSliceServiceOption() -dcso.prepareSelectNSIRequest(execution)</bpmn:script> +dcso.prepareDecomposeNST(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing> + <bpmn:callActivity id="CallActivity_0c567r4" name="Call Decompose Service" calledElement="DecomposeService"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="nstServiceModelInfo" target="serviceModelInfo" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:out source="serviceDecomposition" target="nstServiceDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1kzy63m</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1t317y2</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_0z0dwk2" name="Process Decomposition NST" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1t317y2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0t4gmix</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.processDecompositionNST(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1kzy63m" sourceRef="ScriptTask_11rb2ju" targetRef="CallActivity_0c567r4" /> + <bpmn:sequenceFlow id="SequenceFlow_1t317y2" sourceRef="CallActivity_0c567r4" targetRef="ScriptTask_0z0dwk2" /> + <bpmn:callActivity id="CallActivity_0tzazs0" name="Handle NSSI Selection OOF request" calledElement="DoHandleOofRequest"> + <bpmn:extensionElements> + <camunda:in source="nssiSelectionUrl" target="apiPath" /> + <camunda:in source="nssiSelection_correlator" target="correlator" /> + <camunda:in source="nssiSelection_messageType" target="messageType" /> + <camunda:in source="nssiSelection_timeout" target="timeout" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:out source="asyncCallbackResponse" target="nssiSelection_oofResponse" /> + <camunda:in source="nssiSelection_oofRequest" target="oofRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0abqxa1</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1tqg26p</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:startEvent id="StartEvent_0mwlirs" name="Start"> + <bpmn:outgoing>SequenceFlow_1fuwy35</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:scriptTask id="ScriptTask_0w34e57" name="Preprocess Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1fuwy35</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_067xdx1</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcso = new DoCreateSliceServiceOption() dcso.preProcessRequest(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:endEvent id="EndEvent_1x6k78c"> - <bpmn:incoming>SequenceFlow_1ap8kar</bpmn:incoming> - <bpmn:incoming>SequenceFlow_0hnsycl</bpmn:incoming> - </bpmn:endEvent> - <bpmn:scriptTask id="ScriptTask_0kecvrc" name="prepare list of NSST associated with NST" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0wy6oag</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0lt2cdo</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_1fuwy35" sourceRef="StartEvent_0mwlirs" targetRef="ScriptTask_0w34e57" /> + <bpmn:scriptTask id="CallActivity_1vzxvna" name="TN NSSMF supports NSSI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_05250mp</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_14rhmx9</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcso = new DoCreateSliceServiceOption() -dcso.prepareNSSTlistfromNST(execution)</bpmn:script> +dcso.getNSSISelectionCap4TN(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_1mlytov" name="send request to OOF for NSSI options" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0a5f5y6</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1r9n9ef</bpmn:outgoing> + <bpmn:scriptTask id="CallActivity_0melx8d" name="CN NSSMF supports NSSI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0euwvgf</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_103oxyw</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcso = new DoCreateSliceServiceOption() -dcso.getNSSTOption(execution)</bpmn:script> +dcso.getNSSISelectionCap4CN(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_1y1wzs9"> - <bpmn:incoming>SequenceFlow_0lt2cdo</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1r9n9ef</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1ap8kar</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0m2mr0o</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_1ap8kar" sourceRef="ExclusiveGateway_1y1wzs9" targetRef="EndEvent_1x6k78c"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isMoreNSSTtoProcess" ) == false)}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_0lt2cdo" sourceRef="ScriptTask_0kecvrc" targetRef="ExclusiveGateway_1y1wzs9" /> - <bpmn:sequenceFlow id="SequenceFlow_0m2mr0o" sourceRef="ExclusiveGateway_1y1wzs9" targetRef="ScriptTask_1e5ysya"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isMoreNSSTtoProcess" ) == true)}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1r9n9ef" sourceRef="ScriptTask_1mlytov" targetRef="ExclusiveGateway_1y1wzs9" /> - <bpmn:scriptTask id="ScriptTask_1e5ysya" name="prepare NSST decomposition" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0m2mr0o</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_016vi3s</bpmn:outgoing> + <bpmn:scriptTask id="CallActivity_0otry7e" name="AN NSSMF supports NSSI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0il5j01</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0aasemn</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcso = new DoCreateSliceServiceOption() -dcso.prepareNSSTDecompose(execution)</bpmn:script> +dcso.getNSSISelectionCap4AN(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_016vi3s" sourceRef="ScriptTask_1e5ysya" targetRef="CallActivity_1rfnoe2" /> - <bpmn:callActivity id="CallActivity_1rfnoe2" name="Call Decompose Service" calledElement="DecomposeService"> - <bpmn:extensionElements> - <camunda:in source="msoRequestId" target="msoRequestId" /> - <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> - <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> - <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> - <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_016vi3s</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0a5f5y6</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_0a5f5y6" sourceRef="CallActivity_1rfnoe2" targetRef="ScriptTask_1mlytov" /> - <bpmn:exclusiveGateway id="ExclusiveGateway_1skfk7w" default="SequenceFlow_0wy6oag"> - <bpmn:incoming>SequenceFlow_0d774n5</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0wy6oag</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0hnsycl</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_0wy6oag" sourceRef="ExclusiveGateway_1skfk7w" targetRef="ScriptTask_0kecvrc" /> - <bpmn:sequenceFlow id="SequenceFlow_0hnsycl" sourceRef="ExclusiveGateway_1skfk7w" targetRef="EndEvent_1x6k78c"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSISuggested" ) == true)}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:scriptTask id="ScriptTask_1umbyel" name="prepare NST decomposition" scriptFormat="groovy"> - <bpmn:incoming>Flow_07ustqm</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0piifl1</bpmn:outgoing> + <bpmn:scriptTask id="Task_1m9qoo3" name="Prepare NSSI Selection" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_126j77n</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0abqxa1</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcso = new DoCreateSliceServiceOption() -dcso.prepareNSTDecompose(execution)</bpmn:script> +dcso.preNSSIRequest(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_0piifl1" sourceRef="ScriptTask_1umbyel" targetRef="CallActivity_0ly8xiw" /> - <bpmn:callActivity id="CallActivity_0ly8xiw" name="Call Decompose Service" calledElement="DecomposeService"> + <bpmn:scriptTask id="Task_00nfg5x" name="Process NSST Solutions" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1tqg26p</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ezi1oi</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.processNSSIResp(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_12sydez" name="prepare NSST decomposition" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0zglfyw</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0t4gmix</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_12pvazb</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.prepareDecomposeNSST(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_0hfiogq" name="Call Decompose Service" calledElement="DecomposeService"> <bpmn:extensionElements> <camunda:in source="msoRequestId" target="msoRequestId" /> <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> - <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="nsstServiceModelInfo" target="serviceModelInfo" /> <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> - <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:out source="serviceDecomposition" target="nsstServiceDecomposition" /> <camunda:out source="WorkflowException" target="WorkflowException" /> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0piifl1</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_086yszq</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_12pvazb</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1inonqp</bpmn:outgoing> </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_086yszq" sourceRef="CallActivity_0ly8xiw" targetRef="Task_1k2ypj0" /> - <bpmn:sequenceFlow id="SequenceFlow_0d774n5" sourceRef="Task_1k2ypj0" targetRef="ExclusiveGateway_1skfk7w" /> - <bpmn:scriptTask id="Task_1k2ypj0" name="Process Decomposition" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_086yszq</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0d774n5</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_14j28c2" name="Process NSST Decomposition" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1inonqp</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_049glzl</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0zglfyw</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.processDecompositionNSST(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_12pvazb" sourceRef="ScriptTask_12sydez" targetRef="CallActivity_0hfiogq" /> + <bpmn:sequenceFlow id="SequenceFlow_1inonqp" sourceRef="CallActivity_0hfiogq" targetRef="ScriptTask_14j28c2" /> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1bxdugq" name="Goto Select NSSI "> + <bpmn:incoming>SequenceFlow_16akt81</bpmn:incoming> + <bpmn:linkEventDefinition id="LinkEventDefinition_1id21k7" name="SelectNSSI" /> + </bpmn:intermediateThrowEvent> + <bpmn:sequenceFlow id="SequenceFlow_067xdx1" sourceRef="ScriptTask_0w34e57" targetRef="ScriptTask_11rb2ju" /> + <bpmn:sequenceFlow id="SequenceFlow_049glzl" sourceRef="ScriptTask_14j28c2" targetRef="Task_1xqjkqx"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nsstHandleContinue" ) == "false")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0zglfyw" sourceRef="ScriptTask_14j28c2" targetRef="ScriptTask_12sydez"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nsstHandleContinue" ) == "true")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0t4gmix" sourceRef="ScriptTask_0z0dwk2" targetRef="ScriptTask_12sydez" /> + <bpmn:scriptTask id="Task_1xqjkqx" name="handle Nsst By Type " scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_049glzl</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_16akt81</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcso = new DoCreateSliceServiceOption() -dcso.processDecomposition(execution)</bpmn:script> +dcso.handleNsstByType(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:callActivity id="Activity_0dlr4ra" name="Handle NSI Selection OOF request" calledElement="DoHandleOofRequest"> + <bpmn:sequenceFlow id="SequenceFlow_16akt81" sourceRef="Task_1xqjkqx" targetRef="IntermediateThrowEvent_1bxdugq" /> + <bpmn:callActivity id="CallActivity_0vs5jgq" name="Handle NSI Selection OOF request" calledElement="DoHandleOofRequest"> <bpmn:extensionElements> <camunda:in source="nsiSelectionUrl" target="apiPath" /> <camunda:in source="nsiSelection_correlator" target="correlator" /> @@ -121,149 +148,281 @@ dcso.processDecomposition(execution)</bpmn:script> <camunda:out source="asyncCallbackResponse" target="nsiSelection_oofResponse" /> <camunda:in source="nsiSelection_oofRequest" target="oofRequest" /> </bpmn:extensionElements> - <bpmn:incoming>Flow_15c2jcx</bpmn:incoming> - <bpmn:outgoing>Flow_1mcx2ja</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_14o0fxe</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0nwt0ci</bpmn:outgoing> </bpmn:callActivity> - <bpmn:scriptTask id="Activity_049mjag" name="Process OOF response " scriptFormat="groovy"> - <bpmn:incoming>Flow_1mcx2ja</bpmn:incoming> - <bpmn:outgoing>Flow_07ustqm</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_12t6v71" name="Process OOF response " scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0nwt0ci</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1h3kdce</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.processNSIResp(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_0bgvphs" name="Prepare OOF Select NSI options request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1iawj3m</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_14o0fxe</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.preNSIRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_00uke3g" name=" Select NSSI "> + <bpmn:outgoing>SequenceFlow_1iawj3m</bpmn:outgoing> + <bpmn:linkEventDefinition id="LinkEventDefinition_0czx4vp" name="SelectNSSI" /> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="SequenceFlow_14o0fxe" sourceRef="ScriptTask_0bgvphs" targetRef="CallActivity_0vs5jgq" /> + <bpmn:sequenceFlow id="SequenceFlow_0nwt0ci" sourceRef="CallActivity_0vs5jgq" targetRef="ScriptTask_12t6v71" /> + <bpmn:sequenceFlow id="SequenceFlow_1iawj3m" sourceRef="IntermediateCatchEvent_00uke3g" targetRef="ScriptTask_0bgvphs" /> + <bpmn:scriptTask id="Task_1jyj2vs" name="handle Nssi select " scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1tr3i9d</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1tey3hz</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcso = new DoCreateSliceServiceOption() -dcso.processOOFResponse(execution)</bpmn:script> +dcso.handleNssiSelect(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="Flow_1mcx2ja" sourceRef="Activity_0dlr4ra" targetRef="Activity_049mjag" /> - <bpmn:sequenceFlow id="Flow_15c2jcx" sourceRef="Task_09nzhwk" targetRef="Activity_0dlr4ra" /> - <bpmn:sequenceFlow id="Flow_07ustqm" sourceRef="Activity_049mjag" targetRef="ScriptTask_1umbyel" /> + <bpmn:parallelGateway id="ParallelGateway_06a2n9u"> + <bpmn:incoming>SequenceFlow_0aasemn</bpmn:incoming> + <bpmn:incoming>SequenceFlow_103oxyw</bpmn:incoming> + <bpmn:incoming>SequenceFlow_14rhmx9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1tr3i9d</bpmn:outgoing> + </bpmn:parallelGateway> + <bpmn:sequenceFlow id="SequenceFlow_1tr3i9d" sourceRef="ParallelGateway_06a2n9u" targetRef="Task_1jyj2vs" /> + <bpmn:sequenceFlow id="SequenceFlow_0aasemn" sourceRef="CallActivity_0otry7e" targetRef="ParallelGateway_06a2n9u" /> + <bpmn:sequenceFlow id="SequenceFlow_103oxyw" sourceRef="CallActivity_0melx8d" targetRef="ParallelGateway_06a2n9u" /> + <bpmn:sequenceFlow id="SequenceFlow_14rhmx9" sourceRef="CallActivity_1vzxvna" targetRef="ParallelGateway_06a2n9u" /> + <bpmn:parallelGateway id="ParallelGateway_05zg916"> + <bpmn:incoming>SequenceFlow_1h3kdce</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0il5j01</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0euwvgf</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_05250mp</bpmn:outgoing> + </bpmn:parallelGateway> + <bpmn:sequenceFlow id="SequenceFlow_0il5j01" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_0otry7e" /> + <bpmn:sequenceFlow id="SequenceFlow_0euwvgf" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_0melx8d" /> + <bpmn:sequenceFlow id="SequenceFlow_05250mp" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_1vzxvna" /> + <bpmn:sequenceFlow id="SequenceFlow_1h3kdce" sourceRef="ScriptTask_12t6v71" targetRef="ParallelGateway_05zg916" /> + <bpmn:sequenceFlow id="SequenceFlow_1tqg26p" sourceRef="CallActivity_0tzazs0" targetRef="Task_00nfg5x" /> + <bpmn:sequenceFlow id="SequenceFlow_1tey3hz" sourceRef="Task_1jyj2vs" targetRef="ExclusiveGateway_0b52m39" /> + <bpmn:sequenceFlow id="SequenceFlow_0abqxa1" sourceRef="Task_1m9qoo3" targetRef="CallActivity_0tzazs0" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_0b52m39" name="need select nssi?" default="SequenceFlow_1nrfy6i"> + <bpmn:incoming>SequenceFlow_1tey3hz</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1ezi1oi</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_126j77n</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1nrfy6i</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_126j77n" name="yes" sourceRef="ExclusiveGateway_0b52m39" targetRef="Task_1m9qoo3"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("needSelectNssi" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:endEvent id="EndEvent_0p0cjhl"> + <bpmn:incoming>SequenceFlow_1nrfy6i</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1nrfy6i" sourceRef="ExclusiveGateway_0b52m39" targetRef="EndEvent_0p0cjhl" /> + <bpmn:sequenceFlow id="SequenceFlow_1ezi1oi" sourceRef="Task_00nfg5x" targetRef="ExclusiveGateway_0b52m39" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateSliceServiceOption"> - <bpmndi:BPMNEdge id="SequenceFlow_0d774n5_di" bpmnElement="SequenceFlow_0d774n5"> - <di:waypoint x="1220" y="125" /> - <di:waypoint x="1275" y="125" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_086yszq_di" bpmnElement="SequenceFlow_086yszq"> - <di:waypoint x="1060" y="125" /> - <di:waypoint x="1120" y="125" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0piifl1_di" bpmnElement="SequenceFlow_0piifl1"> - <di:waypoint x="920" y="125" /> - <di:waypoint x="960" y="125" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0hnsycl_di" bpmnElement="SequenceFlow_0hnsycl"> - <di:waypoint x="1325" y="125" /> - <di:waypoint x="1993" y="125" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0wy6oag_di" bpmnElement="SequenceFlow_0wy6oag"> - <di:waypoint x="1300" y="150" /> - <di:waypoint x="1300" y="351" /> - <di:waypoint x="1430" y="351" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0a5f5y6_di" bpmnElement="SequenceFlow_0a5f5y6"> - <di:waypoint x="2061" y="351" /> - <di:waypoint x="2148" y="351" /> - <di:waypoint x="2148" y="493" /> - <di:waypoint x="1960" y="493" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_016vi3s_di" bpmnElement="SequenceFlow_016vi3s"> - <di:waypoint x="1872" y="351" /> - <di:waypoint x="1961" y="351" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1r9n9ef_di" bpmnElement="SequenceFlow_1r9n9ef"> - <di:waypoint x="1860" y="493" /> - <di:waypoint x="1666" y="493" /> - <di:waypoint x="1666" y="376" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0m2mr0o_di" bpmnElement="SequenceFlow_0m2mr0o"> - <di:waypoint x="1691" y="351" /> - <di:waypoint x="1772" y="351" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0lt2cdo_di" bpmnElement="SequenceFlow_0lt2cdo"> - <di:waypoint x="1530" y="351" /> - <di:waypoint x="1641" y="351" /> + <bpmndi:BPMNShape id="ScriptTask_11rb2ju_di" bpmnElement="ScriptTask_11rb2ju"> + <dc:Bounds x="400" y="140" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0c567r4_di" bpmnElement="CallActivity_0c567r4"> + <dc:Bounds x="560" y="140" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0z0dwk2_di" bpmnElement="ScriptTask_0z0dwk2"> + <dc:Bounds x="710" y="140" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1kzy63m_di" bpmnElement="SequenceFlow_1kzy63m"> + <di:waypoint x="500" y="180" /> + <di:waypoint x="560" y="180" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1ap8kar_di" bpmnElement="SequenceFlow_1ap8kar"> - <di:waypoint x="1666" y="326" /> - <di:waypoint x="1666" y="235" /> - <di:waypoint x="2011" y="235" /> - <di:waypoint x="2011" y="143" /> + <bpmndi:BPMNEdge id="SequenceFlow_1t317y2_di" bpmnElement="SequenceFlow_1t317y2"> + <di:waypoint x="660" y="180" /> + <di:waypoint x="710" y="180" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> - <di:waypoint x="350" y="125" /> - <di:waypoint x="390" y="125" /> + <bpmndi:BPMNShape id="CallActivity_0tzazs0_di" bpmnElement="CallActivity_0tzazs0"> + <dc:Bounds x="1410" y="320" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0mwlirs_di" bpmnElement="StartEvent_0mwlirs"> + <dc:Bounds x="162" y="162" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="436" y="108" width="0" height="12" /> + <dc:Bounds x="169" y="198" width="25" height="14" /> </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0w34e57_di" bpmnElement="ScriptTask_0w34e57"> + <dc:Bounds x="230" y="140" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1fuwy35_di" bpmnElement="SequenceFlow_1fuwy35"> + <di:waypoint x="198" y="180" /> + <di:waypoint x="230" y="180" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1anc3ln_di" bpmnElement="CallActivity_1vzxvna"> + <dc:Bounds x="740" y="320" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1xgkaqi_di" bpmnElement="CallActivity_0melx8d"> + <dc:Bounds x="740" y="460" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_11y7ba5_di" bpmnElement="CallActivity_0otry7e"> + <dc:Bounds x="740" y="580" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1icyh1a_di" bpmnElement="Task_1m9qoo3"> + <dc:Bounds x="1410" y="460" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0aqbm7t_di" bpmnElement="Task_00nfg5x"> + <dc:Bounds x="1210" y="320" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_12sydez_di" bpmnElement="ScriptTask_12sydez"> + <dc:Bounds x="860" y="140" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0hfiogq_di" bpmnElement="CallActivity_0hfiogq"> + <dc:Bounds x="1010" y="140" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_14j28c2_di" bpmnElement="ScriptTask_14j28c2"> + <dc:Bounds x="1170" y="140" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_12pvazb_di" bpmnElement="SequenceFlow_12pvazb"> + <di:waypoint x="960" y="180" /> + <di:waypoint x="1010" y="180" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1inonqp_di" bpmnElement="SequenceFlow_1inonqp"> + <di:waypoint x="1110" y="180" /> + <di:waypoint x="1170" y="180" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> - <di:waypoint x="218" y="125" /> - <di:waypoint x="250" y="125" /> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1bxdugq_di" bpmnElement="IntermediateThrowEvent_1bxdugq"> + <dc:Bounds x="1482" y="162" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="266" y="123" width="0" height="12" /> + <dc:Bounds x="1459" y="205" width="87" height="14" /> </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_067xdx1_di" bpmnElement="SequenceFlow_067xdx1"> + <di:waypoint x="330" y="180" /> + <di:waypoint x="400" y="180" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1mcx2ja_di" bpmnElement="Flow_1mcx2ja"> - <di:waypoint x="640" y="125" /> - <di:waypoint x="680" y="125" /> + <bpmndi:BPMNEdge id="SequenceFlow_049glzl_di" bpmnElement="SequenceFlow_049glzl"> + <di:waypoint x="1270" y="180" /> + <di:waypoint x="1320" y="180" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_15c2jcx_di" bpmnElement="Flow_15c2jcx"> - <di:waypoint x="490" y="122" /> - <di:waypoint x="540" y="120" /> + <bpmndi:BPMNEdge id="SequenceFlow_0zglfyw_di" bpmnElement="SequenceFlow_0zglfyw"> + <di:waypoint x="1230" y="140" /> + <di:waypoint x="1230" y="80" /> + <di:waypoint x="910" y="80" /> + <di:waypoint x="910" y="140" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_07ustqm_di" bpmnElement="Flow_07ustqm"> - <di:waypoint x="780" y="125" /> - <di:waypoint x="820" y="125" /> + <bpmndi:BPMNEdge id="SequenceFlow_0t4gmix_di" bpmnElement="SequenceFlow_0t4gmix"> + <di:waypoint x="810" y="180" /> + <di:waypoint x="860" y="180" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> - <dc:Bounds x="1993" y="107" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="412" y="617" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0kecvrc_di" bpmnElement="ScriptTask_0kecvrc"> - <dc:Bounds x="1430" y="311" width="100" height="80" /> + <bpmndi:BPMNShape id="ScriptTask_1tx9eou_di" bpmnElement="Task_1xqjkqx"> + <dc:Bounds x="1320" y="140" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1mlytov_di" bpmnElement="ScriptTask_1mlytov"> - <dc:Bounds x="1860" y="453" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_1y1wzs9_di" bpmnElement="ExclusiveGateway_1y1wzs9" isMarkerVisible="true"> - <dc:Bounds x="1641" y="326" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1e5ysya_di" bpmnElement="ScriptTask_1e5ysya"> - <dc:Bounds x="1772" y="311" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_1rfnoe2_di" bpmnElement="CallActivity_1rfnoe2"> - <dc:Bounds x="1961" y="311" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_1skfk7w_di" bpmnElement="ExclusiveGateway_1skfk7w" isMarkerVisible="true"> - <dc:Bounds x="1275" y="100" width="50" height="50" /> + <bpmndi:BPMNEdge id="SequenceFlow_16akt81_di" bpmnElement="SequenceFlow_16akt81"> + <di:waypoint x="1420" y="180" /> + <di:waypoint x="1482" y="180" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0vs5jgq_di" bpmnElement="CallActivity_0vs5jgq"> + <dc:Bounds x="360" y="460" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_0ly8xiw_di" bpmnElement="CallActivity_0ly8xiw"> - <dc:Bounds x="960" y="85" width="100" height="80" /> + <bpmndi:BPMNShape id="ScriptTask_12t6v71_di" bpmnElement="ScriptTask_12t6v71"> + <dc:Bounds x="490" y="460" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1895p18_di" bpmnElement="Task_1k2ypj0"> - <dc:Bounds x="1120" y="85" width="100" height="80" /> + <bpmndi:BPMNShape id="ScriptTask_0bgvphs_di" bpmnElement="ScriptTask_0bgvphs"> + <dc:Bounds x="210" y="460" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createNS_StartEvent"> - <dc:Bounds x="182" y="107" width="36" height="36" /> + <bpmndi:BPMNShape id="IntermediateCatchEvent_00uke3g_di" bpmnElement="IntermediateCatchEvent_00uke3g"> + <dc:Bounds x="142" y="482" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="158" y="143" width="86" height="27" /> + <dc:Bounds x="135" y="525" width="60" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> - <dc:Bounds x="250" y="85" width="100" height="80" /> + <bpmndi:BPMNEdge id="SequenceFlow_14o0fxe_di" bpmnElement="SequenceFlow_14o0fxe"> + <di:waypoint x="310" y="500" /> + <di:waypoint x="360" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0nwt0ci_di" bpmnElement="SequenceFlow_0nwt0ci"> + <di:waypoint x="460" y="500" /> + <di:waypoint x="490" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1iawj3m_di" bpmnElement="SequenceFlow_1iawj3m"> + <di:waypoint x="178" y="500" /> + <di:waypoint x="210" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0h3fsja_di" bpmnElement="Task_1jyj2vs"> + <dc:Bounds x="1010" y="460" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk"> - <dc:Bounds x="390" y="85" width="100" height="80" /> + <bpmndi:BPMNShape id="ParallelGateway_06a2n9u_di" bpmnElement="ParallelGateway_06a2n9u"> + <dc:Bounds x="905" y="475" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_049mjag_di" bpmnElement="Activity_049mjag"> - <dc:Bounds x="680" y="85" width="100" height="80" /> + <bpmndi:BPMNEdge id="SequenceFlow_1tr3i9d_di" bpmnElement="SequenceFlow_1tr3i9d"> + <di:waypoint x="955" y="500" /> + <di:waypoint x="1010" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0aasemn_di" bpmnElement="SequenceFlow_0aasemn"> + <di:waypoint x="840" y="620" /> + <di:waypoint x="930" y="620" /> + <di:waypoint x="930" y="525" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_103oxyw_di" bpmnElement="SequenceFlow_103oxyw"> + <di:waypoint x="840" y="500" /> + <di:waypoint x="905" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_14rhmx9_di" bpmnElement="SequenceFlow_14rhmx9"> + <di:waypoint x="840" y="360" /> + <di:waypoint x="930" y="360" /> + <di:waypoint x="930" y="475" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ParallelGateway_05zg916_di" bpmnElement="ParallelGateway_05zg916"> + <dc:Bounds x="635" y="475" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0dlr4ra_di" bpmnElement="Activity_0dlr4ra"> - <dc:Bounds x="540" y="85" width="100" height="80" /> + <bpmndi:BPMNEdge id="SequenceFlow_0il5j01_di" bpmnElement="SequenceFlow_0il5j01"> + <di:waypoint x="660" y="525" /> + <di:waypoint x="660" y="620" /> + <di:waypoint x="740" y="620" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0euwvgf_di" bpmnElement="SequenceFlow_0euwvgf"> + <di:waypoint x="685" y="500" /> + <di:waypoint x="740" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_05250mp_di" bpmnElement="SequenceFlow_05250mp"> + <di:waypoint x="660" y="475" /> + <di:waypoint x="660" y="360" /> + <di:waypoint x="740" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1h3kdce_di" bpmnElement="SequenceFlow_1h3kdce"> + <di:waypoint x="590" y="500" /> + <di:waypoint x="635" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1tqg26p_di" bpmnElement="SequenceFlow_1tqg26p"> + <di:waypoint x="1410" y="360" /> + <di:waypoint x="1310" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1tey3hz_di" bpmnElement="SequenceFlow_1tey3hz"> + <di:waypoint x="1110" y="500" /> + <di:waypoint x="1235" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0abqxa1_di" bpmnElement="SequenceFlow_0abqxa1"> + <di:waypoint x="1460" y="460" /> + <di:waypoint x="1460" y="400" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_0b52m39_di" bpmnElement="ExclusiveGateway_0b52m39" isMarkerVisible="true"> + <dc:Bounds x="1235" y="475" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1218" y="463" width="85" height="14" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1umbyel_di" bpmnElement="ScriptTask_1umbyel"> - <dc:Bounds x="820" y="85" width="100" height="80" /> + <bpmndi:BPMNEdge id="SequenceFlow_126j77n_di" bpmnElement="SequenceFlow_126j77n"> + <di:waypoint x="1285" y="500" /> + <di:waypoint x="1410" y="500" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1339" y="482" width="17" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_0p0cjhl_di" bpmnElement="EndEvent_0p0cjhl"> + <dc:Bounds x="1242" y="632" width="36" height="36" /> </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1nrfy6i_di" bpmnElement="SequenceFlow_1nrfy6i"> + <di:waypoint x="1260" y="525" /> + <di:waypoint x="1260" y="632" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ezi1oi_di" bpmnElement="SequenceFlow_1ezi1oi"> + <di:waypoint x="1260" y="400" /> + <di:waypoint x="1260" y="475" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOptionV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOptionV2.bpmn deleted file mode 100644 index 5d9e53ac18..0000000000 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOptionV2.bpmn +++ /dev/null @@ -1,563 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> - <bpmn:process id="DoCreateSliceServiceOptionV2" name="DoCreateSliceServiceOptionV2" isExecutable="true"> - <bpmn:parallelGateway id="ParallelGateway_0f11kcw"> - <bpmn:incoming>SequenceFlow_17otbuu</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_00t0340</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_06uu0eh</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_09see8v</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_14s7fck</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1c374y2</bpmn:outgoing> - </bpmn:parallelGateway> - <bpmn:parallelGateway id="ParallelGateway_05o7mbp"> - <bpmn:incoming>SequenceFlow_04avf98</bpmn:incoming> - <bpmn:incoming>SequenceFlow_00xa5wa</bpmn:incoming> - <bpmn:incoming>SequenceFlow_064p1n6</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1a699ly</bpmn:outgoing> - </bpmn:parallelGateway> - <bpmn:scriptTask id="ScriptTask_0sznvim" name="Prepare OOF Select NSI options request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_16qt6r2</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_175xozh</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoCreateSliceServiceOption() -dcso.preNSIRequest(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_1sik00k" name="Query TN Sub-net capability" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_09see8v</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_04avf98</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoCreateSliceServiceOption() -dcso.queryTNSubnetCapability(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_1sukxzw" name="Query CN Sub-net capability" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_14s7fck</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_00xa5wa</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoCreateSliceServiceOption() -dcso.queryCNSubnetCapability(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_02u3dmq" name="Query AN Sub-net capability" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1c374y2</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_064p1n6</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoCreateSliceServiceOption() -dcso.queryANSubnetCapability(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_04avf98" sourceRef="ScriptTask_1sik00k" targetRef="ParallelGateway_05o7mbp" /> - <bpmn:sequenceFlow id="SequenceFlow_00xa5wa" sourceRef="ScriptTask_1sukxzw" targetRef="ParallelGateway_05o7mbp" /> - <bpmn:sequenceFlow id="SequenceFlow_064p1n6" sourceRef="ScriptTask_02u3dmq" targetRef="ParallelGateway_05o7mbp" /> - <bpmn:sequenceFlow id="SequenceFlow_1a699ly" sourceRef="ParallelGateway_05o7mbp" targetRef="Task_1kqbsvd" /> - <bpmn:scriptTask id="ScriptTask_11rb2ju" name="prepare NST decomposition" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_00t0340</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1kzy63m</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoCreateSliceServiceOption() -dcso.prepareDecomposeNST(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:callActivity id="CallActivity_0c567r4" name="Call Decompose Service" calledElement="DecomposeService"> - <bpmn:extensionElements> - <camunda:in source="msoRequestId" target="msoRequestId" /> - <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> - <camunda:in source="nstServiceModelInfo" target="serviceModelInfo" /> - <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> - <camunda:out source="serviceDecomposition" target="nstServiceDecomposition" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1kzy63m</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1t317y2</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:scriptTask id="ScriptTask_0z0dwk2" name="Process Decomposition" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1t317y2</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1rwl882</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoCreateSliceServiceOption() -dcso.processDecomposition(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_0f0rh4w" name="prepare NSST decomposition" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_06uu0eh</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1dtfpqp</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoCreateSliceServiceOption() -dcso.prepareNSTDecompose(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:callActivity id="CallActivity_1tmbgfs" name="Call Decompose Service" calledElement="DecomposeService"> - <bpmn:extensionElements> - <camunda:in source="msoRequestId" target="msoRequestId" /> - <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> - <camunda:in source="nsstServiceModelInfo" target="serviceModelInfo" /> - <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> - <camunda:out source="serviceDecomposition" target="nsstServiceDecomposition" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1dtfpqp</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0fdqj9b</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:scriptTask id="ScriptTask_0m6v98c" name="Process Decomposition" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0fdqj9b</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0d2lpv3</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoCreateSliceServiceOption() -dcso.processDecomposition(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_1kzy63m" sourceRef="ScriptTask_11rb2ju" targetRef="CallActivity_0c567r4" /> - <bpmn:sequenceFlow id="SequenceFlow_1t317y2" sourceRef="CallActivity_0c567r4" targetRef="ScriptTask_0z0dwk2" /> - <bpmn:sequenceFlow id="SequenceFlow_1dtfpqp" sourceRef="ScriptTask_0f0rh4w" targetRef="CallActivity_1tmbgfs" /> - <bpmn:sequenceFlow id="SequenceFlow_0fdqj9b" sourceRef="CallActivity_1tmbgfs" targetRef="ScriptTask_0m6v98c" /> - <bpmn:sequenceFlow id="SequenceFlow_1rwl882" sourceRef="ScriptTask_0z0dwk2" targetRef="ParallelGateway_1v1unh1" /> - <bpmn:sequenceFlow id="SequenceFlow_0d2lpv3" sourceRef="ScriptTask_0m6v98c" targetRef="ParallelGateway_1v1unh1" /> - <bpmn:callActivity id="CallActivity_15kmmuf" name="Handle NSI Selection OOF request" calledElement="DoHandleOofRequest"> - <bpmn:extensionElements> - <camunda:in source="nsiSelectionUrl" target="apiPath" /> - <camunda:in source="nsiSelection_correlator" target="correlator" /> - <camunda:in source="nsiSelection_messageType" target="messageType" /> - <camunda:in source="nsiSelection_timeout" target="timeout" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="asyncCallbackResponse" target="nsiSelection_oofResponse" /> - <camunda:in source="nsiSelection_oofRequest" target="oofRequest" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_175xozh</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_188g03z</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_175xozh" sourceRef="ScriptTask_0sznvim" targetRef="CallActivity_15kmmuf" /> - <bpmn:scriptTask id="ScriptTask_0woac2j" name="Process OOF response " scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_188g03z</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_17emrud</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoCreateSliceServiceOption() -dcso.processNSIResp(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_188g03z" sourceRef="CallActivity_15kmmuf" targetRef="ScriptTask_0woac2j" /> - <bpmn:sequenceFlow id="SequenceFlow_17emrud" sourceRef="ScriptTask_0woac2j" targetRef="EndEvent_15dimzx" /> - <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0pstvd4" name=" Select NSSI "> - <bpmn:outgoing>SequenceFlow_1sg6mqd</bpmn:outgoing> - <bpmn:linkEventDefinition id="LinkEventDefinition_1slqdh4" name="SelectNSSI" /> - </bpmn:intermediateCatchEvent> - <bpmn:parallelGateway id="ParallelGateway_05zg916"> - <bpmn:incoming>SequenceFlow_1sg6mqd</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_05250mp</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0euwvgf</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0il5j01</bpmn:outgoing> - </bpmn:parallelGateway> - <bpmn:parallelGateway id="ParallelGateway_06a2n9u"> - <bpmn:incoming>SequenceFlow_14rhmx9</bpmn:incoming> - <bpmn:incoming>SequenceFlow_103oxyw</bpmn:incoming> - <bpmn:incoming>SequenceFlow_0aasemn</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1tr3i9d</bpmn:outgoing> - </bpmn:parallelGateway> - <bpmn:callActivity id="CallActivity_0tzazs0" name="Handle NSST Selection OOF request" calledElement="DoHandleOofRequest"> - <bpmn:extensionElements> - <camunda:in source="nstSelectionUrl" target="apiPath" /> - <camunda:in source="nstSelection_correlator" target="correlator" /> - <camunda:in source="nstSelection_messageType" target="messageType" /> - <camunda:in source="nstSelection_timeout" target="timeout" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="asyncCallbackResponse" target="nstSelection_oofResponse" /> - <camunda:in source="nstSelection_oofRequest" target="oofRequest" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0abqxa1</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1tqg26p</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_1sg6mqd" sourceRef="IntermediateCatchEvent_0pstvd4" targetRef="ParallelGateway_05zg916" /> - <bpmn:sequenceFlow id="SequenceFlow_05250mp" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_1vzxvna" /> - <bpmn:sequenceFlow id="SequenceFlow_14rhmx9" sourceRef="CallActivity_1vzxvna" targetRef="ParallelGateway_06a2n9u" /> - <bpmn:sequenceFlow id="SequenceFlow_0euwvgf" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_0melx8d" /> - <bpmn:sequenceFlow id="SequenceFlow_103oxyw" sourceRef="CallActivity_0melx8d" targetRef="ParallelGateway_06a2n9u" /> - <bpmn:sequenceFlow id="SequenceFlow_0il5j01" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_0otry7e" /> - <bpmn:sequenceFlow id="SequenceFlow_0aasemn" sourceRef="CallActivity_0otry7e" targetRef="ParallelGateway_06a2n9u" /> - <bpmn:sequenceFlow id="SequenceFlow_1tr3i9d" sourceRef="ParallelGateway_06a2n9u" targetRef="Task_1jyj2vs" /> - <bpmn:sequenceFlow id="SequenceFlow_0abqxa1" sourceRef="Task_1m9qoo3" targetRef="CallActivity_0tzazs0" /> - <bpmn:sequenceFlow id="SequenceFlow_1tqg26p" sourceRef="CallActivity_0tzazs0" targetRef="Task_00nfg5x" /> - <bpmn:intermediateThrowEvent id="EndEvent_15dimzx" name="Goto Select NSSI "> - <bpmn:incoming>SequenceFlow_17emrud</bpmn:incoming> - <bpmn:linkEventDefinition name="SelectNSSI" /> - </bpmn:intermediateThrowEvent> - <bpmn:endEvent id="EndEvent_0p0cjhl"> - <bpmn:incoming>SequenceFlow_1nrfy6i</bpmn:incoming> - </bpmn:endEvent> - <bpmn:parallelGateway id="ParallelGateway_1v1unh1"> - <bpmn:incoming>SequenceFlow_1rwl882</bpmn:incoming> - <bpmn:incoming>SequenceFlow_0d2lpv3</bpmn:incoming> - <bpmn:incoming>SequenceFlow_06t1dq5</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_16qt6r2</bpmn:outgoing> - </bpmn:parallelGateway> - <bpmn:sequenceFlow id="SequenceFlow_16qt6r2" sourceRef="ParallelGateway_1v1unh1" targetRef="ScriptTask_0sznvim" /> - <bpmn:startEvent id="StartEvent_0mwlirs" name="Start"> - <bpmn:outgoing>SequenceFlow_1fuwy35</bpmn:outgoing> - </bpmn:startEvent> - <bpmn:scriptTask id="ScriptTask_0w34e57" name="Preprocess Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1fuwy35</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_17otbuu</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoCreateSliceServiceOption() -dcso.preProcessRequest(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_1fuwy35" sourceRef="StartEvent_0mwlirs" targetRef="ScriptTask_0w34e57" /> - <bpmn:sequenceFlow id="SequenceFlow_17otbuu" sourceRef="ScriptTask_0w34e57" targetRef="ParallelGateway_0f11kcw" /> - <bpmn:sequenceFlow id="SequenceFlow_00t0340" sourceRef="ParallelGateway_0f11kcw" targetRef="ScriptTask_11rb2ju" /> - <bpmn:sequenceFlow id="SequenceFlow_06uu0eh" sourceRef="ParallelGateway_0f11kcw" targetRef="ScriptTask_0f0rh4w" /> - <bpmn:sequenceFlow id="SequenceFlow_09see8v" sourceRef="ParallelGateway_0f11kcw" targetRef="ScriptTask_1sik00k" /> - <bpmn:sequenceFlow id="SequenceFlow_14s7fck" sourceRef="ParallelGateway_0f11kcw" targetRef="ScriptTask_1sukxzw" /> - <bpmn:sequenceFlow id="SequenceFlow_1c374y2" sourceRef="ParallelGateway_0f11kcw" targetRef="ScriptTask_02u3dmq" /> - <bpmn:scriptTask id="CallActivity_1vzxvna" name="TN NSSMF supports NSSI" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_05250mp</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_14rhmx9</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoCreateSliceServiceOption() -dcso.getNSSISelectionCap4TN(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="CallActivity_0melx8d" name="CN NSSMF supports NSSI" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0euwvgf</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_103oxyw</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoCreateSliceServiceOption() -dcso.getNSSISelectionCap4CN(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="CallActivity_0otry7e" name="AN NSSMF supports NSSI" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0il5j01</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0aasemn</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoCreateSliceServiceOption() -dcso.getNSSISelectionCap4AN(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_06t1dq5" sourceRef="Task_1kqbsvd" targetRef="ParallelGateway_1v1unh1" /> - <bpmn:scriptTask id="Task_1kqbsvd" name="handle sub-net capability info" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1a699ly</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_06t1dq5</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoCreateSliceServiceOption() -dcso.handleSubnetCapabilityResp(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="Task_1m9qoo3" name="Prepare NSSI Selection" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_126j77n</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0abqxa1</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoCreateSliceServiceOption() -dcso.preNSSIRequest(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="Task_00nfg5x" name="Process NSST Solutions" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1tqg26p</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1i3j8c3</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoCreateSliceServiceOption() -dcso.processNSSIResp(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_0b52m39" name="need select nssi?" default="SequenceFlow_1nrfy6i"> - <bpmn:incoming>SequenceFlow_1tey3hz</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_126j77n</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1nrfy6i</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_126j77n" name="yes" sourceRef="ExclusiveGateway_0b52m39" targetRef="Task_1m9qoo3"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" ) == "update")}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1nrfy6i" sourceRef="ExclusiveGateway_0b52m39" targetRef="EndEvent_0p0cjhl" /> - <bpmn:sequenceFlow id="SequenceFlow_1i3j8c3" sourceRef="Task_00nfg5x" targetRef="Task_1jyj2vs" /> - <bpmn:sequenceFlow id="SequenceFlow_1tey3hz" sourceRef="Task_1jyj2vs" targetRef="ExclusiveGateway_0b52m39" /> - <bpmn:scriptTask id="Task_1jyj2vs" name="handle Nssi select " scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1tr3i9d</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1i3j8c3</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1tey3hz</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoCreateSliceServiceOption() -dcso.handleNssiSelect(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:group id="Group_1k2kt9q" categoryValueRef="CategoryValue_1eh1etw" /> - <bpmn:group id="Group_19fk2vp" categoryValueRef="CategoryValue_1x9qkyq" /> - <bpmn:group id="Group_01yft6a" categoryValueRef="CategoryValue_1nwi9c3" /> - </bpmn:process> - <bpmn:category id="Category_0s5hs8l"> - <bpmn:categoryValue id="CategoryValue_1eh1etw" value="subnetCapabilities" /> - </bpmn:category> - <bpmn:category id="Category_1ahkzyt"> - <bpmn:categoryValue id="CategoryValue_1x9qkyq" value="nst -> NSTInfo" /> - </bpmn:category> - <bpmn:category id="Category_0ne04nd"> - <bpmn:categoryValue id="CategoryValue_1nwi9c3" value="nsst -> NSSTInfo" /> - </bpmn:category> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateSliceServiceOptionV2"> - <bpmndi:BPMNShape id="ParallelGateway_0f11kcw_di" bpmnElement="ParallelGateway_0f11kcw"> - <dc:Bounds x="355" y="525" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ParallelGateway_05o7mbp_di" bpmnElement="ParallelGateway_05o7mbp"> - <dc:Bounds x="697" y="215" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0sznvim_di" bpmnElement="ScriptTask_0sznvim"> - <dc:Bounds x="1110" y="510" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1sik00k_di" bpmnElement="ScriptTask_1sik00k"> - <dc:Bounds x="520" y="90" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1sukxzw_di" bpmnElement="ScriptTask_1sukxzw"> - <dc:Bounds x="520" y="200" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_02u3dmq_di" bpmnElement="ScriptTask_02u3dmq"> - <dc:Bounds x="520" y="310" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_04avf98_di" bpmnElement="SequenceFlow_04avf98"> - <di:waypoint x="620" y="130" /> - <di:waypoint x="722" y="130" /> - <di:waypoint x="722" y="215" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_00xa5wa_di" bpmnElement="SequenceFlow_00xa5wa"> - <di:waypoint x="620" y="240" /> - <di:waypoint x="697" y="240" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_064p1n6_di" bpmnElement="SequenceFlow_064p1n6"> - <di:waypoint x="620" y="350" /> - <di:waypoint x="722" y="350" /> - <di:waypoint x="722" y="265" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1a699ly_di" bpmnElement="SequenceFlow_1a699ly"> - <di:waypoint x="747" y="240" /> - <di:waypoint x="820" y="240" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="Group_1k2kt9q_di" bpmnElement="Group_1k2kt9q"> - <dc:Bounds x="487" y="77" width="485" height="325" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="739" y="78" width="85" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_11rb2ju_di" bpmnElement="ScriptTask_11rb2ju"> - <dc:Bounds x="520" y="510" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_0c567r4_di" bpmnElement="CallActivity_0c567r4"> - <dc:Bounds x="660" y="510" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0z0dwk2_di" bpmnElement="ScriptTask_0z0dwk2"> - <dc:Bounds x="820" y="510" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0f0rh4w_di" bpmnElement="ScriptTask_0f0rh4w"> - <dc:Bounds x="520" y="740" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_1tmbgfs_di" bpmnElement="CallActivity_1tmbgfs"> - <dc:Bounds x="660" y="740" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0m6v98c_di" bpmnElement="ScriptTask_0m6v98c"> - <dc:Bounds x="820" y="740" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1kzy63m_di" bpmnElement="SequenceFlow_1kzy63m"> - <di:waypoint x="620" y="550" /> - <di:waypoint x="660" y="550" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1t317y2_di" bpmnElement="SequenceFlow_1t317y2"> - <di:waypoint x="760" y="550" /> - <di:waypoint x="820" y="550" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1dtfpqp_di" bpmnElement="SequenceFlow_1dtfpqp"> - <di:waypoint x="620" y="780" /> - <di:waypoint x="660" y="780" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0fdqj9b_di" bpmnElement="SequenceFlow_0fdqj9b"> - <di:waypoint x="760" y="780" /> - <di:waypoint x="820" y="780" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1rwl882_di" bpmnElement="SequenceFlow_1rwl882"> - <di:waypoint x="920" y="550" /> - <di:waypoint x="995" y="550" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0d2lpv3_di" bpmnElement="SequenceFlow_0d2lpv3"> - <di:waypoint x="920" y="780" /> - <di:waypoint x="1020" y="780" /> - <di:waypoint x="1020" y="575" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_15kmmuf_di" bpmnElement="CallActivity_15kmmuf"> - <dc:Bounds x="1280" y="510" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_175xozh_di" bpmnElement="SequenceFlow_175xozh"> - <di:waypoint x="1210" y="550" /> - <di:waypoint x="1280" y="550" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0woac2j_di" bpmnElement="ScriptTask_0woac2j"> - <dc:Bounds x="1420" y="510" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_188g03z_di" bpmnElement="SequenceFlow_188g03z"> - <di:waypoint x="1380" y="550" /> - <di:waypoint x="1420" y="550" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="Group_19fk2vp_di" bpmnElement="Group_19fk2vp"> - <dc:Bounds x="495" y="450" width="453" height="180" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="686" y="457" width="72" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_17emrud_di" bpmnElement="SequenceFlow_17emrud"> - <di:waypoint x="1520" y="550" /> - <di:waypoint x="1562" y="550" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="IntermediateCatchEvent_0pstvd4_di" bpmnElement="IntermediateCatchEvent_0pstvd4"> - <dc:Bounds x="198" y="1202" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="191" y="1245" width="60" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ParallelGateway_05zg916_di" bpmnElement="ParallelGateway_05zg916"> - <dc:Bounds x="335" y="1195" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ParallelGateway_06a2n9u_di" bpmnElement="ParallelGateway_06a2n9u"> - <dc:Bounds x="675" y="1195" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_0tzazs0_di" bpmnElement="CallActivity_0tzazs0"> - <dc:Bounds x="1200" y="1040" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1sg6mqd_di" bpmnElement="SequenceFlow_1sg6mqd"> - <di:waypoint x="234" y="1220" /> - <di:waypoint x="335" y="1220" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_05250mp_di" bpmnElement="SequenceFlow_05250mp"> - <di:waypoint x="360" y="1195" /> - <di:waypoint x="360" y="1080" /> - <di:waypoint x="500" y="1080" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_14rhmx9_di" bpmnElement="SequenceFlow_14rhmx9"> - <di:waypoint x="600" y="1080" /> - <di:waypoint x="700" y="1080" /> - <di:waypoint x="700" y="1195" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0euwvgf_di" bpmnElement="SequenceFlow_0euwvgf"> - <di:waypoint x="385" y="1220" /> - <di:waypoint x="500" y="1220" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_103oxyw_di" bpmnElement="SequenceFlow_103oxyw"> - <di:waypoint x="600" y="1220" /> - <di:waypoint x="675" y="1220" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0il5j01_di" bpmnElement="SequenceFlow_0il5j01"> - <di:waypoint x="360" y="1245" /> - <di:waypoint x="360" y="1340" /> - <di:waypoint x="500" y="1340" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0aasemn_di" bpmnElement="SequenceFlow_0aasemn"> - <di:waypoint x="600" y="1340" /> - <di:waypoint x="700" y="1340" /> - <di:waypoint x="700" y="1245" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1tr3i9d_di" bpmnElement="SequenceFlow_1tr3i9d"> - <di:waypoint x="725" y="1220" /> - <di:waypoint x="800" y="1220" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0abqxa1_di" bpmnElement="SequenceFlow_0abqxa1"> - <di:waypoint x="1250" y="1180" /> - <di:waypoint x="1250" y="1120" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1tqg26p_di" bpmnElement="SequenceFlow_1tqg26p"> - <di:waypoint x="1200" y="1080" /> - <di:waypoint x="900" y="1080" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="IntermediateThrowEvent_0ubqlvg_di" bpmnElement="EndEvent_15dimzx"> - <dc:Bounds x="1562" y="532" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1539" y="575" width="87" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_0p0cjhl_di" bpmnElement="EndEvent_0p0cjhl"> - <dc:Bounds x="1232" y="1322" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Group_01yft6a_di" bpmnElement="Group_01yft6a"> - <dc:Bounds x="495" y="690" width="453" height="180" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="680" y="697" width="85" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ParallelGateway_1v1unh1_di" bpmnElement="ParallelGateway_1v1unh1"> - <dc:Bounds x="995" y="525" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_16qt6r2_di" bpmnElement="SequenceFlow_16qt6r2"> - <di:waypoint x="1045" y="550" /> - <di:waypoint x="1110" y="550" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="StartEvent_0mwlirs_di" bpmnElement="StartEvent_0mwlirs"> - <dc:Bounds x="162" y="532" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="169" y="568" width="25" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0w34e57_di" bpmnElement="ScriptTask_0w34e57"> - <dc:Bounds x="230" y="510" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1fuwy35_di" bpmnElement="SequenceFlow_1fuwy35"> - <di:waypoint x="198" y="550" /> - <di:waypoint x="230" y="550" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_17otbuu_di" bpmnElement="SequenceFlow_17otbuu"> - <di:waypoint x="330" y="550" /> - <di:waypoint x="355" y="550" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_00t0340_di" bpmnElement="SequenceFlow_00t0340"> - <di:waypoint x="405" y="550" /> - <di:waypoint x="520" y="550" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_06uu0eh_di" bpmnElement="SequenceFlow_06uu0eh"> - <di:waypoint x="380" y="575" /> - <di:waypoint x="380" y="780" /> - <di:waypoint x="520" y="780" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_09see8v_di" bpmnElement="SequenceFlow_09see8v"> - <di:waypoint x="380" y="525" /> - <di:waypoint x="380" y="130" /> - <di:waypoint x="520" y="130" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_14s7fck_di" bpmnElement="SequenceFlow_14s7fck"> - <di:waypoint x="380" y="525" /> - <di:waypoint x="380" y="240" /> - <di:waypoint x="520" y="240" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1c374y2_di" bpmnElement="SequenceFlow_1c374y2"> - <di:waypoint x="380" y="525" /> - <di:waypoint x="380" y="350" /> - <di:waypoint x="520" y="350" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1anc3ln_di" bpmnElement="CallActivity_1vzxvna"> - <dc:Bounds x="500" y="1040" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1xgkaqi_di" bpmnElement="CallActivity_0melx8d"> - <dc:Bounds x="500" y="1180" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_11y7ba5_di" bpmnElement="CallActivity_0otry7e"> - <dc:Bounds x="500" y="1300" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_06t1dq5_di" bpmnElement="SequenceFlow_06t1dq5"> - <di:waypoint x="920" y="240" /> - <di:waypoint x="1020" y="240" /> - <di:waypoint x="1020" y="525" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1xkxr0x_di" bpmnElement="Task_1kqbsvd"> - <dc:Bounds x="820" y="200" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1icyh1a_di" bpmnElement="Task_1m9qoo3"> - <dc:Bounds x="1200" y="1180" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0aqbm7t_di" bpmnElement="Task_00nfg5x"> - <dc:Bounds x="800" y="1040" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0b52m39_di" bpmnElement="ExclusiveGateway_0b52m39" isMarkerVisible="true"> - <dc:Bounds x="1025" y="1195" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1008" y="1183" width="85" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_126j77n_di" bpmnElement="SequenceFlow_126j77n"> - <di:waypoint x="1075" y="1220" /> - <di:waypoint x="1200" y="1220" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1129" y="1202" width="17" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1nrfy6i_di" bpmnElement="SequenceFlow_1nrfy6i"> - <di:waypoint x="1050" y="1245" /> - <di:waypoint x="1050" y="1340" /> - <di:waypoint x="1232" y="1340" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1i3j8c3_di" bpmnElement="SequenceFlow_1i3j8c3"> - <di:waypoint x="850" y="1120" /> - <di:waypoint x="850" y="1180" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1tey3hz_di" bpmnElement="SequenceFlow_1tey3hz"> - <di:waypoint x="900" y="1220" /> - <di:waypoint x="1025" y="1220" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0h3fsja_di" bpmnElement="Task_1jyj2vs"> - <dc:Bounds x="800" y="1180" width="100" height="80" /> - </bpmndi:BPMNShape> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleOofRequest.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleOofRequest.bpmn index d6b251649f..ed4561c757 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleOofRequest.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleOofRequest.bpmn @@ -18,7 +18,7 @@ oofHandler.callOofAdapter(execution)</bpmn:script> <bpmn:outgoing>Flow_1fbzzqg</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.common.scripts.* def oofHandler = new DoHandleOofRequest() -oofHandler .preProcessRequest(execution)</bpmn:script> +oofHandler.preProcessRequest(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:subProcess id="Activity_02ru8n9" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true"> <bpmn:startEvent id="Event_1r00tca"> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyCoreNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyCoreNSSI.bpmn index fa167d4515..1f1fe4e735 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyCoreNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyCoreNSSI.bpmn @@ -118,7 +118,7 @@ def mcnssi= new ModifyCoreNSSI() <bpmn:outgoing>Flow_1wtv1zj</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def mcnssi= new ModifyCoreNSSI() - mcnssi.removeNSSIToSliceInstanceAssociation(execution)</bpmn:script> + mcnssi.removeSPAssociationWithNSSI(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="Flow_15fi92t" sourceRef="Activity_0c4wmiz" targetRef="Activity_1iegufd" /> <bpmn:scriptTask id="Activity_010nkjp" name="Delete the slice profile instance
" scriptFormat="groovy"> @@ -143,6 +143,14 @@ def mcnssi= new ModifyCoreNSSI() </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1nmtzzp"> + <bpmndi:BPMNEdge id="Flow_06j2avj_di" bpmnElement="Flow_06j2avj"> + <di:waypoint x="380" y="150" /> + <di:waypoint x="440" y="150" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0e007rx_di" bpmnElement="Flow_0e007rx"> + <di:waypoint x="218" y="150" /> + <di:waypoint x="280" y="150" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0lrenyo_di" bpmnElement="Flow_0lrenyo"> <di:waypoint x="890" y="600" /> <di:waypoint x="930" y="600" /> @@ -217,20 +225,39 @@ def mcnssi= new ModifyCoreNSSI() <di:waypoint x="540" y="150" /> <di:waypoint x="620" y="150" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0e007rx_di" bpmnElement="Flow_0e007rx"> - <di:waypoint x="218" y="150" /> - <di:waypoint x="280" y="150" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_06j2avj_di" bpmnElement="Flow_06j2avj"> - <di:waypoint x="380" y="150" /> - <di:waypoint x="440" y="150" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="Event_0fbqt56_di" bpmnElement="Event_0fbqt56"> <dc:Bounds x="182" y="132" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="158" y="175" width="89" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0tf735w_di" bpmnElement="Activity_0tf735w"> + <dc:Bounds x="440" y="110" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1ce41n6_di" bpmnElement="Activity_1ce41n6"> + <dc:Bounds x="620" y="110" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_02skgkj_di" bpmnElement="Activity_02skgkj"> + <dc:Bounds x="810" y="110" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_1hadnun_di" bpmnElement="Gateway_1hadnun" isMarkerVisible="true"> + <dc:Bounds x="985" y="125" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="974" y="86" width="75" height="40" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_1243wg1_di" bpmnElement="Event_1243wg1"> + <dc:Bounds x="1132" y="132" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1113" y="173" width="90" height="40" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_1gjhrcq_di" bpmnElement="Event_1gjhrcq"> + <dc:Bounds x="992" y="252" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="973" y="293" width="90" height="40" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0oph5am_di" bpmnElement="Activity_0oph5am"> <dc:Bounds x="970" y="480" width="100" height="80" /> </bpmndi:BPMNShape> @@ -276,33 +303,6 @@ def mcnssi= new ModifyCoreNSSI() <bpmndi:BPMNShape id="Activity_010nkjp_di" bpmnElement="Activity_010nkjp"> <dc:Bounds x="790" y="560" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_1243wg1_di" bpmnElement="Event_1243wg1"> - <dc:Bounds x="1132" y="132" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1113" y="173" width="90" height="40" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_1hadnun_di" bpmnElement="Gateway_1hadnun" isMarkerVisible="true"> - <dc:Bounds x="985" y="125" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="974" y="86" width="75" height="40" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_1gjhrcq_di" bpmnElement="Event_1gjhrcq"> - <dc:Bounds x="992" y="252" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="973" y="293" width="90" height="40" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_02skgkj_di" bpmnElement="Activity_02skgkj"> - <dc:Bounds x="810" y="110" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1ce41n6_di" bpmnElement="Activity_1ce41n6"> - <dc:Bounds x="620" y="110" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0tf735w_di" bpmnElement="Activity_0tf735w"> - <dc:Bounds x="440" y="110" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0klj7y1_di" bpmnElement="Activity_0klj7y1"> <dc:Bounds x="280" y="110" width="100" height="80" /> </bpmndi:BPMNShape> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java index 806d4b5151..9ac3579957 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java @@ -32,6 +32,10 @@ import java.util.UUID; import java.util.stream.Collectors; import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.BpmnError; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; @@ -52,9 +56,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIConfigurationResources; @@ -66,7 +67,6 @@ import org.onap.so.client.orchestration.AAIVfModuleResources; import org.onap.so.client.orchestration.AAIVnfResources; import org.onap.so.client.orchestration.AAIVolumeGroupResources; import org.onap.so.client.orchestration.AAIVpnBindingResources; -import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -695,7 +695,8 @@ public class AAICreateTasks { if (fqdnCount > 0) { for (int i = 0; i < fqdnCount; i++) { String fqdn = fqdnList[i]; - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY); + AAIPluralResourceUri uri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies()); uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn); Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy = aaiNetworkResources.getNetworkPolicy(uri); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java index 42fb719f89..d62fc6f50f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java @@ -27,6 +27,9 @@ import java.util.List; import java.util.Optional; import org.onap.aai.domain.yang.NetworkPolicies; import org.onap.aai.domain.yang.NetworkPolicy; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; @@ -38,9 +41,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIConfigurationResources; import org.onap.so.client.orchestration.AAIInstanceGroupResources; @@ -279,7 +279,8 @@ public class AAIDeleteTasks { if (fqdnCount > 0) { for (int i = 0; i < fqdnCount; i++) { String fqdn = fqdnList[i]; - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY); + AAIPluralResourceUri uri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies()); uri.queryParam(networkPolicyFqdnParam, fqdn); Optional<NetworkPolicies> oNetPolicies = aaiNetworkResources.getNetworkPolicies(uri); if (oNetPolicies.isPresent()) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java index 0912cba94a..9df9dd330c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java @@ -32,15 +32,15 @@ import org.onap.aai.domain.yang.RouteTableReference; import org.onap.aai.domain.yang.RouteTargets; import org.onap.aai.domain.yang.Subnet; import org.onap.aai.domain.yang.VpnBinding; +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.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.onap.so.adapters.nwrest.CreateNetworkRequest; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.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.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAINetworkResources; import org.slf4j.Logger; @@ -76,8 +76,7 @@ public class AAIQueryTasks { if (!networkRelationships.isPresent()) { throw (new Exception(ERROR_MSG)); } - List<AAIResourceUri> netBindingsUriList = - networkRelationships.get().getRelatedAAIUris(AAIObjectType.VPN_BINDING); + List<AAIResourceUri> netBindingsUriList = networkRelationships.get().getRelatedUris(Types.VPN_BINDING); List<org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding> mappedVpnBindings = new ArrayList<>(); if (netBindingsUriList != null && !netBindingsUriList.isEmpty()) { @@ -115,8 +114,7 @@ public class AAIQueryTasks { if (!networkRelationships.isPresent()) { throw (new Exception(ERROR_MSG)); } - List<AAIResourceUri> netBindingsUriList = - networkRelationships.get().getRelatedAAIUris(AAIObjectType.VPN_BINDING); + List<AAIResourceUri> netBindingsUriList = networkRelationships.get().getRelatedUris(Types.VPN_BINDING); List<org.onap.so.openstack.beans.RouteTarget> routeTargets = new ArrayList<>(); for (AAIResourceUri netBindingUri : netBindingsUriList) { logger.info("Get Route Targests"); @@ -168,8 +166,7 @@ public class AAIQueryTasks { if (!networkRelationships.isPresent()) { throw (new Exception(ERROR_MSG)); } - List<AAIResourceUri> netPoliciesUriList = - networkRelationships.get().getRelatedAAIUris(AAIObjectType.NETWORK_POLICY); + List<AAIResourceUri> netPoliciesUriList = networkRelationships.get().getRelatedUris(Types.NETWORK_POLICY); if (!netPoliciesUriList.isEmpty()) { for (AAIResourceUri netPolicyUri : netPoliciesUriList) { @@ -201,7 +198,7 @@ public class AAIQueryTasks { throw (new Exception(ERROR_MSG)); } List<AAIResourceUri> routeTableUriList = - networkRelationships.get().getRelatedAAIUris(AAIObjectType.ROUTE_TABLE_REFERENCE); + networkRelationships.get().getRelatedUris(Types.ROUTE_TABLE_REFERENCE); if (!routeTableUriList.isEmpty()) { for (AAIResourceUri routeTableUri : routeTableUriList) { @@ -241,7 +238,7 @@ public class AAIQueryTasks { if (!networkRelationships.isPresent()) { throw (new Exception(ERROR_MSG)); } - List<AAIResourceUri> subnetsUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.SUBNET); + List<AAIResourceUri> subnetsUriList = networkRelationships.get().getRelatedUris(Types.SUBNET); if (!subnetsUriList.isEmpty()) { for (AAIResourceUri subnetUri : subnetsUriList) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java index c21b467a95..a556d3088c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java @@ -1,19 +1,16 @@ package org.onap.so.bpmn.infrastructure.adapter.cnf.tasks; -import java.io.IOException; +import java.util.HashMap; +import java.util.Map; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowAction; import org.onap.so.client.adapter.cnf.CnfAdapterClient; -import org.onap.so.client.adapter.cnf.CnfAdapterClientException; import org.onap.so.client.adapter.cnf.entities.InstanceRequest; import org.onap.so.client.adapter.cnf.entities.InstanceResponse; +import org.onap.so.client.adapter.cnf.entities.Labels; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; @Component public class CnfAdapter { @@ -25,8 +22,19 @@ public class CnfAdapter { public void callCnfAdapter(DelegateExecution execution) throws Exception { try { - final String instanceRequest = (String) execution.getVariable("instanceRequest"); - InstanceRequest request = new ObjectMapper().readValue(instanceRequest, InstanceRequest.class); + InstanceRequest request = new InstanceRequest(); + request.setRbName("test-rbdef"); + request.setRbVersion("v1"); + request.setCloudRegion("krd"); + request.setVfModuleUUID("VF module UUID"); + request.setProfileName("p1"); + Map<String, String> overrideValues = new HashMap<>(); + overrideValues.put("image.tag", "latest"); + overrideValues.put("dcae_collector_ip", "1.2.3.4"); + Map<String, String> labels = new HashMap<String, String>(); + labels.put("custom-label-1", "abcdef"); + request.setLabels(labels); + request.setOverrideValues(overrideValues); InstanceResponse response = cnfAdapterClient.createVfModule(request); } catch (Exception ex) { logger.error("Exception in callCnfAdapter", ex); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java index 93d30512b6..7624bcb811 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java @@ -112,7 +112,7 @@ public class CnfAdapterCreateTasks { request.setRbName(vfModule.getModelInfoVfModule().getModelInvariantUUID()); request.setRbVersion(vfModule.getModelInfoVfModule().getModelUUID()); request.setCloudRegion(cloudRegion.getLcpCloudRegionId()); - request.setReleaseName(vfModule.getVfModuleId()); + request.setVfModuleUUID(vfModule.getVfModuleId()); request.setProfileName(sdncDirectives.get("k8s-rb-profile-name")); request.setOverrideValues(sdncDirectives); return request; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java index 1f05522011..2644ae1b58 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java @@ -6,11 +6,11 @@ import java.util.List; import java.util.Map; import java.util.Optional; import org.onap.aai.domain.yang.Vserver; -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.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.onap.appc.client.lcm.model.Action; import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest; import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVm; @@ -186,7 +186,7 @@ public class AppcOrchestratorPreProcessor { if (aaiRW != null && aaiRW.getRelationships().isPresent()) { Relationships relationships = aaiRW.getRelationships().get(); if (relationships != null) { - List<AAIResourceUri> vserverUris = relationships.getRelatedAAIUris(AAIObjectType.VSERVER); + List<AAIResourceUri> vserverUris = relationships.getRelatedUris(Types.VSERVER); ArrayList<String> vserverIds = new ArrayList<String>(); ArrayList<String> vserverSelfLinks = new ArrayList<String>(); for (AAIResourceUri j : vserverUris) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java index 70edc375c4..de2976fb80 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java @@ -30,11 +30,11 @@ import java.util.Map; import java.util.Optional; import org.json.JSONArray; import org.json.JSONObject; -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.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.onap.appc.client.lcm.model.Action; import org.onap.logging.filter.base.ErrorCode; import org.onap.so.bpmn.common.BuildingBlockExecution; @@ -251,7 +251,7 @@ public class AppcRunTasks { return; } Relationships relationships = aaiRW.getRelationships().get(); - List<AAIResourceUri> vserverUris = relationships.getRelatedAAIUris(AAIObjectType.VSERVER); + List<AAIResourceUri> vserverUris = relationships.getRelatedUris(Types.VSERVER); JSONArray vserverIds = new JSONArray(); JSONArray vserverSelfLinks = new JSONArray(); if (vserverUris != null) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java index a1e513fd47..3b81d52703 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java @@ -22,17 +22,22 @@ import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable; import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.cds.AbstractCDSProcessingBBUtils; +import org.onap.so.client.cds.ConfigureInstanceParamsForPnf; import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean; import org.onap.so.client.cds.PayloadConstants; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.exception.PayloadGenerationException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.util.List; +import java.util.Map; import java.util.UUID; import static org.onap.so.client.cds.PayloadConstants.PRC_BLUEPRINT_NAME; import static org.onap.so.client.cds.PayloadConstants.PRC_BLUEPRINT_VERSION; @@ -54,13 +59,16 @@ public class GenericPnfCDSControllerRunnableBB implements ControllerRunnable<Bui private AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils; private ExtractPojosForBB extractPojosForBB; private ExceptionBuilder exceptionBuilder; + private ConfigureInstanceParamsForPnf configureInstanceParamsForPnf; @Autowired public GenericPnfCDSControllerRunnableBB(AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils, - ExtractPojosForBB extractPojosForBB, ExceptionBuilder exceptionBuilder) { + ExtractPojosForBB extractPojosForBB, ExceptionBuilder exceptionBuilder, + ConfigureInstanceParamsForPnf configureInstanceParamsForPnf) { this.abstractCDSProcessingBBUtils = abstractCDSProcessingBBUtils; this.extractPojosForBB = extractPojosForBB; this.exceptionBuilder = exceptionBuilder; + this.configureInstanceParamsForPnf = configureInstanceParamsForPnf; } @Override @@ -115,6 +123,7 @@ public class GenericPnfCDSControllerRunnableBB implements ControllerRunnable<Bui String resolutionKey = null; try { final Pnf pnf = getPnf(execution); + final String modelCustomizationUuid = pnf.getModelInfoPnf().getModelCustomizationUuid(); final ServiceInstance serviceInstance = getServiceInstance(execution); resolutionKey = pnf.getPnfName(); @@ -123,10 +132,17 @@ public class GenericPnfCDSControllerRunnableBB implements ControllerRunnable<Bui pnfObject); setExecutionVariable("pnf-id", pnf.getPnfId(), pnfObject); setExecutionVariable("pnf-name", resolutionKey, pnfObject); - setExecutionVariable("pnf-customization-uuid", pnf.getModelInfoPnf().getModelCustomizationUuid(), - pnfObject); + setExecutionVariable("pnf-customization-uuid", modelCustomizationUuid, pnfObject); + + final GeneralBuildingBlock generalBuildingBlock = execution.getGeneralBuildingBlock(); - } catch (BBObjectNotFoundException exception) { + List<Map<String, Object>> userParamsFromRequest = + generalBuildingBlock.getRequestContext().getRequestParameters().getUserParams(); + if (userParamsFromRequest != null && userParamsFromRequest.size() != 0) { + configureInstanceParamsForPnf.populateInstanceParams(pnfObject, userParamsFromRequest, + modelCustomizationUuid); + } + } catch (BBObjectNotFoundException | PayloadGenerationException exception) { logger.error("An exception occurred when creating payload for CDS request", exception); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, exception); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java index 751e91d009..f7c42b97e9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java @@ -1,6 +1,14 @@ package org.onap.so.bpmn.infrastructure.vfmodule; import java.util.Optional; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +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.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; @@ -8,14 +16,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -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.Relationships; -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.so.client.exception.ExceptionBuilder; import org.onap.so.cloud.resource.beans.CloudInformation; import org.onap.so.cloud.resource.beans.NodeType; @@ -60,15 +60,15 @@ public class CreateVFModule { } protected NodeType getNodeType(CloudRegion cloudRegion) { - AAIResourceUri cloudRegionUri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, - cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()); + AAIResourceUri cloudRegionUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())); AAIResourcesClient client = getAAIClient(); Optional<Relationships> relationships = client.get(cloudRegionUri).getRelationships(); if (relationships.isPresent()) { AAIPluralResourceUri networkTechsGreenfieldUri = AAIUriFactory - .createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId()) - .relatedTo(AAIObjectPlurals.NETWORK_TECHNOLOGY) + .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())) + .relatedTo(Types.NETWORK_TECHNOLOGIES.getFragment()) .queryParam("network-technology-name", NodeType.GREENFIELD.getNetworkTechnologyName()); AAIResultWrapper networkTechsGreenfield = client.get(networkTechsGreenfieldUri); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java index 905862880f..304cb9f4b4 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java @@ -23,10 +23,10 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; import java.util.List; import java.util.Optional; import org.onap.aai.domain.yang.L3Network; -import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; -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.generated.fluentbuilders.AAIFluentTypeBuilder.Types; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -143,7 +143,7 @@ public class VrfValidation { AAIResultWrapper networkWrapper = new AAIResultWrapper(aaiLocalNetwork); if (networkWrapper.getRelationships().isPresent()) { List<AAIResourceUri> vpnBindingUris = - networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING); + networkWrapper.getRelationships().get().getRelatedUris(Types.VPN_BINDING); if (!vpnBindingUris.isEmpty()) { Optional<org.onap.aai.domain.yang.VpnBinding> vpnBindingOp = bbInputSetupUtils.getAAIResourceDepthOne(vpnBindingUris.get(0)) diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index 9b9433afdb..0f955e2851 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -50,12 +50,13 @@ import org.onap.aai.domain.yang.Vnfc; import org.onap.aai.domain.yang.VolumeGroup; import org.onap.aai.domain.yang.VpnBinding; import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; -import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIObjectName; 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.BBConstants; import org.onap.so.bpmn.infrastructure.workflow.tasks.utils.WorkflowResourceIdsUtils; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; @@ -485,16 +486,17 @@ public class WorkflowAction { } protected <T> List<T> getRelatedResourcesInVfModule(String vnfId, String vfModuleId, Class<T> resultClass, - AAIObjectType type) { + AAIObjectName name) { List<T> vnfcs = new ArrayList<>(); - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId); + AAIResourceUri uri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)); AAIResultWrapper vfModuleResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri); Optional<Relationships> relationshipsOp = vfModuleResultsWrapper.getRelationships(); if (!relationshipsOp.isPresent()) { logger.debug("No relationships were found for vfModule in AAI"); } else { Relationships relationships = relationshipsOp.get(); - List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(type); + List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(name); for (AAIResultWrapper vnfcResultWrapper : vnfcResultWrappers) { Optional<T> vnfcOp = vnfcResultWrapper.asBean(resultClass); vnfcOp.ifPresent(vnfcs::add); @@ -503,9 +505,9 @@ public class WorkflowAction { return vnfcs; } - protected <T> T getRelatedResourcesInVnfc(Vnfc vnfc, Class<T> resultClass, AAIObjectType type) throws Exception { + protected <T> T getRelatedResourcesInVnfc(Vnfc vnfc, Class<T> resultClass, AAIObjectName name) throws Exception { T configuration = null; - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfc.getVnfcName()); + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfc.getVnfcName())); AAIResultWrapper vnfcResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri); Optional<Relationships> relationshipsOp = vnfcResultsWrapper.getRelationships(); if (!relationshipsOp.isPresent()) { @@ -513,7 +515,7 @@ public class WorkflowAction { } else { Relationships relationships = relationshipsOp.get(); List<AAIResultWrapper> configurationResultWrappers = - this.getResultWrappersFromRelationships(relationships, type); + this.getResultWrappersFromRelationships(relationships, name); if (configurationResultWrappers.size() > 1) { String multipleRelationshipsError = "Multiple relationships exist from VNFC " + vnfc.getVnfcName() + " to Configurations"; @@ -530,8 +532,8 @@ public class WorkflowAction { } protected List<AAIResultWrapper> getResultWrappersFromRelationships(Relationships relationships, - AAIObjectType type) { - return relationships.getByType(type); + AAIObjectName name) { + return relationships.getByType(name); } protected boolean isConfiguration(List<OrchestrationFlow> orchFlows) { @@ -565,12 +567,12 @@ public class WorkflowAction { vfModuleCustomizationUUID = aaiVfModule.getModelCustomizationId(); } - List<org.onap.aai.domain.yang.Vnfc> vnfcs = getRelatedResourcesInVfModule(vnfId, vfModuleId, - org.onap.aai.domain.yang.Vnfc.class, AAIObjectType.VNFC); + List<org.onap.aai.domain.yang.Vnfc> vnfcs = + getRelatedResourcesInVfModule(vnfId, vfModuleId, org.onap.aai.domain.yang.Vnfc.class, Types.VNFC); for (org.onap.aai.domain.yang.Vnfc vnfc : vnfcs) { WorkflowResourceIds workflowIdsCopy = SerializationUtils.clone(dataObj.getWorkflowResourceIds()); - org.onap.aai.domain.yang.Configuration configuration = getRelatedResourcesInVnfc(vnfc, - org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION); + org.onap.aai.domain.yang.Configuration configuration = + getRelatedResourcesInVnfc(vnfc, org.onap.aai.domain.yang.Configuration.class, Types.CONFIGURATION); if (configuration == null) { logger.warn(String.format("No configuration found for VNFC %s in AAI", vnfc.getVnfcName())); continue; @@ -813,7 +815,7 @@ public class WorkflowAction { new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiLocalNetwork)).getRelationships(); if (relationshipsOp.isPresent()) { List<AAIResultWrapper> configurationsRelatedToLocalNetwork = - relationshipsOp.get().getByType(AAIObjectType.CONFIGURATION); + relationshipsOp.get().getByType(Types.CONFIGURATION); if (configurationsRelatedToLocalNetwork.size() > 1) { throw new VrfBondingServiceException( "Network: " + aaiLocalNetwork.getNetworkId() + " has more than 1 configuration related to it"); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index 7420df144a..5425b2a725 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -20,12 +20,23 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.UUID; +import java.util.stream.Collectors; +import javax.persistence.EntityNotFoundException; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.onap.aai.domain.yang.*; -import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.InstanceGroup; +import org.onap.aai.domain.yang.L3Network; +import org.onap.aai.domain.yang.ServiceInstance; +import org.onap.aai.domain.yang.VfModule; +import org.onap.aai.domain.yang.Vnfc; +import org.onap.aai.domain.yang.VolumeGroup; import org.onap.aaiclient.client.aai.entities.Configuration; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.onap.so.bpmn.common.DelegateExecutionImpl; import org.onap.so.bpmn.common.listener.db.RequestsDbListenerRunner; import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner; @@ -48,13 +59,8 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; -import javax.persistence.EntityNotFoundException; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.UUID; -import java.util.stream.Collectors; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; @Component public class WorkflowActionBBTasks { @@ -421,8 +427,7 @@ public class WorkflowActionBBTasks { String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId(); String vfModuleCustomizationUUID = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId(); - List<Vnfc> vnfcs = - workflowAction.getRelatedResourcesInVfModule(vnfId, vfModuleId, Vnfc.class, AAIObjectType.VNFC); + List<Vnfc> vnfcs = workflowAction.getRelatedResourcesInVfModule(vnfId, vfModuleId, Vnfc.class, Types.VNFC); logger.debug("Vnfc Size: {}", vnfcs.size()); for (Vnfc vnfc : vnfcs) { String modelCustomizationId = vnfc.getModelCustomizationId(); @@ -461,7 +466,7 @@ public class WorkflowActionBBTasks { protected String getConfigurationId(Vnfc vnfc) throws Exception { Configuration configuration = - workflowAction.getRelatedResourcesInVnfc(vnfc, Configuration.class, AAIObjectType.CONFIGURATION); + workflowAction.getRelatedResourcesInVnfc(vnfc, Configuration.class, Types.CONFIGURATION); if (configuration != null) { return configuration.getConfigurationId(); } else { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java index de674daca3..4140692b44 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java @@ -23,12 +23,12 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; import java.util.List; import java.util.Optional; import org.onap.aai.domain.yang.VpnBinding; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; -import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; -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.generated.fluentbuilders.AAIFluentTypeBuilder.Types; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -42,7 +42,7 @@ public class WorkflowActionExtractResourcesAAI { protected BBInputSetupUtils bbInputSetupUtils; public Optional<Configuration> extractRelationshipsConfiguration(Relationships relationships) { - List<AAIResultWrapper> configurations = relationships.getByType(AAIObjectType.CONFIGURATION); + List<AAIResultWrapper> configurations = relationships.getByType(Types.CONFIGURATION); for (AAIResultWrapper configWrapper : configurations) { Optional<Configuration> config = configWrapper.asBean(Configuration.class); if (config.isPresent()) { @@ -53,7 +53,7 @@ public class WorkflowActionExtractResourcesAAI { } public Optional<VpnBinding> extractRelationshipsVpnBinding(Relationships relationships) { - List<AAIResourceUri> configurations = relationships.getRelatedUris(AAIObjectType.VPN_BINDING); + List<AAIResourceUri> configurations = relationships.getRelatedUris(Types.VPN_BINDING); for (AAIResourceUri vpnBindingUri : configurations) { AAIResultWrapper vpnBindingWrapper = bbInputSetupUtils.getAAIResourceDepthOne(vpnBindingUri); Optional<VpnBinding> vpnBinding = vpnBindingWrapper.asBean(VpnBinding.class); @@ -65,7 +65,7 @@ public class WorkflowActionExtractResourcesAAI { } public Optional<Relationships> extractRelationshipsVnfc(Relationships relationships) { - List<AAIResultWrapper> vnfcs = relationships.getByType(AAIObjectType.VNFC); + List<AAIResultWrapper> vnfcs = relationships.getByType(Types.VNFC); for (AAIResultWrapper vnfcWrapper : vnfcs) { if (vnfcWrapper.getRelationships().isPresent()) { return vnfcWrapper.getRelationships(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java index f44c15ac54..b74aa9056d 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java @@ -34,6 +34,7 @@ import org.springframework.core.env.Environment; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; +import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.retry.annotation.Backoff; import org.springframework.retry.annotation.Retryable; @@ -75,11 +76,32 @@ public class CnfAdapterClient { } } + @Retryable(value = {HttpServerErrorException.class}, maxAttempts = 3, backoff = @Backoff(delay = 3000)) + public InstanceResponse healthcheck() throws CnfAdapterClientException { + try { + // String uri = env.getRequiredProperty("mso.cnf.adapter.endpoint"); //TODO: This needs to be added as well + // for configuration + String uri = "https://localhost:32780"; // TODO: What is the correct uri? + String endpoint = UriBuilder.fromUri(uri).path("/api/cnf-adapter/v1/healthcheck").build().toString(); + HttpEntity<?> entity = new HttpEntity<>(getHttpHeaders()); + ResponseEntity<InstanceResponse> result = + restTemplate.exchange(endpoint, HttpMethod.GET, entity, InstanceResponse.class); + return result.getBody(); + } catch (HttpClientErrorException e) { + logger.error("Error Calling CNF Adapter, e"); + if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { + throw new EntityNotFoundException(e.getResponseBodyAsString()); + } + throw e; + } + } + protected HttpHeaders getHttpHeaders() { HttpHeaders headers = new HttpHeaders(); - List<org.springframework.http.MediaType> acceptableMediaTypes = new ArrayList<>(); - acceptableMediaTypes.add(org.springframework.http.MediaType.APPLICATION_JSON); + List<MediaType> acceptableMediaTypes = new ArrayList<>(); + acceptableMediaTypes.add(MediaType.APPLICATION_JSON); headers.setAccept(acceptableMediaTypes); + headers.setContentType(MediaType.APPLICATION_JSON); /* * try { String userCredentials = CryptoUtils.decrypt(env.getRequiredProperty("mso.cnf.adapter.auth"), * env.getRequiredProperty("mso.msoKey")); if (userCredentials != null) { headers.add(HttpHeaders.AUTHORIZATION, diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java index e4058097ab..37d4e41553 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java @@ -11,18 +11,18 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; "override-values"}) public class InstanceRequest { - @JsonProperty("rb-name") + @JsonProperty("modelInvariantId") private String rbName; - @JsonProperty("rb-version") + @JsonProperty("modelVersionId") private String rbVersion; - @JsonProperty("profile-name") + @JsonProperty("k8sRBProfileName") private String profileName; - @JsonProperty("release-name") - private String releaseName; - @JsonProperty("cloud-region") + @JsonProperty("vfModuleUUID") + private String vfModuleUUID; + @JsonProperty("cloudRegionId") private String cloudRegion; @JsonProperty("labels") - private Labels labels; + private Map<String, String> labels; @JsonProperty(value = "override-values") private Map<String, String> overrideValues; @@ -67,21 +67,21 @@ public class InstanceRequest { } @JsonProperty("labels") - public Labels getLabels() { + public Map<String, String> getLabels() { return labels; } @JsonProperty("labels") - public void setLabels(Labels labels) { + public void setLabels(Map<String, String> labels) { this.labels = labels; } - public String getReleaseName() { - return releaseName; + public String getVfModuleUUID() { + return vfModuleUUID; } - public void setReleaseName(String releaseName) { - this.releaseName = releaseName; + public void setVfModuleUUID(String vfModuleUUID) { + this.vfModuleUUID = vfModuleUUID; } public Map<String, String> getOverrideValues() { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java index 7386740c25..78c8cfb145 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java @@ -20,11 +20,11 @@ package org.onap.so.client.orchestration; -import org.onap.so.bpmn.common.InjectionHelper; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; -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.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; @@ -40,7 +40,7 @@ public class AAICollectionResources { public void createCollection(Collection collection) { AAIResourceUri networkCollectionURI = - AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(collection.getId())); collection.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); org.onap.aai.domain.yang.Collection aaiCollection = aaiObjectMapper.mapCollection(collection); injectionHelper.getAaiClient().create(networkCollectionURI, aaiCollection); @@ -48,13 +48,14 @@ public class AAICollectionResources { public void updateCollection(Collection collection) { AAIResourceUri networkCollectionURI = - AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(collection.getId())); org.onap.aai.domain.yang.Collection aaiCollection = aaiObjectMapper.mapCollection(collection); injectionHelper.getAaiClient().update(networkCollectionURI, aaiCollection); } public void deleteCollection(Collection collection) { - AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId()); + AAIResourceUri instanceGroupUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(collection.getId())); injectionHelper.getAaiClient().delete(instanceGroupUri); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java index a832930723..1373c2ca97 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java @@ -22,12 +22,13 @@ package org.onap.so.client.orchestration; import java.util.Optional; import javax.ws.rs.core.UriBuilder; -import org.onap.so.bpmn.common.InjectionHelper; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; -import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; 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.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; @@ -47,8 +48,8 @@ public class AAIConfigurationResources { * @param configuration */ public void createConfiguration(Configuration configuration) { - AAIResourceUri configurationURI = - AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); + AAIResourceUri configurationURI = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().configuration(configuration.getConfigurationId())); configuration.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration); injectionHelper.getAaiClient().createIfNotExists(configurationURI, Optional.of(aaiConfiguration)); @@ -61,7 +62,8 @@ public class AAIConfigurationResources { * @return */ public Optional<org.onap.aai.domain.yang.Configuration> getConfiguration(String configurationId) { - AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + AAIResourceUri aaiResourceUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Configuration.class, aaiResourceUri); } @@ -71,8 +73,8 @@ public class AAIConfigurationResources { * @param configuration */ public void updateConfiguration(Configuration configuration) { - AAIResourceUri configurationURI = - AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); + AAIResourceUri configurationURI = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().configuration(configuration.getConfigurationId())); org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration); injectionHelper.getAaiClient().update(configurationURI, aaiConfiguration); } @@ -85,9 +87,10 @@ public class AAIConfigurationResources { */ public void disconnectConfigurationToServiceInstance(String configurationId, String serviceInstanceId) { - AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + AAIResourceUri configurationURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)); injectionHelper.getAaiClient().disconnect(configurationURI, serviceInstanceURI); } @@ -99,9 +102,9 @@ public class AAIConfigurationResources { */ public void connectVrfConfigurationToVnrConfiguration(String vrfConfigurationId, String vnrConfigurationId) { AAIResourceUri vnrConfigurationUri = - AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vnrConfigurationId); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(vnrConfigurationId)); AAIResourceUri vrfConfigurationUri = - AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vrfConfigurationId); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(vrfConfigurationId)); injectionHelper.getAaiClient().connect(vrfConfigurationUri, vnrConfigurationUri); } @@ -112,8 +115,9 @@ public class AAIConfigurationResources { * @param configurationId */ public void connectConfigurationToPnfObject(String pnfId, String configurationId) { - AAIResourceUri pnfUri = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId); - AAIResourceUri configurationUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + AAIResourceUri pnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnfId)); + AAIResourceUri configurationUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); injectionHelper.getAaiClient().connect(configurationUri, pnfUri); } @@ -124,9 +128,10 @@ public class AAIConfigurationResources { * @param serviceInstanceId */ public void connectConfigurationToServiceInstance(String configurationId, String serviceInstanceId) { - AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + AAIResourceUri configurationURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)); injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI); } @@ -139,9 +144,10 @@ public class AAIConfigurationResources { */ public void connectConfigurationToServiceInstance(String configurationId, String serviceInstanceId, AAIEdgeLabel aaiLabel) { - AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + AAIResourceUri configurationURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)); injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI, aaiLabel); } @@ -152,8 +158,10 @@ public class AAIConfigurationResources { * @param genericVnfId */ public void connectConfigurationToGenericVnf(String configurationId, String genericVnfId) { - AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); - AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnfId); + AAIResourceUri configurationURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); + AAIResourceUri genericVnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnfId)); injectionHelper.getAaiClient().connect(configurationURI, genericVnfURI); } @@ -165,26 +173,33 @@ public class AAIConfigurationResources { * */ public void connectConfigurationToVpnBinding(String configurationId, String vpnId) { - AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); - AAIResourceUri vpnBindingURI = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId); + AAIResourceUri configurationURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); + AAIResourceUri vpnBindingURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBinding(vpnId)); injectionHelper.getAaiClient().connect(configurationURI, vpnBindingURI); } public void connectConfigurationToVfModule(String configurationId, String vnfId, String vfModuleId) { - AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); - AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId); + AAIResourceUri configurationURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); + AAIResourceUri vfModuleURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)); injectionHelper.getAaiClient().connect(configurationURI, vfModuleURI); } public void connectConfigurationToVnfc(String configurationId, String vnfcName) { - AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); - AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName); + AAIResourceUri configurationURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); + AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfcName)); injectionHelper.getAaiClient().connect(configurationURI, vnfcURI); } public void connectConfigurationToL3Network(String configurationId, String networkId) { - AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); - AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId); + AAIResourceUri configurationURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); + AAIResourceUri networkURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)); injectionHelper.getAaiClient().connect(configurationURI, networkURI); } @@ -194,7 +209,8 @@ public class AAIConfigurationResources { * @param configurationId */ public void deleteConfiguration(String configurationId) { - AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + AAIResourceUri aaiResourceUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId)); injectionHelper.getAaiClient().delete(aaiResourceUri); } @@ -204,8 +220,8 @@ public class AAIConfigurationResources { * @param configuration */ public void deleteConfiguration(Configuration configuration) { - AAIResourceUri aaiResourceUri = - AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); + AAIResourceUri aaiResourceUri = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().configuration(configuration.getConfigurationId())); injectionHelper.getAaiClient().delete(aaiResourceUri); } @@ -217,13 +233,13 @@ public class AAIConfigurationResources { */ public Optional<org.onap.aai.domain.yang.Configuration> getConfigurationFromRelatedLink(String relatedLink) { return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Configuration.class, AAIUriFactory - .createResourceFromExistingURI(AAIObjectType.CONFIGURATION, UriBuilder.fromPath(relatedLink).build())); + .createResourceFromExistingURI(Types.CONFIGURATION, UriBuilder.fromPath(relatedLink).build())); } public void updateOrchestrationStatusConfiguration(Configuration configuration, OrchestrationStatus orchestrationStatus) { - AAIResourceUri aaiResourceUri = - AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); + AAIResourceUri aaiResourceUri = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().configuration(configuration.getConfigurationId())); configuration.setOrchestrationStatus(orchestrationStatus); org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration); injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration); @@ -231,8 +247,8 @@ public class AAIConfigurationResources { public void updateConfigurationOrchestrationStatus(Configuration configuration, OrchestrationStatus orchestrationStatus) { - AAIResourceUri aaiResourceUri = - AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); + AAIResourceUri aaiResourceUri = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().configuration(configuration.getConfigurationId())); org.onap.aai.domain.yang.Configuration aaiConfiguration = new org.onap.aai.domain.yang.Configuration(); aaiConfiguration.setOrchestrationStatus(orchestrationStatus.name()); injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java index 05c8f7dd8f..27fa4304c4 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java @@ -21,16 +21,16 @@ package org.onap.so.client.orchestration; import java.util.Optional; -import org.onap.so.bpmn.common.InjectionHelper; -import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; -import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; -import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; 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.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -45,50 +45,52 @@ public class AAIInstanceGroupResources { public void createInstanceGroup(InstanceGroup instanceGroup) { AAIResourceUri instanceGroupUri = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup); injectionHelper.getAaiClient().createIfNotExists(instanceGroupUri, Optional.of(aaiInstanceGroup)); } public void deleteInstanceGroup(InstanceGroup instanceGroup) { AAIResourceUri instanceGroupUri = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); injectionHelper.getAaiClient().delete(instanceGroupUri); } public void connectInstanceGroupToVnf(InstanceGroup instanceGroup, GenericVnf vnf) { AAIResourceUri instanceGroupUri = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); + AAIResourceUri vnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())); injectionHelper.getAaiClient().connect(instanceGroupUri, vnfURI); } public void connectInstanceGroupToVnf(InstanceGroup instanceGroup, GenericVnf vnf, AAIEdgeLabel aaiLabel) { AAIResourceUri instanceGroupUri = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); + AAIResourceUri vnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())); injectionHelper.getAaiClient().connect(instanceGroupUri, vnfURI, aaiLabel); } public boolean exists(InstanceGroup instanceGroup) { AAIResourceUri instanceGroupUri = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); return injectionHelper.getAaiClient().exists(instanceGroupUri); } public void createInstanceGroupandConnectServiceInstance(InstanceGroup instanceGroup, ServiceInstance serviceInstance) { AAIResourceUri instanceGroupUri = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup); - AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + AAIResourceUri serviceInstanceURI = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); injectionHelper.getAaiClient().createIfNotExists(instanceGroupUri, Optional.of(aaiInstanceGroup)) .connect(instanceGroupUri, serviceInstanceURI); } public boolean checkInstanceGroupNameInUse(String instanceGroupName) { - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroups()) .queryParam("instance-group-name", instanceGroupName); return injectionHelper.getAaiClient().exists(uri); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java index 611d715331..2e8e50aebf 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java @@ -25,6 +25,15 @@ import org.onap.aai.domain.yang.NetworkPolicies; import org.onap.aai.domain.yang.NetworkPolicy; import org.onap.aai.domain.yang.RouteTableReference; import org.onap.aai.domain.yang.VpnBinding; +import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri; +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.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; @@ -34,16 +43,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; -import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri; -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.so.client.aai.mapper.AAIObjectMapper; -import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -58,46 +58,51 @@ public class AAINetworkResources { private AAIObjectMapper aaiObjectMapper; public void updateNetwork(L3Network network) { - AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); + AAIResourceUri networkURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId())); org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(network); injectionHelper.getAaiClient().update(networkURI, aaiL3Network); } public void updateSubnet(L3Network network, Subnet subnet) { - AAIResourceUri subnetURI = - AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, network.getNetworkId(), subnet.getSubnetId()); + AAIResourceUri subnetURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()).subnet(subnet.getSubnetId())); org.onap.aai.domain.yang.Subnet aaiSubnet = aaiObjectMapper.mapSubnet(subnet); injectionHelper.getAaiClient().update(subnetURI, aaiSubnet); } public void createNetworkConnectToServiceInstance(L3Network network, ServiceInstance serviceInstance) { - AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); + AAIResourceUri networkURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId())); network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); - AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + AAIResourceUri serviceInstanceURI = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(network); injectionHelper.getAaiClient().createIfNotExists(networkURI, Optional.of(aaiL3Network)).connect(networkURI, serviceInstanceURI); } public void createLineOfBusinessAndConnectNetwork(LineOfBusiness lineOfBusiness, L3Network network) { - AAIResourceUri lineOfBusinessURI = - AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness.getLineOfBusinessName()); - AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); + AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.business().lineOfBusiness(lineOfBusiness.getLineOfBusinessName())); + AAIResourceUri networkURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId())); injectionHelper.getAaiClient().createIfNotExists(lineOfBusinessURI, Optional.of(lineOfBusiness)) .connect(networkURI, lineOfBusinessURI); } public void createPlatformAndConnectNetwork(Platform platform, L3Network network) { AAIResourceUri platformURI = - AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platform.getPlatformName()); - AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().platform(platform.getPlatformName())); + AAIResourceUri networkURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId())); injectionHelper.getAaiClient().createIfNotExists(platformURI, Optional.of(platform)).connect(networkURI, platformURI); } public void deleteNetwork(L3Network network) { - AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); + AAIResourceUri networkURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId())); injectionHelper.getAaiClient().delete(networkURI); } @@ -122,115 +127,122 @@ public class AAINetworkResources { } public Optional<org.onap.aai.domain.yang.L3Network> queryNetworkById(L3Network l3network) { - AAIResourceUri uri = - AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()).depth(Depth.ALL); + AAIResourceUri uri = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId())).depth(Depth.ALL); AAIResultWrapper aaiWrapper = injectionHelper.getAaiClient().get(uri); return aaiWrapper.asBean(org.onap.aai.domain.yang.L3Network.class); } public AAIResultWrapper queryNetworkWrapperById(L3Network l3network) { - AAIResourceUri uri = - AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()).depth(Depth.ALL); + AAIResourceUri uri = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId())).depth(Depth.ALL); return injectionHelper.getAaiClient().get(uri); } public void createNetworkInstanceGroup(InstanceGroup instanceGroup) { AAIResourceUri instanceGroupURI = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup); injectionHelper.getAaiClient().create(instanceGroupURI, aaiInstanceGroup); } public void createNetworkCollection(Collection networkCollection) { AAIResourceUri networkCollectionURI = - AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId())); networkCollection.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); org.onap.aai.domain.yang.Collection aaiCollection = aaiObjectMapper.mapCollection(networkCollection); injectionHelper.getAaiClient().create(networkCollectionURI, aaiCollection); } public void connectNetworkToTenant(L3Network l3network, CloudRegion cloudRegion) { - AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId()); - AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()); + AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .tenant(cloudRegion.getTenantId())); + AAIResourceUri networkURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId())); injectionHelper.getAaiClient().connect(tenantURI, networkURI); } public void connectNetworkToCloudRegion(L3Network l3network, CloudRegion cloudRegion) { - AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, - cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()); - AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()); + AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())); + AAIResourceUri networkURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId())); injectionHelper.getAaiClient().connect(networkURI, cloudRegionURI); } public void connectNetworkToNetworkCollectionInstanceGroup(L3Network l3network, InstanceGroup instanceGroup) { AAIResourceUri netwrokCollectionInstanceGroupURI = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); - AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); + AAIResourceUri networkURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId())); injectionHelper.getAaiClient().connect(netwrokCollectionInstanceGroupURI, networkURI); } public void connectNetworkToNetworkCollectionServiceInstance(L3Network l3network, ServiceInstance networkCollectionServiceInstance) { AAIResourceUri networkCollectionServiceInstanceUri = AAIUriFactory.createResourceUri( - AAIObjectType.SERVICE_INSTANCE, networkCollectionServiceInstance.getServiceInstanceId()); - AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()); + Types.SERVICE_INSTANCE.getFragment(networkCollectionServiceInstance.getServiceInstanceId())); + AAIResourceUri networkURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId())); injectionHelper.getAaiClient().connect(networkCollectionServiceInstanceUri, networkURI); } public void connectNetworkCollectionInstanceGroupToNetworkCollection(InstanceGroup instanceGroup, Collection networkCollection) { AAIResourceUri networkCollectionUri = - AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId())); AAIResourceUri netwrokCollectionInstanceGroupURI = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); injectionHelper.getAaiClient().connect(networkCollectionUri, netwrokCollectionInstanceGroupURI); } public void connectInstanceGroupToCloudRegion(InstanceGroup instanceGroup, CloudRegion cloudRegion) { - AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, - cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()); + AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())); AAIResourceUri instanceGroupURI = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); injectionHelper.getAaiClient().connect(instanceGroupURI, cloudRegionURI, AAIEdgeLabel.USES); } public void connectNetworkCollectionToServiceInstance(Collection networkCollection, ServiceInstance networkCollectionServiceInstance) { AAIResourceUri networkCollectionUri = - AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId())); AAIResourceUri networkCollectionServiceInstanceUri = AAIUriFactory.createResourceUri( - AAIObjectType.SERVICE_INSTANCE, networkCollectionServiceInstance.getServiceInstanceId()); + Types.SERVICE_INSTANCE.getFragment(networkCollectionServiceInstance.getServiceInstanceId())); injectionHelper.getAaiClient().connect(networkCollectionUri, networkCollectionServiceInstanceUri); } public void deleteCollection(Collection collection) { - AAIResourceUri collectionURI = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId()); + AAIResourceUri collectionURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(collection.getId())); injectionHelper.getAaiClient().delete(collectionURI); } public void deleteNetworkInstanceGroup(InstanceGroup instanceGroup) { AAIResourceUri instanceGroupURI = - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); injectionHelper.getAaiClient().delete(instanceGroupURI); } public void createNetworkPolicy(org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy networkPolicy) { NetworkPolicy aaiNetworkPolicy = aaiObjectMapper.mapNetworkPolicy(networkPolicy); String networkPolicyId = networkPolicy.getNetworkPolicyId(); - AAIResourceUri netUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId); + AAIResourceUri netUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicyId)); injectionHelper.getAaiClient().create(netUri, aaiNetworkPolicy); } public void deleteNetworkPolicy(String networkPolicyId) { AAIResourceUri networkPolicyURI = - AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicyId)); injectionHelper.getAaiClient().delete(networkPolicyURI); } public boolean checkNetworkNameInUse(String networkName) { - AAIPluralResourceUri uri = - AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName); + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Networks()) + .queryParam("network-name", networkName); return injectionHelper.getAaiClient().exists(uri); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java index 3da17194ff..a426c39646 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java @@ -20,24 +20,25 @@ package org.onap.so.client.orchestration; -import com.google.common.base.Strings; import java.util.Optional; import org.apache.commons.lang3.StringUtils; import org.onap.aai.domain.yang.RelatedToProperty; import org.onap.aai.domain.yang.Relationship; import org.onap.aai.domain.yang.RelationshipData; +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.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -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.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import com.google.common.base.Strings; @Component public class AAIPnfResources { @@ -51,16 +52,16 @@ public class AAIPnfResources { private AAIObjectMapper aaiObjectMapper; public void createPnfAndConnectServiceInstance(Pnf pnf, ServiceInstance serviceInstance) { - AAIResourceUri pnfURI = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName()); + AAIResourceUri pnfURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnf.getPnfName())); pnf.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); - AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + AAIResourceUri serviceInstanceURI = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); injectionHelper.getAaiClient().createIfNotExists(pnfURI, Optional.of(aaiObjectMapper.mapPnf(pnf))) .connect(pnfURI, serviceInstanceURI); } public void updateOrchestrationStatusPnf(Pnf pnf, OrchestrationStatus orchestrationStatus) { - AAIResourceUri pnfURI = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName()); + AAIResourceUri pnfURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnf.getPnfName())); Pnf pnfCopy = pnf.shallowCopyId(); @@ -72,7 +73,7 @@ public class AAIPnfResources { public void checkIfPnfExistsInAaiAndCanBeUsed(Pnf pnf) throws Exception { Optional<org.onap.aai.domain.yang.Pnf> pnfFromAai = injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class, - AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName())); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnf.getPnfName()))); if (pnfFromAai.isPresent()) { checkIfPnfCanBeUsed(pnfFromAai.get()); updatePnfInAAI(pnf, pnfFromAai.get()); @@ -81,8 +82,8 @@ public class AAIPnfResources { private void updatePnfInAAI(Pnf pnf, org.onap.aai.domain.yang.Pnf pnfFromAai) { updatePnfFields(pnf, pnfFromAai); - injectionHelper.getAaiClient().update(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName()), - pnfFromAai); + injectionHelper.getAaiClient().update( + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnf.getPnfName())), pnfFromAai); logger.debug("updatePnfInAAI: {}", pnfFromAai); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java index 424b3ecefa..cc99f178bd 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java @@ -27,17 +27,17 @@ package org.onap.so.client.orchestration; import java.util.List; import java.util.Optional; import org.onap.aai.domain.yang.OwningEntities; +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.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.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.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; @@ -53,15 +53,16 @@ public class AAIServiceInstanceResources { private AAIObjectMapper aaiObjectMapper; public boolean existsServiceInstance(ServiceInstance serviceInstance) { - AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + AAIResourceUri serviceInstanceURI = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); return injectionHelper.getAaiClient().exists(serviceInstanceURI); } public void createServiceInstance(ServiceInstance serviceInstance, Customer customer) { AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, customer.getGlobalCustomerId(), - customer.getServiceSubscription().getServiceType(), serviceInstance.getServiceInstanceId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId()) + .serviceSubscription(customer.getServiceSubscription().getServiceType()) + .serviceInstance(serviceInstance.getServiceInstanceId())); serviceInstance.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = aaiObjectMapper.mapServiceInstance(serviceInstance); @@ -74,58 +75,63 @@ public class AAIServiceInstanceResources { * @param customer */ public void createServiceSubscription(Customer customer) { - AAIResourceUri serviceSubscriptionURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_SUBSCRIPTION, - customer.getGlobalCustomerId(), customer.getServiceSubscription().getServiceType()); + AAIResourceUri serviceSubscriptionURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId()) + .serviceSubscription(customer.getServiceSubscription().getServiceType())); org.onap.aai.domain.yang.ServiceSubscription serviceSubscription = aaiObjectMapper.mapServiceSubscription(customer.getServiceSubscription()); injectionHelper.getAaiClient().createIfNotExists(serviceSubscriptionURI, Optional.of(serviceSubscription)); } public void deleteServiceInstance(ServiceInstance serviceInstance) { - AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + AAIResourceUri serviceInstanceURI = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); injectionHelper.getAaiClient().delete(serviceInstanceURI); } public void createProject(Project project) { - AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, project.getProjectName()); + AAIResourceUri projectURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().project(project.getProjectName())); org.onap.aai.domain.yang.Project aaiProject = aaiObjectMapper.mapProject(project); injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(aaiProject)); } public void createProjectandConnectServiceInstance(Project project, ServiceInstance serviceInstance) { - AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, project.getProjectName()); - AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + AAIResourceUri projectURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().project(project.getProjectName())); + AAIResourceUri serviceInstanceURI = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); org.onap.aai.domain.yang.Project aaiProject = aaiObjectMapper.mapProject(project); injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(aaiProject)).connect(projectURI, serviceInstanceURI); } public void createOwningEntity(OwningEntity owningEntity) { - AAIResourceUri owningEntityURI = - AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId()); + AAIResourceUri owningEntityURI = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntity.getOwningEntityId())); org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity); injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(aaiOwningEntity)); } public boolean existsOwningEntity(OwningEntity owningEntity) { - AAIResourceUri owningEntityUri = - AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId()); + AAIResourceUri owningEntityUri = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntity.getOwningEntityId())); return injectionHelper.getAaiClient().exists(owningEntityUri); } public boolean existsOwningEntityName(String owningEntityName) { - AAIPluralResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY) - .queryParam("owning-entity-name", owningEntityName); + AAIPluralResourceUri owningEntityUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntities()) + .queryParam("owning-entity-name", owningEntityName); AAIResourcesClient aaiRC = injectionHelper.getAaiClient(); return aaiRC.exists(owningEntityUri); } public org.onap.aai.domain.yang.OwningEntity getOwningEntityByName(String owningEntityName) throws AAIEntityNotFoundException { - AAIPluralResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY) - .queryParam("owning-entity-name", owningEntityName); + AAIPluralResourceUri owningEntityUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntities()) + .queryParam("owning-entity-name", owningEntityName); AAIResourcesClient aaiRC = injectionHelper.getAaiClient(); Optional<OwningEntities> owningEntities = aaiRC.get(OwningEntities.class, owningEntityUri); if (owningEntities.isPresent()) { @@ -142,19 +148,19 @@ public class AAIServiceInstanceResources { } public void connectOwningEntityandServiceInstance(OwningEntity owningEntity, ServiceInstance serviceInstance) { - AAIResourceUri owningEntityURI = - AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId()); - AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + AAIResourceUri owningEntityURI = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntity.getOwningEntityId())); + AAIResourceUri serviceInstanceURI = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); injectionHelper.getAaiClient().connect(owningEntityURI, serviceInstanceURI); } public void createOwningEntityandConnectServiceInstance(OwningEntity owningEntity, ServiceInstance serviceInstance) { - AAIResourceUri owningEntityURI = - AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId()); - AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + AAIResourceUri owningEntityURI = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntity.getOwningEntityId())); + AAIResourceUri serviceInstanceURI = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity); injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(aaiOwningEntity)) .connect(owningEntityURI, serviceInstanceURI); @@ -171,15 +177,15 @@ public class AAIServiceInstanceResources { } public void updateServiceInstance(ServiceInstance serviceInstance) { - AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + AAIResourceUri serviceInstanceURI = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = aaiObjectMapper.mapServiceInstance(serviceInstance); injectionHelper.getAaiClient().update(serviceInstanceURI, aaiServiceInstance); } public boolean checkInstanceServiceNameInUse(ServiceInstance serviceInstance) { - AAIPluralResourceUri uriSI = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE) + AAIPluralResourceUri uriSI = AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCES.getFragment()) .queryParam("service-instance-name", serviceInstance.getServiceInstanceName()); return injectionHelper.getAaiClient().exists(uriSI); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java index d5d0b0868a..72c9b7cc4f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java @@ -23,16 +23,16 @@ package org.onap.so.client.orchestration; import java.util.Optional; +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.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.AAIObjectType; -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.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; @@ -48,23 +48,23 @@ public class AAIVfModuleResources { private AAIObjectMapper aaiObjectMapper; public void createVfModule(VfModule vfModule, GenericVnf vnf) { - AAIResourceUri vfModuleURI = - AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId())); vfModule.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); injectionHelper.getAaiClient().createIfNotExists(vfModuleURI, Optional.of(aaiObjectMapper.mapVfModule(vfModule))); } public void deleteVfModule(VfModule vfModule, GenericVnf vnf) { - AAIResourceUri vfModuleURI = - AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId())); injectionHelper.getAaiClient().delete(vfModuleURI); } public void updateOrchestrationStatusVfModule(VfModule vfModule, GenericVnf vnf, OrchestrationStatus orchestrationStatus) { - AAIResourceUri vfModuleURI = - AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId())); VfModule copiedVfModule = vfModule.shallowCopyId(); vfModule.setOrchestrationStatus(orchestrationStatus); @@ -74,8 +74,8 @@ public class AAIVfModuleResources { } public void updateHeatStackIdVfModule(VfModule vfModule, GenericVnf vnf) { - AAIResourceUri vfModuleURI = - AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId())); VfModule copiedVfModule = vfModule.shallowCopyId(); copiedVfModule.setHeatStackId(vfModule.getHeatStackId()); @@ -84,8 +84,8 @@ public class AAIVfModuleResources { } public void updateContrailServiceInstanceFqdnVfModule(VfModule vfModule, GenericVnf vnf) { - AAIResourceUri vfModuleURI = - AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId())); VfModule copiedVfModule = vfModule.shallowCopyId(); copiedVfModule.setContrailServiceInstanceFqdn(vfModule.getContrailServiceInstanceFqdn()); @@ -94,24 +94,25 @@ public class AAIVfModuleResources { } public void changeAssignVfModule(VfModule vfModule, GenericVnf vnf) { - AAIResourceUri vfModuleURI = - AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId())); org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(vfModule); injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule); } public void connectVfModuleToVolumeGroup(GenericVnf vnf, VfModule vfModule, VolumeGroup volumeGroup, CloudRegion cloudRegion) { - AAIResourceUri vfModuleURI = - AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); - AAIResourceUri volumeGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, - cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId())); + AAIResourceUri volumeGroupURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .volumeGroup(volumeGroup.getVolumeGroupId())); injectionHelper.getAaiClient().connect(vfModuleURI, volumeGroupURI); } public boolean checkNameInUse(VfModule vfModule) { boolean nameInUse = false; - AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE) + AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment()) .queryParam("vf-module-name", vfModule.getVfModuleName()); AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id", vfModule.getModelInfoVfModule().getModelCustomizationUUID()); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java index c2e84f668c..2f48b1f2f5 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java @@ -25,22 +25,22 @@ package org.onap.so.client.orchestration; import java.io.IOException; import java.util.Optional; import org.onap.aai.domain.yang.Vserver; -import org.onap.so.bpmn.common.InjectionHelper; -import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; -import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; -import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; -import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.aai.AAIRestClientImpl; import org.onap.aaiclient.client.aai.AAIValidatorImpl; 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.so.client.aai.mapper.AAIObjectMapper; +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.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -57,37 +57,42 @@ public class AAIVnfResources { private AAIValidatorImpl aaiValidatorImpl = new AAIValidatorImpl(); public void createVnfandConnectServiceInstance(GenericVnf vnf, ServiceInstance serviceInstance) { - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + AAIResourceUri vnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())); vnf.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); - AAIResourceUri serviceInstanceURI = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + AAIResourceUri serviceInstanceURI = AAIUriFactory + .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); injectionHelper.getAaiClient().createIfNotExists(vnfURI, Optional.of(aaiObjectMapper.mapVnf(vnf))) .connect(vnfURI, serviceInstanceURI); } public void createPlatformandConnectVnf(Platform platform, GenericVnf vnf) { AAIResourceUri platformURI = - AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platform.getPlatformName()); - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().platform(platform.getPlatformName())); + AAIResourceUri vnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())); injectionHelper.getAaiClient().createIfNotExists(platformURI, Optional.of(platform)).connect(vnfURI, platformURI); } public void createLineOfBusinessandConnectVnf(LineOfBusiness lineOfBusiness, GenericVnf vnf) { - AAIResourceUri lineOfBusinessURI = - AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness.getLineOfBusinessName()); - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.business().lineOfBusiness(lineOfBusiness.getLineOfBusinessName())); + AAIResourceUri vnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())); injectionHelper.getAaiClient().createIfNotExists(lineOfBusinessURI, Optional.of(lineOfBusiness)).connect(vnfURI, lineOfBusinessURI); } public void deleteVnf(GenericVnf vnf) { - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + AAIResourceUri vnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())); injectionHelper.getAaiClient().delete(vnfURI); } public void updateOrchestrationStatusVnf(GenericVnf vnf, OrchestrationStatus orchestrationStatus) { - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + AAIResourceUri vnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())); GenericVnf copiedVnf = vnf.shallowCopyId(); @@ -97,7 +102,8 @@ public class AAIVnfResources { } public void updateObjectVnf(GenericVnf vnf) { - AAIResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + AAIResourceUri vnfUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())); injectionHelper.getAaiClient().update(vnfUri, aaiObjectMapper.mapVnf(vnf)); } @@ -109,7 +115,7 @@ public class AAIVnfResources { */ public Optional<org.onap.aai.domain.yang.GenericVnf> getGenericVnf(String vnfId) { return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.GenericVnf.class, - AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))); } /** @@ -121,29 +127,32 @@ public class AAIVnfResources { public boolean checkInMaintFlag(String vnfId) { org.onap.aai.domain.yang.GenericVnf vnf = injectionHelper.getAaiClient() .get(org.onap.aai.domain.yang.GenericVnf.class, - AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)) + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))) .orElse(new org.onap.aai.domain.yang.GenericVnf()); return vnf.isInMaint(); } public void connectVnfToCloudRegion(GenericVnf vnf, CloudRegion cloudRegion) { - AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, - cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()); - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())); + AAIResourceUri vnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())); injectionHelper.getAaiClient().connect(vnfURI, cloudRegionURI); } public void connectVnfToTenant(GenericVnf vnf, CloudRegion cloudRegion) { - AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId()); - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .tenant(cloudRegion.getTenantId())); + AAIResourceUri vnfURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())); injectionHelper.getAaiClient().connect(tenantURI, vnfURI); } public boolean checkVnfClosedLoopDisabledFlag(String vnfId) { org.onap.aai.domain.yang.GenericVnf vnf = injectionHelper.getAaiClient() .get(org.onap.aai.domain.yang.GenericVnf.class, - AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)) + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))) .orElse(new org.onap.aai.domain.yang.GenericVnf()); return vnf.isIsClosedLoopDisabled(); } @@ -151,7 +160,7 @@ public class AAIVnfResources { public boolean checkVnfPserversLockedFlag(String vnfId) throws IOException { org.onap.aai.domain.yang.GenericVnf vnf = injectionHelper.getAaiClient() .get(org.onap.aai.domain.yang.GenericVnf.class, - AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)) + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))) .orElse(new org.onap.aai.domain.yang.GenericVnf()); AAIRestClientImpl client = new AAIRestClientImpl(); aaiValidatorImpl.setClient(client); @@ -160,14 +169,14 @@ public class AAIVnfResources { } public boolean checkNameInUse(String vnfName) { - AAIPluralResourceUri vnfUri = - AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName); + AAIPluralResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()) + .queryParam("vnf-name", vnfName); return injectionHelper.getAaiClient().exists(vnfUri); } public AAIResultWrapper queryVnfWrapperById(GenericVnf vnf) { - AAIResourceUri uri = - AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()).depth(Depth.ALL); + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())) + .depth(Depth.ALL); return injectionHelper.getAaiClient().get(uri); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java index 886dafe626..1fbfe8cab0 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java @@ -22,15 +22,15 @@ package org.onap.so.client.orchestration; +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.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.AAIObjectType; -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.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; @@ -46,16 +46,18 @@ public class AAIVolumeGroupResources { private AAIObjectMapper aaiObjectMapper; public void createVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) { - AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, - cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .volumeGroup(volumeGroup.getVolumeGroupId())); volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); injectionHelper.getAaiClient().create(uriVolumeGroup, aaiObjectMapper.mapVolumeGroup(volumeGroup)); } public void updateOrchestrationStatusVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion, OrchestrationStatus orchestrationStatus) { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .volumeGroup(volumeGroup.getVolumeGroupId())); VolumeGroup copiedVolumeGroup = volumeGroup.shallowCopyId(); volumeGroup.setOrchestrationStatus(orchestrationStatus); @@ -65,29 +67,34 @@ public class AAIVolumeGroupResources { public void connectVolumeGroupToVnf(GenericVnf genericVnf, VolumeGroup volumeGroup, CloudRegion cloudRegion) { AAIResourceUri uriGenericVnf = - AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnf.getVnfId()); - AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, - cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnf.getVnfId())); + AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .volumeGroup(volumeGroup.getVolumeGroupId())); injectionHelper.getAaiClient().connect(uriGenericVnf, uriVolumeGroup); } public void connectVolumeGroupToTenant(VolumeGroup volumeGroup, CloudRegion cloudRegion) { - AAIResourceUri uriTenant = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId()); - AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, - cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + AAIResourceUri uriTenant = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .tenant(cloudRegion.getTenantId())); + AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .volumeGroup(volumeGroup.getVolumeGroupId())); injectionHelper.getAaiClient().connect(uriTenant, uriVolumeGroup); } public void deleteVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .volumeGroup(volumeGroup.getVolumeGroupId())); injectionHelper.getAaiClient().delete(uri); } public void updateHeatStackIdVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .volumeGroup(volumeGroup.getVolumeGroupId())); VolumeGroup copiedVolumeGroup = volumeGroup.shallowCopyId(); copiedVolumeGroup.setHeatStackId(volumeGroup.getHeatStackId()); @@ -95,7 +102,7 @@ public class AAIVolumeGroupResources { } public boolean checkNameInUse(VolumeGroup volumeGroup) { - AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP) + AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(Types.VOLUME_GROUPS.getFragment()) .queryParam("volume-group-name", volumeGroup.getVolumeGroupName()); return injectionHelper.getAaiClient().exists(volumeGroupUri); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java index 5ce8268d55..5200be9d65 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java @@ -22,14 +22,13 @@ package org.onap.so.client.orchestration; import java.util.Optional; import org.onap.aai.domain.yang.VpnBindings; -import org.onap.so.bpmn.common.InjectionHelper; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; -import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.AAIObjectType; 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.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -46,8 +45,8 @@ public class AAIVpnBindingResources { * @param customer */ public boolean existsCustomer(Customer customer) { - AAIResourceUri uriCustomer = - AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, customer.getGlobalCustomerId()); + AAIResourceUri uriCustomer = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())); return injectionHelper.getAaiClient().exists(uriCustomer); } @@ -56,8 +55,9 @@ public class AAIVpnBindingResources { * @return */ public Optional<VpnBindings> getVpnBindingByCustomerVpnId(String customerVpnId) { - AAIPluralResourceUri aaiVpnBindingsResourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VPN_BINDING) - .queryParam("customer-vpn-id", customerVpnId); + AAIPluralResourceUri aaiVpnBindingsResourceUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBindings()) + .queryParam("customer-vpn-id", customerVpnId); return injectionHelper.getAaiClient().get(VpnBindings.class, aaiVpnBindingsResourceUri); } @@ -67,7 +67,7 @@ public class AAIVpnBindingResources { */ public void createVpnBinding(VpnBinding vpnBinding) { AAIResourceUri aaiVpnBindingResourceUri = - AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnBinding.getVpnId()); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBinding(vpnBinding.getVpnId())); injectionHelper.getAaiClient().create(aaiVpnBindingResourceUri, aaiObjectMapper.mapVpnBinding(vpnBinding)); } @@ -75,8 +75,8 @@ public class AAIVpnBindingResources { * @param customer */ public void createCustomer(Customer customer) { - AAIResourceUri uriCustomer = - AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, customer.getGlobalCustomerId()); + AAIResourceUri uriCustomer = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())); injectionHelper.getAaiClient().create(uriCustomer, aaiObjectMapper.mapCustomer(customer)); } @@ -88,7 +88,7 @@ public class AAIVpnBindingResources { */ public Optional<org.onap.aai.domain.yang.VpnBinding> getVpnBinding(String vpnId) { return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.VpnBinding.class, - AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId)); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBinding(vpnId))); } @@ -97,8 +97,10 @@ public class AAIVpnBindingResources { * @param vpnId */ public void connectCustomerToVpnBinding(String globalSubscriberId, String vpnId) { - AAIResourceUri customerURI = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId); - AAIResourceUri vpnBindingURI = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId); + AAIResourceUri customerURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId)); + AAIResourceUri vpnBindingURI = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBinding(vpnId)); injectionHelper.getAaiClient().connect(customerURI, vpnBindingURI); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java index d6a28cba25..1cba35dc74 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java @@ -29,16 +29,31 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.cds.ConfigureInstanceParamsForPnf; import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean; import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.PayloadGenerationException; +import org.onap.so.serviceinstancebeans.Service; +import org.onap.so.serviceinstancebeans.Pnfs; +import org.onap.so.serviceinstancebeans.Resources; +import org.onap.so.serviceinstancebeans.ModelInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.when; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.EXECUTION_OBJECT; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.MSO_REQUEST_ID; @@ -51,6 +66,8 @@ public class GenericPnfCDSControllerRunnableBBTest { @Mock private ExtractPojosForBB extractPojosForBB; + @Mock + private ConfigureInstanceParamsForPnf configureInstanceParamsForPnf; @InjectMocks private GenericPnfCDSControllerRunnableBB genericPnfCDSControllerRunnableBB; @@ -67,6 +84,7 @@ public class GenericPnfCDSControllerRunnableBBTest { private final static String serviceModelUUID = "6bc0b04d-1873-4721-b53d-6615225b2a28"; private final static String pnfCustomizationUUID = "9acb3a83-8a52-412c-9a45-901764938144"; private final static String action = "action"; + private static final String GENERAL_BLOCK_EXECUTION_MAP_KEY = "gBBInput"; @Before public void setUp() { @@ -104,7 +122,7 @@ public class GenericPnfCDSControllerRunnableBBTest { } @Test - public void prepareTest() throws BBObjectNotFoundException { + public void prepareTest() throws BBObjectNotFoundException, PayloadGenerationException { // given prepareData(); @@ -119,6 +137,7 @@ public class GenericPnfCDSControllerRunnableBBTest { assertThat(abstractCDSPropertiesBean).isNotNull(); assertThat(abstractCDSPropertiesBean.getRequestObject()).isNotNull(); assertThat(abstractCDSPropertiesBean.getRequestObject()).isInstanceOf(String.class); + assertThat(execution.getGeneralBuildingBlock()).isNotNull(); assertEquals(blueprintName, abstractCDSPropertiesBean.getBlueprintName()); assertEquals(blueprintVersion, abstractCDSPropertiesBean.getBlueprintVersion()); @@ -134,7 +153,7 @@ public class GenericPnfCDSControllerRunnableBBTest { assertEquals(pnfCustomizationUUID, actionProperties.get("pnf-customization-uuid")); } - private void prepareData() throws BBObjectNotFoundException { + private void prepareData() throws BBObjectNotFoundException, PayloadGenerationException { Pnf pnf = new Pnf(); ServiceInstance serviceInstance = new ServiceInstance(); @@ -149,8 +168,62 @@ public class GenericPnfCDSControllerRunnableBBTest { modelInfoServiceInstance.setModelUuid(serviceModelUUID); serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + execution.setVariable(GENERAL_BLOCK_EXECUTION_MAP_KEY, + createGeneralBuildingBlock(createService(createPnfsList()))); when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.PNF))).thenReturn(pnf); when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.SERVICE_INSTANCE_ID))) .thenReturn(serviceInstance); + doNothing().when(configureInstanceParamsForPnf).populateInstanceParams(any(), any(), any()); + } + + private Service createService(List<Pnfs> pnfList) { + Service service = new Service(); + Resources resources = new Resources(); + resources.setPnfs(pnfList); + service.setResources(resources); + return service; + } + + private GeneralBuildingBlock createGeneralBuildingBlock(Object serviceJson) { + GeneralBuildingBlock generalBuildingBlock = new GeneralBuildingBlock(); + RequestContext requestContext = new RequestContext(); + RequestParameters requestParameters = new RequestParameters(); + requestParameters.setUserParams(createRequestUserParams(serviceJson)); + requestContext.setRequestParameters(requestParameters); + generalBuildingBlock.setRequestContext(requestContext); + return generalBuildingBlock; + } + + private List<Map<String, Object>> createRequestUserParams(Object serviceJson) { + List<Map<String, Object>> userParams = new ArrayList<>(); + Map<String, Object> userParamMap = new HashMap<>(); + userParamMap.put("service", serviceJson); + userParams.add(userParamMap); + return userParams; + } + + private List<Pnfs> createPnfsList() { + List<Map<String, String>> instanceParamsListSearchedPnf = new ArrayList<>(); + Map<String, String> instanceParam = new HashMap<>(); + instanceParam.put("INSTANCE_PARAM1_NAME", "INSTANCE_PARAM1_VALUE"); + instanceParam.put("INSTANCE_PARAM2_NAME", "INSTANCE_PARAM2_VALUE"); + Map<String, String> instanceParam2 = new HashMap<>(); + instanceParam2.put("INSTANCE_PARAM3_NAME", "INSTANCE_PARAM3_VALUE"); + instanceParamsListSearchedPnf.add(instanceParam); + instanceParamsListSearchedPnf.add(instanceParam2); + Pnfs searchedPnf = createPnfs("0c1ac643-377e-475b-be50-6be65f91a7ad", instanceParamsListSearchedPnf); + + List<Pnfs> pnfList = new ArrayList<>(); + pnfList.add(searchedPnf); + return pnfList; + } + + private Pnfs createPnfs(String pnfModelCustomizationId, List<Map<String, String>> instanceParamsList) { + Pnfs pnfs = new Pnfs(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid(pnfModelCustomizationId); + pnfs.setModelInfo(modelInfo); + pnfs.setInstanceParams(instanceParamsList); + return pnfs; } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgradeTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgradeTest.java new file mode 100644 index 0000000000..67f08f7108 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgradeTest.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.service.level.impl; + +import static org.assertj.core.api.Assertions.assertThat; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.junit.Test; + +public class ServiceLevelUpgradeTest { + + @Test + public void ServiceLevelUpgradeWithPnf() throws Exception { + // given + ServiceLevelUpgrade testedObject = new ServiceLevelUpgrade(); + DelegateExecution execution = prepareExecution(); + execution.setVariable(ServiceLevelConstants.RESOURCE_TYPE, "pnf"); + // when + testedObject.execute(execution); + // then + assertThat(execution.getVariable(ServiceLevelConstants.SOFTWARE_WORKFLOW_TO_INVOKE)) + .isEqualTo("GenericPnfSoftwareUpgrade"); + assertThat(execution.getVariable(ServiceLevelConstants.CONTROLLER_STATUS)).isEqualTo(""); + } + + @Test + public void ServiceLevelUpgradeWithVnf() throws Exception { + // given + ServiceLevelUpgrade testedObject = new ServiceLevelUpgrade(); + DelegateExecution execution = prepareExecution(); + execution.setVariable(ServiceLevelConstants.RESOURCE_TYPE, "vnf"); + // when + testedObject.execute(execution); + // then + assertThat(execution.getVariable(ServiceLevelConstants.SOFTWARE_WORKFLOW_TO_INVOKE)) + .isEqualTo("GenericVnfSoftwareUpgrade"); + assertThat(execution.getVariable(ServiceLevelConstants.CONTROLLER_STATUS)).isEqualTo(""); + } + + private DelegateExecution prepareExecution() { + DelegateExecution execution = new DelegateExecutionFake(); + execution.setVariable(ServiceLevelConstants.SERVICE_INSTANCE_ID, "serviceTest"); + execution.setVariable(ServiceLevelConstants.BPMN_REQUEST, "bpmnRequestTest"); + execution.setVariable(ServiceLevelConstants.PNF_NAME, "pnfNameTest"); + return execution; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/vfmodule/DeleteVfModuleTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/vfmodule/DeleteVfModuleTest.java new file mode 100644 index 0000000000..60a0bf12d9 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/vfmodule/DeleteVfModuleTest.java @@ -0,0 +1,125 @@ +/*- + * ============LICENSE_START======================================================= + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.vfmodule; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.when; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.cloud.resource.beans.CloudInformation; + +@RunWith(MockitoJUnitRunner.class) +public class DeleteVfModuleTest { + + private static final String VF_MODULE_ID = "vfModuleIdTest"; + private static final String HEAT_STACK_ID = "hsId"; + private static final String VNF_ID = "vnfId"; + private static final String VNF_NAME = "vnfName"; + + private static final String CLOUD_OWNER = "cloudOwTest"; + private static final String LCP_CLOUD_REGION_ID = "lcpClRegTest"; + private static final String TENANT_ID = "tenantIdTest"; + private static final String TENANT_NAME = "tenantNameTest"; + private static final String TENANT_CONTEXT = "tenantContext"; + + @Mock + private ExtractPojosForBB extractPojosForBB; + + @InjectMocks + private DeleteVFModule testedObject; + + @Test + public void createInventoryVariable_Success() throws BBObjectNotFoundException { + // given + BuildingBlockExecution buildingBlockExecution = prepareBuildingBlockExecution(); + when(extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.VF_MODULE_ID)) + .thenReturn(prepareVmModule()); + when(extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.GENERIC_VNF_ID)) + .thenReturn(prepareGenericVnf()); + // when + testedObject.createInventoryVariable(buildingBlockExecution); + // then + verifyExecution(buildingBlockExecution); + } + + private void verifyExecution(BuildingBlockExecution buildingBlockExecution) { + CloudInformation cloudInformation = buildingBlockExecution.getVariable("cloudInformation"); + assertThat(cloudInformation.getOwner()).isEqualTo(CLOUD_OWNER); + assertThat(cloudInformation.getRegionId()).isEqualTo(LCP_CLOUD_REGION_ID); + assertThat(cloudInformation.getTenantId()).isEqualTo(TENANT_ID); + assertThat(cloudInformation.getTenantName()).isEqualTo(TENANT_NAME); + assertThat(cloudInformation.getTenantContext()).isEqualTo(TENANT_CONTEXT); + assertThat(cloudInformation.getTemplateInstanceId()).isEqualTo(HEAT_STACK_ID); + + assertThat(cloudInformation.getVnfId()).isEqualTo(VNF_ID); + assertThat(cloudInformation.getVnfName()).isEqualTo(VNF_NAME); + assertThat(cloudInformation.getVfModuleId()).isEqualTo(VF_MODULE_ID); + } + + private BuildingBlockExecution prepareBuildingBlockExecution() { + DelegateExecution execution = new DelegateExecutionFake(); + execution.setVariable("gBBInput", prepareGeneralBuildingBlock()); + return new DelegateExecutionImpl(execution); + } + + private GeneralBuildingBlock prepareGeneralBuildingBlock() { + GeneralBuildingBlock generalBuildingBlock = new GeneralBuildingBlock(); + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setCloudOwner(CLOUD_OWNER); + cloudRegion.setLcpCloudRegionId(LCP_CLOUD_REGION_ID); + generalBuildingBlock.setCloudRegion(cloudRegion); + Tenant tenant = new Tenant(); + tenant.setTenantId(TENANT_ID); + tenant.setTenantName(TENANT_NAME); + tenant.setTenantContext(TENANT_CONTEXT); + generalBuildingBlock.setTenant(tenant); + return generalBuildingBlock; + } + + private VfModule prepareVmModule() { + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId(VF_MODULE_ID); + vfModule.setHeatStackId(HEAT_STACK_ID); + return vfModule; + } + + private GenericVnf prepareGenericVnf() { + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId(VNF_ID); + genericVnf.setVnfName(VNF_NAME); + return genericVnf; + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java index d9fb7f676c..7f9f0417ea 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java @@ -41,10 +41,10 @@ import org.onap.aai.domain.yang.RouteTargets; import org.onap.aai.domain.yang.Subnet; import org.onap.aai.domain.yang.Subnets; import org.onap.aai.domain.yang.VpnBinding; -import org.onap.so.bpmn.BaseTaskTest; -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.generated.fluentbuilders.AAIFluentTypeBuilder.Types; +import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization; @@ -205,7 +205,7 @@ public class VrfValidationTest extends BaseTaskTest { AAIResultWrapper networkWrapper = new AAIResultWrapper(l3Network); if (networkWrapper.getRelationships().isPresent()) { List<AAIResourceUri> vpnBindingUris = - networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING); + networkWrapper.getRelationships().get().getRelatedUris(Types.VPN_BINDING); VpnBinding vpnBinding = new VpnBinding(); vpnBinding.setRouteTargets(new RouteTargets()); vpnBinding.getRouteTargets().getRouteTarget().add(new RouteTarget()); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java index c1970ec32c..53d1bea1f2 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -39,7 +39,6 @@ import static org.mockito.ArgumentMatchers.anyObject; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; -import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.when; @@ -78,12 +77,12 @@ import org.onap.aai.domain.yang.ServiceInstances; import org.onap.aai.domain.yang.VfModule; import org.onap.aai.domain.yang.VfModules; import org.onap.aai.domain.yang.VolumeGroup; -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.BaseTaskTest; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; @@ -1584,11 +1583,11 @@ public class WorkflowActionTest extends BaseTaskTest { when(bbSetupUtils.getAAIVfModule(any(), any())).thenReturn(vfModule); doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(any(), any(), - eq(org.onap.aai.domain.yang.Vnfc.class), eq(AAIObjectType.VNFC)); + eq(org.onap.aai.domain.yang.Vnfc.class), eq(Types.VNFC)); doReturn(config1).when(SPY_workflowAction).getRelatedResourcesInVnfc(eq(vnfc1), - eq(org.onap.aai.domain.yang.Configuration.class), eq(AAIObjectType.CONFIGURATION)); + eq(org.onap.aai.domain.yang.Configuration.class), eq(Types.CONFIGURATION)); doReturn(config2).when(SPY_workflowAction).getRelatedResourcesInVnfc(eq(vnfc2), - eq(org.onap.aai.domain.yang.Configuration.class), eq(AAIObjectType.CONFIGURATION)); + eq(org.onap.aai.domain.yang.Configuration.class), eq(Types.CONFIGURATION)); List<ExecuteBuildingBlock> results = SPY_workflowAction.getConfigBuildingBlocks(dataObj); @@ -1659,11 +1658,11 @@ public class WorkflowActionTest extends BaseTaskTest { when(bbSetupUtils.getAAIVfModule(any(), any())).thenReturn(vfModule); doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(any(), any(), - eq(org.onap.aai.domain.yang.Vnfc.class), eq(AAIObjectType.VNFC)); + eq(org.onap.aai.domain.yang.Vnfc.class), eq(Types.VNFC)); doReturn(config1).when(SPY_workflowAction).getRelatedResourcesInVnfc(eq(vnfc1), - eq(org.onap.aai.domain.yang.Configuration.class), eq(AAIObjectType.CONFIGURATION)); + eq(org.onap.aai.domain.yang.Configuration.class), eq(Types.CONFIGURATION)); doReturn(config2).when(SPY_workflowAction).getRelatedResourcesInVnfc(eq(vnfc2), - eq(org.onap.aai.domain.yang.Configuration.class), eq(AAIObjectType.CONFIGURATION)); + eq(org.onap.aai.domain.yang.Configuration.class), eq(Types.CONFIGURATION)); List<ExecuteBuildingBlock> results = SPY_workflowAction.getConfigBuildingBlocks(dataObj); @@ -1763,13 +1762,13 @@ public class WorkflowActionTest extends BaseTaskTest { List<AAIResultWrapper> configurationResultWrappers = new ArrayList<AAIResultWrapper>(); configurationResultWrappers.add(configurationWrapper); - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfc.getVnfcName()); + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfc.getVnfcName())); when(bbSetupUtils.getAAIResourceDepthOne(uri)).thenReturn(vfncWrapper); doReturn(configurationResultWrappers).when(SPY_workflowAction).getResultWrappersFromRelationships(anyObject(), anyObject()); org.onap.aai.domain.yang.Configuration configuration = SPY_workflowAction.getRelatedResourcesInVnfc(vnfc, - org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION); + org.onap.aai.domain.yang.Configuration.class, Types.CONFIGURATION); assertEquals("testConfigurationId", configuration.getConfigurationId()); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java index 2c7ab92438..fcd44e137b 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java @@ -28,18 +28,11 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; import org.onap.so.bpmn.BaseTaskTest; -import org.onap.so.bpmn.common.InjectionHelper; -import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.aai.AAIResourcesClient; -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; public class AAICollectionResourcesTest extends BaseTaskTest { @@ -65,7 +58,8 @@ public class AAICollectionResourcesTest extends BaseTaskTest { assertEquals(OrchestrationStatus.INVENTORIED, networkCollection.getOrchestrationStatus()); verify(MOCK_aaiResourcesClient, times(1)).create( - eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId())), + eq(AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId()))), isA(org.onap.aai.domain.yang.Collection.class)); } @@ -74,15 +68,16 @@ public class AAICollectionResourcesTest extends BaseTaskTest { doReturn(new org.onap.aai.domain.yang.Collection()).when(MOCK_aaiObjectMapper).mapCollection(networkCollection); aaiCollectionResources.updateCollection(networkCollection); verify(MOCK_aaiResourcesClient, times(1)).update( - eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId())), + eq(AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId()))), isA(org.onap.aai.domain.yang.Collection.class)); } @Test public void deleteCollectionTest() throws Exception { aaiCollectionResources.deleteCollection(networkCollection); - verify(MOCK_aaiResourcesClient, times(1)) - .delete(eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId()))); + verify(MOCK_aaiResourcesClient, times(1)).delete(eq( + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId())))); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java index 2bf177ef83..11694ff83f 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java @@ -35,6 +35,11 @@ import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; +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.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; @@ -44,11 +49,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.aai.AAIResourcesClient; -import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; @@ -204,7 +204,8 @@ public class AAIConfigurationResourcesTest extends TestDataSetup { @Test public void getConfigurationTest() { - AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "configurationId"); + AAIResourceUri aaiResourceUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration("configurationId")); doReturn(Optional.of(new org.onap.aai.domain.yang.Configuration())).when(MOCK_aaiResourcesClient) .get(org.onap.aai.domain.yang.Configuration.class, aaiResourceUri); aaiConfigurationResources.getConfiguration("configurationId"); @@ -213,7 +214,8 @@ public class AAIConfigurationResourcesTest extends TestDataSetup { @Test public void deleteConfigurationTest() { - AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "configurationId"); + AAIResourceUri aaiResourceUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration("configurationId")); doNothing().when(MOCK_aaiResourcesClient).delete(aaiResourceUri); aaiConfigurationResources.deleteConfiguration("configurationId"); verify(MOCK_aaiResourcesClient, times(1)).delete(aaiResourceUri); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java index a73cf81e75..b2978e6e62 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java @@ -36,18 +36,17 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; -import org.onap.so.bpmn.common.InjectionHelper; -import org.onap.so.bpmn.common.data.TestDataSetup; -import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; -import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; -import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.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.AAIEdgeLabel; 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.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.client.aai.mapper.AAIObjectMapper; @RunWith(MockitoJUnitRunner.Silent.class) @@ -83,39 +82,42 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup { .mapInstanceGroup(instanceGroup); aaiInstanceGroupResources.createInstanceGroup(instanceGroup); verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists( - eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())), + eq(AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))), isA(Optional.class)); } @Test public void deleteInstanceGroupTest() throws Exception { aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup); - verify(MOCK_aaiResourcesClient, times(1)) - .delete(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()))); + verify(MOCK_aaiResourcesClient, times(1)).delete(eq( + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())))); } @Test public void connectInstanceGroupTest() throws Exception { aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf); verify(MOCK_aaiResourcesClient, times(1)).connect( - eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())), - eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()))); + eq(AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))), + eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())))); } @Test public void connectInstanceGroupWithEdgeTest() throws Exception { aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf, AAIEdgeLabel.BELONGS_TO); verify(MOCK_aaiResourcesClient, times(1)).connect( - eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())), - eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId())), + eq(AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))), + eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()))), eq(AAIEdgeLabel.BELONGS_TO)); } @Test public void existsTest() throws Exception { aaiInstanceGroupResources.exists(instanceGroup); - verify(MOCK_aaiResourcesClient, times(1)) - .exists(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()))); + verify(MOCK_aaiResourcesClient, times(1)).exists(eq( + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())))); } @Test @@ -135,7 +137,7 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup { @Test public void checkInstanceGroupNameInUseTrueTest() throws Exception { - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroups()) .queryParam("instance-group-name", "instanceGroupName"); doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri)); boolean nameInUse = aaiInstanceGroupResources.checkInstanceGroupNameInUse("instanceGroupName"); @@ -144,7 +146,7 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup { @Test public void checkInstanceGroupNameInUseFalseTest() throws Exception { - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroups()) .queryParam("instance-group-name", "instanceGroupName"); doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri)); boolean nameInUse = aaiInstanceGroupResources.checkInstanceGroupNameInUse("instanceGroupName"); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java index 3bc4fc0503..535a159e10 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java @@ -46,6 +46,14 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.onap.aai.domain.yang.RouteTableReference; import org.onap.aai.domain.yang.VpnBinding; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +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.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @@ -55,15 +63,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; -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.AAIEdgeLabel; -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; -import org.onap.aaiclient.client.aai.entities.Relationships; -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.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; @@ -167,7 +166,8 @@ public class AAINetworkResourcesTest extends TestDataSetup { new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiVpnBinding.json"))); AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); Optional<VpnBinding> oVpnBinding = Optional.empty(); - AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, "ModelInvariantUUID"); + AAIResourceUri aaiUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBinding("ModelInvariantUUID")); doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); oVpnBinding = aaiNetworkResources.getVpnBinding(aaiUri); @@ -186,7 +186,7 @@ public class AAINetworkResourcesTest extends TestDataSetup { AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy = Optional.empty(); AAIResourceUri netPolicyUri = - AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, "ModelInvariantUUID"); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy("ModelInvariantUUID")); doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); oNetPolicy = aaiNetworkResources.getNetworkPolicy(netPolicyUri); @@ -204,7 +204,8 @@ public class AAINetworkResourcesTest extends TestDataSetup { new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPolicies.json"))); AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); Optional<org.onap.aai.domain.yang.NetworkPolicies> oNetPolicies = Optional.empty(); - AAIPluralResourceUri netPoliciesUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY); + AAIPluralResourceUri netPoliciesUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies()); doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIPluralResourceUri.class)); oNetPolicies = aaiNetworkResources.getNetworkPolicies(netPoliciesUri); @@ -222,8 +223,8 @@ public class AAINetworkResourcesTest extends TestDataSetup { new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkTableRefs.json"))); AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); Optional<RouteTableReference> oRtref = Optional.empty(); - AAIResourceUri rTRefUri = - AAIUriFactory.createResourceUri(AAIObjectType.ROUTE_TABLE_REFERENCE, "ModelInvariantUUID"); + AAIResourceUri rTRefUri = AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().routeTableReference("ModelInvariantUUID")); doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); oRtref = aaiNetworkResources.getRouteTable(rTRefUri); @@ -310,41 +311,45 @@ public class AAINetworkResourcesTest extends TestDataSetup { public void connectNetworkToNetworkCollectionInstanceGroupTest() throws Exception { aaiNetworkResources.connectNetworkToNetworkCollectionInstanceGroup(network, instanceGroup); verify(MOCK_aaiResourcesClient, times(1)).connect( - eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())), - eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()))); + eq(AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))), + eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId())))); } @Test public void connectNetworkToNetworkCollectionServiceInstanceTest() throws Exception { aaiNetworkResources.connectNetworkToNetworkCollectionServiceInstance(network, serviceInstance); verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), - eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()))); + eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId())))); } @Test public void connectNetworkToCloudRegionTest() throws Exception { aaiNetworkResources.connectNetworkToCloudRegion(network, cloudRegion); verify(MOCK_aaiResourcesClient, times(1)).connect( - eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId())), - eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId()))); + eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()))), + eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())))); } @Test public void connectNetworkToTenantTest() throws Exception { aaiNetworkResources.connectNetworkToTenant(network, cloudRegion); verify(MOCK_aaiResourcesClient, times(1)).connect( - eq(AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId())), - eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()))); + eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .tenant(cloudRegion.getTenantId()))), + (eq(AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()))))); } @Test public void connectNetworkCollectionInstanceGroupToNetworkCollectionTest() throws Exception { aaiNetworkResources.connectNetworkCollectionInstanceGroupToNetworkCollection(instanceGroup, collection); verify(MOCK_aaiResourcesClient, times(1)).connect( - eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId())), - eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()))); + eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(collection.getId()))), + eq(AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())))); } @Test @@ -384,9 +389,10 @@ public class AAINetworkResourcesTest extends TestDataSetup { public void connectInstanceGroupToCloudRegionTest() throws Exception { aaiNetworkResources.connectInstanceGroupToCloudRegion(instanceGroup, cloudRegion); verify(MOCK_aaiResourcesClient, times(1)).connect( - eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())), - eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId())), + eq(AAIUriFactory + .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))), + eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()))), eq(AAIEdgeLabel.USES)); } @@ -396,8 +402,8 @@ public class AAINetworkResourcesTest extends TestDataSetup { new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiSubnetsMapped_to_aai.json"))); AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); Optional<org.onap.aai.domain.yang.Subnet> oSubnet = Optional.empty(); - AAIResourceUri subnetUri = - AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, "ModelInvariantUUID", "serviceModelVersionId"); + AAIResourceUri subnetUri = AAIUriFactory.createResourceUri( + AAIFluentTypeBuilder.network().l3Network("ModelInvariantUUID").subnet("serviceModelVersionId")); doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); oSubnet = aaiNetworkResources.getSubnet(subnetUri); @@ -429,8 +435,8 @@ public class AAINetworkResourcesTest extends TestDataSetup { @Test public void checkInstanceGroupNameInUseTrueTest() throws Exception { - AAIPluralResourceUri uri = - AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "networkName"); + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Networks()) + .queryParam("network-name", "networkName"); doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri)); boolean nameInUse = aaiNetworkResources.checkNetworkNameInUse("networkName"); assertTrue(nameInUse); @@ -438,8 +444,8 @@ public class AAINetworkResourcesTest extends TestDataSetup { @Test public void checkInstanceGroupNameInUseFalseTest() throws Exception { - AAIPluralResourceUri uri = - AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "networkName"); + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Networks()) + .queryParam("network-name", "networkName"); doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri)); boolean nameInUse = aaiNetworkResources.checkNetworkNameInUse("networkName"); assertFalse(nameInUse); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java index b8be045f97..8547ea53b4 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java @@ -32,25 +32,25 @@ import static org.mockito.Mockito.when; import java.io.File; import java.io.IOException; import java.util.Optional; -import com.fasterxml.jackson.databind.ObjectMapper; -import joptsimple.internal.Strings; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; -import org.onap.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.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.aaiclient.client.aai.AAIResourcesClient; -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; +import com.fasterxml.jackson.databind.ObjectMapper; +import joptsimple.internal.Strings; @RunWith(MockitoJUnitRunner.Silent.class) public class AAIPnfResourcesTest extends TestDataSetup { @@ -118,7 +118,8 @@ public class AAIPnfResourcesTest extends TestDataSetup { Pnf pnfTest = createPnfWithDefaultName(); org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(OrchestrationStatus.INVENTORIED.toString()); when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class, - AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai)); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME)))) + .thenReturn(Optional.of(pnfFromAai)); // when testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest); verify(aaiResourcesClientMock, times(1)).update(any(), any()); @@ -131,7 +132,8 @@ public class AAIPnfResourcesTest extends TestDataSetup { org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(null); pnfTest.setRole("test"); when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class, - AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai)); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME)))) + .thenReturn(Optional.of(pnfFromAai)); // when testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest); verify(aaiResourcesClientMock, times(1)).update(any(), eq(pnfFromAai)); @@ -143,7 +145,8 @@ public class AAIPnfResourcesTest extends TestDataSetup { org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(null); Pnf pnfTest = getPnfWithTestValues(); when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class, - AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai)); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME)))) + .thenReturn(Optional.of(pnfFromAai)); // when testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest); verify(aaiResourcesClientMock, times(1)).update(any(), eq(pnfFromAai)); @@ -181,7 +184,8 @@ public class AAIPnfResourcesTest extends TestDataSetup { Pnf pnfTest = createPnfWithDefaultName(); org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(Strings.EMPTY); when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class, - AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai)); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME)))) + .thenReturn(Optional.of(pnfFromAai)); // when testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest); } @@ -192,7 +196,8 @@ public class AAIPnfResourcesTest extends TestDataSetup { Pnf pnfTest = createPnfWithDefaultName(); org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(OrchestrationStatus.ACTIVE.toString()); when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class, - AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai)); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME)))) + .thenReturn(Optional.of(pnfFromAai)); // when try { testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest); @@ -216,7 +221,8 @@ public class AAIPnfResourcesTest extends TestDataSetup { org.onap.aai.domain.yang.Pnf pnfFromAai = new ObjectMapper().readValue(new File(path), org.onap.aai.domain.yang.Pnf.class); when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class, - AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai)); + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME)))) + .thenReturn(Optional.of(pnfFromAai)); // when try { testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java index 9f9ac88c3c..8ccb46257d 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java @@ -39,6 +39,11 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; +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.Types; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; @@ -46,11 +51,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -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.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; @@ -195,7 +195,7 @@ public class AAIServiceInstanceResourcesTest extends TestDataSetup { @Test public void checkInstanceServiceNameInUseTrueTest() throws Exception { - AAIPluralResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE) + AAIPluralResourceUri uri = AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCES.getFragment()) .queryParam("service-instance-name", serviceInstance.getServiceInstanceName()); doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri)); boolean nameInUse = aaiServiceInstanceResources.checkInstanceServiceNameInUse(serviceInstance); @@ -204,7 +204,7 @@ public class AAIServiceInstanceResourcesTest extends TestDataSetup { @Test public void checkInstanceServiceNameInUseFalseTest() throws Exception { - AAIPluralResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE) + AAIPluralResourceUri uri = AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCES.getFragment()) .queryParam("service-instance-name", serviceInstance.getServiceInstanceName()); doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri)); boolean nameInUse = aaiServiceInstanceResources.checkInstanceServiceNameInUse(serviceInstance); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java index 3dbacd2679..7cc628266b 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java @@ -38,17 +38,17 @@ import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; +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.Types; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -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.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; @@ -163,7 +163,7 @@ public class AAIVfModuleResourcesTest extends TestDataSetup { @Test public void checkNameInUseTrueTest() throws Exception { - AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE) + AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment()) .queryParam("vf-module-name", vfModule.getVfModuleName()); AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id", vfModule.getModelInfoVfModule().getModelCustomizationUUID()); @@ -175,7 +175,7 @@ public class AAIVfModuleResourcesTest extends TestDataSetup { @Test public void checkNameInUseFalseIsResumeTest() throws Exception { - AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE) + AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment()) .queryParam("vf-module-name", vfModule.getVfModuleName()); AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id", vfModule.getModelInfoVfModule().getModelCustomizationUUID()); @@ -186,7 +186,7 @@ public class AAIVfModuleResourcesTest extends TestDataSetup { @Test public void checkNameInUseFalseTest() throws Exception { - AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE) + AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment()) .queryParam("vf-module-name", vfModule.getVfModuleName()); AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id", vfModule.getModelInfoVfModule().getModelCustomizationUUID()); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java index 7750c8ad90..bdde1a1237 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java @@ -43,15 +43,6 @@ import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; -import org.onap.so.bpmn.common.InjectionHelper; -import org.onap.so.bpmn.common.data.TestDataSetup; -import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; -import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; -import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; -import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.aai.AAIResourcesClient; import org.onap.aaiclient.client.aai.AAIRestClientImpl; import org.onap.aaiclient.client.aai.AAIValidatorImpl; @@ -59,8 +50,16 @@ 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.so.client.aai.mapper.AAIObjectMapper; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; @RunWith(MockitoJUnitRunner.Silent.class) @@ -197,18 +196,19 @@ public class AAIVnfResourcesTest extends TestDataSetup { public void connectVnfToTenantTest() throws Exception { aaiVnfResources.connectVnfToTenant(genericVnf, cloudRegion); verify(MOCK_aaiResourcesClient, times(1)).connect( - eq(AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId())), - eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnf.getVnfId()))); + eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()) + .tenant(cloudRegion.getTenantId()))), + eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnf.getVnfId())))); } @Test public void connectVnfToCloudRegionTest() throws Exception { aaiVnfResources.connectVnfToCloudRegion(genericVnf, cloudRegion); verify(MOCK_aaiResourcesClient, times(1)).connect( - eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnf.getVnfId())), - eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId()))); + eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnf.getVnfId()))), + eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())))); } @@ -244,8 +244,8 @@ public class AAIVnfResourcesTest extends TestDataSetup { @Test public void checkNameInUseTrueTest() { - AAIPluralResourceUri vnfUri = - AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "vnfName"); + AAIPluralResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()) + .queryParam("vnf-name", "vnfName"); doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(vnfUri)); boolean nameInUse = aaiVnfResources.checkNameInUse("vnfName"); assertTrue(nameInUse); @@ -253,8 +253,8 @@ public class AAIVnfResourcesTest extends TestDataSetup { @Test public void checkNameInUseFalseTest() { - AAIPluralResourceUri vnfUri = - AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "vnfName"); + AAIPluralResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()) + .queryParam("vnf-name", "vnfName"); doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(vnfUri)); boolean nameInUse = aaiVnfResources.checkNameInUse("vnfName"); assertFalse(nameInUse); @@ -262,7 +262,8 @@ public class AAIVnfResourcesTest extends TestDataSetup { @Test public void queryVnfWrapperByIdTest() throws Exception { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId").depth(Depth.ALL); + AAIResourceUri uri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")).depth(Depth.ALL); final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiGenericVnf.json"))); GenericVnf genericVnf = new GenericVnf(); genericVnf.setVnfId("vnfId"); @@ -279,8 +280,8 @@ public class AAIVnfResourcesTest extends TestDataSetup { new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiVserverQueryResponse.json"))); AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); Optional<org.onap.aai.domain.yang.Vserver> oVserver = Optional.empty(); - AAIResourceUri vserverUri = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, "ModelInvariantUUID", - "serviceModelVersionId", "abc", "abc"); + AAIResourceUri vserverUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion("ModelInvariantUUID", "serviceModelVersionId").tenant("abc").vserver("abc")); doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); oVserver = aaiVnfResources.getVserver(vserverUri); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java index 0eae6a3fdc..ada59721fe 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java @@ -37,16 +37,16 @@ import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; +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.Types; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; -import org.onap.aaiclient.client.aai.AAIObjectPlurals; -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.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; @@ -155,7 +155,7 @@ public class AAIVolumeGroupResourcesTest extends TestDataSetup { @Test public void checkNameInUseTrueTest() { - AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP) + AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(Types.VOLUME_GROUPS.getFragment()) .queryParam("volume-group-name", "testVolumeGroupName1"); doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(volumeGroupUri)); boolean nameInUse = aaiVolumeGroupResources.checkNameInUse(volumeGroup); @@ -164,7 +164,7 @@ public class AAIVolumeGroupResourcesTest extends TestDataSetup { @Test public void checkNameInUseFalseTest() { - AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP) + AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(Types.VOLUME_GROUPS.getFragment()) .queryParam("volume-group-name", "testVolumeGroupName1"); doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(volumeGroupUri)); boolean nameInUse = aaiVolumeGroupResources.checkNameInUse(volumeGroup); |