diff options
author | Michael Dürre <michael.duerre@highstreet-technologies.com> | 2020-07-29 08:35:29 +0200 |
---|---|---|
committer | KAPIL SINGAL <ks220y@att.com> | 2020-07-29 13:23:01 +0000 |
commit | 461cc15c741776837b59b8779e0f5bb683657a10 (patch) | |
tree | 2bee62133b014b975b659fdd3daba641ce27a2cd /sdnr/wt/devicemanager-onf/provider/src | |
parent | 4aaaeb525cb04023147527da0164bbf7152fc9fd (diff) |
update devicemanager onf
sodium fixes and some small other changes
Issue-ID: CCSDK-2576
Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com>
Change-Id: I58670cbfbd10c90bd6ade65a0e59d2e7d543cebe
Diffstat (limited to 'sdnr/wt/devicemanager-onf/provider/src')
8 files changed, 49 insertions, 414 deletions
diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ONFCoreNetworkElement12Equipment.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ONFCoreNetworkElement12Equipment.java index 5641f2873..fdaaf4f76 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ONFCoreNetworkElement12Equipment.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ONFCoreNetworkElement12Equipment.java @@ -27,7 +27,6 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.OnfInterfacePac; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.EquipmentData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.InventoryInformationDcae; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; @@ -54,32 +53,41 @@ public class ONFCoreNetworkElement12Equipment { private static final int EQUIPMENTROOTLEVEL = 0; private final NetworkElementCoreData coreData; - private final OnfInterfacePac equipmentPac; + private final @Nullable OnfInterfacePac equipmentPac; private final NetconfAccessor acessor; private final ValueNameList extensionList; - private final List<UniversalId> topLevelEqUuidList; + private final @NonNull List<UniversalId> topLevelEqUuidList; private final @NonNull FaultData globalProblemList; private final @NonNull List<ExtendedEquipment> globalEquipmentList; + public ONFCoreNetworkElement12Equipment(NetconfAccessor acessor, NetworkElementCoreData coreData) { + this(acessor, coreData, false); + } + public ONFCoreNetworkElement12Equipment(NetconfAccessor acessor, NetworkElementCoreData coreData, - Capabilities capabilities) { + Boolean disabled) { LOG.debug("Initialize class: {} " + ONFCoreNetworkElement12Equipment.class.getName()); this.acessor = acessor; this.coreData = coreData; - if (capabilities.isSupportingNamespaceAndRevision(WrapperEquipmentPacRev170402.QNAME)) { + String reason; + if (disabled) { + this.equipmentPac = null; + reason = "disabled"; + } else if (acessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperEquipmentPacRev170402.QNAME)) { this.equipmentPac = new WrapperEquipmentPacRev170402(acessor); - LOG.debug("Equipement pac supported {}", WrapperEquipmentPacRev170402.QNAME); + reason = "WrapperEquipmentPacRev170402.QNAME"; } else { this.equipmentPac = null; - LOG.debug("Equipement pac not supported {}", WrapperEquipmentPacRev170402.QNAME); + reason = "unsupported"; } + LOG.debug("Equipement pac initialization '{}'", reason); + + globalEquipmentList = new ArrayList<>(); extensionList = new ValueNameList(); topLevelEqUuidList = new ArrayList<>(); - globalEquipmentList = new ArrayList<>(); globalProblemList = new FaultData(); - initClassVars(); } @@ -192,8 +200,8 @@ public class ONFCoreNetworkElement12Equipment { equipmentList.add( new ExtendedEquipment(this.getMountpoint(), parentUuid.getValue(), equipment, path, treeLevel)); - if (this.equipmentPac != null) { - this.equipmentPac.readTheFaults(uuid, problemList); + if (equipmentPac != null) { + equipmentPac.readTheFaults(uuid, problemList); List<ContainedHolder> containedHolderListe = equipment.getContainedHolder(); if (containedHolderListe != null) { diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Base.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Base.java index 698a39ab6..6ffdd0ce9 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Base.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Base.java @@ -102,7 +102,7 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB this.nodeId = getAcessor().get().getNodeId(); this.isNetworkElementCurrentProblemsSupporting12 = acessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElementPac.QNAME); - this.equipment = new ONFCoreNetworkElement12Equipment(acessor, this, acessor.getCapabilites()); + this.equipment = new ONFCoreNetworkElement12Equipment(acessor, this); WrapperPTPModelRev170208.initSynchronizationExtension(acessor); LOG.debug("support necurrent-problem-list={}", this.isNetworkElementCurrentProblemsSupporting12); } @@ -141,7 +141,7 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB * Read from NetworkElement and verify LTPs have changed. If the NE has changed, update to the new structure. From * initial state it changes also. */ - protected synchronized boolean readNetworkElementAndInterfaces() { + protected boolean readNetworkElementAndInterfaces() { LOG.debug("Update mountpoint if changed {}", getMountpoint()); diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java index 05402f895..19be0281a 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java @@ -131,7 +131,7 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base { * Read during startup all relevant structure and status parameters from device */ @Override - public synchronized void initialReadFromNetworkElement() { + public void initialReadFromNetworkElement() { LOG.debug("Get info about {}", getMountpoint()); @@ -143,13 +143,18 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base { // Step 2.2: read ne from data store readNetworkElementAndInterfaces(); + LOG.debug("NETCONF read network element and interfaces completed"); equipment.readNetworkElementEquipment(); + LOG.debug("NETCONF read equipment completed"); // Step 2.3: read the existing faults and add to DB FaultData resultList = readAllCurrentProblemsOfNode(); + LOG.debug("NETCONF read current problems completed"); equipment.addProblemsofNode(resultList); faultService.initCurrentProblemStatus(nodeId, resultList); + LOG.debug("DB write current problems completed"); + equipmentService.writeEquipment(equipment.getEquipmentData()); LOG.info("Found info at {} for device {} number of problems: {}", getMountpoint(), getUuId(), @@ -184,7 +189,7 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base { // -- Register NE to performance manager performanceManager.registration(mountPointNodeName, this); - //events will be already pushed by base devmgr (needs more clarification SDNC-1123) + //events will be already pushed by base devmgr (needs more clarification SDNC-1123) //eventListenerHandler.registration(mountPointNodeName, acessor.getNetconfNode()); //LOG.debug("refresh necon entry for {} with type {} not",mountPointNodeName,this.getDeviceType()); //eventListenerHandler.connectIndication(mountPointNodeName, getDeviceType()); diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java index a8384ea61..0fc5b15f4 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java @@ -172,7 +172,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas * * @param uuidString of the equipment-pac */ - private synchronized void syncEquipmentPac(String uuidString) { + private void syncEquipmentPac(String uuidString) { int problems = microwaveEventListener.removeObjectsCurrentProblemsOfNode(nodeId, uuidString); LOG.debug("Removed {} problems for uuid {}", problems, uuidString); @@ -192,7 +192,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas * Read during startup all relevant structure and status parameters from device */ @Override - public synchronized void initialReadFromNetworkElement() { + public void initialReadFromNetworkElement() { LOG.debug("Get info about {}", getMountpoint()); int problems = microwaveEventListener.removeAllCurrentProblemsOfNode(nodeId); @@ -203,13 +203,17 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas // Step 2.2: read ne from data store readNetworkElementAndInterfaces(); + LOG.debug("NETCONF read network element and interfaces completed"); equipment.readNetworkElementEquipment(); + LOG.debug("NETCONF read equipment completed"); // Step 2.3: read the existing faults and add to DB FaultData resultList = readAllCurrentProblemsOfNode(); + LOG.debug("NETCONF read current problems completed"); equipment.addProblemsofNode(resultList); microwaveEventListener.initCurrentProblemStatus(nodeId, resultList); + LOG.debug("DB write current problems completed"); equipmentService.writeEquipment(equipment.getEquipmentData()); LOG.info("Found info at {} for device {} number of problems: {}", getMountpoint(), getUuId(), @@ -256,6 +260,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas idxStart = resultList.size(); uuid = Helper.nnGetUniversalId(lp.getUuid()); + @Nullable Class<?> lpClass = getLpExtension(lp); ONFLayerProtocolName lpName = ONFLayerProtocolName.valueOf(lp.getLayerProtocolName()); @@ -321,7 +326,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas QName qName = QName.create(capability, revision, conditionalPackage); res = this.microwaveModel.getClassForLtpExtension(qName); } catch (IllegalArgumentException e) { - LOG.debug("Can not create QName from ({}{}{}): {}", capability, revision, conditionalPackage, + LOG.warn("Can not create QName from ({}{}{}): {}", capability, revision, conditionalPackage, e.getMessage()); } } diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementBase.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementBase.java index 40a6d323b..deacab8f2 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementBase.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementBase.java @@ -21,24 +21,10 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ne; import java.util.Optional; -import javax.annotation.Nonnull; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ONFCoreNetworkElementRepresentation; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.InternalConnectionStatus; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; import org.opendaylight.mdsal.binding.api.DataBroker; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Host; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.Credentials; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPassword; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ConnectionLogStatus; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.NetworkElementConnectionBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.NetworkElementConnectionEntity; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.NetworkElementDeviceType; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.network.element.connection.entity.NodeDetailsBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,7 +33,6 @@ import org.slf4j.LoggerFactory; * @author herbert * */ -@SuppressWarnings("deprecation") public abstract class ONFCoreNetworkElementBase implements AutoCloseable, ONFCoreNetworkElementRepresentation { private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElementBase.class); 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 403451799..095446f0b 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 @@ -81,8 +81,7 @@ public class TestONFCoreNetworkElement12Equipment { @Test public void test() { when(capabilities.isSupportingNamespaceAndRevision(WrapperEquipmentPacRev170402.QNAME)).thenReturn(true); - ONFCoreNetworkElement12Equipment onfCoreEqpt = - new ONFCoreNetworkElement12Equipment(netconfAccessor, coreData, capabilities); + ONFCoreNetworkElement12Equipment onfCoreEqpt = new ONFCoreNetworkElement12Equipment(netconfAccessor, coreData); onfCoreEqpt.addProblemsofNode(faultData); onfCoreEqpt.addProblemsofNodeObject("ABCD"); onfCoreEqpt.getInventoryInformation(Arrays.asList("TESTINV")); @@ -96,8 +95,7 @@ public class TestONFCoreNetworkElement12Equipment { @Test public void test1() { when(capabilities.isSupportingNamespaceAndRevision(WrapperEquipmentPacRev170402.QNAME)).thenReturn(false); - ONFCoreNetworkElement12Equipment onfCoreEqpt = - new ONFCoreNetworkElement12Equipment(netconfAccessor, coreData, capabilities); + ONFCoreNetworkElement12Equipment onfCoreEqpt = new ONFCoreNetworkElement12Equipment(netconfAccessor, coreData); } } 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 242014fc0..cfdc5988e 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 @@ -94,134 +94,6 @@ public class TestONFCoreNetworkElement12Basic { } @Test - public void test() { - optionalNe = new NetworkElement() { - - @Override - public @Nullable List<Label> getLabel() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<Extension> getExtension() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable OperationalState getOperationalState() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable LifecycleState getLifecycleState() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable AdministrativeState getAdministrativeState() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable AdministrativeControl getAdministrativeControl() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<Name> getName() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable UniversalId getUuid() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<LocalId> getLocalId() { - // TODO Auto-generated method stub - return null; - } - - @Override - public <E$$ extends Augmentation<NetworkElement>> @Nullable E$$ augmentation(Class<E$$> augmentationType) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Class<? extends DataContainer> getImplementedInterface() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<Ltp> getLtp() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<Fd> getFd() { - // TODO Auto-generated method stub - return null; - } - }; - - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, - NETWORKELEMENT_IID)).thenReturn(optionalNe); - - ONFCoreNetworkElement12Basic onfCoreNetworkElement12Basic = - new ONFCoreNetworkElement12Basic(accessor, serviceProvider, configuration); - onfCoreNetworkElement12Basic.prepareCheck(); - - /* - * EventlogEntity eventlogEntity = new EventlogEntity() { - * - * @Override public @Nullable String getId() { // TODO Auto-generated method - * stub return null; } - * - * @Override public @Nullable DateAndTime getTimestamp() { // TODO - * Auto-generated method stub return null; } - * - * @Override public @Nullable String getObjectId() { // TODO Auto-generated - * method stub return "ABCD"; } - * - * @Override public @Nullable String getNodeId() { // TODO Auto-generated method - * stub return null; } - * - * @Override public @Nullable Integer getCounter() { // TODO Auto-generated - * method stub return null; } - * - * @Override public @Nullable SourceType getSourceType() { // TODO - * Auto-generated method stub return null; } - * - * @Override public @Nullable String getNewValue() { // TODO Auto-generated - * method stub return null; } - * - * @Override public @Nullable String getAttributeName() { // TODO Auto-generated - * method stub return - * "/network-element/extension[value-name=\"top-level-equipment\"]/value"; // - * "/equipment-pac/equipment-current-problems"; } - * - * @Override public Class<? extends DataContainer> getImplementedInterface() { - * // TODO Auto-generated method stub return null; } }; - * - * onfCoreNetworkElement12Basic.notificationActor(eventlogEntity); - */ - - } - - - @Test public void test1() { when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, NETWORKELEMENT_IID)).thenReturn(null); @@ -230,63 +102,10 @@ public class TestONFCoreNetworkElement12Basic { 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; - } - }; - + EventlogEntity eventlogEntity = mock(EventlogEntity.class); + when(eventlogEntity.getObjectId()).thenReturn("ABCD"); + when(eventlogEntity.getAttributeName()).thenReturn("/equipment-pac/equipment-current-problems"); + onfCoreNetworkElement12MW.notificationActor(eventlogEntity); } diff --git a/sdnr/wt/devicemanager-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 dcef80916..221ca40ed 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 @@ -94,86 +94,7 @@ public class TestONFCoreNetworkElement12Microwave { @Test public void test() { - optionalNe = new NetworkElement() { - - @Override - public @Nullable List<Label> getLabel() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<Extension> getExtension() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable OperationalState getOperationalState() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable LifecycleState getLifecycleState() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable AdministrativeState getAdministrativeState() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable AdministrativeControl getAdministrativeControl() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<Name> getName() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable UniversalId getUuid() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<LocalId> getLocalId() { - // TODO Auto-generated method stub - return null; - } - - @Override - public <E$$ extends Augmentation<NetworkElement>> @Nullable E$$ augmentation(Class<E$$> augmentationType) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Class<? extends DataContainer> getImplementedInterface() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<Ltp> getLtp() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<Fd> getFd() { - // TODO Auto-generated method stub - return null; - } - }; + optionalNe = mock(NetworkElement.class); when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, NETWORKELEMENT_IID)).thenReturn(optionalNe); @@ -182,62 +103,9 @@ public class TestONFCoreNetworkElement12Microwave { 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 "/network-element/extension[value-name=\"top-level-equipment\"]/value"; // "/equipment-pac/equipment-current-problems"; - } - - @Override - public Class<? extends DataContainer> getImplementedInterface() { - // TODO Auto-generated method stub - return null; - } - }; + EventlogEntity eventlogEntity = mock(EventlogEntity.class); + when(eventlogEntity.getObjectId()).thenReturn("ABCD"); + when(eventlogEntity.getAttributeName()).thenReturn("/network-element/extension[value-name=\"top-level-equipment\"]/value"); onfCoreNetworkElement12MW.notificationActor(eventlogEntity); @@ -253,62 +121,9 @@ public class TestONFCoreNetworkElement12Microwave { 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; - } - }; + EventlogEntity eventlogEntity = mock(EventlogEntity.class); + when(eventlogEntity.getObjectId()).thenReturn("ABCD"); + when(eventlogEntity.getAttributeName()).thenReturn("/equipment-pac/equipment-current-problems"); onfCoreNetworkElement12MW.notificationActor(eventlogEntity); } |