diff options
author | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2021-03-29 09:04:05 +0200 |
---|---|---|
committer | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2021-03-29 09:04:33 +0200 |
commit | 9fb395380431345b7da7a765651185815a9ac91d (patch) | |
tree | e9915a557d158c3f446c5dcd108afba9e307633a /sdnr/wt/mountpoint-state-provider | |
parent | 38c3dd74dc9c43a6606680cc6df82062cd7cbd81 (diff) |
Map ORAN alarm-notif to VES fault
O-RAN (FrontHaul) deviceManager: o-ran-fm.yang/alarm-notif to VES:fault
Issue-ID: CCSDK-3161
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Change-Id: I3c0854ac3096160119220c341a2d8f2010facd8b
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/mountpoint-state-provider')
4 files changed, 22 insertions, 23 deletions
diff --git a/sdnr/wt/mountpoint-state-provider/provider/pom.xml b/sdnr/wt/mountpoint-state-provider/provider/pom.xml index f07a82d68..fc6d7e07e 100644 --- a/sdnr/wt/mountpoint-state-provider/provider/pom.xml +++ b/sdnr/wt/mountpoint-state-provider/provider/pom.xml @@ -107,11 +107,6 @@ <artifactId>org.osgi.compendium</artifactId> <scope>provided</scope> </dependency> - <dependency> - <groupId>org.onap.dmaap.messagerouter.dmaapclient</groupId> - <artifactId>dmaapClient</artifactId> - <version>1.1.12</version> - </dependency> </dependencies> <build> diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointStatePublisher.java b/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointStatePublisher.java index e05b3f1ba..e430a5e24 100644 --- a/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointStatePublisher.java +++ b/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointStatePublisher.java @@ -29,6 +29,7 @@ import org.eclipse.jdt.annotation.NonNull; import org.json.JSONObject; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorCfgService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -66,8 +67,8 @@ public class MountpointStatePublisher implements Runnable { } - public String createVESMessage(JSONObject msg, VESCollectorCfgService vesCfg) { - MountpointStateVESMessageFormatter vesFormatter = new MountpointStateVESMessageFormatter(vesCfg); + public VESMessage createVESMessage(JSONObject msg, VESCollectorCfgService vesCfg) { + MountpointStateVESMessageFormatter vesFormatter = new MountpointStateVESMessageFormatter(vesCfg, vesCollectorService); return vesFormatter.createVESMessage(msg); } @@ -77,7 +78,7 @@ public class MountpointStatePublisher implements Runnable { try { if (!getStateObjects().isEmpty()) { JSONObject obj = ((LinkedList<JSONObject>) getStateObjects()).removeFirst(); - String vesMsg = createVESMessage(obj, vesCollectorService.getConfig()); + VESMessage vesMsg = createVESMessage(obj, vesCollectorService.getConfig()); this.vesCollectorService.publishVESMessage(vesMsg); } else { pauseThread(); diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointStateVESMessageFormatter.java b/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointStateVESMessageFormatter.java index 4ab1a9a85..01a8d49ff 100644 --- a/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointStateVESMessageFormatter.java +++ b/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointStateVESMessageFormatter.java @@ -22,21 +22,27 @@ package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.impl; import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; import java.time.Instant; +import org.eclipse.jdt.annotation.NonNull; import org.json.JSONObject; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorCfgService; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESCommonEventHeaderPOJO; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESMessage; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESNotificationFieldsPOJO; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MountpointStateVESMessageFormatter { private static final Logger LOG = LoggerFactory.getLogger(MountpointStateVESMessageFormatter.class); - private VESCollectorCfgService vesCfg; + private final @NonNull VESCollectorCfgService vesCfg; + private final @NonNull VESCollectorService vesCollectorService; static long sequenceNo = 0; - public MountpointStateVESMessageFormatter(VESCollectorCfgService vesCfg) { + public MountpointStateVESMessageFormatter(VESCollectorCfgService vesCfg, VESCollectorService vesCollectorService) { this.vesCfg = vesCfg; + this.vesCollectorService = vesCollectorService; } private static void incrSequenceNo() { @@ -47,26 +53,22 @@ public class MountpointStateVESMessageFormatter { return sequenceNo; } - public String createVESMessage(JSONObject obj) { + public VESMessage createVESMessage(JSONObject obj) { if (LOG.isDebugEnabled()) { LOG.debug("JSON Object to format to VES is - {0}", obj); } - String vesMsg = "{}"; + MountpointStateVESMessageFormatter.incrSequenceNo(); VESCommonEventHeaderPOJO vesCommonEventHeader = createVESCommonEventHeader(obj); VESNotificationFieldsPOJO vesNotificationFields = createVESNotificationFields(obj); - VESEvent vesEvent = new VESEvent(); - vesEvent.addEventObjects(vesCommonEventHeader); - vesEvent.addEventObjects(vesNotificationFields); - + VESMessage vesMsg = null; try { - ObjectMapper objMapper = new ObjectMapper(); - vesMsg = objMapper.writeValueAsString(vesEvent); - LOG.debug("VES message to be published - {}", vesMsg); + vesMsg = vesCollectorService.generateVESEvent(vesCommonEventHeader, vesNotificationFields); + LOG.info("VES Message is - {}", vesMsg.getMessage()); } catch (JsonProcessingException e) { - LOG.warn("Exception {} while processing JSON Message - {}", e, obj); + LOG.error("Exception while generating VES Event - ", e); } return vesMsg; diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/TestMountpointStatePublisher.java b/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/TestMountpointStatePublisher.java index 468e0c1ee..ebf4cb894 100644 --- a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/TestMountpointStatePublisher.java +++ b/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/TestMountpointStatePublisher.java @@ -34,6 +34,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServic import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorCfgService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESMessage; import org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.impl.MountpointStatePublisher; public class TestMountpointStatePublisher { @@ -41,7 +42,7 @@ public class TestMountpointStatePublisher { MountpointStatePublisher mountpointStatePublisher; VESCollectorService vesCollectorService; VESCollectorCfgService vesCfg; - String vesMsg = "{}"; + VESMessage vesMsg; JSONObject testJsonData; @Before @@ -64,7 +65,7 @@ public class TestMountpointStatePublisher { mountpointStatePublisher = new MountpointStatePublisher(vesCollectorService); mountpointStatePublisher.addToPublish(testJsonData); - //mountpointStatePublisher.getStateObjects().add(testJsonData); + mountpointStatePublisher.getStateObjects().add(testJsonData); } @Test |