summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/mountpoint-state-provider/provider/src/main
diff options
context:
space:
mode:
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2021-03-29 09:04:05 +0200
committerRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2021-03-29 09:04:33 +0200
commit9fb395380431345b7da7a765651185815a9ac91d (patch)
treee9915a557d158c3f446c5dcd108afba9e307633a /sdnr/wt/mountpoint-state-provider/provider/src/main
parent38c3dd74dc9c43a6606680cc6df82062cd7cbd81 (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/provider/src/main')
-rw-r--r--sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointStatePublisher.java7
-rw-r--r--sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointStateVESMessageFormatter.java28
2 files changed, 19 insertions, 16 deletions
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;