diff options
author | pwielebs <piotr.wielebski@nokia.com> | 2018-08-20 15:42:16 +0200 |
---|---|---|
committer | pwielebs <piotr.wielebski@nokia.com> | 2018-08-20 15:48:30 +0200 |
commit | 5801f1f7469045d51c28174e795c3deed1d9250b (patch) | |
tree | a3019af03ef409c39ad12884154d0e7041e6868d /prh-app-server/src/main/java | |
parent | 5005d7463fb8ef25f0b4e975d4392367037c7239 (diff) |
Update PRH against VES 7.0
- Changes made according to new VES 7.0.1
schema
- UT modified
Change-Id: I0e1eb07e4326f65da4bf3e1bd551962b15b907c1
Issue-ID: DCAEGEN2-600
Signed-off-by: pwielebs <piotr.wielebski@nokia.com>
Diffstat (limited to 'prh-app-server/src/main/java')
-rw-r--r-- | prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java index 1b8aaca3..d7bbfd2c 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java @@ -37,12 +37,11 @@ import reactor.core.publisher.Mono; */ public class DmaapConsumerJsonParser { - private static final String EVENT = "event"; - private static final String OTHER_FIELDS = "otherFields"; - private static final String PNF_OAM_IPV_4_ADDRESS = "pnfOamIpv4Address"; - private static final String PNF_OAM_IPV_6_ADDRESS = "pnfOamIpv6Address"; - private static final String PNF_VENDOR_NAME = "pnfVendorName"; - private static final String PNF_SERIAL_NUMBER = "pnfSerialNumber"; + private static final String PNF_REGISTRATION_FIELDS = "pnfRegistrationFields"; + private static final String OAM_IPV_4_ADDRESS = "oamV4IpAddress"; + private static final String OAM_IPV_6_ADDRESS = "oamV6IpAddress"; + private static final String VENDOR_NAME = "vendorName"; + private static final String SERIAL_NUMBER = "serialNumber"; /** * Extract info from string and create @see {@link org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel}. @@ -85,11 +84,11 @@ public class DmaapConsumerJsonParser { } private Mono<ConsumerDmaapModel> transform(JsonObject monoJsonP) { - monoJsonP = monoJsonP.getAsJsonObject(EVENT).getAsJsonObject(OTHER_FIELDS); - String pnfVendorName = getValueFromJson(monoJsonP, PNF_VENDOR_NAME); - String pnfSerialNumber = getValueFromJson(monoJsonP, PNF_SERIAL_NUMBER); - String pnfOamIpv4Address = getValueFromJson(monoJsonP, PNF_OAM_IPV_4_ADDRESS); - String pnfOamIpv6Address = getValueFromJson(monoJsonP, PNF_OAM_IPV_6_ADDRESS); + monoJsonP = monoJsonP.getAsJsonObject(PNF_REGISTRATION_FIELDS); + String pnfVendorName = getValueFromJson(monoJsonP, VENDOR_NAME); + String pnfSerialNumber = getValueFromJson(monoJsonP, SERIAL_NUMBER); + String pnfOamIpv4Address = getValueFromJson(monoJsonP, OAM_IPV_4_ADDRESS); + String pnfOamIpv6Address = getValueFromJson(monoJsonP, OAM_IPV_6_ADDRESS); return (!vendorAndSerialNotEmpty(pnfSerialNumber, pnfVendorName) || !ipPropertiesNotEmpty(pnfOamIpv4Address, pnfOamIpv6Address)) @@ -114,16 +113,15 @@ public class DmaapConsumerJsonParser { } private boolean containsHeader(JsonObject jsonObject) { - return jsonObject.has(EVENT) && jsonObject.getAsJsonObject(EVENT).has(OTHER_FIELDS); + return jsonObject.has(PNF_REGISTRATION_FIELDS); } - private String printMessage(String pnfVendorName, String pnfSerialNumber, String pnfOamIpv4Address, - String pnfOamIpv6Address) { + private String printMessage(String vendorName, String serialNumber, String oamIpv4Address, String oamIpv6Address) { return String.format("%n{" - + "\"pnfVendorName\" : \"%s\"," - + "\"pnfSerialNumber\": \"%s\"," - + "\"pnfOamIpv4Address\": \"%s\"," - + "\"pnfOamIpv6Address\": \"%s\"" - + "%n}", pnfVendorName, pnfSerialNumber, pnfOamIpv4Address, pnfOamIpv6Address); + + "\"" + VENDOR_NAME + " : \"%s\"," + + "\"" + SERIAL_NUMBER + "\": \"%s\"," + + "\"" + OAM_IPV_4_ADDRESS + "\": \"%s\"," + + "\"" + OAM_IPV_6_ADDRESS + "\": \"%s\"" + + "%n}", vendorName, serialNumber, oamIpv4Address, oamIpv6Address); } } |