summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager-onap/openroadm
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/devicemanager-onap/openroadm')
-rwxr-xr-xsdnr/wt/devicemanager-onap/openroadm/installer/pom.xml4
-rw-r--r--sdnr/wt/devicemanager-onap/openroadm/provider/pom.xml4
-rw-r--r--sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java2
-rw-r--r--sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElementFactory.java2
-rw-r--r--sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/PmDataBuilderOpenRoadm.java3
-rw-r--r--sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmDeviceChangeNotification.java9
-rw-r--r--sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmInventory.java2
-rw-r--r--sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElement.java9
-rw-r--r--sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElementFactory.java38
-rw-r--r--sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmPMDataBuilder.java46
10 files changed, 69 insertions, 50 deletions
diff --git a/sdnr/wt/devicemanager-onap/openroadm/installer/pom.xml b/sdnr/wt/devicemanager-onap/openroadm/installer/pom.xml
index c07ce11f8..a6e085f18 100755
--- a/sdnr/wt/devicemanager-onap/openroadm/installer/pom.xml
+++ b/sdnr/wt/devicemanager-onap/openroadm/installer/pom.xml
@@ -44,7 +44,7 @@
<dependencies>
<dependency>
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <groupId>${project.groupId}</groupId>
<artifactId>${application.name}-feature</artifactId>
<version>${project.version}</version>
<type>xml</type>
@@ -57,7 +57,7 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <groupId>${project.groupId}</groupId>
<artifactId>${application.name}-provider</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/pom.xml b/sdnr/wt/devicemanager-onap/openroadm/provider/pom.xml
index 5f827df35..bb155162b 100644
--- a/sdnr/wt/devicemanager-onap/openroadm/provider/pom.xml
+++ b/sdnr/wt/devicemanager-onap/openroadm/provider/pom.xml
@@ -77,7 +77,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>sdnr-wt-devicemanager-onap-openroadm-model</artifactId>
<version>${project.version}</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
@@ -89,7 +88,8 @@
<groupId>${project.groupId}</groupId>
<artifactId>sdnr-wt-data-provider-model</artifactId>
<version>${project.version}</version>
- </dependency>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>sdnr-wt-netconfnode-state-service-model</artifactId>
diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java
index cc406d843..45490a8b7 100644
--- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java
+++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java
@@ -62,7 +62,7 @@ import org.slf4j.LoggerFactory;
public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase {
// variables
- private final long equipmentLevel = 1;
+ private final long equipmentLevel = 0;
private static final Logger log = LoggerFactory.getLogger(OpenroadmNetworkElement.class);
private Hashtable<String, Long> circuitPacksRecord;
private Hashtable<String, Long> shelfProvisionedcircuitPacks;
diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElementFactory.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElementFactory.java
index cc8eaa68e..f4f486578 100644
--- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElementFactory.java
+++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElementFactory.java
@@ -63,7 +63,7 @@ public class OpenroadmNetworkElementFactory implements NetworkElementFactory {
if (bindingAccessor.isPresent()) {
return Optional.of(new OpenroadmNetworkElementBase(bindingAccessor.get(), serviceProvider));
}
- }
+ }
return Optional.empty();
}
// end of public methods
diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/PmDataBuilderOpenRoadm.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/PmDataBuilderOpenRoadm.java
index f1fd4471f..b032348ca 100644
--- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/PmDataBuilderOpenRoadm.java
+++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/PmDataBuilderOpenRoadm.java
@@ -94,6 +94,9 @@ public class PmDataBuilderOpenRoadm {
// Build PM entity for writing into the database
public List<PmdataEntity> buildPmDataEntity(HistoricalPmList historicalPmEnitityList) {
List<PmdataEntity> pmEntitiyList = new ArrayList<>();
+ if(historicalPmEnitityList==null) {
+ return pmEntitiyList;
+ }
Collection<HistoricalPmEntry> pmDataEntryList =
YangHelper.getCollection(historicalPmEnitityList.getHistoricalPmEntry());
for (HistoricalPmEntry pmDataEntry : pmDataEntryList) {
diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmDeviceChangeNotification.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmDeviceChangeNotification.java
index a6d276d48..ca9ce351c 100644
--- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmDeviceChangeNotification.java
+++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmDeviceChangeNotification.java
@@ -21,6 +21,7 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.test;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -91,13 +92,7 @@ public class TestOpenRoadmDeviceChangeNotification {
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(ncTimeConverter.getTimeStamp()).build();
- verify(databaseService).writeEventLog(event);
+ verify(databaseService).writeEventLog(any(EventlogEntity.class));
}
/**
diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmInventory.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmInventory.java
index e856511e5..1924bc665 100644
--- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmInventory.java
+++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmInventory.java
@@ -66,7 +66,7 @@ public class TestOpenRoadmInventory {
.setMaxNumBin15minHistoricalPm(Uint16.valueOf(32)).setMaxNumBin24hourHistoricalPm(Uint16.valueOf(7))
.setOpenroadmVersion(OpenroadmVersionType._20).build();
- private OrgOpenroadmDevice device = mock(OrgOpenroadmDevice.class);;
+ private OrgOpenroadmDevice device = mock(OrgOpenroadmDevice.class);
private Shelves shelf = mock(Shelves.class);
private Interface interfaces = mock(Interface.class);
private CircuitPacks cp = mock(CircuitPacks.class);
diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElement.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElement.java
index f5b40d050..4119ff904 100644
--- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElement.java
+++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElement.java
@@ -29,7 +29,6 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.jdt.annotation.Nullable;
import org.junit.Before;
-import org.junit.Ignore;
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;
@@ -296,15 +295,15 @@ public class TestOpenRoadmNetworkElement {
}
-
-
- @Ignore
@Test
public void test() {
OpenroadmNetworkElement optionalNe = new OpenroadmNetworkElement(accessor, serviceProvider);
optionalNe.initialReadFromNetworkElement();
verify(dataprovider).writeInventory(accessor.getNodeId().getValue(),
- Arrays.asList(inventoryData.getInventoryData(Uint32.valueOf(1))));
+ Arrays.asList(inventoryData.getInventoryData(Uint32.valueOf(0)),
+ inventoryData.getShelvesInventory(shelf, Uint32.valueOf(1)),
+ inventoryData.getXponderInventory(xpdr, Uint32.valueOf(1)),
+ inventoryData.getCircuitPackInventory(cp3, Uint32.valueOf(2))));
}
}
diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElementFactory.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElementFactory.java
index 40a48c358..8d3bfd9fa 100644
--- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElementFactory.java
+++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElementFactory.java
@@ -28,7 +28,7 @@ import static org.mockito.Mockito.when;
import java.io.IOException;
import java.util.Optional;
import org.junit.After;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl.OpenroadmNetworkElementFactory;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
@@ -43,54 +43,56 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class TestOpenRoadmNetworkElementFactory {
- private static NetconfBindingAccessor accessor;
+ private static NetconfBindingAccessor bindingAccessor;
private static DeviceManagerServiceProvider serviceProvider;
private static Capabilities capabilities;
private static TransactionUtils transactionUtils;
private static DataBroker dataBroker;
- @BeforeClass
- public static void init() throws InterruptedException, IOException {
- accessor = mock(NetconfBindingAccessor.class);
+ @Before
+ public void init() throws InterruptedException, IOException {
+ bindingAccessor = mock(NetconfBindingAccessor.class);
capabilities = mock(Capabilities.class);
dataBroker = mock(DataBroker.class);
transactionUtils = mock(TransactionUtils.class);
serviceProvider = mock(DeviceManagerServiceProvider.class);
- when(accessor.getNodeId()).thenReturn(new NodeId("RoadmA2"));
- when(accessor.getCapabilites()).thenReturn(capabilities);
- when(accessor.getDataBroker()).thenReturn(dataBroker);
- when(accessor.getTransactionUtils()).thenReturn(transactionUtils);
- when(accessor.getNetconfBindingAccessor()).thenReturn(Optional.of(accessor));
+
+ when(bindingAccessor.getCapabilites()).thenReturn(capabilities);
+ when(bindingAccessor.getNetconfBindingAccessor()).thenReturn(Optional.of(bindingAccessor));
+ when(bindingAccessor.getNodeId()).thenReturn(new NodeId("RoadmA2"));
+ when(bindingAccessor.getNodeId()).thenReturn(new NodeId("RoadmA2"));
+ when(bindingAccessor.getDataBroker()).thenReturn(dataBroker);
+ when(bindingAccessor.getTransactionUtils()).thenReturn(transactionUtils);
when(serviceProvider.getDataProvider()).thenReturn(null);
final Class<OrgOpenroadmDevice> openRoadmDev = OrgOpenroadmDevice.class;
InstanceIdentifier<OrgOpenroadmDevice> deviceId = InstanceIdentifier.builder(openRoadmDev).build();
- when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ when(bindingAccessor.getTransactionUtils().readData(bindingAccessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
deviceId)).thenReturn(mock(OrgOpenroadmDevice.class));
- when(accessor.getTransactionUtils()).thenReturn(mock(TransactionUtils.class));
+ when(bindingAccessor.getTransactionUtils()).thenReturn(mock(TransactionUtils.class));
}
@Test
public void testCapabiltiesAvailable1() {
- when(accessor.getCapabilites().isSupportingNamespaceAndRevision(OrgOpenroadmDevice.QNAME)).thenReturn(true);
+ when(bindingAccessor.getCapabilites().isSupportingNamespaceAndRevision(OrgOpenroadmDevice.QNAME)).thenReturn(true);
OpenroadmNetworkElementFactory factory = new OpenroadmNetworkElementFactory();
- assertTrue((factory.create(accessor, serviceProvider)).isPresent());
+ assertTrue((factory.create(bindingAccessor, serviceProvider)).isPresent());
}
@Test
public void testCapabiltiesAvailable2() {
- when(accessor.getCapabilites().isSupportingNamespaceAndRevision("http://org/openroadm/device", "2018-10-19"))
+ when(bindingAccessor.getCapabilites().isSupportingNamespaceAndRevision("http://org/openroadm/device", "2018-10-19"))
.thenReturn(true);
OpenroadmNetworkElementFactory factory = new OpenroadmNetworkElementFactory();
- assertTrue((factory.create(accessor, serviceProvider)).isPresent());
+ assertTrue((factory.create(bindingAccessor, serviceProvider)).isPresent());
}
@Test
public void testCapabiltiesNotAvailable() throws Exception {
- when(accessor.getCapabilites().isSupportingNamespaceAndRevision(OrgOpenroadmDevice.QNAME)).thenReturn(false);
+ when(bindingAccessor.getCapabilites().isSupportingNamespaceAndRevision(OrgOpenroadmDevice.QNAME)).thenReturn(false);
OpenroadmNetworkElementFactory factory = new OpenroadmNetworkElementFactory();
- assertFalse(factory.create(accessor, serviceProvider).isPresent());
+ assertFalse(factory.create(bindingAccessor, serviceProvider).isPresent());
}
@After
diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmPMDataBuilder.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmPMDataBuilder.java
index 9d80e8f75..2a70ec7b6 100644
--- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmPMDataBuilder.java
+++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmPMDataBuilder.java
@@ -66,6 +66,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint64;
+
public class TestOpenRoadmPMDataBuilder {
// variables
// end of variables
@@ -87,16 +88,8 @@ public class TestOpenRoadmPMDataBuilder {
private Map<HistoricalPmKey, HistoricalPm> historicalPMCollection = new HashMap<HistoricalPmKey, HistoricalPm>();
private Map<HistoricalPmEntryKey, HistoricalPmEntry> historicalPmEntryCollection =
new HashMap<HistoricalPmEntryKey, HistoricalPmEntry>();
- private PathArgument pa =new PathArgument() {
- @Override
- public int compareTo(PathArgument o) {
- return 0;
- }
- @Override
- public @NonNull Class<? extends DataObject> getType() {
- return Pmdata15mEntity.class;
- }
- };
+
+
// public methods
@Before
@@ -138,8 +131,22 @@ public class TestOpenRoadmPMDataBuilder {
when(historicalPm.getMeasurement()).thenReturn(measurementData);
historicalPMCollection.put(historicalPmBuilder.key(), historicalPmBuilder.build());
+ PathArgument pa =new PathArgument() {
+
+ @Override
+ public int compareTo(PathArgument o) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public @NonNull Class<? extends DataObject> getType() {
+ // TODO Auto-generated method stub
+ return Pmdata15mEntity.class;
+ }
+ };
historicalPmEntryBuiler.setPmResourceInstance(InstanceIdentifier.create(Arrays.asList(pa)))
- .setPmResourceTypeExtension("dshjdekjdewkk")
+ .setPmResourceTypeExtension("dshjdekjdewkk")
.setPmResourceType(ResourceTypeEnum.CircuitPack).setHistoricalPm(historicalPMCollection);
historicalPmEntryCollection.put(historicalPmEntryBuiler.key(), historicalPmEntryBuiler.build());
@@ -161,10 +168,23 @@ public class TestOpenRoadmPMDataBuilder {
historicalPmBuilder.setType(PmNamesEnum.ErroredSeconds).setDirection(Direction.Rx)
.setExtension("sajhsiwiduwugdhegdeuz").setLocation(Location.FarEnd).setMeasurement(measurementData);
when(historicalPm.getMeasurement()).thenReturn(measurementData);
-
+ PathArgument pa =new PathArgument() {
+
+ @Override
+ public int compareTo(PathArgument o) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public Class<? extends DataObject> getType() {
+ // TODO Auto-generated method stub
+ return Pmdata15mEntity.class;
+ }
+ };
historicalPMCollection.put(historicalPmBuilder.key(), historicalPmBuilder.build());
historicalPmEntryBuiler.setPmResourceInstance(InstanceIdentifier.create(Arrays.asList(pa)))
- .setPmResourceTypeExtension("dshjdekjdewkk")
+ .setPmResourceTypeExtension("dshjdekjdewkk")
.setPmResourceType(ResourceTypeEnum.Device).setHistoricalPm(historicalPMCollection);
historicalPmEntryCollection.put(historicalPmEntryBuiler.key(), historicalPmEntryBuiler.build());