aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager-onf/provider/src/test
diff options
context:
space:
mode:
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2020-02-14 12:30:46 +0100
committerKAPIL SINGAL <ks220y@att.com>2020-02-14 15:44:43 +0000
commit53f1c13a96a6ee7a12b7bc3642e6a63d54cd07f3 (patch)
tree1fdc19db345ad7660c2400b839947fb5b4917ada /sdnr/wt/devicemanager-onf/provider/src/test
parent1c924ae13ed9a0fc9b6afd4d16b8becdf8d0b44c (diff)
Add Unit test cases
Add Unit tests to provide Code coverage for compliance Issue-ID: SDNC-1073 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> Change-Id: Ic35016d270cc32c6f42e665cafc3b7ea6407ea15
Diffstat (limited to 'sdnr/wt/devicemanager-onf/provider/src/test')
-rw-r--r--sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestExtendedEquipment.java87
-rw-r--r--sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestONFCoreNetworkElement12Equipment.java100
-rw-r--r--sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestHelper.java47
-rw-r--r--sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java293
-rw-r--r--sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java290
-rw-r--r--sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java295
-rw-r--r--sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/test/TestWrapperPTPModelRev170208.java93
-rw-r--r--sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/test/TestONFCoreNetworkElementFactory.java99
-rw-r--r--sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java295
-rw-r--r--sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Microwave.java319
10 files changed, 1918 insertions, 0 deletions
diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestExtendedEquipment.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestExtendedEquipment.java
new file mode 100644
index 000000000..f55ef4afc
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestExtendedEquipment.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * ============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-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestONFCoreNetworkElement12Equipment.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestONFCoreNetworkElement12Equipment.java
new file mode 100644
index 000000000..c5107364f
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestONFCoreNetworkElement12Equipment.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * ============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.NetconfAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.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 {
+
+ NetconfAccessor 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(NetconfAccessor.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, capabilities);
+ 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, capabilities);
+ }
+
+}
diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestHelper.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestHelper.java
new file mode 100644
index 000000000..5d14e7d26
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestHelper.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * ============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-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java
new file mode 100644
index 000000000..7ac2944dd
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java
@@ -0,0 +1,293 @@
+/*******************************************************************************
+ * ============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.NetconfAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.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 {
+
+ NetconfAccessor 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(NetconfAccessor.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-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java
new file mode 100644
index 000000000..ee0f727dd
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java
@@ -0,0 +1,290 @@
+/*******************************************************************************
+ * ============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.NetconfAccessor;
+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 {
+
+ NetconfAccessor 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(NetconfAccessor.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-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java
new file mode 100644
index 000000000..074948ba1
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java
@@ -0,0 +1,295 @@
+/*******************************************************************************
+ * ============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.NetconfAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.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 {
+
+ NetconfAccessor 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(NetconfAccessor.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-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/test/TestWrapperPTPModelRev170208.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/test/TestWrapperPTPModelRev170208.java
new file mode 100644
index 000000000..55db66a1a
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf/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.NetconfAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.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";
+ NetconfAccessor netconfAccessor;
+ Capabilities capabilities;
+ TransactionUtils transactionUtils;
+ DataBroker dataBroker;
+
+ @Before
+ public void init() {
+ netconfAccessor = mock(NetconfAccessor.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-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/test/TestONFCoreNetworkElementFactory.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/test/TestONFCoreNetworkElementFactory.java
new file mode 100644
index 000000000..6713a7821
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/test/TestONFCoreNetworkElementFactory.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * ============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.IOException;
+import org.junit.After;
+import org.junit.BeforeClass;
+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.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.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.NetconfAccessor;
+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 NetconfAccessor accessor;
+ static DeviceManagerServiceProvider serviceProvider;
+ static Capabilities capabilities;
+ static DataBroker dataBroker;
+ static NodeId nNodeId;
+ QName qCapability;
+
+ @BeforeClass
+ public static void init() throws InterruptedException, IOException {
+ capabilities = mock(Capabilities.class);
+ accessor = mock(NetconfAccessor.class);
+ serviceProvider = mock(DeviceManagerServiceProvider.class);
+ dataBroker = mock(DataBroker.class);
+
+ when(accessor.getCapabilites()).thenReturn(capabilities);
+ //when(serviceProvider.getDataProvider()).thenReturn(dataProvider);
+ nNodeId = new NodeId("nSky");
+ when(accessor.getNodeId()).thenReturn(nNodeId);
+
+
+ }
+
+ @Test
+ public void testCreateMWModelRev170324() throws Exception {
+ when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElement.QNAME)).thenReturn(true);
+ 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();
+ assertTrue((factory.create(accessor, serviceProvider)).isPresent());
+ }
+
+ @Test
+ public void testCreateMWModelRev180907() throws Exception {
+ when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElement.QNAME)).thenReturn(true);
+ 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();
+ assertTrue(factory.create(accessor, serviceProvider).isPresent());
+ }
+
+ @Test
+ public void testCreateMWModelRev181010() throws Exception {
+ when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElement.QNAME)).thenReturn(true);
+ 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();
+ assertTrue(factory.create(accessor, serviceProvider).isPresent());
+ }
+
+ @After
+ public void cleanUp() throws Exception {
+
+ }
+}
+
diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java
new file mode 100644
index 000000000..a09d6fcfc
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java
@@ -0,0 +1,295 @@
+/*******************************************************************************
+ * ============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.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.List;
+import java.util.Optional;
+
+import org.eclipse.jdt.annotation.Nullable;
+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.ne.ONFCoreNetworkElement12Basic;
+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.NetconfAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+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.AdministrativeControl;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.AdministrativeState;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.LifecycleState;
+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.core.model.rev170320.OperationalState;
+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.extension.g.Extension;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.global._class.g.LocalId;
+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.name.g.Name;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.network.element.Fd;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.network.element.Ltp;
+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.rev190801.EventlogEntity;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SourceType;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yangtools.yang.binding.Augmentation;
+import org.opendaylight.yangtools.yang.binding.DataContainer;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class TestONFCoreNetworkElement12Basic {
+
+ NetconfAccessor accessor;
+ DeviceManagerServiceProvider serviceProvider;
+ Capabilities capabilities;
+ TransactionUtils transactionUtils;
+ NetworkElement optionalNe;
+ OnfMicrowaveModel onfMicrowaveModel;
+ FaultService faultService;
+ EquipmentService equipmentService;
+
+ protected static final InstanceIdentifier<NetworkElement> NETWORKELEMENT_IID = InstanceIdentifier
+ .builder(NetworkElement.class).build();
+
+ @Before
+ public void init() {
+ accessor = mock(NetconfAccessor.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);
+
+ 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 = new NetworkElement() {
+
+ @Override
+ public @Nullable List<Label> getLabel() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable List<Extension> getExtension() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable OperationalState getOperationalState() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable LifecycleState getLifecycleState() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable AdministrativeState getAdministrativeState() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable AdministrativeControl getAdministrativeControl() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable List<Name> getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable UniversalId getUuid() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable List<LocalId> getLocalId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <E$$ extends Augmentation<NetworkElement>> @Nullable E$$ augmentation(Class<E$$> augmentationType) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Class<? extends DataContainer> getImplementedInterface() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable List<Ltp> getLtp() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable List<Fd> getFd() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ };
+
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ NETWORKELEMENT_IID)).thenReturn(optionalNe);
+
+ ONFCoreNetworkElement12Basic onfCoreNetworkElement12Basic = new ONFCoreNetworkElement12Basic(accessor,
+ serviceProvider);
+ onfCoreNetworkElement12Basic.prepareCheck();
+
+ /*
+ * EventlogEntity eventlogEntity = new EventlogEntity() {
+ *
+ * @Override public @Nullable String getId() { // TODO Auto-generated method
+ * stub return null; }
+ *
+ * @Override public @Nullable DateAndTime getTimestamp() { // TODO
+ * Auto-generated method stub return null; }
+ *
+ * @Override public @Nullable String getObjectId() { // TODO Auto-generated
+ * method stub return "ABCD"; }
+ *
+ * @Override public @Nullable String getNodeId() { // TODO Auto-generated method
+ * stub return null; }
+ *
+ * @Override public @Nullable Integer getCounter() { // TODO Auto-generated
+ * method stub return null; }
+ *
+ * @Override public @Nullable SourceType getSourceType() { // TODO
+ * Auto-generated method stub return null; }
+ *
+ * @Override public @Nullable String getNewValue() { // TODO Auto-generated
+ * method stub return null; }
+ *
+ * @Override public @Nullable String getAttributeName() { // TODO Auto-generated
+ * method stub return
+ * "/network-element/extension[value-name=\"top-level-equipment\"]/value"; //
+ * "/equipment-pac/equipment-current-problems"; }
+ *
+ * @Override public Class<? extends DataContainer> getImplementedInterface() {
+ * // TODO Auto-generated method stub return null; } };
+ *
+ * onfCoreNetworkElement12Basic.notificationActor(eventlogEntity);
+ */
+
+ }
+
+
+ @Test
+ public void test1()
+ {
+ when (accessor.getTransactionUtils().readData(accessor.getDataBroker(),
+ LogicalDatastoreType.OPERATIONAL, NETWORKELEMENT_IID)).thenReturn(null);
+
+ ONFCoreNetworkElement12Microwave onfCoreNetworkElement12MW =
+ new ONFCoreNetworkElement12Microwave(accessor, serviceProvider,
+ onfMicrowaveModel); onfCoreNetworkElement12MW.prepareCheck();
+
+ EventlogEntity eventlogEntity = new EventlogEntity() {
+
+ @Override
+ public @Nullable String getId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable DateAndTime getTimestamp() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable String getObjectId() {
+ // TODO Auto-generated method stub
+ return "ABCD";
+ }
+
+ @Override
+ public @Nullable String getNodeId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable Integer getCounter() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable SourceType getSourceType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable String getNewValue() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable String getAttributeName() {
+ // TODO Auto-generated method stub
+ return "/equipment-pac/equipment-current-problems";
+ }
+
+ @Override
+ public Class<? extends DataContainer> getImplementedInterface() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ };
+
+ onfCoreNetworkElement12MW.notificationActor(eventlogEntity);
+ }
+
+
+}
diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Microwave.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Microwave.java
new file mode 100644
index 000000000..63b31b717
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Microwave.java
@@ -0,0 +1,319 @@
+/*******************************************************************************
+ * ============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.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.List;
+import java.util.Optional;
+
+import org.eclipse.jdt.annotation.Nullable;
+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.ne.ONFCoreNetworkElement12Basic;
+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.NetconfAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+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.AdministrativeControl;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.AdministrativeState;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.LifecycleState;
+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.core.model.rev170320.OperationalState;
+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.extension.g.Extension;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.global._class.g.LocalId;
+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.name.g.Name;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.network.element.Fd;
+import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.network.element.Ltp;
+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.rev190801.EventlogEntity;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SourceType;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yangtools.yang.binding.Augmentation;
+import org.opendaylight.yangtools.yang.binding.DataContainer;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class TestONFCoreNetworkElement12Microwave {
+
+ NetconfAccessor accessor;
+ DeviceManagerServiceProvider serviceProvider;
+ Capabilities capabilities;
+ TransactionUtils transactionUtils;
+ NetworkElement optionalNe;
+ OnfMicrowaveModel onfMicrowaveModel;
+ FaultService faultService;
+ EquipmentService equipmentService;
+
+ protected static final InstanceIdentifier<NetworkElement> NETWORKELEMENT_IID = InstanceIdentifier
+ .builder(NetworkElement.class).build();
+
+ @Before
+ public void init() {
+ accessor = mock(NetconfAccessor.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);
+
+ 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 = new NetworkElement() {
+
+ @Override
+ public @Nullable List<Label> getLabel() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable List<Extension> getExtension() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable OperationalState getOperationalState() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable LifecycleState getLifecycleState() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable AdministrativeState getAdministrativeState() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable AdministrativeControl getAdministrativeControl() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable List<Name> getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable UniversalId getUuid() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable List<LocalId> getLocalId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <E$$ extends Augmentation<NetworkElement>> @Nullable E$$ augmentation(Class<E$$> augmentationType) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Class<? extends DataContainer> getImplementedInterface() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable List<Ltp> getLtp() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable List<Fd> getFd() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ };
+
+ when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
+ NETWORKELEMENT_IID)).thenReturn(optionalNe);
+
+ ONFCoreNetworkElement12Microwave onfCoreNetworkElement12MW = new ONFCoreNetworkElement12Microwave(accessor,
+ serviceProvider, onfMicrowaveModel);
+ onfCoreNetworkElement12MW.prepareCheck();
+
+ EventlogEntity eventlogEntity = new EventlogEntity() {
+
+ @Override
+ public @Nullable String getId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable DateAndTime getTimestamp() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable String getObjectId() {
+ // TODO Auto-generated method stub
+ return "ABCD";
+ }
+
+ @Override
+ public @Nullable String getNodeId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable Integer getCounter() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable SourceType getSourceType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable String getNewValue() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable String getAttributeName() {
+ // TODO Auto-generated method stub
+ return "/network-element/extension[value-name=\"top-level-equipment\"]/value"; // "/equipment-pac/equipment-current-problems";
+ }
+
+ @Override
+ public Class<? extends DataContainer> getImplementedInterface() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ };
+
+ 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,
+ onfMicrowaveModel); onfCoreNetworkElement12MW.prepareCheck();
+
+ EventlogEntity eventlogEntity = new EventlogEntity() {
+
+ @Override
+ public @Nullable String getId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable DateAndTime getTimestamp() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable String getObjectId() {
+ // TODO Auto-generated method stub
+ return "ABCD";
+ }
+
+ @Override
+ public @Nullable String getNodeId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable Integer getCounter() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable SourceType getSourceType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable String getNewValue() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public @Nullable String getAttributeName() {
+ // TODO Auto-generated method stub
+ return "/equipment-pac/equipment-current-problems";
+ }
+
+ @Override
+ public Class<? extends DataContainer> getImplementedInterface() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ };
+
+ onfCoreNetworkElement12MW.notificationActor(eventlogEntity);
+ }
+
+
+}