summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTait,Trevor(rt0435) <rtait@amdocs.com>2019-02-06 14:31:44 -0500
committerTait,Trevor(rt0435) <rtait@amdocs.com>2019-02-06 15:33:05 -0500
commit194ade66a442423398000b9c9f9fe312e3c7844b (patch)
treede9539ace43c327b7f88330a1e49e4e51c8d8926
parent769cb4c222fb6123bda3ae12abadd73cba7bdbb5 (diff)
Fix: NPE if there is no configuration ID
Issue-ID: LOG-778 Change-Id: I6c6c5d99ac911e47020ef6df99543efaf111b96e Signed-off-by: Tait,Trevor(rt0435) <rtait@amdocs.com>
-rw-r--r--config/portMirrorConfigurations.spec14
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java3
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;