diff options
author | 2019-01-31 10:58:16 -0500 | |
---|---|---|
committer | 2019-02-04 14:21:26 -0500 | |
commit | 769cb4c222fb6123bda3ae12abadd73cba7bdbb5 (patch) | |
tree | de57d516fea37140e7fbb23bd4130767b2bbf716 /src/main/java/org/onap/pomba/contextbuilder/sdnc | |
parent | 7aa6d16dff7103b7b83fbd3261c2caa374b7810e (diff) |
SDNC Context Builder : L2 Fabric Retrieval - pnf
Handle the case where there ONE PNF under source-port OR dest-port but
not both.
Issue-ID: LOG-778
Change-Id: Ia37bc98e51e9bc8548ac897af369c0e576f57308
Signed-off-by: Tait,Trevor(rt0435) <rtait@amdocs.com>
Diffstat (limited to 'src/main/java/org/onap/pomba/contextbuilder/sdnc')
-rw-r--r-- | src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java | 9 |
1 files changed, 7 insertions, 2 deletions
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 ab48ac5..5065da3 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 @@ -225,6 +225,7 @@ public class RestUtil { } public static List<PNF> getPnfFromSdncResonse(Client sdncClient, String sdncBaseUrl, String authorization, String sdncPortMirrorResourcePath, String sdncResponse) throws AuditException { + List<PNF> pnfList = new ArrayList<>(); List<Object> providedConfigurationsSpec = JsonUtils.filepathToList(PROVIDED_CONFIGURATIONS_SPEC_PATH); Object providedConfigurationsInput = JsonUtils.jsonToObject(sdncResponse); Chainr providedConfigurations = Chainr.fromSpec(providedConfigurationsSpec); @@ -240,9 +241,13 @@ public class RestUtil { Object portMirrorInput = JsonUtils.jsonToObject(portMirrorResponse); Chainr portMirror = Chainr.fromSpec(portMirrorSpec); Object portMirrorObject = portMirror.transform(portMirrorInput); - return gson.fromJson(JsonUtils.toPrettyJsonString(portMirrorObject), ModelContext.class).getPnfs(); + for (PNF pnf :gson.fromJson(JsonUtils.toPrettyJsonString(portMirrorObject), ModelContext.class).getPnfs()) { + if (null != pnf) { + pnfList.add(pnf); + } + }; } - return new ArrayList<>(); + return pnfList; } /** |