Add additional fields to PRH (2) 97/78397/1
authorpwielebs <piotr.wielebski@nokia.com>
Wed, 13 Feb 2019 15:06:53 +0000 (16:06 +0100)
committerpwielebs <piotr.wielebski@nokia.com>
Wed, 13 Feb 2019 15:06:53 +0000 (16:06 +0100)
* correct name of parameters

Change-Id: I591ed6ba66691d3fe637b9d81b0956a635deac1c
Issue-ID: DCAEGEN2-1173
Signed-off-by: pwielebs <piotr.wielebski@nokia.com>
pom.xml
prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java
prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/PnfRegistrationFields.java
prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParserTest.java
prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java

diff --git a/pom.xml b/pom.xml
index 61a64cf..ad48c40 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -50,7 +50,7 @@
     <spring-boot.version>2.1.2.RELEASE</spring-boot.version>
     <springfox.version>2.9.2</springfox.version>
     <immutables.version>2.7.5</immutables.version>
-    <sdk.version>1.1.0-SNAPSHOT</sdk.version>
+    <sdk.version>1.1.2-SNAPSHOT</sdk.version>
   </properties>
 
   <modules>
index f47231d..7532c5d 100644 (file)
@@ -119,13 +119,14 @@ public class DmaapConsumerJsonParser {
                 .getAsJsonObject(PNF_REGISTRATION_FIELDS);
 
         this.pnfSourceName = getValueFromJson(commonEventHeader, SOURCE_NAME);
+        this.pnfNfRoleAdditionalField = getValueFromJson(commonEventHeader, NF_ROLE);
+
         this.pnfOamIpv4Address = getValueFromJson(pnfRegistrationFields, OAM_IPV_4_ADDRESS);
         this.pnfOamIpv6Address = getValueFromJson(pnfRegistrationFields, OAM_IPV_6_ADDRESS);
         this.pnfSerialNumberAdditionalField = getValueFromJson(pnfRegistrationFields, SERIAL_NUMBER);
         this.pnfEquipVendorAdditionalField = getValueFromJson(pnfRegistrationFields, EQUIP_VENDOR);
         this.pnfEquipModelAdditionalField = getValueFromJson(pnfRegistrationFields, EQUIP_MODEL);
         this.pnfEquipTypeAdditionalField = getValueFromJson(pnfRegistrationFields, EQUIP_TYPE);
-        this.pnfNfRoleAdditionalField = getValueFromJson(pnfRegistrationFields, NF_ROLE);
         this.pnfSwVersionAdditionalField = getValueFromJson(pnfRegistrationFields, SW_VERSION);
 
         return (StringUtils.isEmpty(pnfSourceName) || !ipPropertiesNotEmpty(pnfOamIpv4Address, pnfOamIpv6Address))
index c2c2b74..a9a28c0 100644 (file)
@@ -33,12 +33,12 @@ class PnfRegistrationFields {
     static final String CORRELATION_ID = "correlationId";
 
     // additional fields
-    static final String SERIAL_NUMBER = "serial-number";
-    static final String EQUIP_VENDOR = "equip-vendor";
-    static final String EQUIP_MODEL = "equip-model";
-    static final String EQUIP_TYPE = "equip-type";
-    static final String NF_ROLE = "nf-role";
-    static final String SW_VERSION = "sw-version";
+    static final String SERIAL_NUMBER = "serialNumber";
+    static final String EQUIP_VENDOR = "vendorName";
+    static final String EQUIP_MODEL = "modelNumber";
+    static final String EQUIP_TYPE = "unitType";
+    static final String NF_ROLE = "nfNamingCode";
+    static final String SW_VERSION = "softwareVersion";
 
     private PnfRegistrationFields() {}
 }
index 591276b..44651a5 100644 (file)
@@ -42,31 +42,36 @@ class DmaapConsumerJsonParserTest {
     void whenPassingCorrectJson_validationNotThrowingAnException() {
         //given
         String message = "[{\"event\": {"
-                + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"},"
+                + "\"commonEventHeader\": { "
+                + " \"sourceName\":\"NOKQTFCOC540002E\","
+                + " \"nfNamingCode\":\"gNB\" "
+                + "},"
                 + "\"pnfRegistrationFields\": {"
-                + " \"equip-vendor\": \"nokia\","
-                + " \"serial-number\": \"QTFCOC540002E\","
+                + " \"vendorName\": \"nokia\","
+                + " \"serialNumber\": \"QTFCOC540002E\","
                 + " \"pnfRegistrationFieldsVersion\": \"2.0\","
-                + " \"equip-model\": \"3310\","
-                + " \"equip-type\": \"type\",\n"
-                + " \"nf-role\": \"role\","
+                + " \"modelNumber\": \"3310\","
+                + " \"unitType\": \"type\",\n"
+                + " \"unitFamily\": \"BBU\","
                 + " \"oamV4IpAddress\": \"10.16.123.234\","
-                + " \"sw-version\": \"v4.5.0.1\","
+                + " \"softwareVersion\": \"v4.5.0.1\","
                 + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
                 + "}}}]";
 
         String parsed = "{\"event\": {"
-                + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"},"
+                + "\"commonEventHeader\": { "
+                + " \"sourceName\":\"NOKQTFCOC540002E\","
+                + " \"nfNamingCode\":\"gNB\" "
+                + "},"
                 + "\"pnfRegistrationFields\": {"
-                + " \"equip-vendor\": \"nokia\","
-                + " \"serial-number\": \"QTFCOC540002E\","
+                + " \"vendorName\": \"nokia\","
+                + " \"serialNumber\": \"QTFCOC540002E\","
                 + " \"pnfRegistrationFieldsVersion\": \"2.0\","
-                + " \"equip-model\": \"3310\","
-                + " \"equip-type\": \"type\",\n"
-                + " \"nf-role\": \"role\","
+                + " \"modelNumber\": \"3310\","
+                + " \"unitType\": \"type\",\n"
                 + " \"unitFamily\": \"BBU\","
                 + " \"oamV4IpAddress\": \"10.16.123.234\","
-                + " \"sw-version\": \"v4.5.0.1\","
+                + " \"softwareVersion\": \"v4.5.0.1\","
                 + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
                 + "}}}";
 
@@ -78,7 +83,7 @@ class DmaapConsumerJsonParserTest {
                 .equipVendor("nokia")
                 .equipModel("3310")
                 .equipType("type")
-                .nfRole("role")
+                .nfRole("gNB")
                 .swVersion("v4.5.0.1")
                 .build();
         //when
@@ -97,30 +102,34 @@ class DmaapConsumerJsonParserTest {
     void whenPassingCorrectJsonWithoutIpv4_validationNotThrowingAnException() {
         //given
         String message = "[{\"event\": {"
-                + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"},"
+                + "\"commonEventHeader\": { "
+                + " \"sourceName\":\"NOKQTFCOC540002E\","
+                + " \"nfNamingCode\":\"gNB\" "
+                + "},"
                 + "\"pnfRegistrationFields\": {"
-                + " \"equip-vendor\": \"nokia\","
-                + " \"serial-number\": \"QTFCOC540002E\","
+                + " \"vendorName\": \"nokia\","
+                + " \"serialNumber\": \"QTFCOC540002E\","
                 + " \"pnfRegistrationFieldsVersion\": \"2.0\","
-                + " \"equip-model\": \"3310\","
-                + " \"equip-type\": \"type\",\n"
-                + " \"nf-role\": \"role\","
+                + " \"modelNumber\": \"3310\","
+                + " \"unitType\": \"type\",\n"
                 + " \"unitFamily\": \"BBU\","
-                + " \"sw-version\": \"v4.5.0.1\","
+                + " \"softwareVersion\": \"v4.5.0.1\","
                 + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
                 + "}}}]";
 
         String parsed = "{\"event\": {"
-                + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"},"
+                + "\"commonEventHeader\": { "
+                + " \"sourceName\":\"NOKQTFCOC540002E\","
+                + " \"nfNamingCode\":\"gNB\" "
+                + "},"
                 + "\"pnfRegistrationFields\": {"
-                + " \"equip-vendor\": \"nokia\","
-                + " \"serial-number\": \"QTFCOC540002E\","
+                + " \"vendorName\": \"nokia\","
+                + " \"serialNumber\": \"QTFCOC540002E\","
                 + " \"pnfRegistrationFieldsVersion\": \"2.0\","
-                + " \"equip-model\": \"3310\","
-                + " \"equip-type\": \"type\",\n"
-                + " \"nf-role\": \"role\","
+                + " \"modelNumber\": \"3310\","
+                + " \"unitType\": \"type\",\n"
                 + " \"unitFamily\": \"BBU\","
-                + " \"sw-version\": \"v4.5.0.1\","
+                + " \"softwareVersion\": \"v4.5.0.1\","
                 + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
                 + "}}}";
 
@@ -141,7 +150,7 @@ class DmaapConsumerJsonParserTest {
                 .equipVendor("nokia")
                 .equipModel("3310")
                 .equipType("type")
-                .nfRole("role")
+                .nfRole("gNB")
                 .swVersion("v4.5.0.1")
                 .build();
         Assertions.assertNotNull(consumerDmaapModel);
@@ -152,33 +161,39 @@ class DmaapConsumerJsonParserTest {
     void whenPassingCorrectJsonWithoutIpv6_validationNotThrowingAnException() {
         //given
         String message = "[{\"event\": {"
-                + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"},"
+                + "\"commonEventHeader\": { "
+                + " \"sourceName\":\"NOKQTFCOC540002E\","
+                + " \"nfNamingCode\":\"gNB\" "
+                + "},"
                 + "\"pnfRegistrationFields\": {"
-                + " \"equip-vendor\": \"nokia\","
-                + " \"serial-number\": \"QTFCOC540002E\","
+                + " \"vendorName\": \"nokia\","
+                + " \"serialNumber\": \"QTFCOC540002E\","
                 + " \"pnfRegistrationFieldsVersion\": \"2.0\","
-                + " \"equip-model\": \"3310\","
-                + " \"equip-type\": \"type\",\n"
-                + " \"nf-role\": \"role\","
+                + " \"modelNumber\": \"3310\","
+                + " \"unitType\": \"type\",\n"
                 + " \"unitFamily\": \"BBU\","
                 + " \"oamV4IpAddress\": \"10.16.123.234\","
-                + " \"sw-version\": \"v4.5.0.1\""
+                + " \"softwareVersion\": \"v4.5.0.1\""
                 + "}}}]";
 
+
         String parsed = "{\"event\": {"
-                + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"},"
+                + "\"commonEventHeader\": { "
+                + " \"sourceName\":\"NOKQTFCOC540002E\","
+                + " \"nfNamingCode\":\"gNB\" "
+                + "},"
                 + "\"pnfRegistrationFields\": {"
-                + " \"equip-vendor\": \"nokia\","
-                + " \"serial-number\": \"QTFCOC540002E\","
+                + " \"vendorName\": \"nokia\","
+                + " \"serialNumber\": \"QTFCOC540002E\","
                 + " \"pnfRegistrationFieldsVersion\": \"2.0\","
-                + " \"equip-model\": \"3310\","
-                + " \"equip-type\": \"type\",\n"
-                + " \"nf-role\": \"role\","
+                + " \"modelNumber\": \"3310\","
+                + " \"unitType\": \"type\",\n"
                 + " \"unitFamily\": \"BBU\","
                 + " \"oamV4IpAddress\": \"10.16.123.234\","
-                + " \"sw-version\": \"v4.5.0.1\""
+                + " \"softwareVersion\": \"v4.5.0.1\""
                 + "}}}";
 
+
         ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder()
                 .ipv4("10.16.123.234")
                 .ipv6("")
@@ -187,7 +202,7 @@ class DmaapConsumerJsonParserTest {
                 .equipVendor("nokia")
                 .equipModel("3310")
                 .equipType("type")
-                .nfRole("role")
+                .nfRole("gNB")
                 .swVersion("v4.5.0.1")
                 .build();
         //when
@@ -206,32 +221,34 @@ class DmaapConsumerJsonParserTest {
     void whenPassingCorrectJsonWithoutIpv4andIpv6_validationAddingAnException() {
         //given
         String message = "[{\"event\": {"
-            + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"},"
-            + "\"pnfRegistrationFields\": {"
-            + " \"unitType\": \"AirScale\","
-            + " \"serialNumber\": \"QTFCOC540002E\","
-            + " \"pnfRegistrationFieldsVersion\": \"2.0\","
-            + " \"manufactureDate\": \"1535014037024\","
-            + " \"modelNumber\": \"7BEA\",\n"
-            + " \"lastServiceDate\": \"1535014037024\","
-            + " \"unitFamily\": \"BBU\","
-            + " \"vendorName\": \"Nokia\","
-            + " \"softwareVersion\": \"v4.5.0.1\""
-            + "}}}]";
+                + "\"commonEventHeader\": { "
+                + " \"sourceName\":\"NOKQTFCOC540002E\","
+                + " \"nfNamingCode\":\"gNB\" "
+                + "},"
+                + "\"pnfRegistrationFields\": {"
+                + " \"vendorName\": \"nokia\","
+                + " \"serialNumber\": \"QTFCOC540002E\","
+                + " \"pnfRegistrationFieldsVersion\": \"2.0\","
+                + " \"modelNumber\": \"3310\","
+                + " \"unitType\": \"type\",\n"
+                + " \"unitFamily\": \"BBU\","
+                + " \"softwareVersion\": \"v4.5.0.1\""
+                + "}}}]";
 
         String parsed = "{\"event\": {"
-            + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"},"
-            + "\"pnfRegistrationFields\": {"
-            + " \"unitType\": \"AirScale\","
-            + " \"serialNumber\": \"QTFCOC540002E\","
-            + " \"pnfRegistrationFieldsVersion\": \"2.0\","
-            + " \"manufactureDate\": \"1535014037024\","
-            + " \"modelNumber\": \"7BEA\",\n"
-            + " \"lastServiceDate\": \"1535014037024\","
-            + " \"unitFamily\": \"BBU\","
-            + " \"vendorName\": \"Nokia\","
-            + " \"softwareVersion\": \"v4.5.0.1\""
-            + "}}}";
+                + "\"commonEventHeader\": { "
+                + " \"sourceName\":\"NOKQTFCOC540002E\","
+                + " \"nfNamingCode\":\"gNB\" "
+                + "},"
+                + "\"pnfRegistrationFields\": {"
+                + " \"vendorName\": \"nokia\","
+                + " \"serialNumber\": \"QTFCOC540002E\","
+                + " \"pnfRegistrationFieldsVersion\": \"2.0\","
+                + " \"modelNumber\": \"3310\","
+                + " \"unitType\": \"type\",\n"
+                + " \"unitFamily\": \"BBU\","
+                + " \"softwareVersion\": \"v4.5.0.1\""
+                + "}}}";
 
         DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser());
         JsonElement jsonElement = new JsonParser().parse(parsed);
@@ -410,34 +427,41 @@ class DmaapConsumerJsonParserTest {
     @Test
     void whenPassingCorrectJsoArrayWithoutIpv4_validationNotThrowingAnException() {
         //given
-        String message =
-                "[{\"event\": {"
-                + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"},"
+        String message = "[{\"event\": {"
+                + "\"commonEventHeader\": { "
+                + "  \"sourceName\":\"NOKQTFCOC540002E\","
+                + "  \"nfNamingCode\":\"gNB\" "
+                + "  },"
                 + "\"pnfRegistrationFields\": {"
-                + " \"equip-vendor\": \"nokia\","
-                + " \"serial-number\": \"QTFCOC540002E\","
+                + " \"vendorName\": \"nokia\","
+                + " \"serialNumber\": \"QTFCOC540002E\","
                 + " \"pnfRegistrationFieldsVersion\": \"2.0\","
-                + " \"equip-model\": \"3310\","
-                + " \"equip-type\": \"type\",\n"
-                + " \"nf-role\": \"role\","
+                + " \"modelNumber\": \"3310\","
+                + " \"unitType\": \"type\",\n"
                 + " \"unitFamily\": \"BBU\","
-                + " \"sw-version\": \"v4.5.0.1\","
+                + " \"softwareVersion\": \"v4.5.0.1\","
                 + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
                 + "}}},"
-                + "{\"event\": {"
-                + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"},"
+                + " {\"event\": {"
+                + "\"commonEventHeader\": { "
+                + " \"sourceName\":\"NOKQTFCOC540002E\","
+                + " \"nfNamingCode\":\"gNB\" "
+                + "},"
                 + "\"pnfRegistrationFields\": {"
-                + " \"equip-vendor\": \"nokia\","
-                + " \"serial-number\": \"QTFCOC540002E\","
+                + " \"vendorName\": \"nokia\","
+                + " \"serialNumber\": \"QTFCOC540002E\","
                 + " \"pnfRegistrationFieldsVersion\": \"2.0\","
-                + " \"equip-model\": \"3310\","
-                + " \"equip-type\": \"type\",\n"
-                + " \"nf-role\": \"role\","
+                + " \"modelNumber\": \"3310\","
+                + " \"unitType\": \"type\",\n"
                 + " \"unitFamily\": \"BBU\","
-                + " \"sw-version\": \"v4.5.0.1\","
+                + " \"softwareVersion\": \"v4.5.0.1\","
                 + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
                 + "}}}]";
 
+
+
+
+
         ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder()
                 .ipv4("")
                 .ipv6("0:0:0:0:0:FFFF:0A10:7BEA")
@@ -446,7 +470,7 @@ class DmaapConsumerJsonParserTest {
                 .equipVendor("nokia")
                 .equipModel("3310")
                 .equipType("type")
-                .nfRole("role")
+                .nfRole("gNB")
                 .swVersion("v4.5.0.1")
                 .build();
         //when
index a2f0807..87b037f 100644 (file)
@@ -67,23 +67,25 @@ class DmaapConsumerTaskImplTest {
             .equipVendor("nokia")
             .equipModel("3310")
             .equipType("type")
-            .nfRole("role")
+            .nfRole("gNB")
             .swVersion("v4.5.0.1")
             .build();
         appConfig = mock(AppConfig.class);
 
         message = "[{\"event\": {"
-            + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"},"
+            + "\"commonEventHeader\": { "
+            + " \"sourceName\":\"NOKQTFCOC540002E\","
+            + " \"nfNamingCode\":\"gNB\" "
+            + "},"
             + "\"pnfRegistrationFields\": {"
-            + " \"equip-vendor\": \"nokia\","
-            + " \"serial-number\": \"QTFCOC540002E\","
+            + " \"vendorName\": \"nokia\","
+            + " \"serialNumber\": \"QTFCOC540002E\","
             + " \"pnfRegistrationFieldsVersion\": \"2.0\","
-            + " \"equip-model\": \"3310\","
-            + " \"equip-type\": \"type\",\n"
-            + " \"nf-role\": \"role\","
+            + " \"modelNumber\": \"3310\","
+            + " \"unitType\": \"type\",\n"
             + " \"unitFamily\": \"BBU\","
             + " \"oamV4IpAddress\": \"10.16.123.234\","
-            + " \"sw-version\": \"v4.5.0.1\","
+            + " \"softwareVersion\": \"v4.5.0.1\","
             + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
             + "}}}]";
     }