summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh
diff options
context:
space:
mode:
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2024-01-18 18:55:18 +0530
committerRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2024-03-27 04:02:33 +0000
commitc2e89eb5cd0e9a42403a45623e97a92a09c757d7 (patch)
treec2475afcde3bc3113f7c63903b7336986e2920d5 /sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh
parent762f33ff221125ad5ecf8d750e06df81e5662865 (diff)
Align initial alarms and notifications parsing
Refactor as part of the aligning of the alarms Issue-ID: CCSDK-3984 Change-Id: I9d7de249b4773240a50f09311fcf6d7db8bf4006 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> (cherry picked from commit 3d368255a787995fc14e8c89529d367e665e54f3)
Diffstat (limited to 'sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh')
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/dataprovider/ORanDOMToInternalDataModel.java65
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMNetworkElement.java9
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMFaultNotificationListener.java20
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/util/ORanDMDOMUtility.java15
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/vesmapper/ORanDOMFaultToVESFaultMapper.java16
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/vesmapper/ORanDOMSupervisionNotifToVESMapper.java4
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMToInternalDataModel.java4
7 files changed, 56 insertions, 77 deletions
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/dataprovider/ORanDOMToInternalDataModel.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/dataprovider/ORanDOMToInternalDataModel.java
index 4db249790..958e3bf72 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/dataprovider/ORanDOMToInternalDataModel.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/dataprovider/ORanDOMToInternalDataModel.java
@@ -21,27 +21,20 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.dataprovider;
-import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDMDOMUtility;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDeviceManagerQNames;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.yangspecs.ORANFM;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.yangspecs.OnapSystem;
-import org.opendaylight.mdsal.dom.api.DOMEvent;
import org.opendaylight.mdsal.dom.api.DOMNotification;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogEntity;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Guicutthrough;
@@ -66,14 +59,13 @@ import org.slf4j.LoggerFactory;
public class ORanDOMToInternalDataModel {
private static final Logger LOG = LoggerFactory.getLogger(ORanDOMToInternalDataModel.class);
- private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStampImpl.getConverter();
public static List<Inventory> getInventoryList(NodeId nodeId, NormalizedNode hwData) {
List<Inventory> inventoryResultList = new ArrayList<Inventory>();
ContainerNode hwContainer = (ContainerNode) hwData;
- MapNode componentMap = (MapNode) hwContainer
- .getChildByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_HW_COMPONENT_LIST));
+ MapNode componentMap =
+ (MapNode) hwContainer.getChildByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_HW_COMPONENT_LIST));
Collection<MapEntryNode> componentMapEntries = componentMap.body();
for (MapEntryNode componentMapEntryNode : getRootComponents(componentMapEntries)) {
@@ -203,7 +195,8 @@ public class ORanDOMToInternalDataModel {
* @param sys
* @return
*/
- public static Optional<Guicutthrough> getGuicutthrough(@Nullable AugmentationNode onapSysAugData, @NonNull OnapSystem onapSys) {
+ public static Optional<Guicutthrough> getGuicutthrough(@Nullable AugmentationNode onapSysAugData,
+ @NonNull OnapSystem onapSys) {
if (onapSysAugData != null) {
String name = ORanDMDOMUtility.getLeafValue(onapSysAugData, onapSys.getName());
@@ -232,14 +225,13 @@ public class ORanDOMToInternalDataModel {
* @param counter to be integrated into data
* @return FaultlogEntity with data
*/
- public static FaultlogEntity getFaultLog(DOMNotification notification, @NonNull ORANFM oranfm, NodeId nodeId, Integer counter) {
+ public static FaultlogEntity getFaultLog(DOMNotification notification, @NonNull ORANFM oranfm, NodeId nodeId) {
ContainerNode cn = notification.getBody();
FaultlogBuilder faultAlarm = new FaultlogBuilder();
faultAlarm.setNodeId(nodeId.getValue());
faultAlarm.setObjectId(ORanDMDOMUtility.getLeafValue(cn, oranfm.getFaultSourceQName()));
faultAlarm.setProblem(ORanDMDOMUtility.getLeafValue(cn, oranfm.getFaultTextQName()));
- faultAlarm.setSeverity(getSeverityType(
- ORanDMDOMUtility.getLeafValue(cn, oranfm.getFaultSeverityQName()),
+ faultAlarm.setSeverity(getSeverityType(ORanDMDOMUtility.getLeafValue(cn, oranfm.getFaultSeverityQName()),
ORanDMDOMUtility.getLeafValue(cn, oranfm.getFaultIsClearedQName()).equals("true")));
faultAlarm.setCounter(Integer.parseInt(ORanDMDOMUtility.getLeafValue(cn, oranfm.getFaultIdQName())));
faultAlarm.setId(ORanDMDOMUtility.getLeafValue(cn, oranfm.getFaultIdQName()));
@@ -250,13 +242,11 @@ public class ORanDOMToInternalDataModel {
return faultAlarm.build();
}
- public static FaultlogEntity getFaultLog(UnkeyedListEntryNode activeAlarmEntry, ORANFM oranfm, NodeId nodeId, Integer counter) {
+ public static FaultlogEntity getFaultLog(UnkeyedListEntryNode activeAlarmEntry, ORANFM oranfm, NodeId nodeId) {
FaultlogBuilder faultAlarm = new FaultlogBuilder();
faultAlarm.setNodeId(nodeId.getValue());
- faultAlarm.setObjectId(getObjectId(
- ORanDMDOMUtility.getLeafValue(activeAlarmEntry, oranfm.getFaultSourceQName())));
- faultAlarm.setProblem(
- ORanDMDOMUtility.getLeafValue(activeAlarmEntry, oranfm.getFaultTextQName()));
+ faultAlarm.setObjectId(ORanDMDOMUtility.getLeafValue(activeAlarmEntry, oranfm.getFaultSourceQName()));
+ faultAlarm.setProblem(ORanDMDOMUtility.getLeafValue(activeAlarmEntry, oranfm.getFaultTextQName()));
faultAlarm.setSeverity(getSeverityType(
ORanDMDOMUtility.getLeafValue(activeAlarmEntry, oranfm.getFaultSeverityQName()),
ORanDMDOMUtility.getLeafValue(activeAlarmEntry, oranfm.getFaultIsClearedQName()).equals("true")));
@@ -264,32 +254,9 @@ public class ORanDOMToInternalDataModel {
Integer.parseInt(ORanDMDOMUtility.getLeafValue(activeAlarmEntry, oranfm.getFaultIdQName())));
faultAlarm.setId(ORanDMDOMUtility.getLeafValue(activeAlarmEntry, oranfm.getFaultIdQName()));
faultAlarm.setSourceType(SourceType.Netconf);
- faultAlarm.setTimestamp(NetconfTimeStampImpl.getConverter().getTimeStamp(
- ORanDMDOMUtility.getLeafValue(activeAlarmEntry, oranfm.getFaultEventTimeQName())));
+ faultAlarm.setTimestamp(NetconfTimeStampImpl.getConverter()
+ .getTimeStamp(ORanDMDOMUtility.getLeafValue(activeAlarmEntry, oranfm.getFaultEventTimeQName())));
return faultAlarm.build();
-
- }
-
- /**
- * Convert Instant to NETCONF DateAndTime
- * @param eventTimeInstant
- * @return DateAndTime
- */
- public static DateAndTime getDateAndTimeOfInstant(Instant eventTimeInstant) {
- Date eventDate = Date.from(eventTimeInstant);
- return new DateAndTime(NETCONFTIME_CONVERTER.getTimeStamp(eventDate));
- }
-
- private static DateAndTime getEventTime(DOMNotification notification) {
- DateAndTime eventTime;
- Instant notificationEventTime = null;
- if (notification instanceof DOMEvent) {
- notificationEventTime = ((DOMEvent) notification).getEventInstant();
- eventTime = NetconfTimeStampImpl.getConverter().getTimeStamp(notificationEventTime.toString());
- } else {
- eventTime = NetconfTimeStampImpl.getConverter().getTimeStamp();
- }
- return eventTime;
}
/**
@@ -321,14 +288,4 @@ public class ORanDOMToInternalDataModel {
+ " faultSeverity=" + faultSeverity);
}
- private static String getObjectId(String leafValue) {
- // fault-source = /ietf-hardware:hardware/component[name='slot0-logical0']
- Pattern p = Pattern.compile("\\/ietf-hardware:hardware\\/component\\[name=\\'(.*)\\']");
- Matcher m = p.matcher(leafValue);
- if (m.find()) {
- return m.group(1);
- }
- return leafValue;
- }
-
}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMNetworkElement.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMNetworkElement.java
index 72cda1679..50f1411d0 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMNetworkElement.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMNetworkElement.java
@@ -197,6 +197,7 @@ public class ORanDOMNetworkElement implements NetworkElement, IConfigChangedList
* this.oRanFaultListenerRegistrationResult.close(); } ;
*/
databaseService.clearGuiCutThroughEntriesOfNode(getMountpointId());
+ faultService.removeAllCurrentProblemsOfNode(getNodeId());
}
@Override
@@ -215,7 +216,9 @@ public class ORanDOMNetworkElement implements NetworkElement, IConfigChangedList
}
@Override
- public void warmstart() {}
+ public void warmstart() {
+ faultService.removeAllCurrentProblemsOfNode(getNodeId());
+ }
@Override
public Optional<NetconfAccessor> getAcessor() {
@@ -307,12 +310,10 @@ public class ORanDOMNetworkElement implements NetworkElement, IConfigChangedList
ContainerNode cn = (ContainerNode) oData.get();
UnkeyedListNode activeAlarmsList =
(UnkeyedListNode) cn.childByArg(new NodeIdentifier(oranfm.get().getFaultActiveAlarmsQName()));
- int counter = 0;
for (UnkeyedListEntryNode activeAlarmEntry : activeAlarmsList.body())
faultService.faultNotification(ORanDOMToInternalDataModel.getFaultLog(activeAlarmEntry, oranfm.get(),
- netconfDomAccessor.getNodeId(), Integer.valueOf(counter++)));
+ netconfDomAccessor.getNodeId()));
}
-
}
@Override
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMFaultNotificationListener.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMFaultNotificationListener.java
index 3e99bcd6d..a6329d58e 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMFaultNotificationListener.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMFaultNotificationListener.java
@@ -63,7 +63,7 @@ public class ORanDOMFaultNotificationListener implements DOMNotificationListener
private final @NonNull DataProvider databaseService;
private final @NonNull ORANFM oranfm;
- private Integer counter; //Local counter is assigned to Notifications
+ private Integer counter; //Local counter is assigned to Events in EventLog
public ORanDOMFaultNotificationListener(@NonNull NetconfDomAccessor netconfDomAccessor, Optional<ORANFM> oranfm,
@NonNull VESCollectorService vesCollectorService, @NonNull FaultService faultService,
@@ -74,8 +74,8 @@ public class ORanDOMFaultNotificationListener implements DOMNotificationListener
this.websocketManagerService = Objects.requireNonNull(websocketManagerService);
this.databaseService = Objects.requireNonNull(databaseService);
this.oranfm = oranfm.get();
- this.mapper =
- new ORanDOMFaultToVESFaultMapper(netconfDomAccessor.getNodeId(), vesCollectorService, "AlarmNotif");
+ this.mapper = new ORanDOMFaultToVESFaultMapper(netconfDomAccessor.getNodeId(), this.vesCollectorService,
+ this.oranfm, "AlarmNotif");
this.counter = 0;
}
@@ -112,18 +112,20 @@ public class ORanDOMFaultNotificationListener implements DOMNotificationListener
// Send devicemanager specific notification for database and ODLUX
Instant eventTimeInstant = ORanDMDOMUtility.getNotificationInstant(notification);
faultService.faultNotification(
- ORanDOMToInternalDataModel.getFaultLog(notification, oranfm, netconfDomAccessor.getNodeId(), counter));
+ ORanDOMToInternalDataModel.getFaultLog(notification, oranfm, netconfDomAccessor.getNodeId()));
// Send model specific notification to WebSocketManager
- websocketManagerService.sendNotification(notification, netconfDomAccessor.getNodeId(), oranfm.getAlarmNotifQName());
+ websocketManagerService.sendNotification(notification, netconfDomAccessor.getNodeId(),
+ oranfm.getAlarmNotifQName());
try {
if (vesCollectorService.getConfig().isVESCollectorEnabled()) {
- VESCommonEventHeaderPOJO header = mapper.mapCommonEventHeader(notification, eventTimeInstant, counter);
- VESFaultFieldsPOJO body = mapper.mapFaultFields(notification, oranfm);
+ VESCommonEventHeaderPOJO header = mapper.mapCommonEventHeader(notification, eventTimeInstant);
+ VESFaultFieldsPOJO body = mapper.mapFaultFields(notification);
VESMessage vesMsg = vesCollectorService.generateVESEvent(header, body);
vesCollectorService.publishVESMessage(vesMsg);
LOG.debug("VES Message is {}", vesMsg.getMessage());
- writeToEventLog(vesMsg.getMessage(), eventTimeInstant, oranfm.getAlarmNotifQName().getLocalName(), counter);
+ writeToEventLog(vesMsg.getMessage(), eventTimeInstant, oranfm.getAlarmNotifQName().getLocalName(),
+ counter);
}
} catch (JsonProcessingException | DateTimeParseException e) {
LOG.debug("Can not convert event into VES message {}", notification, e);
@@ -149,7 +151,7 @@ public class ORanDOMFaultNotificationListener implements DOMNotificationListener
}
eventlogBuilder.setNewValue(data);
eventlogBuilder.setSourceType(SourceType.Netconf);
- eventlogBuilder.setTimestamp(ORanDOMToInternalDataModel.getDateAndTimeOfInstant(eventTimeInstant));
+ eventlogBuilder.setTimestamp(ORanDMDOMUtility.getDateAndTimeOfInstant(eventTimeInstant));
databaseService.writeEventLog(eventlogBuilder.build());
}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/util/ORanDMDOMUtility.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/util/ORanDMDOMUtility.java
index 708ba8a47..a13ffaa9d 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/util/ORanDMDOMUtility.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/util/ORanDMDOMUtility.java
@@ -24,11 +24,15 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util;
import com.google.common.base.VerifyException;
import java.time.Instant;
import java.util.Collection;
+import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl;
import org.opendaylight.mdsal.dom.api.DOMEvent;
import org.opendaylight.mdsal.dom.api.DOMNotification;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
@@ -42,6 +46,7 @@ import org.slf4j.LoggerFactory;
public class ORanDMDOMUtility {
public static final Logger LOG = LoggerFactory.getLogger(ORanDMDOMUtility.class);
+ private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStampImpl.getConverter();
public static String getKeyValue(MapEntryNode componentEntry) {
NodeIdentifierWithPredicates componentKey = componentEntry.getIdentifier(); // list key
@@ -86,4 +91,14 @@ public class ORanDMDOMUtility {
}
}
+ /**
+ * Convert Instant to NETCONF DateAndTime
+ * @param eventTimeInstant
+ * @return DateAndTime
+ */
+ public static DateAndTime getDateAndTimeOfInstant(Instant eventTimeInstant) {
+ Date eventDate = Date.from(eventTimeInstant);
+ return new DateAndTime(NETCONFTIME_CONVERTER.getTimeStamp(eventDate));
+ }
+
}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/vesmapper/ORanDOMFaultToVESFaultMapper.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/vesmapper/ORanDOMFaultToVESFaultMapper.java
index fabe26463..7c01ba252 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/vesmapper/ORanDOMFaultToVESFaultMapper.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/vesmapper/ORanDOMFaultToVESFaultMapper.java
@@ -85,15 +85,18 @@ public class ORanDOMFaultToVESFaultMapper {
private final VESCollectorService vesProvider;
private final String notifName; // Name
+ private final ORANFM oranfm;
private final String nodeIdString; // Sourcename
//Initialized during registration
private String mfgName;
private String uuid;
private String modelName;
- public ORanDOMFaultToVESFaultMapper(NodeId nodeId, VESCollectorService vesCollectorService, String notifName) {
+ public ORanDOMFaultToVESFaultMapper(NodeId nodeId, VESCollectorService vesCollectorService, ORANFM oranfm,
+ String notifName) {
this.nodeIdString = nodeId.getValue();
this.vesProvider = vesCollectorService;
+ this.oranfm = oranfm;
this.notifName = notifName;
}
@@ -109,29 +112,30 @@ public class ORanDOMFaultToVESFaultMapper {
this.modelName = modelName;
}
- public VESCommonEventHeaderPOJO mapCommonEventHeader(DOMNotification notification, Instant eventTime,
- int sequenceNo) {
+ public VESCommonEventHeaderPOJO mapCommonEventHeader(DOMNotification notification, Instant eventTime) {
VESCommonEventHeaderPOJO vesCEH = new VESCommonEventHeaderPOJO();
+ ContainerNode cn = notification.getBody();
vesCEH.setDomain(VES_EVENT_DOMAIN);
vesCEH.setEventName(notifName);
vesCEH.setEventType(VES_EVENTTYPE);
vesCEH.setPriority(VES_EVENT_PRIORITY);
- String eventId = notifName + "-" + Long.toUnsignedString(sequenceNo);
+ String eventId =
+ notifName + "-" + Integer.parseInt(ORanDMDOMUtility.getLeafValue(cn, oranfm.getFaultIdQName()));
vesCEH.setEventId(eventId);
vesCEH.setStartEpochMicrosec(eventTime.toEpochMilli() * 1000);
vesCEH.setLastEpochMicrosec(eventTime.toEpochMilli() * 1000);
vesCEH.setNfVendorName(mfgName);
vesCEH.setReportingEntityName(vesProvider.getConfig().getReportingEntityName());
- vesCEH.setSequence(sequenceNo);
+ vesCEH.setSequence(Integer.parseInt(ORanDMDOMUtility.getLeafValue(cn, oranfm.getFaultIdQName())));
vesCEH.setSourceId(uuid);
vesCEH.setSourceName(nodeIdString);
return vesCEH;
}
- public VESFaultFieldsPOJO mapFaultFields(DOMNotification alarmNotif, ORANFM oranfm) {
+ public VESFaultFieldsPOJO mapFaultFields(DOMNotification alarmNotif) {
VESFaultFieldsPOJO vesFaultFields = new VESFaultFieldsPOJO();
ContainerNode cn = alarmNotif.getBody();
vesFaultFields.setAlarmCondition(ORanDMDOMUtility.getLeafValue(cn, oranfm.getFaultIdQName()));
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/vesmapper/ORanDOMSupervisionNotifToVESMapper.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/vesmapper/ORanDOMSupervisionNotifToVESMapper.java
index b87b93d80..f58351a6b 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/vesmapper/ORanDOMSupervisionNotifToVESMapper.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/vesmapper/ORanDOMSupervisionNotifToVESMapper.java
@@ -23,7 +23,7 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.vesmapper;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.Instant;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.dataprovider.ORanDOMToInternalDataModel;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDMDOMUtility;
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.VESStndDefinedFieldsPOJO;
@@ -138,7 +138,7 @@ public class ORanDOMSupervisionNotifToVESMapper {
IetfNotification ietfNotif = new IetfNotification();
ietfNotif.setOranSupervisionNotif(oruSuperNotif);
- ietfNotif.setEventTime(ORanDOMToInternalDataModel.getDateAndTimeOfInstant(eventTimeInstant).getValue());
+ ietfNotif.setEventTime(ORanDMDOMUtility.getDateAndTimeOfInstant(eventTimeInstant).getValue());
DataObject data = new DataObject();
data.setIetfNotification(ietfNotif);
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMToInternalDataModel.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMToInternalDataModel.java
index eb4a7fa79..b86177cdb 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMToInternalDataModel.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMToInternalDataModel.java
@@ -183,7 +183,7 @@ public class TestORanDOMToInternalDataModel {
public void testORANFault() {
ContainerNode cn = createORANDOMFault();
NetconfDeviceNotification faultNotif = new NetconfDeviceNotification(cn, Instant.now());
- FaultlogEntity fle = ORanDOMToInternalDataModel.getFaultLog(faultNotif, oranfm.get(), nodeId, 1);
+ FaultlogEntity fle = ORanDOMToInternalDataModel.getFaultLog(faultNotif, oranfm.get(), nodeId);
assertEquals(fle.getId(), "47");
}
@@ -207,7 +207,7 @@ public class TestORanDOMToInternalDataModel {
UnkeyedListNode activeAlarmsList =
(UnkeyedListNode) cn.childByArg(new NodeIdentifier(oranfm.get().getFaultActiveAlarmsQName()));
for (UnkeyedListEntryNode activeAlarmEntry : activeAlarmsList.body())
- ORanDOMToInternalDataModel.getFaultLog(activeAlarmEntry, oranfm.get(), new NodeId("nSky"), Integer.valueOf(0));
+ ORanDOMToInternalDataModel.getFaultLog(activeAlarmEntry, oranfm.get(), new NodeId("nSky"));
}
public static ContainerNode createORANDOMFault() {