1 /*******************************************************************************
2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
17 ******************************************************************************/
18 package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf;
20 import java.util.ArrayList;
21 import java.util.Collections;
22 import java.util.List;
23 import javax.annotation.Nonnull;
24 import javax.annotation.Nullable;
25 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime;
26 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity;
27 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.AllPm;
28 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.Capabilities;
29 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ONFLayerProtocolName;
30 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.GenericTransactionUtils;
31 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.OnfMicrowaveModel;
32 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.WrapperMicrowaveModelRev170324;
33 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.WrapperMicrowaveModelRev180907;
34 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.WrapperMicrowaveModelRev181010;
35 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.toggleAlarmFilter.NotificationDelayService;
36 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.ProviderClient;
37 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.service.HtDatabaseEventsService;
38 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.listener.MicrowaveEventListener12;
39 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.AttributeValueChangedNotificationXml;
40 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
41 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClient;
42 import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.MaintenanceService;
43 import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsHistoricalPerformance15Minutes;
44 import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsHistoricalPerformance24Hours;
45 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
46 import org.opendaylight.controller.md.sal.binding.api.MountPoint;
47 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
48 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
49 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement;
50 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
51 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.extension.g.Extension;
52 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
53 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.network.element.Ltp;
54 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.GranularityPeriodType;
55 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG;
56 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac;
57 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.network.element.pac.NetworkElementCurrentProblems;
58 import org.opendaylight.yangtools.concepts.ListenerRegistration;
59 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
60 import org.opendaylight.yangtools.yang.binding.NotificationListener;
61 import org.opendaylight.yangtools.yang.common.QName;
62 import org.slf4j.Logger;
63 import org.slf4j.LoggerFactory;
64 import com.google.common.base.Optional;
67 * Get information over NETCONF device according to ONF Coremodel. Read networkelement and
68 * conditional packages.
70 * Get conditional packages from Networkelement Possible interfaces are: MWPS, LTP(MWPS-TTP),
71 * MWAirInterfacePac, MicrowaveModel-ObjectClasses-AirInterface ETH-CTP,LTP(Client),
72 * MW_EthernetContainer_Pac MWS, LTP(MWS-CTP-xD), MWAirInterfaceDiversityPac,
73 * MicrowaveModel-ObjectClasses-AirInterfaceDiversity MWS, LTP(MWS-TTP),
74 * ,MicrowaveModel-ObjectClasses-HybridMwStructure MWS, LTP(MWS-TTP),
75 * ,MicrowaveModel-ObjectClasses-PureEthernetStructure
80 public class ONFCoreNetworkElement12 extends ONFCoreNetworkElement12Base
81 implements ONFCoreNetworkElementCallback, NotificationActor<AttributeValueChangedNotificationXml> {
83 private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElement12.class);
85 /*-----------------------------------------------------------------------------
88 private final @Nonnull MicrowaveEventListener12 microwaveEventListener;
89 private final @Nonnull OnfMicrowaveModel microwaveModel;
90 private final NotificationWorker<AttributeValueChangedNotificationXml> notificationQueue;
92 private ListenerRegistration<NotificationListener> listenerRegistrationresult = null;
94 /*-----------------------------------------------------------------------------
101 * @param mountPointNodeName as String
102 * @param capabilities of the specific network element
103 * @param netconfNodeDataBroker for the network element specific data
104 * @param webSocketService to forward event notifications
105 * @param databaseService to access the database
106 * @param dcaeProvider to forward problem / change notifications
108 private ONFCoreNetworkElement12(String mountPointNodeName, Capabilities capabilities,
109 DataBroker netconfNodeDataBroker, WebSocketServiceClient webSocketService,
110 HtDatabaseEventsService databaseService, ProviderClient dcaeProvider, @Nullable ProviderClient aotsmClient,
111 MaintenanceService maintenanceService,
112 NotificationDelayService<ProblemNotificationXml> notificationDelayService,
113 OnfMicrowaveModel onfMicrowaveModel) {
115 super(mountPointNodeName, netconfNodeDataBroker, capabilities);
117 this.microwaveModel = onfMicrowaveModel;
118 this.microwaveModel.setCoreData(this);
120 // Create MicrowaveService here
121 this.microwaveEventListener = new MicrowaveEventListener12(mountPointNodeName, webSocketService,
122 databaseService, dcaeProvider, aotsmClient, maintenanceService, notificationDelayService, this);
123 this.microwaveModel.setOnfMicrowaveModelListener(microwaveEventListener);
125 this.notificationQueue = new NotificationWorker<>(1, 100, this);
127 // ->Below shifted to super class
128 // this.isNetworkElementCurrentProblemsSupporting12 =
129 // capabilities.isSupportingNamespaceAndRevision(NetworkElementPac.QNAME);
130 // LOG.debug("support necurrent-problem-list=" + this.isNetworkElementCurrentProblemsSupporting12);
131 // LOG.info("Create NE instance {}", InstanceList.QNAME.getLocalName());
136 * Check capabilities are matching the this specific implementation and create network element
137 * representation if so.
139 * @param mountPointNodeName as String
140 * @param capabilities of the specific network element
141 * @param netconfNodeDataBroker for the network element specific data
142 * @param webSocketService to forward event notifications
143 * @param databaseService to access the database
144 * @param dcaeProvider to forward problem / change notifications
145 * @return created Object if conditions are OK or null if not.
147 public static @Nullable ONFCoreNetworkElement12 build(String mountPointNodeName, Capabilities capabilities,
148 DataBroker netconfNodeDataBroker, WebSocketServiceClient webSocketService,
149 HtDatabaseEventsService databaseService, ProviderClient dcaeProvider, @Nullable ProviderClient aotsmClient,
150 MaintenanceService maintenanceService,
151 NotificationDelayService<ProblemNotificationXml> notificationDelayService) {
153 if (capabilities.isSupportingNamespaceAndRevision(NetworkElement.QNAME)) {
154 OnfMicrowaveModel onfMicrowaveModel = null;
156 if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)) {
157 onfMicrowaveModel = new WrapperMicrowaveModelRev170324();
158 } else if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)) {
159 onfMicrowaveModel = new WrapperMicrowaveModelRev180907();
160 } else if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)) {
161 onfMicrowaveModel = new WrapperMicrowaveModelRev181010();
164 if (onfMicrowaveModel != null) {
165 return new ONFCoreNetworkElement12(mountPointNodeName, capabilities, netconfNodeDataBroker,
166 webSocketService, databaseService, dcaeProvider, aotsmClient, maintenanceService,
167 notificationDelayService, onfMicrowaveModel);
174 /*-----------------------------------------------------------------------------
179 * DeviceMonitor Prepare check by updating NE state and reading all interfaces.
182 public void prepareCheck() {
183 synchronized (dmLock) {
184 boolean change = readNetworkElementAndInterfaces();
186 int problems = microwaveEventListener.removeAllCurrentProblemsOfNode();
187 List<ProblemNotificationXml> resultList = readAllCurrentProblemsOfNode();
188 microwaveEventListener.initCurrentProblemStatus(resultList);
189 LOG.info("Resync mountpoint {} for device {}. Removed {}. Current problems: {}", getMountPointNodeName(),
190 getUuId(), problems, resultList.size());
195 // public boolean checkIfConnectionToMediatorIsOk() -> Shifted to super class
196 // public boolean checkIfConnectionToNeIsOk() -> Shifted to super class
198 /*-----------------------------------------------------------------------------
202 // public void initSynchronizationExtension() -> Shifted to super class
203 // private InstanceList readPTPClockInstances() -> Shifted to super class
205 /*-----------------------------------------------------------------------------
206 * Services for NE/Device synchronization
210 * Handling of specific Notifications from NE, indicating changes and need for synchronization.
212 * <attribute-value-changed-notification xmlns="urn:onf:params:xml:ns:yang:microwave-model">
213 * <attribute-name>/equipment-pac/equipment-current-problems</attribute-name>
214 * <object-id-ref>CARD-1.1.1.0</object-id-ref> <new-value></new-value>
215 * </attribute-value-changed-notification>
216 * <attribute-value-changed-notification xmlns="urn:onf:params:xml:ns:yang:microwave-model">
217 * <attribute-name>/network-element/extension[value-name="top-level-equipment"]/value</attribute-name>
218 * <object-id-ref>Hybrid-Z</object-id-ref>
219 * <new-value>SHELF-1.1.0.0,IDU-1.55.0.0,ODU-1.56.0.0,IDU-1.65.0.0</new-value>
220 * </attribute-value-changed-notification>
225 public void notificationFromNeListener(AttributeValueChangedNotificationXml notificationXml) {
226 notificationQueue.put(notificationXml);
230 public void notificationActor(AttributeValueChangedNotificationXml notificationXml) {
232 LOG.debug("Enter change notification listener");
233 if (LOG.isTraceEnabled()) {
234 LOG.trace("Notification: {}", notificationXml);
236 if (notificationXml.getAttributeName().equals("/equipment-pac/equipment-current-problems")) {
237 syncEquipmentPac(notificationXml.getObjectId());
238 } else if (notificationXml.getAttributeName()
239 .equals("/network-element/extension[value-name=\"top-level-equipment\"]/value")) {
240 initialReadFromNetworkElement();
242 LOG.debug("Leave change notification listener");
246 * Synchronize problems for a specific equipment-pac
248 * @param uuidString of the equipment-pac
250 private synchronized void syncEquipmentPac(String uuidString) {
252 int problems = microwaveEventListener.removeObjectsCurrentProblemsOfNode(uuidString);
253 LOG.debug("Removed {} problems for uuid {}", problems, uuidString);
255 List<ProblemNotificationXml> resultList = equipment.addProblemsofNodeObject(uuidString);
256 microwaveEventListener.initCurrentProblemStatus(resultList);
257 LOG.debug("Added {} problems for uuid {}", resultList.size(), uuidString);
262 /*-----------------------------------------------------------------------------
263 * Problem/Fault related functions
267 * Read during startup all relevant structure and status parameters from device
270 public synchronized void initialReadFromNetworkElement() {
271 // optionalNe.getLtp().get(0).getLp();
272 LOG.debug("Get info about {}", getMountPointNodeName());
274 int problems = microwaveEventListener.removeAllCurrentProblemsOfNode();
275 LOG.debug("Removed all {} problems from database at registration", problems);
277 // Step 2.1: access data broker within this mount point
278 LOG.debug("DBRead start");
280 // Step 2.2: read ne from data store
281 readNetworkElementAndInterfaces();
282 equipment.readNetworkElementEquipment();
284 // Step 2.3: read the existing faults and add to DB
285 List<ProblemNotificationXml> resultList = readAllCurrentProblemsOfNode();
286 equipment.addProblemsofNode(resultList);
288 microwaveEventListener.initCurrentProblemStatus(resultList);
290 microwaveEventListener.writeEquipment(equipment);
292 LOG.info("Found info at {} for device {} number of problems: {}", getMountPointNodeName(), getUuId(),
297 * LOG the newly added problems of the interface pac
303 private void debugResultList(String uuid, List<ProblemNotificationXml> resultList, int idxStart) {
304 if (LOG.isDebugEnabled()) {
305 StringBuffer sb = new StringBuffer();
307 for (int t = idxStart; t < resultList.size(); t++) {
310 sb.append(resultList.get(t));
313 LOG.debug("Found problems {} {}", uuid, sb.toString());
318 * Read from NetworkElement and verify LTPs have changed. If the NE has changed, update to the new
319 * structure. From initial state it changes also.
321 private synchronized boolean readNetworkElementAndInterfaces() {
323 LOG.debug("Update mountpoint if changed {}", getMountPointNodeName());
325 optionalNe = GenericTransactionUtils.readData(getNetconfNodeDataBroker(), LogicalDatastoreType.OPERATIONAL,
326 NETWORKELEMENT_IID);;
327 synchronized (pmLock) {
328 boolean change = false;
330 if (optionalNe == null) {
331 LOG.debug("Unable to read NE data for mountpoint {}", getMountPointNodeName());
332 if (!interfaceList.isEmpty()) {
333 interfaceList.clear();
334 interfaceListIterator = null;
339 LOG.debug("Mountpoint '{}' NE-Name '{}'", getMountPointNodeName(), optionalNe.getName());
340 List<Lp> actualInterfaceList = getLtpList(optionalNe);
341 if (!interfaceList.equals(actualInterfaceList)) {
342 LOG.debug("Mountpoint '{}' Update LTP List. Elements {}", getMountPointNodeName(),
343 actualInterfaceList.size());
344 interfaceList.clear();
345 interfaceList.addAll(actualInterfaceList);
346 interfaceListIterator = null;
355 * Read current problems of AirInterfaces and EthernetContainer according to NE status into DB
357 * @return List with all problems
359 private List<ProblemNotificationXml> readAllCurrentProblemsOfNode() {
361 // Step 2.3: read the existing faults and add to DB
362 List<ProblemNotificationXml> resultList = new ArrayList<>();
363 int idxStart; // Start index for debug messages
366 synchronized (pmLock) {
367 for (Lp lp : interfaceList) {
369 idxStart = resultList.size();
371 Class<?> lpClass = getLpExtension(lp);
373 ONFLayerProtocolName lpName = ONFLayerProtocolName.valueOf(lp.getLayerProtocolName());
375 microwaveModel.readTheFaultsOfMicrowaveModel(lpName, lpClass, uuid, resultList);
377 debugResultList(uuid.getValue(), resultList, idxStart);
382 // Step 2.4: Read other problems from mountpoint
383 if (isNetworkElementCurrentProblemsSupporting12) {
384 idxStart = resultList.size();
385 readNetworkElementCurrentProblems12(resultList);
386 debugResultList("CurrentProblems12", resultList, idxStart);
394 * Get uuid of Optional NE.
396 * @return Uuid or EMPTY String if optionNE is not available
398 private String getUuId() {
402 uuid = optionalNe != null ? optionalNe.getUuid() != null ? optionalNe.getUuid().getValue() : EMPTY : EMPTY;
403 } catch (NullPointerException e) {
404 // Unfortunately throws null pointer if not definied
410 * Read the NetworkElement part from database.
412 * @return Optional with NetworkElement or empty
415 private NetworkElement readNetworkElement() {
416 // Step 2.2: construct data and the relative iid
417 // The schema path to identify an instance is
418 // <i>CoreModel-CoreNetworkModule-ObjectClasses/NetworkElement</i>
419 // Read to the config data store
420 return GenericTransactionUtils.readData(getNetconfNodeDataBroker(), LogicalDatastoreType.OPERATIONAL,
425 * Get from LayerProtocolExtensions the related generated ONF Interface PAC class which represents it.
427 * @param lp logical termination point
428 * @return Class of InterfacePac
431 private Class<?> getLpExtension(@Nullable Lp lp) {
433 String capability = EMPTY;
434 String revision = EMPTY;
435 String conditionalPackage = EMPTY;
439 for (Extension e : getExtensionList(lp)) {
440 if (e.getValueName().contentEquals("capability")) {
441 capability = e.getValue();
442 int idx = capability.indexOf("?");
444 capability = capability.substring(0, idx);
447 if (e.getValueName().contentEquals("revision")) {
448 revision = e.getValue();
450 if (e.getValueName().contentEquals("conditional-package")) {
451 conditionalPackage = e.getValue();
456 // org.opendaylight.yangtools.yang.common.QName.create("urn:onf:params:xml:ns:yang:microwave-model",
457 // "2017-03-24", "mw-air-interface-pac").intern();
458 LOG.info("LpExtension capability={} revision={} conditionalPackage={}", capability, revision,
460 if (!capability.isEmpty() && !revision.isEmpty() && !conditionalPackage.isEmpty()) {
462 QName qName = QName.create(capability, revision, conditionalPackage);
463 res = this.microwaveModel.getClassForLtpExtension(qName);
464 } catch (IllegalArgumentException e) {
465 LOG.debug("Can not create QName from ({}{}{}): {}", capability, revision, conditionalPackage,
473 * Read element from class that could be not available
475 * @param ltp layer termination point
476 * @return List with extension parameters or empty list
479 private static List<Extension> getExtensionList(@Nullable Lp ltp) {
480 if (ltp != null && ltp.getExtension() != null) {
481 return ltp.getExtension();
483 return EMPTYLTPEXTENSIONLIST;
488 * Get List of UUIDs for conditional packages from Networkelement<br>
489 * Possible interfaces are:<br>
490 * MWPS, LTP(MWPS-TTP), MWAirInterfacePac, MicrowaveModel-ObjectClasses-AirInterface<br>
491 * ETH-CTP,LTP(Client), MW_EthernetContainer_Pac<br>
492 * MWS, LTP(MWS-CTP-xD), MWAirInterfaceDiversityPac,
493 * MicrowaveModel-ObjectClasses-AirInterfaceDiversity<br>
494 * MWS, LTP(MWS-TTP), ,MicrowaveModel-ObjectClasses-HybridMwStructure<br>
495 * MWS, LTP(MWS-TTP), ,MicrowaveModel-ObjectClasses-PureEthernetStructure<br>
497 * @param ne Networkelement
498 * @return Id List, never null.
500 private static List<Lp> getLtpList(@Nullable NetworkElement ne) {
502 List<Lp> res = Collections.synchronizedList(new ArrayList<Lp>());
505 List<Ltp> ltpRefList = ne.getLtp();
506 if (ltpRefList == null) {
507 LOG.debug("DBRead NE-Interfaces: null");
509 for (Ltp ltRefListE : ltpRefList) {
510 List<Lp> lpList = ltRefListE.getLp();
511 if (lpList == null) {
512 LOG.debug("DBRead NE-Interfaces Reference List: null");
514 for (Lp ltp : lpList) {
515 //// LayerProtocolName layerProtocolName = lpListE.getLayerProtocolName();
516 // UniversalId uuId = lpListE.getUuid();
523 LOG.debug("DBRead NE: null");
527 if (LOG.isDebugEnabled()) {
528 StringBuffer strBuf = new StringBuffer();
530 if (strBuf.length() > 0) {
533 strBuf.append(ltp.getLayerProtocolName().getValue());
535 strBuf.append(ltp.getUuid().getValue());
537 LOG.debug("DBRead NE-Interfaces: {}", strBuf.toString());
546 private List<? extends OtnHistoryDataG> readTheHistoricalPerformanceData(Lp lp) {
547 ONFLayerProtocolName lpName = ONFLayerProtocolName.valueOf(lp.getLayerProtocolName());
549 return this.microwaveModel.readTheHistoricalPerformanceData(lpName, lp);
551 * switch (lpName) { case MWAirInterface: return
552 * readTheHistoricalPerformanceDataOfMwAirInterfacePac(lp);
554 * case EthernetContainer12: return readTheHistoricalPerformanceDataOfEthernetContainer(lp);
556 * case EthernetContainer10: case EthernetPhysical: case Ethernet: case TDMContainer: case
557 * Structure: case Unknown: LOG.debug("Do not read HistoricalPM data for {} {}", lpName,
558 * lp.getUuid().getValue()); break; } return new ArrayList<>();
563 public AllPm getHistoricalPM() {
565 synchronized (pmLock) {
567 LOG.debug("Enter query PM");
568 AllPm allPm = new AllPm();
571 List<? extends OtnHistoryDataG> resultList = readTheHistoricalPerformanceData(lp);
572 LOG.debug("Got records: {}", resultList.size());
573 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.GranularityPeriodType
574 GranularityPeriodType granularityPeriod;
575 for (OtnHistoryDataG perf : resultList) {
577 granularityPeriod = perf.getGranularityPeriod();
578 if (granularityPeriod == null) {
579 granularityPeriod = GranularityPeriodType.Unknown;
582 switch (granularityPeriod) {
584 EsHistoricalPerformance15Minutes pm =
585 new EsHistoricalPerformance15Minutes(getMountPointNodeName(), lp)
586 .setHistoricalRecord15Minutes(perf);
591 case Period24Hours: {
592 EsHistoricalPerformance24Hours pm =
593 new EsHistoricalPerformance24Hours(getMountPointNodeName(), lp)
594 .setHistoricalRecord24Hours(perf);
595 LOG.debug("Write 24h write to DB");
601 LOG.warn("Unknown granularity {}", perf.getGranularityPeriod());
606 LOG.debug("Deliver normalized records: {}", allPm.size());
609 LOG.debug("Deliver empty, no LTP");
610 return AllPm.getEmpty();
616 public void resetPMIterator() {
617 synchronized (pmLock) {
618 interfaceListIterator = interfaceList.iterator();
620 LOG.debug("PM reset iterator");
624 public boolean hasNext() {
626 synchronized (pmLock) {
627 res = interfaceListIterator != null ? interfaceListIterator.hasNext() : false;
629 LOG.debug("PM hasNext LTP {}", res);
635 synchronized (pmLock) {
636 if (interfaceListIterator == null) {
638 LOG.debug("PM next LTP null");
640 pmLp = interfaceListIterator.next();
641 LOG.debug("PM next LTP {}", pmLp.getLayerProtocolName().getValue());
647 public String pmStatusToString() {
648 StringBuffer res = new StringBuffer();
649 synchronized (pmLock) {
650 res.append(pmLp == null ? "no interface" : pmLp.getLayerProtocolName().getValue());
651 for (Lp lp : interfaceList) {
653 res.append(lp.getLayerProtocolName().getValue());
657 return res.toString();
661 * Remove all entries from list
664 public int removeAllCurrentProblemsOfNode() {
665 return microwaveEventListener.removeAllCurrentProblemsOfNode();
669 * Register the listener
672 public void doRegisterMicrowaveEventListener(MountPoint mountPoint) {
673 LOG.info("End registration listener for Mountpoint {}", mountPoint.getIdentifier().toString());
674 final Optional<NotificationService> optionalNotificationService =
675 mountPoint.getService(NotificationService.class);
676 final NotificationService notificationService = optionalNotificationService.get();
677 // notificationService.registerNotificationListener(microwaveEventListener);
678 listenerRegistrationresult =
679 notificationService.registerNotificationListener(microwaveModel.getNotificationListener());
680 LOG.info("End registration listener for Mountpoint {} Listener: {} Result: {}",
681 mountPoint.getIdentifier().toString(), optionalNotificationService, listenerRegistrationresult);
685 /*------------------------------------------------------------
686 * private function to access database
689 /*-----------------------------------------------------------------------------
690 * Reading problems for the networkElement V1.2
693 private List<ProblemNotificationXml> readNetworkElementCurrentProblems12(List<ProblemNotificationXml> resultList) {
695 LOG.info("DBRead Get {} NetworkElementCurrentProblems12", getMountPointNodeName());
697 InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac> networkElementCurrentProblemsIID =
698 InstanceIdentifier.builder(
699 org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac.class)
702 // Step 2.3: read to the config data store
703 NetworkElementPac problemPac;
704 NetworkElementCurrentProblems problems;
706 problemPac = GenericTransactionUtils.readData(getNetconfNodeDataBroker(), LogicalDatastoreType.OPERATIONAL,
707 networkElementCurrentProblemsIID);
708 problems = problemPac.getNetworkElementCurrentProblems();
709 if (problems == null) {
710 LOG.debug("DBRead no NetworkElementCurrentProblems12");
711 } else if (problems.getCurrentProblemList() == null) {
712 LOG.debug("DBRead empty CurrentProblemList12");
714 for (org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.network.element.current.problems.g.CurrentProblemList problem : problems
715 .getCurrentProblemList()) {
716 resultList.add(new ProblemNotificationXml(getMountPointNodeName(), problem.getObjectReference(),
717 problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
718 problem.getSequenceNumber().toString(),
719 InternalDateAndTime.valueOf(problem.getTimeStamp())));
722 } catch (Exception e) {
723 LOG.warn("DBRead {} NetworkElementCurrentProblems12 not supported. Message '{}' ", getMountPointNodeName(),
731 public void close() throws Exception {
733 if (listenerRegistrationresult != null) {
734 listenerRegistrationresult.close();