diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java | 9 | ||||
-rw-r--r-- | src/test/resources/junit/portMirrorConfigurationsResponse.json | 40 |
2 files changed, 25 insertions, 24 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; } /** diff --git a/src/test/resources/junit/portMirrorConfigurationsResponse.json b/src/test/resources/junit/portMirrorConfigurationsResponse.json index 1c9b430..50b5b07 100644 --- a/src/test/resources/junit/portMirrorConfigurationsResponse.json +++ b/src/test/resources/junit/portMirrorConfigurationsResponse.json @@ -1,23 +1,19 @@ -{
- "port-mirror-configuration-request-input": {
- "source-port": [
- {
- "vnf-information": {
- "vnf-id": "09a8c1d8-0981-4e3d-a4c0-6007d6f57e1b"
- },
- "pnf-information": {
- "pnf-name": "onapTest1",
- "pnf-type": "onapSrc"
- }
- }
- ],
- "dest-port": [
- {
- "pnf-information": {
- "pnf-name": "onapTest2",
- "pnf-type": "onapDest"
- }
- }
- ]
- }
+{ + "port-mirror-configuration-request-input": { + "source-port": { + "vnf-information": { + "vnf-id": "09a8c1d8-0981-4e3d-a4c0-6007d6f57e1b" + }, + "pnf-information": { + "pnf-name": "onapTest1", + "pnf-type": "onapSrc" + } + }, + "dest-port": { + "pnf-information": { + "pnf-name": "onapTest2", + "pnf-type": "onapDest" + } + } + } }
\ No newline at end of file |