From 140cd9c29a4f1ab9aa9590f07ac6b653ca459ffa Mon Sep 17 00:00:00 2001 From: Isaac Manuel Raj Date: Fri, 17 May 2019 20:48:58 +0530 Subject: Fix SDNC Resource creation workflow Fix SDNC Resource Creation workflow Issue-ID: SO-1393 Change-Id: Ia75150adf3695e623a2f3ec7ea5f720667142c1b Signed-off-by: Isaac Manuel Raj --- .../onap/so/bpmn/common/recipe/ResourceInput.java | 24 ++++++++++++++++++++++ .../bpmn/common/resource/InstanceResourceList.java | 14 ++++++++----- 2 files changed, 33 insertions(+), 5 deletions(-) (limited to 'bpmn/MSOCommonBPMN/src/main') diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java index 2bb024897c..33c48fbe44 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java @@ -84,6 +84,30 @@ public class ResourceInput { @JsonProperty("operationType") private String operationType; + @JsonProperty("vfModelInfo") + private ModelInfo vfModelInfo; + + + @JsonProperty("vnf-Id") + private String vnfId; + + public String getVnfId() { + return vnfId; + } + + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + + public ModelInfo getVfModelInfo() { + return vfModelInfo; + } + + public void setVfModelInfo(ModelInfo vfModelInfo) { + this.vfModelInfo = vfModelInfo; + } + + /** * @return Returns the requestsInputs. */ 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 71ea3b565b..e32a03dfa2 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 @@ -98,8 +98,6 @@ public class InstanceResourceList { // ....} // it will return sdwansiteresource_list private static String getPrimaryKey(Resource resource) { - String pk = ""; - String resourceInput = ""; if (resource instanceof VnfResource) { resourceInput = ((VnfResource) resource).getResourceInput(); @@ -111,10 +109,16 @@ public class InstanceResourceList { Type type = new TypeToken>() {}.getType(); Map map = gson.fromJson(resourceInput, type); - Optional pkOpt = map.values().stream().filter(e -> e.contains("[")).map(e -> e.replace("[", "")) - .map(e -> e.split(",")[0]).findFirst(); + if (map != null) { + Optional pkOpt = map.values().stream().filter(e -> e.contains("[")).map(e -> e.replace("[", "")) + .map(e -> e.split(",")[0]).findFirst(); - return pkOpt.isPresent() ? pkOpt.get() : ""; + return pkOpt.isPresent() ? pkOpt.get() : ""; + } else { + // TODO: handle the case if VNF resource is not list + // e.g. { resourceInput + return ""; + } } private static List convertToInstanceResourceList(Map>> normalizedReq, -- cgit 1.2.3-korg