summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager-onap/onf14/provider/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/devicemanager-onap/onf14/provider/src/test')
-rw-r--r--sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestDeviceManagerOnf14Impl.java55
-rw-r--r--sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14AirInterfaceNotificationListener.java198
-rw-r--r--sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14EthernetContainerNotificationListener.java197
-rw-r--r--sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElement.java123
-rw-r--r--sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElementFactory.java71
-rw-r--r--sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14ToInternalDataModel2.java127
-rw-r--r--sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14WireInterfaceNotificationListener.java198
-rw-r--r--sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestSeverity.java80
-rw-r--r--sdnr/wt/devicemanager-onap/onf14/provider/src/test/resources/simplelogger.properties61
9 files changed, 1110 insertions, 0 deletions
diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestDeviceManagerOnf14Impl.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestDeviceManagerOnf14Impl.java
new file mode 100644
index 000000000..4b69e4232
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestDeviceManagerOnf14Impl.java
@@ -0,0 +1,55 @@
+/*
+ * ============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;
+
+import java.io.IOException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.DeviceManagerOnf14Impl;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService;
+
+public class TestDeviceManagerOnf14Impl extends Mockito {
+
+ DeviceManagerOnf14Impl devMgrOnf14;
+ private static NetconfNetworkElementService netconfElemService;
+
+ @Before
+ public void init() throws InterruptedException, IOException {
+ netconfElemService = mock(NetconfNetworkElementService.class);
+ }
+
+ @Test
+ public void test() throws Exception {
+ devMgrOnf14 = new DeviceManagerOnf14Impl();
+
+ try {
+ devMgrOnf14.setNetconfNetworkElementService(netconfElemService);
+ devMgrOnf14.init();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @After
+ public void cleanUp() throws Exception {
+ devMgrOnf14.close();
+ }
+
+}
diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14AirInterfaceNotificationListener.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14AirInterfaceNotificationListener.java
new file mode 100644
index 000000000..b9f1c2131
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14AirInterfaceNotificationListener.java
@@ -0,0 +1,198 @@
+/*
+ * ============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;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.junit.Before;
+import org.junit.Test;
+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.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.NetconfBindingAccessor;
+import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
+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;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.ObjectDeletionNotification;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.ProblemNotification;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.SEVERITYTYPE;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.SEVERITYTYPECRITICAL;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.SEVERITYTYPEMAJOR;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.SEVERITYTYPEMINOR;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.SEVERITYTYPENONALARMED;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.SEVERITYTYPEWARNING;
+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;
+
+public class TestOnf14AirInterfaceNotificationListener extends Mockito {
+ private NetconfBindingAccessor accessor;
+ private NodeId nodeId;
+ private DeviceManagerServiceProvider serviceProvider;
+ private FaultService faultService;
+ private DataProvider databaseService;
+ private NotificationService notificationService;
+
+ private ObjectDeletionNotification deletionNotif;
+ private ObjectCreationNotification creationNotif;
+ private ProblemNotification problemNotif;
+ private AttributeValueChangedNotification attrValChangedNotif;
+ private @NonNull WebsocketManagerService websocketService;
+
+ @Before
+ public void init() {
+ accessor = mock(NetconfBindingAccessor.class);
+ nodeId = mock(NodeId.class);
+ serviceProvider = mock(DeviceManagerServiceProvider.class);
+ faultService = mock(FaultService.class);
+ databaseService = mock(DataProvider.class);
+ notificationService = mock(NotificationService.class);
+ websocketService = mock(WebsocketManagerService.class);
+
+ problemNotif = mock(ProblemNotification.class);
+ deletionNotif = mock(ObjectDeletionNotification.class);
+ creationNotif = mock(ObjectCreationNotification.class);
+ attrValChangedNotif = mock(AttributeValueChangedNotification.class);
+
+ when(accessor.getNodeId()).thenReturn(nodeId);
+ when(problemNotif.getCounter()).thenReturn(10);
+ 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(20);
+ 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(20);
+ 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(20);
+ when(deletionNotif.getObjectIdRef()).thenReturn(new UniversalId("12345678-0123-1234-abcd-0123456789AB"));
+ when(deletionNotif.getTimestamp()).thenReturn(new DateAndTime("2020-02-05T12:30:45.283Z"));
+
+ when(serviceProvider.getFaultService()).thenReturn(faultService);
+ when(serviceProvider.getDataProvider()).thenReturn(databaseService);
+ when(serviceProvider.getNotificationService()).thenReturn(notificationService);
+ when(serviceProvider.getWebsocketService()).thenReturn(websocketService);
+ }
+
+ @Test
+ public void testOtherNotif() {
+ Onf14AirInterfaceNotificationListener notifListener =
+ new Onf14AirInterfaceNotificationListener(accessor, serviceProvider);
+
+ notifListener.onObjectDeletionNotification(deletionNotif);
+ notifListener.onObjectCreationNotification(creationNotif);
+ notifListener.onAttributeValueChangedNotification(attrValChangedNotif);
+ }
+
+ @Test
+ public void testProblemNotifCritical() {
+ Onf14AirInterfaceNotificationListener notifListener =
+ new Onf14AirInterfaceNotificationListener(accessor, serviceProvider);
+
+ when(problemNotif.getSeverity()).thenAnswer(new Answer<Class<? extends SEVERITYTYPE>>() {
+ @Override
+ public Class<? extends SEVERITYTYPE> answer(InvocationOnMock invocation) throws Throwable {
+ return SEVERITYTYPECRITICAL.class;
+ }
+ });
+
+ notifListener.onProblemNotification(problemNotif);
+ }
+
+ @Test
+ public void testProblemNotifMajor() {
+ Onf14AirInterfaceNotificationListener notifListener =
+ new Onf14AirInterfaceNotificationListener(accessor, serviceProvider);
+
+ when(problemNotif.getSeverity()).thenAnswer(new Answer<Class<? extends SEVERITYTYPE>>() {
+ @Override
+ public Class<? extends SEVERITYTYPE> answer(InvocationOnMock invocation) throws Throwable {
+ return SEVERITYTYPEMAJOR.class;
+ }
+ });
+
+ notifListener.onProblemNotification(problemNotif);
+ }
+
+ @Test
+ public void testProblemNotifMinor() {
+ Onf14AirInterfaceNotificationListener notifListener =
+ new Onf14AirInterfaceNotificationListener(accessor, serviceProvider);
+
+ when(problemNotif.getSeverity()).thenAnswer(new Answer<Class<? extends SEVERITYTYPE>>() {
+ @Override
+ public Class<? extends SEVERITYTYPE> answer(InvocationOnMock invocation) throws Throwable {
+ return SEVERITYTYPEMINOR.class;
+ }
+ });
+
+ notifListener.onProblemNotification(problemNotif);
+ }
+
+ @Test
+ public void testProblemNotifWarning() {
+ Onf14AirInterfaceNotificationListener notifListener =
+ new Onf14AirInterfaceNotificationListener(accessor, serviceProvider);
+
+ when(problemNotif.getSeverity()).thenAnswer(new Answer<Class<? extends SEVERITYTYPE>>() {
+ @Override
+ public Class<? extends SEVERITYTYPE> answer(InvocationOnMock invocation) throws Throwable {
+ return SEVERITYTYPEWARNING.class;
+ }
+ });
+
+ notifListener.onProblemNotification(problemNotif);
+ }
+
+ @Test
+ public void testProblemNotifNonalarmed() {
+ Onf14AirInterfaceNotificationListener notifListener =
+ new Onf14AirInterfaceNotificationListener(accessor, serviceProvider);
+
+ when(problemNotif.getSeverity()).thenAnswer(new Answer<Class<? extends SEVERITYTYPE>>() {
+ @Override
+ public Class<? extends SEVERITYTYPE> answer(InvocationOnMock invocation) throws Throwable {
+ return SEVERITYTYPENONALARMED.class;
+ }
+ });
+
+ notifListener.onProblemNotification(problemNotif);
+ }
+
+ @Test
+ public void testProblemNotifNull() {
+ Onf14AirInterfaceNotificationListener notifListener =
+ new Onf14AirInterfaceNotificationListener(accessor, serviceProvider);
+
+ when(problemNotif.getSeverity()).thenReturn(null);
+
+ notifListener.onProblemNotification(problemNotif);
+ }
+
+}
diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14EthernetContainerNotificationListener.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14EthernetContainerNotificationListener.java
new file mode 100644
index 000000000..09e44f47d
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14EthernetContainerNotificationListener.java
@@ -0,0 +1,197 @@
+/*
+ * ============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;
+
+import org.junit.Before;
+import org.junit.Test;
+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.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.NetconfBindingAccessor;
+import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
+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;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.ObjectCreationNotification;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.ObjectDeletionNotification;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.ProblemNotification;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.SEVERITYTYPE;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.SEVERITYTYPECRITICAL;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.SEVERITYTYPEMAJOR;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.SEVERITYTYPEMINOR;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.SEVERITYTYPENONALARMED;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.SEVERITYTYPEWARNING;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+
+public class TestOnf14EthernetContainerNotificationListener extends Mockito {
+ private NetconfBindingAccessor accessor;
+ private NodeId nodeId;
+ private DeviceManagerServiceProvider serviceProvider;
+ private FaultService faultService;
+ private DataProvider databaseService;
+ private NotificationService notificationService;
+
+ private ObjectDeletionNotification deletionNotif;
+ private ObjectCreationNotification creationNotif;
+ private ProblemNotification problemNotif;
+ private AttributeValueChangedNotification attrValChangedNotif;
+ private WebsocketManagerService websocketService;
+
+ @Before
+ public void init() {
+ accessor = mock(NetconfBindingAccessor.class);
+ nodeId = mock(NodeId.class);
+ serviceProvider = mock(DeviceManagerServiceProvider.class);
+ faultService = mock(FaultService.class);
+ databaseService = mock(DataProvider.class);
+ notificationService = mock(NotificationService.class);
+ websocketService = mock(WebsocketManagerService.class);
+
+ problemNotif = mock(ProblemNotification.class);
+ deletionNotif = mock(ObjectDeletionNotification.class);
+ creationNotif = mock(ObjectCreationNotification.class);
+ attrValChangedNotif = mock(AttributeValueChangedNotification.class);
+
+ when(accessor.getNodeId()).thenReturn(nodeId);
+ 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(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(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(20L);
+ when(deletionNotif.getObjectIdRef()).thenReturn(new UniversalId("12345678-0123-1234-abcd-0123456789AB"));
+ when(deletionNotif.getTimestamp()).thenReturn(new DateAndTime("2020-02-05T12:30:45.283Z"));
+
+ when(serviceProvider.getFaultService()).thenReturn(faultService);
+ when(serviceProvider.getDataProvider()).thenReturn(databaseService);
+ when(serviceProvider.getNotificationService()).thenReturn(notificationService);
+ when(serviceProvider.getWebsocketService()).thenReturn(websocketService);
+ }
+
+ @Test
+ public void testOtherNotif() {
+ Onf14EthernetContainerNotificationListener notifListener =
+ new Onf14EthernetContainerNotificationListener(accessor, serviceProvider);
+
+ notifListener.onObjectDeletionNotification(deletionNotif);
+ notifListener.onObjectCreationNotification(creationNotif);
+ notifListener.onAttributeValueChangedNotification(attrValChangedNotif);
+ }
+
+ @Test
+ public void testProblemNotifCritical() {
+ Onf14EthernetContainerNotificationListener notifListener =
+ new Onf14EthernetContainerNotificationListener(accessor, serviceProvider);
+
+ when(problemNotif.getSeverity()).thenAnswer(new Answer<Class<? extends SEVERITYTYPE>>() {
+ @Override
+ public Class<? extends SEVERITYTYPE> answer(InvocationOnMock invocation) throws Throwable {
+ return SEVERITYTYPECRITICAL.class;
+ }
+ });
+
+ notifListener.onProblemNotification(problemNotif);
+ }
+
+ @Test
+ public void testProblemNotifMajor() {
+ Onf14EthernetContainerNotificationListener notifListener =
+ new Onf14EthernetContainerNotificationListener(accessor, serviceProvider);
+
+ when(problemNotif.getSeverity()).thenAnswer(new Answer<Class<? extends SEVERITYTYPE>>() {
+ @Override
+ public Class<? extends SEVERITYTYPE> answer(InvocationOnMock invocation) throws Throwable {
+ return SEVERITYTYPEMAJOR.class;
+ }
+ });
+
+ notifListener.onProblemNotification(problemNotif);
+ }
+
+ @Test
+ public void testProblemNotifMinor() {
+ Onf14EthernetContainerNotificationListener notifListener =
+ new Onf14EthernetContainerNotificationListener(accessor, serviceProvider);
+
+ when(problemNotif.getSeverity()).thenAnswer(new Answer<Class<? extends SEVERITYTYPE>>() {
+ @Override
+ public Class<? extends SEVERITYTYPE> answer(InvocationOnMock invocation) throws Throwable {
+ return SEVERITYTYPEMINOR.class;
+ }
+ });
+
+ notifListener.onProblemNotification(problemNotif);
+ }
+
+ @Test
+ public void testProblemNotifWarning() {
+ Onf14EthernetContainerNotificationListener notifListener =
+ new Onf14EthernetContainerNotificationListener(accessor, serviceProvider);
+
+ when(problemNotif.getSeverity()).thenAnswer(new Answer<Class<? extends SEVERITYTYPE>>() {
+ @Override
+ public Class<? extends SEVERITYTYPE> answer(InvocationOnMock invocation) throws Throwable {
+ return SEVERITYTYPEWARNING.class;
+ }
+ });
+
+ notifListener.onProblemNotification(problemNotif);
+ }
+
+ @Test
+ public void testProblemNotifNonalarmed() {
+ Onf14EthernetContainerNotificationListener notifListener =
+ new Onf14EthernetContainerNotificationListener(accessor, serviceProvider);
+
+ when(problemNotif.getSeverity()).thenAnswer(new Answer<Class<? extends SEVERITYTYPE>>() {
+ @Override
+ public Class<? extends SEVERITYTYPE> answer(InvocationOnMock invocation) throws Throwable {
+ return SEVERITYTYPENONALARMED.class;
+ }
+ });
+
+ notifListener.onProblemNotification(problemNotif);
+ }
+
+ @Test
+ public void testProblemNotifNull() {
+ Onf14EthernetContainerNotificationListener notifListener =
+ new Onf14EthernetContainerNotificationListener(accessor, serviceProvider);
+
+ when(problemNotif.getSeverity()).thenReturn(null);
+
+ notifListener.onProblemNotification(problemNotif);
+ }
+
+}
diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElement.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElement.java
new file mode 100644
index 000000000..30b4c9b1a
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElement.java
@@ -0,0 +1,123 @@
+/*
+ * ============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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Optional;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
+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.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.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.data.api.YangInstanceIdentifier;
+
+public class TestOnf14NetworkElement extends Mockito {
+
+ private static String NODEIDSTRING = "nSky";
+
+ static NetconfDomAccessor accessor;
+ static DeviceManagerServiceProvider serviceProvider;
+ static Capabilities capabilities;
+ static DataProvider dataProvider;
+ static FaultService faultService;
+ static DOMDataBroker dataBroker;
+ static TransactionUtils transactionUtils;
+ static ControlConstruct controlConstruct;
+
+ @Before
+ public void init() {
+ capabilities = mock(Capabilities.class);
+ accessor = mock(NetconfDomAccessor.class);
+ serviceProvider = mock(DeviceManagerServiceProvider.class);
+
+ NodeId nNodeId = new NodeId("nSky");
+ when(accessor.getCapabilites()).thenReturn(capabilities);
+ when(accessor.getNodeId()).thenReturn(nNodeId);
+
+ dataProvider = mock(DataProvider.class);
+ when(serviceProvider.getDataProvider()).thenReturn(dataProvider);
+
+ faultService = mock(FaultService.class);
+ when(serviceProvider.getFaultService()).thenReturn(faultService);
+
+ dataBroker = mock(DOMDataBroker.class);
+ when(accessor.getDataBroker()).thenReturn(dataBroker);
+
+ controlConstruct = mock(ControlConstruct.class);
+
+ 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");
+ topLevelEqList = Arrays.asList(uuid);
+
+ when(Optional.of(controlConstruct).get().getTopLevelEquipment()).thenReturn(topLevelEqList);
+ }
+
+ @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));
+
+ ConfigurationFileRepresentation configurationRepresentation = mock(ConfigurationFileRepresentation.class);
+ when(serviceProvider.getConfigurationFileRepresentation()).thenReturn(configurationRepresentation);
+
+ Onf14NetworkElementFactory factory = new Onf14NetworkElementFactory();
+ onfNe = factory.create(accessor, serviceProvider);
+ assertTrue(onfNe.isPresent());
+
+ onfNe.get().register();
+ onfNe.get().deregister();
+ onfNe.get().getAcessor();
+ onfNe.get().getDeviceType();
+ onfNe.get().warmstart();
+ onfNe.get().getService(null);
+ assertEquals(onfNe.get().getNodeId().getValue(), "nSky");
+ }
+
+}
diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElementFactory.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElementFactory.java
new file mode 100644
index 000000000..f9041eb80
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElementFactory.java
@@ -0,0 +1,71 @@
+/*
+ * ============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;
+
+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.common.configuration.ConfigurationFileRepresentation;
+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.service.DeviceManagerServiceProvider;
+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.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.ControlConstruct;
+
+public class TestOnf14NetworkElementFactory extends Mockito {
+
+ private static NetconfBindingAccessor accessor;
+ private static Capabilities capabilities;
+ private static DeviceManagerServiceProvider serviceProvider;
+ private static ConfigurationFileRepresentation configurationRepresentation;
+
+
+ @BeforeClass
+ public static void init() throws InterruptedException, IOException {
+ capabilities = mock(Capabilities.class);
+ accessor = mock(NetconfBindingAccessor.class);
+ serviceProvider = mock(DeviceManagerServiceProvider.class);
+ configurationRepresentation = mock(ConfigurationFileRepresentation.class);
+
+ when(accessor.getCapabilites()).thenReturn(capabilities);
+ when(serviceProvider.getDataProvider()).thenReturn(mock(DataProvider.class));
+ when(serviceProvider.getConfigurationFileRepresentation()).thenReturn(configurationRepresentation);
+ }
+
+ @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());
+ }
+
+ @Test
+ public void testCreateNone() throws Exception {
+ when(accessor.getCapabilites().isSupportingNamespace(ControlConstruct.QNAME)).thenReturn(false);
+ Onf14NetworkElementFactory factory = new Onf14NetworkElementFactory();
+ assertTrue(factory.create(accessor, serviceProvider).isEmpty());
+ }
+}
+
diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14ToInternalDataModel2.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14ToInternalDataModel2.java
new file mode 100644
index 000000000..b0b00d935
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14ToInternalDataModel2.java
@@ -0,0 +1,127 @@
+/*
+ * ============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;
+
+import static org.junit.Assert.assertEquals;
+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.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;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.manufactured.thing.ManufacturerProperties;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+
+public class TestOnf14ToInternalDataModel2 extends Mockito {
+
+ private static NodeId nodeId;
+ private static Equipment currentEq;
+ private static Equipment parentEq;
+ private static ActualEquipment component;
+ private static ContainedHolder holder;
+ private static ManufacturedThing manThing;
+ private static ManufacturerProperties manProperties;
+ private static EquipmentInstance eqInstance;
+ private static EquipmentType eqType;
+
+ @BeforeClass
+ public static void init() {
+ nodeId = mock(NodeId.class);
+ currentEq = mock(Equipment.class);
+ parentEq = mock(Equipment.class);
+ component = mock(ActualEquipment.class);
+ holder = mock(ContainedHolder.class);
+ manThing = mock(ManufacturedThing.class);
+ manProperties = mock(ManufacturerProperties.class);
+ eqInstance = mock(EquipmentInstance.class);
+ eqType = mock(EquipmentType.class);
+
+ when(nodeId.getValue()).thenReturn("CoreModel-1-4-node");
+
+ when(component.getLocalId()).thenReturn("actLocalEq");
+ when(currentEq.getUuid()).thenReturn(new UniversalId("0Aabcdef-0abc-0cfD-0abC-0123456789AB"));
+ when(parentEq.getUuid()).thenReturn(new UniversalId("0Aabcdef-0123-0abc-abcd-0123456789AB"));
+
+ @NonNull Map<ContainedHolderKey, ContainedHolder> containedHolderList = new HashMap<>();
+ containedHolderList.put(holder.key(),holder);
+ when(currentEq.nonnullContainedHolder()).thenReturn(containedHolderList);
+
+ }
+
+ @Test
+ public void test1() {
+
+ Onf14ToInternalDataModel model = new Onf14ToInternalDataModel();
+
+ when(currentEq.getActualEquipment()).thenReturn(component);
+ when(holder.getOccupyingFru()).thenReturn(new UniversalId("12345678-0123-0abc-abcd-0123456789AB"));
+ when(component.getManufacturedThing()).thenReturn(manThing);
+ when(manThing.getManufacturerProperties()).thenReturn(manProperties);
+ when(manThing.getEquipmentInstance()).thenReturn(eqInstance);
+ when(eqInstance.getManufactureDate()).thenReturn(new DateAndTime("2020-02-05T12:30:45.283Z"));
+ when(manThing.getEquipmentType()).thenReturn(eqType);
+
+ model.getInternalEquipment(nodeId, currentEq, parentEq, 0);
+ assertEquals(currentEq.getActualEquipment().getLocalId(), "actLocalEq");
+ }
+
+ @Test
+ public void test2() {
+
+ Onf14ToInternalDataModel model = new Onf14ToInternalDataModel();
+
+ when(holder.getOccupyingFru()).thenReturn(null);
+ when(component.getManufacturedThing()).thenReturn(null);
+ when(manThing.getManufacturerProperties()).thenReturn(null);
+ when(manThing.getEquipmentInstance()).thenReturn(null);
+ when(manThing.getEquipmentType()).thenReturn(null);
+
+ model.getInternalEquipment(nodeId, currentEq, null, 0);
+ }
+
+
+ @Test
+ public void test3() {
+ Onf14ToInternalDataModel model = new Onf14ToInternalDataModel();
+
+ when(component.getManufacturedThing()).thenReturn(manThing);
+ when(manThing.getManufacturerProperties()).thenReturn(null);
+ when(manThing.getEquipmentInstance()).thenReturn(null);
+ when(manThing.getEquipmentType()).thenReturn(null);
+
+ model.getInternalEquipment(nodeId, currentEq, null, 0);
+ }
+
+ @Test
+ public void test4() {
+ Onf14ToInternalDataModel model = new Onf14ToInternalDataModel();
+
+ when(currentEq.getActualEquipment()).thenReturn(null);
+ model.getInternalEquipment(nodeId, currentEq, null, 0);
+ }
+}
diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14WireInterfaceNotificationListener.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14WireInterfaceNotificationListener.java
new file mode 100644
index 000000000..e64847b91
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14WireInterfaceNotificationListener.java
@@ -0,0 +1,198 @@
+/*
+ * ============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;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.junit.Before;
+import org.junit.Test;
+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.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.NetconfBindingAccessor;
+import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
+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;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.ObjectCreationNotification;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.ObjectDeletionNotification;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.ProblemNotification;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPE;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPECRITICAL;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPEMAJOR;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPEMINOR;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPENONALARMED;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPEWARNING;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+
+public class TestOnf14WireInterfaceNotificationListener extends Mockito {
+ private NetconfBindingAccessor accessor;
+ private NodeId nodeId;
+ private DeviceManagerServiceProvider serviceProvider;
+ private FaultService faultService;
+ private DataProvider databaseService;
+ private NotificationService notificationService;
+
+ private ObjectDeletionNotification deletionNotif;
+ private ObjectCreationNotification creationNotif;
+ private ProblemNotification problemNotif;
+ private AttributeValueChangedNotification attrValChangedNotif;
+ private @NonNull WebsocketManagerService websocketService;
+
+ @Before
+ public void init() {
+ accessor = mock(NetconfBindingAccessor.class);
+ nodeId = mock(NodeId.class);
+ serviceProvider = mock(DeviceManagerServiceProvider.class);
+ faultService = mock(FaultService.class);
+ databaseService = mock(DataProvider.class);
+ notificationService = mock(NotificationService.class);
+ websocketService = mock(WebsocketManagerService.class);
+
+ problemNotif = mock(ProblemNotification.class);
+ deletionNotif = mock(ObjectDeletionNotification.class);
+ creationNotif = mock(ObjectCreationNotification.class);
+ attrValChangedNotif = mock(AttributeValueChangedNotification.class);
+
+ when(accessor.getNodeId()).thenReturn(nodeId);
+ when(problemNotif.getCounter()).thenReturn(10);
+ 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(20);
+ 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(20);
+ 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(20);
+ when(deletionNotif.getObjectIdRef()).thenReturn(new UniversalId("12345678-0123-1234-abcd-0123456789AB"));
+ when(deletionNotif.getTimestamp()).thenReturn(new DateAndTime("2020-02-05T12:30:45.283Z"));
+
+ when(serviceProvider.getFaultService()).thenReturn(faultService);
+ when(serviceProvider.getDataProvider()).thenReturn(databaseService);
+ when(serviceProvider.getNotificationService()).thenReturn(notificationService);
+ when(serviceProvider.getWebsocketService()).thenReturn(websocketService);
+ }
+
+ @Test
+ public void testOtherNotif() {
+ Onf14WireInterfaceNotificationListener notifListener =
+ new Onf14WireInterfaceNotificationListener(accessor, serviceProvider);
+
+ notifListener.onObjectDeletionNotification(deletionNotif);
+ notifListener.onObjectCreationNotification(creationNotif);
+ notifListener.onAttributeValueChangedNotification(attrValChangedNotif);
+ }
+
+ @Test
+ public void testProblemNotifCritical() {
+ Onf14WireInterfaceNotificationListener notifListener =
+ new Onf14WireInterfaceNotificationListener(accessor, serviceProvider);
+
+ when(problemNotif.getSeverity()).thenAnswer(new Answer<Class<? extends SEVERITYTYPE>>() {
+ @Override
+ public Class<? extends SEVERITYTYPE> answer(InvocationOnMock invocation) throws Throwable {
+ return SEVERITYTYPECRITICAL.class;
+ }
+ });
+
+ notifListener.onProblemNotification(problemNotif);
+ }
+
+ @Test
+ public void testProblemNotifMajor() {
+ Onf14WireInterfaceNotificationListener notifListener =
+ new Onf14WireInterfaceNotificationListener(accessor, serviceProvider);
+
+ when(problemNotif.getSeverity()).thenAnswer(new Answer<Class<? extends SEVERITYTYPE>>() {
+ @Override
+ public Class<? extends SEVERITYTYPE> answer(InvocationOnMock invocation) throws Throwable {
+ return SEVERITYTYPEMAJOR.class;
+ }
+ });
+
+ notifListener.onProblemNotification(problemNotif);
+ }
+
+ @Test
+ public void testProblemNotifMinor() {
+ Onf14WireInterfaceNotificationListener notifListener =
+ new Onf14WireInterfaceNotificationListener(accessor, serviceProvider);
+
+ when(problemNotif.getSeverity()).thenAnswer(new Answer<Class<? extends SEVERITYTYPE>>() {
+ @Override
+ public Class<? extends SEVERITYTYPE> answer(InvocationOnMock invocation) throws Throwable {
+ return SEVERITYTYPEMINOR.class;
+ }
+ });
+
+ notifListener.onProblemNotification(problemNotif);
+ }
+
+ @Test
+ public void testProblemNotifWarning() {
+ Onf14WireInterfaceNotificationListener notifListener =
+ new Onf14WireInterfaceNotificationListener(accessor, serviceProvider);
+
+ when(problemNotif.getSeverity()).thenAnswer(new Answer<Class<? extends SEVERITYTYPE>>() {
+ @Override
+ public Class<? extends SEVERITYTYPE> answer(InvocationOnMock invocation) throws Throwable {
+ return SEVERITYTYPEWARNING.class;
+ }
+ });
+
+ notifListener.onProblemNotification(problemNotif);
+ }
+
+ @Test
+ public void testProblemNotifNonalarmed() {
+ Onf14WireInterfaceNotificationListener notifListener =
+ new Onf14WireInterfaceNotificationListener(accessor, serviceProvider);
+
+ when(problemNotif.getSeverity()).thenAnswer(new Answer<Class<? extends SEVERITYTYPE>>() {
+ @Override
+ public Class<? extends SEVERITYTYPE> answer(InvocationOnMock invocation) throws Throwable {
+ return SEVERITYTYPENONALARMED.class;
+ }
+ });
+
+ notifListener.onProblemNotification(problemNotif);
+ }
+
+ @Test
+ public void testProblemNotifNull() {
+ Onf14WireInterfaceNotificationListener notifListener =
+ new Onf14WireInterfaceNotificationListener(accessor, serviceProvider);
+
+ when(problemNotif.getSeverity()).thenReturn(null);
+
+ notifListener.onProblemNotification(problemNotif);
+ }
+
+}
diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestSeverity.java b/sdnr/wt/devicemanager-onap/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-onap/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-onap/onf14/provider/src/test/resources/simplelogger.properties b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/resources/simplelogger.properties
new file mode 100644
index 000000000..9af26dc96
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/resources/simplelogger.properties
@@ -0,0 +1,61 @@
+#
+# ============LICENSE_START=======================================================
+# ONAP : ccsdk features
+# ================================================================================
+# Copyright (C) 2020 AT&T 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=======================================================
+#
+#
+
+# SLF4J's SimpleLogger configuration file
+# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err.
+
+# Default logging detail level for all instances of SimpleLogger.
+# Must be one of ("trace", "debug", "info", "warn", or "error").
+# If not specified, defaults to "info".
+org.slf4j.simpleLogger.defaultLogLevel=info
+
+# Logging detail level for a SimpleLogger instance named "xxx.yyy.zzz".
+# Must be one of ("trace", "debug", "info", "warn", or "error").
+# If not specified, the default logging detail level is used.
+# org.slf4j.simpleLogger.log.xxx.yyy=debug
+org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager=info
+org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.test=debug
+org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.database=debug
+org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice=info
+org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.Resources=info
+org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container=info
+
+# Set to true if you want the current date and time to be included in output messages.
+# Default is false, and will output the number of milliseconds elapsed since startup.
+#org.slf4j.simpleLogger.showDateTime=false
+
+# The date and time format to be used in the output messages.
+# The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat.
+# If the format is not specified or is invalid, the default format is used.
+# The default format is yyyy-MM-dd HH:mm:ss:SSS Z.
+#org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z
+
+# Set to true if you want to output the current thread name.
+# Defaults to true.
+#org.slf4j.simpleLogger.showThreadName=true
+
+# Set to true if you want the Logger instance name to be included in output messages.
+# Defaults to true.
+#org.slf4j.simpleLogger.showLogName=true
+
+# Set to true if you want the last component of the name to be included in output messages.
+# Defaults to false.
+#org.slf4j.simpleLogger.showShortLogName=false