summaryrefslogtreecommitdiffstats
path: root/sdnr/wt
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt')
-rw-r--r--sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/InitialDeviceAlarmReader.java40
-rw-r--r--sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmChangeNotificationListener.java39
-rw-r--r--sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmDeviceChangeNotificationListener.java5
-rw-r--r--sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmFaultNotificationListener.java58
-rw-r--r--sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmInventoryInput.java5
-rw-r--r--sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java46
-rw-r--r--sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElementBase.java9
-rw-r--r--sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/PmDataBuilderOpenRoadm.java167
-rw-r--r--sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestChangeNotificationListener.java10
-rw-r--r--sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestDeviceManagerOpenRoadmImpl.java8
-rw-r--r--sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmAlarmNotification.java25
-rw-r--r--sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmDeviceChangeNotification.java106
-rw-r--r--sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmInventory.java17
-rw-r--r--sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElement.java612
-rw-r--r--sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElementFactory.java6
-rw-r--r--sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmPMDataBuilder.java161
-rw-r--r--sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenroadmNetworkElementBase.java62
17 files changed, 800 insertions, 576 deletions
diff --git a/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/InitialDeviceAlarmReader.java b/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/InitialDeviceAlarmReader.java
index ccada31bc..6c8837327 100644
--- a/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/InitialDeviceAlarmReader.java
+++ b/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/InitialDeviceAlarmReader.java
@@ -32,7 +32,6 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.ActiveAlarmList;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.OrgOpenroadmAlarmListener;
import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.Severity;
import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.active.alarm.list.ActiveAlarms;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Faultlog;
@@ -51,7 +50,7 @@ import org.slf4j.LoggerFactory;
public class InitialDeviceAlarmReader {
// variables
private Integer count = 1;
- private static final Logger log = LoggerFactory.getLogger(OrgOpenroadmAlarmListener.class);
+ private static final Logger log = LoggerFactory.getLogger(InitialDeviceAlarmReader.class);
private final NetconfBindingAccessor netConfAccesor;
private final @NonNull FaultService faultEventListener;
private final DataProvider dataProvider;
@@ -100,25 +99,8 @@ public class InitialDeviceAlarmReader {
this.faultEventListener.initCurrentProblemStatus(this.netConfAccesor.getNodeId(), writeFaultData());
writeAlarmLog(writeFaultData());
}
- // end of protected methods
-
- // private methods
-
- // Read Alarm Data
- private ActiveAlarmList getActiveAlarmList(NetconfBindingAccessor accessor) {
- final Class<ActiveAlarmList> classAlarm = ActiveAlarmList.class;
- log.info("Get Alarm data for element {}", accessor.getNodeId().getValue());
- InstanceIdentifier<ActiveAlarmList> alarmDataIid = InstanceIdentifier.builder(classAlarm).build();
-
- ActiveAlarmList alarmData = accessor.getTransactionUtils().readData(accessor.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, alarmDataIid);
-
- log.info("AlarmData {}", alarmData.toString());
- return alarmData;
- }
-
// Mapping Severity of AlarmNotification to SeverityType of FaultLog
- private SeverityType checkSeverityValue(Severity severity) {
+ protected static SeverityType checkSeverityValue(Severity severity) {
SeverityType severityType = null;
log.info("Device Severity: {}", severity.getName());
@@ -149,6 +131,24 @@ public class InitialDeviceAlarmReader {
return severityType;
}
+ // end of protected methods
+
+ // private methods
+
+ // Read Alarm Data
+ private ActiveAlarmList getActiveAlarmList(NetconfBindingAccessor accessor) {
+ final Class<ActiveAlarmList> classAlarm = ActiveAlarmList.class;
+ log.info("Get Alarm data for element {}", accessor.getNodeId().getValue());
+ InstanceIdentifier<ActiveAlarmList> alarmDataIid = InstanceIdentifier.builder(classAlarm).build();
+
+ ActiveAlarmList alarmData = accessor.getTransactionUtils().readData(accessor.getDataBroker(),
+ LogicalDatastoreType.OPERATIONAL, alarmDataIid);
+
+ log.info("AlarmData {}", alarmData);
+ return alarmData;
+ }
+
+
// end of private methods
diff --git a/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmChangeNotificationListener.java b/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmChangeNotificationListener.java
index 539fd4847..a138dfbd8 100644
--- a/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmChangeNotificationListener.java
+++ b/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmChangeNotificationListener.java
@@ -22,10 +22,8 @@
package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl;
import java.util.List;
-import org.eclipse.jdt.annotation.NonNull;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.ChangeNotification;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.IetfNetconfNotificationsListener;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfCapabilityChange;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfConfigChange;
@@ -64,22 +62,22 @@ public class OpenroadmChangeNotificationListener implements IetfNetconfNotificat
// public methods
@Override
public void onNetconfConfirmedCommit(NetconfConfirmedCommit notification) {
- log.info("onNetconfConfirmedCommit ", notification);
+ log.info("onNetconfConfirmedCommit {} ", notification);
}
@Override
public void onNetconfSessionStart(NetconfSessionStart notification) {
- log.info("onNetconfSessionStart ", notification);
+ log.info("onNetconfSessionStart {} ", notification);
}
@Override
public void onNetconfSessionEnd(NetconfSessionEnd notification) {
- log.info("onNetconfSessionEnd ", notification);
+ log.info("onNetconfSessionEnd {}", notification);
}
@Override
public void onNetconfCapabilityChange(NetconfCapabilityChange notification) {
- log.info("onNetconfCapabilityChange ", notification);
+ log.info("onNetconfCapabilityChange {}", notification);
}
@Override
@@ -110,35 +108,6 @@ public class OpenroadmChangeNotificationListener implements IetfNetconfNotificat
log.info("onNetconfConfigChange (2) {}", sb);
}
- public void onDeviceConfigChange(ChangeNotification notification) {
- log.info("onDeviceConfigChange(1){}", notification);
- StringBuffer sb = new StringBuffer();
- @NonNull
- List<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.change.notification.Edit> editList =
- notification.nonnullEdit();
- for (org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.change.notification.Edit edit : editList) {
- if (sb.length() > 0) {
- sb.append(", ");
- }
- sb.append(edit);
-
- EventlogBuilder eventlogBuilder = new EventlogBuilder();
-
- InstanceIdentifier<?> target = edit.getTarget();
- if (target != null) {
- eventlogBuilder.setObjectId(target.toString());
- log.info("TARGET: {} {}", target.getClass(), target.getTargetType());
- for (PathArgument pa : target.getPathArguments()) {
- log.info("PathArgument {}", pa);
- }
- }
- eventlogBuilder.setNodeId(netconfAccessor.getNodeId().getValue());
- eventlogBuilder.setNewValue(String.valueOf(edit.getOperation()));
- databaseService.writeEventLog(eventlogBuilder.build());
-
- }
- log.info("onDeviceConfigChange (2) {}", sb);
- }
// end of public methods
}
diff --git a/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmDeviceChangeNotificationListener.java b/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmDeviceChangeNotificationListener.java
index a79bed706..44c8b8d6d 100644
--- a/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmDeviceChangeNotificationListener.java
+++ b/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmDeviceChangeNotificationListener.java
@@ -27,7 +27,6 @@ import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
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.netconfnodestateservice.NetconfAccessor;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.OrgOpenroadmAlarmListener;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.ChangeNotification;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.CreateTechInfoNotification;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.OrgOpenroadmDeviceListener;
@@ -49,7 +48,7 @@ import org.slf4j.LoggerFactory;
public class OpenroadmDeviceChangeNotificationListener implements OrgOpenroadmDeviceListener {
// variables
- private static final Logger log = LoggerFactory.getLogger(OrgOpenroadmAlarmListener.class);
+ private static final Logger log = LoggerFactory.getLogger(OpenroadmDeviceChangeNotificationListener.class);
private Integer counter = 1;
private final NetconfAccessor netconfAccessor;
private final DataProvider databaseProvider;
@@ -105,7 +104,7 @@ public class OpenroadmDeviceChangeNotificationListener implements OrgOpenroadmDe
@Override
public void onCreateTechInfoNotification(CreateTechInfoNotification notification) {
- // TODO Auto-generated method stub
+
log.info("onCreateTechInfoNotification(1){}", notification);
EventlogBuilder eventlogBuilder = new EventlogBuilder();
eventlogBuilder.setId(notification.getShelfId()).setAttributeName(notification.getShelfId())
diff --git a/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmFaultNotificationListener.java b/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmFaultNotificationListener.java
index f3ff9f9bd..6c3ebd60a 100644
--- a/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmFaultNotificationListener.java
+++ b/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmFaultNotificationListener.java
@@ -23,16 +23,12 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl;
import org.eclipse.jdt.annotation.NonNull;
-//import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.AlarmNotification;
import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.OrgOpenroadmAlarmListener;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.Severity;
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.SeverityType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,69 +38,37 @@ import org.slf4j.LoggerFactory;
* Listener for Open roadm device specific alarm notifications
**/
public class OpenroadmFaultNotificationListener implements OrgOpenroadmAlarmListener {
- private static final Logger log = LoggerFactory.getLogger(OrgOpenroadmAlarmListener.class);
- //private final NetconfAccessor accesor;
- //private final DataProvider databaseProvider;
+ private static final Logger log = LoggerFactory.getLogger(OpenroadmFaultNotificationListener.class);
+ // variables
private final @NonNull FaultService faultEventListener;
private Integer count = 1;
-
- public OpenroadmFaultNotificationListener(NetconfAccessor netConfAccessor,
- DeviceManagerServiceProvider serviceProvider) {
- //this.databaseProvider = serviceProvider.getDataProvider();
- //this.accesor = netConfAccessor;
+ // end of variables
+ // constructors
+ public OpenroadmFaultNotificationListener(DeviceManagerServiceProvider serviceProvider) {
this.faultEventListener = serviceProvider.getFaultService();
}
-
+ // end of constructors
+ // public methods
@Override
public void onAlarmNotification(AlarmNotification notification) {
+
log.info("AlarmNotification {} \t {}", notification.getId(), notification.getAdditionalDetail());
FaultlogEntity faultAlarm = new FaultlogBuilder().setObjectId(notification.getCircuitId())
.setProblem(notification.getProbableCause().getCause().getName())
.setTimestamp(notification.getRaiseTime()).setId(notification.getId())
.setNodeId(notification.getResource().getDevice().getNodeId().getValue())
- .setSeverity(checkSeverityValue(notification.getSeverity())).setCounter(count).build();
+ .setSeverity(InitialDeviceAlarmReader.checkSeverityValue(notification.getSeverity())).setCounter(count)
+ .build();
- //this.databaseProvider.writeFaultLog(faultAlarm);
this.faultEventListener.faultNotification(faultAlarm);
count++;
log.info("Notification is written into the database {}", faultAlarm.getObjectId());
}
-
- // Mapping Severity of AlarmNotification to SeverityType of FaultLog
- private SeverityType checkSeverityValue(Severity severity) {
- SeverityType severityType = null;
- log.info("Device Severity: {}", severity.getName());
-
- switch (severity.getName()) {
- case ("warning"):
- severityType = SeverityType.Warning;
- break;
- case ("major"):
- severityType = SeverityType.Major;
- break;
- case ("minor"):
- severityType = SeverityType.Minor;
- break;
- case ("clear"):
- severityType = SeverityType.NonAlarmed;
- break;
- case ("critical"):
- severityType = SeverityType.Critical;
- break;
- case ("indeterminate"):
- severityType = SeverityType.Critical;
- break;
- default:
- severityType = SeverityType.Critical;
- break;
- }
- return severityType;
-
- }
+ // end of public methods
}
diff --git a/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmInventoryInput.java b/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmInventoryInput.java
index 9618ce2af..abaec72ab 100644
--- a/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmInventoryInput.java
+++ b/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmInventoryInput.java
@@ -47,8 +47,8 @@ public class OpenroadmInventoryInput {
// end of variables
// constructors
- public OpenroadmInventoryInput(NetconfAccessor netconfAccessor, OrgOpenroadmDevice readDevice) {
- this.openRoadmDevice = readDevice;
+ public OpenroadmInventoryInput(NetconfAccessor netconfAccessor, OrgOpenroadmDevice roadmDevice) {
+ this.openRoadmDevice = roadmDevice;
this.accessor = netconfAccessor;
}
// end of constructors
@@ -56,6 +56,7 @@ public class OpenroadmInventoryInput {
// public methods
public Inventory getInventoryData(Uint32 treeLevel) {
InventoryBuilder inventoryBuilder = new InventoryBuilder();
+ log.info("Info for device {}", this.openRoadmDevice.getInfo().getNodeId().getValue());
inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue())
.setUuid(this.openRoadmDevice.getInfo().getNodeId() == null ? "N/A"
: this.openRoadmDevice.getInfo().getNodeId().getValue())
diff --git a/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java b/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java
index 7b45c3e42..bf57a3cf7 100644
--- a/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java
+++ b/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java
@@ -26,7 +26,6 @@ import java.util.Collection;
import java.util.Hashtable;
import java.util.List;
import java.util.Optional;
-
import org.eclipse.jdt.annotation.NonNull;
import org.onap.ccsdk.features.sdnr.wt.common.YangHelper;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp;
@@ -77,7 +76,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase {
private OpenroadmInventoryInput opnRdmInventoryInput;
private PmDataBuilderOpenRoadm openRoadmPmData;
private InitialDeviceAlarmReader initialAlarmReader;
- private List<PmdataEntity> pmDataEntity = new ArrayList<PmdataEntity>();
+
private Optional<NetconfNotifications> notifications;
private static final NetconfTimeStamp ncTimeConverter = NetconfTimeStampImpl.getConverter();
private int counter = 1;
@@ -87,18 +86,18 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase {
public OpenroadmNetworkElement(NetconfBindingAccessor netconfAccess, DeviceManagerServiceProvider serviceProvider) {
super(netconfAccess, serviceProvider);
-
+
this.notifications = netconfAccess.getNotificationAccessor();
log.info("Create {}", OpenroadmNetworkElement.class.getSimpleName());
this.openRdmListenerRegistrationResult = null;
this.openRdmListener = new OpenroadmChangeNotificationListener(netconfAccessor, databaseService);
this.opnRdmFaultListenerRegistrationResult = null;
- this.opnRdmFaultListener = new OpenroadmFaultNotificationListener(netconfAccessor, serviceProvider);
+ this.opnRdmFaultListener = new OpenroadmFaultNotificationListener(serviceProvider);
this.opnRdmDeviceListenerRegistrationResult = null;
this.opnRdmDeviceListener = new OpenroadmDeviceChangeNotificationListener(netconfAccessor, databaseService);
- this.circuitPacksRecord = new Hashtable<String, Long>();
- this.shelfProvisionedcircuitPacks = new Hashtable<String, Long>();
+ this.circuitPacksRecord = new Hashtable<>();
+ this.shelfProvisionedcircuitPacks = new Hashtable<>();
this.openRoadmPmData = new PmDataBuilderOpenRoadm(this.netconfAccessor);
this.initialAlarmReader = new InitialDeviceAlarmReader(this.netconfAccessor, serviceProvider);
log.info("NodeId {}", this.netconfAccessor.getNodeId().getValue());
@@ -112,7 +111,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase {
OrgOpenroadmDevice device = readDevice(this.netconfAccessor);
this.opnRdmInventoryInput = new OpenroadmInventoryInput(this.netconfAccessor, device);
- log.info("oScaMapper details{}", this.opnRdmInventoryInput.getClass().getName());
+ log.info("openroadmMapper details{}", this.opnRdmInventoryInput.getClass().getName());
databaseService.writeInventory(this.opnRdmInventoryInput.getInventoryData(Uint32.valueOf(equipmentLevel)));
readShelvesData(device);
@@ -121,6 +120,8 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase {
readInterfaceData(device);
// Writing initial alarms at the time of device registration
initialAlarmReader.faultService();
+// Writing historical PM data at the time of device registration
+ List<PmdataEntity> pmDataEntity = new ArrayList<>();
pmDataEntity = this.openRoadmPmData.buildPmDataEntity(this.openRoadmPmData.getPmData(this.netconfAccessor));
if (!pmDataEntity.isEmpty()) {
this.databaseService.doWritePerformanceData(pmDataEntity);
@@ -216,13 +217,16 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase {
}
private void readCircuitPacketData(OrgOpenroadmDevice device) {
- Collection<CircuitPacks> circuitpacklist = YangHelper.getCollection(device.getCircuitPacks());
- List<String> cpNames = new ArrayList<String>();
+ Collection<CircuitPacks> circuitpackCollection = YangHelper.getCollection(device.getCircuitPacks());
+ List<String> cpNameList = new ArrayList<>();
- if (circuitpacklist != null) {
- for (CircuitPacks cp : circuitpacklist) {
- cpNames.add(cp.getCircuitPackName());
+ if (circuitpackCollection != null) {
+// collect all circuit pack names. Required to check for invalid parents later on
+ for (CircuitPacks cp : circuitpackCollection) {
+ cpNameList.add(cp.getCircuitPackName());
+ }
+ for (CircuitPacks cp : circuitpackCollection) {
log.info("CP Name:{}", cp.getCircuitPackName());
if (cp.getParentCircuitPack() == null
@@ -253,13 +257,14 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase {
databaseService.writeInventory(this.opnRdmInventoryInput.getCircuitPackInventory(cp,
Uint32.valueOf(equipmentLevel + 3)));
} else {
- // check for incorrect hierarchy
+// check for incorrect hierarchy
if (cp.getParentCircuitPack().getCircuitPackName() != null
- && !cpNames.contains(cp.getParentCircuitPack().getCircuitPackName())) {
+ && !cpNameList.contains(cp.getParentCircuitPack().getCircuitPackName())) {
databaseService.writeEventLog(writeIncorrectParentLog(cp.getCircuitPackName(), counter)
.setObjectId(device.getInfo().getNodeId().getValue())
.setId(cp.getParentCircuitPack().getCpSlotName()).build());
}
+
log.info("Cp has parent circuit pack but no shelf or a shelf but no parent circuit pack");
this.circuitPacksRecord.put(cp.getCircuitPackName(), (equipmentLevel + 2));
databaseService.writeInventory(this.opnRdmInventoryInput.getCircuitPackInventory(cp,
@@ -269,16 +274,6 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase {
}
}
-
- // for (String s : cpParentNames) {
- // log.info("Parent cps {}:", s);
- //
- // if (!cpNames.contains(s)) {
- // log.info("Invalid Hierarchy detected for {}", s);
- // databaseService.writeEventLog(writeIncorrectParentLog(s, counter)
- // .setObjectId(device.getInfo().getNodeId().getValue()).setId(s).build());
- // }
- // }
}
}
@@ -311,9 +306,8 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase {
private OrgOpenroadmDevice readDevice(NetconfBindingAccessor accessor) {
final Class<OrgOpenroadmDevice> openRoadmDev = OrgOpenroadmDevice.class;
InstanceIdentifier<OrgOpenroadmDevice> deviceId = InstanceIdentifier.builder(openRoadmDev).build();
- OrgOpenroadmDevice device = accessor.getTransactionUtils().readData(accessor.getDataBroker(),
+ return accessor.getTransactionUtils().readData(accessor.getDataBroker(),
LogicalDatastoreType.OPERATIONAL, deviceId);
- return device;
}
private EventlogBuilder writeIncorrectParentLog(String attributeName, Integer counter) {
diff --git a/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElementBase.java b/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElementBase.java
index 9949056bb..9f69018f8 100644
--- a/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElementBase.java
+++ b/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElementBase.java
@@ -32,17 +32,19 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
public class OpenroadmNetworkElementBase implements NetworkElement {
-
+ // variables
protected final NetconfBindingAccessor netconfAccessor;
protected final DataProvider databaseService;
-
+ // end of variables
+ // constructors
public OpenroadmNetworkElementBase(NetconfBindingAccessor netconfAccess,
DeviceManagerServiceProvider serviceProvider) {
this.netconfAccessor = netconfAccess;
this.databaseService = serviceProvider.getDataProvider();
}
-
+ // end of constructors
+ //public methods
@Override
public void register() {}
@@ -71,4 +73,5 @@ public class OpenroadmNetworkElementBase implements NetworkElement {
public Optional<NetconfAccessor> getAcessor() {
return Optional.of(netconfAccessor);
}
+ // end of public methods
}
diff --git a/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/PmDataBuilderOpenRoadm.java b/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/PmDataBuilderOpenRoadm.java
index 7ad2003c4..7665e81d8 100644
--- a/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/PmDataBuilderOpenRoadm.java
+++ b/sdnr/wt/devicemanager-openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/PmDataBuilderOpenRoadm.java
@@ -29,7 +29,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.onap.ccsdk.features.sdnr.wt.common.YangHelper;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.YangHelper2;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.HistoricalPmList;
@@ -45,10 +44,15 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.GranularityPeriodType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.PmdataEntity;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.PmdataEntityBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.pmdata.entity.PerformanceData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.pmdata.entity.PerformanceDataBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.pmdata.grp.MeasurementBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.pmdata.grp.MeasurementKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.units.rev200413.Celsius;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.units.rev200413.DB;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.units.rev200413.DBm;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.units.rev200413.Fahrenheit;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.units.rev200413.KHz;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.units.rev200413.MW;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.units.rev200413.PerformanceMeasurementUnitId;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.osgi.framework.Bundle;
@@ -64,20 +68,20 @@ import org.slf4j.LoggerFactory;
*/
public class PmDataBuilderOpenRoadm {
// variables
- private static final Logger log = LoggerFactory.getLogger(OpenroadmNetworkElement.class);
+ private static final Logger log = LoggerFactory.getLogger(PmDataBuilderOpenRoadm.class);
private PmdataEntityBuilder pmDataBuilder;
private Bundle b = FrameworkUtil.getBundle(this.getClass());
-
// end of variables
+
// constructors
public PmDataBuilderOpenRoadm(NetconfBindingAccessor accessor) {
this.pmDataBuilder = new PmdataEntityBuilder();
this.pmDataBuilder.setNodeName(accessor.getNodeId().getValue());
}
-
// end of constructors
+
// public methods
- // Read PM data
+ // Instantiate historical PM data list
public HistoricalPmList getPmData(NetconfBindingAccessor accessor) {
final Class<HistoricalPmList> pmDataClass = HistoricalPmList.class;
log.info("Get PM data for element {}", accessor.getNodeId().getValue());
@@ -97,15 +101,12 @@ public class PmDataBuilderOpenRoadm {
Collection<HistoricalPm> historicalPmList = YangHelper.getCollection(pmDataEntry.getHistoricalPm());
for (HistoricalPm historicalPm : historicalPmList) {
log.info("PmName:{}", historicalPm.getType());
- // pmDataBuilder.setPerformanceData(value)
try {
writeperformanceData(historicalPm);
} catch (ClassNotFoundException e) {
log.info("No relevant data found");
}
- // log.info("NodeName: {}, Scanner Id:{}, Period: {}", this.getNodeName(),
- // this.getScannerId(), this.getGranularityPeriod().getName());
pmEntitiyList.add(this.pmDataBuilder.build());
log.info("PmListSize before db writing: {}", pmEntitiyList.size());
@@ -117,9 +118,11 @@ public class PmDataBuilderOpenRoadm {
// end of public methods
// private methods
+ // Build performance data of Data provider by mapping values from device
private void writeperformanceData(HistoricalPm historicalPm) throws ClassNotFoundException {
Collection<Measurement> measurementList = YangHelper.getCollection(historicalPm.getMeasurement());
- Map<MeasurementKey, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.pmdata.grp.Measurement> measurementMap=new HashMap<MeasurementKey, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.pmdata.grp.Measurement>();
+ Map<MeasurementKey, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.pmdata.grp.Measurement> measurementMap =
+ new HashMap<>();
// Map Performance data of PmDataEntity with MeasurmentData-HistoricalPm
PerformanceDataBuilder performanceDataBuilder = new PerformanceDataBuilder();
for (Measurement measurementData : measurementList) {
@@ -128,14 +131,13 @@ public class PmDataBuilderOpenRoadm {
if (measurementData.getValidity().getName().equals("suspect")) {
this.pmDataBuilder.setSuspectIntervalFlag(true);
}
- measurementMap.put(new MeasurementKey(measurementBuilder(historicalPm.getType(), measurementData.getPmParameterUnit(),
- measurementData.getPmParameterValue()).getPmKey()), measurementBuilder(historicalPm.getType(), measurementData.getPmParameterUnit(),
- measurementData.getPmParameterValue()));
+ measurementMap.put(
+ new MeasurementKey(measurementBuilder(historicalPm.getType(), measurementData.getPmParameterUnit(),
+ measurementData.getPmParameterValue()).getPmKey()),
+ measurementBuilder(historicalPm.getType(), measurementData.getPmParameterUnit(),
+ measurementData.getPmParameterValue()));
-
- // log.info("Time:d{}, \n Scannerid: {}, \n UUID: {}", this.getGranularityPeriod().getName(),
- // pmDataBuilder.getScannerId(), this.getUuidInterface());
}
pmDataBuilder.setPerformanceData(performanceDataBuilder.setMeasurement(measurementMap).build());
@@ -143,15 +145,6 @@ public class PmDataBuilderOpenRoadm {
- //Map Performance data of PmDataEntity with MeasurmentData-HistoricalPm
- private PerformanceData getPerformancedata(Measurement measurementData) {
- PerformanceData performanceData;
- PerformanceDataBuilder performanceDataBuilder = new PerformanceDataBuilder();
- performanceData = performanceDataBuilder.setCses(YangHelper2.getInteger(measurementData.getBinNumber()))
- .setSes(measurementData.getPmParameterValue().getUint64().intValue()).build();
- return performanceData;
- }
-
// Mapping Granularity period of PmDataEntity with PmGranularity of MeasurmentData-HistoricalPm
private GranularityPeriodType mapGranularityPeriod(PmGranularity pmGranularity) {
@@ -173,88 +166,98 @@ public class PmDataBuilderOpenRoadm {
return granPeriod;
}
- private List<Class<? extends PerformanceMeasurementTypeId>> setMeasurementTypeId() throws ClassNotFoundException {
+
+ // Build the measurement list of data provider based on various values from device
+ private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.pmdata.grp.Measurement measurementBuilder(
+ PmNamesEnum pmType, String pmUnit, PmDataType pmDataType) {
+
+ MeasurementBuilder measBuilder = new MeasurementBuilder();
+ if (pmType.getName().equals("erroredSeconds")) {
+ measBuilder.setPmKey(ErroredSecond.class);
+ } else if (pmType.getName().equals("severelyErroredSeconds")) {
+ measBuilder.setPmKey(SeverelyErroredSecond.class);
+ } else {
+ for (Class<? extends PerformanceMeasurementTypeId> obj : setMeasurementTypeId()) {
+ if (obj.toString().contains(pmType.name())) {
+ measBuilder.setPmKey(obj);
+ }
+ }
+ }
+ measBuilder.setPmUnit(setMeasurementUnit(pmUnit));
+ measBuilder.setPmValue(pmDataType);
+ return measBuilder.build();
+
+ }
+ // Find the proper PerformanceMeasurementTypeId class based on the PmNames Enum value from device
+ private List<Class<? extends PerformanceMeasurementTypeId>> setMeasurementTypeId() {
String packageName =
"org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.openroadm.pm.types.rev200413";
String packageName1 =
"/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/data/provider/openroadm/pm/types/rev200413/";
- List<Class<? extends PerformanceMeasurementTypeId>> measTypeObjList =
- new ArrayList<Class<? extends PerformanceMeasurementTypeId>>();
+ List<Class<? extends PerformanceMeasurementTypeId>> measTypeObjList = new ArrayList<>();
URL root = Thread.currentThread().getContextClassLoader().getResource(packageName1);
log.info("path for type package: {}", root);
Enumeration<URL> results = getFileURL(b, packageName);
log.info("FOund Packages {}", results);
- while (results.hasMoreElements()) {
- URL path = results.nextElement();
- // log.info("Enumeration URL-file {}", path.getFile());
- // log.info("Enumeration URL-String {}", path.toString());
- Class<?> cls1 = loadClass(b, path.getFile());
-
- if (PerformanceMeasurementTypeId.class.isAssignableFrom(cls1)) {
- measTypeObjList.add((Class<? extends PerformanceMeasurementTypeId>) cls1);
- }
- log.info("Class Added {}", cls1.getSimpleName());
+ if (results != null) {
+ while (results.hasMoreElements()) {
+ URL path = results.nextElement();
- }
+ Class<?> cls1 = loadClass(b, path.getFile());
- return measTypeObjList;
- }
+ if (PerformanceMeasurementTypeId.class.isAssignableFrom(cls1)) {
+ measTypeObjList.add((Class<? extends PerformanceMeasurementTypeId>) cls1);
+
+
+ }
+ if (cls1 != null) {
+ log.info("Class Added {}", cls1.getSimpleName());
+ }
- private List<Class<? extends PerformanceMeasurementUnitId>> setMeasurementUnit() throws ClassNotFoundException {
- String packageName =
- "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.units.rev200413";
- List<Class<? extends PerformanceMeasurementUnitId>> measUnitObjList =
- new ArrayList<Class<? extends PerformanceMeasurementUnitId>>();
- URL root = Thread.currentThread().getContextClassLoader().getResource(packageName.replace(".", "/"));
- log.info("path for unit package{}", root);
-
- Enumeration<URL> results_unit = getFileURL(b, packageName);
- log.info("FOund Packages {}", results_unit);
- while (results_unit.hasMoreElements()) {
- URL path = results_unit.nextElement();
- Class<?> cls1 = loadClass(b, path.getFile());
- if (PerformanceMeasurementUnitId.class.isAssignableFrom(cls1)) {
- measUnitObjList.add((Class<? extends PerformanceMeasurementUnitId>) cls1);
}
- log.info("Class Added {}", cls1.getSimpleName());
+
}
- return measUnitObjList;
+ return measTypeObjList;
}
- private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.pmdata.grp.Measurement measurementBuilder(
- PmNamesEnum pmType, String pmUnit, PmDataType pmDataType) throws ClassNotFoundException {
-
- MeasurementBuilder measBuilder = new MeasurementBuilder();
- if (pmType.getName() == "erroredSeconds") {
- measBuilder.setPmKey(ErroredSecond.class);
- } else if (pmType.getName() == "severelyErroredSeconds") {
- measBuilder.setPmKey(SeverelyErroredSecond.class);
- } else {
- for (Class<? extends PerformanceMeasurementTypeId> obj : setMeasurementTypeId()) {
- if (obj.toString().contains(pmType.name())) {
- measBuilder.setPmKey(obj);
- }
- }
- }
- for (Class<? extends PerformanceMeasurementUnitId> obj : setMeasurementUnit()) {
- if (obj.toString().contains(pmUnit)) {
- measBuilder.setPmUnit(obj);
- }
+ //Map matching PerformanceMeasurementUnitId class based on the string value from device
+ private Class<? extends PerformanceMeasurementUnitId> setMeasurementUnit(String unitName) {
+ Class<? extends PerformanceMeasurementUnitId> measurementUnitClass = null;
+ switch (unitName) {
+ case ("celsius"):
+ measurementUnitClass = Celsius.class;
+ break;
+ case ("dB"):
+ measurementUnitClass = DB.class;
+ break;
+ case ("dBm"):
+ measurementUnitClass = DBm.class;
+ break;
+ case ("fahrenheit"):
+ measurementUnitClass = Fahrenheit.class;
+ break;
+ case ("kHz"):
+ measurementUnitClass = KHz.class;
+ break;
+ case ("mW"):
+ measurementUnitClass = MW.class;
+ break;
+ default:
+ break;
}
- measBuilder.setPmValue(pmDataType);
- return measBuilder.build();
-
+ return measurementUnitClass;
}
+
private Class<?> loadClass(Bundle bundle, String classFilePath) {
String className = classFilePath.replaceFirst("^/", "").replace('/', '.').replaceFirst(".class$", "");
try {
return bundle.loadClass(className);
- } catch (Throwable e) {
+ } catch (Exception e) {
log.info(String.format("Class [%s] could not be loaded. Message: [%s].", className, e.getMessage()));
}
return null;
@@ -277,9 +280,7 @@ public class PmDataBuilderOpenRoadm {
for (Bundle bundle : bundles) {
resultUrl = bundle.findEntries("/" + classPath.replace(".", "/"), "*.class", false);
- // resultUrl = bundle.getEntryPaths("/" + classPath.replace(".", "/"));
if (resultUrl != null) {
- b = bundle;
break;
}
diff --git a/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestChangeNotificationListener.java b/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestChangeNotificationListener.java
index caf631416..305bd9ca3 100644
--- a/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestChangeNotificationListener.java
+++ b/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestChangeNotificationListener.java
@@ -27,6 +27,7 @@ import static org.mockito.Mockito.when;
import java.util.Arrays;
import java.util.List;
import org.eclipse.jdt.annotation.NonNull;
+import org.junit.Test;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl.OpenroadmChangeNotificationListener;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
@@ -42,10 +43,12 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
public class TestChangeNotificationListener {
-
+ // variables
private static final String NODEID = "node1";
- //@Test
+ // end of variables
+ // public methods
+ @Test
public void test() {
NetconfAccessor netconfAccessor = mock(NetconfAccessor.class);
@@ -74,6 +77,8 @@ public class TestChangeNotificationListener {
}
+ // end of public methods
+ // private methods
/**
* @param type
* @return
@@ -86,4 +91,5 @@ public class TestChangeNotificationListener {
when(change.nonnullEdit()).thenReturn(edits);
return change;
}
+ // end of private methods
}
diff --git a/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestDeviceManagerOpenRoadmImpl.java b/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestDeviceManagerOpenRoadmImpl.java
index 9967f780f..f86a22d6d 100644
--- a/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestDeviceManagerOpenRoadmImpl.java
+++ b/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestDeviceManagerOpenRoadmImpl.java
@@ -21,6 +21,7 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.test;
+import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.mock;
import org.junit.After;
import org.junit.Before;
@@ -29,9 +30,12 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl.DeviceManage
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService;
public class TestDeviceManagerOpenRoadmImpl {
+ // variables
DeviceManagerOpenroadmImpl devMgrOpenRdmImpl;
NetconfNetworkElementService netcnfNtwrkElmntSrvc;
+ // end of variables
+ // public methods
@Before
public void init() {
netcnfNtwrkElmntSrvc = mock(NetconfNetworkElementService.class);
@@ -41,11 +45,13 @@ public class TestDeviceManagerOpenRoadmImpl {
@Test
public void test() throws Exception {
devMgrOpenRdmImpl.setNetconfNetworkElementService(netcnfNtwrkElmntSrvc);
+ assertNotNull(devMgrOpenRdmImpl);
+
}
@After
public void cleanUp() throws Exception {
devMgrOpenRdmImpl.close();
}
-
+ // end of public methods
}
diff --git a/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmAlarmNotification.java b/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmAlarmNotification.java
index 90b706374..4b44386a9 100644
--- a/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmAlarmNotification.java
+++ b/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmAlarmNotification.java
@@ -45,6 +45,7 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.rev191129.resour
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
public class TestOpenRoadmAlarmNotification {
+ // variables
private static final String myCircuitId = "Test_Id";
private static final String myId = "Alarm_Id";
DateAndTime myRaiseTime = new DateAndTime("2020-02-25T10:08:06.7Z");
@@ -58,6 +59,8 @@ public class TestOpenRoadmAlarmNotification {
Severity severity;
static NetconfAccessor accessor;
+ // end of variables
+ // public methods
@BeforeClass
public static void init() throws InterruptedException, IOException {
@@ -68,16 +71,10 @@ public class TestOpenRoadmAlarmNotification {
}
@Test
- public void test() {
- System.out.println("Shabnam");
- }
-
- @Test
public void testNotification() {
severity = Severity.Critical;
when(serviceProvider.getFaultService()).thenReturn(faultService);
- OpenroadmFaultNotificationListener alarmListener =
- new OpenroadmFaultNotificationListener(accessor, serviceProvider);
+ OpenroadmFaultNotificationListener alarmListener = new OpenroadmFaultNotificationListener(serviceProvider);
notification = mock(AlarmNotification.class);
when(notification.getId()).thenReturn(myId);
@@ -88,14 +85,14 @@ public class TestOpenRoadmAlarmNotification {
when(notification.getSeverity()).thenReturn(severity);
alarmListener.onAlarmNotification(notification);
System.out.println(notification.getId());
- assertEquals(notification.getId(), myId);
- assertEquals(notification.getCircuitId(), myCircuitId);
- assertEquals(notification.getRaiseTime(), myRaiseTime);
- assertEquals(notification.getProbableCause(), myProbableCause);
- assertEquals(notification.getResource(), myResource);
- assertEquals(notification.getSeverity(), severity);
-
+ assertEquals(myId, notification.getId());
+ assertEquals(myCircuitId, notification.getCircuitId());
+ assertEquals(myRaiseTime, notification.getRaiseTime());
+ assertEquals(myProbableCause, notification.getProbableCause());
+ assertEquals(myResource, notification.getResource());
+ assertEquals(severity, notification.getSeverity());
}
+ // end of public methods
}
diff --git a/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmDeviceChangeNotification.java b/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmDeviceChangeNotification.java
index 64333e1d6..24c8824e5 100644
--- a/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmDeviceChangeNotification.java
+++ b/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmDeviceChangeNotification.java
@@ -21,56 +21,108 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.test;
-import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import org.junit.Before;
+import java.util.Arrays;
+import java.util.List;
+import org.eclipse.jdt.annotation.NonNull;
import org.junit.Test;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
+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.openroadm.impl.OpenroadmDeviceChangeNotificationListener;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev191129.RpcStatus;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.ChangeNotification;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.CreateTechInfoNotification;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.OrgOpenroadmDevice;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.CreateTechInfoNotificationBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.change.notification.Edit;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.change.notification.EditBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.rev110601.EditOperationType;
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.EventlogBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
public class TestOpenRoadmDeviceChangeNotification {
+ // variables
+ private static final String NODEID = "Roadm1";
+ private NetconfAccessor netconfAccessor = mock(NetconfAccessor.class);
+ private DataProvider databaseService = mock(DataProvider.class);
+ private OpenroadmDeviceChangeNotificationListener deviceChangeListener =
+ new OpenroadmDeviceChangeNotificationListener(netconfAccessor, databaseService);
+ private static final NetconfTimeStamp ncTimeConverter = NetconfTimeStampImpl.getConverter();
- private NetconfAccessor accessor = mock(NetconfAccessor.class);
- private DataProvider databaseProvider = mock(DataProvider.class);
- static ChangeNotification notification = mock(ChangeNotification.class);
- static CreateTechInfoNotification notificationTechInfo = mock(CreateTechInfoNotification.class);
- final EditOperationType operation = EditOperationType.Merge;
- private NodeId nodeId = new NodeId("RoadmA2");
- Edit change = mock(Edit.class);
- final Class<OrgOpenroadmDevice> clazzRoadm = OrgOpenroadmDevice.class;
- OpenroadmDeviceChangeNotificationListener changeListener =
- new OpenroadmDeviceChangeNotificationListener(accessor, databaseProvider);
- InstanceIdentifier<?> target = InstanceIdentifier.builder(clazzRoadm).build();
+ // end of variables
+ // public methods
+ @Test
+ public void testOnChangeNotification() {
+
+ when(netconfAccessor.getNodeId()).thenReturn(new NodeId(NODEID));
+ Iterable<? extends PathArgument> pathArguments = Arrays.asList(new PathArgument() {
+
+ @Override
+ public int compareTo(PathArgument arg0) {
+ return 0;
+ }
+
+ @Override
+ public Class<? extends DataObject> getType() {
+ return DataObject.class;
+ }
+ });
+ InstanceIdentifier<?> target = InstanceIdentifier.create(pathArguments);
+
+ deviceChangeListener.onChangeNotification(createNotification(EditOperationType.Create, target));
+ EventlogEntity event =
+ new EventlogBuilder().setNodeId(NODEID).setNewValue(String.valueOf(EditOperationType.Create))
+ .setObjectId(target.getPathArguments().toString()).setCounter(1)
+ .setAttributeName(target.getTargetType().getName()).setSourceType(SourceType.Netconf).build();
+ verify(databaseService).writeEventLog(event);
- @Before
- public void init() {
- doReturn(target).when(change).getTarget();
- when(change.getOperation()).thenReturn(operation);
- when(accessor.getNodeId()).thenReturn(nodeId);
}
@Test
- public void testOnChangeNotification() {
- when(notification.getChangeTime()).thenReturn(new DateAndTime("2017-10-22T15:23:43Z"));
- changeListener.onChangeNotification(notification);
+ public void testOnCreateTechInfoNotification() {
+ when(netconfAccessor.getNodeId()).thenReturn(new NodeId(NODEID));
+ deviceChangeListener.onCreateTechInfoNotification(createTechInfoNotification());
+ EventlogEntity event = new EventlogBuilder().setNodeId(NODEID).setCounter(1)
+ .setId(createTechInfoNotification().getShelfId())
+ .setAttributeName(createTechInfoNotification().getShelfId())
+ .setObjectId(createTechInfoNotification().getShelfId())
+ .setNewValue(createTechInfoNotification().getStatus().getName()).setSourceType(SourceType.Netconf)
+ .setTimestamp(new DateAndTime(ncTimeConverter.getTimeStamp())).build();
+ verify(databaseService).writeEventLog(event);
}
+ // end of public methods
+ // private methods
+
+ /**
+ * @param type
+ * @return
+ */
+ private static ChangeNotification createNotification(EditOperationType type, InstanceIdentifier<?> target) {
+ ChangeNotification change = mock(ChangeNotification.class);
+
+ @SuppressWarnings("null")
+ final @NonNull List<Edit> edits = Arrays.asList(new EditBuilder().setOperation(type).setTarget(target).build());
+ when(change.nonnullEdit()).thenReturn(edits);
+ return change;
+ }
+
+ private static CreateTechInfoNotification createTechInfoNotification() {
+ CreateTechInfoNotificationBuilder techInfoNotificationBuilder = new CreateTechInfoNotificationBuilder();
+ techInfoNotificationBuilder.setLogFileName("shjkdjld/EHJkk").setShelfId("dsjhdukdgkzw")
+ .setStatus(RpcStatus.Successful).setStatusMessage("TestSuccessful");
+ return techInfoNotificationBuilder.build();
- @Test
- public void testCreateTechInfoNotification() {
- when(notificationTechInfo.getShelfId()).thenReturn("Shelf688");
- when(notificationTechInfo.getStatus()).thenReturn(RpcStatus.Successful);
- changeListener.onCreateTechInfoNotification(notificationTechInfo);
}
+ // end of private methods
+
}
diff --git a/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmInventory.java b/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmInventory.java
index 607e9ac03..e856511e5 100644
--- a/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmInventory.java
+++ b/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmInventory.java
@@ -22,6 +22,7 @@
package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.junit.Test;
@@ -61,8 +62,9 @@ public class TestOpenRoadmInventory {
.setCurrentIpAddress(ipAddress).setCurrentDefaultGateway(new IpAddress(new Ipv4Address("127.0.0.20")))
.setCurrentDefaultGateway(new IpAddress(new Ipv4Address("127.0.0.20"))).setNodeType(NodeTypes.Rdm)
.setCurrentDatetime(new DateAndTime("2017-10-22T15:23:43Z")).setSoftwareVersion("swversion1234")
- .setPrefixLength(Uint8.valueOf(28)).setMaxDegrees(Uint16.valueOf(2)).setMaxSrgs(Uint16.valueOf(3)).setMaxNumBin15minHistoricalPm(Uint16.valueOf(32))
- .setMaxNumBin24hourHistoricalPm(Uint16.valueOf(7)).setOpenroadmVersion(OpenroadmVersionType._20).build();
+ .setPrefixLength(Uint8.valueOf(28)).setMaxDegrees(Uint16.valueOf(2)).setMaxSrgs(Uint16.valueOf(3))
+ .setMaxNumBin15minHistoricalPm(Uint16.valueOf(32)).setMaxNumBin24hourHistoricalPm(Uint16.valueOf(7))
+ .setOpenroadmVersion(OpenroadmVersionType._20).build();
private OrgOpenroadmDevice device = mock(OrgOpenroadmDevice.class);;
private Shelves shelf = mock(Shelves.class);
@@ -77,7 +79,7 @@ public class TestOpenRoadmInventory {
when(device.getInfo()).thenReturn(info);
roadmInventory.getInventoryData(Uint32.valueOf(value1));
- assertEquals(device.getInfo(), info);
+ assertEquals(info, device.getInfo());
}
@@ -95,7 +97,8 @@ public class TestOpenRoadmInventory {
when(shelf.getModel()).thenReturn("1");
when(shelf.getHardwareVersion()).thenReturn("0.1");
when(shelf.getManufactureDate()).thenReturn(new DateAndTime("2017-10-22T15:23:43Z"));
- roadmInventory.getShelvesInventory(shelf, Uint32.valueOf(value1 + 1));
+ assertNotNull(roadmInventory.getShelvesInventory(shelf, Uint32.valueOf(value1 + 1)));
+
LOG.info("Shelves test completed");
}
@@ -113,7 +116,7 @@ public class TestOpenRoadmInventory {
when(cp.getProductCode()).thenReturn("oooooo");
when(cp.getCircuitPackMode()).thenReturn("inServiceMode");
when(device.getInfo()).thenReturn(info);
- roadmInventory.getCircuitPackInventory(cp, Uint32.valueOf(value1 + 1));
+ assertNotNull(roadmInventory.getCircuitPackInventory(cp, Uint32.valueOf(value1 + 1)));
}
@@ -124,7 +127,7 @@ public class TestOpenRoadmInventory {
when(interfaces.getDescription()).thenReturn("Ethernet Interface");
when(interfaces.getSupportingCircuitPackName()).thenReturn("1/0");
when(device.getInfo()).thenReturn(info);
- roadmInventory.getInterfacesInventory(interfaces, Uint32.valueOf(value1 + 2));
+ assertNotNull(roadmInventory.getInterfacesInventory(interfaces, Uint32.valueOf(value1 + 2)));
}
@Test
@@ -134,7 +137,7 @@ public class TestOpenRoadmInventory {
when(xpdr.getLifecycleState()).thenReturn(LifecycleState.Deployed);
when(accessor.getNodeId()).thenReturn(nodeId);
when(device.getInfo()).thenReturn(info);
- roadmInventory.getXponderInventory(xpdr, Uint32.valueOf(value1 + 1));
+ assertNotNull(roadmInventory.getXponderInventory(xpdr, Uint32.valueOf(value1 + 1)));
}
diff --git a/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElement.java b/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElement.java
index 794c2eb1a..04cc4589b 100644
--- a/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElement.java
+++ b/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElement.java
@@ -1,304 +1,308 @@
-///*
-// * ============LICENSE_START=======================================================
-// * ONAP : ccsdk features
-// * ================================================================================
-// * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
-// * All rights reserved.
-// * ================================================================================
-// * Licensed under the Apache License, Version 2.0 (the "License");
-// * you may not use this file except in compliance with the License.
-// * You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing, software
-// * distributed under the License is distributed on an "AS IS" BASIS,
-// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// * See the License for the specific language governing permissions and
-// * limitations under the License.
-// * ============LICENSE_END=========================================================
-// *
-// */
-//package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.test;
-//
-//import static org.mockito.Mockito.mock;
-//import static org.mockito.Mockito.when;
-//import java.math.BigInteger;
-//import java.util.Arrays;
-//import java.util.HashMap;
-//import java.util.List;
-//import java.util.Map;
-//
-//import org.eclipse.jdt.annotation.Nullable;
-//import org.junit.Before;
-//import org.junit.Test;
-//import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
-//import org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl.OpenroadmInventoryInput;
-//import org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl.OpenroadmNetworkElement;
-//import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
-//import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
-//import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
-//import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
-//import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
-//import org.opendaylight.mdsal.binding.api.DataBroker;
-//import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.ActiveAlarmList;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.Severity;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.active.alarm.list.ActiveAlarms;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.active.alarm.list.ActiveAlarmsKey;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.alarm.ProbableCauseBuilder;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.alarm.ResourceBuilder;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev191129.NodeIdType;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.LifecycleState;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev191129.OpenroadmVersionType;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.OrgOpenroadmDevice;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.circuit.pack.ParentCircuitPack;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.circuit.packs.CircuitPacks;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.circuit.packs.CircuitPacksKey;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.interfaces.grp.Interface;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.interfaces.grp.InterfaceKey;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.org.openroadm.device.Info;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.org.openroadm.device.InfoBuilder;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.org.openroadm.device.Xponder;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.org.openroadm.device.XponderKey;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.shelf.Slots;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.shelf.SlotsKey;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.shelves.Shelves;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.shelves.ShelvesKey;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.device.types.rev191129.NodeTypes;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.device.types.rev191129.XpdrNodeTypes;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.HistoricalPmList;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.group.HistoricalPm;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.group.HistoricalPmKey;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.list.HistoricalPmEntry;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.list.HistoricalPmEntryKey;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.val.group.Measurement;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.val.group.MeasurementKey;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.PmDataType;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.PmGranularity;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.PmNamesEnum;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.Validity;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.probablecause.rev191129.ProbableCauseEnum;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.rev191129.resource.DeviceBuilder;
-//import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.types.rev191129.ResourceTypeEnum;
-//import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-//import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-//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.Inventory;
-//import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-//import org.opendaylight.yangtools.yang.binding.DataObject;
-//import org.opendaylight.yangtools.yang.binding.Identifiable;
-//import org.opendaylight.yangtools.yang.binding.Identifier;
-//import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-//import org.opendaylight.yangtools.yang.common.Uint16;
-//import org.opendaylight.yangtools.yang.common.Uint64;
-//
-//public class TestOpenRoadmNetworkElement {
-//
-// NetconfAccessor accessor = mock(NetconfAccessor.class);
-// DeviceManagerServiceProvider serviceProvider = mock(DeviceManagerServiceProvider.class);
-// DataProvider dataprovider = mock(DataProvider.class);
-// Capabilities capabilities = mock(Capabilities.class);
-// TransactionUtils transactionUtils = mock(TransactionUtils.class);
-// DataBroker dataBroker = mock(DataBroker.class);
-// // OscaNetworkElement optionalNe = mock(OscaNetworkElement.class);
-//
-// FaultService faultService = mock(FaultService.class);
-// OrgOpenroadmDevice device;
-// // OscaInventoryInput inventoryData = mock(OscaInventoryInput.class);
-// OpenroadmInventoryInput inventoryData;
-// private Inventory equipment = mock(Inventory.class);
-// long level = 1;
-// private Shelves shelf = mock(Shelves.class);
-// private @Nullable Map<ShelvesKey, Shelves> shelfList;
-// private CircuitPacks cp, cp1, cp2, cp3;
-// private Interface interfaces = mock(Interface.class);
-// private Xponder xpdr = mock(Xponder.class);
-// private IpAddress ipAddress = new IpAddress(new Ipv4Address("127.0.0.11"));
-// private Info info = new InfoBuilder().setNodeId(NodeIdType.getDefaultInstance("zNhe2i5")).setClli("NodeB")
-// .setSerialId("0002").setModel("model2").setVendor("VendorA").setCurrentIpAddress(ipAddress)
-// .setCurrentIpAddress(ipAddress).setCurrentDefaultGateway(new IpAddress(new Ipv4Address("127.0.0.20")))
-// .setCurrentDefaultGateway(new IpAddress(new Ipv4Address("127.0.0.20"))).setNodeType(NodeTypes.Rdm)
-// .setCurrentDatetime(new DateAndTime("2017-10-22T15:23:43Z")).setSoftwareVersion("swversion1234")
-// .setPrefixLength((short) 28).setMaxDegrees(2).setMaxSrgs(3).setMaxNumBin15minHistoricalPm(32)
-// .setMaxNumBin24hourHistoricalPm(7).setOpenroadmVersion(OpenroadmVersionType._20).build();
-// private ActiveAlarmList alarmList = mock(ActiveAlarmList.class);
-// private ActiveAlarms activeAlarms = mock(ActiveAlarms.class);
-// private HistoricalPmList pmDataList = mock(HistoricalPmList.class);
-// private HistoricalPm historicalPm = mock(HistoricalPm.class);
-// @Before
-// public void init() {
-// when(accessor.getCapabilites()).thenReturn(capabilities);
-// when(serviceProvider.getFaultService()).thenReturn(faultService);
-// when(serviceProvider.getDataProvider()).thenReturn(dataprovider);
-// NodeId nNodeId = new NodeId("RoadmA");
-// when(accessor.getNodeId()).thenReturn(nNodeId);
-// when(accessor.getDataBroker()).thenReturn(dataBroker);
-// when(accessor.getTransactionUtils()).thenReturn(transactionUtils);
-// when(accessor.getCapabilites().isSupportingNamespaceAndRevision(OrgOpenroadmDevice.QNAME)).thenReturn(true);
-// final Class<OrgOpenroadmDevice> openRoadmDev = OrgOpenroadmDevice.class;
-// // Reading data from device
-// InstanceIdentifier<OrgOpenroadmDevice> deviceId = InstanceIdentifier.builder(openRoadmDev).build();
-// device = mock(OrgOpenroadmDevice.class);
-// when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
-// deviceId)).thenReturn(device);
-//
-// when(device.getInfo()).thenReturn(info);
-// inventoryData = new OpenroadmInventoryInput(accessor, device);
-// // Reading the shelfs data;
-// when(shelf.getShelfPosition()).thenReturn("10");
-// when(shelf.getOperationalState()).thenReturn(State.InService);
-// when(shelf.getSerialId()).thenReturn("nodeid-1");
-// when(shelf.getShelfName()).thenReturn("Shelf1");
-// when(shelf.getShelfType()).thenReturn("Shelf");
-// when(shelf.getClei()).thenReturn("1234567890");
-// when(shelf.getVendor()).thenReturn("vendorA");
-// when(shelf.getModel()).thenReturn("1");
-// when(shelf.getHardwareVersion()).thenReturn("0.1");
-// when(shelf.getManufactureDate()).thenReturn(new DateAndTime("2017-10-22T15:23:43Z"));
-// @Nullable Map<SlotsKey, Slots> slotList = null;
-// Slots slots = mock(Slots.class);
-// when(slots.getLabel()).thenReturn("Slot56746");
-// when(slots.getSlotName()).thenReturn("slotofRoadmA");
-// when(slots.getProvisionedCircuitPack()).thenReturn("1/0");
-// slotList = new HashMap<>();
-// slotList.put(slots.key(),slots);
-// when(shelf.getSlots()).thenReturn(slotList);
-// shelfList = new HashMap<>();
-// shelfList.put(shelf.key(),shelf);
-// when(device.getShelves()).thenReturn(shelfList);
-//
-// // Reading data from CircuitPacks
-// cp = mock(CircuitPacks.class);
-// when(cp.getCircuitPackName()).thenReturn("1/0");
-// when(cp.getVendor()).thenReturn("VendorA");
-// when(cp.getModel()).thenReturn("Model1");
-// when(cp.getSerialId()).thenReturn("46277sgh6");
-// when(cp.getClei()).thenReturn("136268785");
-// when(cp.getHardwareVersion()).thenReturn("0.1");
-// when(cp.getType()).thenReturn("WSS");
-// when(cp.getProductCode()).thenReturn("oooooo");
-// when(cp.getCircuitPackMode()).thenReturn("inServiceMode");
-//
-// ParentCircuitPack parentCp = mock(ParentCircuitPack.class);
-// when(parentCp.getCircuitPackName()).thenReturn("1/0");
-// when(parentCp.getCpSlotName()).thenReturn("Slot1");
-// cp1 = mock(CircuitPacks.class);
-// when(cp1.getCircuitPackName()).thenReturn("1/0 EThernet");
-// when(cp1.getVendor()).thenReturn("VendorA");
-// when(cp1.getModel()).thenReturn("Model1678");
-// when(cp1.getSerialId()).thenReturn("4627dgs7sgh6");
-// when(cp1.getClei()).thenReturn("1362d68785");
-// when(cp1.getHardwareVersion()).thenReturn("0.1");
-// when(cp1.getType()).thenReturn("EthPlug");
-// when(cp1.getProductCode()).thenReturn("oooooo");
-// when(cp1.getCircuitPackMode()).thenReturn("inServiceMode");
-// when(cp1.getParentCircuitPack()).thenReturn(parentCp);
-//
-// cp2 = mock(CircuitPacks.class);
-// when(cp2.getCircuitPackName()).thenReturn("2/0");
-// when(cp2.getVendor()).thenReturn("VendorA");
-// when(cp2.getModel()).thenReturn("Model1678");
-// when(cp2.getSerialId()).thenReturn("4sads7sgh6");
-// when(cp2.getClei()).thenReturn("1wew362d68785");
-// when(cp2.getHardwareVersion()).thenReturn("0.1");
-// when(cp2.getType()).thenReturn("WSS");
-// when(cp2.getProductCode()).thenReturn("osooooo");
-// when(cp2.getCircuitPackMode()).thenReturn("inServiceMode");
-//
-// cp3 = mock(CircuitPacks.class);
-// when(parentCp.getCircuitPackName()).thenReturn("2/0");
-// when(parentCp.getCpSlotName()).thenReturn("Slot1");
-// when(cp3.getCircuitPackName()).thenReturn("2/0 OCS");
-// when(cp3.getVendor()).thenReturn("VendorA");
-// when(cp3.getModel()).thenReturn("Model1678");
-// when(cp3.getSerialId()).thenReturn("dswsads7sgh6");
-// when(cp3.getClei()).thenReturn("1ew62d68785");
-// when(cp3.getHardwareVersion()).thenReturn("0.1");
-// when(cp3.getType()).thenReturn("OCS Plug");
-// when(cp3.getProductCode()).thenReturn("osooooo");
-// when(cp3.getCircuitPackMode()).thenReturn("inServiceMode");
-// when(cp3.getParentCircuitPack()).thenReturn(parentCp);
-// @Nullable Map<CircuitPacksKey, CircuitPacks> cpList = new HashMap<>();
-// cpList.put(cp.key(),cp);
-// cpList.put(cp1.key(),cp1);
-// cpList.put(cp2.key(),cp2);
-// cpList.put(cp3.key(),cp3);
-// when(device.getCircuitPacks()).thenReturn(cpList);
-//
-// // Reading Interface Data
-// when(interfaces.getName()).thenReturn("1GE-interface-1");
-// when(interfaces.getDescription()).thenReturn("Ethernet Interface");
-// when(interfaces.getSupportingCircuitPackName()).thenReturn("1/0 EThernet");
-// @Nullable Map<InterfaceKey, Interface> interfacesList = new HashMap<>();
-// interfacesList.put(interfaces.key(),interfaces);
-// when(device.getInterface()).thenReturn(interfacesList);
-//
-// // Reading Xponder Data
-// when(xpdr.getXpdrNumber()).thenReturn(Uint16.valueOf(1));
-// when(xpdr.getXpdrType()).thenReturn(XpdrNodeTypes.Mpdr);
-// when(xpdr.getLifecycleState()).thenReturn(LifecycleState.Deployed);
-// @Nullable Map<XponderKey, Xponder> xpnderList = new HashMap<>();
-// xpnderList.put(xpdr.key(), xpdr);
-// when(device.getXponder()).thenReturn(xpnderList);
-//
-// // Read initial Alarm data
-// final Class<ActiveAlarmList> classAlarm = ActiveAlarmList.class;
-// InstanceIdentifier<ActiveAlarmList> alarmDataIid = InstanceIdentifier.builder(classAlarm).build();
-// when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
-// alarmDataIid)).thenReturn(alarmList);
-// when(activeAlarms.getId()).thenReturn("Alarm1");
-// when(activeAlarms.getCircuitId()).thenReturn("1/0");
-// when(activeAlarms.getRaiseTime()).thenReturn(new DateAndTime("2017-10-22T15:23:43Z"));
-// when(activeAlarms.getSeverity()).thenReturn(Severity.Critical);
-// when(activeAlarms.getProbableCause())
-// .thenReturn(new ProbableCauseBuilder().setCause(ProbableCauseEnum.AutomaticLaserShutdown).build());
-// when(activeAlarms.getAdditionalDetail()).thenReturn("LaserShutdown");
-// when(activeAlarms.getResource()).thenReturn(new ResourceBuilder()
-// .setDevice(new DeviceBuilder().setNodeId(NodeIdType.getDefaultInstance("zNhe2i5")).build()).build());
-// @Nullable Map<ActiveAlarmsKey, ActiveAlarms> activeAlarmlist = new HashMap<>();
-// activeAlarmlist.put(activeAlarms.key(),activeAlarms);
-// when(alarmList.getActiveAlarms()).thenReturn(activeAlarmlist);
-//
-// // Read PM Data
-// final Class<HistoricalPmList> pmDataClass = HistoricalPmList.class;
-// InstanceIdentifier<HistoricalPmList> pmDataIid = InstanceIdentifier.builder(pmDataClass).build();
-// when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
-// pmDataIid)).thenReturn(pmDataList);
-//
-// Measurement measurement = mock(Measurement.class);
-// PmDataType pmDataType = mock(PmDataType.class);
-// when(pmDataType.getUint64()).thenReturn(Uint64.valueOf(2425425));
-// when(measurement.getBinNumber()).thenReturn(Uint16.valueOf(1452));
-// when(measurement.getCompletionTime()).thenReturn(new DateAndTime("2018-10-22T15:23:43Z"));
-// when(measurement.getGranularity()).thenReturn(PmGranularity._24Hour);
-// when(measurement.getPmParameterUnit()).thenReturn("6824545199534863756");
-// when(measurement.getPmParameterValue()).thenReturn(pmDataType);
-// when(measurement.getValidity()).thenReturn(Validity.Partial);
-//
-// @Nullable Map<MeasurementKey, Measurement> measurementList = new HashMap<>();
-// measurementList.put(measurement.key(),measurement);
-// when(historicalPm.getMeasurement()).thenReturn(measurementList);
-// when(historicalPm.getType()).thenReturn(PmNamesEnum.DelayTCM1Down);
-// when(historicalPm.getExtension()).thenReturn("OpticalPowerOutput");
-// @Nullable Map<HistoricalPmKey, HistoricalPm> historicalPmList = new HashMap<>();
-// historicalPmList.put(historicalPm.key(),historicalPm);
-// HistoricalPmEntry histPmEntry = mock(HistoricalPmEntry.class);
-// when(histPmEntry.getHistoricalPm()).thenReturn(historicalPmList);
-// when(histPmEntry.getPmResourceType()).thenReturn(ResourceTypeEnum.CircuitPack);
-// @Nullable Map<HistoricalPmEntryKey, HistoricalPmEntry> histPmList = new HashMap<>();
-// histPmList.put(histPmEntry.key(),histPmEntry);
-// when(pmDataList.getHistoricalPmEntry()).thenReturn(histPmList);
-//
-// }
-//
-//
-//
-// @Test
-// public void test() {
-// OpenroadmNetworkElement optionalNe = new OpenroadmNetworkElement(accessor, serviceProvider);
-// optionalNe.initialReadFromNetworkElement();
-// }
-//
-//}
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
+ * All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ */
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.test;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.jdt.annotation.Nullable;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl.OpenroadmInventoryInput;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl.OpenroadmNetworkElement;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.ActiveAlarmList;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.Severity;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.active.alarm.list.ActiveAlarms;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.active.alarm.list.ActiveAlarmsKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.alarm.ProbableCauseBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.alarm.ResourceBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev191129.NodeIdType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.LifecycleState;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev191129.OpenroadmVersionType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.OrgOpenroadmDevice;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.circuit.pack.ParentCircuitPack;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.circuit.packs.CircuitPacks;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.circuit.packs.CircuitPacksKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.interfaces.grp.Interface;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.interfaces.grp.InterfaceKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.org.openroadm.device.Info;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.org.openroadm.device.InfoBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.org.openroadm.device.Xponder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.org.openroadm.device.XponderKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.shelf.Slots;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.shelf.SlotsKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.shelves.Shelves;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.shelves.ShelvesKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.types.rev191129.NodeTypes;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.types.rev191129.XpdrNodeTypes;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.HistoricalPmList;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.group.HistoricalPm;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.group.HistoricalPmKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.list.HistoricalPmEntry;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.list.HistoricalPmEntryKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.val.group.Measurement;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.val.group.MeasurementKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.PmDataType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.PmGranularity;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.PmNamesEnum;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.Validity;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.probablecause.rev191129.ProbableCauseEnum;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.rev191129.resource.DeviceBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.types.rev191129.ResourceTypeEnum;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
+import org.opendaylight.yangtools.yang.common.Uint8;
+
+public class TestOpenRoadmNetworkElement {
+ // variables
+ NetconfBindingAccessor accessor = mock(NetconfBindingAccessor.class);
+ DeviceManagerServiceProvider serviceProvider = mock(DeviceManagerServiceProvider.class);
+ DataProvider dataprovider = mock(DataProvider.class);
+ Capabilities capabilities = mock(Capabilities.class);
+ TransactionUtils transactionUtils = mock(TransactionUtils.class);
+ DataBroker dataBroker = mock(DataBroker.class);
+ FaultService faultService = mock(FaultService.class);
+ OrgOpenroadmDevice device;
+ OpenroadmInventoryInput inventoryData;
+ long level = 1;
+ private Shelves shelf = mock(Shelves.class);
+ private @Nullable Map<ShelvesKey, Shelves> shelfList;
+ private CircuitPacks cp, cp1, cp2, cp3;
+ private Interface interfaces = mock(Interface.class);
+ private Xponder xpdr = mock(Xponder.class);
+ private IpAddress ipAddress = new IpAddress(new Ipv4Address("127.0.0.11"));
+ private Info info = new InfoBuilder().setNodeId(NodeIdType.getDefaultInstance("zNhe2i5")).setClli("NodeB")
+ .setSerialId("0002").setModel("model2").setVendor("VendorA").setCurrentIpAddress(ipAddress)
+ .setCurrentIpAddress(ipAddress).setCurrentDefaultGateway(new IpAddress(new Ipv4Address("127.0.0.20")))
+ .setCurrentDefaultGateway(new IpAddress(new Ipv4Address("127.0.0.20"))).setNodeType(NodeTypes.Rdm)
+ .setCurrentDatetime(new DateAndTime("2017-10-22T15:23:43Z")).setSoftwareVersion("swversion1234")
+ .setCurrentPrefixLength(Uint8.valueOf(45)).setMaxDegrees(Uint16.valueOf(56)).setMaxSrgs(Uint16.valueOf(251))
+ .setMaxNumBin15minHistoricalPm(Uint16.valueOf(324)).setMaxNumBin24hourHistoricalPm(Uint16.valueOf(142))
+ .setOpenroadmVersion(OpenroadmVersionType._20).build();
+ private ActiveAlarmList alarmList = mock(ActiveAlarmList.class);
+ private ActiveAlarms activeAlarms = mock(ActiveAlarms.class);
+ private HistoricalPmList pmDataList = mock(HistoricalPmList.class);
+ private HistoricalPm historicalPm = mock(HistoricalPm.class);
+
+ // end of variables
+ // public methods
+ @Before
+ public void init() {
+ when(accessor.getCapabilites()).thenReturn(capabilities);
+ when(serviceProvider.getFaultService()).thenReturn(faultService);
+ when(serviceProvider.getDataProvider()).thenReturn(dataprovider);
+ NodeId nNodeId = new NodeId("RoadmA");
+ when(accessor.getNodeId()).thenReturn(nNodeId);
+ when(accessor.getDataBroker()).thenReturn(dataBroker);
+ when(accessor.getTransactionUtils()).thenReturn(transactionUtils);
+ when(accessor.getCapabilites().isSupportingNamespaceAndRevision(OrgOpenroadmDevice.QNAME)).thenReturn(true);
+ final Class<OrgOpenroadmDevice> openRoadmDev = OrgOpenroadmDevice.class;
+ // Reading data from device
+ InstanceIdentifier<OrgOpenroadmDevice> deviceId = InstanceIdentifier.builder(openRoadmDev).build();
+ device = mock(OrgOpenroadmDevice.class);
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ deviceId)).thenReturn(device);
+
+ when(device.getInfo()).thenReturn(info);
+ inventoryData = new OpenroadmInventoryInput(accessor, device);
+ // Reading the shelfs data;
+ when(shelf.getShelfPosition()).thenReturn("10");
+ when(shelf.getOperationalState()).thenReturn(State.InService);
+ when(shelf.getSerialId()).thenReturn("nodeid-1");
+ when(shelf.getShelfName()).thenReturn("Shelf1");
+ when(shelf.getShelfType()).thenReturn("Shelf");
+ when(shelf.getClei()).thenReturn("1234567890");
+ when(shelf.getVendor()).thenReturn("vendorA");
+ when(shelf.getModel()).thenReturn("1");
+ when(shelf.getHardwareVersion()).thenReturn("0.1");
+ when(shelf.getManufactureDate()).thenReturn(new DateAndTime("2017-10-22T15:23:43Z"));
+ @Nullable
+ Map<SlotsKey, Slots> slotList = null;
+ Slots slots = mock(Slots.class);
+ when(slots.getLabel()).thenReturn("Slot56746");
+ when(slots.getSlotName()).thenReturn("slotofRoadmA");
+ when(slots.getProvisionedCircuitPack()).thenReturn("1/0");
+ slotList = new HashMap<>();
+ slotList.put(slots.key(), slots);
+ when(shelf.getSlots()).thenReturn(slotList);
+ shelfList = new HashMap<>();
+ shelfList.put(shelf.key(), shelf);
+ when(device.getShelves()).thenReturn(shelfList);
+
+ // Reading data from CircuitPacks
+ cp = mock(CircuitPacks.class);
+ when(cp.getCircuitPackName()).thenReturn("1/0");
+ when(cp.getVendor()).thenReturn("VendorA");
+ when(cp.getModel()).thenReturn("Model1");
+ when(cp.getSerialId()).thenReturn("46277sgh6");
+ when(cp.getClei()).thenReturn("136268785");
+ when(cp.getHardwareVersion()).thenReturn("0.1");
+ when(cp.getType()).thenReturn("WSS");
+ when(cp.getProductCode()).thenReturn("oooooo");
+ when(cp.getCircuitPackMode()).thenReturn("inServiceMode");
+
+ ParentCircuitPack parentCp = mock(ParentCircuitPack.class);
+ when(parentCp.getCircuitPackName()).thenReturn("1/0");
+ when(parentCp.getCpSlotName()).thenReturn("Slot1");
+ cp1 = mock(CircuitPacks.class);
+ when(cp1.getCircuitPackName()).thenReturn("1/0 EThernet");
+ when(cp1.getVendor()).thenReturn("VendorA");
+ when(cp1.getModel()).thenReturn("Model1678");
+ when(cp1.getSerialId()).thenReturn("4627dgs7sgh6");
+ when(cp1.getClei()).thenReturn("1362d68785");
+ when(cp1.getHardwareVersion()).thenReturn("0.1");
+ when(cp1.getType()).thenReturn("EthPlug");
+ when(cp1.getProductCode()).thenReturn("oooooo");
+ when(cp1.getCircuitPackMode()).thenReturn("inServiceMode");
+ when(cp1.getParentCircuitPack()).thenReturn(parentCp);
+
+ cp2 = mock(CircuitPacks.class);
+ when(cp2.getCircuitPackName()).thenReturn("2/0");
+ when(cp2.getVendor()).thenReturn("VendorA");
+ when(cp2.getModel()).thenReturn("Model1678");
+ when(cp2.getSerialId()).thenReturn("4sads7sgh6");
+ when(cp2.getClei()).thenReturn("1wew362d68785");
+ when(cp2.getHardwareVersion()).thenReturn("0.1");
+ when(cp2.getType()).thenReturn("WSS");
+ when(cp2.getProductCode()).thenReturn("osooooo");
+ when(cp2.getCircuitPackMode()).thenReturn("inServiceMode");
+
+ cp3 = mock(CircuitPacks.class);
+ when(parentCp.getCircuitPackName()).thenReturn("2/0");
+ when(parentCp.getCpSlotName()).thenReturn("Slot1");
+ when(cp3.getCircuitPackName()).thenReturn("2/0 OCS");
+ when(cp3.getVendor()).thenReturn("VendorA");
+ when(cp3.getModel()).thenReturn("Model1678");
+ when(cp3.getSerialId()).thenReturn("dswsads7sgh6");
+ when(cp3.getClei()).thenReturn("1ew62d68785");
+ when(cp3.getHardwareVersion()).thenReturn("0.1");
+ when(cp3.getType()).thenReturn("OCS Plug");
+ when(cp3.getProductCode()).thenReturn("osooooo");
+ when(cp3.getCircuitPackMode()).thenReturn("inServiceMode");
+ when(cp3.getParentCircuitPack()).thenReturn(parentCp);
+ @Nullable
+ Map<CircuitPacksKey, CircuitPacks> cpList = new HashMap<>();
+ cpList.put(cp.key(), cp);
+ cpList.put(cp1.key(), cp1);
+ cpList.put(cp2.key(), cp2);
+ cpList.put(cp3.key(), cp3);
+ when(device.getCircuitPacks()).thenReturn(cpList);
+
+ // Reading Interface Data
+ when(interfaces.getName()).thenReturn("1GE-interface-1");
+ when(interfaces.getDescription()).thenReturn("Ethernet Interface");
+ when(interfaces.getSupportingCircuitPackName()).thenReturn("1/0 EThernet");
+ @Nullable
+ Map<InterfaceKey, Interface> interfacesList = new HashMap<>();
+ interfacesList.put(interfaces.key(), interfaces);
+ when(device.getInterface()).thenReturn(interfacesList);
+
+ // Reading Xponder Data
+ when(xpdr.getXpdrNumber()).thenReturn(Uint16.valueOf(1));
+ when(xpdr.getXpdrType()).thenReturn(XpdrNodeTypes.Mpdr);
+ when(xpdr.getLifecycleState()).thenReturn(LifecycleState.Deployed);
+ @Nullable
+ Map<XponderKey, Xponder> xpnderList = new HashMap<>();
+ xpnderList.put(xpdr.key(), xpdr);
+ when(device.getXponder()).thenReturn(xpnderList);
+
+ // Read initial Alarm data
+ final Class<ActiveAlarmList> classAlarm = ActiveAlarmList.class;
+ InstanceIdentifier<ActiveAlarmList> alarmDataIid = InstanceIdentifier.builder(classAlarm).build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ alarmDataIid)).thenReturn(alarmList);
+ when(activeAlarms.getId()).thenReturn("Alarm1");
+ when(activeAlarms.getCircuitId()).thenReturn("1/0");
+ when(activeAlarms.getRaiseTime()).thenReturn(new DateAndTime("2017-10-22T15:23:43Z"));
+ when(activeAlarms.getSeverity()).thenReturn(Severity.Critical);
+ when(activeAlarms.getProbableCause())
+ .thenReturn(new ProbableCauseBuilder().setCause(ProbableCauseEnum.AutomaticLaserShutdown).build());
+ when(activeAlarms.getAdditionalDetail()).thenReturn("LaserShutdown");
+ when(activeAlarms.getResource()).thenReturn(new ResourceBuilder()
+ .setDevice(new DeviceBuilder().setNodeId(NodeIdType.getDefaultInstance("zNhe2i5")).build()).build());
+ @Nullable
+ Map<ActiveAlarmsKey, ActiveAlarms> activeAlarmlist = new HashMap<>();
+ activeAlarmlist.put(activeAlarms.key(), activeAlarms);
+ when(alarmList.getActiveAlarms()).thenReturn(activeAlarmlist);
+
+ // Read PM Data
+ final Class<HistoricalPmList> pmDataClass = HistoricalPmList.class;
+ InstanceIdentifier<HistoricalPmList> pmDataIid = InstanceIdentifier.builder(pmDataClass).build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ pmDataIid)).thenReturn(pmDataList);
+
+ Measurement measurement = mock(Measurement.class);
+ PmDataType pmDataType = mock(PmDataType.class);
+ when(pmDataType.getUint64()).thenReturn(Uint64.valueOf(2425425));
+ when(measurement.getBinNumber()).thenReturn(Uint16.valueOf(1452));
+ when(measurement.getCompletionTime()).thenReturn(new DateAndTime("2018-10-22T15:23:43Z"));
+ when(measurement.getGranularity()).thenReturn(PmGranularity._24Hour);
+ when(measurement.getPmParameterUnit()).thenReturn("6824545199534863756");
+ when(measurement.getPmParameterValue()).thenReturn(pmDataType);
+ when(measurement.getValidity()).thenReturn(Validity.Partial);
+
+ @Nullable
+ Map<MeasurementKey, Measurement> measurementList = new HashMap<>();
+ measurementList.put(measurement.key(), measurement);
+ when(historicalPm.getMeasurement()).thenReturn(measurementList);
+ when(historicalPm.getType()).thenReturn(PmNamesEnum.ErroredSeconds);
+ when(historicalPm.getExtension()).thenReturn("OpticalPowerOutput");
+ @Nullable
+ Map<HistoricalPmKey, HistoricalPm> historicalPmList = new HashMap<>();
+ historicalPmList.put(historicalPm.key(), historicalPm);
+ HistoricalPmEntry histPmEntry = mock(HistoricalPmEntry.class);
+ when(histPmEntry.getHistoricalPm()).thenReturn(historicalPmList);
+ when(histPmEntry.getPmResourceType()).thenReturn(ResourceTypeEnum.CircuitPack);
+ @Nullable
+ Map<HistoricalPmEntryKey, HistoricalPmEntry> histPmList = new HashMap<>();
+ histPmList.put(histPmEntry.key(), histPmEntry);
+ when(pmDataList.getHistoricalPmEntry()).thenReturn(histPmList);
+
+ }
+
+
+
+ @Test
+ public void test() {
+ OpenroadmNetworkElement optionalNe = new OpenroadmNetworkElement(accessor, serviceProvider);
+ optionalNe.initialReadFromNetworkElement();
+ verify(dataprovider).writeInventory(inventoryData.getInventoryData(Uint32.valueOf(1)));
+ }
+ // end of public methods
+}
diff --git a/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElementFactory.java b/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElementFactory.java
index 40a48c358..856948940 100644
--- a/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElementFactory.java
+++ b/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElementFactory.java
@@ -42,13 +42,15 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class TestOpenRoadmNetworkElementFactory {
-
+// variables
private static NetconfBindingAccessor accessor;
private static DeviceManagerServiceProvider serviceProvider;
private static Capabilities capabilities;
private static TransactionUtils transactionUtils;
private static DataBroker dataBroker;
+ // end of variables
+ // public methods
@BeforeClass
public static void init() throws InterruptedException, IOException {
accessor = mock(NetconfBindingAccessor.class);
@@ -97,5 +99,5 @@ public class TestOpenRoadmNetworkElementFactory {
public void cleanUp() throws Exception {
}
-
+ // end of public methods
}
diff --git a/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmPMDataBuilder.java b/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmPMDataBuilder.java
new file mode 100644
index 000000000..b926e0c13
--- /dev/null
+++ b/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmPMDataBuilder.java
@@ -0,0 +1,161 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
+ * All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ */
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl.PmDataBuilderOpenRoadm;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.alarm.pm.types.rev191129.Direction;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.alarm.pm.types.rev191129.Location;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.HistoricalPmList;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.group.HistoricalPm;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.group.HistoricalPmBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.group.HistoricalPmKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.list.HistoricalPmEntry;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.list.HistoricalPmEntryBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.list.HistoricalPmEntryKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.val.group.Measurement;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.val.group.MeasurementBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.val.group.MeasurementKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.PmDataType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.PmGranularity;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.PmNamesEnum;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.Validity;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.types.rev191129.ResourceTypeEnum;
+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.units.rev200413.Celsius;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.units.rev200413.PerformanceMeasurementUnitId;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint64;
+
+public class TestOpenRoadmPMDataBuilder {
+ // variables
+
+ private NetconfBindingAccessor acessor = mock(NetconfBindingAccessor.class);
+ private DataBroker dataBroker = mock(DataBroker.class);
+ private TransactionUtils transactionUtils = mock(TransactionUtils.class);
+ private PmDataBuilderOpenRoadm pmDataBuilderORoadm;
+ private NodeId nodeId = new NodeId("RoadmA");
+ private HistoricalPmList historicalPmDatalist = mock(HistoricalPmList.class);
+ private HistoricalPm historicalPm = mock(HistoricalPm.class);
+ private PmDataType pmDataType = new PmDataType(Uint64.valueOf(67508));
+ private MeasurementBuilder measurementBuilder = new MeasurementBuilder();
+ private HistoricalPmBuilder historicalPmBuilder = new HistoricalPmBuilder();
+ private HistoricalPmEntryBuilder historicalPmEntryBuiler = new HistoricalPmEntryBuilder();
+ private List<Class<? extends PerformanceMeasurementUnitId>> performanceMeasUnitList =
+ new ArrayList<Class<? extends PerformanceMeasurementUnitId>>();
+ private Map<MeasurementKey, Measurement> measurementData = new HashMap<MeasurementKey, Measurement>();
+ private Map<HistoricalPmKey, HistoricalPm> historicalPMCollection = new HashMap<HistoricalPmKey, HistoricalPm>();
+ private Map<HistoricalPmEntryKey, HistoricalPmEntry> historicalPmEntryCollection =
+ new HashMap<HistoricalPmEntryKey, HistoricalPmEntry>();
+
+ // end of variables
+
+ // public methods
+ @Before
+ public void init() {
+ when(acessor.getDataBroker()).thenReturn(dataBroker);
+ when(acessor.getTransactionUtils()).thenReturn(transactionUtils);
+
+
+
+ }
+
+ @Test
+ public void testGetPmData() {
+ when(acessor.getNodeId()).thenReturn(nodeId);
+ pmDataBuilderORoadm = new PmDataBuilderOpenRoadm(acessor);
+
+ final Class<HistoricalPmList> pmDataClass = HistoricalPmList.class;
+ InstanceIdentifier<HistoricalPmList> pmDataListId = InstanceIdentifier.builder(pmDataClass).build();
+ when(acessor.getTransactionUtils().readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ pmDataListId)).thenReturn(historicalPmDatalist);
+
+ assertEquals(historicalPmDatalist,pmDataBuilderORoadm.getPmData(acessor));
+
+ }
+
+ @Test
+ public void testBuildPmDataEntity() {
+ when(acessor.getNodeId()).thenReturn(nodeId);
+ pmDataBuilderORoadm = new PmDataBuilderOpenRoadm(acessor);
+
+ performanceMeasUnitList.add(Celsius.class);
+ measurementBuilder.setBinNumber(Uint16.valueOf(24657))
+ .setCompletionTime(new DateAndTime("2020-10-22T15:23:43Z")).setGranularity(PmGranularity._24Hour)
+ .setPmParameterUnit("dBm").setPmParameterValue(pmDataType).setValidity(Validity.Suspect);
+
+ measurementData.put(measurementBuilder.key(), measurementBuilder.build());
+ historicalPmBuilder.setType(PmNamesEnum.SeverelyErroredSeconds).setDirection(Direction.Bidirectional)
+ .setExtension("sajhsiwiduwugdhegdeuz").setLocation(Location.NearEnd).setMeasurement(measurementData);
+ when(historicalPm.getMeasurement()).thenReturn(measurementData);
+
+ historicalPMCollection.put(historicalPmBuilder.key(), historicalPmBuilder.build());
+ historicalPmEntryBuiler.setPmResourceTypeExtension("dshjdekjdewkk")
+ .setPmResourceType(ResourceTypeEnum.CircuitPack).setHistoricalPm(historicalPMCollection);
+
+ historicalPmEntryCollection.put(historicalPmEntryBuiler.key(), historicalPmEntryBuiler.build());
+ when(historicalPmDatalist.getHistoricalPmEntry()).thenReturn(historicalPmEntryCollection);
+
+ assertNotNull(pmDataBuilderORoadm.buildPmDataEntity(historicalPmDatalist));
+ }
+ @Test
+ public void testBuildPmDataEntity1() {
+ when(acessor.getNodeId()).thenReturn(nodeId);
+ pmDataBuilderORoadm = new PmDataBuilderOpenRoadm(acessor);
+
+ performanceMeasUnitList.add(Celsius.class);
+ measurementBuilder.setBinNumber(Uint16.valueOf(24657))
+ .setCompletionTime(new DateAndTime("2020-10-22T15:23:43Z")).setGranularity(PmGranularity._15min)
+ .setPmParameterUnit("celsius").setPmParameterValue(pmDataType).setValidity(Validity.Suspect);
+
+ measurementData.put(measurementBuilder.key(), measurementBuilder.build());
+ historicalPmBuilder.setType(PmNamesEnum.ErroredSeconds).setDirection(Direction.Rx)
+ .setExtension("sajhsiwiduwugdhegdeuz").setLocation(Location.FarEnd).setMeasurement(measurementData);
+ when(historicalPm.getMeasurement()).thenReturn(measurementData);
+
+ historicalPMCollection.put(historicalPmBuilder.key(), historicalPmBuilder.build());
+ historicalPmEntryBuiler.setPmResourceTypeExtension("dshjdekjdewkk")
+ .setPmResourceType(ResourceTypeEnum.Device).setHistoricalPm(historicalPMCollection);
+
+ historicalPmEntryCollection.put(historicalPmEntryBuiler.key(), historicalPmEntryBuiler.build());
+ when(historicalPmDatalist.getHistoricalPmEntry()).thenReturn(historicalPmEntryCollection);
+
+ assertNotNull(pmDataBuilderORoadm.buildPmDataEntity(historicalPmDatalist));
+ }
+ // end of public methods
+
+}
diff --git a/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenroadmNetworkElementBase.java b/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenroadmNetworkElementBase.java
new file mode 100644
index 000000000..58c95e746
--- /dev/null
+++ b/sdnr/wt/devicemanager-openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenroadmNetworkElementBase.java
@@ -0,0 +1,62 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
+ * All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ */
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.test;
+
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl.OpenroadmNetworkElementBase;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+public class TestOpenroadmNetworkElementBase {
+ // variables
+ private NetconfBindingAccessor netconfAccessor = mock(NetconfBindingAccessor.class);
+ private DeviceManagerServiceProvider deviceManagerSvcProvider = mock(DeviceManagerServiceProvider.class);
+ private DataProvider databaseService = mock(DataProvider.class);
+ private NodeId nodeId = new NodeId("RoadmA");
+ private OpenroadmNetworkElementBase openRoadmNetElementBase = new OpenroadmNetworkElementBase(netconfAccessor,deviceManagerSvcProvider);
+ // end of variables
+
+ // public methods
+ @Before
+ public void init() {
+
+ when(netconfAccessor.getNodeId()).thenReturn(nodeId);
+
+ }
+
+ @Test
+ public void testGetNodeId() {
+ assertNotNull(openRoadmNetElementBase.getNodeId());
+
+ }
+
+ @Test
+ public void testGetDeviceType() {
+ assertNotNull(openRoadmNetElementBase.getDeviceType());
+ }
+ // end of public methods
+}