diff options
Diffstat (limited to 'bpmn')
5 files changed, 97 insertions, 54 deletions
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index 891a57d0f2..182976d69e 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -311,7 +311,7 @@ <dependency> <groupId>org.onap.appc.client</groupId> <artifactId>client-lib</artifactId> - <version>1.5.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> <exclusions> <exclusion> <groupId>org.mockito</groupId> @@ -330,7 +330,7 @@ <dependency> <groupId>org.onap.appc.client</groupId> <artifactId>client-kit</artifactId> - <version>1.5.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> <exclusions> <exclusion> <groupId>org.mockito</groupId> 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 e32a03dfa2..cc628657db 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 @@ -42,12 +42,14 @@ public class InstanceResourceList { 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 @@ -67,27 +69,36 @@ public class InstanceResourceList { } else if (r.getResourceType() == ResourceType.GROUP) { String sk = getPrimaryKey(r); - for (String pk : normalizedRequest.keySet()) { - JsonArray vfs = reqInputJsonObj.getAsJsonArray(pk); + // 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; + } - for (int i = 0; i < vfs.size(); i++) { + String pk = getPrimaryKey(lastVfProcessed); + JsonArray vfs = reqInputJsonObj.getAsJsonArray(pk); - JsonElement vfcsNode = vfs.get(i).getAsJsonObject().get(sk); - if (vfcsNode instanceof JsonArray) { + for (int i = 0; i < vfs.size(); i++) { - List<GroupResource> groupResources = normalizedRequest.get(pk).get(i); + JsonElement vfcsNode = vfs.get(i).getAsJsonObject().get(sk); + if (vfcsNode instanceof JsonArray) { - if (groupResources == null) { - groupResources = new ArrayList<>(); - normalizedRequest.get(pk).add(i, groupResources); - } + List<GroupResource> groupResources = normalizedRequest.get(pk).get(i); - for (int j = 0; j < ((JsonArray) vfcsNode).size(); j++) { - groupResources.add((GroupResource) r); - } + 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; 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 2d0b9e5a99..0338647ce7 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 @@ -33,6 +33,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +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 @@ -84,9 +85,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { } String sdnc_svcAction = "activate" - String sdnc_requestAction = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() +".operation-type") - String isActivateRequired = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() +".activation-required") - execution.setVariable("isActivateRequired", isActivateRequired) + String sdnc_requestAction = sdnc_svcAction.capitalize() + UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() +".operation-type") + "Instance" execution.setVariable(Prefix + "svcAction", sdnc_svcAction) execution.setVariable(Prefix + "requestAction", sdnc_requestAction) @@ -175,7 +174,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { String source = execution.getVariable("source") String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(execution.getVariable(Prefix + "resourceInput"), ResourceInput.class) - String networkInstanceId = execution.getVariable("networkInstanceId") + String resourceInstanceId = execution.getVariable("resourceInstanceId") String serviceType = resourceInputObj.getServiceType() String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid() @@ -194,6 +193,25 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { // 1. prepare assign topology via SDNC Adapter SUBFLOW call 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" @@ -230,7 +248,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> </service-information> <vnf-information> - <vnf-id>${msoUtils.xmlEscape(networkInstanceId)}</vnf-id> + <vnf-id>${msoUtils.xmlEscape(resourceInstanceId)}</vnf-id> <vnf-type></vnf-type> <onap-model-information> <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> @@ -254,15 +272,14 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { break case "GROUP" : - sdncTopologyActivateRequest = - """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" - xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + 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:SvcOperation>vf-module-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> @@ -286,23 +303,34 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { </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> - <!-- TODO: to be filled as per the request input --> - <allotted-resource-id>${msoUtils.xmlEscape(networkInstanceId)}</allotted-resource-id> - <allotted-resource-type></allotted-resource-type> - <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id> + <vnf-information> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-invariant-uuid>${msoUtils.xmlEscape(vnfmodelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(vnfmodelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(vnfmodelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(vnfmodelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(vnfmodelName)}</model-name> + </onap-model-information> + <vnf-id>${msoUtils.xmlEscape(vnfid)}</vnf-id> + </vnf-information> + <vf-module-information> + <from-preload>false</from-preload> + <vf-module-id>${msoUtils.xmlEscape(resourceInstanceId)}</vf-module-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> + </vf-module-information> + <vf-module-request-input> + <vf-module-input-parameters> + $netowrkInputParameters + </vf-module-input-parameters> + </vf-module-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break @@ -344,7 +372,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { </service-information> <network-information> <!-- TODO: to be filled by response from create --> - <network-id>${msoUtils.xmlEscape(networkInstanceId)}</network-id> + <network-id>${msoUtils.xmlEscape(resourceInstanceId)}</network-id> <onap-model-information> <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> 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 4c4b63101f..23c11ca4dc 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 @@ -102,7 +102,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { } String sdnc_svcAction = "create" - String sdnc_requestAction = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() +".operation-type") + String sdnc_requestAction = sdnc_svcAction.capitalize() + UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() +".operation-type") + "Instance" String isActivateRequired = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() +".activation-required") execution.setVariable("isActivateRequired", isActivateRequired) @@ -352,7 +352,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String vnfmodelName = "" String modelType = resourceInputObj.getResourceModelInfo().getModelType() if(modelType.equalsIgnoreCase(ResourceType.GROUP.toString())) { - vnfid = resourceInputObj.getVnfId(); + vnfid = resourceInputObj.getVnfId() ModelInfo vfModelInfo = resourceInputObj.getVfModelInfo() vnfmodelInvariantUuid = vfModelInfo.getModelInvariantUuid() vnfmodelCustomizationUuid = vfModelInfo.getModelCustomizationUuid() @@ -397,7 +397,6 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> </service-information> <vnf-information> - <vnf-id>${msoUtils.xmlEscape(vnfid)}</vnf-id> <vnf-type></vnf-type> <onap-model-information> <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> @@ -427,7 +426,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { <sdncadapter:RequestId>${msoUtils.xmlEscape(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:SvcOperation>vf-module-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> @@ -454,24 +453,30 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> </service-information> <vnf-information> + <onap-model-information> <model-invariant-uuid>${msoUtils.xmlEscape(vnfmodelInvariantUuid)}</model-invariant-uuid> <model-customization-uuid>${msoUtils.xmlEscape(vnfmodelCustomizationUuid)}</model-customization-uuid> <model-uuid>${msoUtils.xmlEscape(vnfmodelUuid)}</model-uuid> <model-version>${msoUtils.xmlEscape(vnfmodelVersion)}</model-version> <model-name>${msoUtils.xmlEscape(vnfmodelName)}</model-name> + </onap-model-information> + <vnf-id>${msoUtils.xmlEscape(vnfid)}</vnf-id> </vnf-information> - <vnf-request-input> - <vnf-input-parameters> + <vf-module-information> + <from-preload>false</from-preload> + <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> + </vf-module-information> + <vf-module-request-input> + <vf-module-input-parameters> $netowrkInputParameters - </vnf-input-parameters> - <request-version></request-version> - <vnf-name></vnf-name> - <vnf-networks> - </vnf-networks> - </vnf-request-input> - <connection-attachment-request-input> - $netowrkInputParameters - </connection-attachment-request-input> + </vf-module-input-parameters> + </vf-module-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn index 0bdc6dc0bd..5a4b3ac348 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="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="1.16.2"> <bpmn:process id="CreateSDNCNetworkResource" name="CreateSDNCNetworkResource" isExecutable="true"> <bpmn:startEvent id="createNS_StartEvent" name="createNS_StartEvent"> <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> @@ -137,8 +137,7 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)</bpmn:script> <camunda:in source="requestAction" target="requestAction" /> <camunda:in source="URN_mso_workflow_sdncadapter_callback" target="URN_mso_workflow_sdncadapter_callback" /> <camunda:in source="networkRequest" target="networkRequest" /> - <camunda:in source="networkInstanceId" target="networkInstanceId" /> - <camunda:in source="parentServiceInstanceId" target="parentServiceInstanceId" /> + <camunda:in source="resourceInstanceId" target="resourceInstanceId" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1dww8ye</bpmn:incoming> <bpmn:outgoing>SequenceFlow_05niqbf</bpmn:outgoing> @@ -309,4 +308,4 @@ dcsi.afterCreateSDNCCall(execution)</bpmn:script> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions>
\ No newline at end of file +</bpmn:definitions> |