From 194ade66a442423398000b9c9f9fe312e3c7844b Mon Sep 17 00:00:00 2001 From: "Tait,Trevor(rt0435)" Date: Wed, 6 Feb 2019 14:31:44 -0500 Subject: Fix: NPE if there is no configuration ID Issue-ID: LOG-778 Change-Id: I6c6c5d99ac911e47020ef6df99543efaf111b96e Signed-off-by: Tait,Trevor(rt0435) --- config/portMirrorConfigurations.spec | 14 +++++++++----- .../org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java | 3 +++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/config/portMirrorConfigurations.spec b/config/portMirrorConfigurations.spec index 964b385..edf413a 100644 --- a/config/portMirrorConfigurations.spec +++ b/config/portMirrorConfigurations.spec @@ -4,22 +4,26 @@ { // This section extracts pnf-information from the GENERIC-RESOURCES-API - // response from sdnc + // port-mirror-configuration-request-input response from sdnc "operation": "shift", "spec": { "port-mirror-configuration-request-input": { "source-port": { "pnf-information": { "pnf-name": "pnfList[0].name", - "#nfType": "pnfList[0].attributeList[0].name", - "pnf-type": "pnfList[0].attributeList[0].value" + "pnf-type": { + "#nfType": "pnfList[0].attributeList[0].name", + "@(1,pnf-type)": "pnfList[0].attributeList[0].value" + } } }, "dest-port": { "pnf-information": { "pnf-name": "pnfList[1].name", - "#nfType": "pnfList[1].attributeList[0].name", - "pnf-type": "pnfList[1].attributeList[0].value" + "pnf-type": { + "#nfType": "pnfList[1].attributeList[0].name", + "@(1,pnf-type)": "pnfList[1].attributeList[0].value" + } } } } diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java index 5065da3..b35f9f4 100644 --- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java +++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java @@ -230,6 +230,9 @@ public class RestUtil { Object providedConfigurationsInput = JsonUtils.jsonToObject(sdncResponse); Chainr providedConfigurations = Chainr.fromSpec(providedConfigurationsSpec); Object providedConfigurationsObject = providedConfigurations.transform(providedConfigurationsInput); + if (null == providedConfigurationsObject) { + return pnfList; + } Gson gson = new Gson(); JsonElement jsonElement = gson.toJsonTree(providedConfigurationsObject); JsonObject jsonObject = (JsonObject) jsonElement; -- cgit 1.2.3-korg