diff options
author | highstreetherbert <herbert.eiselt@highstreet-technologies.com> | 2020-07-10 18:40:56 +0200 |
---|---|---|
committer | highstreetherbert <herbert.eiselt@highstreet-technologies.com> | 2020-07-10 18:41:05 +0200 |
commit | c845f3a65190c74815818cf78fde9f59cb7cba80 (patch) | |
tree | 842da802d11b27c90eec486b06ecad05632f3ddb /sdnr/wt/devicemanager-onf/provider/src/test | |
parent | 23c27ddcd79913d11eac16eb42c5a43899de97a1 (diff) |
Reformat sdnr devicemanager-onf to ONAP code style
Reformat to ONAP code style
Issue-ID: SDNC-1283
Signed-off-by: highstreetherbert <herbert.eiselt@highstreet-technologies.com>
Change-Id: Ib23d7b4cfca80022979ff71f15f9ee94abfaaee3
Signed-off-by: highstreetherbert <herbert.eiselt@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/devicemanager-onf/provider/src/test')
10 files changed, 1057 insertions, 905 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 index cda0f5366..20d479efa 100644 --- 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 @@ -44,44 +44,38 @@ 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(); - - } + 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 index ff2969eac..403451799 100644 --- 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 @@ -45,56 +45,59 @@ 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; + 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); - } + 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 index cae28f4fe..337dc2644 100644 --- 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 @@ -27,21 +27,23 @@ import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.r 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)); - - } + @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 index 0140eaa59..96c3c757d 100644 --- 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 @@ -82,212 +82,261 @@ 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); - } + 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 index e4d89f28f..dec443519 100644 --- 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 @@ -82,209 +82,258 @@ 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; + 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; + 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); - } + 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 index eac003dac..94f8e6c19 100644 --- 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 @@ -84,212 +84,260 @@ 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); - } + 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 index bf9337291..42f7de1d6 100644 --- 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 @@ -47,47 +47,47 @@ 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); - } + 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 index 93e65c0b9..909a67edc 100644 --- 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 @@ -83,9 +83,12 @@ public class TestONFCoreNetworkElementFactory { 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); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)) + .thenReturn(true); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)) + .thenReturn(false); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)) + .thenReturn(false); ONFCoreNetworkElementFactory factory = new ONFCoreNetworkElementFactory(configuration); assertTrue(factory.create(accessor, serviceProvider).isPresent()); } @@ -93,9 +96,12 @@ public class TestONFCoreNetworkElementFactory { @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); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)) + .thenReturn(false); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)) + .thenReturn(true); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)) + .thenReturn(false); ONFCoreNetworkElementFactory factory = new ONFCoreNetworkElementFactory(configuration); assertTrue(factory.create(accessor, serviceProvider).isPresent()); } @@ -103,9 +109,12 @@ public class TestONFCoreNetworkElementFactory { @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); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)) + .thenReturn(false); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)) + .thenReturn(false); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)) + .thenReturn(true); ONFCoreNetworkElementFactory factory = new ONFCoreNetworkElementFactory(configuration); assertTrue(factory.create(accessor, serviceProvider).isPresent()); } 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 index ba295f6ce..242014fc0 100644 --- 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 @@ -68,8 +68,8 @@ public class TestONFCoreNetworkElement12Basic { EquipmentService equipmentService; DeviceManagerOnfConfiguration configuration; - protected static final InstanceIdentifier<NetworkElement> NETWORKELEMENT_IID = InstanceIdentifier - .builder(NetworkElement.class).build(); + protected static final InstanceIdentifier<NetworkElement> NETWORKELEMENT_IID = + InstanceIdentifier.builder(NetworkElement.class).build(); @Before public void init() { @@ -179,8 +179,8 @@ public class TestONFCoreNetworkElement12Basic { when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, NETWORKELEMENT_IID)).thenReturn(optionalNe); - ONFCoreNetworkElement12Basic onfCoreNetworkElement12Basic = new ONFCoreNetworkElement12Basic(accessor, - serviceProvider,configuration); + ONFCoreNetworkElement12Basic onfCoreNetworkElement12Basic = + new ONFCoreNetworkElement12Basic(accessor, serviceProvider, configuration); onfCoreNetworkElement12Basic.prepareCheck(); /* @@ -222,73 +222,72 @@ public class TestONFCoreNetworkElement12Basic { @Test - public void test1() - { - when (accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, NETWORKELEMENT_IID)).thenReturn(null); + public void test1() { + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + NETWORKELEMENT_IID)).thenReturn(null); ONFCoreNetworkElement12Microwave onfCoreNetworkElement12MW = - new ONFCoreNetworkElement12Microwave(accessor, serviceProvider, configuration, - onfMicrowaveModel); onfCoreNetworkElement12MW.prepareCheck(); - - EventlogEntity eventlogEntity = 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); + new ONFCoreNetworkElement12Microwave(accessor, serviceProvider, configuration, 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 index a5462d6f1..dcef80916 100644 --- 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 @@ -67,8 +67,8 @@ public class TestONFCoreNetworkElement12Microwave { EquipmentService equipmentService; DeviceManagerOnfConfiguration configuration; - protected static final InstanceIdentifier<NetworkElement> NETWORKELEMENT_IID = InstanceIdentifier - .builder(NetworkElement.class).build(); + protected static final InstanceIdentifier<NetworkElement> NETWORKELEMENT_IID = + InstanceIdentifier.builder(NetworkElement.class).build(); @Before public void init() { @@ -178,8 +178,8 @@ public class TestONFCoreNetworkElement12Microwave { when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, NETWORKELEMENT_IID)).thenReturn(optionalNe); - ONFCoreNetworkElement12Microwave onfCoreNetworkElement12MW = new ONFCoreNetworkElement12Microwave(accessor, - serviceProvider, configuration, onfMicrowaveModel); + ONFCoreNetworkElement12Microwave onfCoreNetworkElement12MW = + new ONFCoreNetworkElement12Microwave(accessor, serviceProvider, configuration, onfMicrowaveModel); onfCoreNetworkElement12MW.prepareCheck(); EventlogEntity eventlogEntity = new EventlogEntity() { @@ -245,73 +245,72 @@ public class TestONFCoreNetworkElement12Microwave { @Test - public void test1() - { - when (accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, NETWORKELEMENT_IID)).thenReturn(null); + public void test1() { + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + NETWORKELEMENT_IID)).thenReturn(null); ONFCoreNetworkElement12Microwave onfCoreNetworkElement12MW = - new ONFCoreNetworkElement12Microwave(accessor, serviceProvider, configuration, - onfMicrowaveModel); onfCoreNetworkElement12MW.prepareCheck(); - - EventlogEntity eventlogEntity = 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); + new ONFCoreNetworkElement12Microwave(accessor, serviceProvider, configuration, 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); } |