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;
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();
}
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) {
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);
}
* 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());
* 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());
// 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(),
// -- 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());
*
* @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);
* 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);
// 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(),
idxStart = resultList.size();
uuid = Helper.nnGetUniversalId(lp.getUuid());
+ @Nullable
Class<?> lpClass = getLpExtension(lp);
ONFLayerProtocolName lpName = ONFLayerProtocolName.valueOf(lp.getLayerProtocolName());
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());
}
}
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;
* @author herbert
*
*/
-@SuppressWarnings("deprecation")
public abstract class ONFCoreNetworkElementBase implements AutoCloseable, ONFCoreNetworkElementRepresentation {
private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElementBase.class);
@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"));
@Test
public void test1() {
when(capabilities.isSupportingNamespaceAndRevision(WrapperEquipmentPacRev170402.QNAME)).thenReturn(false);
- ONFCoreNetworkElement12Equipment onfCoreEqpt =
- new ONFCoreNetworkElement12Equipment(netconfAccessor, coreData, capabilities);
+ ONFCoreNetworkElement12Equipment onfCoreEqpt = new ONFCoreNetworkElement12Equipment(netconfAccessor, coreData);
}
}
}
- @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,
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);
}
@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);
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);
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);
}