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 @SuppressWarnings("deprecation")
81 public class ONFCoreNetworkElement12 extends ONFCoreNetworkElement12Base
82 implements ONFCoreNetworkElementCallback, NotificationActor<AttributeValueChangedNotificationXml> {
84 private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElement12.class);
86 /*-----------------------------------------------------------------------------
89 private final @Nonnull MicrowaveEventListener12 microwaveEventListener;
90 private final @Nonnull OnfMicrowaveModel microwaveModel;
91 private final NotificationWorker<AttributeValueChangedNotificationXml> notificationQueue;
93 private ListenerRegistration<NotificationListener> listenerRegistrationresult = null;
95 /*-----------------------------------------------------------------------------
102 * @param mountPointNodeName as String
103 * @param capabilities of the specific network element
104 * @param netconfNodeDataBroker for the network element specific data
105 * @param webSocketService to forward event notifications
106 * @param databaseService to access the database
107 * @param dcaeProvider to forward problem / change notifications
109 private ONFCoreNetworkElement12(String mountPointNodeName, Capabilities capabilities,
110 DataBroker netconfNodeDataBroker, WebSocketServiceClient webSocketService,
111 HtDatabaseEventsService databaseService, ProviderClient dcaeProvider, @Nullable ProviderClient aotsmClient,
112 MaintenanceService maintenanceService,
113 NotificationDelayService<ProblemNotificationXml> notificationDelayService,
114 OnfMicrowaveModel onfMicrowaveModel) {
116 super(mountPointNodeName, netconfNodeDataBroker, capabilities);
118 this.microwaveModel = onfMicrowaveModel;
119 this.microwaveModel.setCoreData(this);
121 // Create MicrowaveService here
122 this.microwaveEventListener = new MicrowaveEventListener12(mountPointNodeName, webSocketService,
123 databaseService, dcaeProvider, aotsmClient, maintenanceService, notificationDelayService, this);
124 this.microwaveModel.setOnfMicrowaveModelListener(microwaveEventListener);
126 this.notificationQueue = new NotificationWorker<>(1, 100, this);
128 // ->Below shifted to super class
129 // this.isNetworkElementCurrentProblemsSupporting12 =
130 // capabilities.isSupportingNamespaceAndRevision(NetworkElementPac.QNAME);
131 // LOG.debug("support necurrent-problem-list=" + this.isNetworkElementCurrentProblemsSupporting12);
132 // LOG.info("Create NE instance {}", InstanceList.QNAME.getLocalName());
137 * Check capabilities are matching the this specific implementation and create network element
138 * representation if so.
140 * @param mountPointNodeName as String
141 * @param capabilities of the specific network element
142 * @param netconfNodeDataBroker for the network element specific data
143 * @param webSocketService to forward event notifications
144 * @param databaseService to access the database
145 * @param dcaeProvider to forward problem / change notifications
146 * @return created Object if conditions are OK or null if not.
148 public static @Nullable ONFCoreNetworkElement12 build(String mountPointNodeName, Capabilities capabilities,
149 DataBroker netconfNodeDataBroker, WebSocketServiceClient webSocketService,
150 HtDatabaseEventsService databaseService, ProviderClient dcaeProvider, @Nullable ProviderClient aotsmClient,
151 MaintenanceService maintenanceService,
152 NotificationDelayService<ProblemNotificationXml> notificationDelayService) {
154 if (capabilities.isSupportingNamespaceAndRevision(NetworkElement.QNAME)) {
155 OnfMicrowaveModel onfMicrowaveModel = null;
157 if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)) {
158 onfMicrowaveModel = new WrapperMicrowaveModelRev170324();
159 } else if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)) {
160 onfMicrowaveModel = new WrapperMicrowaveModelRev180907();
161 } else if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)) {
162 onfMicrowaveModel = new WrapperMicrowaveModelRev181010();
165 if (onfMicrowaveModel != null) {
166 return new ONFCoreNetworkElement12(mountPointNodeName, capabilities, netconfNodeDataBroker,
167 webSocketService, databaseService, dcaeProvider, aotsmClient, maintenanceService,
168 notificationDelayService, onfMicrowaveModel);
175 /*-----------------------------------------------------------------------------
180 * DeviceMonitor Prepare check by updating NE state and reading all interfaces.
183 public void prepareCheck() {
184 synchronized (dmLock) {
185 boolean change = readNetworkElementAndInterfaces();
187 int problems = microwaveEventListener.removeAllCurrentProblemsOfNode();
188 List<ProblemNotificationXml> resultList = readAllCurrentProblemsOfNode();
189 microwaveEventListener.initCurrentProblemStatus(resultList);
190 LOG.info("Resync mountpoint {} for device {}. Removed {}. Current problems: {}", getMountPointNodeName(),
191 getUuId(), problems, resultList.size());
196 // public boolean checkIfConnectionToMediatorIsOk() -> Shifted to super class
197 // public boolean checkIfConnectionToNeIsOk() -> Shifted to super class
199 /*-----------------------------------------------------------------------------
203 // public void initSynchronizationExtension() -> Shifted to super class
204 // private InstanceList readPTPClockInstances() -> Shifted to super class
206 /*-----------------------------------------------------------------------------
207 * Services for NE/Device synchronization
211 * Handling of specific Notifications from NE, indicating changes and need for synchronization.
213 * <attribute-value-changed-notification xmlns="urn:onf:params:xml:ns:yang:microwave-model">
214 * <attribute-name>/equipment-pac/equipment-current-problems</attribute-name>
215 * <object-id-ref>CARD-1.1.1.0</object-id-ref> <new-value></new-value>
216 * </attribute-value-changed-notification>
217 * <attribute-value-changed-notification xmlns="urn:onf:params:xml:ns:yang:microwave-model">
218 * <attribute-name>/network-element/extension[value-name="top-level-equipment"]/value</attribute-name>
219 * <object-id-ref>Hybrid-Z</object-id-ref>
220 * <new-value>SHELF-1.1.0.0,IDU-1.55.0.0,ODU-1.56.0.0,IDU-1.65.0.0</new-value>
221 * </attribute-value-changed-notification>
226 public void notificationFromNeListener(AttributeValueChangedNotificationXml notificationXml) {
227 notificationQueue.put(notificationXml);
231 public void notificationActor(AttributeValueChangedNotificationXml notificationXml) {
233 LOG.debug("Enter change notification listener");
234 if (LOG.isTraceEnabled()) {
235 LOG.trace("Notification: {}", notificationXml);
237 if (notificationXml.getAttributeName().equals("/equipment-pac/equipment-current-problems")) {
238 syncEquipmentPac(notificationXml.getObjectId());
239 } else if (notificationXml.getAttributeName()
240 .equals("/network-element/extension[value-name=\"top-level-equipment\"]/value")) {
241 initialReadFromNetworkElement();
243 LOG.debug("Leave change notification listener");
247 * Synchronize problems for a specific equipment-pac
249 * @param uuidString of the equipment-pac
251 private synchronized void syncEquipmentPac(String uuidString) {
253 int problems = microwaveEventListener.removeObjectsCurrentProblemsOfNode(uuidString);
254 LOG.debug("Removed {} problems for uuid {}", problems, uuidString);
256 List<ProblemNotificationXml> resultList = equipment.addProblemsofNodeObject(uuidString);
257 microwaveEventListener.initCurrentProblemStatus(resultList);
258 LOG.debug("Added {} problems for uuid {}", resultList.size(), uuidString);
263 /*-----------------------------------------------------------------------------
264 * Problem/Fault related functions
268 * Read during startup all relevant structure and status parameters from device
271 public synchronized void initialReadFromNetworkElement() {
272 // optionalNe.getLtp().get(0).getLp();
273 LOG.debug("Get info about {}", getMountPointNodeName());
275 int problems = microwaveEventListener.removeAllCurrentProblemsOfNode();
276 LOG.debug("Removed all {} problems from database at registration", problems);
278 // Step 2.1: access data broker within this mount point
279 LOG.debug("DBRead start");
281 // Step 2.2: read ne from data store
282 readNetworkElementAndInterfaces();
283 equipment.readNetworkElementEquipment();
285 // Step 2.3: read the existing faults and add to DB
286 List<ProblemNotificationXml> resultList = readAllCurrentProblemsOfNode();
287 equipment.addProblemsofNode(resultList);
289 microwaveEventListener.initCurrentProblemStatus(resultList);
291 microwaveEventListener.writeEquipment(equipment);
293 LOG.info("Found info at {} for device {} number of problems: {}", getMountPointNodeName(), getUuId(),
298 * LOG the newly added problems of the interface pac
304 private void debugResultList(String uuid, List<ProblemNotificationXml> resultList, int idxStart) {
305 if (LOG.isDebugEnabled()) {
306 StringBuffer sb = new StringBuffer();
308 for (int t = idxStart; t < resultList.size(); t++) {
311 sb.append(resultList.get(t));
314 LOG.debug("Found problems {} {}", uuid, sb.toString());
319 * Read from NetworkElement and verify LTPs have changed. If the NE has changed, update to the new
320 * structure. From initial state it changes also.
322 private synchronized boolean readNetworkElementAndInterfaces() {
324 LOG.debug("Update mountpoint if changed {}", getMountPointNodeName());
326 optionalNe = GenericTransactionUtils.readData(getNetconfNodeDataBroker(), LogicalDatastoreType.OPERATIONAL,
327 NETWORKELEMENT_IID);;
328 synchronized (pmLock) {
329 boolean change = false;
331 if (optionalNe == null) {
332 LOG.debug("Unable to read NE data for mountpoint {}", getMountPointNodeName());
333 if (!interfaceList.isEmpty()) {
334 interfaceList.clear();
335 interfaceListIterator = null;
340 LOG.debug("Mountpoint '{}' NE-Name '{}'", getMountPointNodeName(), optionalNe.getName());
341 List<Lp> actualInterfaceList = getLtpList(optionalNe);
342 if (!interfaceList.equals(actualInterfaceList)) {
343 LOG.debug("Mountpoint '{}' Update LTP List. Elements {}", getMountPointNodeName(),
344 actualInterfaceList.size());
345 interfaceList.clear();
346 interfaceList.addAll(actualInterfaceList);
347 interfaceListIterator = null;
356 * Read current problems of AirInterfaces and EthernetContainer according to NE status into DB
358 * @return List with all problems
360 private List<ProblemNotificationXml> readAllCurrentProblemsOfNode() {
362 // Step 2.3: read the existing faults and add to DB
363 List<ProblemNotificationXml> resultList = new ArrayList<>();
364 int idxStart; // Start index for debug messages
367 synchronized (pmLock) {
368 for (Lp lp : interfaceList) {
370 idxStart = resultList.size();
372 Class<?> lpClass = getLpExtension(lp);
374 ONFLayerProtocolName lpName = ONFLayerProtocolName.valueOf(lp.getLayerProtocolName());
376 microwaveModel.readTheFaultsOfMicrowaveModel(lpName, lpClass, uuid, resultList);
378 debugResultList(uuid.getValue(), resultList, idxStart);
383 // Step 2.4: Read other problems from mountpoint
384 if (isNetworkElementCurrentProblemsSupporting12) {
385 idxStart = resultList.size();
386 readNetworkElementCurrentProblems12(resultList);
387 debugResultList("CurrentProblems12", resultList, idxStart);
395 * Get uuid of Optional NE.
397 * @return Uuid or EMPTY String if optionNE is not available
399 private String getUuId() {
403 uuid = optionalNe != null ? optionalNe.getUuid() != null ? optionalNe.getUuid().getValue() : EMPTY : EMPTY;
404 } catch (NullPointerException e) {
405 // Unfortunately throws null pointer if not definied
411 * Read the NetworkElement part from database.
413 * @return Optional with NetworkElement or empty
416 private NetworkElement readNetworkElement() {
417 // Step 2.2: construct data and the relative iid
418 // The schema path to identify an instance is
419 // <i>CoreModel-CoreNetworkModule-ObjectClasses/NetworkElement</i>
420 // Read to the config data store
421 return GenericTransactionUtils.readData(getNetconfNodeDataBroker(), LogicalDatastoreType.OPERATIONAL,
426 * Get from LayerProtocolExtensions the related generated ONF Interface PAC class which represents it.
428 * @param lp logical termination point
429 * @return Class of InterfacePac
432 private Class<?> getLpExtension(@Nullable Lp lp) {
434 String capability = EMPTY;
435 String revision = EMPTY;
436 String conditionalPackage = EMPTY;
440 for (Extension e : getExtensionList(lp)) {
441 if (e.getValueName().contentEquals("capability")) {
442 capability = e.getValue();
443 int idx = capability.indexOf("?");
445 capability = capability.substring(0, idx);
448 if (e.getValueName().contentEquals("revision")) {
449 revision = e.getValue();
451 if (e.getValueName().contentEquals("conditional-package")) {
452 conditionalPackage = e.getValue();
457 // org.opendaylight.yangtools.yang.common.QName.create("urn:onf:params:xml:ns:yang:microwave-model",
458 // "2017-03-24", "mw-air-interface-pac").intern();
459 LOG.info("LpExtension capability={} revision={} conditionalPackage={}", capability, revision,
461 if (!capability.isEmpty() && !revision.isEmpty() && !conditionalPackage.isEmpty()) {
463 QName qName = QName.create(capability, revision, conditionalPackage);
464 res = this.microwaveModel.getClassForLtpExtension(qName);
465 } catch (IllegalArgumentException e) {
466 LOG.debug("Can not create QName from ({}{}{}): {}", capability, revision, conditionalPackage,
474 * Read element from class that could be not available
476 * @param ltp layer termination point
477 * @return List with extension parameters or empty list
480 private static List<Extension> getExtensionList(@Nullable Lp ltp) {
481 if (ltp != null && ltp.getExtension() != null) {
482 return ltp.getExtension();
484 return EMPTYLTPEXTENSIONLIST;
489 * Get List of UUIDs for conditional packages from Networkelement<br>
490 * Possible interfaces are:<br>
491 * MWPS, LTP(MWPS-TTP), MWAirInterfacePac, MicrowaveModel-ObjectClasses-AirInterface<br>
492 * ETH-CTP,LTP(Client), MW_EthernetContainer_Pac<br>
493 * MWS, LTP(MWS-CTP-xD), MWAirInterfaceDiversityPac,
494 * MicrowaveModel-ObjectClasses-AirInterfaceDiversity<br>
495 * MWS, LTP(MWS-TTP), ,MicrowaveModel-ObjectClasses-HybridMwStructure<br>
496 * MWS, LTP(MWS-TTP), ,MicrowaveModel-ObjectClasses-PureEthernetStructure<br>
498 * @param ne Networkelement
499 * @return Id List, never null.
501 private static List<Lp> getLtpList(@Nullable NetworkElement ne) {
503 List<Lp> res = Collections.synchronizedList(new ArrayList<Lp>());
506 List<Ltp> ltpRefList = ne.getLtp();
507 if (ltpRefList == null) {
508 LOG.debug("DBRead NE-Interfaces: null");
510 for (Ltp ltRefListE : ltpRefList) {
511 List<Lp> lpList = ltRefListE.getLp();
512 if (lpList == null) {
513 LOG.debug("DBRead NE-Interfaces Reference List: null");
515 for (Lp ltp : lpList) {
516 //// LayerProtocolName layerProtocolName = lpListE.getLayerProtocolName();
517 // UniversalId uuId = lpListE.getUuid();
524 LOG.debug("DBRead NE: null");
528 if (LOG.isDebugEnabled()) {
529 StringBuffer strBuf = new StringBuffer();
531 if (strBuf.length() > 0) {
534 strBuf.append(ltp.getLayerProtocolName().getValue());
536 strBuf.append(ltp.getUuid().getValue());
538 LOG.debug("DBRead NE-Interfaces: {}", strBuf.toString());
547 private List<? extends OtnHistoryDataG> readTheHistoricalPerformanceData(Lp lp) {
548 ONFLayerProtocolName lpName = ONFLayerProtocolName.valueOf(lp.getLayerProtocolName());
550 return this.microwaveModel.readTheHistoricalPerformanceData(lpName, lp);
552 * switch (lpName) { case MWAirInterface: return
553 * readTheHistoricalPerformanceDataOfMwAirInterfacePac(lp);
555 * case EthernetContainer12: return readTheHistoricalPerformanceDataOfEthernetContainer(lp);
557 * case EthernetContainer10: case EthernetPhysical: case Ethernet: case TDMContainer: case
558 * Structure: case Unknown: LOG.debug("Do not read HistoricalPM data for {} {}", lpName,
559 * lp.getUuid().getValue()); break; } return new ArrayList<>();
564 public AllPm getHistoricalPM() {
566 synchronized (pmLock) {
568 LOG.debug("Enter query PM");
569 AllPm allPm = new AllPm();
572 List<? extends OtnHistoryDataG> resultList = readTheHistoricalPerformanceData(lp);
573 LOG.debug("Got records: {}", resultList.size());
574 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.GranularityPeriodType
575 GranularityPeriodType granularityPeriod;
576 for (OtnHistoryDataG perf : resultList) {
578 granularityPeriod = perf.getGranularityPeriod();
579 if (granularityPeriod == null) {
580 granularityPeriod = GranularityPeriodType.Unknown;
583 switch (granularityPeriod) {
585 EsHistoricalPerformance15Minutes pm =
586 new EsHistoricalPerformance15Minutes(getMountPointNodeName(), lp)
587 .setHistoricalRecord15Minutes(perf);
592 case Period24Hours: {
593 EsHistoricalPerformance24Hours pm =
594 new EsHistoricalPerformance24Hours(getMountPointNodeName(), lp)
595 .setHistoricalRecord24Hours(perf);
596 LOG.debug("Write 24h write to DB");
602 LOG.warn("Unknown granularity {}", perf.getGranularityPeriod());
607 LOG.debug("Deliver normalized records: {}", allPm.size());
610 LOG.debug("Deliver empty, no LTP");
611 return AllPm.getEmpty();
617 public void resetPMIterator() {
618 synchronized (pmLock) {
619 interfaceListIterator = interfaceList.iterator();
621 LOG.debug("PM reset iterator");
625 public boolean hasNext() {
627 synchronized (pmLock) {
628 res = interfaceListIterator != null ? interfaceListIterator.hasNext() : false;
630 LOG.debug("PM hasNext LTP {}", res);
636 synchronized (pmLock) {
637 if (interfaceListIterator == null) {
639 LOG.debug("PM next LTP null");
641 pmLp = interfaceListIterator.next();
642 LOG.debug("PM next LTP {}", pmLp.getLayerProtocolName().getValue());
648 public String pmStatusToString() {
649 StringBuffer res = new StringBuffer();
650 synchronized (pmLock) {
651 res.append(pmLp == null ? "no interface" : pmLp.getLayerProtocolName().getValue());
652 for (Lp lp : interfaceList) {
654 res.append(lp.getLayerProtocolName().getValue());
658 return res.toString();
662 * Remove all entries from list
665 public int removeAllCurrentProblemsOfNode() {
666 return microwaveEventListener.removeAllCurrentProblemsOfNode();
670 * Register the listener
673 public void doRegisterMicrowaveEventListener(MountPoint mountPoint) {
674 LOG.info("End registration listener for Mountpoint {}", mountPoint.getIdentifier().toString());
675 final Optional<NotificationService> optionalNotificationService =
676 mountPoint.getService(NotificationService.class);
677 final NotificationService notificationService = optionalNotificationService.get();
678 // notificationService.registerNotificationListener(microwaveEventListener);
679 listenerRegistrationresult =
680 notificationService.registerNotificationListener(microwaveModel.getNotificationListener());
681 LOG.info("End registration listener for Mountpoint {} Listener: {} Result: {}",
682 mountPoint.getIdentifier().toString(), optionalNotificationService, listenerRegistrationresult);
686 /*------------------------------------------------------------
687 * private function to access database
690 /*-----------------------------------------------------------------------------
691 * Reading problems for the networkElement V1.2
694 private List<ProblemNotificationXml> readNetworkElementCurrentProblems12(List<ProblemNotificationXml> resultList) {
696 LOG.info("DBRead Get {} NetworkElementCurrentProblems12", getMountPointNodeName());
698 InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac> networkElementCurrentProblemsIID =
699 InstanceIdentifier.builder(
700 org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac.class)
703 // Step 2.3: read to the config data store
704 NetworkElementPac problemPac;
705 NetworkElementCurrentProblems problems;
707 problemPac = GenericTransactionUtils.readData(getNetconfNodeDataBroker(), LogicalDatastoreType.OPERATIONAL,
708 networkElementCurrentProblemsIID);
709 problems = problemPac.getNetworkElementCurrentProblems();
710 if (problems == null) {
711 LOG.debug("DBRead no NetworkElementCurrentProblems12");
712 } else if (problems.getCurrentProblemList() == null) {
713 LOG.debug("DBRead empty CurrentProblemList12");
715 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
716 .getCurrentProblemList()) {
717 resultList.add(new ProblemNotificationXml(getMountPointNodeName(), problem.getObjectReference(),
718 problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
719 problem.getSequenceNumber().toString(),
720 InternalDateAndTime.valueOf(problem.getTimeStamp())));
723 } catch (Exception e) {
724 LOG.warn("DBRead {} NetworkElementCurrentProblems12 not supported. Message '{}' ", getMountPointNodeName(),
732 public void close() throws Exception {
734 if (listenerRegistrationresult != null) {
735 listenerRegistrationresult.close();