aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager-core/provider
diff options
context:
space:
mode:
authorMichael DÜrre <michael.duerre@highstreet-technologies.com>2022-03-10 10:39:16 +0100
committerDan Timoney <dtimoney@att.com>2022-03-23 15:08:48 -0400
commiteb2a7c97c0007b013bd1784ac17d57be02b63d03 (patch)
treeb0861438532727219216cfd426e21ae053abb31a /sdnr/wt/devicemanager-core/provider
parent3c74361514bb920ed441d105f66ca978bd074ced (diff)
migrate sdnr features to phosphorus
fix mapper and switch to dom api Updated to use phosphorus version of parent poms Issue-ID: CCSDK-3566 Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com> Change-Id: I98c5bef9286622e0d66b53db687557d798cd53f5 Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/devicemanager-core/provider')
-rw-r--r--sdnr/wt/devicemanager-core/provider/pom.xml2
-rw-r--r--sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java1
-rw-r--r--sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/EventlogNotificationBuilder.java46
-rw-r--r--sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java4
-rw-r--r--sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ConnectionStatusHousekeepingService.java2
-rw-r--r--sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceCalculator.java2
-rw-r--r--sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerTask.java417
7 files changed, 216 insertions, 258 deletions
diff --git a/sdnr/wt/devicemanager-core/provider/pom.xml b/sdnr/wt/devicemanager-core/provider/pom.xml
index 22c4bd966..c4808211e 100644
--- a/sdnr/wt/devicemanager-core/provider/pom.xml
+++ b/sdnr/wt/devicemanager-core/provider/pom.xml
@@ -28,7 +28,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java
index 3d570e59a..94694cd90 100644
--- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java
+++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java
@@ -34,6 +34,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.toggleAlarmFilter.Deviceman
import org.onap.ccsdk.features.sdnr.wt.devicemanager.toggleAlarmFilter.NotificationDelayFilter;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.toggleAlarmFilter.NotificationDelayedListener;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.EquipmentData;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.EventlogNotificationBuilder;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity;
diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/EventlogNotificationBuilder.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/EventlogNotificationBuilder.java
deleted file mode 100644
index 3afa493b5..000000000
--- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/EventlogNotificationBuilder.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.eventdatahandler;
-
-import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-
-/**
- * Add specific constructor
- */
-public class EventlogNotificationBuilder extends EventlogBuilder {
-
- public EventlogNotificationBuilder(NodeId nodeId, @Nullable Integer counter, @Nullable DateAndTime timeStamp,
- @Nullable String objectId, @Nullable String attributeName, @Nullable String newValue) {
-
- setNodeId(nodeId.getValue());
- if (counter != null) {
- setCounter(counter);
- }
- if (timeStamp != null) {
- setTimestamp(timeStamp);
- }
- setObjectId(objectId);
- setAttributeName(attributeName);
- setNewValue(newValue);
-
- }
-
-}
diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java
index 4543ab0b4..ba65447e9 100644
--- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java
+++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java
@@ -195,7 +195,7 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea
DateAndTime ts = NETCONFTIME_CONVERTER.getTimeStamp();
AttributeValueChangedNotification notification = new AttributeValueChangedNotificationBuilder()
.setCounter(popEvntNumber()).setTimeStamp(ts).setObjectIdRef(nNodeId.getValue())
- .setAttributeName("deviceType").setNewValue(deviceType.name()).build();
+ .setAttributeName("deviceType").setNewValue(deviceType.getName()).build();
webSocketService.sendViaWebsockets(new NodeId(ownKeyName), notification,
AttributeValueChangedNotification.QNAME, ts);
}
@@ -231,7 +231,7 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea
// Write first to prevent missing entries
databaseService.removeNetworkConnection(nodeId.getValue());
databaseService.writeConnectionLog(log);
- webSocketService.sendViaWebsockets(new NodeId(nodeId.getValue()), notification,
+ webSocketService.sendViaWebsockets(new NodeId(ownKeyName), notification,
ObjectDeletionNotification.QNAME, ts);
}
diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ConnectionStatusHousekeepingService.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ConnectionStatusHousekeepingService.java
index 02c32d91b..f2726b091 100644
--- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ConnectionStatusHousekeepingService.java
+++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ConnectionStatusHousekeepingService.java
@@ -163,7 +163,7 @@ public class ConnectionStatusHousekeepingService
.setTimestamp(new DateAndTime(ts.getTimeStamp())).setObjectId(item.getNodeId())
.setAttributeName("status").setNewValue(String.valueOf(mdsalStatus))
.setCounter(popEvntNumber()).setSourceType(SourceType.Controller).build());
- if ((item.isIsRequired() == null || item.isIsRequired() == false)
+ if ((item.requireIsRequired() == null || item.requireIsRequired() == false)
&& mdsalStatus == ConnectionLogStatus.Disconnected) {
LOG.info("removing entry for node {} ({}) from database due missing MD-SAL entry",
item.getNodeId(), mdsalStatus);
diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceCalculator.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceCalculator.java
index 23ff50fb9..3d892e42d 100644
--- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceCalculator.java
+++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceCalculator.java
@@ -56,7 +56,7 @@ public class MaintenanceCalculator {
ZonedDateTime now) {
if (maintenance != null) {
- Boolean isActive = maintenance.isActive();
+ Boolean isActive = maintenance.getActive();
if (isActive != null && isActive && isInMaintenance(maintenance, objectIdRef, problem, now)) {
return true;
}
diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerTask.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerTask.java
index 0b5b331be..707675504 100644
--- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerTask.java
+++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerTask.java
@@ -24,6 +24,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
+
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.PerformanceDataProvider;
@@ -34,211 +35,213 @@ import org.slf4j.LoggerFactory;
public class PerformanceManagerTask implements Runnable {
- private static final Logger LOG = LoggerFactory.getLogger(PerformanceManagerTask.class);
- private static final String LOGMARKER = "PMTick";
-
- private int tickCounter = 0;
-
- private final ConcurrentHashMap<String, PerformanceDataProvider> queue = new ConcurrentHashMap<>();
- private final DataProvider databaseService;
- private final ScheduledExecutorService scheduler;
- private final long seconds;
-
- private ScheduledFuture<?> taskHandle = null;
- private Iterator<PerformanceDataProvider> neIterator = null;
- private PerformanceDataProvider actualNE = null;
- private final NetconfNetworkElementService netconfNetworkElementService;
-
- /**
- * Constructor of PM Task
- *
- * @param seconds seconds to call PM Task
- * @param microwaveHistoricalPerformanceWriterService DB Service to load PM data to
- * @param netconfNetworkElementService to write into log
- */
-
- public PerformanceManagerTask(long seconds, DataProvider microwaveHistoricalPerformanceWriterService,
- NetconfNetworkElementService netconfNetworkElementService) {
-
- LOG.info("Init task {} handling time {} seconds", PerformanceManagerTask.class.getSimpleName(), seconds);
- this.seconds = seconds;
- this.databaseService = microwaveHistoricalPerformanceWriterService;
- this.scheduler = Executors.newSingleThreadScheduledExecutor();
- this.netconfNetworkElementService = netconfNetworkElementService;
-
- }
-
- /**
- * Start PM Task
- */
- public void start() {
- LOG.info("PM task created");
- taskHandle = this.scheduler.scheduleAtFixedRate(this, 0, seconds, TimeUnit.SECONDS);
- LOG.info("PM task scheduled");
- }
-
- /**
- * Stop everything
- */
- public void stop() {
- LOG.info("Stop {}", PerformanceManagerImpl.class.getSimpleName());
- if (taskHandle != null) {
- taskHandle.cancel(true);
- try {
- scheduler.awaitTermination(10, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- LOG.debug("Scheduler stopped.", e);
- // Restore interrupted state...
- Thread.currentThread().interrupt();
- }
- }
- }
-
- /**
- * Add NE/Mountpoint to PM Processig
- *
- * @param mountPointNodeName to be added
- * @param ne that is connected to the mountpoint
- */
- public void registration(String mountPointNodeName, NetworkElement ne) {
-
- Optional<PerformanceDataProvider> oPmNe = ne.getService(PerformanceDataProvider.class);
- if (oPmNe.isPresent()) {
- queue.put(mountPointNodeName, oPmNe.get());
- }
- }
-
- /**
- * Remove mountpoint/NE from PM process
- *
- * @param mountPointNodeName that has to be removed
- */
- public void deRegistration(String mountPointNodeName) {
- LOG.debug("Deregister {}", mountPointNodeName);
- PerformanceDataProvider removedNE = queue.remove(mountPointNodeName);
-
- if (removedNE == null) {
- LOG.warn("Couldn't delete {}", mountPointNodeName);
- }
- }
-
- /*--------------------------------------------------------------
- * Task to read PM data from NE
- */
-
- /**
- * Task runner to read all performance data from Network Elements. Catch exceptions to make sure, that the Task is
- * not stopped.
- */
- @Override
- public void run() {
-
- String mountpointName = "No NE";
- if (actualNE != null && actualNE.getAcessor().isPresent()) {
- mountpointName = actualNE.getAcessor().get().getNodeId().getValue();
- }
- LOG.debug("{} start {} Start with mountpoint {}", LOGMARKER, tickCounter, mountpointName);
-
- // Proceed to next NE/Interface
- getNextInterface(mountpointName);
-
- LOG.debug("{} {} Next interface to handle {}", LOGMARKER, tickCounter,
- actualNE == null ? "No NE/IF" : actualNE.pmStatusToString());
-
- if (actualNE != null) {
- try {
- LOG.debug("{} Start to read PM from NE ({})", LOGMARKER, tickCounter);
- Optional<PerformanceDataLtp> allPm = actualNE.getLtpHistoricalPerformanceData();
- if (allPm.isPresent()) {
- LOG.debug("{} {} Got PM list. Start write to DB", LOGMARKER, tickCounter);
- databaseService.doWritePerformanceData(allPm.get().getList());
- }
- LOG.debug("{} {} PM List end.", LOGMARKER, tickCounter);
- } catch (Throwable e) {
- LOG.debug("{} {} PM Exception", LOGMARKER, tickCounter);
- String msg = new StringBuffer().append(e.getMessage()).toString();
- LOG.warn("{} {} PM read/write failed. Write log entry {}", LOGMARKER, tickCounter, msg);
- netconfNetworkElementService.writeToEventLog(mountpointName, "PM Problem", msg);
- }
- }
-
- LOG.debug("{} end {}", LOGMARKER, tickCounter);
- tickCounter++;
- }
-
- /**
- * Reset queue to start from beginning
- */
- private void resetQueue() {
- actualNE = null;
- neIterator = null;
- }
-
- /**
- * Get then next interface in the list. First try to find a next on the actual NE. If not available search next
- * interface at a NE Special Situations to handle: Empty queue, NEs, but no interfaces
- */
- private void getNextInterface(String mountpointName) {
- boolean started = false;
- int loopCounter = 0;
-
- LOG.debug("{} {} getNextInterface enter. Queue size {} ", LOGMARKER, tickCounter, queue.size());
-
- if (actualNE != null && !queue.containsValue(actualNE)) {
- LOG.debug("{} {} NE Removed duringprocessing A", LOGMARKER, tickCounter);
- resetQueue();
- }
-
- while (true) {
-
- if (loopCounter++ >= 1000) {
- LOG.error("{} {} Problem in PM iteration. endless condition reached", LOGMARKER, tickCounter);
- resetQueue();
- break;
- }
-
- LOG.debug("{} {} Loop ne {}:neiterator {}:Interfaceiterator:{} Loop:{}", LOGMARKER, tickCounter,
- actualNE == null ? "null" : mountpointName, neIterator == null ? "null" : neIterator.hasNext(),
- actualNE == null ? "null" : actualNE.hasNext(), loopCounter);
-
- if (actualNE != null && actualNE.hasNext()) {
- // Yes, there is an interface, deliver back
- LOG.debug("{} {} getNextInterface yes A", LOGMARKER, tickCounter);
- actualNE.next();
- break;
-
- } else {
- // No element in neInterfaceInterator .. get next NE and try
- if (neIterator != null && neIterator.hasNext()) {
- // Set a new NE
- LOG.debug("{} {} Next NE A", LOGMARKER, tickCounter);
- actualNE = neIterator.next();
- actualNE.resetPMIterator();
-
- } else {
- // Goto start condition 1) first entry 2) end of queue reached
- LOG.debug("{} {} Reset", LOGMARKER, tickCounter);
- resetQueue();
-
- if (queue.isEmpty()) {
- LOG.debug("{} {} no nextInterfac. queue empty", LOGMARKER, tickCounter);
- break;
- } else if (!started) {
- LOG.debug("{} {} getNextInterface start condition. Get interator.", LOGMARKER, tickCounter);
- neIterator = queue.values().iterator();
- started = true;
- } else {
- LOG.debug("{} {} no nextInterface", LOGMARKER, tickCounter);
- break;
- }
- }
- }
- } // while
-
- if (actualNE != null && !queue.containsValue(actualNE)) {
- LOG.debug("{} {} NE Removed duringprocessing B", LOGMARKER, tickCounter);
- resetQueue();
- }
-
- }
+ private static final Logger LOG = LoggerFactory.getLogger(PerformanceManagerTask.class);
+ private static final String LOGMARKER = "PMTick";
+
+ private int tickCounter = 0;
+
+ private final ConcurrentHashMap<String, PerformanceDataProvider> queue = new ConcurrentHashMap<>();
+ private final DataProvider databaseService;
+ private final ScheduledExecutorService scheduler;
+ private final long seconds;
+
+ private ScheduledFuture<?> taskHandle = null;
+ private Iterator<PerformanceDataProvider> neIterator = null;
+ private PerformanceDataProvider actualNE = null;
+ private final NetconfNetworkElementService netconfNetworkElementService;
+
+ /**
+ * Constructor of PM Task
+ *
+ * @param seconds seconds to call PM Task
+ * @param microwaveHistoricalPerformanceWriterService DB Service to load PM data
+ * to
+ * @param netconfNetworkElementService to write into log
+ */
+
+ public PerformanceManagerTask(long seconds, DataProvider microwaveHistoricalPerformanceWriterService,
+ NetconfNetworkElementService netconfNetworkElementService) {
+
+ LOG.info("Init task {} handling time {} seconds", PerformanceManagerTask.class.getSimpleName(), seconds);
+ this.seconds = seconds;
+ this.databaseService = microwaveHistoricalPerformanceWriterService;
+ this.scheduler = Executors.newSingleThreadScheduledExecutor();
+ this.netconfNetworkElementService = netconfNetworkElementService;
+
+ }
+
+ /**
+ * Start PM Task
+ */
+ public void start() {
+ LOG.info("PM task created");
+ taskHandle = this.scheduler.scheduleAtFixedRate(this, 0, seconds, TimeUnit.SECONDS);
+ LOG.info("PM task scheduled");
+ }
+
+ /**
+ * Stop everything
+ */
+ public void stop() {
+ LOG.info("Stop {}", PerformanceManagerImpl.class.getSimpleName());
+ if (taskHandle != null) {
+ taskHandle.cancel(true);
+ try {
+ scheduler.awaitTermination(10, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {
+ LOG.debug("Scheduler stopped.", e);
+ // Restore interrupted state...
+ Thread.currentThread().interrupt();
+ }
+ }
+ }
+
+ /**
+ * Add NE/Mountpoint to PM Processig
+ *
+ * @param mountPointNodeName to be added
+ * @param ne that is connected to the mountpoint
+ */
+ public void registration(String mountPointNodeName, NetworkElement ne) {
+
+ Optional<PerformanceDataProvider> oPmNe = ne.getService(PerformanceDataProvider.class);
+ if (oPmNe.isPresent()) {
+ queue.put(mountPointNodeName, oPmNe.get());
+ }
+ }
+
+ /**
+ * Remove mountpoint/NE from PM process
+ *
+ * @param mountPointNodeName that has to be removed
+ */
+ public void deRegistration(String mountPointNodeName) {
+ LOG.debug("Deregister {}", mountPointNodeName);
+ PerformanceDataProvider removedNE = queue.remove(mountPointNodeName);
+
+ if (removedNE == null) {
+ LOG.warn("Couldn't delete {}", mountPointNodeName);
+ }
+ }
+
+ /*--------------------------------------------------------------
+ * Task to read PM data from NE
+ */
+
+ /**
+ * Task runner to read all performance data from Network Elements. Catch
+ * exceptions to make sure, that the Task is not stopped.
+ */
+ @Override
+ public void run() {
+
+ String mountpointName = "No NE";
+ if (actualNE != null && actualNE.getAcessor().isPresent()) {
+ mountpointName = actualNE.getAcessor().get().getNodeId().getValue();
+ }
+ LOG.debug("{} start {} Start with mountpoint {}", LOGMARKER, tickCounter, mountpointName);
+
+ // Proceed to next NE/Interface
+ getNextInterface(mountpointName);
+
+ LOG.debug("{} {} Next interface to handle {}", LOGMARKER, tickCounter,
+ actualNE == null ? "No NE/IF" : actualNE.pmStatusToString());
+
+ if (actualNE != null) {
+ try {
+ LOG.debug("{} Start to read PM from NE ({})", LOGMARKER, tickCounter);
+ Optional<PerformanceDataLtp> allPm = actualNE.getLtpHistoricalPerformanceData();
+ if (allPm.isPresent()) {
+ LOG.debug("{} {} Got PM list. Start write to DB", LOGMARKER, tickCounter);
+ databaseService.doWritePerformanceData(allPm.get().getList());
+ }
+ LOG.debug("{} {} PM List end.", LOGMARKER, tickCounter);
+ } catch (Throwable e) {
+ LOG.debug("{} {} PM Exception", LOGMARKER, tickCounter);
+ String msg = new StringBuffer().append(e.getMessage()).toString();
+ LOG.warn("{} {} PM read/write failed. Write log entry {}", LOGMARKER, tickCounter, msg);
+ netconfNetworkElementService.writeToEventLog(mountpointName, "PM Problem", msg);
+ }
+ }
+
+ LOG.debug("{} end {}", LOGMARKER, tickCounter);
+ tickCounter++;
+ }
+
+ /**
+ * Reset queue to start from beginning
+ */
+ private void resetQueue() {
+ actualNE = null;
+ neIterator = null;
+ }
+
+ /**
+ * Get then next interface in the list. First try to find a next on the actual
+ * NE. If not available search next interface at a NE Special Situations to
+ * handle: Empty queue, NEs, but no interfaces
+ */
+ private void getNextInterface(String mountpointName) {
+ boolean started = false;
+ int loopCounter = 0;
+
+ LOG.debug("{} {} getNextInterface enter. Queue size {} ", LOGMARKER, tickCounter, queue.size());
+
+ if (actualNE != null && !queue.containsValue(actualNE)) {
+ LOG.debug("{} {} NE Removed duringprocessing A", LOGMARKER, tickCounter);
+ resetQueue();
+ }
+
+ while (true) {
+
+ if (loopCounter++ >= 1000) {
+ LOG.error("{} {} Problem in PM iteration. endless condition reached", LOGMARKER, tickCounter);
+ resetQueue();
+ break;
+ }
+
+ LOG.debug("{} {} Loop ne {}:neiterator {}:Interfaceiterator:{} Loop:{}", LOGMARKER, tickCounter,
+ actualNE == null ? "null" : mountpointName, neIterator == null ? "null" : neIterator.hasNext(),
+ actualNE == null ? "null" : actualNE.hasNext(), loopCounter);
+
+ if (actualNE != null && actualNE.hasNext()) {
+ // Yes, there is an interface, deliver back
+ LOG.debug("{} {} getNextInterface yes A", LOGMARKER, tickCounter);
+ actualNE.next();
+ break;
+
+ } else {
+ // No element in neInterfaceInterator .. get next NE and try
+ if (neIterator != null && neIterator.hasNext()) {
+ // Set a new NE
+ LOG.debug("{} {} Next NE A", LOGMARKER, tickCounter);
+ actualNE = neIterator.next();
+ actualNE.resetPMIterator();
+
+ } else {
+ // Goto start condition 1) first entry 2) end of queue reached
+ LOG.debug("{} {} Reset", LOGMARKER, tickCounter);
+ resetQueue();
+
+ if (queue.isEmpty()) {
+ LOG.debug("{} {} no nextInterfac. queue empty", LOGMARKER, tickCounter);
+ break;
+ } else if (!started) {
+ LOG.debug("{} {} getNextInterface start condition. Get interator.", LOGMARKER, tickCounter);
+ neIterator = queue.values().iterator();
+ started = true;
+ } else {
+ LOG.debug("{} {} no nextInterface", LOGMARKER, tickCounter);
+ break;
+ }
+ }
+ }
+ } // while
+
+ if (actualNE != null && !queue.containsValue(actualNE)) {
+ LOG.debug("{} {} NE Removed duringprocessing B", LOGMARKER, tickCounter);
+ resetQueue();
+ }
+
+ }
}