aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager-onap/openroadm/provider
diff options
context:
space:
mode:
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2022-02-01 17:29:38 +0530
committerRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2022-02-01 17:29:48 +0530
commitb2dac066845d8d215f3cea53fb30a5f7ded57bc7 (patch)
tree68c8d2ffffb87354b6341be7da9fa5d9080c26e7 /sdnr/wt/devicemanager-onap/openroadm/provider
parent9912e1626d93afeb4f7148dd5d826ae1caa1ef8a (diff)
Update roadm devicemanagers
updates to logging, null checks and some refactoring Issue-ID: CCSDK-3579 Change-Id: I88bfdacaac69fe4f89b7a8c4ddae76d490ca7e32 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/devicemanager-onap/openroadm/provider')
-rw-r--r--sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/InitialDeviceAlarmReader.java5
-rw-r--r--sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmChangeNotificationListener.java29
-rw-r--r--sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java20
3 files changed, 32 insertions, 22 deletions
diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/InitialDeviceAlarmReader.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/InitialDeviceAlarmReader.java
index 6c8837327..6472e6653 100644
--- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/InitialDeviceAlarmReader.java
+++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/InitialDeviceAlarmReader.java
@@ -68,8 +68,9 @@ public class InitialDeviceAlarmReader {
// Mapping the alarm data with the fault data
protected FaultData writeFaultData() {
FaultData faultData = new FaultData();
- if (this.getActiveAlarmList(this.netConfAccesor).getActiveAlarms() != null) {
- Collection<ActiveAlarms> activeAlarms = YangHelper.getCollection(this.getActiveAlarmList(this.netConfAccesor).getActiveAlarms());
+ ActiveAlarmList actAlarmList = this.getActiveAlarmList(this.netConfAccesor);
+ if (actAlarmList != null) {
+ Collection<ActiveAlarms> activeAlarms = YangHelper.getCollection(actAlarmList.getActiveAlarms());
if (!activeAlarms.isEmpty()) {
for (ActiveAlarms activeAlarm : activeAlarms) {
faultData.add(this.netConfAccesor.getNodeId(), this.count, activeAlarm.getRaiseTime(),
diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmChangeNotificationListener.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmChangeNotificationListener.java
index 3b7f8b044..ba6d8084b 100644
--- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmChangeNotificationListener.java
+++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmChangeNotificationListener.java
@@ -49,7 +49,7 @@ import org.slf4j.LoggerFactory;
public class OpenroadmChangeNotificationListener implements IetfNetconfNotificationsListener {
// variables
- private static final Logger log = LoggerFactory.getLogger(OpenroadmChangeNotificationListener.class);
+ private static final Logger LOG = LoggerFactory.getLogger(OpenroadmChangeNotificationListener.class);
private final NetconfAccessor netconfAccessor;
private final DataProvider databaseService;
private final WebsocketManagerService notificationServiceService;
@@ -67,14 +67,14 @@ public class OpenroadmChangeNotificationListener implements IetfNetconfNotificat
// public methods
@Override
public void onNetconfConfirmedCommit(NetconfConfirmedCommit notification) {
- log.info("onNetconfConfirmedCommit {} ", notification);
+ LOG.debug("onNetconfConfirmedCommit {} ", notification);
this.notificationServiceService.sendNotification(notification, this.netconfAccessor.getNodeId(),
NetconfConfirmedCommit.QNAME, NetconfTimeStampImpl.getConverter().getTimeStamp());
}
@Override
public void onNetconfSessionStart(NetconfSessionStart notification) {
- log.info("onNetconfSessionStart {} ", notification);
+ LOG.debug("onNetconfSessionStart {} ", notification);
this.notificationServiceService.sendNotification(notification, this.netconfAccessor.getNodeId(),
NetconfSessionStart.QNAME, NetconfTimeStampImpl.getConverter().getTimeStamp());
@@ -82,44 +82,51 @@ public class OpenroadmChangeNotificationListener implements IetfNetconfNotificat
@Override
public void onNetconfSessionEnd(NetconfSessionEnd notification) {
- log.info("onNetconfSessionEnd {}", notification);
+ LOG.debug("onNetconfSessionEnd {}", notification);
this.notificationServiceService.sendNotification(notification, this.netconfAccessor.getNodeId(),
NetconfSessionEnd.QNAME, NetconfTimeStampImpl.getConverter().getTimeStamp());
}
@Override
public void onNetconfCapabilityChange(NetconfCapabilityChange notification) {
- log.info("onNetconfCapabilityChange {}", notification);
+ LOG.debug("onNetconfCapabilityChange {}", notification);
this.notificationServiceService.sendNotification(notification, this.netconfAccessor.getNodeId(),
NetconfCapabilityChange.QNAME, NetconfTimeStampImpl.getConverter().getTimeStamp());
}
@Override
public void onNetconfConfigChange(NetconfConfigChange notification) {
- log.info("onNetconfConfigChange (1) {}", notification);
+ LOG.debug("onNetconfConfigChange (1) {}", notification);
StringBuffer sb = new StringBuffer();
List<Edit> editList = notification.nonnullEdit();
for (Edit edit : editList) {
+ if(edit==null) { //should never happen
+ LOG.warn("null object in config change");
+ continue;
+ }
if (sb.length() > 0) {
sb.append(", ");
}
- sb.append(edit);
-
+ try {
+ sb.append(edit);
+ } catch (Exception e) { //catch odl error
+ LOG.warn("unable to serialize edit obj", e);
+ }
EventlogBuilder eventlogBuilder = new EventlogBuilder();
InstanceIdentifier<?> target = edit.getTarget();
if (target != null) {
eventlogBuilder.setObjectId(target.toString());
- log.info("TARGET: {} {}", target.getClass(), target.getTargetType());
+ LOG.debug("TARGET: {} {}", target.getClass(), target.getTargetType());
for (PathArgument pa : target.getPathArguments()) {
- log.info("PathArgument {}", pa);
+ LOG.debug("PathArgument {}", pa);
}
}
eventlogBuilder.setNodeId(netconfAccessor.getNodeId().getValue());
eventlogBuilder.setNewValue(String.valueOf(edit.getOperation()));
databaseService.writeEventLog(eventlogBuilder.build());
}
- log.info("onNetconfConfigChange (2) {}", sb);
+ LOG.debug("onNetconfConfigChange (2) {}", sb);
this.notificationServiceService.sendNotification(notification, this.netconfAccessor.getNodeId(),
NetconfConfigChange.QNAME, NetconfTimeStampImpl.getConverter().getTimeStamp());
diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java
index 45490a8b7..996ff69e7 100644
--- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java
+++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java
@@ -108,15 +108,17 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase {
public void initialReadFromNetworkElement() {
OrgOpenroadmDevice device = readDevice(this.netconfAccessor);
- this.opnRdmInventoryInput = new OpenroadmInventoryInput(this.netconfAccessor, device);
- log.info("openroadmMapper details{}", this.opnRdmInventoryInput.getClass().getName());
- List<Inventory> inventoryList = new ArrayList<>();
- inventoryList.add(this.opnRdmInventoryInput.getInventoryData(Uint32.valueOf(equipmentLevel)));
- readShelvesData(inventoryList, device);
- readXpndrData(inventoryList, device);
- readCircuitPacketData(inventoryList, device);
- readInterfaceData(inventoryList, device);
- this.databaseService.writeInventory(this.netconfAccessor.getNodeId().getValue(), inventoryList);
+ if (device != null) {
+ this.opnRdmInventoryInput = new OpenroadmInventoryInput(this.netconfAccessor, device);
+ log.info("openroadmMapper details{}", this.opnRdmInventoryInput.getClass().getName());
+ List<Inventory> inventoryList = new ArrayList<>();
+ inventoryList.add(this.opnRdmInventoryInput.getInventoryData(Uint32.valueOf(equipmentLevel)));
+ readShelvesData(inventoryList, device);
+ readXpndrData(inventoryList, device);
+ readCircuitPacketData(inventoryList, device);
+ readInterfaceData(inventoryList, device);
+ this.databaseService.writeInventory(this.netconfAccessor.getNodeId().getValue(), inventoryList);
+ }
// Writing initial alarms at the time of device registration
initialAlarmReader.faultService();
// Writing historical PM data at the time of device registration