aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager-onap/onf12/provider/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/devicemanager-onap/onf12/provider/src/test')
-rw-r--r--sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/TestSerializer.java53
-rw-r--r--sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestExtendedEquipment.java81
-rw-r--r--sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestONFCoreNetworkElement12Equipment.java101
-rw-r--r--sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestHelper.java49
-rw-r--r--sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java342
-rw-r--r--sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java339
-rw-r--r--sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java343
-rw-r--r--sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/test/TestWrapperPTPModelRev170208.java93
-rw-r--r--sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/test/TestONFCoreNetworkElementFactory.java127
-rw-r--r--sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java98
-rw-r--r--sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Microwave.java113
-rw-r--r--sdnr/wt/devicemanager-onap/onf12/provider/src/test/resources/simplelogger.properties61
12 files changed, 1800 insertions, 0 deletions
diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/TestSerializer.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/TestSerializer.java
new file mode 100644
index 000000000..d4c587b6d
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/TestSerializer.java
@@ -0,0 +1,53 @@
+/*
+ * ============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.onf;
+
+import static org.junit.Assert.fail;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapper;
+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.params.xml.ns.yang.core.model.rev170320.UniversalId;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ProblemNotification;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ProblemNotificationBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.SeverityType;
+
+public class TestSerializer {
+
+ @Test
+ public void testProblemNotification() {
+ ProblemNotification notification = new ProblemNotificationBuilder().setCounter(32)
+ .setObjectIdRef(new UniversalId("abc")).setProblem("problem").setSeverity(SeverityType.Critical)
+ .setTimeStamp(DateAndTime.getDefaultInstance("2020-01-01T01:01:02.0Z")).build();
+
+
+ YangToolsMapper mapper = new YangToolsMapper();
+ String result=null;
+ try {
+ result = mapper.writeValueAsString(notification);
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ System.out.println(result);
+ }
+}
diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestExtendedEquipment.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestExtendedEquipment.java
new file mode 100644
index 000000000..20d479efa
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestExtendedEquipment.java
@@ -0,0 +1,81 @@
+/*
+ * ============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.onf.ifpac.equipment.test;
+
+import static org.junit.Assert.*;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.WrapperPTPModelRev170208;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.equipment.ExtendedEquipment;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.Equipment;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.EquipmentBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ContainedHolder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ContainedHolderBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ManufacturedThing;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ManufacturedThingBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.EquipmentInstance;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.EquipmentInstanceBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.EquipmentType;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.EquipmentTypeBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.ManufacturerProperties;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.ManufacturerPropertiesBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TestExtendedEquipment {
+
+ UniversalId id = new UniversalId("1234567");
+ private static final String NODEID = "NODE1";
+ private static final Logger LOG = LoggerFactory.getLogger(TestExtendedEquipment.class);
+
+ @Test
+ public void test() {
+ final @NonNull List<ContainedHolder> holder = Arrays.asList(new ContainedHolderBuilder().setUuid(id).build());
+ final @NonNull ManufacturerProperties manufacturerProps = new ManufacturerPropertiesBuilder()
+ .setManufacturerIdentifier("NOK").setManufacturerName("Nokia").build();
+
+ final @NonNull EquipmentType eqptType =
+ new EquipmentTypeBuilder().setDescription("5G RAN Equipment").setModelIdentifier("NOK-987-1T")
+ .setPartTypeIdentifier("ABCDEF").setTypeName("12345").setVersion("5T9V4567").build();
+
+ final @NonNull EquipmentInstance eqptInstance =
+ new EquipmentInstanceBuilder().setAssetInstanceIdentifier("NOK1234-ABCD")
+ .setManufactureDate("2020-02-11").setSerialNumber("123456ABCD").build();
+
+ final @NonNull ManufacturedThing manufacturedThing =
+ new ManufacturedThingBuilder().setManufacturerProperties(manufacturerProps).setEquipmentType(eqptType)
+ .setEquipmentInstance(eqptInstance).build();
+
+ Equipment equipment = new EquipmentBuilder().setUuid(id).setContainedHolder(holder)
+ .setManufacturedThing(manufacturedThing).build();
+
+ ExtendedEquipment extEqpt = new ExtendedEquipment(NODEID, "1234567890", equipment, "/var/opt", 3);
+ assertEquals(extEqpt.getNodeId(), NODEID);
+ assertEquals(extEqpt.getParentUuid(), "1234567890");
+ assertEquals(extEqpt.getEquipment(), equipment);
+ LOG.info(extEqpt.toString());
+ extEqpt.getCreateInventoryInput();
+
+ }
+
+}
diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestONFCoreNetworkElement12Equipment.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestONFCoreNetworkElement12Equipment.java
new file mode 100644
index 000000000..30cd7647a
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestONFCoreNetworkElement12Equipment.java
@@ -0,0 +1,101 @@
+/*
+ * ============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.onf.ifpac.equipment.test;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.NetworkElementCoreData;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.equipment.ONFCoreNetworkElement12Equipment;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.equipment.WrapperEquipmentPacRev170402;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.EquipmentPac;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.EquipmentPacKey;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.equipment.pac.EquipmentCurrentProblems;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class TestONFCoreNetworkElement12Equipment {
+
+ NetconfBindingAccessor netconfAccessor;
+ Capabilities capabilities;
+ NetworkElementCoreData coreData;
+ FaultData faultData;
+ TransactionUtils transactionUtils;
+ EquipmentCurrentProblems eqptCurrProblems;
+ DataBroker dataBroker;
+ UniversalId uid = new UniversalId("ID");
+
+
+ @Before
+ public void init() throws Exception {
+ netconfAccessor = mock(NetconfBindingAccessor.class);
+ capabilities = mock(Capabilities.class);
+ coreData = mock(NetworkElementCoreData.class);
+ faultData = mock(FaultData.class);
+ eqptCurrProblems = mock(EquipmentCurrentProblems.class);
+ dataBroker = mock(DataBroker.class);
+ transactionUtils = mock(TransactionUtils.class);
+
+ final Class<EquipmentPac> clazzPac = EquipmentPac.class;
+ final Class<EquipmentPacKey> clazzPacKey = EquipmentPacKey.class;
+ final Class<EquipmentCurrentProblems> clazzProblems = EquipmentCurrentProblems.class;
+ Constructor<EquipmentPacKey> cons = clazzPacKey.getConstructor(UniversalId.class);
+ InstanceIdentifier<EquipmentCurrentProblems> interfaceIID =
+ InstanceIdentifier.builder(clazzPac, cons.newInstance(uid)).child(clazzProblems).build();
+ when(netconfAccessor.getCapabilites()).thenReturn(capabilities);
+ when(netconfAccessor.getTransactionUtils()).thenReturn(transactionUtils);
+ when(netconfAccessor.getDataBroker()).thenReturn(dataBroker);
+ when(netconfAccessor.getTransactionUtils().readData(netconfAccessor.getDataBroker(),
+ LogicalDatastoreType.OPERATIONAL, interfaceIID)).thenReturn(eqptCurrProblems);
+ }
+
+ @Test
+ public void test() {
+ when(capabilities.isSupportingNamespaceAndRevision(WrapperEquipmentPacRev170402.QNAME)).thenReturn(true);
+ ONFCoreNetworkElement12Equipment onfCoreEqpt = new ONFCoreNetworkElement12Equipment(netconfAccessor, coreData);
+ onfCoreEqpt.addProblemsofNode(faultData);
+ onfCoreEqpt.addProblemsofNodeObject("ABCD");
+ onfCoreEqpt.getInventoryInformation(Arrays.asList("TESTINV"));
+ onfCoreEqpt.getEquipmentAll();
+ onfCoreEqpt.getEquipmentData();
+ onfCoreEqpt.getEquipmentPac();
+ onfCoreEqpt.readNetworkElementEquipment();
+
+ }
+
+ @Test
+ public void test1() {
+ when(capabilities.isSupportingNamespaceAndRevision(WrapperEquipmentPacRev170402.QNAME)).thenReturn(false);
+ ONFCoreNetworkElement12Equipment onfCoreEqpt = new ONFCoreNetworkElement12Equipment(netconfAccessor, coreData);
+ }
+
+}
diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestHelper.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestHelper.java
new file mode 100644
index 000000000..337dc2644
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestHelper.java
@@ -0,0 +1,49 @@
+/*
+ * ============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.onf.ifpac.microwave.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.Helper;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.LayerProtocolName;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.GranularityPeriodType;
+
+public class TestHelper {
+
+ @Test
+ public void test() {
+
+ assertEquals(GranularityPeriodType.Period24Hours,
+ Helper.nnGetGranularityPeriodType(GranularityPeriodType.Period24Hours));
+ assertEquals(GranularityPeriodType.Unknown, Helper.nnGetGranularityPeriodType(null));
+
+ assertEquals(new LayerProtocolName("TDM"),
+ Helper.nnGetLayerProtocolName(LayerProtocolName.getDefaultInstance("TDM")));
+ assertEquals(new LayerProtocolName("default"), Helper.nnGetLayerProtocolName(null));
+
+ assertEquals("TEST", Helper.nnGetString("TEST"));
+ assertEquals("", Helper.nnGetString(null));
+
+ assertEquals(new UniversalId("ABC"), Helper.nnGetUniversalId(new UniversalId("ABC")));
+ assertEquals(new UniversalId("Default"), Helper.nnGetUniversalId(null));
+
+ }
+
+}
diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java
new file mode 100644
index 000000000..bee34b5b5
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java
@@ -0,0 +1,342 @@
+/*
+ * ============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.onf.ifpac.microwave.test;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.lang.reflect.Constructor;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.WrapperMicrowaveModelRev170324;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.util.ONFLayerProtocolName;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.LpBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.GranularityPeriodType;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfaceDiversityPac;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfaceDiversityPacKey;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfacePac;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfacePacKey;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwEthernetContainerPac;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwEthernetContainerPacKey;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwHybridMwStructurePac;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwHybridMwStructurePacKey;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwPureEthernetStructurePac;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwPureEthernetStructurePacKey;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwTdmContainerPac;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwTdmContainerPacKey;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.SeverityType;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblemsBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceCurrentProblems;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceCurrentProblemsBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceHistoricalPerformancesBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.ethernet.container.pac.EthernetContainerCurrentProblemsBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.ethernet.container.pac.EthernetContainerHistoricalPerformancesBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblemsBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblemsBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.tdm.container.pac.TdmContainerCurrentProblems;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.tdm.container.pac.TdmContainerCurrentProblemsBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceConfiguration;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceConfigurationBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.current.problems.g.CurrentProblemList;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.current.problems.g.CurrentProblemListBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.diversity.current.performance.g.CurrentPerformanceDataList;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performance.type.g.PerformanceDataBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performance.type.g.PerformanceData;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataListBuilder;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class TestWrapperMicrowaveModelRev170324 {
+
+ NetconfBindingAccessor accessor;
+ DeviceManagerServiceProvider serviceProvider;
+ FaultData resultList;
+ UniversalId uid;
+ TransactionUtils transactionUtils;
+ DataBroker dataBroker;
+
+ InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID;
+ @NonNull
+ AirInterfaceCurrentProblems airInterfaceCurrentProblems;
+
+ InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID;
+ @NonNull
+ EthernetContainerCurrentProblems ethernetContainerCurrentProblems;
+
+ @Before
+ public void init() {
+ accessor = mock(NetconfBindingAccessor.class);
+ serviceProvider = mock(DeviceManagerServiceProvider.class);
+ resultList = mock(FaultData.class);
+ transactionUtils = mock(TransactionUtils.class);
+ dataBroker = mock(DataBroker.class);
+
+ uid = new UniversalId("ABCD");
+
+ mwAirInterfaceIID = InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid))
+ .child(AirInterfaceCurrentProblems.class).build();
+ List<CurrentProblemList> currentProblemList =
+ Arrays.asList(new CurrentProblemListBuilder().setProblemName("Loss of Signal")
+ .setProblemSeverity(SeverityType.Critical).setSequenceNumber(1).setTimeStamp(null).build());
+ airInterfaceCurrentProblems =
+ new AirInterfaceCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build();
+
+ mwEthInterfaceIID = InstanceIdentifier.builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(uid))
+ .child(EthernetContainerCurrentProblems.class).build();
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.current.problems.g.CurrentProblemList> ethCurrentProblemsList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.current.problems.g.CurrentProblemListBuilder()
+ .setProblemName("Link Negotiation Unsuccessful")
+ .setProblemSeverity(SeverityType.Critical).setSequenceNumber(1).setTimeStamp(null)
+ .build());
+ ethernetContainerCurrentProblems =
+ new EthernetContainerCurrentProblemsBuilder().setCurrentProblemList(ethCurrentProblemsList).build();
+
+ NodeId nNodeId = new NodeId("nSky");
+ when(accessor.getNodeId()).thenReturn(nNodeId);
+ when(accessor.getTransactionUtils()).thenReturn(transactionUtils);
+ when(accessor.getDataBroker()).thenReturn(dataBroker);
+
+ }
+
+ @Test
+ public void testMWAirInterfaceWithProblems() {
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwAirInterfaceIID)).thenReturn(airInterfaceCurrentProblems);
+
+ WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 =
+ new WrapperMicrowaveModelRev170324(accessor, serviceProvider);
+ wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid,
+ resultList);
+ }
+
+ @Test
+ public void testMWAirInterfaceWithoProblems() {
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwAirInterfaceIID)).thenReturn(null);
+
+ WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 =
+ new WrapperMicrowaveModelRev170324(accessor, serviceProvider);
+ wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid,
+ resultList);
+ }
+
+ @Test
+ public void testEthernetContainer12WithProblems() {
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwEthInterfaceIID)).thenReturn(ethernetContainerCurrentProblems);
+
+ WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 =
+ new WrapperMicrowaveModelRev170324(accessor, serviceProvider);
+ wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null,
+ uid, resultList);
+ }
+
+ @Test
+ public void testEthernetContainer12WithNoProblems() {
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwEthInterfaceIID)).thenReturn(null);
+
+ WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 =
+ new WrapperMicrowaveModelRev170324(accessor, serviceProvider);
+ wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null,
+ uid, resultList);
+ }
+
+ @Test
+ public void testTdmContainer12WithProblems() throws Exception {
+ final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
+ final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
+ final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
+
+ Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
+ InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID =
+ InstanceIdentifier.builder(clazzPac, cons.newInstance(uid)).child(clazzProblems).build();
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.tdm.container.current.problems.g.CurrentProblemList> currentProblemList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.tdm.container.current.problems.g.CurrentProblemListBuilder()
+ .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major)
+ .setSequenceNumber(2).setTimeStamp(null).build());
+ TdmContainerCurrentProblems tdmInterfaceCurrentProblems =
+ new TdmContainerCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwEthInterfaceIID)).thenReturn(tdmInterfaceCurrentProblems);
+
+ WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 =
+ new WrapperMicrowaveModelRev170324(accessor, serviceProvider);
+ wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.TDMCONTAINER, null, uid,
+ resultList);
+
+ }
+
+ @Test
+ public void testMwHybridMwStructureWithProblems() throws Exception {
+ final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
+ final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
+
+ InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID =
+ InstanceIdentifier.builder(clazzPac, new MwHybridMwStructurePacKey(uid)).child(clazzProblems).build();
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.hybrid.mw.structure.current.problems.g.CurrentProblemList> currentProblemList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.hybrid.mw.structure.current.problems.g.CurrentProblemListBuilder()
+ .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major)
+ .setSequenceNumber(2).setTimeStamp(null).build());
+ HybridMwStructureCurrentProblems hybridMwStructureCurrentProblems =
+ new HybridMwStructureCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems);
+
+ WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 =
+ new WrapperMicrowaveModelRev170324(accessor, serviceProvider);
+ wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE,
+ MwHybridMwStructurePac.class, uid, resultList);
+
+ }
+
+ @Test
+ public void testMwAirInterfaceDiversityStructureWithProblems() throws Exception {
+ final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
+ final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
+
+ InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
+ .builder(clazzPac, new MwAirInterfaceDiversityPacKey(uid)).child(clazzProblems).build();
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.diversity.current.problems.g.CurrentProblemList> currentProblemList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.diversity.current.problems.g.CurrentProblemListBuilder()
+ .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major)
+ .setSequenceNumber(2).setTimeStamp(null).build());
+ AirInterfaceDiversityCurrentProblems hybridMwStructureCurrentProblems =
+ new AirInterfaceDiversityCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems);
+
+ WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 =
+ new WrapperMicrowaveModelRev170324(accessor, serviceProvider);
+ wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE,
+ MwAirInterfaceDiversityPac.class, uid, resultList);
+
+ }
+
+ @Test
+ public void testMwPureEthernetStructureWithProblems() throws Exception {
+ final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
+ final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
+
+ InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
+ .builder(clazzPac, new MwPureEthernetStructurePacKey(uid)).child(clazzProblems).build();
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.pure.ethernet.structure.current.problems.g.CurrentProblemList> currentProblemList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.pure.ethernet.structure.current.problems.g.CurrentProblemListBuilder()
+ .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major)
+ .setSequenceNumber(2).setTimeStamp(null).build());
+ PureEthernetStructureCurrentProblems hybridMwStructureCurrentProblems =
+ new PureEthernetStructureCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems);
+
+ WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 =
+ new WrapperMicrowaveModelRev170324(accessor, serviceProvider);
+ wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE,
+ MwPureEthernetStructurePac.class, uid, resultList);
+
+ }
+
+ @Test
+ public void testNullStructureWithProblems() throws Exception {
+
+ WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 =
+ new WrapperMicrowaveModelRev170324(accessor, serviceProvider);
+ wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, null, uid,
+ resultList);
+
+ }
+
+ @Test
+ public void testgetLtpHistoricalPerformanceData() {
+ InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID =
+ InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid))
+ .child(AirInterfaceConfiguration.class).build();
+
+ AirInterfaceConfiguration airConfiguration =
+ new AirInterfaceConfigurationBuilder().setAirInterfaceName("TESTINTF").build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwAirInterfaceConfigurationIID)).thenReturn(airConfiguration);
+
+ InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID =
+ InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid))
+ .child(AirInterfaceHistoricalPerformances.class).build();
+
+ PerformanceData performanceData = new PerformanceDataBuilder().build();
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder()
+ .setGranularityPeriod(GranularityPeriodType.Period15Min)
+ .setPerformanceData(performanceData).build());
+ AirInterfaceHistoricalPerformances airHistoricalPerformanceData =
+ new AirInterfaceHistoricalPerformancesBuilder().setHistoricalPerformanceDataList(airHistPMList).build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwAirInterfaceHistoricalPerformanceIID)).thenReturn(airHistoricalPerformanceData);
+
+ InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID =
+ InstanceIdentifier.builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(uid))
+ .child(EthernetContainerHistoricalPerformances.class).build();
+
+ org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.container.historical.performance.type.g.PerformanceData ethPerformanceData =
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.container.historical.performance.type.g.PerformanceDataBuilder()
+ .build();
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> ethHistPMList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataListBuilder()
+ .setGranularityPeriod(GranularityPeriodType.Period24Hours)
+ .setPerformanceData(ethPerformanceData).build());
+ EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData =
+ new EthernetContainerHistoricalPerformancesBuilder().setHistoricalPerformanceDataList(ethHistPMList)
+ .build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ ethContainerIID)).thenReturn(ethContainerHistoricalPerformanceData);
+
+ Lp lp = new LpBuilder().setUuid(uid).build();
+ WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 =
+ new WrapperMicrowaveModelRev170324(accessor, serviceProvider);
+
+ wrapperMicrowaveModelRev170324.getLtpHistoricalPerformanceData(ONFLayerProtocolName.ETHERNET, lp);
+ }
+}
diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java
new file mode 100644
index 000000000..4c4c9734a
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java
@@ -0,0 +1,339 @@
+/*
+ * ============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.onf.ifpac.microwave.test;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.lang.reflect.Constructor;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.WrapperMicrowaveModelRev180907;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.util.ONFLayerProtocolName;
+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.types.FaultData;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.label.g.Label;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.LpBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.GranularityPeriodType;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performance.type.g.PerformanceData;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performance.type.g.PerformanceDataBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceConfiguration;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceConfigurationBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceHistoricalPerformancesBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.ethernet.container.pac.EthernetContainerHistoricalPerformancesBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfaceDiversityPac;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfaceDiversityPacKey;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfacePac;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfacePacKey;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwEthernetContainerPac;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwEthernetContainerPacKey;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwHybridMwStructurePac;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwHybridMwStructurePacKey;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwPureEthernetStructurePac;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwPureEthernetStructurePacKey;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwTdmContainerPac;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwTdmContainerPacKey;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.SeverityType;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblemsBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceCurrentProblems;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceCurrentProblemsBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.ethernet.container.pac.EthernetContainerCurrentProblemsBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblemsBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblemsBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.tdm.container.pac.TdmContainerCurrentProblems;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.tdm.container.pac.TdmContainerCurrentProblemsBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.current.problems.g.CurrentProblemList;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.current.problems.g.CurrentProblemListBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.diversity.current.performance.g.CurrentPerformanceDataList;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class TestWrapperMicrowaveModelRev180907 {
+
+ NetconfBindingAccessor accessor;
+ DeviceManagerServiceProvider serviceProvider;
+ FaultData resultList;
+ UniversalId uid;
+ TransactionUtils transactionUtils;
+
+ InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID;
+ @NonNull
+ AirInterfaceCurrentProblems airInterfaceCurrentProblems;
+
+ InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID;
+ @NonNull
+ EthernetContainerCurrentProblems ethernetContainerCurrentProblems;
+
+ @Before
+ public void init() {
+ accessor = mock(NetconfBindingAccessor.class);
+ serviceProvider = mock(DeviceManagerServiceProvider.class);
+ resultList = mock(FaultData.class);
+ transactionUtils = mock(TransactionUtils.class);
+
+ uid = new UniversalId("ABCD");
+
+ mwAirInterfaceIID = InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid))
+ .child(AirInterfaceCurrentProblems.class).build();
+ List<CurrentProblemList> currentProblemList =
+ Arrays.asList(new CurrentProblemListBuilder().setProblemName("Loss of Signal")
+ .setProblemSeverity(SeverityType.Critical).setSequenceNumber(1).setTimeStamp(null).build());
+ airInterfaceCurrentProblems =
+ new AirInterfaceCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build();
+
+ mwEthInterfaceIID = InstanceIdentifier.builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(uid))
+ .child(EthernetContainerCurrentProblems.class).build();
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.current.problems.g.CurrentProblemList> ethCurrentProblemsList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.current.problems.g.CurrentProblemListBuilder()
+ .setProblemName("Link Negotiation Unsuccessful")
+ .setProblemSeverity(SeverityType.Critical).setSequenceNumber(1).setTimeStamp(null)
+ .build());
+ ethernetContainerCurrentProblems =
+ new EthernetContainerCurrentProblemsBuilder().setCurrentProblemList(ethCurrentProblemsList).build();
+
+ NodeId nNodeId = new NodeId("nSky");
+ when(accessor.getNodeId()).thenReturn(nNodeId);
+ when(accessor.getTransactionUtils()).thenReturn(transactionUtils);
+
+ }
+
+ @Test
+ public void testMWAirInterfaceWithProblems() {
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwAirInterfaceIID)).thenReturn(airInterfaceCurrentProblems);
+
+ WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 =
+ new WrapperMicrowaveModelRev180907(accessor, serviceProvider);
+ wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid,
+ resultList);
+ }
+
+ @Test
+ public void testMWAirInterfaceWithoProblems() {
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwAirInterfaceIID)).thenReturn(null);
+
+ WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 =
+ new WrapperMicrowaveModelRev180907(accessor, serviceProvider);
+ wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid,
+ resultList);
+ }
+
+ @Test
+ public void testEthernetContainer12WithProblems() {
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwEthInterfaceIID)).thenReturn(ethernetContainerCurrentProblems);
+
+ WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 =
+ new WrapperMicrowaveModelRev180907(accessor, serviceProvider);
+ wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null,
+ uid, resultList);
+ }
+
+ @Test
+ public void testEthernetContainer12WithNoProblems() {
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwEthInterfaceIID)).thenReturn(null);
+
+ WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 =
+ new WrapperMicrowaveModelRev180907(accessor, serviceProvider);
+ wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null,
+ uid, resultList);
+ }
+
+ @Test
+ public void testTdmContainer12WithProblems() throws Exception {
+ final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
+ final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
+ final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
+
+ Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
+ InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID =
+ InstanceIdentifier.builder(clazzPac, cons.newInstance(uid)).child(clazzProblems).build();
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.tdm.container.current.problems.g.CurrentProblemList> currentProblemList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.tdm.container.current.problems.g.CurrentProblemListBuilder()
+ .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major)
+ .setSequenceNumber(2).setTimeStamp(null).build());
+ TdmContainerCurrentProblems tdmInterfaceCurrentProblems =
+ new TdmContainerCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwEthInterfaceIID)).thenReturn(tdmInterfaceCurrentProblems);
+
+ WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 =
+ new WrapperMicrowaveModelRev180907(accessor, serviceProvider);
+ wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.TDMCONTAINER, null, uid,
+ resultList);
+
+ }
+
+ @Test
+ public void testMwHybridMwStructureWithProblems() throws Exception {
+ final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
+ final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
+
+ InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID =
+ InstanceIdentifier.builder(clazzPac, new MwHybridMwStructurePacKey(uid)).child(clazzProblems).build();
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.hybrid.mw.structure.current.problems.g.CurrentProblemList> currentProblemList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.hybrid.mw.structure.current.problems.g.CurrentProblemListBuilder()
+ .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major)
+ .setSequenceNumber(2).setTimeStamp(null).build());
+ HybridMwStructureCurrentProblems hybridMwStructureCurrentProblems =
+ new HybridMwStructureCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems);
+
+ WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 =
+ new WrapperMicrowaveModelRev180907(accessor, serviceProvider);
+ wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE,
+ MwHybridMwStructurePac.class, uid, resultList);
+
+ }
+
+ @Test
+ public void testMwAirInterfaceDiversityStructureWithProblems() throws Exception {
+ final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
+ final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
+
+ InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
+ .builder(clazzPac, new MwAirInterfaceDiversityPacKey(uid)).child(clazzProblems).build();
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.diversity.current.problems.g.CurrentProblemList> currentProblemList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.diversity.current.problems.g.CurrentProblemListBuilder()
+ .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major)
+ .setSequenceNumber(2).setTimeStamp(null).build());
+ AirInterfaceDiversityCurrentProblems hybridMwStructureCurrentProblems =
+ new AirInterfaceDiversityCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems);
+
+ WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 =
+ new WrapperMicrowaveModelRev180907(accessor, serviceProvider);
+ wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE,
+ MwAirInterfaceDiversityPac.class, uid, resultList);
+
+ }
+
+ @Test
+ public void testMwPureEthernetStructureWithProblems() throws Exception {
+ final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
+ final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
+
+ InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
+ .builder(clazzPac, new MwPureEthernetStructurePacKey(uid)).child(clazzProblems).build();
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.pure.ethernet.structure.current.problems.g.CurrentProblemList> currentProblemList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.pure.ethernet.structure.current.problems.g.CurrentProblemListBuilder()
+ .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major)
+ .setSequenceNumber(2).setTimeStamp(null).build());
+ PureEthernetStructureCurrentProblems hybridMwStructureCurrentProblems =
+ new PureEthernetStructureCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems);
+
+ WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 =
+ new WrapperMicrowaveModelRev180907(accessor, serviceProvider);
+ wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE,
+ MwPureEthernetStructurePac.class, uid, resultList);
+
+ }
+
+ @Test
+ public void testNullStructureWithProblems() throws Exception {
+
+ WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 =
+ new WrapperMicrowaveModelRev180907(accessor, serviceProvider);
+ wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, null, uid,
+ resultList);
+
+ }
+
+ @Test
+ public void testgetLtpHistoricalPerformanceData() {
+ InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID =
+ InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid))
+ .child(AirInterfaceConfiguration.class).build();
+
+ AirInterfaceConfiguration airConfiguration =
+ new AirInterfaceConfigurationBuilder().setAirInterfaceName("TESTINTF").build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwAirInterfaceConfigurationIID)).thenReturn(airConfiguration);
+
+ InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID =
+ InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid))
+ .child(AirInterfaceHistoricalPerformances.class).build();
+
+ PerformanceData performanceData = new PerformanceDataBuilder().build();
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder()
+ .setGranularityPeriod(GranularityPeriodType.Period15Min)
+ .setPerformanceData(performanceData).build());
+ AirInterfaceHistoricalPerformances airHistoricalPerformanceData =
+ new AirInterfaceHistoricalPerformancesBuilder().setHistoricalPerformanceDataList(airHistPMList).build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwAirInterfaceHistoricalPerformanceIID)).thenReturn(airHistoricalPerformanceData);
+
+ InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID =
+ InstanceIdentifier.builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(uid))
+ .child(EthernetContainerHistoricalPerformances.class).build();
+
+ org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.container.historical.performance.type.g.PerformanceData ethPerformanceData =
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.container.historical.performance.type.g.PerformanceDataBuilder()
+ .build();
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> ethHistPMList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.historical.performances.g.HistoricalPerformanceDataListBuilder()
+ .setGranularityPeriod(GranularityPeriodType.Period24Hours)
+ .setPerformanceData(ethPerformanceData).build());
+ EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData =
+ new EthernetContainerHistoricalPerformancesBuilder().setHistoricalPerformanceDataList(ethHistPMList)
+ .build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ ethContainerIID)).thenReturn(ethContainerHistoricalPerformanceData);
+
+ Lp lp = new LpBuilder().setUuid(uid).build();;
+ WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 =
+ new WrapperMicrowaveModelRev180907(accessor, serviceProvider);
+
+ wrapperMicrowaveModelRev180907.getLtpHistoricalPerformanceData(ONFLayerProtocolName.MWAIRINTERFACE, lp);
+ }
+}
diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java
new file mode 100644
index 000000000..0259fea5e
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java
@@ -0,0 +1,343 @@
+/*
+ * ============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.onf.ifpac.microwave.test;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.lang.reflect.Constructor;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.WrapperMicrowaveModelRev181010;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.util.ONFLayerProtocolName;
+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.types.FaultData;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.label.g.Label;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.LpBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.GranularityPeriodType;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.ethernet.container.pac.EthernetContainerHistoricalPerformancesBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performance.type.g.PerformanceData;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performance.type.g.PerformanceDataBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfaceDiversityPac;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfaceDiversityPacKey;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfacePac;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfacePacKey;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwEthernetContainerPac;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwEthernetContainerPacKey;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwHybridMwStructurePac;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwHybridMwStructurePacKey;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwPureEthernetStructurePac;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwPureEthernetStructurePacKey;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwTdmContainerPac;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwTdmContainerPacKey;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.SeverityType;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblemsBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceConfiguration;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceConfigurationBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceCurrentProblems;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceCurrentProblemsBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceHistoricalPerformancesBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.ethernet.container.pac.EthernetContainerCurrentProblemsBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblemsBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblemsBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.tdm.container.pac.TdmContainerCurrentProblems;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.tdm.container.pac.TdmContainerCurrentProblemsBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.current.problems.g.CurrentProblemList;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.current.problems.g.CurrentProblemListBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.diversity.current.performance.g.CurrentPerformanceDataList;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+@SuppressWarnings("deprecation")
+public class TestWrapperMicrowaveModelRev181010 {
+
+ NetconfBindingAccessor accessor;
+ DeviceManagerServiceProvider serviceProvider;
+ FaultData resultList;
+ UniversalId uid;
+ TransactionUtils transactionUtils;
+ DataBroker dataBroker;
+
+ InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID;
+ @NonNull
+ AirInterfaceCurrentProblems airInterfaceCurrentProblems;
+
+ InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID;
+ @NonNull
+ EthernetContainerCurrentProblems ethernetContainerCurrentProblems;
+
+ @Before
+ public void init() {
+ accessor = mock(NetconfBindingAccessor.class);
+ serviceProvider = mock(DeviceManagerServiceProvider.class);
+ resultList = mock(FaultData.class);
+ transactionUtils = mock(TransactionUtils.class);
+ dataBroker = mock(DataBroker.class);
+
+ uid = new UniversalId("ABCD");
+
+ mwAirInterfaceIID = InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid))
+ .child(AirInterfaceCurrentProblems.class).build();
+ List<CurrentProblemList> currentProblemList =
+ Arrays.asList(new CurrentProblemListBuilder().setProblemName("Loss of Signal")
+ .setProblemSeverity(SeverityType.Critical).setSequenceNumber(1).setTimeStamp(null).build());
+ airInterfaceCurrentProblems =
+ new AirInterfaceCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build();
+
+ mwEthInterfaceIID = InstanceIdentifier.builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(uid))
+ .child(EthernetContainerCurrentProblems.class).build();
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.current.problems.g.CurrentProblemList> ethCurrentProblemsList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.current.problems.g.CurrentProblemListBuilder()
+ .setProblemName("Link Negotiation Unsuccessful")
+ .setProblemSeverity(SeverityType.Critical).setSequenceNumber(1).setTimeStamp(null)
+ .build());
+ ethernetContainerCurrentProblems =
+ new EthernetContainerCurrentProblemsBuilder().setCurrentProblemList(ethCurrentProblemsList).build();
+
+ NodeId nNodeId = new NodeId("nSky");
+ when(accessor.getNodeId()).thenReturn(nNodeId);
+ when(accessor.getTransactionUtils()).thenReturn(transactionUtils);
+ when(accessor.getDataBroker()).thenReturn(dataBroker);
+
+ }
+
+ @Test
+ public void testMWAirInterfaceWithProblems() {
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwAirInterfaceIID)).thenReturn(airInterfaceCurrentProblems);
+
+ WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 =
+ new WrapperMicrowaveModelRev181010(accessor, serviceProvider);
+ wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid,
+ resultList);
+ }
+
+ @Test
+ public void testMWAirInterfaceWithoProblems() {
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwAirInterfaceIID)).thenReturn(null);
+
+ WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 =
+ new WrapperMicrowaveModelRev181010(accessor, serviceProvider);
+ wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid,
+ resultList);
+ }
+
+ @Test
+ public void testEthernetContainer12WithProblems() {
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwEthInterfaceIID)).thenReturn(ethernetContainerCurrentProblems);
+
+ WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 =
+ new WrapperMicrowaveModelRev181010(accessor, serviceProvider);
+ wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null,
+ uid, resultList);
+ }
+
+ @Test
+ public void testEthernetContainer12WithNoProblems() {
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwEthInterfaceIID)).thenReturn(null);
+
+ WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 =
+ new WrapperMicrowaveModelRev181010(accessor, serviceProvider);
+ wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null,
+ uid, resultList);
+ }
+
+ @Test
+ public void testTdmContainer12WithProblems() throws Exception {
+ final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
+ final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
+ final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
+
+ Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
+ InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID =
+ InstanceIdentifier.builder(clazzPac, cons.newInstance(uid)).child(clazzProblems).build();
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.tdm.container.current.problems.g.CurrentProblemList> currentProblemList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.tdm.container.current.problems.g.CurrentProblemListBuilder()
+ .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major)
+ .setSequenceNumber(2).setTimeStamp(null).build());
+ TdmContainerCurrentProblems tdmInterfaceCurrentProblems =
+ new TdmContainerCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwEthInterfaceIID)).thenReturn(tdmInterfaceCurrentProblems);
+
+ WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 =
+ new WrapperMicrowaveModelRev181010(accessor, serviceProvider);
+ wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.TDMCONTAINER, null, uid,
+ resultList);
+
+ }
+
+ @Test
+ public void testMwHybridMwStructureWithProblems() throws Exception {
+ final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
+ final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
+
+ InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID =
+ InstanceIdentifier.builder(clazzPac, new MwHybridMwStructurePacKey(uid)).child(clazzProblems).build();
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.hybrid.mw.structure.current.problems.g.CurrentProblemList> currentProblemList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.hybrid.mw.structure.current.problems.g.CurrentProblemListBuilder()
+ .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major)
+ .setSequenceNumber(2).setTimeStamp(null).build());
+ HybridMwStructureCurrentProblems hybridMwStructureCurrentProblems =
+ new HybridMwStructureCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems);
+
+ WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 =
+ new WrapperMicrowaveModelRev181010(accessor, serviceProvider);
+ wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE,
+ MwHybridMwStructurePac.class, uid, resultList);
+
+ }
+
+ @Test
+ public void testMwAirInterfaceDiversityStructureWithProblems() throws Exception {
+ final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
+ final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
+
+ InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
+ .builder(clazzPac, new MwAirInterfaceDiversityPacKey(uid)).child(clazzProblems).build();
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.diversity.current.problems.g.CurrentProblemList> currentProblemList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.diversity.current.problems.g.CurrentProblemListBuilder()
+ .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major)
+ .setSequenceNumber(2).setTimeStamp(null).build());
+ AirInterfaceDiversityCurrentProblems hybridMwStructureCurrentProblems =
+ new AirInterfaceDiversityCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems);
+
+ WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 =
+ new WrapperMicrowaveModelRev181010(accessor, serviceProvider);
+ wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE,
+ MwAirInterfaceDiversityPac.class, uid, resultList);
+
+ }
+
+ @Test
+ public void testMwPureEthernetStructureWithProblems() throws Exception {
+ final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
+ final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
+
+ InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
+ .builder(clazzPac, new MwPureEthernetStructurePacKey(uid)).child(clazzProblems).build();
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.pure.ethernet.structure.current.problems.g.CurrentProblemList> currentProblemList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.pure.ethernet.structure.current.problems.g.CurrentProblemListBuilder()
+ .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major)
+ .setSequenceNumber(2).setTimeStamp(null).build());
+ PureEthernetStructureCurrentProblems hybridMwStructureCurrentProblems =
+ new PureEthernetStructureCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems);
+
+ WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 =
+ new WrapperMicrowaveModelRev181010(accessor, serviceProvider);
+ wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE,
+ MwPureEthernetStructurePac.class, uid, resultList);
+
+ }
+
+ @Test
+ public void testNullStructureWithProblems() throws Exception {
+
+ WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 =
+ new WrapperMicrowaveModelRev181010(accessor, serviceProvider);
+ wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, null, uid,
+ resultList);
+
+ }
+
+ @Test
+ public void testgetLtpHistoricalPerformanceData() {
+ InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID =
+ InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid))
+ .child(AirInterfaceConfiguration.class).build();
+
+ AirInterfaceConfiguration airConfiguration = new AirInterfaceConfigurationBuilder().build();
+ when(accessor.getTransactionUtils().readData(dataBroker, LogicalDatastoreType.OPERATIONAL,
+ mwAirInterfaceConfigurationIID)).thenReturn(airConfiguration);
+
+ InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID =
+ InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid))
+ .child(AirInterfaceHistoricalPerformances.class).build();
+
+ PerformanceData performanceData = new PerformanceDataBuilder().build();
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder()
+ .setGranularityPeriod(GranularityPeriodType.Period15Min)
+ .setPerformanceData(performanceData).build());
+ AirInterfaceHistoricalPerformances airHistoricalPerformanceData =
+ new AirInterfaceHistoricalPerformancesBuilder().setHistoricalPerformanceDataList(airHistPMList).build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ mwAirInterfaceHistoricalPerformanceIID)).thenReturn(airHistoricalPerformanceData);
+
+ InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID =
+ InstanceIdentifier.builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(uid))
+ .child(EthernetContainerHistoricalPerformances.class).build();
+
+ org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.container.historical.performance.type.g.PerformanceData ethPerformanceData =
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.container.historical.performance.type.g.PerformanceDataBuilder()
+ .build();
+ List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> ethHistPMList =
+ Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.historical.performances.g.HistoricalPerformanceDataListBuilder()
+ .setGranularityPeriod(GranularityPeriodType.Period24Hours)
+ .setPerformanceData(ethPerformanceData).build());
+ EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData =
+ new EthernetContainerHistoricalPerformancesBuilder().setHistoricalPerformanceDataList(ethHistPMList)
+ .build();
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ ethContainerIID)).thenReturn(ethContainerHistoricalPerformanceData);
+
+ Lp lp = new LpBuilder().setUuid(uid).build();
+ WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 =
+ new WrapperMicrowaveModelRev181010(accessor, serviceProvider);
+
+ wrapperMicrowaveModelRev181010.getLtpHistoricalPerformanceData(ONFLayerProtocolName.MWAIRINTERFACE, lp);
+ }
+}
diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/test/TestWrapperPTPModelRev170208.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/test/TestWrapperPTPModelRev170208.java
new file mode 100644
index 000000000..0694bcecc
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/test/TestWrapperPTPModelRev170208.java
@@ -0,0 +1,93 @@
+/*
+ * ============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.onf.ifpac.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.WrapperPTPModelRev170208;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ptp.dataset.rev170208.InstanceList;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ptp.dataset.rev170208.InstanceListBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ptp.dataset.rev170208.InstanceListKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ptp.dataset.rev170208.instance.list.PortDsList;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ptp.dataset.rev170208.instance.list.PortDsListBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ptp.dataset.rev170208.port.ds.entry.PortIdentity;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ptp.dataset.rev170208.port.ds.entry.PortIdentityBuilder;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.Arrays;
+import java.util.List;
+
+import static org.mockito.Mockito.*;
+
+public class TestWrapperPTPModelRev170208 {
+
+ private static final String NODEID = "node1";
+ NetconfBindingAccessor netconfAccessor;
+ Capabilities capabilities;
+ TransactionUtils transactionUtils;
+ DataBroker dataBroker;
+
+ @Before
+ public void init() {
+ netconfAccessor = mock(NetconfBindingAccessor.class);
+ capabilities = mock(Capabilities.class);
+ dataBroker = mock(DataBroker.class);
+ transactionUtils = mock(TransactionUtils.class);
+
+ when(netconfAccessor.getNodeId()).thenReturn(new NodeId(NODEID));
+ when(netconfAccessor.getCapabilites()).thenReturn(capabilities);
+ when(netconfAccessor.getTransactionUtils()).thenReturn(transactionUtils);
+ when(netconfAccessor.getDataBroker()).thenReturn(dataBroker);
+
+ PortIdentity portIdentity = new PortIdentityBuilder().setPortNumber(10).build();
+ List<PortDsList> portDsList = Arrays.asList(new PortDsListBuilder().setPortIdentity(portIdentity).build());
+ InstanceList instanceList = new InstanceListBuilder().setPortDsList(portDsList).build();
+ InstanceIdentifier<InstanceList> PTPINSTANCES_IID =
+ InstanceIdentifier.builder(InstanceList.class, new InstanceListKey(1)).build();
+ when(netconfAccessor.getTransactionUtils().readData(netconfAccessor.getDataBroker(),
+ LogicalDatastoreType.OPERATIONAL, PTPINSTANCES_IID)).thenReturn(instanceList);
+ }
+
+ @Test
+ public void test() {
+
+ when(capabilities.isSupportingNamespaceAndRevision(InstanceList.QNAME)).thenReturn(false);
+
+ WrapperPTPModelRev170208.initSynchronizationExtension(netconfAccessor);
+ }
+
+ @Test
+ public void test1() {
+
+ when(capabilities.isSupportingNamespaceAndRevision(InstanceList.QNAME)).thenReturn(true);
+
+ WrapperPTPModelRev170208.initSynchronizationExtension(netconfAccessor);
+ }
+
+}
diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/test/TestONFCoreNetworkElementFactory.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/test/TestONFCoreNetworkElementFactory.java
new file mode 100644
index 000000000..be0191f87
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/test/TestONFCoreNetworkElementFactory.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.onf.impl.test;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import java.io.File;
+import java.io.IOException;
+import java.util.Optional;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.WrapperMicrowaveModelRev170324;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.WrapperMicrowaveModelRev180907;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.WrapperMicrowaveModelRev181010;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.impl.DeviceManagerOnfConfiguration;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.impl.ONFCoreNetworkElementFactory;
+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.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yangtools.yang.common.QName;
+
+public class TestONFCoreNetworkElementFactory {
+
+ static NetconfBindingAccessor accessor;
+ static DeviceManagerServiceProvider serviceProvider;
+ static Capabilities capabilities;
+ static DataBroker dataBroker;
+ static NodeId nNodeId;
+ static DeviceManagerOnfConfiguration configuration;
+ QName qCapability;
+ static File configFile;
+
+
+ @BeforeClass
+ public static void init() throws InterruptedException, IOException {
+
+ capabilities = mock(Capabilities.class);
+ accessor = mock(NetconfBindingAccessor.class);
+ serviceProvider = mock(DeviceManagerServiceProvider.class);
+ dataBroker = mock(DataBroker.class);
+
+ configFile = new File("devicemanager.properties");
+ ConfigurationFileRepresentation configFileRep = new ConfigurationFileRepresentation(configFile);
+ configuration = new DeviceManagerOnfConfiguration(configFileRep);
+
+ when(accessor.getCapabilites()).thenReturn(capabilities);
+ //when(serviceProvider.getDataProvider()).thenReturn(dataProvider);
+ nNodeId = new NodeId("nSky");
+ NetconfBindingAccessor bindingAccessor = mock(NetconfBindingAccessor.class);
+ when(bindingAccessor.getNodeId()).thenReturn(nNodeId);
+ when(bindingAccessor.getCapabilites()).thenReturn(capabilities);
+
+ when(accessor.getNodeId()).thenReturn(nNodeId);
+ when(accessor.getNetconfBindingAccessor()).thenReturn(Optional.of(bindingAccessor));
+ when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElement.QNAME)).thenReturn(true);
+
+ }
+
+ @AfterClass
+ public static void after() {
+ configFile.delete();
+ }
+
+ @Test
+ public void testCreateMWModelRev170324() throws Exception {
+ when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME))
+ .thenReturn(true);
+ when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME))
+ .thenReturn(false);
+ when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME))
+ .thenReturn(false);
+ ONFCoreNetworkElementFactory factory = new ONFCoreNetworkElementFactory(configuration);
+ assertTrue(factory.create(accessor, serviceProvider).isPresent());
+ }
+
+ @Test
+ public void testCreateMWModelRev180907() throws Exception {
+ when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME))
+ .thenReturn(false);
+ when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME))
+ .thenReturn(true);
+ when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME))
+ .thenReturn(false);
+ ONFCoreNetworkElementFactory factory = new ONFCoreNetworkElementFactory(configuration);
+ assertTrue(factory.create(accessor, serviceProvider).isPresent());
+ }
+
+ @Test
+ public void testCreateMWModelRev181010() throws Exception {
+ when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME))
+ .thenReturn(false);
+ when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME))
+ .thenReturn(false);
+ when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME))
+ .thenReturn(true);
+ ONFCoreNetworkElementFactory factory = new ONFCoreNetworkElementFactory(configuration);
+ assertTrue(factory.create(accessor, serviceProvider).isPresent());
+ }
+
+ @After
+ public void cleanUp() throws Exception {
+
+ }
+}
+
diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java
new file mode 100644
index 000000000..25fba9281
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java
@@ -0,0 +1,98 @@
+/*
+ * ============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.onf.ne.test;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import java.util.Optional;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.OnfMicrowaveModel;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.impl.DeviceManagerOnfConfiguration;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ne.ONFCoreNetworkElement12Microwave;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.EquipmentService;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class TestONFCoreNetworkElement12Basic {
+
+ NetconfBindingAccessor accessor;
+ DeviceManagerServiceProvider serviceProvider;
+ Capabilities capabilities;
+ TransactionUtils transactionUtils;
+ NetworkElement optionalNe;
+ OnfMicrowaveModel onfMicrowaveModel;
+ FaultService faultService;
+ EquipmentService equipmentService;
+ DeviceManagerOnfConfiguration configuration;
+
+ protected static final InstanceIdentifier<NetworkElement> NETWORKELEMENT_IID =
+ InstanceIdentifier.builder(NetworkElement.class).build();
+
+ @Before
+ public void init() {
+ accessor = mock(NetconfBindingAccessor.class);
+ serviceProvider = mock(DeviceManagerServiceProvider.class);
+ capabilities = mock(Capabilities.class);
+ transactionUtils = mock(TransactionUtils.class);
+ onfMicrowaveModel = mock(OnfMicrowaveModel.class);
+ faultService = mock(FaultService.class);
+ equipmentService = mock(EquipmentService.class);
+ configuration = mock(DeviceManagerOnfConfiguration.class);
+
+ when(accessor.getCapabilites()).thenReturn(capabilities);
+ when(serviceProvider.getFaultService()).thenReturn(faultService);
+ when(serviceProvider.getEquipmentService()).thenReturn(equipmentService);
+
+ NodeId nNodeId = new NodeId("nSky");
+ when(accessor.getNodeId()).thenReturn(nNodeId);
+ when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElementPac.QNAME)).thenReturn(true);
+ when(accessor.getTransactionUtils()).thenReturn(transactionUtils);
+ NetconfBindingAccessor bindingAccessor = mock(NetconfBindingAccessor.class);
+ when(bindingAccessor.getNodeId()).thenReturn(nNodeId);
+ when(accessor.getNetconfBindingAccessor()).thenReturn(Optional.of(bindingAccessor));
+
+ }
+
+ @Test
+ public void test1() {
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ NETWORKELEMENT_IID)).thenReturn(null);
+
+ ONFCoreNetworkElement12Microwave onfCoreNetworkElement12MW =
+ new ONFCoreNetworkElement12Microwave(accessor, serviceProvider, configuration, onfMicrowaveModel);
+ onfCoreNetworkElement12MW.prepareCheck();
+
+ EventlogEntity eventlogEntity = mock(EventlogEntity.class);
+ when(eventlogEntity.getObjectId()).thenReturn("ABCD");
+ when(eventlogEntity.getAttributeName()).thenReturn("/equipment-pac/equipment-current-problems");
+
+ onfCoreNetworkElement12MW.notificationActor(eventlogEntity);
+ }
+
+
+}
diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Microwave.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Microwave.java
new file mode 100644
index 000000000..ab907ead7
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Microwave.java
@@ -0,0 +1,113 @@
+/*
+ * ============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.onf.ne.test;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.OnfMicrowaveModel;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.impl.DeviceManagerOnfConfiguration;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ne.ONFCoreNetworkElement12Microwave;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.EquipmentService;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class TestONFCoreNetworkElement12Microwave {
+
+ NetconfBindingAccessor accessor;
+ DeviceManagerServiceProvider serviceProvider;
+ Capabilities capabilities;
+ TransactionUtils transactionUtils;
+ NetworkElement optionalNe;
+ OnfMicrowaveModel onfMicrowaveModel;
+ FaultService faultService;
+ EquipmentService equipmentService;
+ DeviceManagerOnfConfiguration configuration;
+
+ protected static final InstanceIdentifier<NetworkElement> NETWORKELEMENT_IID =
+ InstanceIdentifier.builder(NetworkElement.class).build();
+
+ @Before
+ public void init() {
+ accessor = mock(NetconfBindingAccessor.class);
+ serviceProvider = mock(DeviceManagerServiceProvider.class);
+ capabilities = mock(Capabilities.class);
+ transactionUtils = mock(TransactionUtils.class);
+ onfMicrowaveModel = mock(OnfMicrowaveModel.class);
+ faultService = mock(FaultService.class);
+ equipmentService = mock(EquipmentService.class);
+ configuration = mock(DeviceManagerOnfConfiguration.class);
+
+ when(accessor.getCapabilites()).thenReturn(capabilities);
+ when(serviceProvider.getFaultService()).thenReturn(faultService);
+ when(serviceProvider.getEquipmentService()).thenReturn(equipmentService);
+
+ NodeId nNodeId = new NodeId("nSky");
+ when(accessor.getNodeId()).thenReturn(nNodeId);
+ when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElementPac.QNAME)).thenReturn(true);
+ when(accessor.getTransactionUtils()).thenReturn(transactionUtils);
+ }
+
+ @Test
+ public void test() {
+ optionalNe = mock(NetworkElement.class);
+
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ NETWORKELEMENT_IID)).thenReturn(optionalNe);
+
+ ONFCoreNetworkElement12Microwave onfCoreNetworkElement12MW =
+ new ONFCoreNetworkElement12Microwave(accessor, serviceProvider, configuration, onfMicrowaveModel);
+ onfCoreNetworkElement12MW.prepareCheck();
+
+ EventlogEntity eventlogEntity = mock(EventlogEntity.class);
+ when(eventlogEntity.getObjectId()).thenReturn("ABCD");
+ when(eventlogEntity.getAttributeName()).thenReturn("/network-element/extension[value-name=\"top-level-equipment\"]/value");
+
+ onfCoreNetworkElement12MW.notificationActor(eventlogEntity);
+
+ }
+
+
+ @Test
+ public void test1() {
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ NETWORKELEMENT_IID)).thenReturn(null);
+
+ ONFCoreNetworkElement12Microwave onfCoreNetworkElement12MW =
+ new ONFCoreNetworkElement12Microwave(accessor, serviceProvider, configuration, onfMicrowaveModel);
+ onfCoreNetworkElement12MW.prepareCheck();
+
+ EventlogEntity eventlogEntity = mock(EventlogEntity.class);
+ when(eventlogEntity.getObjectId()).thenReturn("ABCD");
+ when(eventlogEntity.getAttributeName()).thenReturn("/equipment-pac/equipment-current-problems");
+
+ onfCoreNetworkElement12MW.notificationActor(eventlogEntity);
+ }
+
+
+}
diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/resources/simplelogger.properties b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/resources/simplelogger.properties
new file mode 100644
index 000000000..9af26dc96
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf12/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