summaryrefslogtreecommitdiffstats
path: root/prh-commons/src/main/java
diff options
context:
space:
mode:
authorJoanna Jeremicz <joanna.jeremicz@nokia.com>2019-03-14 08:52:17 +0100
committerJoanna Jeremicz <joanna.jeremicz@nokia.com>2019-03-14 09:37:07 +0100
commitda01e853388b3715a4da488a73a10522e90bf0ed (patch)
tree9f25184027034f47c9f3a72b266e600fe7ad7aaa /prh-commons/src/main/java
parentc69d68d5669e45c969fd1293aa76c78d55a95dca (diff)
Revert IP information removal
Change-Id: I43cdc2f2086f884df1f74dfbf999addae2019b5e Issue-ID: DCAEGEN2-1312 Signed-off-by: Joanna Jeremicz <joanna.jeremicz@nokia.com>
Diffstat (limited to 'prh-commons/src/main/java')
-rw-r--r--prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java6
-rw-r--r--prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/JsonBodyBuilderImpl.java8
2 files changed, 12 insertions, 2 deletions
diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java
index d8eefec1..f6b817ef 100644
--- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java
+++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java
@@ -38,6 +38,12 @@ public interface ConsumerDmaapModel extends AaiModel, DmaapModel {
@SerializedName(value = "correlationId", alternate = "correlationId")
String getCorrelationId();
+ @SerializedName(value = "ipaddress-v4-oam", alternate = "ipaddress-v4-oam")
+ String getIpv4();
+
+ @SerializedName(value = "ipaddress-v6-oam", alternate = "ipaddress-v6-oam")
+ String getIpv6();
+
@SerializedName(value = "serial-number", alternate = "serial-number")
String getSerialNumber();
diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/JsonBodyBuilderImpl.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/JsonBodyBuilderImpl.java
index f04168c2..d031b1b5 100644
--- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/JsonBodyBuilderImpl.java
+++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/JsonBodyBuilderImpl.java
@@ -42,7 +42,9 @@ public class JsonBodyBuilderImpl implements JsonBodyBuilder<ConsumerDmaapModel>
public String createJsonBody(ConsumerDmaapModel consumerDmaapModel) {
GsonBuilder gsonBuilder = new GsonBuilder();
ServiceLoader.load(TypeAdapterFactory.class).forEach(gsonBuilder::registerTypeAdapterFactory);
- return filterOutAdditionalFieldsIfEmpty(gsonBuilder.create().toJson(ImmutableConsumerDmaapModel.builder()
+ return filterOutRedundantFields(gsonBuilder.create().toJson(ImmutableConsumerDmaapModel.builder()
+ .ipv4(consumerDmaapModel.getIpv4())
+ .ipv6(consumerDmaapModel.getIpv6())
.correlationId(consumerDmaapModel.getCorrelationId())
.serialNumber(consumerDmaapModel.getSerialNumber())
.equipVendor(consumerDmaapModel.getEquipVendor())
@@ -54,11 +56,13 @@ public class JsonBodyBuilderImpl implements JsonBodyBuilder<ConsumerDmaapModel>
.build()));
}
- private String filterOutAdditionalFieldsIfEmpty(String json) {
+ private String filterOutRedundantFields(String json) {
JsonObject jsonObject = new JsonParser().parse(json).getAsJsonObject();
if(jsonObject.get(ADDITIONAL_FIELDS).equals(new JsonObject())) {
jsonObject.remove(ADDITIONAL_FIELDS);
}
+ jsonObject.remove("ipaddress-v4-oam");
+ jsonObject.remove("ipaddress-v6-oam");
return jsonObject.toString();
}
} \ No newline at end of file