diff options
38 files changed, 1198 insertions, 829 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index 94517ccc45..a08206b477 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -628,11 +628,12 @@ public class ToscaResourceInstaller { protected void processNetworks(ToscaResourceStructure toscaResourceStruct, Service service) throws ArtifactInstallerException { - List<NodeTemplate> nodeTemplatesVLList = toscaResourceStruct.getSdcCsarHelper().getServiceVlList(); - if (nodeTemplatesVLList != null) { - for (NodeTemplate vlNode : nodeTemplatesVLList) { - String networkResourceModelName = vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME); + List<IEntityDetails> vlEntityList = getEntityDetails(toscaResourceStruct, SdcTypes.VL, SdcTypes.SERVICE); + + if (vlEntityList != null) { + for (IEntityDetails vlEntity : vlEntityList) { + String networkResourceModelName = vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME); TempNetworkHeatTemplateLookup tempNetworkLookUp = tempNetworkLookupRepo.findFirstBynetworkResourceModelName(networkResourceModelName); @@ -641,7 +642,7 @@ public class ToscaResourceInstaller { HeatTemplate heatTemplate = heatRepo.findByArtifactUuid(tempNetworkLookUp.getHeatTemplateArtifactUuid()); if (heatTemplate != null) { - NetworkResourceCustomization networkCustomization = createNetwork(vlNode, toscaResourceStruct, + NetworkResourceCustomization networkCustomization = createNetwork(vlEntity, toscaResourceStruct, heatTemplate, tempNetworkLookUp.getAicVersionMax(), tempNetworkLookUp.getAicVersionMin(), service); service.getNetworkCustomizations().add(networkCustomization); @@ -651,7 +652,7 @@ public class ToscaResourceInstaller { } } else { NetworkResourceCustomization networkCustomization = - createNetwork(vlNode, toscaResourceStruct, null, null, null, service); + createNetwork(vlEntity, toscaResourceStruct, null, null, null, service); service.getNetworkCustomizations().add(networkCustomization); logger.debug("No NetworkResourceName found in TempNetworkHeatTemplateLookup for " + networkResourceModelName); @@ -1493,13 +1494,13 @@ public class ToscaResourceInstaller { return cvnfcCustomization; } - protected NetworkResourceCustomization createNetwork(NodeTemplate networkNodeTemplate, + protected NetworkResourceCustomization createNetwork(IEntityDetails networkEntity, ToscaResourceStructure toscaResourceStructure, HeatTemplate heatTemplate, String aicMax, String aicMin, Service service) { NetworkResourceCustomization networkResourceCustomization = networkCustomizationRepo.findOneByModelCustomizationUUID( - networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); boolean networkUUIDsMatch = true; // Check to make sure the NetworkResourceUUID on the Customization record matches the NetworkResourceUUID from @@ -1507,8 +1508,7 @@ public class ToscaResourceInstaller { // If not we'll update the Customization record with latest from the distribution if (networkResourceCustomization != null) { String existingNetworkModelUUID = networkResourceCustomization.getNetworkResource().getModelUUID(); - String latestNetworkModelUUID = - networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID); + String latestNetworkModelUUID = networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID); if (!existingNetworkModelUUID.equals(latestNetworkModelUUID)) { networkUUIDsMatch = false; @@ -1519,7 +1519,7 @@ public class ToscaResourceInstaller { if (networkResourceCustomization != null && !networkUUIDsMatch) { NetworkResource networkResource = - createNetworkResource(networkNodeTemplate, toscaResourceStructure, heatTemplate, aicMax, aicMin); + createNetworkResource(networkEntity, toscaResourceStructure, heatTemplate, aicMax, aicMin); networkResourceCustomization.setNetworkResource(networkResource); @@ -1527,14 +1527,13 @@ public class ToscaResourceInstaller { } else if (networkResourceCustomization == null) { - networkResourceCustomization = - createNetworkResourceCustomization(networkNodeTemplate, toscaResourceStructure); + networkResourceCustomization = createNetworkResourceCustomization(networkEntity, toscaResourceStructure); NetworkResource networkResource = findExistingNetworkResource(service, - networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); if (networkResource == null) - networkResource = createNetworkResource(networkNodeTemplate, toscaResourceStructure, heatTemplate, - aicMax, aicMin); + networkResource = + createNetworkResource(networkEntity, toscaResourceStructure, heatTemplate, aicMax, aicMin); networkResource.addNetworkResourceCustomization(networkResourceCustomization); networkResourceCustomization.setNetworkResource(networkResource); @@ -1557,31 +1556,34 @@ public class ToscaResourceInstaller { return networkResource; } - protected NetworkResourceCustomization createNetworkResourceCustomization(NodeTemplate networkNodeTemplate, + protected NetworkResourceCustomization createNetworkResourceCustomization(IEntityDetails networkEntity, ToscaResourceStructure toscaResourceStructure) { NetworkResourceCustomization networkResourceCustomization = new NetworkResourceCustomization(); networkResourceCustomization.setModelInstanceName( - testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); + testNull(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); networkResourceCustomization.setModelCustomizationUUID( - testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); + testNull(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); networkResourceCustomization.setNetworkTechnology( - testNull(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate, - SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY))); - networkResourceCustomization.setNetworkType(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE))); - networkResourceCustomization.setNetworkRole(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE))); - networkResourceCustomization.setNetworkScope(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE))); + getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY)); + + networkResourceCustomization + .setNetworkType(getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE)); + + networkResourceCustomization + .setNetworkRole(getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE)); + + networkResourceCustomization + .setNetworkScope(getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE)); + return networkResourceCustomization; } - protected NetworkResource createNetworkResource(NodeTemplate networkNodeTemplate, + protected NetworkResource createNetworkResource(IEntityDetails vlEntity, ToscaResourceStructure toscaResourceStructure, HeatTemplate heatTemplate, String aicMax, String aicMin) { NetworkResource networkResource = new NetworkResource(); - String providerNetwork = toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue( - networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK); + String providerNetwork = + getLeafPropertyValue(vlEntity, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK); if ("true".equalsIgnoreCase(providerNetwork)) { networkResource.setNeutronNetworkType(PROVIDER); @@ -1589,21 +1591,19 @@ public class ToscaResourceInstaller { networkResource.setNeutronNetworkType(BASIC); } - networkResource.setModelName( - testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); + networkResource.setModelName(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); networkResource.setModelInvariantUUID( - testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); - networkResource.setModelUUID( - testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); - networkResource.setModelVersion( - testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); + testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); + networkResource.setModelUUID(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); + networkResource + .setModelVersion(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); networkResource.setAicVersionMax(aicMax); networkResource.setAicVersionMin(aicMin); - networkResource.setToscaNodeType(networkNodeTemplate.getType()); - networkResource.setDescription( - testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + networkResource.setToscaNodeType(vlEntity.getToscaType()); + networkResource + .setDescription(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); networkResource.setOrchestrationMode(HEAT); networkResource.setHeatTemplate(heatTemplate); return networkResource; @@ -2672,6 +2672,41 @@ public class ToscaResourceInstaller { + vfModuleStructure.getVfModuleMetadata().getVfModuleModelName(); } + protected List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct, SdcTypes entityType, + SdcTypes topologyTemplate) { + + EntityQuery entityQuery = EntityQuery.newBuilder(entityType).build(); + TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(topologyTemplate).build(); + List<IEntityDetails> entityDetails = + toscaResourceStruct.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, false); + + return entityDetails; + + } + + protected List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct, String entityType, + SdcTypes topologyTemplate) { + + EntityQuery entityQuery = EntityQuery.newBuilder(entityType).build(); + TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(topologyTemplate).build(); + List<IEntityDetails> entityDetails = + toscaResourceStruct.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, true); + + return entityDetails; + + } + + protected String getLeafPropertyValue(IEntityDetails entityDetails, String propName) { + + Property leafProperty = entityDetails.getProperties().get(propName); + + if (leafProperty != null && leafProperty.getValue() != null) { + return leafProperty.getValue().toString(); + } + + return null; + } + protected String getPropertyInput(String propertyName) { String inputName = new String(); diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java index bd8e877369..115af3adaf 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java @@ -45,6 +45,7 @@ import org.mockito.MockitoAnnotations; import org.onap.sdc.api.notification.IArtifactInfo; import org.onap.sdc.api.notification.INotificationData; import org.onap.sdc.api.notification.IResourceInstance; +import org.onap.sdc.tosca.parser.api.IEntityDetails; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; import org.onap.sdc.tosca.parser.impl.SdcCsarHelperImpl; import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; @@ -102,6 +103,8 @@ public class ToscaResourceInstallerTest extends BaseTest { @Mock private NodeTemplate nodeTemplate; @Mock + private IEntityDetails entityDetails; + @Mock private ToscaResourceStructure toscaResourceStructure; @Mock private ServiceProxyResourceCustomization spResourceCustomization; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java index 2b650e1eed..b1173bbf95 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java @@ -24,16 +24,15 @@ import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import org.onap.so.bpmn.core.domain.GroupResource; -import org.onap.so.bpmn.core.domain.Resource; -import org.onap.so.bpmn.core.domain.ResourceType; -import org.onap.so.bpmn.core.domain.VnfResource; import java.lang.reflect.Type; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; +import org.apache.commons.lang3.StringUtils; +import org.onap.so.bpmn.core.domain.GroupResource; +import org.onap.so.bpmn.core.domain.Resource; +import org.onap.so.bpmn.core.domain.VnfResource; public class InstanceResourceList { @@ -41,72 +40,6 @@ public class InstanceResourceList { throw new IllegalStateException("Utility class"); } - private static Map<String, List<List<GroupResource>>> convertUUIReqTOStd(final JsonObject reqInputJsonObj, - List<Resource> seqResourceList) { - - Map<String, List<List<GroupResource>>> normalizedRequest = new HashMap<>(); - Resource lastVfProcessed = null; - for (Resource r : seqResourceList) { - - if (r.getResourceType() == ResourceType.VNF) { - String pk = getPrimaryKey(r); - - JsonElement vfNode = reqInputJsonObj.get(pk); - lastVfProcessed = r; - - // if the service property is type of array then it - // means it is a VF resource - if (vfNode instanceof JsonArray) { - - for (int i = 0; i < ((JsonArray) vfNode).size(); i++) { - List<List<GroupResource>> groupsList = normalizedRequest.get(pk); - if (groupsList == null) { - groupsList = new ArrayList<>(); - normalizedRequest.put(pk, groupsList); - } - - groupsList.add(new ArrayList<>()); - } - } - - } else if (r.getResourceType() == ResourceType.GROUP) { - String sk = getPrimaryKey(r); - - // if sk is empty that means it is not list type - if (sk.isEmpty()) { - List<List<GroupResource>> vfList = normalizedRequest.get(getPrimaryKey(lastVfProcessed)); - for (List<GroupResource> grpList : vfList) { - grpList.add((GroupResource) r); - } - continue; - } - - String pk = getPrimaryKey(lastVfProcessed); - JsonArray vfs = reqInputJsonObj.getAsJsonArray(pk); - - for (int i = 0; i < vfs.size(); i++) { - - JsonElement vfcsNode = vfs.get(i).getAsJsonObject().get(sk); - if (vfcsNode instanceof JsonArray) { - - List<GroupResource> groupResources = normalizedRequest.get(pk).get(i); - - if (groupResources == null) { - groupResources = new ArrayList<>(); - normalizedRequest.get(pk).add(i, groupResources); - } - - for (int j = 0; j < ((JsonArray) vfcsNode).size(); j++) { - groupResources.add((GroupResource) r); - } - } - } - - } - } - return normalizedRequest; - } - // this method returns key from resource input // e.g. {\"sdwansite_emails\" : \"[sdwansiteresource_list(PK), INDEX, sdwansite_emails]|default\", // ....} @@ -129,45 +62,87 @@ public class InstanceResourceList { return pkOpt.isPresent() ? pkOpt.get() : ""; } else { - // TODO: handle the case if VNF resource is not list - // e.g. { resourceInput return ""; } } - private static List<Resource> convertToInstanceResourceList(Map<String, List<List<GroupResource>>> normalizedReq, - List<Resource> seqResourceList) { - List<Resource> flatResourceList = new ArrayList<>(); - for (Resource r : seqResourceList) { - if (r.getResourceType() == ResourceType.VNF) { - String primaryKey = getPrimaryKey(r); - for (String pk : normalizedReq.keySet()) { - if (primaryKey.equalsIgnoreCase(pk)) { - - List<List<GroupResource>> vfs = normalizedReq.get(pk); + public static List<Resource> getInstanceResourceList(final VnfResource vnfResource, final String uuiRequest) { + List<Resource> sequencedResourceList = new ArrayList<Resource>(); + Gson gson = new Gson(); + JsonObject servJsonObject = gson.fromJson(uuiRequest, JsonObject.class); + JsonObject reqInputJsonObj = servJsonObject.getAsJsonObject("service").getAsJsonObject("parameters") + .getAsJsonObject("requestInputs"); - vfs.stream().forEach(e -> { - flatResourceList.add(r); - flatResourceList.addAll(e); - }); + String pk = getPrimaryKey(vnfResource); + // if pk is not empty that means it can contain list of VNF + if (!pk.isEmpty()) { + JsonElement vfNode = reqInputJsonObj.get(pk); + if (vfNode.isJsonArray()) { + // multiple instance of VNF + JsonArray vfNodeList = vfNode.getAsJsonArray(); + for (JsonElement vf : vfNodeList) { + JsonObject vfObj = vf.getAsJsonObject(); + + // Add VF first before adding groups + sequencedResourceList.add(vnfResource); + List<Resource> sequencedGroupResourceList = getGroupResourceInstanceList(vnfResource, vfObj); + if (!sequencedGroupResourceList.isEmpty()) { + sequencedResourceList.addAll(sequencedGroupResourceList); } } } + } else { + // if pk is empty that means it has only one VNF Node + // Add VF first before adding groups + sequencedResourceList.add(vnfResource); + // check the groups for this VNF and add into resource list + List<Resource> sequencedGroupResourceList = getGroupResourceInstanceList(vnfResource, reqInputJsonObj); + if (!sequencedGroupResourceList.isEmpty()) { + sequencedResourceList.addAll(sequencedGroupResourceList); + } } - return flatResourceList; - } - public static List<Resource> getInstanceResourceList(final List<Resource> seqResourceList, - final String uuiRequest) { + // In negative case consider only VNF resource only + if (sequencedResourceList.isEmpty()) { + sequencedResourceList.add(vnfResource); + } - Gson gson = new Gson(); - JsonObject servJsonObject = gson.fromJson(uuiRequest, JsonObject.class); - JsonObject reqInputJsonObj = servJsonObject.getAsJsonObject("service").getAsJsonObject("parameters") - .getAsJsonObject("requestInputs"); + return sequencedResourceList; + } - // this will convert UUI request to normalized form - Map<String, List<List<GroupResource>>> normalizedRequest = convertUUIReqTOStd(reqInputJsonObj, seqResourceList); - return convertToInstanceResourceList(normalizedRequest, seqResourceList); + private static List<Resource> getGroupResourceInstanceList(VnfResource vnfResource, JsonObject vfObj) { + List<Resource> sequencedResourceList = new ArrayList<Resource>(); + if (vnfResource.getGroupOrder() != null && !StringUtils.isEmpty(vnfResource.getGroupOrder())) { + String[] grpSequence = vnfResource.getGroupOrder().split(","); + for (String grpType : grpSequence) { + for (GroupResource gResource : vnfResource.getGroups()) { + if (StringUtils.containsIgnoreCase(gResource.getModelInfo().getModelName(), grpType)) { + // check the number of group instances from UUI to be added + String sk = getPrimaryKey(gResource); + + // if sk is empty that means it is not list type + // only one group / vnfc to be considered + if (sk.isEmpty()) { + sequencedResourceList.add(gResource); + } else { + // check the number of list size of VNFC of a group + JsonElement vfcNode = vfObj.get(sk); + if (vfcNode.isJsonArray()) { + JsonArray vfcList = vfcNode.getAsJsonArray(); + for (JsonElement vfc : vfcList) { + sequencedResourceList.add(gResource); + } + } else { + // consider only one vnfc/group if not an array + sequencedResourceList.add(gResource); + } + } + + } + } + } + } + return sequencedResourceList; } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java index faa3d74dba..b814d6c595 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java @@ -122,8 +122,13 @@ public class ResourceRequestBuilder { Map<String, Object> uuiRequestInputs = null; if (JsonUtils.getJsonValue(uuiServiceParameters, "requestInputs") != null) { - uuiRequestInputs = - getJsonObject((String) JsonUtils.getJsonValue(uuiServiceParameters, "requestInputs"), Map.class); + String uuiRequestInputStr = JsonUtils.getJsonValue(uuiServiceParameters, "requestInputs"); + logger.info("resource input from UUI: " + uuiRequestInputStr); + if (uuiRequestInputStr == null || uuiRequestInputStr.isEmpty()) { + uuiRequestInputStr = "{}"; + } + + uuiRequestInputs = getJsonObject(uuiRequestInputStr, Map.class); } if (uuiRequestInputs == null) { diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java index 3be67c965c..f3233f2350 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java @@ -3,6 +3,7 @@ package org.onap.so.bpmn.common.resource; import org.junit.Assert; import org.junit.Test; import org.onap.so.bpmn.core.domain.GroupResource; +import org.onap.so.bpmn.core.domain.ModelInfo; import org.onap.so.bpmn.core.domain.Resource; import org.onap.so.bpmn.core.domain.ResourceType; import org.onap.so.bpmn.core.domain.VnfResource; @@ -23,15 +24,67 @@ public class InstnaceResourceListTest { String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json"))); List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(createResourceSequence(), uuiRequest); - Assert.assertEquals(4, instanceResourceList.size()); + Assert.assertEquals(7, instanceResourceList.size()); Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType()); Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(1).getResourceType()); - Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(2).getResourceType()); + Assert.assertEquals("device", instanceResourceList.get(1).getModelInfo().getModelName()); + Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(2).getResourceType()); + Assert.assertEquals("sitewan", instanceResourceList.get(2).getModelInfo().getModelName()); Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(3).getResourceType()); + Assert.assertEquals("sitewan", instanceResourceList.get(3).getModelInfo().getModelName()); + Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(4).getResourceType()); + Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(5).getResourceType()); + Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(6).getResourceType()); } - private List<Resource> createResourceSequence() { - List<Resource> resourceList = new ArrayList<>(); + // Test when PK is empty + @Test + public void testSimpleVFResource() throws IOException { + String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json"))); + VnfResource vnfResource = new VnfResource(); + vnfResource.setResourceInput("{\"a\":\"ipaddress|127.0.0.1\"}"); + List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(vnfResource, uuiRequest); + Assert.assertEquals(1, instanceResourceList.size()); + Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType()); + } + + // Test when PK is not empty and PK does not contain any groups + @Test + public void testVFWithEmptyGroupResource() throws IOException { + String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json"))); + VnfResource vnfResource = new VnfResource(); + vnfResource.setResourceInput("{\"a\":\"[emptygroup_list,INDEX,name]\"}"); + List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(vnfResource, uuiRequest); + Assert.assertEquals(1, instanceResourceList.size()); + Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType()); + } + + // Test when PK is not empty and contains a group which SK is empty + @Test + public void testVFWithEmptyGroupKeyResource() throws IOException { + String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json"))); + VnfResource vnfResource = new VnfResource(); + vnfResource.setResourceInput("{\"a\":\"[emptygroup_list,INDEX,name]\"}"); + + VnfcResource vnfcResource = new VnfcResource(); + vnfcResource.setResourceInput("{\"a\":\"test|default_value\"}"); + GroupResource groupResource = new GroupResource(); + groupResource.setVnfcs(Arrays.asList(vnfcResource)); + ModelInfo wanModel = new ModelInfo(); + wanModel.setModelName("wan"); + groupResource.setModelInfo(wanModel); + + vnfResource.setGroupOrder("wan"); + vnfResource.setGroups(Arrays.asList(groupResource)); + + List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(vnfResource, uuiRequest); + Assert.assertEquals(2, instanceResourceList.size()); + Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType()); + Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(1).getResourceType()); + Assert.assertEquals("wan", instanceResourceList.get(1).getModelInfo().getModelName()); + } + + private VnfResource createResourceSequence() { VnfResource vnfResource = new VnfResource(); vnfResource.setResourceInput("{\"a\":\"[sdwansiteresource_list,INDEX,sdwansiteresource_list]\"}"); @@ -40,7 +93,20 @@ public class InstnaceResourceListTest { GroupResource groupResource = new GroupResource(); groupResource.setVnfcs(Arrays.asList(vnfcResource)); + ModelInfo wanModel = new ModelInfo(); + wanModel.setModelName("sitewan"); + groupResource.setModelInfo(wanModel); + + VnfcResource vnfcDeviceResource = new VnfcResource(); + vnfcDeviceResource.setResourceInput("{\"a\":\"[sdwandevice_list,INDEX,test]\"}"); + GroupResource groupResource2 = new GroupResource(); + groupResource2.setVnfcs(Arrays.asList(vnfcDeviceResource)); + ModelInfo deviceModel = new ModelInfo(); + deviceModel.setModelName("device"); + groupResource2.setModelInfo(deviceModel); - return Arrays.asList(vnfResource, groupResource); + vnfResource.setGroupOrder("device,sitewan"); + vnfResource.setGroups(Arrays.asList(groupResource, groupResource2)); + return vnfResource; } } diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/InstanceResourceList/InstanceResourceList.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/InstanceResourceList/InstanceResourceList.json index 0b3d9f0bbe..a111ae2646 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/InstanceResourceList/InstanceResourceList.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/InstanceResourceList/InstanceResourceList.json @@ -67,6 +67,19 @@ } ], "requestInputs":{ + "emptygroup_list": [ + { + "topology": "hub_spoke", + "name": "defaultvpn", + "role":"Hub", + "portType":"GE", + "portSwitch":"layer3-port", + "vlanId":"", + "ipAddress":"192.168.10.1", + "deviceName":"vCPE", + "portNumer":"0/0/1" + } + ], "sdwanvpnresource_list":[ { "sdwanvpn_topology":"hub_spoke", @@ -117,6 +130,19 @@ "portNumber":"0/0/0", "ipMode":"DHCP", "publicIP":"119.3.7.113" + }, + { + "providerIpAddress":"", + "portType":"GE", + "inputBandwidth":"1200", + "ipAddress":"", + "name":"10001", + "transportNetworkName":"internet", + "outputBandwidth":"10001", + "deviceName":"vCPE", + "portNumber":"0/0/0", + "ipMode":"DHCP", + "publicIP":"119.3.7.114" } ], "sdwandevice_list":[ diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy index 0338647ce7..30b5cc8567 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy @@ -83,9 +83,14 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { //the operationType from worflow(first node) is highest priority. operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") } + String operationTypeFromConfig = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() + ".operation-type") + if (StringUtils.isNotEmpty(operationTypeFromConfig)) { + // highest priority if operation type configured + operationType = operationTypeFromConfig + } String sdnc_svcAction = "activate" - String sdnc_requestAction = sdnc_svcAction.capitalize() + UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() +".operation-type") + "Instance" + String sdnc_requestAction = sdnc_svcAction.capitalize() + operationType + "Instance" execution.setVariable(Prefix + "svcAction", sdnc_svcAction) execution.setVariable(Prefix + "requestAction", sdnc_requestAction) @@ -194,24 +199,6 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { String sdncTopologyActivateRequest = "" String modelType = resourceInputObj.getResourceModelInfo().getModelType() - //When a new resource creation request reaches SO, the parent resources information needs to be provided - //while creating the child resource. - String vnfid = "" - String vnfmodelInvariantUuid = "" - String vnfmodelCustomizationUuid = "" - String vnfmodelUuid = "" - String vnfmodelVersion = "" - String vnfmodelName = "" - if(modelType.equalsIgnoreCase(ResourceType.GROUP.toString())) { - vnfid = resourceInputObj.getVnfId() - ModelInfo vfModelInfo = resourceInputObj.getVfModelInfo() - vnfmodelInvariantUuid = vfModelInfo.getModelInvariantUuid() - vnfmodelCustomizationUuid = vfModelInfo.getModelCustomizationUuid() - vnfmodelUuid = vfModelInfo.getModelUuid() - vnfmodelVersion = vfModelInfo.getModelVersion() - vnfmodelName = vfModelInfo.getModelName() - } - switch (modelType) { case "VNF" : sdncTopologyActivateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" @@ -272,6 +259,15 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { break case "GROUP" : + //When a new resource creation request reaches SO, the parent resources information needs to be provided + //while creating the child resource. + String vnfid = resourceInputObj.getVnfId() + ModelInfo vfModelInfo = resourceInputObj.getVfModelInfo() + String vnfmodelInvariantUuid = vfModelInfo.getModelInvariantUuid() + String vnfmodelCustomizationUuid = vfModelInfo.getModelCustomizationUuid() + String vnfmodelUuid = vfModelInfo.getModelUuid() + String vnfmodelVersion = vfModelInfo.getModelVersion() + String vnfmodelName = vfModelInfo.getModelName() sdncTopologyActivateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> @@ -335,6 +331,61 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { </aetgt:SDNCAdapterWorkflowRequest>""".trim() break + // sdwanvpnattachment or sotnvpnattachment + case "ALLOTTED_RESOURCE" : + sdncTopologyActivateRequest = + """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> + </onap-model-information> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + </service-information> + <allotted-resource-information> + <allotted-resource-id>${msoUtils.xmlEscape(resourceInstanceId)}</allotted-resource-id> + <allotted-resource-type></allotted-resource-type> + <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </allotted-resource-information> + <connection-attachment-request-input> + $netowrkInputParameters + </connection-attachment-request-input> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + + break + // for SDWANConnectivity and SOTN Connectivity default: sdncTopologyActivateRequest = @@ -371,7 +422,6 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> </service-information> <network-information> - <!-- TODO: to be filled by response from create --> <network-id>${msoUtils.xmlEscape(resourceInstanceId)}</network-id> <onap-model-information> <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> 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 1578f0f7c0..044f0b462b 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 @@ -353,6 +353,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso // ExternalAPI message format String externalId = execution.getVariable("resourceName") + String serviceType = execution.getVariable("serviceType") String category = "E2E Service" String description = "Service Order from SPPartner" String requestedStartDate = utils.generateCurrentTimeInUtc() @@ -360,7 +361,9 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String priority = "1" // 0-4 0:highest String subscriberId = execution.getVariable("globalSubscriberId") String customerRole = "ONAPcustomer" - String subscriberName = subscriberId + // Below SO will pass serviceType as subscriberName and externalAPI will use + // the same serviceType in another domain instead of model name + String subscriberName = serviceType String referredType = "Consumer" String orderItemId = "1" String action = "add" //for create @@ -401,7 +404,6 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso _requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) requestInputsMap.clear() - String serviceType = execution.getVariable("serviceType") requestInputsMap.put("inputName", '"serviceType"') requestInputsMap.put("inputValue", '"' + serviceType + '"') _requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) @@ -420,7 +422,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap) execution.setVariable(Prefix + "Payload", payload) - logger.info("Exit " + prepare3rdONAPRequest) + logger.info(" ***** Exit prepare3rdONAPRequest *****") } public void doCreateE2ESIin3rdONAP(DelegateExecution execution) { @@ -464,7 +466,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso logger.error("doCreateE2ESIin3rdONAP exception:" + e.getMessage()) } - logger.info("Exit " + doCreateE2ESIin3rdONAP) + logger.info(" ***** Exit doCreateE2ESIin3rdONAP *****") } @@ -562,7 +564,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable("statusDescription", "Get Create ServiceOrder Exception") logger.error("getE2ESIProgressin3rdONAP exception:" + e.getMessage()) } - logger.info("Exit " + getE2ESIProgressin3rdONAP) + logger.info(" ***** Exit getE2ESIProgressin3rdONAP *****") } /** @@ -608,7 +610,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso logger.info(msg) // throw new BpmnError("MSOWorkflowException") } - logger.info("Exit " + saveSPPartnerInAAI) + logger.info(" ***** Exit saveSPPartnerInAAI *****") } private void setProgressUpdateVariables(DelegateExecution execution, String body) { 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 d431bdc3b4..b0419be7cb 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 @@ -22,7 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts -import com.google.gson.Gson + import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution @@ -32,11 +32,8 @@ 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.aai.domain.yang.v13.Pnf -import org.onap.aai.domain.yang.v13.Pnfs import org.onap.so.bpmn.common.recipe.ResourceInput import org.onap.so.bpmn.common.resource.ResourceRequestBuilder -import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils @@ -52,8 +49,6 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory -import static org.apache.commons.lang3.StringUtils.* - /** * This groovy class supports the <class>CreateSDNCCNetworkResource.bpmn</class> process. * flow for SDNC Network Resource Create @@ -88,7 +83,6 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { //Deal with recipeParams String recipeParamsFromWf = execution.getVariable("recipeParamXsd") - String resourceName = resourceInputObj.getResourceInstanceName() //For sdnc requestAction default is "createNetworkInstance" String operationType = "Network" @@ -100,9 +94,14 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { //the operationType from worflow(first node) is highest priority. operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") } + String operationTypeFromConfig = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() + ".operation-type") + if (StringUtils.isNotEmpty(operationTypeFromConfig)) { + // highest priority if operation type configured + operationType = operationTypeFromConfig + } String sdnc_svcAction = "create" - String sdnc_requestAction = sdnc_svcAction.capitalize() + UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() +".operation-type") + "Instance" + String sdnc_requestAction = sdnc_svcAction.capitalize() + operationType + "Instance" String isActivateRequired = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() +".activation-required") execution.setVariable("isActivateRequired", isActivateRequired) @@ -278,27 +277,38 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : // fill attachment TP in networkInputParamJson - String customer = resourceInputObj.getGlobalSubscriberId() - String serviceType = resourceInputObj.getServiceType() - def vpnName = StringUtils.containsIgnoreCase(modelName, "sotnvpnattachment") ? "sotnvpnattachmentvf_sotncondition_sotnVpnName" : "sdwanvpnattachmentvf_sdwancondition_sdwanVpnName" - String parentServiceName = jsonUtil.getJsonValueForKey(resourceInputObj.getRequestsInputs(), vpnName) - - AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer, serviceType).queryParam("service-instance-name", parentServiceName) - ServiceInstances sis = client.get(uri).asBean(ServiceInstances.class).get() - ServiceInstance si = sis.getServiceInstance().get(0) - - def parentServiceInstanceId = si.getServiceInstanceId() - execution.setVariable("parentServiceInstanceId", parentServiceInstanceId) + fillAttachmentTPInfo(resourceInputObj, modelName, execution, vpnName) break default: + // Special case for handling alloted resource types + // in case name is different as expected + if ("ALLOTTED_RESOURCE".equals(resourceInputObj.getResourceModelInfo().getModelType())) { + def vpnName = modelName + "_sotnVpnName" + fillAttachmentTPInfo(resourceInputObj, modelName, execution, vpnName) + } break } return resourceInputObj } + private void fillAttachmentTPInfo(ResourceInput resourceInputObj, String modelName, DelegateExecution execution, String vpnName) { + String customer = resourceInputObj.getGlobalSubscriberId() + String serviceType = resourceInputObj.getServiceType() + + String parentServiceName = jsonUtil.getJsonValueForKey(resourceInputObj.getRequestsInputs(), vpnName) + + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer, serviceType).queryParam("service-instance-name", parentServiceName) + ServiceInstances sis = client.get(uri).asBean(ServiceInstances.class).get() + logger.debug("Fetched AAI ServiceInstances for the vpnName:" + vpnName + " is " + sis.getServiceInstance().toString()) + ServiceInstance si = sis.getServiceInstance().get(0) + + def parentServiceInstanceId = si.getServiceInstanceId() + execution.setVariable("parentServiceInstanceId", parentServiceInstanceId) + } + /** * Pre Process the BPMN Flow Request * Includes: @@ -339,26 +349,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { // 1. prepare assign topology via SDNC Adapter SUBFLOW call String sdncTopologyCreateRequest = ""; - - - //When a new resource creation request reaches SO, the parent resources information needs to be provided - //while creating the child resource. - String vnfid = "" - String vnfmodelInvariantUuid = "" - String vnfmodelCustomizationUuid = "" - String vnfmodelUuid = "" - String vnfmodelVersion = "" - String vnfmodelName = "" String modelType = resourceInputObj.getResourceModelInfo().getModelType() - if(modelType.equalsIgnoreCase(ResourceType.GROUP.toString())) { - vnfid = resourceInputObj.getVnfId() - ModelInfo vfModelInfo = resourceInputObj.getVfModelInfo() - vnfmodelInvariantUuid = vfModelInfo.getModelInvariantUuid() - vnfmodelCustomizationUuid = vfModelInfo.getModelCustomizationUuid() - vnfmodelUuid = vfModelInfo.getModelUuid() - vnfmodelVersion = vfModelInfo.getModelVersion() - vnfmodelName = vfModelInfo.getModelName() - } switch (modelType) { case "VNF" : @@ -418,6 +409,13 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { </aetgt:SDNCAdapterWorkflowRequest>""".trim() break case "GROUP" : + String vnfid = resourceInputObj.getVnfId() + ModelInfo vfModelInfo = resourceInputObj.getVfModelInfo() + String vnfmodelInvariantUuid = vfModelInfo.getModelInvariantUuid() + String vnfmodelCustomizationUuid = vfModelInfo.getModelCustomizationUuid() + String vnfmodelUuid = vfModelInfo.getModelUuid() + String vnfmodelVersion = vfModelInfo.getModelVersion() + String vnfmodelName = vfModelInfo.getModelName() sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> @@ -480,7 +478,62 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { </aetgt:SDNCAdapterWorkflowRequest>""".trim() break - // for SDWANConnectivity and SOTNConnectivity: + // sdwanvpnattachment or sotnvpnattachment + case "ALLOTTED_RESOURCE" : + sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> + </onap-model-information> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> + </service-information> + <allotted-resource-information> + <allotted-resource-id></allotted-resource-id> + <allotted-resource-type></allotted-resource-type> + <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </allotted-resource-information> + <connection-attachment-request-input> + $netowrkInputParameters + </connection-attachment-request-input> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + + break + + // for SDWANConnectivity and SOTNConnectivity: default: sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" @@ -532,198 +585,6 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { } - - - - //switch (modelName) { - // case ~/[\w\s\W]*deviceVF[\w\s\W]*/ - // case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : - // case ~/[\w\s\W]*SiteVF[\w\s\W]*/: - /* sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" - xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" - xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> - <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation> - <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> - <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> - </sdncadapter:RequestHeader> - <sdncadapterworkflow:SDNCRequestData> - <request-information> - <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEscape(source)}</source> - <notification-url></notification-url> - <order-number></order-number> - <order-version></order-version> - </request-information> - <service-information> - <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> - <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> - </onap-model-information> - <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> - <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> - </service-information> - <vnf-information> - <vnf-id></vnf-id> - <vnf-type></vnf-type> - <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${msoUtils.xmlEscape(modelName)}</model-name> - </onap-model-information> - </vnf-information> - <vnf-request-input> - <vnf-input-parameters> - $netowrkInputParameters - </vnf-input-parameters> - <request-version></request-version> - <vnf-name></vnf-name> - <vnf-networks> - </vnf-networks> - </vnf-request-input> - </sdncadapterworkflow:SDNCRequestData> - </aetgt:SDNCAdapterWorkflowRequest>""".trim() - - - break - - //case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ - //case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : - /* sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" - xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" - xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> - <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> - <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> - <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> - </sdncadapter:RequestHeader> - <sdncadapterworkflow:SDNCRequestData> - <request-information> - <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEscape(source)}</source> - <notification-url></notification-url> - <order-number></order-number> - <order-version></order-version> - </request-information> - <service-information> - <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> - <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> - </onap-model-information> - <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> - <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> - </service-information><vnf-information> - <vnf-id></vnf-id> - <vnf-type></vnf-type> - <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${msoUtils.xmlEscape(modelName)}</model-name> - </onap-model-information> - </vnf-information> - <vnf-request-input> - <vnf-input-parameters> - $netowrkInputParameters - </vnf-input-parameters> - <request-version></request-version> - <vnf-name></vnf-name> - <vnf-networks> - </vnf-networks> - </vnf-request-input> - <allotted-resource-information> - <!-- TODO: to be filled as per the request input --> - <allotted-resource-id></allotted-resource-id> - <allotted-resource-type></allotted-resource-type> - <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id> - <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${msoUtils.xmlEscape(modelName)}</model-name> - </onap-model-information> - </allotted-resource-information> - <connection-attachment-request-input> - $netowrkInputParameters - </connection-attachment-request-input> - </sdncadapterworkflow:SDNCRequestData> - </aetgt:SDNCAdapterWorkflowRequest>""".trim() - break - - // for SDWANConnectivity and SOTNConnectivity: - default: - sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" - xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" - xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> - <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${hdrRequestId}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> - <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> - <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> - </sdncadapter:RequestHeader> - <sdncadapterworkflow:SDNCRequestData> - <request-information> - <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEscape(source)}</source> - <notification-url></notification-url> - <order-number></order-number> - <order-version></order-version> - </request-information> - <service-information> - <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> - <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> - </onap-model-information> - <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> - </service-information> - <network-information> - <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${msoUtils.xmlEscape(modelName)}</model-name> - </onap-model-information> - </network-information> - <network-request-input> - <network-input-parameters>$netowrkInputParameters</network-input-parameters> - </network-request-input> - </sdncadapterworkflow:SDNCRequestData> - </aetgt:SDNCAdapterWorkflowRequest>""".trim() - } - - **/ - String sndcTopologyCreateRequesAsString = utils.formatXml(sdncTopologyCreateRequest) execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString) logger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString) @@ -813,40 +674,20 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") - def instnaceId = getInstnaceId(execution) + def instnaceId = getInstanceId(execution) execution.setVariable("resourceInstanceId", instnaceId) logger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) logger.info(" ***** Exit prepareSDNCRequest *****") } - private def getInstnaceId(DelegateExecution execution) { + private def getInstanceId(DelegateExecution execution) { def response = new XmlSlurper().parseText(execution.getVariable("CRENWKI_createSDNCResponse")) ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(execution.getVariable(Prefix + "resourceInput"), ResourceInput.class) String modelName = resourceInputObj.getResourceModelInfo().getModelName() def val = "" - - //switch (modelName) { - // case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : - // case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : - // case ~/[\w\s\W]*Site[\w\s\W]*/: - // val = response."response-data"."RequestData"."output"."vnf-response-information"."instance-id" - // break - - // case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : - // case ~/[\w\s\W]*sotnvpprepareUpdateAfterCreateSDNCResourcenattachment[\w\s\W]*/: - // val = response."response-data"."RequestData"."output"."connection-attachment-response-information"."instance-id" - // break - - // for SDWANConnectivity and SOTNConnectivity and default: - // default: - // val = response."response-data"."RequestData"."output"."network-response-information"."instance-id" - // break - //} - - String modelType = resourceInputObj.getResourceModelInfo().getModelType() switch (modelType) { case "VNF" : @@ -855,7 +696,12 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { case "GROUP": val = response."response-data"."RequestData"."output"."vf-module-response-information"."instance-id" break + case "ALLOTTED_RESOURCE": + // sdwanvpnattachment or sotnvpnattachment + val = response."response-data"."RequestData"."output"."connection-attachment-response-information"."instance-id" + break default: + // SDWANConnectivity or SOTN Connectivity val = response."response-data"."RequestData"."output"."network-response-information"."instance-id" break } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy index 3d62a6ca90..097a1be291 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy @@ -118,6 +118,8 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") String source = execution.getVariable("source") String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") + String resourceInput = execution.getVariable("resourceInput") + String allotedParentServiceInstanceId = execution.getVariable("allotedParentServiceInstanceId") ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) String serviceType = resourceInputObj.getServiceType() String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() @@ -268,6 +270,61 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor </aetgt:SDNCAdapterWorkflowRequest>""".trim() break + // sdwanvpnattachment or sotnvpnattachment + case "ALLOTTED_RESOURCE" : + + sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> + </onap-model-information> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name></subscriber-name> + </service-information> + <allotted-resource-information> + <allotted-resource-id>$resourceInstnaceId</allotted-resource-id> + <allotted-resource-type></allotted-resource-type> + <parent-service-instance-id>$allotedParentServiceInstanceId</parent-service-instance-id> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </allotted-resource-information> + <connection-attachment-request-input> + </connection-attachment-request-input> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + + break + // for SDWANConnectivity and SOTNConnectivity: default: sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" @@ -334,6 +391,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor } public void prepareUpdateAfterDeActivateSDNCResource(DelegateExecution execution) { + String resourceInput = execution.getVariable("resourceInput") ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() 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 443c8f6616..64ae3dfbef 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 @@ -217,6 +217,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso // ExternalAPI message format String externalId = execution.getVariable("resourceName") + String serviceType = execution.getVariable("serviceType") String category = "E2E Service" String description = "Service Order from SPPartner" String requestedStartDate = utils.generateCurrentTimeInUtc() @@ -224,13 +225,14 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String priority = "1" // 0-4 0:highest String subscriberId = execution.getVariable("globalSubscriberId") String customerRole = "ONAPcustomer" - String subscriberName = subscriberId + // Below SO will pass serviceType as subscriberName and externalAPI will use + // the same serviceType in another domain instead of model name + String subscriberName = serviceType String referredType = "Consumer" String orderItemId = "1" String action = "delete" //for delete String serviceState = "active" String serviceName = "" - String serviceType = execution.getVariable("serviceType") String serviceId = execution.getVariable(Prefix + "SppartnerId") queryServicefrom3rdONAP(execution) @@ -260,7 +262,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap) execution.setVariable(Prefix + "Payload", payload) - logger.info( "Exit " + prepare3rdONAPRequest) + logger.info( "***** Exit prepare3rdONAPRequest *****") } private void queryServicefrom3rdONAP(DelegateExecution execution) @@ -294,7 +296,8 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso { logger.debug("Get Service Received a Good Response") JSONArray responseList = new JSONArray(extApiResponse) - for(JSONObject obj : responseList) { + for(int i=0; i< responseList.length(); i++) { + JSONObject obj = responseList.getJSONObject(i) String svcId = obj.get("id") if(StringUtils.equalsIgnoreCase(SppartnerServiceId, svcId)) { JSONObject serviceSpecification = obj.get("serviceSpecification") @@ -311,7 +314,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso }catch(Exception e) { logger.error("queryServicefrom3rdONAP exception:" + e.getMessage()) } - logger.info( "Exit " + queryServicefrom3rdONAP) + logger.info( "***** Exit queryServicefrom3rdONAP *****") } public void doDeleteE2ESIin3rdONAP(DelegateExecution execution) { @@ -354,7 +357,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso }catch(Exception e) { logger.error("doDeleteE2ESIin3rdONAP exception:" + e.getMessage()) } - logger.info( "Exit " + doDeleteE2ESIin3rdONAP) + logger.info( "***** Exit doDeleteE2ESIin3rdONAP *****") } @@ -450,7 +453,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable("statusDescription", "Get Delete ServiceOrder Exception") logger.error("getE2ESIProgressin3rdONAP exception:" + e.getMessage()) } - logger.info( "Exit " + getE2ESIProgressin3rdONAP) + logger.info( "***** Exit getE2ESIProgressin3rdONAP *****") } /** @@ -495,7 +498,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso // throw new BpmnError("MSOWorkflowException") } - logger.info( "Exit " + getSPPartnerInAAI) + logger.info( "***** Exit getSPPartnerInAAI *****") } public void deleteSPPartnerInAAI(DelegateExecution execution) { @@ -516,7 +519,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } - logger.info( "Exit " + deleteSPPartnerInAAI) + logger.info( "**** Exit deleteSPPartnerInAAI ****") } private void setProgressUpdateVariables(DelegateExecution execution, String body) { 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 49f0e14d17..7c8b7eb7cc 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 @@ -25,6 +25,9 @@ package org.onap.so.bpmn.infrastructure.scripts import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.AllottedResource +import org.onap.aai.domain.yang.Relationship +import org.onap.aai.domain.yang.RelationshipData import org.onap.so.bpmn.common.recipe.ResourceInput import org.onap.so.bpmn.common.resource.ResourceRequestBuilder import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor @@ -35,9 +38,16 @@ 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.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory +import javax.ws.rs.NotFoundException + import static org.apache.commons.lang3.StringUtils.* /** @@ -76,6 +86,27 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { //Deal with recipeParams String recipeParamsFromWf = execution.getVariable("recipeParamXsd") String resourceModelName = resourceInputObj.getResourceModelInfo().getModelName() + String resourceInstanceId = resourceInputObj.getResourceInstancenUuid() + String globalCustomerId = resourceInputObj.getGlobalSubscriberId() + String serviceType = resourceInputObj.getServiceType() + String serviceInstanceId = resourceInputObj.getServiceInstanceId() + + // fetch parent instance id for allotted resources + String modelType = resourceInputObj.getResourceModelInfo().getModelType() + switch (modelType) { + // sdwanvpnattachment or sotnvpnattachment + case "ALLOTTED_RESOURCE": + String parentServiceId = fetchParentServiceInstance(globalCustomerId, serviceType, serviceInstanceId, resourceInstanceId) + if (null != parentServiceId) { + execution.setVariable("allotedParentServiceInstanceId", parentServiceId) + } else { + logger.warn("Alloted Resource ParentServiceInstanceId not found in AAI response for allotedId: " + resourceInstanceId) + } + break; + default: + break; + } + //For sdnc requestAction default is "NetworkInstance" String operationType = "Network" if(!StringUtils.isBlank(recipeParamsFromRequest) && "null" != recipeParamsFromRequest){ @@ -106,13 +137,47 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() + String msg = "Exception in preProcessRequest " + ex.getMessage() logger.debug( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } logger.info(" ***** Exit preProcessRequest *****") } + private String fetchParentServiceInstance(String globalCustId, String serviceType, String serviceInstanceId, String allotedResourceId ) { + logger.trace("Entered fetchParentServiceInstance") + try { + String parentServiceId = ""; + AAIResourcesClient resourceClient = new AAIResourcesClient(); + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, globalCustId, serviceType, serviceInstanceId, 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())) { + logger.debug("SI Data relationship-list exists") + List<Relationship> relationshipList = si.get().getRelationshipList().getRelationship() + for (Relationship relationship : relationshipList) { + String rt = relationship.getRelatedTo() + List<RelationshipData> rl_datas = relationship.getRelationshipData() + if(rt.equals("service-instance") ){ + for (RelationshipData rl_data : rl_datas) { + String eKey = rl_data.getRelationshipKey() + String eValue = rl_data.getRelationshipValue() + if(eKey.equals("service-instance.service-instance-id") && (!eValue.equals(serviceInstanceId))){ + return eValue + } + } + } + } + } + + logger.trace("Exited fetchParentServiceInstance") + }catch(Exception e){ + logger.debug("Error occured within deleteServiceInstance method: " + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during deleteServiceInstance from aai") + } + return null + } + /** * Pre Process the BPMN Flow Request * Includes: @@ -135,6 +200,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") String resourceInput = execution.getVariable(Prefix + "resourceInput") logger.info("The resourceInput is: " + resourceInput) + String allotedParentServiceInstanceId = execution.getVariable("allotedParentServiceInstanceId") ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) String serviceType = resourceInputObj.getServiceType() String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() @@ -285,7 +351,61 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { </aetgt:SDNCAdapterWorkflowRequest>""".trim() break - // for SDWANConnectivity and SOTNConnectivity: + // sdwanvpnattachment or sotnvpnattachment + case "ALLOTTED_RESOURCE" : + sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> + </onap-model-information> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name></subscriber-name> + </service-information> + <allotted-resource-information> + <allotted-resource-id>$resourceInstnaceId</allotted-resource-id> + <allotted-resource-type></allotted-resource-type> + <parent-service-instance-id>$allotedParentServiceInstanceId</parent-service-instance-id> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </allotted-resource-information> + <connection-attachment-request-input> + </connection-attachment-request-input> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + + break + + // for SDWANConnectivity and SOTNConnectivity: default: sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" 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 a5a92b6b06..d9f9299616 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,6 +22,9 @@ */ 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.so.logger.ErrorCode; @@ -31,6 +34,7 @@ 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.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -291,6 +295,103 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { logger.trace("Exit createServiceInstance ") } + public void createCustomRelationship(DelegateExecution execution) { + logger.trace("createCustomRelationship ") + String msg = "" + try { + String uuiRequest = execution.getVariable("uuiRequest") + String vpnName = isNeedProcessCustomRelationship(uuiRequest) + + if(null != vpnName){ + logger.debug("fetching resource-link information for the given sotnVpnName:"+vpnName) + // fetch the service instance to link the relationship + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.NODES_QUERY).queryParam("search-node-type","service-instance").queryParam("filter","service-instance-name:EQUALS:"+vpnName) + AAIResultWrapper aaiResult = client.get(uri,NotFoundException.class) + Map<String, Object> result = aaiResult.asMap() + List<Object> resources = + (List<Object>) result.getOrDefault("result-data", Collections.emptyList()); + if(resources.size()>0) { + String relationshipUrl = ((Map<String, Object>) resources.get(0)).get("resource-link") + + final Relationship body = new Relationship(); + body.setRelatedLink(relationshipUrl) + + createRelationShipInAAI(execution, body) + } else { + logger.warn("No resource-link found for the given sotnVpnName:"+vpnName) + } + + } else { + logger.error("VPNName not found in request input") + } + + + + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + + msg = "Exception in DoCreateE2EServiceInstance.createCustomRelationship. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.trace("Exit createCustomRelationship ") + } + + private void createRelationShipInAAI(DelegateExecution execution, final Relationship relationship){ + logger.trace("createRelationShipInAAI ") + String msg = "" + 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() + client.create(uri, relationship) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + + msg = "Exception in DoCreateE2EServiceInstance.createRelationShipInAAI. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.trace("Exit createRelationShipInAAI ") + + } + + private String isNeedProcessCustomRelationship(String uuiRequest) { + String requestInput = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs") + Map<String, String> requestInputObject = getJsonObject(requestInput, Map.class); + if (requestInputObject == null) { + return null; + } + + Optional<Map.Entry> firstKey = + requestInputObject.entrySet() + .stream() + .filter({entry -> entry.getKey().toString().contains("_sotnVpnName")}) + .findFirst() + if (firstKey.isPresent()) { + return firstKey.get().getValue() + } + + return null + } + + private static <T> T getJsonObject(String jsonstr, Class<T> type) { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); + try { + return mapper.readValue(jsonstr, type); + } catch (IOException e) { + logger.error("{} {} fail to unMarshal json", MessageEnum.RA_NS_EXC.toString(), + ErrorCode.BusinessProcesssError.getValue(), e); + } + return null; + } + + /** * Gets the service instance and its relationships from aai */ diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy index 587337b647..b1356b9fb6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy @@ -28,7 +28,6 @@ import com.google.gson.Gson import org.apache.http.util.EntityUtils import org.onap.so.bpmn.common.resource.InstanceResourceList import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory -import org.onap.so.bpmn.core.domain.GroupResource import org.onap.so.bpmn.core.domain.ModelInfo import org.onap.so.bpmn.core.domain.ResourceType import org.onap.so.bpmn.infrastructure.properties.BPMNProperties @@ -96,16 +95,6 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ logger.trace("Exit preProcessRequest ") } - // this method will convert resource list to instance_resource_list - public void prepareInstanceResourceList(DelegateExecution execution) { - - String uuiRequest = execution.getVariable("uuiRequest") - List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") - List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(sequencedResourceList, uuiRequest) - - execution.setVariable("instanceResourceList", instanceResourceList) - } - public void sequenceResoure(DelegateExecution execution) { logger.trace("Start sequenceResoure Process ") @@ -134,23 +123,20 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ for (resourceType in resourceSequence) { for (resource in addResourceList) { if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) { - sequencedResourceList.add(resource) + // if resource type is vnfResource then check for groups also // Did not use continue because if same model type is used twice // then we would like to add it twice for processing - // e.g. S{ V1{G1, G2, G1}} --> S{ V1{G1, G1, G2}} - if (resource instanceof VnfResource) { - if (resource.getGroupOrder() != null && !StringUtils.isEmpty(resource.getGroupOrder())) { - String[] grpSequence = resource.getGroupOrder().split(",") - for (String grpType in grpSequence) { - for (GroupResource gResource in resource.getGroups()) { - if (StringUtils.containsIgnoreCase(gResource.getModelInfo().getModelName(), grpType)) { - sequencedResourceList.add(gResource) - } - } - } - } + // ex-1. S{ V1{G1, G2}} --> S{ V1{G1, G1, G2}} + // ex-2. S{ V1{G1, G2}} --> S{ V1{G1, G2, G2, G2} V1 {G1, G1, G2}} + if ((resource.getResourceType() == ResourceType.VNF) && (resource instanceof VnfResource)) { + + // check the size of VNF/Group list from UUI + List<Resource> sequencedInstanceResourceList = InstanceResourceList.getInstanceResourceList((VnfResource) resource, incomingRequest) + sequencedResourceList.addAll(sequencedInstanceResourceList) + } else { + sequencedResourceList.add(resource) } if (resource instanceof NetworkResource) { networkResourceList.add(resource) @@ -167,7 +153,9 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ for (Resource rc : addResourceList){ if (rc instanceof VnfResource) { - vnfResourceList.add(rc) + // check the size of VNF/Group list from UUI + List<Resource> sequencedGroupResourceList = InstanceResourceList.getInstanceResourceList((VnfResource) rc, incomingRequest) + vnfResourceList.addAll(sequencedGroupResourceList) } else if (rc instanceof NetworkResource) { networkResourceList.add(rc) } else if (rc instanceof AllottedResource) { @@ -216,8 +204,8 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ public void getCurrentResoure(DelegateExecution execution){ logger.trace("Start getCurrentResoure Process ") def currentIndex = execution.getVariable("currentResourceIndex") - List<Resource> instanceResourceList = execution.getVariable("instanceResourceList") - Resource currentResource = instanceResourceList.get(currentIndex) + List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") + Resource currentResource = sequencedResourceList.get(currentIndex) execution.setVariable("resourceType", currentResource.getModelInfo().getModelName()) logger.info("Now we deal with resource:" + currentResource.getModelInfo().getModelName()) logger.trace("COMPLETED getCurrentResource Process ") @@ -228,8 +216,8 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ def currentIndex = execution.getVariable("currentResourceIndex") def nextIndex = currentIndex + 1 execution.setVariable("currentResourceIndex", nextIndex) - List<Resource> instanceResourceList = execution.getVariable("instanceResourceList") - if(nextIndex >= instanceResourceList.size()){ + List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") + if(nextIndex >= sequencedResourceList.size()){ execution.setVariable("allResourceFinished", "true") }else{ execution.setVariable("allResourceFinished", "false") @@ -256,7 +244,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ resourceInput.setOperationId(operationId) resourceInput.setOperationType(operationType); def currentIndex = execution.getVariable("currentResourceIndex") - List<Resource> sequencedResourceList = execution.getVariable("instanceResourceList") + List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") Resource currentResource = sequencedResourceList.get(currentIndex) resourceInput.setResourceModelInfo(currentResource.getModelInfo()) resourceInput.getResourceModelInfo().setModelType(currentResource.getResourceType().toString()) @@ -320,8 +308,8 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ HttpResponse resp = bpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput, recipeParamXsd) def currentIndex = execution.getVariable("currentResourceIndex") - List<Resource> instanceResourceList = execution.getVariable("instanceResourceList") as List<Resource> - Resource currentResource = instanceResourceList.get(currentIndex) + List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") as List<Resource> + Resource currentResource = sequencedResourceList.get(currentIndex) if(ResourceType.VNF == currentResource.getResourceType()) { if (resp.getStatusLine().getStatusCode() > 199 && resp.getStatusLine().getStatusCode() < 300) { String responseString = EntityUtils.toString(resp.getEntity(), "UTF-8") 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 e24597aab3..481a79a7ef 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 @@ -58,9 +58,9 @@ import org.onap.so.utils.TargetEntity import org.springframework.web.util.UriUtils import javax.ws.rs.NotFoundException +import javax.ws.rs.core.MediaType import javax.ws.rs.core.Response - import static org.apache.commons.lang3.StringUtils.isBlank /** @@ -237,6 +237,9 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { )) { jObj.put("resourceInstanceId", eValue) } + else if (rt.equals("allotted-resource") && eKey.equals("allotted-resource.id")){ + jObj.put("resourceInstanceId", eValue) + } // for sp-partner and others else if (eKey.endsWith("-id")) { jObj.put("resourceInstanceId", eValue) @@ -386,7 +389,10 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { URL url = new URL(serviceAaiPath) HttpClient client = new HttpClientFactory().newXmlClient(url, TargetEntity.AAI) - + client.addBasicAuthHeader(UrnPropertiesReader.getVariable("aai.auth", execution), UrnPropertiesReader.getVariable("mso.msoKey", execution)) + client.addAdditionalHeader("X-FromAppId", "MSO") + client.addAdditionalHeader("X-TransactionId", utils.getRequestID()) + client.setAcceptType(MediaType.APPLICATION_XML) Response response = client.get() int responseCode = response.getStatus() @@ -413,12 +419,17 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { if(jObj.has("model-invariant-id")) { modelInvariantId = jObj.get("model-invariant-id") modelUuid = jObj.get("model-version-id") - modelCustomizationId = jObj.get("model-customization-id") + if (jObj.has("model-customization-id")) { + modelCustomizationId = jObj.get("model-customization-id") + } else { + logger.info("resource customization id is not found for :" + url) + } } jObj.put("modelInvariantId", modelInvariantId) jObj.put("modelVersionId", modelUuid) jObj.put("modelCustomizationId", modelCustomizationId) + logger.info("resource detail from AAI:" + jObj) } else { String exceptionMessage = "Get RelatedResource Received a Bad Response Code. Response Code is: " + responseCode @@ -505,11 +516,12 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String modelName = resource.getModelInfo().getModelName() String modelCustomizationUuid = resource.getModelInfo().getModelCustomizationUuid() + String modelUuid = resource.getModelInfo().getModelUuid() if (StringUtils.containsIgnoreCase(obj.get("resourceType"), modelName)) { resource.setResourceId(obj.get("resourceInstanceId")) //deleteRealResourceList.add(resource) matches = true; - } else if (modelCustomizationUuid.equals(obj.get("modelCustomizationId"))) { + } else if (modelCustomizationUuid.equals(obj.get("modelCustomizationId")) || modelUuid.equals(obj.get("model-version-id")) ) { resource.setResourceId(obj.get("resourceInstanceId")) resource.setResourceInstanceName(obj.get("resourceType")) //deleteRealResourceList.add(resource) @@ -624,4 +636,26 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { //to do } + /** + * Deletes the service instance in aai + */ + public void deleteServiceInstance(DelegateExecution execution) { + logger.trace("Entered deleteServiceInstance") + try { + String globalCustId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + AAIResourcesClient resourceClient = new AAIResourcesClient(); + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId) + resourceClient.delete(serviceInstanceUri) + + logger.trace("Exited deleteServiceInstance") + }catch(Exception e){ + logger.debug("Error occured within deleteServiceInstance method: " + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during deleteServiceInstance from aai") + } + } + + } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy index 2dcfcaa4f4..53c1e311e2 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy @@ -271,6 +271,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { execution.setVariable("sequencedResourceList", sequencedResourceList) execution.setVariable("parentVNF", parentVNF) logger.debug("resourceSequence: " + resourceSequence) + logger.debug("delete resource sequence list : " + sequencedResourceList) logger.debug(" ======== END sequenceResource Process ======== ") } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn index c2d4de3973..4cd4ab527f 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.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="2.0.0"> +<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.1.0"> <bpmn:process id="DeleteSDNCNetworkResource" name="DeleteSDNCNetworkResource" isExecutable="true"> <bpmn:startEvent id="deleteNetworkResource_StartEvent_delete" name="deleteNetworkResource_StartEvent"> <bpmn:outgoing>SequenceFlow_1qo2pln_delete</bpmn:outgoing> @@ -123,6 +123,7 @@ csi.sendSyncResponse(execution)</bpmn:script> <camunda:in source="recipeParamXsd" target="recipeParamXsd" /> <camunda:in source="URN_mso_workflow_sdncadapter_callback" target="URN_mso_workflow_sdncadapter_callback" /> <camunda:in source="resourceInput" target="resourceInput" /> + <camunda:in source="allotedParentServiceInstanceId" target="allotedParentServiceInstanceId" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0h3klf0_delete</bpmn:incoming> <bpmn:outgoing>SequenceFlow_00vqgvt_delete</bpmn:outgoing> @@ -154,145 +155,145 @@ dcsi.prepareUpdateAfterDeleteSDNCResource(execution)</bpmn:script> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteSDNCNetworkResource"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="deleteNetworkResource_StartEvent_delete"> - <dc:Bounds x="-111" y="111" width="36" height="36" /> + <dc:Bounds x="180" y="244" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-135" y="147" width="88" height="40" /> + <dc:Bounds x="156" y="280" width="88" height="40" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln_delete"> - <di:waypoint x="-75" y="129" /> - <di:waypoint x="-10" y="129" /> + <di:waypoint x="216" y="262" /> + <di:waypoint x="281" y="262" /> <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_delete"> - <di:waypoint x="593" y="129" /> - <di:waypoint x="684" y="129" /> + <di:waypoint x="884" y="262" /> + <di:waypoint x="975" y="262" /> <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_delete"> - <dc:Bounds x="493" y="89" width="100" height="80" /> + <dc:Bounds x="784" y="222" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c_delete"> - <dc:Bounds x="898" y="317" width="36" height="36" /> + <dc:Bounds x="1189" y="450" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="862" y="359" width="84" height="27" /> + <dc:Bounds x="1153" y="492" width="84" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0_delete"> - <di:waypoint x="624" y="335" /> - <di:waypoint x="709" y="335" /> + <di:waypoint x="915" y="468" /> + <di:waypoint x="1000" y="468" /> <bpmndi:BPMNLabel> <dc:Bounds x="719" y="314" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred_delete"> - <dc:Bounds x="524" y="295" width="100" height="80" /> + <dc:Bounds x="815" y="428" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0w2es8j_di" bpmnElement="SequenceFlow_0w2es8j_delete"> - <di:waypoint x="90" y="129" /> - <di:waypoint x="148" y="129" /> + <di:waypoint x="381" y="262" /> + <di:waypoint x="439" y="262" /> <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_delete"> - <di:waypoint x="248" y="129" /> - <di:waypoint x="325" y="129" /> + <di:waypoint x="539" y="262" /> + <di:waypoint x="616" y="262" /> <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_delete"> - <dc:Bounds x="-10" y="89" width="100" height="80" /> + <dc:Bounds x="281" y="222" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp_delete"> - <dc:Bounds x="148" y="89" width="100" height="80" /> + <dc:Bounds x="439" y="222" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1mz0vdx_di" bpmnElement="SequenceFlow_1mz0vdx_delete"> - <di:waypoint x="784" y="129" /> - <di:waypoint x="900" y="129" /> + <di:waypoint x="1075" y="262" /> + <di:waypoint x="1191" y="262" /> <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_delete"> - <di:waypoint x="950" y="169" /> - <di:waypoint x="950" y="246" /> - <di:waypoint x="-106" y="246" /> - <di:waypoint x="-106" y="335" /> - <di:waypoint x="9" y="335" /> + <di:waypoint x="1241" y="302" /> + <di:waypoint x="1241" y="379" /> + <di:waypoint x="185" y="379" /> + <di:waypoint x="185" y="468" /> + <di:waypoint x="300" y="468" /> <bpmndi:BPMNLabel> <dc:Bounds x="349" y="197" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1kqf4ge_di" bpmnElement="Task_0tfzqd4_delete"> - <dc:Bounds x="684" y="89" width="100" height="80" /> + <dc:Bounds x="975" y="222" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1q6ssz7_di" bpmnElement="Task_18tomkl_delete"> - <dc:Bounds x="900" y="89" width="100" height="80" /> + <dc:Bounds x="1191" y="222" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1cm8iwr_di" bpmnElement="ServiceTask_1cm8iwr_delete"> - <dc:Bounds x="355" y="295" width="100" height="80" /> + <dc:Bounds x="646" y="428" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1emjxm2_di" bpmnElement="ScriptTask_1emjxm2_delete"> - <dc:Bounds x="709" y="295" width="100" height="80" /> + <dc:Bounds x="1000" y="428" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_15wux6a_di" bpmnElement="SequenceFlow_15wux6a_delete"> - <di:waypoint x="809" y="335" /> - <di:waypoint x="898" y="335" /> + <di:waypoint x="1100" y="468" /> + <di:waypoint x="1189" y="468" /> <bpmndi:BPMNLabel> <dc:Bounds x="930" y="313" width="0" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0ds04u5_di" bpmnElement="SequenceFlow_0ds04u5_delete"> - <di:waypoint x="455" y="335" /> - <di:waypoint x="524" y="335" /> + <di:waypoint x="746" y="468" /> + <di:waypoint x="815" y="468" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_0xrgeq3_di" bpmnElement="ExclusiveGateway_0xrgeq3_delete" isMarkerVisible="true"> - <dc:Bounds x="325" y="104" width="50" height="50" /> + <dc:Bounds x="616" y="237" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="320" y="161" width="63" height="27" /> + <dc:Bounds x="611" y="294" width="63" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0jh88qw_di" bpmnElement="SequenceFlow_0jh88qw_delete"> - <di:waypoint x="375" y="129" /> - <di:waypoint x="493" y="129" /> + <di:waypoint x="666" y="262" /> + <di:waypoint x="784" y="262" /> <bpmndi:BPMNLabel> - <dc:Bounds x="427" y="111" width="14" height="14" /> + <dc:Bounds x="718" y="244" width="14" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0h3klf0_di" bpmnElement="SequenceFlow_0h3klf0_delete"> - <di:waypoint x="350" y="104" /> - <di:waypoint x="350" y="-12" /> - <di:waypoint x="493" y="-12" /> + <di:waypoint x="641" y="237" /> + <di:waypoint x="641" y="121" /> + <di:waypoint x="784" y="121" /> <bpmndi:BPMNLabel> - <dc:Bounds x="356" y="43" width="19" height="14" /> + <dc:Bounds x="647" y="176" width="19" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_00vqgvt_di" bpmnElement="SequenceFlow_00vqgvt_delete"> - <di:waypoint x="543" y="28" /> - <di:waypoint x="543" y="89" /> + <di:waypoint x="834" y="161" /> + <di:waypoint x="834" y="222" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_1lddjec_di" bpmnElement="Task_1xychp0_delete"> - <dc:Bounds x="493" y="-52" width="100" height="80" /> + <dc:Bounds x="784" y="81" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1wj862v_di" bpmnElement="Task_1ikbt2h_delete"> - <dc:Bounds x="205" y="295" width="100" height="80" /> + <dc:Bounds x="496" y="428" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0yooswe_di" bpmnElement="SequenceFlow_0yooswe_delete"> - <di:waypoint x="305" y="335" /> - <di:waypoint x="355" y="335" /> + <di:waypoint x="596" y="468" /> + <di:waypoint x="646" y="468" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_0bj0odq_di" bpmnElement="CallActivity_0bj0odq"> - <dc:Bounds x="9" y="295" width="100" height="80" /> + <dc:Bounds x="300" y="428" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0lplazm_di" bpmnElement="SequenceFlow_0lplazm"> - <di:waypoint x="109" y="335" /> - <di:waypoint x="205" y="335" /> + <di:waypoint x="400" y="468" /> + <di:waypoint x="496" y="468" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn index 76dd6facd6..125f08c49e 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DoCreateE2EServiceInstanceV3" name="DoCreateE2EServiceInstanceV3" isExecutable="true"> <bpmn2:startEvent id="createSI_startEvent" name="Start Flow"> <bpmn2:outgoing>SequenceFlow_1qiiycn</bpmn2:outgoing> @@ -9,8 +9,7 @@ <bpmn2:outgoing>SequenceFlow_0w9t6tc</bpmn2:outgoing> <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DoCreateE2EServiceInstance() -dcsi.preProcessRequest(execution) -</bpmn2:script> +dcsi.preProcessRequest(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:subProcess id="SubProcess_06d8lk8" name="Sub-process for Application Errors" triggeredByEvent="true"> <bpmn2:startEvent id="StartEvent_0yljq9y"> @@ -38,8 +37,7 @@ dcsi.preProcessRequest(execution) <bpmn2:outgoing>SequenceFlow_1lqktwf</bpmn2:outgoing> <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DoCreateE2EServiceInstance() -dcsi.preProcessRollback(execution) -</bpmn2:script> +dcsi.preProcessRollback(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1lqktwf" sourceRef="ScriptTask_0ocetux" targetRef="CallActivity_1srx6p6" /> <bpmn2:scriptTask id="ScriptTask_1p0vyip" name="Post Process Rollback" scriptFormat="groovy"> @@ -47,8 +45,7 @@ dcsi.preProcessRollback(execution) <bpmn2:outgoing>SequenceFlow_1xzgv5k</bpmn2:outgoing> <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DoCreateE2EServiceInstance() -dcsi.postProcessRollback(execution) -</bpmn2:script> +dcsi.postProcessRollback(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1xzgv5k" sourceRef="ScriptTask_1p0vyip" targetRef="EndEvent_117lkk3" /> </bpmn2:subProcess> @@ -98,10 +95,10 @@ dcsi.prepareDecomposeService(execution)</bpmn2:script> <bpmn2:sequenceFlow id="SequenceFlow_1qiiycn" sourceRef="createSI_startEvent" targetRef="preProcessRequest_ScriptTask" /> <bpmn2:sequenceFlow id="SequenceFlow_166w91p" sourceRef="IntermediateCatchEvent_0tv85pg" targetRef="ScriptTask_1cllqk3" /> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_16okck2" name="GoTo StartPrepareResource"> - <bpmn2:incoming>SequenceFlow_1tkgqu3</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_19zefa9</bpmn2:incoming> <bpmn2:linkEventDefinition name="StartPrepareResource" /> </bpmn2:intermediateThrowEvent> - <bpmn2:sequenceFlow id="SequenceFlow_1tkgqu3" sourceRef="ScriptTask_0q37vn9" targetRef="IntermediateThrowEvent_16okck2" /> + <bpmn2:sequenceFlow id="SequenceFlow_1tkgqu3" sourceRef="ScriptTask_0q37vn9" targetRef="Task_0osptcq" /> <bpmn2:sequenceFlow id="SequenceFlow_0w9t6tc" sourceRef="preProcessRequest_ScriptTask" targetRef="IntermediateThrowEvent_0bq4fxs" /> <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_05dus9b" name="StartPrepareResource"> <bpmn2:outgoing>SequenceFlow_0yuzaen</bpmn2:outgoing> @@ -156,7 +153,7 @@ ddsi.preInitResourcesOperStatus(execution)</bpmn2:script> <camunda:in source="msoRequestId" target="msoRequestId" /> <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_0b1dsaj</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_11zobkq</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0sphcy5</bpmn2:outgoing> </bpmn2:callActivity> <bpmn2:scriptTask id="ScriptTask_0ns08tn" name="PreProcess for Add Resources" scriptFormat="groovy"> @@ -168,6 +165,7 @@ csi.preProcessForAddResource(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="ScriptTask_19t13rd" name="PostProcess for Add Resource" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0sphcy5</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1mvvc6c</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_18gnns6</bpmn2:outgoing> <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi = new DoCreateE2EServiceInstance() @@ -193,253 +191,289 @@ dcsi.doTPResourcesAllocation(execution)</bpmn2:script> <bpmn2:sequenceFlow id="SequenceFlow_1y9rkfr" sourceRef="ScriptTask_0jxdler" targetRef="ScriptTask_1rzf8a1" /> <bpmn2:sequenceFlow id="SequenceFlow_0n7nbx3" sourceRef="ScriptTask_1rzf8a1" targetRef="ServiceTask_1asgesv" /> <bpmn2:sequenceFlow id="SequenceFlow_0ckto7v" sourceRef="ServiceTask_1asgesv" targetRef="ScriptTask_0ts3c3b" /> - <bpmn2:sequenceFlow id="SequenceFlow_0b1dsaj" sourceRef="ScriptTask_0ns08tn" targetRef="CallActivity_1gae03e" /> + <bpmn2:sequenceFlow id="SequenceFlow_0b1dsaj" sourceRef="ScriptTask_0ns08tn" targetRef="ExclusiveGateway_1hmlw0b" /> <bpmn2:sequenceFlow id="SequenceFlow_0sphcy5" sourceRef="CallActivity_1gae03e" targetRef="ScriptTask_19t13rd" /> <bpmn2:sequenceFlow id="SequenceFlow_022onug" sourceRef="ScriptTask_0ts3c3b" targetRef="ScriptTask_0ns08tn" /> <bpmn2:sequenceFlow id="SequenceFlow_18gnns6" sourceRef="ScriptTask_19t13rd" targetRef="EndEvent_1x4kvfh" /> <bpmn2:sequenceFlow id="SequenceFlow_0yuzaen" sourceRef="IntermediateCatchEvent_05dus9b" targetRef="ScriptTask_0jxdler" /> + <bpmn2:sequenceFlow id="SequenceFlow_19zefa9" sourceRef="Task_0osptcq" targetRef="IntermediateThrowEvent_16okck2" /> + <bpmn2:scriptTask id="Task_0osptcq" name="AAI Create Custom Relationship " scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1tkgqu3</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_19zefa9</bpmn2:outgoing> + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* +def ddsi = new DoCreateE2EServiceInstance() +ddsi.createCustomRelationship(execution)</bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:exclusiveGateway id="ExclusiveGateway_1hmlw0b" default="SequenceFlow_1mvvc6c"> + <bpmn2:incoming>SequenceFlow_0b1dsaj</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_11zobkq</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_1mvvc6c</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_11zobkq" name="yes" sourceRef="ExclusiveGateway_1hmlw0b" targetRef="CallActivity_1gae03e"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{(execution.getVariable("isCreateResourceListValid" ) == true)}</bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="SequenceFlow_1mvvc6c" sourceRef="ExclusiveGateway_1hmlw0b" targetRef="ScriptTask_19t13rd" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateE2EServiceInstanceV3"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_47" bpmnElement="createSI_startEvent"> - <dc:Bounds x="9" y="-22" width="36" height="36" /> + <dc:Bounds x="172" y="103" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="3" y="19" width="50" height="12" /> + <dc:Bounds x="166" y="144" width="50" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_61" bpmnElement="preProcessRequest_ScriptTask"> - <dc:Bounds x="117" y="-44" width="100" height="80" /> + <dc:Bounds x="280" y="81" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_06d8lk8_di" bpmnElement="SubProcess_06d8lk8" isExpanded="true"> - <dc:Bounds x="15" y="865" width="783" height="195" /> + <dc:Bounds x="178" y="990" width="783" height="195" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_0yljq9y_di" bpmnElement="StartEvent_0yljq9y"> - <dc:Bounds x="111" y="942" width="36" height="36" /> + <dc:Bounds x="274" y="1067" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="84" y="983" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_117lkk3_di" bpmnElement="EndEvent_117lkk3"> - <dc:Bounds x="744" y="942" width="36" height="36" /> + <dc:Bounds x="907" y="1067" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="717" y="983" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_1srx6p6_di" bpmnElement="CallActivity_1srx6p6"> - <dc:Bounds x="409" y="920" width="100" height="80" /> + <dc:Bounds x="572" y="1045" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0eumzpf_di" bpmnElement="SequenceFlow_0eumzpf"> - <di:waypoint x="509" y="960" /> - <di:waypoint x="577" y="960" /> + <di:waypoint x="672" y="1085" /> + <di:waypoint x="740" y="1085" /> <bpmndi:BPMNLabel> <dc:Bounds x="498" y="945" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0tgrn11_di" bpmnElement="SequenceFlow_0tgrn11"> - <di:waypoint x="147" y="960" /> - <di:waypoint x="246" y="960" /> + <di:waypoint x="310" y="1085" /> + <di:waypoint x="409" y="1085" /> <bpmndi:BPMNLabel> <dc:Bounds x="152" y="945" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0q37vn9_di" bpmnElement="ScriptTask_0q37vn9"> - <dc:Bounds x="1012" y="106" width="100" height="80" /> + <dc:Bounds x="1103" y="231" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0ocetux_di" bpmnElement="ScriptTask_0ocetux"> - <dc:Bounds x="246" y="920" width="100" height="80" /> + <dc:Bounds x="409" y="1045" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1lqktwf_di" bpmnElement="SequenceFlow_1lqktwf"> - <di:waypoint x="346" y="960" /> - <di:waypoint x="409" y="960" /> + <di:waypoint x="509" y="1085" /> + <di:waypoint x="572" y="1085" /> <bpmndi:BPMNLabel> <dc:Bounds x="333" y="945" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1p0vyip_di" bpmnElement="ScriptTask_1p0vyip"> - <dc:Bounds x="577" y="920" width="100" height="80" /> + <dc:Bounds x="740" y="1045" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1xzgv5k_di" bpmnElement="SequenceFlow_1xzgv5k"> - <di:waypoint x="677" y="960" /> - <di:waypoint x="709" y="960" /> - <di:waypoint x="709" y="960" /> - <di:waypoint x="744" y="960" /> + <di:waypoint x="840" y="1085" /> + <di:waypoint x="872" y="1085" /> + <di:waypoint x="872" y="1085" /> + <di:waypoint x="907" y="1085" /> <bpmndi:BPMNLabel> <dc:Bounds x="679" y="960" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_11saqvj_di" bpmnElement="IntermediateThrowEvent_0bq4fxs"> - <dc:Bounds x="1306" y="-22" width="36" height="36" /> + <dc:Bounds x="1469" y="103" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1281" y="18" width="88" height="36" /> + <dc:Bounds x="1444" y="143" width="88" height="40" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1o01d7d_di" bpmnElement="ScriptTask_1o01d7d"> - <dc:Bounds x="704" y="106" width="100" height="80" /> + <dc:Bounds x="867" y="231" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0biblpc_di" bpmnElement="CallActivity_0biblpc"> - <dc:Bounds x="469" y="106" width="100" height="80" /> + <dc:Bounds x="632" y="231" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1cllqk3_di" bpmnElement="ScriptTask_1cllqk3"> - <dc:Bounds x="187" y="106" width="100" height="80" /> + <dc:Bounds x="350" y="231" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateCatchEvent_0tv85pg_di" bpmnElement="IntermediateCatchEvent_0tv85pg"> - <dc:Bounds x="17" y="128" width="36" height="36" /> + <dc:Bounds x="180" y="253" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-7" y="164" width="88" height="24" /> + <dc:Bounds x="156" y="289" width="88" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0xjwb45_di" bpmnElement="SequenceFlow_0xjwb45"> - <di:waypoint x="569" y="146" /> - <di:waypoint x="704" y="146" /> + <di:waypoint x="732" y="271" /> + <di:waypoint x="867" y="271" /> <bpmndi:BPMNLabel> <dc:Bounds x="592" y="125" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0qxzgvq_di" bpmnElement="SequenceFlow_0qxzgvq"> - <di:waypoint x="287" y="146" /> - <di:waypoint x="469" y="146" /> + <di:waypoint x="450" y="271" /> + <di:waypoint x="632" y="271" /> <bpmndi:BPMNLabel> <dc:Bounds x="333" y="125" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1qiiycn_di" bpmnElement="SequenceFlow_1qiiycn"> - <di:waypoint x="45" y="-4" /> - <di:waypoint x="117" y="-4" /> + <di:waypoint x="208" y="121" /> + <di:waypoint x="280" y="121" /> <bpmndi:BPMNLabel> <dc:Bounds x="36" y="-25" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_166w91p_di" bpmnElement="SequenceFlow_166w91p"> - <di:waypoint x="53" y="146" /> - <di:waypoint x="187" y="146" /> + <di:waypoint x="216" y="271" /> + <di:waypoint x="350" y="271" /> <bpmndi:BPMNLabel> <dc:Bounds x="75" y="125" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_16okck2_di" bpmnElement="IntermediateThrowEvent_16okck2"> - <dc:Bounds x="1306" y="128" width="36" height="36" /> + <dc:Bounds x="1469" y="253" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1285" y="169" width="82" height="36" /> + <dc:Bounds x="1448" y="294" width="83" height="40" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1tkgqu3_di" bpmnElement="SequenceFlow_1tkgqu3"> - <di:waypoint x="1112" y="146" /> - <di:waypoint x="1222" y="146" /> - <di:waypoint x="1222" y="146" /> - <di:waypoint x="1306" y="146" /> + <di:waypoint x="1203" y="271" /> + <di:waypoint x="1286" y="271" /> <bpmndi:BPMNLabel> <dc:Bounds x="1192" y="140" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0w9t6tc_di" bpmnElement="SequenceFlow_0w9t6tc"> - <di:waypoint x="217" y="-4" /> - <di:waypoint x="762" y="-4" /> - <di:waypoint x="762" y="-4" /> - <di:waypoint x="1306" y="-4" /> + <di:waypoint x="380" y="121" /> + <di:waypoint x="925" y="121" /> + <di:waypoint x="925" y="121" /> + <di:waypoint x="1469" y="121" /> <bpmndi:BPMNLabel> <dc:Bounds x="732" y="-10" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateCatchEvent_05dus9b_di" bpmnElement="IntermediateCatchEvent_05dus9b"> - <dc:Bounds x="18" y="282" width="36" height="36" /> + <dc:Bounds x="181" y="407" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-3" y="318" width="82" height="24" /> + <dc:Bounds x="160" y="443" width="83" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_012h7yx_di" bpmnElement="SequenceFlow_012h7yx"> - <di:waypoint x="804" y="146" /> - <di:waypoint x="917" y="146" /> - <di:waypoint x="917" y="146" /> - <di:waypoint x="1012" y="146" /> + <di:waypoint x="967" y="271" /> + <di:waypoint x="1103" y="271" /> <bpmndi:BPMNLabel> <dc:Bounds x="887" y="139" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1rzf8a1_di" bpmnElement="ScriptTask_1rzf8a1"> - <dc:Bounds x="262" y="260" width="100" height="80" /> + <dc:Bounds x="425" y="385" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1asgesv_di" bpmnElement="ServiceTask_1asgesv"> - <dc:Bounds x="433" y="260" width="100" height="80" /> + <dc:Bounds x="576" y="385" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_1gae03e_di" bpmnElement="CallActivity_1gae03e"> - <dc:Bounds x="957" y="260" width="100" height="80" /> + <dc:Bounds x="1146" y="385" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0ns08tn_di" bpmnElement="ScriptTask_0ns08tn"> - <dc:Bounds x="785" y="260" width="100" height="80" /> + <dc:Bounds x="894" y="385" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_19t13rd_di" bpmnElement="ScriptTask_19t13rd"> - <dc:Bounds x="1131" y="260" width="100" height="80" /> + <dc:Bounds x="1294" y="385" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1x4kvfh_di" bpmnElement="EndEvent_1x4kvfh"> - <dc:Bounds x="1301" y="282" width="36" height="36" /> + <dc:Bounds x="1464" y="407" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="1274" y="322" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0jxdler_di" bpmnElement="ScriptTask_0jxdler"> - <dc:Bounds x="88" y="260" width="100" height="80" /> + <dc:Bounds x="251" y="385" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0ts3c3b_di" bpmnElement="ScriptTask_0ts3c3b"> - <dc:Bounds x="599" y="260" width="100" height="80" /> + <dc:Bounds x="733" y="385" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1y9rkfr_di" bpmnElement="SequenceFlow_1y9rkfr"> - <di:waypoint x="188" y="300" /> - <di:waypoint x="262" y="300" /> + <di:waypoint x="351" y="425" /> + <di:waypoint x="425" y="425" /> <bpmndi:BPMNLabel> <dc:Bounds x="180" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0n7nbx3_di" bpmnElement="SequenceFlow_0n7nbx3"> - <di:waypoint x="362" y="300" /> - <di:waypoint x="433" y="300" /> + <di:waypoint x="525" y="425" /> + <di:waypoint x="576" y="425" /> <bpmndi:BPMNLabel> <dc:Bounds x="353.5" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0ckto7v_di" bpmnElement="SequenceFlow_0ckto7v"> - <di:waypoint x="533" y="300" /> - <di:waypoint x="599" y="300" /> + <di:waypoint x="676" y="425" /> + <di:waypoint x="733" y="425" /> <bpmndi:BPMNLabel> <dc:Bounds x="521" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0b1dsaj_di" bpmnElement="SequenceFlow_0b1dsaj"> - <di:waypoint x="885" y="300" /> - <di:waypoint x="957" y="300" /> + <di:waypoint x="994" y="425" /> + <di:waypoint x="1044" y="425" /> <bpmndi:BPMNLabel> <dc:Bounds x="876" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0sphcy5_di" bpmnElement="SequenceFlow_0sphcy5"> - <di:waypoint x="1057" y="300" /> - <di:waypoint x="1131" y="300" /> + <di:waypoint x="1246" y="425" /> + <di:waypoint x="1294" y="425" /> <bpmndi:BPMNLabel> <dc:Bounds x="1049" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_022onug_di" bpmnElement="SequenceFlow_022onug"> - <di:waypoint x="699" y="300" /> - <di:waypoint x="785" y="300" /> + <di:waypoint x="833" y="425" /> + <di:waypoint x="894" y="425" /> <bpmndi:BPMNLabel> <dc:Bounds x="697" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_18gnns6_di" bpmnElement="SequenceFlow_18gnns6"> - <di:waypoint x="1231" y="300" /> - <di:waypoint x="1301" y="300" /> + <di:waypoint x="1394" y="425" /> + <di:waypoint x="1464" y="425" /> <bpmndi:BPMNLabel> <dc:Bounds x="1221" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0yuzaen_di" bpmnElement="SequenceFlow_0yuzaen"> - <di:waypoint x="54" y="300" /> - <di:waypoint x="88" y="300" /> + <di:waypoint x="217" y="425" /> + <di:waypoint x="251" y="425" /> <bpmndi:BPMNLabel> <dc:Bounds x="71" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_19zefa9_di" bpmnElement="SequenceFlow_19zefa9"> + <di:waypoint x="1386" y="271" /> + <di:waypoint x="1469" y="271" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1495sm9_di" bpmnElement="Task_0osptcq"> + <dc:Bounds x="1286" y="231" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1hmlw0b_di" bpmnElement="ExclusiveGateway_1hmlw0b" isMarkerVisible="true"> + <dc:Bounds x="1044" y="400" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_11zobkq_di" bpmnElement="SequenceFlow_11zobkq"> + <di:waypoint x="1094" y="425" /> + <di:waypoint x="1146" y="425" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1112" y="407" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1mvvc6c_di" bpmnElement="SequenceFlow_1mvvc6c"> + <di:waypoint x="1069" y="450" /> + <di:waypoint x="1069" y="607" /> + <di:waypoint x="1344" y="607" /> + <di:waypoint x="1344" y="465" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateResources.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateResources.bpmn index 75767929aa..2a2093522f 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateResources.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateResources.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.16.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DoCreateResourcesV3" name="DoCreateResourcesV3" isExecutable="true"> <bpmn2:startEvent id="createSI_startEvent" name="Start Flow"> <bpmn2:outgoing>SequenceFlow_1qiiycn</bpmn2:outgoing> @@ -9,8 +9,7 @@ <bpmn2:outgoing>SequenceFlow_0w9t6tc</bpmn2:outgoing> <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DoCreateResources() -dcsi.preProcessRequest(execution) -</bpmn2:script> +dcsi.preProcessRequest(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="ScriptTask_1xdjlzm" name="Post Config Service Instance Creation" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_16nxl6h</bpmn2:incoming> @@ -48,7 +47,7 @@ ddsi.parseNextResource(execution)</bpmn2:script> <bpmn2:sequenceFlow id="SequenceFlow_1jenxlp" sourceRef="ScriptTask_0y4u2ty" targetRef="ExclusiveGateway_0n9y4du" /> <bpmn2:scriptTask id="ScriptTask_0l4nkqr" name="Get Current Resource" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0q6uy30</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_1obf0cq</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1qozd66</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0uiygod</bpmn2:outgoing> <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoCreateResources() @@ -103,7 +102,7 @@ ddsi.executeResourceRecipe(execution)</bpmn2:script> <bpmn2:sequenceFlow id="SequenceFlow_0uiygod" sourceRef="ScriptTask_0l4nkqr" targetRef="Task_0qlkmvt" /> <bpmn2:sequenceFlow id="SequenceFlow_1u9k0dm" sourceRef="Task_0qlkmvt" targetRef="Task_12ghoph" /> <bpmn2:sequenceFlow id="SequenceFlow_13c7bhn" sourceRef="Task_12ghoph" targetRef="ScriptTask_0y4u2ty" /> - <bpmn2:sequenceFlow id="SequenceFlow_1qozd66" sourceRef="IntermediateCatchEvent_02bah5m" targetRef="Task_0g7zo7b" /> + <bpmn2:sequenceFlow id="SequenceFlow_1qozd66" sourceRef="IntermediateCatchEvent_02bah5m" targetRef="ScriptTask_0l4nkqr" /> <bpmn2:endEvent id="EndEvent_1ddg1di"> <bpmn2:incoming>SequenceFlow_0epxs3b</bpmn2:incoming> </bpmn2:endEvent> @@ -134,252 +133,237 @@ def ddsi = new DoCreateResources() ddsi.prepareServiceTopologyRequest(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_0k0f7lm" sourceRef="Task_1blaq0f" targetRef="Task_0io5qby" /> - <bpmn2:sequenceFlow id="SequenceFlow_1obf0cq" sourceRef="Task_0g7zo7b" targetRef="ScriptTask_0l4nkqr" /> - <bpmn2:scriptTask id="Task_0g7zo7b" name="Prepare Instnace ResourceList" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1qozd66</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1obf0cq</bpmn2:outgoing> - <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* -def ddsi = new DoCreateResources() -ddsi.prepareInstanceResourceList(execution)</bpmn2:script> - </bpmn2:scriptTask> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateResourcesV3"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_47" bpmnElement="createSI_startEvent"> - <dc:Bounds x="18" y="-207" width="36" height="36" /> + <dc:Bounds x="215" y="103" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="12" y="-166" width="50" height="12" /> + <dc:Bounds x="209" y="144" width="50" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_61" bpmnElement="preProcessRequest_ScriptTask"> - <dc:Bounds x="126" y="-229" width="100" height="80" /> + <dc:Bounds x="323" y="81" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1xdjlzm_di" bpmnElement="ScriptTask_1xdjlzm"> - <dc:Bounds x="1119" y="485" width="100" height="80" /> + <dc:Bounds x="1316" y="795" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0qi8cgg_di" bpmnElement="Task_0io5qby"> - <dc:Bounds x="1047" y="353" width="100" height="80" /> + <dc:Bounds x="1244" y="663" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_11f2zuu_di" bpmnElement="SequenceFlow_11f2zuu"> - <di:waypoint x="1147" y="393" /> - <di:waypoint x="1219" y="393" /> - <di:waypoint x="1219" y="300" /> - <di:waypoint x="1315" y="300" /> + <di:waypoint x="1344" y="703" /> + <di:waypoint x="1416" y="703" /> + <di:waypoint x="1416" y="610" /> + <di:waypoint x="1512" y="610" /> <bpmndi:BPMNLabel> <dc:Bounds x="1189" y="340.5" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1y0los4_di" bpmnElement="ScriptTask_1y0los4"> - <dc:Bounds x="444" y="260" width="100" height="80" /> + <dc:Bounds x="641" y="570" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_13d9g1n_di" bpmnElement="SequenceFlow_13d9g1n"> - <di:waypoint x="544" y="300" /> - <di:waypoint x="753" y="300" /> + <di:waypoint x="741" y="610" /> + <di:waypoint x="950" y="610" /> <bpmndi:BPMNLabel> <dc:Bounds x="603.5" y="279" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_0n9y4du_di" bpmnElement="ExclusiveGateway_0n9y4du" isMarkerVisible="true"> - <dc:Bounds x="929" y="500" width="50" height="50" /> + <dc:Bounds x="1126" y="810" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="911" y="454" width="85" height="36" /> + <dc:Bounds x="1109" y="764" width="83" height="40" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0q6uy30_di" bpmnElement="SequenceFlow_0q6uy30"> - <di:waypoint x="954" y="550" /> - <di:waypoint x="954" y="691" /> - <di:waypoint x="246" y="691" /> - <di:waypoint x="246" y="565" /> + <di:waypoint x="1151" y="860" /> + <di:waypoint x="1151" y="1001" /> + <di:waypoint x="443" y="1001" /> + <di:waypoint x="443" y="875" /> <bpmndi:BPMNLabel> - <dc:Bounds x="593" y="670" width="15" height="12" /> + <dc:Bounds x="791" y="980" width="13" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0y4u2ty_di" bpmnElement="ScriptTask_0y4u2ty"> - <dc:Bounds x="728" y="485" width="100" height="80" /> + <dc:Bounds x="925" y="795" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1jenxlp_di" bpmnElement="SequenceFlow_1jenxlp"> - <di:waypoint x="828" y="525" /> - <di:waypoint x="929" y="525" /> + <di:waypoint x="1025" y="835" /> + <di:waypoint x="1126" y="835" /> <bpmndi:BPMNLabel> <dc:Bounds x="833.5" y="504" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0l4nkqr_di" bpmnElement="ScriptTask_0l4nkqr"> - <dc:Bounds x="196" y="485" width="100" height="80" /> + <dc:Bounds x="393" y="795" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_07rr3wp_di" bpmnElement="ExclusiveGateway_07rr3wp" isMarkerVisible="true"> - <dc:Bounds x="753" y="275" width="50" height="50" /> + <dc:Bounds x="950" y="585" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="734" y="243" width="88" height="24" /> + <dc:Bounds x="931" y="553" width="88" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_18wj44x_di" bpmnElement="SequenceFlow_18wj44x"> - <di:waypoint x="803" y="300" /> - <di:waypoint x="1315" y="300" /> + <di:waypoint x="1000" y="610" /> + <di:waypoint x="1512" y="610" /> <bpmndi:BPMNLabel> - <dc:Bounds x="831" y="294" width="15" height="12" /> + <dc:Bounds x="1029" y="604" width="13" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0u88n0f_di" bpmnElement="Task_0qlkmvt"> - <dc:Bounds x="357" y="485" width="100" height="80" /> + <dc:Bounds x="554" y="795" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1y17r20_di" bpmnElement="Task_12ghoph"> - <dc:Bounds x="551" y="485" width="100" height="80" /> + <dc:Bounds x="748" y="795" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_11saqvj_di" bpmnElement="IntermediateThrowEvent_0bq4fxs"> - <dc:Bounds x="1315" y="-207" width="36" height="36" /> + <dc:Bounds x="1512" y="103" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1292" y="-167" width="88" height="36" /> + <dc:Bounds x="1490" y="143" width="86" height="40" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1qiiycn_di" bpmnElement="SequenceFlow_1qiiycn"> - <di:waypoint x="54" y="-189" /> - <di:waypoint x="126" y="-189" /> + <di:waypoint x="251" y="121" /> + <di:waypoint x="323" y="121" /> <bpmndi:BPMNLabel> <dc:Bounds x="90" y="-210" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0w9t6tc_di" bpmnElement="SequenceFlow_0w9t6tc"> - <di:waypoint x="226" y="-189" /> - <di:waypoint x="771" y="-189" /> - <di:waypoint x="771" y="-189" /> - <di:waypoint x="1315" y="-189" /> + <di:waypoint x="423" y="121" /> + <di:waypoint x="968" y="121" /> + <di:waypoint x="968" y="121" /> + <di:waypoint x="1512" y="121" /> <bpmndi:BPMNLabel> <dc:Bounds x="786" y="-195" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_0f2w7aj_di" bpmnElement="IntermediateThrowEvent_0f2w7aj"> - <dc:Bounds x="1315" y="282" width="36" height="36" /> + <dc:Bounds x="1512" y="592" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1299" y="323" width="73" height="24" /> + <dc:Bounds x="1497" y="633" width="72" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1vprtt9_di" bpmnElement="SequenceFlow_1vprtt9"> - <di:waypoint x="778" y="325" /> - <di:waypoint x="778" y="393" /> - <di:waypoint x="861" y="394" /> + <di:waypoint x="975" y="635" /> + <di:waypoint x="975" y="703" /> + <di:waypoint x="1058" y="704" /> <bpmndi:BPMNLabel> - <dc:Bounds x="784" y="353" width="20" height="12" /> + <dc:Bounds x="982" y="663" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateCatchEvent_05dus9b_di" bpmnElement="IntermediateCatchEvent_05dus9b"> - <dc:Bounds x="18" y="282" width="36" height="36" /> + <dc:Bounds x="215" y="592" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-3" y="318" width="82" height="24" /> + <dc:Bounds x="194" y="628" width="83" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1hbesp9_di" bpmnElement="SequenceFlow_1hbesp9"> - <di:waypoint x="54" y="300" /> - <di:waypoint x="444" y="300" /> + <di:waypoint x="251" y="610" /> + <di:waypoint x="641" y="610" /> <bpmndi:BPMNLabel> <dc:Bounds x="204" y="279" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateCatchEvent_02bah5m_di" bpmnElement="IntermediateCatchEvent_02bah5m"> - <dc:Bounds x="-26" y="507" width="36" height="36" /> + <dc:Bounds x="171" y="817" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-41" y="543" width="72" height="14" /> + <dc:Bounds x="156" y="853" width="72" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_16nxl6h_di" bpmnElement="SequenceFlow_16nxl6h"> - <di:waypoint x="979" y="525" /> - <di:waypoint x="1119" y="525" /> + <di:waypoint x="1176" y="835" /> + <di:waypoint x="1316" y="835" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1040" y="504" width="19" height="12" /> + <dc:Bounds x="1238" y="814" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0uiygod_di" bpmnElement="SequenceFlow_0uiygod"> - <di:waypoint x="296" y="525" /> - <di:waypoint x="357" y="525" /> + <di:waypoint x="493" y="835" /> + <di:waypoint x="554" y="835" /> <bpmndi:BPMNLabel> <dc:Bounds x="326.5" y="504" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1u9k0dm_di" bpmnElement="SequenceFlow_1u9k0dm"> - <di:waypoint x="457" y="525" /> - <di:waypoint x="551" y="525" /> + <di:waypoint x="654" y="835" /> + <di:waypoint x="748" y="835" /> <bpmndi:BPMNLabel> <dc:Bounds x="504" y="504" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_13c7bhn_di" bpmnElement="SequenceFlow_13c7bhn"> - <di:waypoint x="651" y="525" /> - <di:waypoint x="728" y="525" /> + <di:waypoint x="848" y="835" /> + <di:waypoint x="925" y="835" /> <bpmndi:BPMNLabel> <dc:Bounds x="689.5" y="504" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1qozd66_di" bpmnElement="SequenceFlow_1qozd66"> - <di:waypoint x="10" y="525" /> - <di:waypoint x="52" y="525" /> + <di:waypoint x="207" y="835" /> + <di:waypoint x="393" y="835" /> <bpmndi:BPMNLabel> <dc:Bounds x="125" y="504" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1ddg1di_di" bpmnElement="EndEvent_1ddg1di"> - <dc:Bounds x="1314.8151147098515" y="506.9419703103914" width="36" height="36" /> + <dc:Bounds x="1512" y="817" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="1332.8151147098515" y="546.9419703103914" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0epxs3b_di" bpmnElement="SequenceFlow_0epxs3b"> - <di:waypoint x="1219" y="525" /> - <di:waypoint x="1315" y="525" /> + <di:waypoint x="1416" y="835" /> + <di:waypoint x="1512" y="835" /> <bpmndi:BPMNLabel> <dc:Bounds x="1267" y="504" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_0sfdqc1_di" bpmnElement="SubProcess_0sfdqc1" isExpanded="true"> - <dc:Bounds x="338" y="817" width="467" height="193" /> + <dc:Bounds x="535" y="1127" width="467" height="193" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_0x7o2ug_di" bpmnElement="StartEvent_0x7o2ug"> - <dc:Bounds x="407" y="885" width="36" height="36" /> + <dc:Bounds x="604" y="1195" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="335" y="926" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0lgdyyb_di" bpmnElement="EndEvent_0lgdyyb"> - <dc:Bounds x="700" y="885" width="36" height="36" /> + <dc:Bounds x="897" y="1195" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="628" y="926" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1648adp_di" bpmnElement="ScriptTask_1648adp"> - <dc:Bounds x="511" y="863" width="100" height="80" /> + <dc:Bounds x="708" y="1173" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0gr9xqj_di" bpmnElement="SequenceFlow_0gr9xqj"> - <di:waypoint x="443" y="903" /> - <di:waypoint x="511" y="903" /> + <di:waypoint x="640" y="1213" /> + <di:waypoint x="708" y="1213" /> <bpmndi:BPMNLabel> <dc:Bounds x="387" y="888" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0a6l29p_di" bpmnElement="SequenceFlow_0a6l29p"> - <di:waypoint x="611" y="903" /> - <di:waypoint x="700" y="903" /> + <di:waypoint x="808" y="1213" /> + <di:waypoint x="897" y="1213" /> <bpmndi:BPMNLabel> <dc:Bounds x="567.5" y="888" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0dh2mj1_di" bpmnElement="Task_1blaq0f"> - <dc:Bounds x="861" y="354" width="100" height="80" /> + <dc:Bounds x="1058" y="664" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0k0f7lm_di" bpmnElement="SequenceFlow_0k0f7lm"> - <di:waypoint x="961" y="394" /> - <di:waypoint x="1047" y="393" /> + <di:waypoint x="1158" y="704" /> + <di:waypoint x="1244" y="703" /> <bpmndi:BPMNLabel> <dc:Bounds x="1004" y="372.5" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1obf0cq_di" bpmnElement="SequenceFlow_1obf0cq"> - <di:waypoint x="152" y="525" /> - <di:waypoint x="196" y="525" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0iag9tv_di" bpmnElement="Task_0g7zo7b"> - <dc:Bounds x="52" y="485" width="100" height="80" /> - </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn index 4d0324e478..1149cc9ea9 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn @@ -9,8 +9,7 @@ <bpmn:outgoing>SequenceFlow_11e6bfy</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoDeleteE2EServiceInstance() -ddsi.preProcessRequest(execution) -</bpmn:script> +ddsi.preProcessRequest(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:endEvent id="EndEvent_1uqzt26"> <bpmn:incoming>SequenceFlow_0e7inkl</bpmn:incoming> @@ -27,7 +26,7 @@ ddsi.postProcessAAIGET(execution)</bpmn:script> <bpmn:incoming>SequenceFlow_12rr1yy</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0e7inkl</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def ddsi = new DoCustomDeleteE2EServiceInstance() +def ddsi = new DoDeleteE2EServiceInstance() ddsi.deleteServiceInstance(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:subProcess id="SubProcess_1u8zt9i" name="Sub-process for UnexpectedErrors" triggeredByEvent="true"> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/AbstractSDNCTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/AbstractSDNCTask.java new file mode 100644 index 0000000000..c134f31b42 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/AbstractSDNCTask.java @@ -0,0 +1,22 @@ +package org.onap.so.bpmn.infrastructure.sdnc.tasks; + +import java.net.URI; +import javax.ws.rs.core.UriBuilder; +import org.onap.so.client.sdnc.beans.SDNCRequest; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +public class AbstractSDNCTask { + + @Autowired + Environment env; + + + public URI buildCallbackURI(SDNCRequest sdncRequest) { + UriBuilder builder = UriBuilder.fromPath(env.getRequiredProperty("mso.workflow.message.endpoint")) + .path(sdncRequest.getCorrelationName()).path(sdncRequest.getCorrelationValue()); + return builder.build(); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java index e4dd35503e..b85e33144f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java @@ -22,8 +22,6 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks; -import java.net.URI; -import javax.ws.rs.core.UriBuilder; import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; @@ -52,7 +50,7 @@ import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @Component -public class SDNCActivateTasks { +public class SDNCActivateTasks extends AbstractSDNCTask { public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired @@ -77,9 +75,9 @@ public class SDNCActivateTasks { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); CloudRegion cloudRegion = gBBInput.getCloudRegion(); Customer customer = gBBInput.getCustomer(); - GenericResourceApiVnfOperationInformation req = - sdncVnfResources.activateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext); SDNCRequest sdncRequest = new SDNCRequest(); + GenericResourceApiVnfOperationInformation req = sdncVnfResources.activateVnf(vnf, serviceInstance, customer, + cloudRegion, requestContext, buildCallbackURI(sdncRequest)); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VNF); execution.setVariable(SDNC_REQUEST, sdncRequest); @@ -127,11 +125,8 @@ public class SDNCActivateTasks { Customer customer = gBBInput.getCustomer(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); SDNCRequest sdncRequest = new SDNCRequest(); - UriBuilder builder = UriBuilder.fromPath(env.getRequiredProperty("mso.workflow.message.endpoint")) - .path(sdncRequest.getCorrelationName()).path(sdncRequest.getCorrelationValue()); - URI uri = builder.build(); GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.activateVfModule(vfModule, vnf, - serviceInstance, customer, cloudRegion, requestContext, uri); + serviceInstance, customer, cloudRegion, requestContext, buildCallbackURI(sdncRequest)); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); execution.setVariable(SDNC_REQUEST, sdncRequest); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java index c100cd6cee..ab2647a68d 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java @@ -22,8 +22,6 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks; -import java.net.URI; -import javax.ws.rs.core.UriBuilder; import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; @@ -55,7 +53,7 @@ import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @Component -public class SDNCAssignTasks { +public class SDNCAssignTasks extends AbstractSDNCTask { private static final Logger logger = LoggerFactory.getLogger(SDNCAssignTasks.class); public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired @@ -100,9 +98,11 @@ public class SDNCAssignTasks { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); Customer customer = gBBInput.getCustomer(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); - GenericResourceApiVnfOperationInformation req = sdncVnfResources.assignVnf(vnf, serviceInstance, customer, - cloudRegion, requestContext, Boolean.TRUE.equals(vnf.isCallHoming())); SDNCRequest sdncRequest = new SDNCRequest(); + + GenericResourceApiVnfOperationInformation req = + sdncVnfResources.assignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext, + Boolean.TRUE.equals(vnf.isCallHoming()), buildCallbackURI(sdncRequest)); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VNF); execution.setVariable(SDNC_REQUEST, sdncRequest); @@ -128,11 +128,9 @@ public class SDNCAssignTasks { Customer customer = gBBInput.getCustomer(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); SDNCRequest sdncRequest = new SDNCRequest(); - UriBuilder builder = UriBuilder.fromPath(env.getRequiredProperty("mso.workflow.message.endpoint")) - .path(sdncRequest.getCorrelationName()).path(sdncRequest.getCorrelationValue()); - URI uri = builder.build(); - GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.assignVfModule(vfModule, - volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, uri); + GenericResourceApiVfModuleOperationInformation req = + sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, + cloudRegion, requestContext, buildCallbackURI(sdncRequest)); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); execution.setVariable(SDNC_REQUEST, sdncRequest); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java index acf48acdda..c5ebc5e447 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java @@ -20,8 +20,6 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks; -import java.net.URI; -import javax.ws.rs.core.UriBuilder; import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; @@ -49,7 +47,7 @@ import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @Component -public class SDNCChangeAssignTasks { +public class SDNCChangeAssignTasks extends AbstractSDNCTask { public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCNetworkResources sdncNetworkResources; @@ -88,9 +86,10 @@ public class SDNCChangeAssignTasks { GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); - GenericResourceApiVnfOperationInformation req = sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, - gBBInput.getCustomer(), gBBInput.getCloudRegion(), gBBInput.getRequestContext()); SDNCRequest sdncRequest = new SDNCRequest(); + GenericResourceApiVnfOperationInformation req = + sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, gBBInput.getCustomer(), + gBBInput.getCloudRegion(), gBBInput.getRequestContext(), buildCallbackURI(sdncRequest)); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VNF); execution.setVariable(SDNC_REQUEST, sdncRequest); @@ -127,11 +126,8 @@ public class SDNCChangeAssignTasks { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); Customer customer = gBBInput.getCustomer(); SDNCRequest sdncRequest = new SDNCRequest(); - UriBuilder builder = UriBuilder.fromPath(env.getRequiredProperty("mso.workflow.message.endpoint")) - .path(sdncRequest.getCorrelationName()).path(sdncRequest.getCorrelationValue()); - URI uri = builder.build(); GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.changeAssignVfModule(vfModule, - vnf, serviceInstance, customer, cloudRegion, requestContext, uri); + vnf, serviceInstance, customer, cloudRegion, requestContext, buildCallbackURI(sdncRequest)); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); execution.setVariable(SDNC_REQUEST, sdncRequest); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java index 3fc25196e1..3c42f76d73 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java @@ -22,8 +22,6 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks; -import java.net.URI; -import javax.ws.rs.core.UriBuilder; import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; @@ -53,7 +51,7 @@ import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @Component -public class SDNCDeactivateTasks { +public class SDNCDeactivateTasks extends AbstractSDNCTask { public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired @@ -82,11 +80,8 @@ public class SDNCDeactivateTasks { Customer customer = gBBInput.getCustomer(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); SDNCRequest sdncRequest = new SDNCRequest(); - UriBuilder builder = UriBuilder.fromPath(env.getRequiredProperty("mso.workflow.message.endpoint")) - .path(sdncRequest.getCorrelationName()).path(sdncRequest.getCorrelationValue()); - URI uri = builder.build(); GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.deactivateVfModule(vfModule, vnf, - serviceInstance, customer, cloudRegion, requestContext, uri); + serviceInstance, customer, cloudRegion, requestContext, buildCallbackURI(sdncRequest)); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); execution.setVariable(SDNC_REQUEST, sdncRequest); @@ -111,9 +106,9 @@ public class SDNCDeactivateTasks { vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); CloudRegion cloudRegion = gBBInput.getCloudRegion(); Customer customer = gBBInput.getCustomer(); - GenericResourceApiVnfOperationInformation req = - sdncVnfResources.deactivateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext); SDNCRequest sdncRequest = new SDNCRequest(); + GenericResourceApiVnfOperationInformation req = sdncVnfResources.deactivateVnf(vnf, serviceInstance, + customer, cloudRegion, requestContext, buildCallbackURI(sdncRequest)); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VNF); execution.setVariable(SDNC_REQUEST, sdncRequest); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java index 4721bf56f1..e3c9785ab2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java @@ -22,8 +22,6 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks; -import java.net.URI; -import javax.ws.rs.core.UriBuilder; import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; @@ -53,7 +51,7 @@ import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @Component -public class SDNCUnassignTasks { +public class SDNCUnassignTasks extends AbstractSDNCTask { public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired @@ -98,11 +96,8 @@ public class SDNCUnassignTasks { RequestContext requestContext = gBBInput.getRequestContext(); VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); SDNCRequest sdncRequest = new SDNCRequest(); - UriBuilder builder = UriBuilder.fromPath(env.getRequiredProperty("mso.workflow.message.endpoint")) - .path(sdncRequest.getCorrelationName()).path(sdncRequest.getCorrelationValue()); - URI uri = builder.build(); - GenericResourceApiVfModuleOperationInformation req = - sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance, requestContext, uri); + GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.unassignVfModule(vfModule, vnf, + serviceInstance, requestContext, buildCallbackURI(sdncRequest)); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); execution.setVariable(SDNC_REQUEST, sdncRequest); @@ -120,9 +115,9 @@ public class SDNCUnassignTasks { RequestContext requestContext = gBBInput.getRequestContext(); Customer customer = gBBInput.getCustomer(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); - GenericResourceApiVnfOperationInformation req = - sdncVnfResources.unassignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext); SDNCRequest sdncRequest = new SDNCRequest(); + GenericResourceApiVnfOperationInformation req = sdncVnfResources.unassignVnf(vnf, serviceInstance, customer, + cloudRegion, requestContext, buildCallbackURI(sdncRequest)); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VNF); execution.setVariable(SDNC_REQUEST, sdncRequest); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java index 0e32955eed..12aae1e6a6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java @@ -22,6 +22,7 @@ package org.onap.so.client.orchestration; +import java.net.URI; import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @@ -50,47 +51,48 @@ public class SDNCVnfResources { private SDNCClient sdncClient; public GenericResourceApiVnfOperationInformation assignVnf(GenericVnf vnf, ServiceInstance serviceInstance, - Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing) { + Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing, + URI callbackURI) { return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, - cloudRegion, requestContext, homing); + cloudRegion, requestContext, homing, callbackURI); } public GenericResourceApiVnfOperationInformation activateVnf(GenericVnf vnf, ServiceInstance serviceInstance, - Customer customer, CloudRegion cloudRegion, RequestContext requestContext) { + Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) { return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE, GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, - cloudRegion, requestContext, false); + cloudRegion, requestContext, false, callbackURI); } public GenericResourceApiVnfOperationInformation deactivateVnf(GenericVnf vnf, ServiceInstance serviceInstance, - Customer customer, CloudRegion cloudRegion, RequestContext requestContext) { + Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) { return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer, - cloudRegion, requestContext, false); + cloudRegion, requestContext, false, callbackURI); } public GenericResourceApiVnfOperationInformation unassignVnf(GenericVnf vnf, ServiceInstance serviceInstance, - Customer customer, CloudRegion cloudRegion, RequestContext requestContext) { + Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) { return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer, - cloudRegion, requestContext, false); + cloudRegion, requestContext, false, callbackURI); } public GenericResourceApiVnfOperationInformation deleteVnf(GenericVnf vnf, ServiceInstance serviceInstance, - Customer customer, CloudRegion cloudRegion, RequestContext requestContext) { + Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) { return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer, - cloudRegion, requestContext, false); + cloudRegion, requestContext, false, callbackURI); } public GenericResourceApiVnfOperationInformation changeModelVnf(GenericVnf vnf, ServiceInstance serviceInstance, - Customer customer, CloudRegion cloudRegion, RequestContext requestContext) { + Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) { return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, - cloudRegion, requestContext, false); + cloudRegion, requestContext, false, callbackURI); } public String queryVnf(GenericVnf vnf) throws MapperException, BadResponseException { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java index e39e202aa3..bef4ec3465 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java @@ -20,6 +20,7 @@ package org.onap.so.client.sdnc.mapper; +import java.net.URI; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -56,7 +57,8 @@ public class VnfTopologyOperationRequestMapper { public GenericResourceApiVnfOperationInformation reqMapper(SDNCSvcOperation svcOperation, SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration requestAction, GenericVnf vnf, ServiceInstance serviceInstance, - Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing) { + Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing, + URI callbackUrl) { String sdncReqId = UUID.randomUUID().toString(); String msoRequestId = UUID.randomUUID().toString(); if (requestContext != null && requestContext.getMsoRequestId() != null) { @@ -64,7 +66,7 @@ public class VnfTopologyOperationRequestMapper { } GenericResourceApiVnfOperationInformation req = new GenericResourceApiVnfOperationInformation(); GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = - generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId); + generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId, callbackUrl.toString()); GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper .buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, requestAction); GenericResourceApiServiceinformationServiceInformation serviceInformation = diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java index ffd4f74b63..510dc47649 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java @@ -94,11 +94,11 @@ public class SDNCActivateTaskTest extends BaseTaskTest { @Test public void activateVnfTest() throws Exception { - doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).activateVnf(genericVnf, - serviceInstance, customer, cloudRegion, requestContext); + doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).activateVnf(eq(genericVnf), + eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class)); sdncActivateTasks.activateVnf(execution); - verify(sdncVnfResources, times(1)).activateVnf(genericVnf, serviceInstance, customer, cloudRegion, - requestContext); + verify(sdncVnfResources, times(1)).activateVnf(eq(genericVnf), eq(serviceInstance), eq(customer), + eq(cloudRegion), eq(requestContext), any(URI.class)); SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); assertEquals(SDNCTopology.VNF, sdncRequest.getTopology()); } @@ -106,8 +106,8 @@ public class SDNCActivateTaskTest extends BaseTaskTest { @Test public void activateVnfTestException() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(sdncVnfResources).activateVnf(genericVnf, serviceInstance, customer, - cloudRegion, requestContext); + doThrow(RuntimeException.class).when(sdncVnfResources).activateVnf(eq(genericVnf), eq(serviceInstance), + eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class)); sdncActivateTasks.activateVnf(execution); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java index 982868dcbc..b72766c386 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java @@ -113,12 +113,12 @@ public class SDNCAssignTasksTest extends BaseTaskTest { @Test public void assignVnfTest() throws Exception { - doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).assignVnf(genericVnf, - serviceInstance, customer, cloudRegion, requestContext, false); + doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).assignVnf(eq(genericVnf), + eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), eq(false), any(URI.class)); execution.setVariable("generalBuildingBlock", gBBInput); sdncAssignTasks.assignVnf(execution); - verify(sdncVnfResources, times(1)).assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, - false); + verify(sdncVnfResources, times(1)).assignVnf(eq(genericVnf), eq(serviceInstance), eq(customer), eq(cloudRegion), + eq(requestContext), eq(false), any(URI.class)); SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); assertEquals(SDNCTopology.VNF, sdncRequest.getTopology()); } @@ -126,8 +126,8 @@ public class SDNCAssignTasksTest extends BaseTaskTest { @Test public void assignVnfExceptionTest() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(sdncVnfResources).assignVnf(genericVnf, serviceInstance, customer, - cloudRegion, requestContext, false); + doThrow(RuntimeException.class).when(sdncVnfResources).assignVnf(eq(genericVnf), eq(serviceInstance), + eq(customer), eq(cloudRegion), eq(requestContext), eq(false), any(URI.class)); sdncAssignTasks.assignVnf(execution); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java index 8c25bea801..96ff01f78b 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java @@ -80,11 +80,11 @@ public class SDNCChangeAssignTasksTest extends BaseTaskTest { @Test public void changeModelVnfTest() throws Exception { - doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).changeModelVnf(genericVnf, - serviceInstance, customer, cloudRegion, requestContext); + doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).changeModelVnf(eq(genericVnf), + eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class)); sdncChangeAssignTasks.changeModelVnf(execution); - verify(sdncVnfResources, times(1)).changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion, - requestContext); + verify(sdncVnfResources, times(1)).changeModelVnf(eq(genericVnf), eq(serviceInstance), eq(customer), + eq(cloudRegion), eq(requestContext), any(URI.class)); SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); assertEquals(SDNCTopology.VNF, sdncRequest.getTopology()); } @@ -92,8 +92,8 @@ public class SDNCChangeAssignTasksTest extends BaseTaskTest { @Test public void changeModelVnfExceptionTest() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(sdncVnfResources).changeModelVnf(genericVnf, serviceInstance, customer, - cloudRegion, requestContext); + doThrow(RuntimeException.class).when(sdncVnfResources).changeModelVnf(eq(genericVnf), eq(serviceInstance), + eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class)); sdncChangeAssignTasks.changeModelVnf(execution); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java index d8a1b0182e..3714f9d9a9 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java @@ -107,19 +107,19 @@ public class SDNCDeactivateTaskTest extends BaseTaskTest { @Test public void deactivateVnfTest() throws Exception { - doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).deactivateVnf(genericVnf, - serviceInstance, customer, cloudRegion, requestContext); + doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).deactivateVnf(eq(genericVnf), + eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class)); sdncDeactivateTasks.deactivateVnf(execution); - verify(sdncVnfResources, times(1)).deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, - requestContext); + verify(sdncVnfResources, times(1)).deactivateVnf(eq(genericVnf), eq(serviceInstance), eq(customer), + eq(cloudRegion), eq(requestContext), any(URI.class)); SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); assertEquals(SDNCTopology.VNF, sdncRequest.getTopology()); } @Test public void deactivateVnfExceptionTest() throws Exception { - doThrow(RuntimeException.class).when(sdncVnfResources).deactivateVnf(genericVnf, serviceInstance, customer, - cloudRegion, requestContext); + doThrow(RuntimeException.class).when(sdncVnfResources).deactivateVnf(eq(genericVnf), eq(serviceInstance), + eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class)); expectedException.expect(BpmnError.class); sdncDeactivateTasks.deactivateVnf(execution); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java index b29d15c830..98f6bfab9c 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java @@ -125,11 +125,11 @@ public class SDNCUnassignTasksTest extends BaseTaskTest { @Test public void unassignVnfTest() throws Exception { - doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).unassignVnf(genericVnf, - serviceInstance, customer, cloudRegion, requestContext); + doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).unassignVnf(eq(genericVnf), + eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class)); sdncUnassignTasks.unassignVnf(execution); - verify(sdncVnfResources, times(1)).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, - requestContext); + verify(sdncVnfResources, times(1)).unassignVnf(eq(genericVnf), eq(serviceInstance), eq(customer), + eq(cloudRegion), eq(requestContext), any(URI.class)); SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); assertEquals(SDNCTopology.VNF, sdncRequest.getTopology()); } @@ -137,8 +137,8 @@ public class SDNCUnassignTasksTest extends BaseTaskTest { @Test public void unassignVnfExceptionTest() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(sdncVnfResources).unassignVnf(genericVnf, serviceInstance, customer, - cloudRegion, requestContext); + doThrow(RuntimeException.class).when(sdncVnfResources).unassignVnf(eq(genericVnf), eq(serviceInstance), + eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class)); sdncUnassignTasks.unassignVnf(execution); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java index 4c0e2b873f..0ccf056ddc 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java @@ -28,6 +28,8 @@ import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import java.net.URI; +import java.net.URISyntaxException; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -66,6 +68,7 @@ public class SDNCVnfResourcesTest extends TestDataSetup { private CloudRegion cloudRegion; private RequestContext requestContext; private GenericResourceApiVnfOperationInformation sdncReq; + private URI testURI; @Before public void before() { @@ -75,6 +78,11 @@ public class SDNCVnfResourcesTest extends TestDataSetup { cloudRegion = buildCloudRegion(); requestContext = buildRequestContext(); sdncReq = new GenericResourceApiVnfOperationInformation(); + try { + testURI = new URI("http://localhost:9800"); + } catch (URISyntaxException e) { + + } } @Test @@ -82,12 +90,12 @@ public class SDNCVnfResourcesTest extends TestDataSetup { doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), - anyBoolean()); - sdncVnfResources.assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false); + anyBoolean(), any(URI.class)); + sdncVnfResources.assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false, testURI); verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), - anyBoolean()); + anyBoolean(), any(URI.class)); } @Test @@ -95,12 +103,12 @@ public class SDNCVnfResourcesTest extends TestDataSetup { doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), - anyBoolean()); - sdncVnfResources.activateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + anyBoolean(), any(URI.class)); + sdncVnfResources.activateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI); verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), - anyBoolean()); + anyBoolean(), any(URI.class)); } @Test @@ -108,12 +116,12 @@ public class SDNCVnfResourcesTest extends TestDataSetup { doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), - anyBoolean()); - sdncVnfResources.deleteVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + anyBoolean(), any(URI.class)); + sdncVnfResources.deleteVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI); verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), - anyBoolean()); + anyBoolean(), any(URI.class)); } @Test @@ -137,11 +145,12 @@ public class SDNCVnfResourcesTest extends TestDataSetup { doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), - anyBoolean()); - sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); - verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, - SDNCSvcAction.CHANGE_ASSIGN, GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, genericVnf, - serviceInstance, customer, cloudRegion, requestContext, false); + anyBoolean(), any(URI.class)); + sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI); + verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), + eq(SDNCSvcAction.CHANGE_ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE), + eq(genericVnf), eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), eq(false), + any(URI.class)); } @Test @@ -150,12 +159,12 @@ public class SDNCVnfResourcesTest extends TestDataSetup { eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE), isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class), any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class), any(RequestContext.class), - anyBoolean()); - sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + anyBoolean(), any(URI.class)); + sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI); verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE), isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class), any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class), - any(RequestContext.class), anyBoolean()); + any(RequestContext.class), anyBoolean(), any(URI.class)); } @@ -166,8 +175,8 @@ public class SDNCVnfResourcesTest extends TestDataSetup { eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE), isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class), any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class), any(RequestContext.class), - anyBoolean()); - sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + anyBoolean(), any(URI.class)); + sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI); } @Test @@ -176,12 +185,12 @@ public class SDNCVnfResourcesTest extends TestDataSetup { eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.UNASSIGN), isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class), any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class), any(RequestContext.class), - anyBoolean()); - sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + anyBoolean(), any(URI.class)); + sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI); verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.UNASSIGN), isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class), any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class), - any(RequestContext.class), anyBoolean()); + any(RequestContext.class), anyBoolean(), any(URI.class)); } @Test @@ -191,7 +200,7 @@ public class SDNCVnfResourcesTest extends TestDataSetup { eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.UNASSIGN), isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class), any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class), any(RequestContext.class), - anyBoolean()); - sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + anyBoolean(), any(URI.class)); + sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java index cecf34ea10..00836176f0 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java @@ -23,15 +23,18 @@ package org.onap.so.client.sdnc.mapper; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import java.net.URI; import java.util.ArrayList; import java.util.HashMap; -import java.util.Map; import java.util.List; +import java.util.Map; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; +import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; @@ -45,8 +48,6 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.beans.SDNCSvcOperation; -import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; -import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; @RunWith(MockitoJUnitRunner.class) public class VnfTopologyOperationRequestMapperTest { @@ -127,11 +128,11 @@ public class VnfTopologyOperationRequestMapperTest { GenericResourceApiVnfOperationInformation vnfOpInformation = mapper.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, - cloudRegion, requestContext, true); + cloudRegion, requestContext, true, new URI("http://localhost:8080")); GenericResourceApiVnfOperationInformation vnfOpInformationNullReqContext = mapper.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, - cloudRegion, null, true); + cloudRegion, null, true, new URI("http://localhost:8080")); assertNull(vnfOpInformation.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid()); assertEquals("vnfModelCustomizationUUID", diff --git a/common/src/main/java/org/onap/so/client/HttpClient.java b/common/src/main/java/org/onap/so/client/HttpClient.java index 3fb09433e1..715ba32831 100644 --- a/common/src/main/java/org/onap/so/client/HttpClient.java +++ b/common/src/main/java/org/onap/so/client/HttpClient.java @@ -83,4 +83,16 @@ public class HttpClient extends RestClient { } } + public void setAcceptType(String value) { + try { + if (isNotBlank(value)) { + super.accept = value; + } else { + log.warn("Not adding accept to headers."); + } + } catch (Exception e) { + logger.error(e.getMessage(), e); + } + } + } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java index d162ccde65..af7641705e 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java @@ -615,7 +615,7 @@ public class E2EServiceInstances { String serviceInstanceType = e2eSir.getService().getServiceType(); - String serviceId = ""; + String serviceId = e2eSir.getService().getServiceId(); RequestClient requestClient; HttpResponse response; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EService.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EService.java index f969674ed1..d6a99af8cd 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EService.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EService.java @@ -47,6 +47,9 @@ public class E2EService { @JsonProperty("serviceType") private String serviceType; + @JsonProperty("serviceId") + private String serviceId; + @JsonProperty("parameters") private E2EParameters parameters; @@ -109,6 +112,14 @@ public class E2EService { this.serviceType = serviceType; } + public String getServiceId() { + return serviceId; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + public String getServiceUuid() { return serviceUuid; } |