From 66fe8ea2d58813026f074f23594c9ca69a25880d Mon Sep 17 00:00:00 2001 From: Ravi Pendurty Date: Tue, 3 Aug 2021 13:06:19 +0530 Subject: Ignore SDN-R generated VES Messages Both Fault and PNFReg VES Messages with reportingEntity=SDN-R are ignored Issue-ID: CCSDK-3409 Signed-off-by: Ravi Pendurty Change-Id: Id6980cfa4fe79cae240b8c94cac3c4271da32671 Signed-off-by: Ravi Pendurty --- sdnr/wt/mountpoint-registrar/installer/pom.xml | 4 ++-- sdnr/wt/mountpoint-registrar/provider/pom.xml | 8 ++++---- .../mountpointregistrar/impl/DMaaPFaultVESMsgConsumer.java | 12 +++++++++++- .../mountpointregistrar/impl/DMaaPPNFRegVESMsgConsumer.java | 9 ++++++++- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/sdnr/wt/mountpoint-registrar/installer/pom.xml b/sdnr/wt/mountpoint-registrar/installer/pom.xml index 34a70bb77..d1ee3fbb0 100755 --- a/sdnr/wt/mountpoint-registrar/installer/pom.xml +++ b/sdnr/wt/mountpoint-registrar/installer/pom.xml @@ -47,7 +47,7 @@ - org.onap.ccsdk.features.sdnr.wt + ${project.groupId} ${application.name}-feature ${project.version} xml @@ -60,7 +60,7 @@ - org.onap.ccsdk.features.sdnr.wt + ${project.groupId} ${application.name}-provider ${project.version} diff --git a/sdnr/wt/mountpoint-registrar/provider/pom.xml b/sdnr/wt/mountpoint-registrar/provider/pom.xml index 4a6a3f021..69af460f8 100644 --- a/sdnr/wt/mountpoint-registrar/provider/pom.xml +++ b/sdnr/wt/mountpoint-registrar/provider/pom.xml @@ -30,7 +30,7 @@ org.onap.ccsdk.parent binding-parent 2.2.0-SNAPSHOT - + org.onap.ccsdk.features.sdnr.wt @@ -66,7 +66,7 @@ ${project.version} - org.onap.ccsdk.features.sdnr.wt + ${project.groupId} sdnr-wt-common ${project.version} provided @@ -106,13 +106,13 @@ dmaapClient - org.onap.ccsdk.features.sdnr.wt + ${project.groupId} sdnr-wt-data-provider-model ${project.version} provided - org.onap.ccsdk.features.sdnr.wt + ${project.groupId} sdnr-wt-devicemanager-core-model ${project.version} provided diff --git a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPFaultVESMsgConsumer.java b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPFaultVESMsgConsumer.java index ec5198012..6daeb493d 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPFaultVESMsgConsumer.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPFaultVESMsgConsumer.java @@ -49,19 +49,29 @@ public class DMaaPFaultVESMsgConsumer extends DMaaPVESMsgConsumerImpl { String faultSeverity; String vesDomain; int faultSequence; + String reportingEntityName; ObjectMapper oMapper = new ObjectMapper(); JsonNode dmaapMessageRootNode; LOG.info("Fault VES Message is - {}", msg); try { dmaapMessageRootNode = oMapper.readTree(msg); + reportingEntityName = dmaapMessageRootNode.at("/event/commonEventHeader/reportingEntityName").textValue(); + if (reportingEntityName.equals("ONAP SDN-R")) { + LOG.info( + "VES PNF Registration message generated by SDNR, hence no need to process any further; Ignoring the received message"); + return; + } + vesDomain = dmaapMessageRootNode.at("/event/commonEventHeader/domain").textValue(); if (!vesDomain.equalsIgnoreCase("fault")) { LOG.warn("Received {} domain VES Message in DMaaP Fault topic, ignoring it", vesDomain); return; } faultNodeId = dmaapMessageRootNode.at("/event/commonEventHeader/sourceName").textValue(); - faultOccurrenceTime = Instant.ofEpochMilli(dmaapMessageRootNode.at("/event/commonEventHeader/startEpochMicrosec").longValue()/1000) + faultOccurrenceTime = Instant + .ofEpochMilli( + dmaapMessageRootNode.at("/event/commonEventHeader/startEpochMicrosec").longValue() / 1000) .atZone(ZoneId.of("Z")).toString(); faultObjectId = dmaapMessageRootNode.at("/event/faultFields/alarmInterfaceA").textValue(); faultReason = dmaapMessageRootNode.at("/event/faultFields/specificProblem").textValue(); diff --git a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPPNFRegVESMsgConsumer.java b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPPNFRegVESMsgConsumer.java index 1d70077b9..1d95ea522 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPPNFRegVESMsgConsumer.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPPNFRegVESMsgConsumer.java @@ -44,7 +44,6 @@ public class DMaaPPNFRegVESMsgConsumer extends DMaaPVESMsgConsumerImpl { @Override public void processMsg(String msg) { LOG.debug("Message from DMaaP topic is - {} ", msg); - @Nullable String pnfId; String pnfIPAddress; @Nullable @@ -57,10 +56,18 @@ public class DMaaPPNFRegVESMsgConsumer extends DMaaPVESMsgConsumerImpl { String pnfUsername; @Nullable String pnfPasswd = null; + String reportingEntityName; ObjectMapper oMapper = new ObjectMapper(); JsonNode dmaapMessageRootNode; try { dmaapMessageRootNode = oMapper.readTree(msg); + reportingEntityName = dmaapMessageRootNode.at("/event/commonEventHeader/reportingEntityName").textValue(); + if (reportingEntityName.equals("ONAP SDN-R")) { + LOG.info( + "VES PNF Registration message generated by SDNR, hence no need to process any further; Ignoring the received message"); + return; + } + pnfId = dmaapMessageRootNode.at("/event/commonEventHeader/sourceName").textValue(); pnfIPAddress = getPNFIPAddress(dmaapMessageRootNode); pnfCommProtocol = -- cgit 1.2.3-korg