<dependency> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
+ <version>2.6.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-smile</artifactId>
+ <version>2.6.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
+ <version>2.6.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-cbor</artifactId>
+ <version>2.6.3</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -305,6 +311,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
+ <version>3.4</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -312,6 +319,7 @@
<artifactId>delete-by-query</artifactId>
<scope>provided</scope>
</dependency>
+
</dependencies>
<build>
<resources>
@@ -332,6 +340,7 @@
<configuration>
<instructions>
<Import-Package>
+ org.w3c.dom,
org.opendaylight.controller.md.sal.binding.api;version="[1.6,2)",
org.opendaylight.controller.md.sal.common.api.data;version="[1.6,2)",
org.opendaylight.controller.sal.binding.api;version="[1.6,2)",
@@ -392,7 +401,6 @@
org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105,
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714;version="[1.4,2)",
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ptp.dataset.rev170208;version="[0.3,1)",
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ptp.dataset.rev170208.port.ds.entry;version="[0.3,1)",
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715;version="[2013.7,2014)",
org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320;version="[0.3,1)",
org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g;version="[0.3,1)",
@@ -455,3 +463,4 @@
</plugins>
</build>
</project>
+
@@ -6,9 +6,9 @@
* =================================================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
@@ -22,6 +22,14 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
+/**
+ * Provide a thread that is receiving and process notifications.
+ * @param <T> represents the object that is provided with a notification and
+ * forwarded to the NotificationActor<T>.
+ *
+ * @author herbert
+ */
+
public class NotificationWorker<T> implements AutoCloseable {
private final BlockingQueue<T> workQueue;
@@ -17,51 +17,28 @@
******************************************************************************/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.AllPm;
+
import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.Capabilities;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ONFLayerProtocolName;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.GenericTransactionUtils;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.OnfMicrowaveModel;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.WrapperMicrowaveModelRev170324;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.WrapperMicrowaveModelRev180907;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.WrapperMicrowaveModelRev181010;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.toggleAlarmFilter.NotificationDelayService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.ProviderClient;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.service.HtDatabaseEventsService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.listener.MicrowaveEventListener12;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.listener.NetconfEventListener12;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.AttributeValueChangedNotificationXml;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClient;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.MaintenanceService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsHistoricalPerformance15Minutes;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsHistoricalPerformance24Hours;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.MountPoint;
-import org.opendaylight.controller.md.sal.binding.api.NotificationService;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.extension.g.Extension;
import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.network.element.Ltp;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.GranularityPeriodType;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.network.element.pac.NetworkElementCurrentProblems;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.NotificationListener;
-import org.opendaylight.yangtools.yang.common.QName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.base.Optional;
/**
* Get information over NETCONF device according to ONF Coremodel. Read networkelement and
@@ -86,12 +63,9 @@ public class ONFCoreNetworkElement12 extends ONFCoreNetworkElement12Base
/*-----------------------------------------------------------------------------
* Class members
*/
- private final @Nonnull MicrowaveEventListener12 microwaveEventListener;
- private final @Nonnull OnfMicrowaveModel microwaveModel;
+ private final @Nonnull NetconfEventListener12 netconfEventListener;
private final NotificationWorker<AttributeValueChangedNotificationXml> notificationQueue;
- private ListenerRegistration<NotificationListener> listenerRegistrationresult = null;
-
/*-----------------------------------------------------------------------------
* Construction
*/
@@ -106,71 +80,20 @@ public class ONFCoreNetworkElement12 extends ONFCoreNetworkElement12Base
* @param databaseService to access the database
* @param dcaeProvider to forward problem / change notifications
*/
- private ONFCoreNetworkElement12(String mountPointNodeName, Capabilities capabilities,
+ ONFCoreNetworkElement12(String mountPointNodeName, Capabilities capabilities,
DataBroker netconfNodeDataBroker, WebSocketServiceClient webSocketService,
HtDatabaseEventsService databaseService, ProviderClient dcaeProvider, @Nullable ProviderClient aotsmClient,
MaintenanceService maintenanceService,
- NotificationDelayService<ProblemNotificationXml> notificationDelayService,
- OnfMicrowaveModel onfMicrowaveModel) {
+ NotificationDelayService<ProblemNotificationXml> notificationDelayService ) {
super(mountPointNodeName, netconfNodeDataBroker, capabilities);
- this.microwaveModel = onfMicrowaveModel;
- this.microwaveModel.setCoreData(this);
-
- // Create MicrowaveService here
- this.microwaveEventListener = new MicrowaveEventListener12(mountPointNodeName, webSocketService,
+ this.netconfEventListener = new NetconfEventListener12(mountPointNodeName, webSocketService,
databaseService, dcaeProvider, aotsmClient, maintenanceService, notificationDelayService, this);
- this.microwaveModel.setOnfMicrowaveModelListener(microwaveEventListener);
-
this.notificationQueue = new NotificationWorker<>(1, 100, this);
- // ->Below shifted to super class
- // this.isNetworkElementCurrentProblemsSupporting12 =
- // capabilities.isSupportingNamespaceAndRevision(NetworkElementPac.QNAME);
- // LOG.debug("support necurrent-problem-list=" + this.isNetworkElementCurrentProblemsSupporting12);
- // LOG.info("Create NE instance {}", InstanceList.QNAME.getLocalName());
-
}
- /**
- * Check capabilities are matching the this specific implementation and create network element
- * representation if so.
- *
- * @param mountPointNodeName as String
- * @param capabilities of the specific network element
- * @param netconfNodeDataBroker for the network element specific data
- * @param webSocketService to forward event notifications
- * @param databaseService to access the database
- * @param dcaeProvider to forward problem / change notifications
- * @return created Object if conditions are OK or null if not.
- */
- public static @Nullable ONFCoreNetworkElement12 build(String mountPointNodeName, Capabilities capabilities,
- DataBroker netconfNodeDataBroker, WebSocketServiceClient webSocketService,
- HtDatabaseEventsService databaseService, ProviderClient dcaeProvider, @Nullable ProviderClient aotsmClient,
- MaintenanceService maintenanceService,
- NotificationDelayService<ProblemNotificationXml> notificationDelayService) {
-
- if (capabilities.isSupportingNamespaceAndRevision(NetworkElement.QNAME)) {
- OnfMicrowaveModel onfMicrowaveModel = null;
-
- if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)) {
- onfMicrowaveModel = new WrapperMicrowaveModelRev170324();
- } else if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)) {
- onfMicrowaveModel = new WrapperMicrowaveModelRev180907();
- } else if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)) {
- onfMicrowaveModel = new WrapperMicrowaveModelRev181010();
- }
-
- if (onfMicrowaveModel != null) {
- return new ONFCoreNetworkElement12(mountPointNodeName, capabilities, netconfNodeDataBroker,
- webSocketService, databaseService, dcaeProvider, aotsmClient, maintenanceService,
- notificationDelayService, onfMicrowaveModel);
- }
- }
- return null;
-
- }
/*-----------------------------------------------------------------------------
* Functions
@@ -184,9 +107,9 @@ public class ONFCoreNetworkElement12 extends ONFCoreNetworkElement12Base
synchronized (dmLock) {
boolean change = readNetworkElementAndInterfaces();
if (change) {
- int problems = microwaveEventListener.removeAllCurrentProblemsOfNode();
+ int problems = netconfEventListener.removeAllCurrentProblemsOfNode();
List<ProblemNotificationXml> resultList = readAllCurrentProblemsOfNode();
- microwaveEventListener.initCurrentProblemStatus(resultList);
+ netconfEventListener.initCurrentProblemStatus(resultList);
LOG.info("Resync mountpoint {} for device {}. Removed {}. Current problems: {}", getMountPointNodeName(),
getUuId(), problems, resultList.size());
}
@@ -250,11 +173,11 @@ public class ONFCoreNetworkElement12 extends ONFCoreNetworkElement12Base
*/
private synchronized void syncEquipmentPac(String uuidString) {
- int problems = microwaveEventListener.removeObjectsCurrentProblemsOfNode(uuidString);
+ int problems = netconfEventListener.removeObjectsCurrentProblemsOfNode(uuidString);
LOG.debug("Removed {} problems for uuid {}", problems, uuidString);
- List<ProblemNotificationXml> resultList = equipment.addProblemsofNodeObject(uuidString);
- microwaveEventListener.initCurrentProblemStatus(resultList);
+ List<ProblemNotificationXml> resultList = getEquipment().addProblemsofNodeObject(uuidString);
+ netconfEventListener.initCurrentProblemStatus(resultList);
LOG.debug("Added {} problems for uuid {}", resultList.size(), uuidString);
}
@@ -272,7 +195,7 @@ public class ONFCoreNetworkElement12 extends ONFCoreNetworkElement12Base
// optionalNe.getLtp().get(0).getLp();
LOG.debug("Get info about {}", getMountPointNodeName());
- int problems = microwaveEventListener.removeAllCurrentProblemsOfNode();
+ int problems = netconfEventListener.removeAllCurrentProblemsOfNode();
LOG.debug("Removed all {} problems from database at registration", problems);
// Step 2.1: access data broker within this mount point
@@ -280,132 +203,22 @@ public class ONFCoreNetworkElement12 extends ONFCoreNetworkElement12Base
// Step 2.2: read ne from data store
readNetworkElementAndInterfaces();
- equipment.readNetworkElementEquipment();
+ getEquipment().readNetworkElementEquipment();
// Step 2.3: read the existing faults and add to DB
List<ProblemNotificationXml> resultList = readAllCurrentProblemsOfNode();
- equipment.addProblemsofNode(resultList);
+ getEquipment().addProblemsofNode(resultList);
- microwaveEventListener.initCurrentProblemStatus(resultList);
+ netconfEventListener.initCurrentProblemStatus(resultList);
- microwaveEventListener.writeEquipment(equipment);
+ netconfEventListener.writeEquipment(getEquipment());
LOG.info("Found info at {} for device {} number of problems: {}", getMountPointNodeName(), getUuId(),
resultList.size());
}
- /**
- * LOG the newly added problems of the interface pac
- *
- * @param idxStart
- * @param uuid
- * @param resultList
- */
- private void debugResultList(String uuid, List<ProblemNotificationXml> resultList, int idxStart) {
- if (LOG.isDebugEnabled()) {
- StringBuffer sb = new StringBuffer();
- int idx = 0;
- for (int t = idxStart; t < resultList.size(); t++) {
- sb.append(idx++);
- sb.append(":{");
- sb.append(resultList.get(t));
- sb.append('}');
- }
- LOG.debug("Found problems {} {}", uuid, sb.toString());
- }
- }
-
- /**
- * Read from NetworkElement and verify LTPs have changed. If the NE has changed, update to the new
- * structure. From initial state it changes also.
- */
- private synchronized boolean readNetworkElementAndInterfaces() {
-
- LOG.debug("Update mountpoint if changed {}", getMountPointNodeName());
-
- optionalNe = GenericTransactionUtils.readData(getNetconfNodeDataBroker(), LogicalDatastoreType.OPERATIONAL,
- NETWORKELEMENT_IID);;
- synchronized (pmLock) {
- boolean change = false;
-
- if (optionalNe == null) {
- LOG.debug("Unable to read NE data for mountpoint {}", getMountPointNodeName());
- if (!interfaceList.isEmpty()) {
- interfaceList.clear();
- interfaceListIterator = null;
- change = true;
- }
-
- } else {
- LOG.debug("Mountpoint '{}' NE-Name '{}'", getMountPointNodeName(), optionalNe.getName());
- List<Lp> actualInterfaceList = getLtpList(optionalNe);
- if (!interfaceList.equals(actualInterfaceList)) {
- LOG.debug("Mountpoint '{}' Update LTP List. Elements {}", getMountPointNodeName(),
- actualInterfaceList.size());
- interfaceList.clear();
- interfaceList.addAll(actualInterfaceList);
- interfaceListIterator = null;
- change = true;
- }
- }
- return change;
- }
- }
- /**
- * Read current problems of AirInterfaces and EthernetContainer according to NE status into DB
- *
- * @return List with all problems
- */
- private List<ProblemNotificationXml> readAllCurrentProblemsOfNode() {
- // Step 2.3: read the existing faults and add to DB
- List<ProblemNotificationXml> resultList = new ArrayList<>();
- int idxStart; // Start index for debug messages
- UniversalId uuid;
-
- synchronized (pmLock) {
- for (Lp lp : interfaceList) {
-
- idxStart = resultList.size();
- uuid = lp.getUuid();
- Class<?> lpClass = getLpExtension(lp);
-
- ONFLayerProtocolName lpName = ONFLayerProtocolName.valueOf(lp.getLayerProtocolName());
-
- microwaveModel.readTheFaultsOfMicrowaveModel(lpName, lpClass, uuid, resultList);
-
- debugResultList(uuid.getValue(), resultList, idxStart);
-
- }
- }
-
- // Step 2.4: Read other problems from mountpoint
- if (isNetworkElementCurrentProblemsSupporting12) {
- idxStart = resultList.size();
- readNetworkElementCurrentProblems12(resultList);
- debugResultList("CurrentProblems12", resultList, idxStart);
- }
-
- return resultList;
-
- }
-
- /**
- * Get uuid of Optional NE.
- *
- * @return Uuid or EMPTY String if optionNE is not available
- */
- private String getUuId() {
- String uuid = EMPTY;
-
- try {
- uuid = optionalNe != null ? optionalNe.getUuid() != null ? optionalNe.getUuid().getValue() : EMPTY : EMPTY;
- } catch (NullPointerException e) {
- // Unfortunately throws null pointer if not definied
- }
- return uuid;
- }
/**
* Read the NetworkElement part from database.
@@ -423,54 +236,6 @@ public class ONFCoreNetworkElement12 extends ONFCoreNetworkElement12Base
}
/**
- * Get from LayerProtocolExtensions the related generated ONF Interface PAC class which represents it.
- *
- * @param lp logical termination point
- * @return Class of InterfacePac
- */
- @Nullable
- private Class<?> getLpExtension(@Nullable Lp lp) {
-
- String capability = EMPTY;
- String revision = EMPTY;
- String conditionalPackage = EMPTY;
- Class<?> res = null;
-
- if (lp != null) {
- for (Extension e : getExtensionList(lp)) {
- if (e.getValueName().contentEquals("capability")) {
- capability = e.getValue();
- int idx = capability.indexOf("?");
- if (idx != -1) {
- capability = capability.substring(0, idx);
- }
- }
- if (e.getValueName().contentEquals("revision")) {
- revision = e.getValue();
- }
- if (e.getValueName().contentEquals("conditional-package")) {
- conditionalPackage = e.getValue();
- }
- }
- }
- // QName qName =
- // org.opendaylight.yangtools.yang.common.QName.create("urn:onf:params:xml:ns:yang:microwave-model",
- // "2017-03-24", "mw-air-interface-pac").intern();
- LOG.info("LpExtension capability={} revision={} conditionalPackage={}", capability, revision,
- conditionalPackage);
- if (!capability.isEmpty() && !revision.isEmpty() && !conditionalPackage.isEmpty()) {
- try {
- 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,
- e.getMessage());
- }
- }
- return res;
- }
-
- /**
* Read element from class that could be not available
*
* @param ltp layer termination point
@@ -486,257 +251,16 @@ public class ONFCoreNetworkElement12 extends ONFCoreNetworkElement12Base
}
/**
- * Get List of UUIDs for conditional packages from Networkelement<br>
- * Possible interfaces are:<br>
- * MWPS, LTP(MWPS-TTP), MWAirInterfacePac, MicrowaveModel-ObjectClasses-AirInterface<br>
- * ETH-CTP,LTP(Client), MW_EthernetContainer_Pac<br>
- * MWS, LTP(MWS-CTP-xD), MWAirInterfaceDiversityPac,
- * MicrowaveModel-ObjectClasses-AirInterfaceDiversity<br>
- * MWS, LTP(MWS-TTP), ,MicrowaveModel-ObjectClasses-HybridMwStructure<br>
- * MWS, LTP(MWS-TTP), ,MicrowaveModel-ObjectClasses-PureEthernetStructure<br>
- *
- * @param ne Networkelement
- * @return Id List, never null.
- */
- private static List<Lp> getLtpList(@Nullable NetworkElement ne) {
-
- List<Lp> res = Collections.synchronizedList(new ArrayList<Lp>());
-
- if (ne != null) {
- List<Ltp> ltpRefList = ne.getLtp();
- if (ltpRefList == null) {
- LOG.debug("DBRead NE-Interfaces: null");
- } else {
- for (Ltp ltRefListE : ltpRefList) {
- List<Lp> lpList = ltRefListE.getLp();
- if (lpList == null) {
- LOG.debug("DBRead NE-Interfaces Reference List: null");
- } else {
- for (Lp ltp : lpList) {
- //// LayerProtocolName layerProtocolName = lpListE.getLayerProtocolName();
- // UniversalId uuId = lpListE.getUuid();
- res.add(ltp);
- }
- }
- }
- }
- } else {
- LOG.debug("DBRead NE: null");
- }
-
- // ---- Debug
- if (LOG.isDebugEnabled()) {
- StringBuffer strBuf = new StringBuffer();
- for (Lp ltp : res) {
- if (strBuf.length() > 0) {
- strBuf.append(", ");
- }
- strBuf.append(ltp.getLayerProtocolName().getValue());
- strBuf.append(':');
- strBuf.append(ltp.getUuid().getValue());
- }
- LOG.debug("DBRead NE-Interfaces: {}", strBuf.toString());
- }
- // ---- Debug end
-
- return res;
- }
-
-
- @Nonnull
- private List<? extends OtnHistoryDataG> readTheHistoricalPerformanceData(Lp lp) {
- ONFLayerProtocolName lpName = ONFLayerProtocolName.valueOf(lp.getLayerProtocolName());
-
- return this.microwaveModel.readTheHistoricalPerformanceData(lpName, lp);
- /*
- * switch (lpName) { case MWAirInterface: return
- * readTheHistoricalPerformanceDataOfMwAirInterfacePac(lp);
- *
- * case EthernetContainer12: return readTheHistoricalPerformanceDataOfEthernetContainer(lp);
- *
- * case EthernetContainer10: case EthernetPhysical: case Ethernet: case TDMContainer: case
- * Structure: case Unknown: LOG.debug("Do not read HistoricalPM data for {} {}", lpName,
- * lp.getUuid().getValue()); break; } return new ArrayList<>();
- */
- }
-
- @Override
- public AllPm getHistoricalPM() {
-
- synchronized (pmLock) {
- if (pmLp != null) {
- LOG.debug("Enter query PM");
- AllPm allPm = new AllPm();
- Lp lp = pmLp;
-
- List<? extends OtnHistoryDataG> resultList = readTheHistoricalPerformanceData(lp);
- LOG.debug("Got records: {}", resultList.size());
- // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.GranularityPeriodType
- GranularityPeriodType granularityPeriod;
- for (OtnHistoryDataG perf : resultList) {
-
- granularityPeriod = perf.getGranularityPeriod();
- if (granularityPeriod == null) {
- granularityPeriod = GranularityPeriodType.Unknown;
- }
-
- switch (granularityPeriod) {
- case Period15Min: {
- EsHistoricalPerformance15Minutes pm =
- new EsHistoricalPerformance15Minutes(getMountPointNodeName(), lp)
- .setHistoricalRecord15Minutes(perf);
- allPm.add(pm);
- }
- break;
-
- case Period24Hours: {
- EsHistoricalPerformance24Hours pm =
- new EsHistoricalPerformance24Hours(getMountPointNodeName(), lp)
- .setHistoricalRecord24Hours(perf);
- LOG.debug("Write 24h write to DB");
- allPm.add(pm);
- }
- break;
-
- default:
- LOG.warn("Unknown granularity {}", perf.getGranularityPeriod());
- break;
-
- }
- }
- LOG.debug("Deliver normalized records: {}", allPm.size());
- return allPm;
- } else {
- LOG.debug("Deliver empty, no LTP");
- return AllPm.getEmpty();
- }
- }
- }
-
- @Override
- public void resetPMIterator() {
- synchronized (pmLock) {
- interfaceListIterator = interfaceList.iterator();
- }
- LOG.debug("PM reset iterator");
- }
-
- @Override
- public boolean hasNext() {
- boolean res;
- synchronized (pmLock) {
- res = interfaceListIterator != null ? interfaceListIterator.hasNext() : false;
- }
- LOG.debug("PM hasNext LTP {}", res);
- return res;
- }
-
- @Override
- public void next() {
- synchronized (pmLock) {
- if (interfaceListIterator == null) {
- pmLp = null;
- LOG.debug("PM next LTP null");
- } else {
- pmLp = interfaceListIterator.next();
- LOG.debug("PM next LTP {}", pmLp.getLayerProtocolName().getValue());
- }
- }
- }
-
- @Override
- public String pmStatusToString() {
- StringBuffer res = new StringBuffer();
- synchronized (pmLock) {
- res.append(pmLp == null ? "no interface" : pmLp.getLayerProtocolName().getValue());
- for (Lp lp : interfaceList) {
- res.append("IF:");
- res.append(lp.getLayerProtocolName().getValue());
- res.append(" ");
- }
- }
- return res.toString();
- }
-
- /**
* Remove all entries from list
*/
@Override
public int removeAllCurrentProblemsOfNode() {
- return microwaveEventListener.removeAllCurrentProblemsOfNode();
- }
-
- /**
- * Register the listener
- */
- @Override
- public void doRegisterMicrowaveEventListener(MountPoint mountPoint) {
- LOG.info("End registration listener for Mountpoint {}", mountPoint.getIdentifier().toString());
- final Optional<NotificationService> optionalNotificationService =
- mountPoint.getService(NotificationService.class);
- final NotificationService notificationService = optionalNotificationService.get();
- // notificationService.registerNotificationListener(microwaveEventListener);
- listenerRegistrationresult =
- notificationService.registerNotificationListener(microwaveModel.getNotificationListener());
- LOG.info("End registration listener for Mountpoint {} Listener: {} Result: {}",
- mountPoint.getIdentifier().toString(), optionalNotificationService, listenerRegistrationresult);
+ return netconfEventListener.removeAllCurrentProblemsOfNode();
}
- /*------------------------------------------------------------
- * private function to access database
- */
-
- /*-----------------------------------------------------------------------------
- * Reading problems for the networkElement V1.2
- */
-
- private List<ProblemNotificationXml> readNetworkElementCurrentProblems12(List<ProblemNotificationXml> resultList) {
-
- LOG.info("DBRead Get {} NetworkElementCurrentProblems12", getMountPointNodeName());
-
- InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac> networkElementCurrentProblemsIID =
- InstanceIdentifier.builder(
- org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac.class)
- .build();
-
- // Step 2.3: read to the config data store
- NetworkElementPac problemPac;
- NetworkElementCurrentProblems problems;
- try {
- problemPac = GenericTransactionUtils.readData(getNetconfNodeDataBroker(), LogicalDatastoreType.OPERATIONAL,
- networkElementCurrentProblemsIID);
- problems = problemPac.getNetworkElementCurrentProblems();
- if (problems == null) {
- LOG.debug("DBRead no NetworkElementCurrentProblems12");
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead empty CurrentProblemList12");
- } else {
- for (org.opendaylight.yang.gen.v1.urn.onf.params.xml.