diff options
author | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2022-01-31 11:07:35 +0530 |
---|---|---|
committer | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2022-01-31 12:49:04 +0530 |
commit | a31d1f3f489fdc6f68aecfaf66bf02cf6148f173 (patch) | |
tree | 230713c3d58b6af5a0026e61cc0ec1450250c6f8 /sdnr/wt/devicemanager-core/provider | |
parent | 4d62788c11ac7e3a18e5c4b3eccf5eb5896bde70 (diff) |
refactor devicemanager-core
PerformanceDataProvider and Event classes
Issue-ID: CCSDK-3574
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Change-Id: I0c8f800001a01cc638caa702571b32824dbddca9
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/devicemanager-core/provider')
3 files changed, 58 insertions, 19 deletions
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 94694cd90..3d570e59a 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,7 +34,6 @@ 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 new file mode 100644 index 000000000..3afa493b5 --- /dev/null +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/EventlogNotificationBuilder.java @@ -0,0 +1,46 @@ +/* + * ============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/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 8fe6b9565..0b5b331be 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 @@ -51,7 +51,7 @@ public class PerformanceManagerTask implements Runnable { /** * 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 @@ -60,7 +60,7 @@ public class PerformanceManagerTask implements Runnable { public PerformanceManagerTask(long seconds, DataProvider microwaveHistoricalPerformanceWriterService, NetconfNetworkElementService netconfNetworkElementService) { - LOG.debug("Init task {}", PerformanceManagerTask.class.getSimpleName()); + LOG.info("Init task {} handling time {} seconds", PerformanceManagerTask.class.getSimpleName(), seconds); this.seconds = seconds; this.databaseService = microwaveHistoricalPerformanceWriterService; this.scheduler = Executors.newSingleThreadScheduledExecutor(); @@ -87,7 +87,7 @@ public class PerformanceManagerTask implements Runnable { try { scheduler.awaitTermination(10, TimeUnit.SECONDS); } catch (InterruptedException e) { - LOG.debug("Schdule stopped.", e); + LOG.debug("Scheduler stopped.", e); // Restore interrupted state... Thread.currentThread().interrupt(); } @@ -96,7 +96,7 @@ public class PerformanceManagerTask implements Runnable { /** * Add NE/Mountpoint to PM Processig - * + * * @param mountPointNodeName to be added * @param ne that is connected to the mountpoint */ @@ -110,7 +110,7 @@ public class PerformanceManagerTask implements Runnable { /** * Remove mountpoint/NE from PM process - * + * * @param mountPointNodeName that has to be removed */ public void deRegistration(String mountPointNodeName) { @@ -122,7 +122,6 @@ public class PerformanceManagerTask implements Runnable { } } - /*-------------------------------------------------------------- * Task to read PM data from NE */ @@ -140,7 +139,7 @@ public class PerformanceManagerTask implements Runnable { } LOG.debug("{} start {} Start with mountpoint {}", LOGMARKER, tickCounter, mountpointName); - //Proceed to next NE/Interface + // Proceed to next NE/Interface getNextInterface(mountpointName); LOG.debug("{} {} Next interface to handle {}", LOGMARKER, tickCounter, @@ -155,16 +154,11 @@ public class PerformanceManagerTask implements Runnable { databaseService.doWritePerformanceData(allPm.get().getList()); } LOG.debug("{} {} PM List end.", LOGMARKER, tickCounter); - } catch (Exception e) { - StringBuffer msg = new StringBuffer(); - msg.append(e.getMessage()); - msg.append(" - "); - msg.append(e.getCause().toString()); - msg.append(" - "); - msg.append(actualNE.pmStatusToString()); - String msgString = msg.toString(); - LOG.warn("{} {} PM read/write failed. Write log entry {}", LOGMARKER, tickCounter, msgString); - netconfNetworkElementService.writeToEventLog(mountpointName, "PM Problem", msgString); + } 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); } } @@ -239,7 +233,7 @@ public class PerformanceManagerTask implements Runnable { } } } - } //while + } // while if (actualNE != null && !queue.containsValue(actualNE)) { LOG.debug("{} {} NE Removed duringprocessing B", LOGMARKER, tickCounter); |