summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager-onf14/provider/src/test
diff options
context:
space:
mode:
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2021-02-03 15:29:21 +0100
committerDan Timoney <dtimoney@att.com>2021-02-05 22:57:32 +0000
commitece5215df091114be3bffee073c8d3b0bc1ee1bc (patch)
tree0754b73eadae34a61df8703e3733cd237df56362 /sdnr/wt/devicemanager-onf14/provider/src/test
parentf2b7adc8df29246e154011293c7a4afdd242df60 (diff)
Migrate devicemanager-openroadm and devicemanager-onf14
Migrate devicemanager-openroadm and devicemanager-onf14 to Aluminium Issue-ID: CCSDK-3134 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> Change-Id: If5f7073d56c9a334e6a23cc0a2dd9b68e7f19512 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/devicemanager-onf14/provider/src/test')
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestDeviceManagerOnf14Impl.java1
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14AirInterfaceNotificationListener.java9
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14EthernetContainerNotificationListener.java17
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElement.java43
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElementFactory.java16
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14ToInternalDataModel2.java12
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14WireInterfaceNotificationListener.java9
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestSeverity.java80
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/test/mock/NetconfAccessorMock.java112
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/test/mock/TransactionUtilsMock.java44
10 files changed, 140 insertions, 203 deletions
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestDeviceManagerOnf14Impl.java b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestDeviceManagerOnf14Impl.java
index 8dbfa2f5c..4b69e4232 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestDeviceManagerOnf14Impl.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestDeviceManagerOnf14Impl.java
@@ -43,7 +43,6 @@ public class TestDeviceManagerOnf14Impl extends Mockito {
devMgrOnf14.setNetconfNetworkElementService(netconfElemService);
devMgrOnf14.init();
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14AirInterfaceNotificationListener.java b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14AirInterfaceNotificationListener.java
index 7dbbc22b3..d03d50c1a 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14AirInterfaceNotificationListener.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14AirInterfaceNotificationListener.java
@@ -23,12 +23,11 @@ import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.Onf14AirInterfaceNotificationListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.test.mock.NetconfAccessorMock;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14AirInterfaceNotificationListener;
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.devicemanager.service.NotificationService;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.AttributeValueChangedNotification;
import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.ObjectCreationNotification;
@@ -44,7 +43,7 @@ import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.Univ
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
public class TestOnf14AirInterfaceNotificationListener extends Mockito {
- private NetconfAccessor accessor;
+ private NetconfBindingAccessor accessor;
private NodeId nodeId;
private DeviceManagerServiceProvider serviceProvider;
private FaultService faultService;
@@ -58,7 +57,7 @@ public class TestOnf14AirInterfaceNotificationListener extends Mockito {
@Before
public void init() {
- accessor = mock(NetconfAccessorMock.class);
+ accessor = mock(NetconfBindingAccessor.class);
nodeId = mock(NodeId.class);
serviceProvider = mock(DeviceManagerServiceProvider.class);
faultService = mock(FaultService.class);
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14EthernetContainerNotificationListener.java b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14EthernetContainerNotificationListener.java
index dedcf79c8..f6f7d9045 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14EthernetContainerNotificationListener.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14EthernetContainerNotificationListener.java
@@ -23,12 +23,11 @@ import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.Onf14EthernetContainerNotificationListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.test.mock.NetconfAccessorMock;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14EthernetContainerNotificationListener;
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.devicemanager.service.NotificationService;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.UniversalId;
import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.AttributeValueChangedNotification;
@@ -44,7 +43,7 @@ import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
public class TestOnf14EthernetContainerNotificationListener extends Mockito {
- private NetconfAccessor accessor;
+ private NetconfBindingAccessor accessor;
private NodeId nodeId;
private DeviceManagerServiceProvider serviceProvider;
private FaultService faultService;
@@ -58,7 +57,7 @@ public class TestOnf14EthernetContainerNotificationListener extends Mockito {
@Before
public void init() {
- accessor = mock(NetconfAccessorMock.class);
+ accessor = mock(NetconfBindingAccessor.class);
nodeId = mock(NodeId.class);
serviceProvider = mock(DeviceManagerServiceProvider.class);
faultService = mock(FaultService.class);
@@ -71,23 +70,23 @@ public class TestOnf14EthernetContainerNotificationListener extends Mockito {
attrValChangedNotif = mock(AttributeValueChangedNotification.class);
when(accessor.getNodeId()).thenReturn(nodeId);
- when(problemNotif.getCounter()).thenReturn(new Long(10));
+ when(problemNotif.getCounter()).thenReturn(10L);
when(problemNotif.getTimestamp()).thenReturn(new DateAndTime("2020-02-05T12:30:45.283Z"));
when(problemNotif.getObjectIdRef()).thenReturn(new UniversalId("12345678-0123-0abc-abcd-0123456789AB"));
when(problemNotif.getProblem()).thenReturn("modulationIsDownShifted");
when(attrValChangedNotif.getAttributeName()).thenReturn("12345678-0123-2345-abcd-0123456789AB");
- when(attrValChangedNotif.getCounter()).thenReturn(new Long(20));
+ when(attrValChangedNotif.getCounter()).thenReturn(20L);
when(attrValChangedNotif.getNewValue()).thenReturn("new-value");
when(attrValChangedNotif.getObjectIdRef()).thenReturn(new UniversalId("12345678-0123-1234-abcd-0123456789AB"));
when(attrValChangedNotif.getTimestamp()).thenReturn(new DateAndTime("2020-02-05T12:30:45.283Z"));
when(creationNotif.getObjectType()).thenReturn("air-interface-name");
- when(creationNotif.getCounter()).thenReturn(new Long(20));
+ when(creationNotif.getCounter()).thenReturn(20L);
when(creationNotif.getObjectIdRef()).thenReturn(new UniversalId("12345678-0123-1234-abcd-0123456789AB"));
when(creationNotif.getTimestamp()).thenReturn(new DateAndTime("2020-02-05T12:30:45.283Z"));
- when(deletionNotif.getCounter()).thenReturn(new Long(20));
+ when(deletionNotif.getCounter()).thenReturn(20L);
when(deletionNotif.getObjectIdRef()).thenReturn(new UniversalId("12345678-0123-1234-abcd-0123456789AB"));
when(deletionNotif.getTimestamp()).thenReturn(new DateAndTime("2020-02-05T12:30:45.283Z"));
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElement.java b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElement.java
index d87e6d232..7a5658a4f 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElement.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElement.java
@@ -28,35 +28,36 @@ import org.mockito.Mockito;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.Onf14NetworkElementFactory;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.test.mock.NetconfAccessorMock;
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.NetconfDomAccessor;
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.mdsal.dom.api.DOMDataBroker;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.ControlConstruct;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.UniversalId;
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.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
public class TestOnf14NetworkElement extends Mockito {
- static NetconfAccessorMock accessor;
+ private static String NODEIDSTRING = "nSky";
+
+ static NetconfDomAccessor accessor;
static DeviceManagerServiceProvider serviceProvider;
static Capabilities capabilities;
- QName qCapability;
static DataProvider dataProvider;
static FaultService faultService;
- static DataBroker dataBroker;
+ static DOMDataBroker dataBroker;
static TransactionUtils transactionUtils;
static ControlConstruct controlConstruct;
@Before
public void init() {
capabilities = mock(Capabilities.class);
- accessor = mock(NetconfAccessorMock.class);
+ accessor = mock(NetconfDomAccessor.class);
serviceProvider = mock(DeviceManagerServiceProvider.class);
NodeId nNodeId = new NodeId("nSky");
@@ -69,17 +70,16 @@ public class TestOnf14NetworkElement extends Mockito {
faultService = mock(FaultService.class);
when(serviceProvider.getFaultService()).thenReturn(faultService);
- dataBroker = mock(DataBroker.class);
+ dataBroker = mock(DOMDataBroker.class);
when(accessor.getDataBroker()).thenReturn(dataBroker);
controlConstruct = mock(ControlConstruct.class);
- transactionUtils = mock(TransactionUtils.class);
- when(accessor.getTransactionUtils()).thenReturn(transactionUtils);
- InstanceIdentifier<ControlConstruct> CONTROLCONSTRUCT_IID =
- InstanceIdentifier.builder(ControlConstruct.class).build();
- when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.CONFIGURATION,
- CONTROLCONSTRUCT_IID)).thenReturn(controlConstruct);
+ YangInstanceIdentifier CONTROLCONSTRUCT_IID =
+ YangInstanceIdentifier.builder().node(ControlConstruct.QNAME).build();
+
+ when(accessor.readData(LogicalDatastoreType.CONFIGURATION, CONTROLCONSTRUCT_IID, ControlConstruct.class))
+ .thenReturn(Optional.of(controlConstruct));
List<UniversalId> topLevelEqList = null;
UniversalId uuid = new UniversalId("0Aabcdef-0abc-0cfD-0abC-0123456789AB");
@@ -91,10 +91,21 @@ public class TestOnf14NetworkElement extends Mockito {
@Test
public void testGeneric() {
Optional<NetworkElement> onfNe;
+ NodeId nodeId = new NodeId(NODEIDSTRING);
+ NetconfBindingAccessor bindingAccessor = mock(NetconfBindingAccessor.class);
+ when(bindingAccessor.getTransactionUtils()).thenReturn(mock(TransactionUtils.class));
+ when(bindingAccessor.getNodeId()).thenReturn(nodeId);
+
+ NetconfDomAccessor domAccessor = mock(NetconfDomAccessor.class);
+ when(domAccessor.getNodeId()).thenReturn(nodeId);
+
when(accessor.getCapabilites().isSupportingNamespace(ControlConstruct.QNAME)).thenReturn(true);
+ when(accessor.getNetconfBindingAccessor()).thenReturn(Optional.of(bindingAccessor));
+ when(accessor.getNetconfDomAccessor()).thenReturn(Optional.of(domAccessor));
+
Onf14NetworkElementFactory factory = new Onf14NetworkElementFactory();
onfNe = factory.create(accessor, serviceProvider);
- assertTrue(factory.create(accessor, serviceProvider).isPresent());
+ assertTrue(onfNe.isPresent());
onfNe.get().register();
onfNe.get().deregister();
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElementFactory.java b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElementFactory.java
index 59e57da11..4087607d1 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElementFactory.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElementFactory.java
@@ -19,20 +19,22 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
+import java.util.Optional;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.Onf14NetworkElementFactory;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.test.mock.NetconfAccessorMock;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
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.NetconfBindingAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.ControlConstruct;
import org.opendaylight.yangtools.yang.common.QName;
public class TestOnf14NetworkElementFactory extends Mockito {
- static NetconfAccessor accessor;
+ static NetconfBindingAccessor accessor;
static DeviceManagerServiceProvider serviceProvider;
static Capabilities capabilities;
QName qCapability;
@@ -40,16 +42,18 @@ public class TestOnf14NetworkElementFactory extends Mockito {
@BeforeClass
public static void init() throws InterruptedException, IOException {
capabilities = mock(Capabilities.class);
- accessor = mock(NetconfAccessorMock.class);
+ accessor = mock(NetconfBindingAccessor.class);
serviceProvider = mock(DeviceManagerServiceProvider.class);
when(accessor.getCapabilites()).thenReturn(capabilities);
- when(serviceProvider.getDataProvider()).thenReturn(null);
+ when(serviceProvider.getDataProvider()).thenReturn(mock(DataProvider.class));
}
@Test
public void testCreateOnf14Component() throws Exception {
when(accessor.getCapabilites().isSupportingNamespace(ControlConstruct.QNAME)).thenReturn(true);
+ when(accessor.getNetconfBindingAccessor()).thenReturn(Optional.of(mock(NetconfBindingAccessor.class)));
+ when(accessor.getNetconfDomAccessor()).thenReturn(Optional.of(mock(NetconfDomAccessor.class)));
Onf14NetworkElementFactory factory = new Onf14NetworkElementFactory();
assertTrue((factory.create(accessor, serviceProvider)).isPresent());
}
@@ -58,7 +62,7 @@ public class TestOnf14NetworkElementFactory extends Mockito {
public void testCreateNone() throws Exception {
when(accessor.getCapabilites().isSupportingNamespace(ControlConstruct.QNAME)).thenReturn(false);
Onf14NetworkElementFactory factory = new Onf14NetworkElementFactory();
- assertTrue(!(factory.create(accessor, serviceProvider).isPresent()));
+ assertTrue(factory.create(accessor, serviceProvider).isEmpty());
}
}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14ToInternalDataModel2.java b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14ToInternalDataModel2.java
index ca36f7946..b0b00d935 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14ToInternalDataModel2.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14ToInternalDataModel2.java
@@ -18,17 +18,19 @@
package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14;
import static org.junit.Assert.assertEquals;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.jdt.annotation.NonNull;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.Onf14ToInternalDataModel;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.dataprovider.Onf14ToInternalDataModel;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.Equipment;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.UniversalId;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.equipment.ActualEquipment;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.equipment.ContainedHolder;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.equipment.ContainedHolderKey;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.equipment.detail.ManufacturedThing;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.manufactured.thing.EquipmentInstance;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.manufactured.thing.EquipmentType;
@@ -65,8 +67,8 @@ public class TestOnf14ToInternalDataModel2 extends Mockito {
when(currentEq.getUuid()).thenReturn(new UniversalId("0Aabcdef-0abc-0cfD-0abC-0123456789AB"));
when(parentEq.getUuid()).thenReturn(new UniversalId("0Aabcdef-0123-0abc-abcd-0123456789AB"));
- List<ContainedHolder> containedHolderList = new ArrayList<ContainedHolder>();
- containedHolderList.add(holder);
+ @NonNull Map<ContainedHolderKey, ContainedHolder> containedHolderList = new HashMap<>();
+ containedHolderList.put(holder.key(),holder);
when(currentEq.nonnullContainedHolder()).thenReturn(containedHolderList);
}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14WireInterfaceNotificationListener.java b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14WireInterfaceNotificationListener.java
index 267e9a813..e1b13f118 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14WireInterfaceNotificationListener.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14WireInterfaceNotificationListener.java
@@ -23,12 +23,11 @@ import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.Onf14WireInterfaceNotificationListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.test.mock.NetconfAccessorMock;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14WireInterfaceNotificationListener;
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.devicemanager.service.NotificationService;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.UniversalId;
import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.AttributeValueChangedNotification;
@@ -44,7 +43,7 @@ import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
public class TestOnf14WireInterfaceNotificationListener extends Mockito {
- private NetconfAccessor accessor;
+ private NetconfBindingAccessor accessor;
private NodeId nodeId;
private DeviceManagerServiceProvider serviceProvider;
private FaultService faultService;
@@ -58,7 +57,7 @@ public class TestOnf14WireInterfaceNotificationListener extends Mockito {
@Before
public void init() {
- accessor = mock(NetconfAccessorMock.class);
+ accessor = mock(NetconfBindingAccessor.class);
nodeId = mock(NodeId.class);
serviceProvider = mock(DeviceManagerServiceProvider.class);
faultService = mock(FaultService.class);
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestSeverity.java b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestSeverity.java
new file mode 100644
index 000000000..686942a6b
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestSeverity.java
@@ -0,0 +1,80 @@
+/*
+ * ============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.onf14;
+
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14AirInterface;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14WireInterface;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType;
+
+public class TestSeverity extends Mockito {
+
+ @Test
+ public void test1_1() {
+ assertTrue(Onf14WireInterface.mapSeverity(
+ org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPECRITICAL.class)
+ .equals(SeverityType.Critical));
+ }
+
+ @Test
+ public void test1_2() {
+ assertTrue(Onf14WireInterface.mapSeverity(
+ org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPEWARNING.class)
+ .equals(SeverityType.Warning));
+ }
+
+ @Test
+ public void test1_3() {
+ assertTrue(Onf14WireInterface.mapSeverity(
+ org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPEMINOR.class)
+ .equals(SeverityType.Minor));
+ }
+
+ @Test
+ public void test1_4() {
+ assertTrue(Onf14WireInterface.mapSeverity(
+ org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPEMAJOR.class)
+ .equals(SeverityType.Major));
+ }
+
+ public void test2_1() {
+ assertTrue(Onf14AirInterface.mapSeverity(
+ org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.SEVERITYTYPECRITICAL.class)
+ .equals(SeverityType.Critical));
+ }
+
+ @Test
+ public void test2_2() {
+ assertTrue(Onf14AirInterface.mapSeverity(
+ org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.SEVERITYTYPEMINOR.class)
+ .equals(SeverityType.Minor));
+ }
+
+ @Test
+ public void test2_3() {
+ assertTrue(Onf14AirInterface.mapSeverity(null).equals(SeverityType.NonAlarmed));
+ }
+
+
+}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/test/mock/NetconfAccessorMock.java b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/test/mock/NetconfAccessorMock.java
deleted file mode 100644
index 832485410..000000000
--- a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/test/mock/NetconfAccessorMock.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * 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.onf14.test.mock;
-
-import com.google.common.util.concurrent.ListenableFuture;
-import java.util.List;
-import org.eclipse.jdt.annotation.NonNull;
-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.binding.api.MountPoint;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionOutput;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.Stream;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.NotificationListener;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-
-/**
- */
-public class NetconfAccessorMock implements NetconfAccessor {
-
- private final NodeId nNodeId;
- private final NetconfNode netconfNode;
- private final MountPoint mountpoint;
- private final DataBroker netconfNodeDataBroker;
-
- public NetconfAccessorMock(NodeId nNodeId, NetconfNode netconfNode, MountPoint mountpoint,
- DataBroker netconfNodeDataBroker) {
- this.nNodeId = nNodeId;
- this.netconfNode = netconfNode;
- this.mountpoint = mountpoint;
- this.netconfNodeDataBroker = netconfNodeDataBroker;
- }
-
- @Override
- public NodeId getNodeId() {
- return nNodeId;
- }
-
- @Override
- public NetconfNode getNetconfNode() {
- return netconfNode;
- }
-
- @Override
- public Capabilities getCapabilites() {
- return null;
- }
-
- @Override
- public DataBroker getDataBroker() {
- return netconfNodeDataBroker;
- }
-
- @Override
- public MountPoint getMountpoint() {
- return mountpoint;
- }
-
- @Override
- public TransactionUtils getTransactionUtils() {
- return null;
- }
-
- @Override
- public <T extends NotificationListener> ListenerRegistration<NotificationListener> doRegisterNotificationListener(
- @NonNull T listener) {
- return null;
- }
-
- @Override
- public ListenableFuture<RpcResult<CreateSubscriptionOutput>> registerNotificationsStream(String streamName) {
- return null;
- }
-
- @Override
- public void registerNotificationsStream(List<Stream> streamList) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public boolean isNCNotificationsSupported() {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public List<Stream> getNotificationStreams() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/test/mock/TransactionUtilsMock.java b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/test/mock/TransactionUtilsMock.java
deleted file mode 100644
index 9546ae9f9..000000000
--- a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/test/mock/TransactionUtilsMock.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * 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.onf14.test.mock;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
-import org.eclipse.jdt.annotation.Nullable;
-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.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class TransactionUtilsMock implements TransactionUtils {
-
- @Override
- public <T extends DataObject> @Nullable T readData(DataBroker dataBroker, LogicalDatastoreType dataStoreType,
- InstanceIdentifier<T> iid) {
- return null;
- }
-
- @Override
- public <T extends DataObject> @Nullable T readDataOptionalWithStatus(DataBroker dataBroker,
- LogicalDatastoreType dataStoreType, InstanceIdentifier<T> iid, AtomicBoolean noErrorIndication,
- AtomicReference<String> statusIndicator) {
- return null;
- }
-
-}