aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java160
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/GroupResource.java44
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java1
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java23
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceType.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java23
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfcResource.java31
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java16
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java7
-rw-r--r--bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceWithGroupandVnfc.json58
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java10
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java31
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy65
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy30
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java27
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java72
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy67
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java39
23 files changed, 669 insertions, 57 deletions
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
new file mode 100644
index 0000000000..b50ecdad8b
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java
@@ -0,0 +1,160 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.common.resource;
+
+import com.google.gson.Gson;
+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 java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+public class InstanceResourceList {
+
+ private static List<Map<String, List<GroupResource>>> convertUUIReqTOStd(final String uuiRequest,
+ List<Resource> seqResourceList) {
+
+ List<Map<String, List<GroupResource>>> normalizedList = new ArrayList<>();
+
+ Gson gson = new Gson();
+ JsonObject servJsonObject = gson.fromJson(uuiRequest, JsonObject.class);
+
+ JsonObject reqInputJsonObj = servJsonObject.getAsJsonObject("service").getAsJsonObject("parameters")
+ .getAsJsonObject("requestInputs");
+
+ // iterate all node in requestInputs
+ Iterator<Map.Entry<String, JsonElement>> iterator = reqInputJsonObj.entrySet().iterator();
+
+ while (iterator.hasNext()) { // iterate all <vf>_list
+ Map.Entry<String, JsonElement> entry = iterator.next();
+
+ // truncate "_list" from key and keep only the <VF_NAME>
+ String key = entry.getKey().substring(0, entry.getKey().indexOf("_list"));
+
+ // all the element represent VF will contain "<VF_NAME>_list".
+ if (key.contains("_list")) {
+ // this will return list of vf of same type
+ // e.g. vf_list [{vf1}, {vf2}]
+ Iterator<JsonElement> vfsIterator = entry.getValue().getAsJsonArray().iterator();
+
+ while (vfsIterator.hasNext()) { // iterate all [] inside vf_list
+ JsonObject vfObject = vfsIterator.next().getAsJsonObject();
+ List<GroupResource> tmpGrpsHolder = new ArrayList<>();
+
+ // iterate vfObject to get groups(vfc)
+ // currently each vfc represented by one group.
+ Iterator<Map.Entry<String, JsonElement>> vfIterator = vfObject.entrySet().iterator();
+ while (vfIterator.hasNext()) { // iterate all property inside a VF
+ Map.Entry<String, JsonElement> vfEntry = vfIterator.next();
+
+ // property name for vfc input will always carry "<VFC_NAME>_list"
+ if (vfEntry.getKey().contains("_list")) {
+ // truncate "_list" from key and keep only the <VFC_NAME>
+ String vfcName = vfEntry.getKey().substring(0, vfEntry.getKey().indexOf("_list"));
+ GroupResource grpRes = getGroupResource(vfcName, seqResourceList);
+ // A <vfc>_list can contain more than one vfc of same type
+ Iterator<JsonElement> vfcsIterator = vfEntry.getValue().getAsJsonArray().iterator();
+
+ while (vfcsIterator.hasNext()) { // iterate all the vfcs inside <vfc>_list
+ tmpGrpsHolder.add(grpRes);
+ }
+ }
+ }
+ List<GroupResource> seqGrpResourceList = seqGrpResource(tmpGrpsHolder, seqResourceList);
+ HashMap<String, List<GroupResource>> entryNormList = new HashMap<>();
+ entryNormList.put(key, seqGrpResourceList);
+ normalizedList.add(entryNormList);
+ }
+ }
+ }
+
+ return normalizedList;
+ }
+
+ private static List<GroupResource> seqGrpResource(List<GroupResource> grpResources, List<Resource> resourceList) {
+ List<GroupResource> seqGrpResList = new ArrayList<>();
+ for (Resource r : resourceList) {
+ if (r.getResourceType() != ResourceType.GROUP) {
+ continue;
+ }
+ for (GroupResource g : grpResources) {
+ if (r.getModelInfo().getModelName().equalsIgnoreCase(g.getModelInfo().getModelName())) {
+ seqGrpResList.add(g);
+ }
+ }
+ }
+ return seqGrpResList;
+ }
+
+ private static GroupResource getGroupResource(String vfcName, List<Resource> seqRessourceList) {
+ for (Resource r : seqRessourceList) {
+ if (r.getResourceType() == ResourceType.GROUP) {
+ // Currently only once vnfc is added to group
+ return ((GroupResource) r).getVnfcs().get(0).getModelInfo().getModelName().contains(vfcName)
+ ? (GroupResource) r
+ : null;
+ }
+ }
+ return null;
+ }
+
+ private static List<Resource> convertToInstanceResourceList(List<Map<String, List<GroupResource>>> normalizedReq,
+ List<Resource> seqResourceList) {
+ List<Resource> flatResourceList = new ArrayList<>();
+ for (Resource r : seqResourceList) {
+ if (r.getResourceType() == ResourceType.VNF) {
+ for (Map<String, List<GroupResource>> entry : normalizedReq) {
+ if (r.getModelInfo().getModelName().equalsIgnoreCase(entry.keySet().iterator().next())) {
+ flatResourceList.add(r);
+ flatResourceList.addAll(entry.get(entry.keySet().iterator().next()));
+ }
+ }
+ }
+ }
+ return flatResourceList;
+ }
+
+ public static List<Resource> getInstanceResourceList(final List<Resource> seqResourceList,
+ final String uuiRequest) {
+
+ // this will convert UUI request to normalized form
+ List<Map<String, List<GroupResource>>> normalizedReq = convertUUIReqTOStd(uuiRequest, seqResourceList);
+
+ // now UUI json req is normalized to
+ // [
+ // { VFB1 : [GrpA1, GrA2, GrB1]},
+ // { VFB2 : [GrpA1, GrB1]},
+ // { VFA1 : [GrpC1]}
+ // ]
+ // now sequence according to VF order (Group is already sequenced).
+ // After sequence it will look like :
+ // [
+ // { VFA1 : [GrpA1, GrA2, GrB1]},
+ // { VFA2 : [GrpA1, GrB1]},
+ // { VFB1 : [GrpC1]}
+ // ]
+ return convertToInstanceResourceList(normalizedReq, seqResourceList);
+ }
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/GroupResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/GroupResource.java
new file mode 100644
index 0000000000..d194f2750a
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/GroupResource.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.core.domain;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+import java.util.UUID;
+
+public class GroupResource extends Resource {
+ private static final long serialVersionUID = 1L;
+
+ @JsonProperty("vnfcs")
+ private List<VnfcResource> vnfcs;
+
+ public GroupResource() {
+ resourceType = ResourceType.GROUP;
+ setResourceId(UUID.randomUUID().toString());
+ }
+
+ public List<VnfcResource> getVnfcs() {
+ return vnfcs;
+ }
+
+ public void setVnfcs(List<VnfcResource> vnfcs) {
+ this.vnfcs = vnfcs;
+ }
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java
index 897cbe3573..309b053589 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.core.domain;
import java.io.Serializable;
-import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonRootName;
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java
index 602172f8a4..bf53c880e9 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java
@@ -45,6 +45,7 @@ import org.slf4j.LoggerFactory;
*/
@JsonInclude(Include.NON_NULL)
public abstract class JsonWrapper implements Serializable {
+ private static final String EXCEPTION = "Exception :";
private static final Logger logger = LoggerFactory.getLogger(JsonWrapper.class);
@@ -63,7 +64,7 @@ public abstract class JsonWrapper implements Serializable {
jsonString = ow.writeValueAsString(this);
} catch (Exception e) {
- logger.debug("Exception :", e);
+ logger.debug(EXCEPTION, e);
}
return jsonString;
}
@@ -76,14 +77,10 @@ public abstract class JsonWrapper implements Serializable {
JSONObject json = new JSONObject();
try {
json = new JSONObject(mapper.writeValueAsString(this));
- } catch (JsonGenerationException e) {
- logger.debug("Exception :", e);
- } catch (JsonMappingException e) {
- logger.debug("Exception :", e);
- } catch (JSONException e) {
- logger.debug("Exception :", e);
+ } catch (JsonGenerationException | JsonMappingException | JSONException e) {
+ logger.debug(EXCEPTION, e);
} catch (IOException e) {
- logger.debug("Exception :", e);
+ logger.debug(EXCEPTION, e);
}
return json;
}
@@ -95,12 +92,10 @@ public abstract class JsonWrapper implements Serializable {
String jsonString = "";
try {
jsonString = mapper.writeValueAsString(list);
- } catch (JsonGenerationException e) {
- logger.debug("Exception :", e);
- } catch (JsonMappingException e) {
- logger.debug("Exception :", e);
+ } catch (JsonGenerationException | JsonMappingException e) {
+ logger.debug(EXCEPTION, e);
} catch (IOException e) {
- logger.debug("Exception :", e);
+ logger.debug(EXCEPTION, e);
}
return jsonString;
}
@@ -118,7 +113,7 @@ public abstract class JsonWrapper implements Serializable {
jsonString = ow.writeValueAsString(this);
} catch (Exception e) {
- logger.debug("Exception :", e);
+ logger.debug(EXCEPTION, e);
}
return jsonString;
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceType.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceType.java
index a30d0df825..0e17d4c826 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceType.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceType.java
@@ -22,5 +22,5 @@ package org.onap.so.bpmn.core.domain;
public enum ResourceType {
- VNF, NETWORK, MODULE, ALLOTTED_RESOURCE, CONFIGURATION // etc.
+ VNF, NETWORK, MODULE, ALLOTTED_RESOURCE, CONFIGURATION, GROUP, VNFC // etc.
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
index 419f545cdf..b3439d58e3 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
@@ -245,7 +245,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
*/
@JsonIgnore
public List<Resource> getServiceResources() {
- ArrayList serviceResources = new ArrayList();
+ ArrayList<Resource> serviceResources = new ArrayList();
if (this.getAllottedResources() != null) {
serviceResources.addAll(this.getAllottedResources());
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java
index a69a49b89a..da8d5a1f13 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java
@@ -51,6 +51,13 @@ public class VnfResource extends Resource {
*/
@JsonProperty("vfModules")
private List<ModuleResource> vfModules;
+
+ @JsonProperty("groups")
+ private List<GroupResource> groups;
+
+ @JsonProperty("group-order")
+ private String groupOrder;
+
private String vnfHostname;
private String vnfType;
private String nfFunction;
@@ -151,6 +158,22 @@ public class VnfResource extends Resource {
this.resourceInput = resourceInput;
}
+ public List<GroupResource> getGroups() {
+ return groups;
+ }
+
+ public void setGroups(List<GroupResource> groups) {
+ this.groups = groups;
+ }
+
+ public String getGroupOrder() {
+ return groupOrder;
+ }
+
+ public void setGroupOrder(String groupOrder) {
+ this.groupOrder = groupOrder;
+ }
+
/**
* Returns a list of all VfModule objects. Base module is first entry in the list
*
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfcResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfcResource.java
new file mode 100644
index 0000000000..5fced9a8ab
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfcResource.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.core.domain;
+
+import java.util.UUID;
+
+public class VnfcResource extends Resource {
+ private static final long serialVersionUID = 1L;
+
+ public VnfcResource() {
+ resourceType = ResourceType.VNFC;
+ setResourceId(UUID.randomUUID().toString());
+ }
+}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java
index 5db277628e..7ef7deea30 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java
@@ -52,6 +52,22 @@ public class ServiceDecompositionTest {
configResource.setResourceId("configResourceId");
}
+
+ @Test
+ public void serviceDecompositionWithGroupandVnfc() throws IOException {
+ String sericeStr = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "ServiceWithGroupandVnfc.json")));
+ ServiceDecomposition serviceDecomposition = new ServiceDecomposition(sericeStr);
+
+ assertEquals(1, serviceDecomposition.getVnfResources().size());
+ assertEquals(1, serviceDecomposition.getVnfResources().get(0).getGroups().size());
+ assertEquals(1, serviceDecomposition.getVnfResources().get(0).getGroups().get(0).getVnfcs().size());
+
+ VnfcResource vnfcResource = serviceDecomposition.getVnfResources().get(0).getGroups().get(0).getVnfcs().get(0);
+
+ assertEquals("xfs", vnfcResource.getModelInfo().getModelName());
+ assertEquals("22", vnfcResource.getModelInfo().getModelUuid());
+ }
+
@Test
public void serviceDecompositionTest() throws JsonProcessingException, IOException {
// covering methods not covered by openpojo test
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java
index b23633b4d8..de7b21ed73 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java
@@ -14,12 +14,13 @@
*/
package org.onap.so.bpmn.core.domain;
-import static org.junit.Assert.*;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Test;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
public class VnfResourceTest {
diff --git a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceWithGroupandVnfc.json b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceWithGroupandVnfc.json
new file mode 100644
index 0000000000..9d0326e66a
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceWithGroupandVnfc.json
@@ -0,0 +1,58 @@
+{
+ "serviceResources": {
+ "modelInfo": {
+ "modelName": "NSService",
+ "modelUuid": "0bad8c92-7d22-49f0-b092-b64e6ca564a7",
+ "modelInvariantUuid": "69161960-515b-4bf3-91f1-313b813f5e1d",
+ "modelVersion": "1.0"
+ },
+ "serviceType": "",
+ "serviceRole": "",
+ "environmentContext": "General_Revenue-Bearing",
+ "resourceOrder": "NF",
+ "workloadContext": "Production",
+ "serviceVnfs": [
+ {
+ "modelInfo": {
+ "modelName": "",
+ "modelUuid": "123",
+ "modelInvariantUuid": "",
+ "modelVersion": "",
+ "modelCustomizationUuid": "1234",
+ "modelInstanceName": "test"
+ },
+ "toscaNodeType": "",
+ "nfFunction": "",
+ "nfType": "",
+ "nfRole": "",
+ "nfNamingCode": "",
+ "multiStageDesign": "",
+ "resourceInput": "",
+ "vfModules": [],
+ "groups": [
+ {
+ "modelInfo": {
+ "modelName": "test",
+ "modelUuid": "11",
+ "modelInvariantUuid": "11",
+ "modelVersion": "2"
+ },
+ "vnfcs": [
+ {
+ "modelInfo": {
+ "modelName": "xfs",
+ "modelUuid": "22",
+ "modelInvariantUuid": "2222",
+ "modelVersion": "22222",
+ "modelCustomizationUuid": "2222"
+ }
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "serviceNetworks": [],
+ "serviceAllottedResources": []
+ }
+} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java
index cd4257ec60..e0760b5d4a 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -160,12 +162,4 @@ public class DeleteVnfNotification {
return deleteVnfNotification;
}
- /*
- * public String toString() { StringWriter writer = new StringWriter(); try { JAXBContext context = JAXBContext
- * .newInstance(DeleteVnfNotification.class); Marshaller m = context.createMarshaller();
- * m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); m.marshal(this, writer);
- * //System.out.println("toString() - " + writer.getBuffer().toString()); return writer.getBuffer().toString(); }
- * catch (JAXBException e) { //System.out.println("JAXBException - " + e.getStackTrace()); return ""; } }
- */
-
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
index 3734510eed..3ff240ebc2 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
@@ -34,6 +34,8 @@ import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.junit.Before;
import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.common.recipe.ResourceInput;
+import org.onap.so.bpmn.common.resource.ResourceRequestBuilder;
import org.springframework.beans.factory.annotation.Autowired;
public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
@@ -61,6 +63,7 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenAaiEntryExists() {
// given
variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITH_ENTRY);
+ variables.put("resourceInput", getUpdateResInputObj("OLT").toString());
// when
ProcessInstance instance =
runtimeService.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
@@ -79,6 +82,7 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntryExists() {
// given
variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY);
+ variables.put("resourceInput", getUpdateResInputObj("OLT").toString());
// when
ProcessInstance instance =
runtimeService.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
@@ -93,4 +97,31 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
Assertions.assertThat(pnfManagementTest.getServiceAndPnfRelationMap())
.containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY));
}
+
+ private ResourceInput getUpdateResInputObj(String modelName) {
+
+ String resourceInput = "{\n" + "\t\"resourceInstanceName\": \"SotnFc-wan-connection_wanconnection-37\",\n"
+ + "\t\"resourceInstanceDes\": null,\n" + "\t\"globalSubscriberId\": \"sdwandemo\",\n"
+ + "\t\"serviceType\": \"CCVPN\",\n" + "\t\"operationId\": \"df3387b5-4fbf-41bd-82a0-13a955ac178a\",\n"
+ + "\t\"serviceModelInfo\": {\n" + "\t\t\"modelName\": \"WanConnectionSvc03\",\n"
+ + "\t\t\"modelUuid\": \"198b066c-0771-4157-9594-1824adfdda7e\",\n"
+ + "\t\t\"modelInvariantUuid\": \"43fb5165-7d03-4009-8951-a8f45d3f0148\",\n"
+ + "\t\t\"modelVersion\": \"1.0\",\n" + "\t\t\"modelCustomizationUuid\": \"\",\n"
+ + "\t\t\"modelCustomizationName\": \"\",\n" + "\t\t\"modelInstanceName\": \"\",\n"
+ + "\t\t\"modelType\": \"\"\n" + "\t},\n" + "\t\"resourceModelInfo\": {\n" + "\t\t\"modelName\": \""
+ + modelName + "\",\n" + "\t\t\"modelUuid\": \"6a0bf88b-343c-415b-88c1-6f73702452c4\",\n"
+ + "\t\t\"modelInvariantUuid\": \"50bc3415-2e01-4e50-a9e1-ec9584599bb3\",\n"
+ + "\t\t\"modelCustomizationUuid\": \"b205d620-84bd-4058-afa0-e3aeee8bb712\",\n"
+ + "\t\t\"modelCustomizationName\": \"\",\n"
+ + "\t\t\"modelInstanceName\": \"SotnFc-wan-connection 0\",\n" + "\t\t\"modelType\": \"\"\n" + "\t},\n"
+ + "\t\"resourceInstancenUuid\": null,\n"
+ + "\t\"resourceParameters\": \"{\\n\\\"locationConstraints\\\":[],\\n\\\"requestInputs\\\":{\\\"sotnfcspecwanconnection0_route-objective-function\\\":null,\\\"sotnfcspecwanconnection0_colorAware\\\":null,\\\"3rdctlspecwanconnection0_thirdPartyAdaptorRpc\\\":null,\\\"sotnfcspecwanconnection0_couplingFlag\\\":null,\\\"sotnfcspecwanconnection0_pbs\\\":null,\\\"3rdctlspecwanconnection0_thirdPartySdncId\\\":null,\\\"sotnfcspecwanconnection0_cbs\\\":null,\\\"3rdctlspecwanconnection0_thirdpartySdncName\\\":null,\\\"sotnfcspecwanconnection0_total-size\\\":null,\\\"3rdctlspecwanconnection0_templateFileName\\\":\\\"sotn_create_zte_template.json\\\",\\\"fcwanconnection0_type\\\":null,\\\"sotnfcspecwanconnection0_cir\\\":null,\\\"fcwanconnection0_uuid\\\":null,\\\"sotnfcspecwanconnection0_diversity-policy\\\":null,\\\"nf_naming\\\":true,\\\"multi_stage_design\\\":false,\\\"availability_zone_max_count\\\":1,\\\"3rdctlspecwanconnection0_restapiUrl\\\":\\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\\"max_instances\\\":null,\\\"sotnfcspecwanconnection0_reroute\\\":null,\\\"fcwanconnection0_name\\\":null,\\\"sotnfcspecwanconnection0_dualLink\\\":null,\\\"min_instances\\\":null,\\\"sotnfcspecwanconnection0_pir\\\":null,\\\"sotnfcspecwanconnection0_service-type\\\":null}\\n}\",\n"
+ + "\t\"operationType\": \"createInstance\",\n"
+ + "\t\"serviceInstanceId\": \"ffa07ae4-f820-45af-9439-1416b3bc1d39\",\n"
+ + "\t\"requestsInputs\": \"{\\r\\n\\t\\\"service\\\": {\\r\\n\\t\\t\\\"name\\\": \\\"wanconnection-37\\\",\\r\\n\\t\\t\\\"description\\\": \\\"deafe\\\",\\r\\n\\t\\t\\\"serviceInvariantUuid\\\": \\\"43fb5165-7d03-4009-8951-a8f45d3f0148\\\",\\r\\n\\t\\t\\\"serviceUuid\\\": \\\"198b066c-0771-4157-9594-1824adfdda7e\\\",\\r\\n\\t\\t\\\"globalSubscriberId\\\": \\\"sdwandemo\\\",\\r\\n\\t\\t\\\"serviceType\\\": \\\"CCVPN\\\",\\r\\n\\t\\t\\\"parameters\\\": {\\r\\n\\t\\t\\t\\\"resources\\\": [\\r\\n\\t\\t\\t],\\r\\n\\t\\t\\t\\\"requestInputs\\\": {\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sotn_create_zte_template.json\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sdwan_create_zte_template.json\\\",\\\"ont_ont_manufacturer\\\":\\\"huawei\\\",\\\"ont_ont_serial_num\\\":\\\"123\\\"\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\t}\\r\\n}\"\n"
+ + "}";
+
+ ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class);
+ return resourceInputObj;
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
index e7ff69ab3b..dd993bca51 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
@@ -20,7 +20,9 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
+import java.util.HashMap;
import java.util.Objects;
+import java.util.Optional;
import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
@@ -33,7 +35,8 @@ public class DmaapClientTestImpl implements DmaapClient {
private Runnable informConsumer;
@Override
- public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) {
+ public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer,
+ Optional<HashMap<String, String>> updateInfo) {
this.pnfCorrelationId = pnfCorrelationId;
this.informConsumer = informConsumer;
}
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 3e059e53bf..6a5a9021b2 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
@@ -216,7 +216,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
* This method updates the resource input by collecting required info from AAI
* @param execution
*/
- public void updateResourceInput(DelegateExecution execution) {
+ public ResourceInput updateResourceInput(DelegateExecution execution) {
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(execution.getVariable(Prefix + "resourceInput"), ResourceInput.class)
String modelName = resourceInputObj.getResourceModelInfo().getModelName()
@@ -232,9 +232,29 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String incomingRequest = resourceInputObj.getRequestsInputs()
String serviceParameters = JsonUtils.getJsonValue(incomingRequest, "service.parameters")
String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs")
- String cvlan = "10"
- String svlan = "100"
- String accessId = "AC9.0234.0337"
+ String cvlan
+ String svlan
+ String remoteId
+
+ List<Metadatum> metadatum = getMetaDatum(resourceInputObj.getGlobalSubscriberId(),
+ resourceInputObj.getServiceType(),
+ resourceInputObj.getServiceInstanceId())
+ for(Metadatum datum: metadatum) {
+ if (datum.getMetaname().equalsIgnoreCase("cvlan")) {
+ cvlan = datum.getMetaval()
+ }
+
+ if (datum.getMetaname().equalsIgnoreCase("svlan")) {
+ svlan = datum.getMetaval()
+ }
+
+ if (datum.getMetaname().equalsIgnoreCase("remoteId")) {
+ remoteId = datum.getMetaval()
+ }
+ }
+
+ logger.debug("cvlan: "+cvlan+" | svlan: "+svlan+" | remoteId: "+remoteId)
+
String manufacturer = jsonUtil.getJsonValue(serInput,
"service.parameters.requestInputs.ont_ont_manufacturer")
String ontsn = jsonUtil.getJsonValue(serInput,
@@ -242,14 +262,14 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.CVLAN", cvlan)
uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.SVLAN", svlan)
- uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.accessID", accessId)
+ uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.accessID", remoteId)
uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.manufacturer", manufacturer)
uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ONTSN", ontsn)
- msoLogger.debug("old resource input:" + resourceInputObj.toString())
+ logger.debug("old resource input:" + resourceInputObj.toString())
resourceInputObj.setResourceParameters(uResourceInput)
execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString())
- msoLogger.debug("new resource Input :" + resourceInputObj.toString())
+ logger.debug("new resource Input :" + resourceInputObj.toString())
break
case ~/[\w\s\W]*EdgeInternetProfile[\w\s\W]*/ :
@@ -260,23 +280,41 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs")
JSONObject inputParameters = new JSONObject(requestInputs)
- String cvlan = "100"
- String svlan = "1000"
+ String cvlan
+ String svlan
+ String remoteId
String manufacturer = jsonUtil.getJsonValue(serInput,
"service.parameters.requestInputs.ont_ont_manufacturer")
- String accessId = "AC9.0234.0337"
+
String ontsn = jsonUtil.getJsonValue(serInput,
"service.parameters.requestInputs.ont_ont_serial_num")
+ List<Metadatum> metadatum = getMetaDatum(resourceInputObj.getGlobalSubscriberId(),
+ resourceInputObj.getServiceType(),
+ resourceInputObj.getServiceInstanceId())
+ for(Metadatum datum: metadatum) {
+ if (datum.getMetaname().equalsIgnoreCase("cvlan")) {
+ cvlan = datum.getMetaval()
+ }
+
+ if (datum.getMetaname().equalsIgnoreCase("svlan")) {
+ svlan = datum.getMetaval()
+ }
+
+ if (datum.getMetaname().equalsIgnoreCase("remoteId")) {
+ remoteId = datum.getMetaval()
+ }
+ }
+
String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.c_vlan", cvlan)
uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.s_vlan", svlan)
uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.manufacturer", manufacturer)
- uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_access_id", accessId)
+ uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_access_id", remoteId)
uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ont_sn", ontsn)
- msoLogger.debug("old resource input:" + resourceInputObj.toString())
+ logger.debug("old resource input:" + resourceInputObj.toString())
resourceInputObj.setResourceParameters(uResourceInput)
execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString())
- msoLogger.debug("new resource Input :" + resourceInputObj.toString())
+ logger.debug("new resource Input :" + resourceInputObj.toString())
break
@@ -320,6 +358,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
default:
break
}
+ return resourceInputObj
}
/**
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 98def612de..973d8a156c 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
@@ -22,7 +22,9 @@
package org.onap.so.bpmn.infrastructure.scripts
+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.infrastructure.properties.BPMNProperties
import org.apache.commons.lang3.StringUtils
import org.apache.http.HttpResponse
@@ -87,6 +89,16 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
logger.trace("Exit preProcessRequest ")
}
+ // this method will convert resource list to instance_resource_list
+ 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 ")
@@ -117,6 +129,22 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
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.getGroups() != null) {
+ 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)
+ }
+ }
+ }
+ }
+ }
if (resource instanceof NetworkResource) {
networkResourceList.add(resource)
}
@@ -126,7 +154,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
} else {
//define sequenced resource list, we deploy vf first and then network and then ar
- //this is defaule sequence
+ //this is default sequence
List<VnfResource> vnfResourceList = new ArrayList<VnfResource>()
List<AllottedResource> arResourceList = new ArrayList<AllottedResource>()
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
index 94ceddae97..2ababac7e3 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
@@ -24,11 +24,17 @@ import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.camunda.bpm.engine.runtime.Execution;
+import org.onap.aai.domain.yang.v13.Metadatum;
+import org.onap.so.bpmn.common.recipe.ResourceInput;
+import org.onap.so.bpmn.common.resource.ResourceRequestBuilder;
+import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import java.util.HashMap;
+import java.util.Optional;
@Component
public class InformDmaapClient implements JavaDelegate {
@@ -41,8 +47,25 @@ public class InformDmaapClient implements JavaDelegate {
String pnfCorrelationId = (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID);
RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService();
String processBusinessKey = execution.getProcessBusinessKey();
- dmaapClient.registerForUpdate(pnfCorrelationId, () -> runtimeService.createMessageCorrelation("WorkflowMessage")
- .processInstanceBusinessKey(processBusinessKey).correlateWithResult());
+ HashMap<String, String> updateInfo = createUpdateInfo(execution);
+ updateInfo.put("pnfCorrelationId", pnfCorrelationId);
+ dmaapClient
+ .registerForUpdate(pnfCorrelationId,
+ () -> runtimeService.createMessageCorrelation("WorkflowMessage")
+ .processInstanceBusinessKey(processBusinessKey).correlateWithResult(),
+ Optional.of(updateInfo));
+ }
+
+ private HashMap<String, String> createUpdateInfo(DelegateExecution execution) {
+ HashMap<String, String> map = new HashMap();
+
+ ResourceInput resourceInputObj = ResourceRequestBuilder
+
+ .getJsonObject((String) execution.getVariable("resourceInput"), ResourceInput.class);
+ map.put("globalSubscriberID", resourceInputObj.getGlobalSubscriberId());
+ map.put("serviceType", resourceInputObj.getServiceType());
+ map.put("serviceInstanceId", resourceInputObj.getServiceInstanceId());
+ return map;
}
@Autowired
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java
index fbf86cc411..d513684659 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java
@@ -20,9 +20,13 @@
package org.onap.so.bpmn.infrastructure.pnf.dmaap;
+import java.util.HashMap;
+import java.util.Optional;
+
public interface DmaapClient {
- void registerForUpdate(String pnfCorrelationId, Runnable informConsumer);
+ void registerForUpdate(String pnfCorrelationId, Runnable informConsumer,
+ Optional<HashMap<String, String>> updateInfo);
Runnable unregister(String pnfCorrelationId);
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
index 96562fe90f..cce476f4d8 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
@@ -23,9 +23,7 @@
package org.onap.so.bpmn.infrastructure.pnf.dmaap;
import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@@ -40,6 +38,10 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.AAIObjectType;
@Component
public class PnfEventReadyDmaapClient implements DmaapClient {
@@ -53,6 +55,8 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
private volatile ScheduledThreadPoolExecutor executor;
private volatile boolean dmaapThreadListenerIsRunning;
+ public volatile List<HashMap<String, String>> updateInfoMap;
+
@Autowired
public PnfEventReadyDmaapClient(Environment env) {
httpClient = HttpClientBuilder.create().build();
@@ -64,11 +68,19 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
.port(env.getProperty("pnf.dmaap.port", Integer.class)).path(env.getProperty("pnf.dmaap.topicName"))
.path(env.getProperty("pnf.dmaap.consumerGroup")).path(env.getProperty("pnf.dmaap.consumerId"))
.build());
+ updateInfoMap = new ArrayList<>();
}
@Override
- public synchronized void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) {
+ public synchronized void registerForUpdate(String pnfCorrelationId, Runnable informConsumer,
+ Optional<HashMap<String, String>> updateInfo) {
logger.debug("registering for pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId);
+ HashMap<String, String> map = updateInfo.get();
+ if (map != null && map.size() > 0) {
+ synchronized (updateInfoMap) {
+ updateInfoMap.add(map);
+ }
+ }
pnfCorrelationIdToThreadMap.put(pnfCorrelationId, informConsumer);
if (!dmaapThreadListenerIsRunning) {
startDmaapThreadListener();
@@ -78,7 +90,17 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
@Override
public synchronized Runnable unregister(String pnfCorrelationId) {
logger.debug("unregistering from pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId);
- Runnable runnable = pnfCorrelationIdToThreadMap.remove(pnfCorrelationId);
+ Runnable runnable = runnable = pnfCorrelationIdToThreadMap.remove(pnfCorrelationId);
+ synchronized (updateInfoMap) {
+ for (int i = updateInfoMap.size() - 1; i >= 0; i--) {
+ if (!updateInfoMap.get(i).containsKey("pnfCorrelationId"))
+ continue;
+ String id = updateInfoMap.get(i).get("pnfCorrelationId");
+ if (id != pnfCorrelationId)
+ continue;
+ updateInfoMap.remove(i);
+ }
+ }
if (pnfCorrelationIdToThreadMap.isEmpty()) {
stopDmaapThreadListener();
}
@@ -111,7 +133,14 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
try {
logger.debug("dmaap listener starts listening pnf ready dmaap topic");
HttpResponse response = httpClient.execute(getRequest);
- getPnfCorrelationIdListFromResponse(response).forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound);
+ List<String> idList = getPnfCorrelationIdListFromResponse(response);
+
+ if (idList != null && idList.size() > 0) {
+ // send only body of response
+ registerClientResponse(idList.get(0), EntityUtils.toString(response.getEntity(), "UTF-8"));
+ }
+
+ idList.forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound);
} catch (IOException e) {
logger.error("Exception caught during sending rest request to dmaap for listening event topic", e);
} finally {
@@ -136,5 +165,36 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
runnable.run();
}
}
+
+ private void registerClientResponse(String pnfCorrelationId, String response) {
+
+ String customerId = null;
+ String serviceType = null;
+ String serId = null;
+ synchronized (updateInfoMap) {
+ for (HashMap<String, String> map : updateInfoMap) {
+ if (!map.containsKey("pnfCorrelationId"))
+ continue;
+ if (pnfCorrelationId != map.get("pnfCorrelationId"))
+ continue;
+ if (!map.containsKey("globalSubscriberID"))
+ continue;
+ if (!map.containsKey("serviceType"))
+ continue;
+ if (!map.containsKey("serviceInstanceId"))
+ continue;
+ customerId = map.get("pnfCorrelationId");
+ serviceType = map.get("serviceType");
+ serId = map.get("serviceInstanceId");
+ }
+ }
+ if (customerId == null || serviceType == null || serId == null)
+ return;
+ AAIResourcesClient client = new AAIResourcesClient();
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE_METADATA, customerId,
+ serviceType, serId);
+ client.update(uri, response);
+ }
+
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy
index 8dde45be81..e547981b2d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy
@@ -27,6 +27,7 @@ import org.junit.Test
import org.mockito.MockitoAnnotations
import org.onap.so.bpmn.common.recipe.ResourceInput
import org.onap.so.bpmn.common.resource.ResourceRequestBuilder
+import org.onap.so.bpmn.core.json.JsonUtils
import static org.mockito.Mockito.*
/**
@@ -106,6 +107,46 @@ class CreateSDNCNetworkResourceTest extends GroovyTestCase {
return resourceInputObj
}
+ private ResourceInput getUpdateResInputObj(String modelName) {
+
+ String resourceInput = "{\n" +
+ "\t\"resourceInstanceName\": \"SotnFc-wan-connection_wanconnection-37\",\n" +
+ "\t\"resourceInstanceDes\": null,\n" +
+ "\t\"globalSubscriberId\": \"sdwandemo\",\n" +
+ "\t\"serviceType\": \"CCVPN\",\n" +
+ "\t\"operationId\": \"df3387b5-4fbf-41bd-82a0-13a955ac178a\",\n" +
+ "\t\"serviceModelInfo\": {\n" +
+ "\t\t\"modelName\": \"WanConnectionSvc03\",\n" +
+ "\t\t\"modelUuid\": \"198b066c-0771-4157-9594-1824adfdda7e\",\n" +
+ "\t\t\"modelInvariantUuid\": \"43fb5165-7d03-4009-8951-a8f45d3f0148\",\n" +
+ "\t\t\"modelVersion\": \"1.0\",\n" +
+ "\t\t\"modelCustomizationUuid\": \"\",\n" +
+ "\t\t\"modelCustomizationName\": \"\",\n" +
+ "\t\t\"modelInstanceName\": \"\",\n" +
+ "\t\t\"modelType\": \"\"\n" +
+ "\t},\n" +
+ "\t\"resourceModelInfo\": {\n" +
+ "\t\t\"modelName\": \"" +
+ modelName +
+ "\",\n" +
+ "\t\t\"modelUuid\": \"6a0bf88b-343c-415b-88c1-6f73702452c4\",\n" +
+ "\t\t\"modelInvariantUuid\": \"50bc3415-2e01-4e50-a9e1-ec9584599bb3\",\n" +
+ "\t\t\"modelCustomizationUuid\": \"b205d620-84bd-4058-afa0-e3aeee8bb712\",\n" +
+ "\t\t\"modelCustomizationName\": \"\",\n" +
+ "\t\t\"modelInstanceName\": \"SotnFc-wan-connection 0\",\n" +
+ "\t\t\"modelType\": \"\"\n" +
+ "\t},\n" +
+ "\t\"resourceInstancenUuid\": null,\n" +
+ "\t\"resourceParameters\": \"{\\n\\\"locationConstraints\\\":[],\\n\\\"requestInputs\\\":{\\\"sotnfcspecwanconnection0_route-objective-function\\\":null,\\\"sotnfcspecwanconnection0_colorAware\\\":null,\\\"3rdctlspecwanconnection0_thirdPartyAdaptorRpc\\\":null,\\\"sotnfcspecwanconnection0_couplingFlag\\\":null,\\\"sotnfcspecwanconnection0_pbs\\\":null,\\\"3rdctlspecwanconnection0_thirdPartySdncId\\\":null,\\\"sotnfcspecwanconnection0_cbs\\\":null,\\\"3rdctlspecwanconnection0_thirdpartySdncName\\\":null,\\\"sotnfcspecwanconnection0_total-size\\\":null,\\\"3rdctlspecwanconnection0_templateFileName\\\":\\\"sotn_create_zte_template.json\\\",\\\"fcwanconnection0_type\\\":null,\\\"sotnfcspecwanconnection0_cir\\\":null,\\\"fcwanconnection0_uuid\\\":null,\\\"sotnfcspecwanconnection0_diversity-policy\\\":null,\\\"nf_naming\\\":true,\\\"multi_stage_design\\\":false,\\\"availability_zone_max_count\\\":1,\\\"3rdctlspecwanconnection0_restapiUrl\\\":\\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\\"max_instances\\\":null,\\\"sotnfcspecwanconnection0_reroute\\\":null,\\\"fcwanconnection0_name\\\":null,\\\"sotnfcspecwanconnection0_dualLink\\\":null,\\\"min_instances\\\":null,\\\"sotnfcspecwanconnection0_pir\\\":null,\\\"sotnfcspecwanconnection0_service-type\\\":null}\\n}\",\n" +
+ "\t\"operationType\": \"createInstance\",\n" +
+ "\t\"serviceInstanceId\": \"ffa07ae4-f820-45af-9439-1416b3bc1d39\",\n" +
+ "\t\"requestsInputs\": \"{\\r\\n\\t\\\"service\\\": {\\r\\n\\t\\t\\\"name\\\": \\\"wanconnection-37\\\",\\r\\n\\t\\t\\\"description\\\": \\\"deafe\\\",\\r\\n\\t\\t\\\"serviceInvariantUuid\\\": \\\"43fb5165-7d03-4009-8951-a8f45d3f0148\\\",\\r\\n\\t\\t\\\"serviceUuid\\\": \\\"198b066c-0771-4157-9594-1824adfdda7e\\\",\\r\\n\\t\\t\\\"globalSubscriberId\\\": \\\"sdwandemo\\\",\\r\\n\\t\\t\\\"serviceType\\\": \\\"CCVPN\\\",\\r\\n\\t\\t\\\"parameters\\\": {\\r\\n\\t\\t\\t\\\"resources\\\": [\\r\\n\\t\\t\\t],\\r\\n\\t\\t\\t\\\"requestInputs\\\": {\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sotn_create_zte_template.json\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sdwan_create_zte_template.json\\\",\\\"ont_ont_manufacturer\\\":\\\"huawei\\\",\\\"ont_ont_serial_num\\\":\\\"123\\\"\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\t}\\r\\n}\"\n" +
+ "}"
+
+ ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
+ return resourceInputObj
+ }
+
@Test
void testAfterCreateSDNCCall() {
init()
@@ -132,4 +173,30 @@ class CreateSDNCNetworkResourceTest extends GroovyTestCase {
def instanceId = response."response-data"."RequestData"."output"."network-response-information"."instance-id"
return instanceId
}
+
+ @Test
+ void testUpdateResourceInput() {
+ init()
+
+ def execution = getExecutionDelegate("OLT")
+ CreateSDNCNetworkResource createSDNCNetworkResource = new CreateSDNCNetworkResource()
+ def inputObject = createSDNCNetworkResource.updateResourceInput(execution)
+
+ println(inputObject.getResourceParameters())
+ assert JsonUtils.jsonElementExist(inputObject.getResourceParameters(), "requestInputs.SVLAN")
+ assert JsonUtils.jsonElementExist(inputObject.getResourceParameters(), "requestInputs.CVLAN")
+ assert JsonUtils.jsonElementExist(inputObject.getResourceParameters(), "requestInputs.manufacturer")
+ assert JsonUtils.jsonElementExist(inputObject.getResourceParameters(), "requestInputs.ONTSN")
+ }
+
+ private ExecutionEntity getExecutionDelegate(String modelName) {
+ def input = getUpdateResInputObj(modelName)
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+ when(mockExecution.getVariable(Prefix + "sdncCreateReturnCode")).thenReturn("200")
+ when(mockExecution.getVariable(Prefix + "SuccessIndicator")).thenReturn("false")
+ when(mockExecution.getVariable("isActivateRequired")).thenReturn("true")
+ when(mockExecution.getVariable("CRENWKI_createSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse)
+ when(mockExecution.getVariable(Prefix + "resourceInput")).thenReturn(input.toString())
+ return mockExecution
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
index e755214362..bfaf9cfee0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
@@ -42,7 +42,7 @@ public class CancelDmaapSubscriptionTest {
.thenReturn(TEST_PNF_CORRELATION_ID);
when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey");
dmaapClientTest.registerForUpdate("testPnfCorrelationId", () -> {
- });
+ }, null);
// when
delegate.execute(delegateExecution);
// then
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
index 19ba18f6de..2634f03d4b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
@@ -21,7 +21,9 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
+import java.util.HashMap;
import java.util.Objects;
+import java.util.Optional;
public class DmaapClientTestImpl implements DmaapClient {
@@ -29,7 +31,8 @@ public class DmaapClientTestImpl implements DmaapClient {
private Runnable informConsumer;
@Override
- public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) {
+ public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer,
+ Optional<HashMap<String, String>> updateInfo) {
this.pnfCorrelationId = pnfCorrelationId;
this.informConsumer = informConsumer;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
index df060ed014..93a71b31ec 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
@@ -34,10 +34,12 @@ import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InOrder;
+import org.onap.so.bpmn.common.recipe.ResourceInput;
+import org.onap.so.bpmn.common.resource.ResourceRequestBuilder;
public class InformDmaapClientTest {
@Before
- public void setUp() throws Exception {
+ public void setUp() {
informDmaapClient = new InformDmaapClient();
dmaapClientTest = new DmaapClientTestImpl();
informDmaapClient.setDmaapClient(dmaapClientTest);
@@ -53,7 +55,7 @@ public class InformDmaapClientTest {
private MessageCorrelationBuilder messageCorrelationBuilder;
@Test
- public void shouldSendListenerToDmaapClient() throws Exception {
+ public void shouldSendListenerToDmaapClient() {
// when
informDmaapClient.execute(delegateExecution);
// then
@@ -63,7 +65,7 @@ public class InformDmaapClientTest {
}
@Test
- public void shouldSendListenerToDmaapClientAndSendMessageToCamunda() throws Exception {
+ public void shouldSendListenerToDmaapClientAndSendMessageToCamunda() {
// when
informDmaapClient.execute(delegateExecution);
dmaapClientTest.getInformConsumer().run();
@@ -74,11 +76,41 @@ public class InformDmaapClientTest {
inOrder.verify(messageCorrelationBuilder).correlateWithResult();
}
+ private ResourceInput getUpdateResInputObj(String modelName) {
+
+ String resourceInput = "{\n" + "\t\"resourceInstanceName\": \"SotnFc-wan-connection_wanconnection-37\",\n"
+ + "\t\"resourceInstanceDes\": null,\n" + "\t\"globalSubscriberId\": \"sdwandemo\",\n"
+ + "\t\"serviceType\": \"CCVPN\",\n" + "\t\"operationId\": \"df3387b5-4fbf-41bd-82a0-13a955ac178a\",\n"
+ + "\t\"serviceModelInfo\": {\n" + "\t\t\"modelName\": \"WanConnectionSvc03\",\n"
+ + "\t\t\"modelUuid\": \"198b066c-0771-4157-9594-1824adfdda7e\",\n"
+ + "\t\t\"modelInvariantUuid\": \"43fb5165-7d03-4009-8951-a8f45d3f0148\",\n"
+ + "\t\t\"modelVersion\": \"1.0\",\n" + "\t\t\"modelCustomizationUuid\": \"\",\n"
+ + "\t\t\"modelCustomizationName\": \"\",\n" + "\t\t\"modelInstanceName\": \"\",\n"
+ + "\t\t\"modelType\": \"\"\n" + "\t},\n" + "\t\"resourceModelInfo\": {\n" + "\t\t\"modelName\": \""
+ + modelName + "\",\n" + "\t\t\"modelUuid\": \"6a0bf88b-343c-415b-88c1-6f73702452c4\",\n"
+ + "\t\t\"modelInvariantUuid\": \"50bc3415-2e01-4e50-a9e1-ec9584599bb3\",\n"
+ + "\t\t\"modelCustomizationUuid\": \"b205d620-84bd-4058-afa0-e3aeee8bb712\",\n"
+ + "\t\t\"modelCustomizationName\": \"\",\n"
+ + "\t\t\"modelInstanceName\": \"SotnFc-wan-connection 0\",\n" + "\t\t\"modelType\": \"\"\n" + "\t},\n"
+ + "\t\"resourceInstancenUuid\": null,\n"
+ + "\t\"resourceParameters\": \"{\\n\\\"locationConstraints\\\":[],\\n\\\"requestInputs\\\":{\\\"sotnfcspecwanconnection0_route-objective-function\\\":null,\\\"sotnfcspecwanconnection0_colorAware\\\":null,\\\"3rdctlspecwanconnection0_thirdPartyAdaptorRpc\\\":null,\\\"sotnfcspecwanconnection0_couplingFlag\\\":null,\\\"sotnfcspecwanconnection0_pbs\\\":null,\\\"3rdctlspecwanconnection0_thirdPartySdncId\\\":null,\\\"sotnfcspecwanconnection0_cbs\\\":null,\\\"3rdctlspecwanconnection0_thirdpartySdncName\\\":null,\\\"sotnfcspecwanconnection0_total-size\\\":null,\\\"3rdctlspecwanconnection0_templateFileName\\\":\\\"sotn_create_zte_template.json\\\",\\\"fcwanconnection0_type\\\":null,\\\"sotnfcspecwanconnection0_cir\\\":null,\\\"fcwanconnection0_uuid\\\":null,\\\"sotnfcspecwanconnection0_diversity-policy\\\":null,\\\"nf_naming\\\":true,\\\"multi_stage_design\\\":false,\\\"availability_zone_max_count\\\":1,\\\"3rdctlspecwanconnection0_restapiUrl\\\":\\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\\"max_instances\\\":null,\\\"sotnfcspecwanconnection0_reroute\\\":null,\\\"fcwanconnection0_name\\\":null,\\\"sotnfcspecwanconnection0_dualLink\\\":null,\\\"min_instances\\\":null,\\\"sotnfcspecwanconnection0_pir\\\":null,\\\"sotnfcspecwanconnection0_service-type\\\":null}\\n}\",\n"
+ + "\t\"operationType\": \"createInstance\",\n"
+ + "\t\"serviceInstanceId\": \"ffa07ae4-f820-45af-9439-1416b3bc1d39\",\n"
+ + "\t\"requestsInputs\": \"{\\r\\n\\t\\\"service\\\": {\\r\\n\\t\\t\\\"name\\\": \\\"wanconnection-37\\\",\\r\\n\\t\\t\\\"description\\\": \\\"deafe\\\",\\r\\n\\t\\t\\\"serviceInvariantUuid\\\": \\\"43fb5165-7d03-4009-8951-a8f45d3f0148\\\",\\r\\n\\t\\t\\\"serviceUuid\\\": \\\"198b066c-0771-4157-9594-1824adfdda7e\\\",\\r\\n\\t\\t\\\"globalSubscriberId\\\": \\\"sdwandemo\\\",\\r\\n\\t\\t\\\"serviceType\\\": \\\"CCVPN\\\",\\r\\n\\t\\t\\\"parameters\\\": {\\r\\n\\t\\t\\t\\\"resources\\\": [\\r\\n\\t\\t\\t],\\r\\n\\t\\t\\t\\\"requestInputs\\\": {\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sotn_create_zte_template.json\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sdwan_create_zte_template.json\\\",\\\"ont_ont_manufacturer\\\":\\\"huawei\\\",\\\"ont_ont_serial_num\\\":\\\"123\\\"\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\t}\\r\\n}\"\n"
+ + "}";
+
+ ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class);
+ return resourceInputObj;
+ }
+
private DelegateExecution mockDelegateExecution() {
+ ResourceInput input = getUpdateResInputObj("OLT");
DelegateExecution delegateExecution = mock(DelegateExecution.class);
+
when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID)))
.thenReturn("testPnfCorrelationId");
when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey");
+ when(delegateExecution.getVariable("resourceInput")).thenReturn(input.toString());
ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class);
when(delegateExecution.getProcessEngineServices()).thenReturn(processEngineServices);
RuntimeService runtimeService = mock(RuntimeService.class);
@@ -86,6 +118,7 @@ public class InformDmaapClientTest {
messageCorrelationBuilder = mock(MessageCorrelationBuilder.class);
when(runtimeService.createMessageCorrelation(any())).thenReturn(messageCorrelationBuilder);
when(messageCorrelationBuilder.processInstanceBusinessKey(any())).thenReturn(messageCorrelationBuilder);
+
return delegateExecution;
}
}