From 70d33f19094d05d7762eb04fbada9157e9979110 Mon Sep 17 00:00:00 2001 From: c00149107 Date: Wed, 21 Mar 2018 14:33:34 +0800 Subject: Generate sdnc network operation request body Generate sdnc network operation request body Change-Id: I192a50e322f9982b07b3fa3cbb7c180ab6a66bc3 Issue-ID: SO-501 Signed-off-by: c00149107 --- .../mso/bpmn/common/recipe/ResourceInput.java | 70 +++++++--------------- .../mso/bpmn/common/recipe/ResourceInputTest.java | 19 +++--- .../scripts/CreateSDNCNetworkResource.groovy | 69 ++++++++++++++++++++- .../scripts/DoCreateE2EServiceInstance.groovy | 9 +-- 4 files changed, 105 insertions(+), 62 deletions(-) (limited to 'bpmn') diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceInput.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceInput.java index 0a008d1044..00e4ae71d6 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceInput.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceInput.java @@ -19,6 +19,8 @@ */ package org.openecomp.mso.bpmn.common.recipe; +import org.openecomp.mso.bpmn.core.domain.ModelInfo; + import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonRootName; @@ -35,7 +37,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; * @author * @version ONAP Beijing Release 2018-03-08 */ -@JsonPropertyOrder({"resourceInstanceName", "resourceInstanceDes", "globalSubscriberId", "serviceType", "serviceId", "operationId", "resourceType","resourceCustomizationUuid"}) +@JsonPropertyOrder({"resourceInstanceName", "resourceInstanceDes", "globalSubscriberId", "serviceType", "serviceId", "operationId", "serviceModelInfo","resourceModelInfo", "resourceInstancenUuid","resourceParameters","operationType"}) @JsonRootName("variables") public class ResourceInput { @@ -57,17 +59,11 @@ public class ResourceInput { @JsonProperty("operationId") private String operationId; - //for create resource - @JsonProperty("resourceInvariantUuid") - private String resourceInvariantUuid; + @JsonProperty("serviceModelInfo") + private ModelInfo serviceModelInfo; - //for create resource - @JsonProperty("resourceUuid") - private String resourceUuid; - - //for create resource - @JsonProperty("resourceCustomizationUuid") - private String resourceCustomizationUuid; + @JsonProperty("resourceModelInfo") + private ModelInfo resourceModelInfo; //for delete resource @JsonProperty("resourceInstancenUuid") @@ -186,66 +182,46 @@ public class ResourceInput { public void setOperationId(String operationId) { this.operationId = operationId; } - - /** - * @return Returns the resourceInvariantUuid. + * @return Returns the serviceModelInfo. */ - @JsonProperty("resourceInvariantUuid") - public String getResourceInvariantUuid() { - return resourceInvariantUuid; + @JsonProperty("serviceModelInfo") + public ModelInfo getServiceModelInfo() { + return serviceModelInfo; } /** - * @param resourceInvariantUuid The resourceInvariantUuid to set. + * @param serviceModelInfo The serviceModelInfo to set. */ - @JsonProperty("resourceInvariantUuid") - public void setResourceInvariantUuid(String resourceInvariantUuid) { - this.resourceInvariantUuid = resourceInvariantUuid; + @JsonProperty("serviceModelInfo") + public void setServiceModelInfo(ModelInfo serviceModelInfo) { + this.serviceModelInfo = serviceModelInfo; } /** - * @return Returns the resourceUuid. + * @return Returns the resourceModelInfo. */ - @JsonProperty("resourceUuid") - public String getResourceUuid() { - return resourceUuid; + @JsonProperty("resourceModelInfo") + public ModelInfo getResourceModelInfo() { + return resourceModelInfo; } /** - * @param resourceUuid The resourceUuid to set. - */ - @JsonProperty("resourceUuid") - public void setResourceUuid(String resourceUuid) { - this.resourceUuid = resourceUuid; - } - - - /** - * @return Returns the resourceCustomizationUuid. + * @param resourceModelInfo The resourceModelInfo to set. */ - @JsonProperty("resourceCustomizationUuid") - public String getResourceCustomizationUuid() { - return resourceCustomizationUuid; + @JsonProperty("resourceModelInfo") + public void setResourceModelInfo(ModelInfo resourceModelInfo) { + this.resourceModelInfo = resourceModelInfo; } - - /** - * @param resourceCustomizationUuid The resourceCustomizationUuid to set. - */ - @JsonProperty("resourceCustomizationUuid") - public void setResourceCustomizationUuid(String resourceCustomizationUuid) { - this.resourceCustomizationUuid = resourceCustomizationUuid; - } - /** * @return Returns the resourceParameters. */ diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/ResourceInputTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/ResourceInputTest.java index fe1975faf9..466f4a1f3f 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/ResourceInputTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/ResourceInputTest.java @@ -19,9 +19,10 @@ */ package org.openecomp.mso.bpmn.common.recipe; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import org.junit.Test; +import org.openecomp.mso.bpmn.core.domain.ModelInfo; public class ResourceInputTest { @@ -34,9 +35,16 @@ public class ResourceInputTest { ri.setServiceType("serviceType"); ri.setServiceInstanceId("serviceId"); ri.setOperationId("operationId"); - ri.setResourceInvariantUuid("resourceInvariantUuid"); - ri.setResourceUuid("resourceUuid"); - ri.setResourceCustomizationUuid("resourceCustomizationUuid"); + ModelInfo serviceModelInfo = new ModelInfo(); + serviceModelInfo.setModelCustomizationUuid("modelCustomizationUuid"); + serviceModelInfo.setModelInvariantUuid("modelInvariantUuid"); + serviceModelInfo.setModelUuid("modelUuid"); + ri.setServiceModelInfo(serviceModelInfo); + ModelInfo resourceModelInfo = new ModelInfo(); + resourceModelInfo.setModelCustomizationUuid("modelCustomizationUuid"); + resourceModelInfo.setModelInvariantUuid("modelInvariantUuid"); + resourceModelInfo.setModelUuid("modelUuid"); + ri.setResourceModelInfo(resourceModelInfo); ri.setResourceInstancenUuid("resourceInstancenUuid"); ri.setResourceParameters("resourceParameters"); ri.setOperationType("operationType"); @@ -46,9 +54,6 @@ public class ResourceInputTest { assertEquals(ri.getServiceType(), "serviceType"); assertEquals(ri.getServiceInstanceId(), "serviceId"); assertEquals(ri.getOperationId(), "operationId"); - assertEquals(ri.getResourceInvariantUuid(), "resourceInvariantUuid"); - assertEquals(ri.getResourceUuid(), "resourceUuid"); - assertEquals(ri.getResourceCustomizationUuid(), "resourceCustomizationUuid"); assertEquals(ri.getResourceInstancenUuid(), "resourceInstancenUuid"); assertEquals(ri.getResourceParameters(), "resourceParameters"); assertEquals(ri.getOperationType(), "operationType"); diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index 072c3810c2..933d45066a 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -133,11 +133,76 @@ public class CreateSDNCCNetworkResource extends AbstractServiceTaskProcessor { String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + String hdrRequestId = execution.getVariable("mso-request-id") String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") - + String source = execution.getVariable("source") + String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String serviceType = resourceInputObj.getServiceType() + String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() + String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid() + String serviceModelVersion = resourceInputObj.getServiceModelInfo().getModelName() + String serviceModelName = resourceInputObj.getServiceModelInfo().getModelVersion() + String globalCustomerId = resourceInputObj.getGlobalSubscriberId() + String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid(); + String modelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion() + String resourceInputPrameters = resourceInputObj.getResourceParameters() + String netowrkInputParametersJson = jsonUtil.getJsonValue(resourceInputPrameters, "requestInputs") + //here convert json string to xml string + String netowrkInputParameters = jsonUtil.json2xml(netowrkInputParametersJson) // 1. prepare assign topology via SDNC Adapter SUBFLOW call String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, sdnc_svcAction, sdnc_requestAction, null, null, null) - + String content = + """ + + ${hdrRequestId} + ${serviceInstanceId} + ${sdnc_svcAction} + network-topology-operation + sdncCallback + generic-resource + + + + ${hdrRequestId} + ${sdnc_requestAction} + ${source} + + + + + + ${sdnc_service_id} + ${serviceType} + + ${serviceModelInvariantUuid} + ${serviceModelUuid} + ${serviceModelVersion} + ${serviceModelName} + + ${serviceInstanceId} + ${globalCustomerId} + + + + ${modelInvariantUuid} + ${modelCustomizationUuid} + ${modelUuid} + ${modelVersion} + ${modelName} + + + + ${netowrkInputParameters} + + + """.trim() + String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) utils.logAudit(sndcTopologyCreateRequesAsString) execution.setVariable(Prefix + "createSDNCRequest", sndcTopologyCreateRequesAsString) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index 5eb3fd9f41..f32df04f61 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -548,12 +548,9 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { def currentIndex = execution.getVariable("currentResourceIndex") List sequencedResourceList = execution.getVariable("sequencedResourceList") Resource currentResource = sequencedResourceList.get(currentIndex) - String resourceCustomizationUuid = currentResource.getModelInfo().getModelCustomizationUuid() - resourceInput.setResourceCustomizationUuid(resourceCustomizationUuid); - String resourceInvariantUuid = currentResource.getModelInfo().getModelInvariantUuid() - resourceInput.setResourceInvariantUuid(resourceInvariantUuid) - String resourceUuid = currentResource.getModelInfo().getModelUuid() - resourceInput.setResourceUuid(resourceUuid) + resourceInput.setResourceModelInfo(currentResource.getModelInfo()); + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo()); String incomingRequest = execution.getVariable("uuiRequest") //set the requestInputs from tempalte To Be Done -- cgit 1.2.3-korg