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==========================================================================
18 package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave;
22 import java.lang.reflect.Constructor;
23 import java.lang.reflect.InvocationTargetException;
24 import java.util.List;
25 import java.util.Optional;
26 import org.eclipse.jdt.annotation.NonNull;
27 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.pm.PerformanceDataAirInterface181010Builder;
28 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.notifications.NotificationWorker;
29 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.util.ONFLayerProtocolName;
30 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
31 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
32 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService;
33 import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData;
34 import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp;
35 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
36 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
37 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
38 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
39 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
40 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.SeverityType;
41 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceCurrentProblemTypeG;
42 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceDiversityCurrentProblemTypeG;
43 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceHistoricalPerformanceTypeG;
44 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AttributeValueChangedNotification;
45 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ContainerCurrentProblemTypeG;
46 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ContainerHistoricalPerformanceTypeG;
47 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MicrowaveModelListener;
48 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfaceDiversityPac;
49 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfaceDiversityPacKey;
50 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfacePac;
51 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfacePacKey;
52 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwEthernetContainerPac;
53 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwEthernetContainerPacKey;
54 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwHybridMwStructurePac;
55 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwHybridMwStructurePacKey;
56 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwPureEthernetStructurePac;
57 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwPureEthernetStructurePacKey;
58 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwTdmContainerPac;
59 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwTdmContainerPacKey;
60 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ObjectCreationNotification;
61 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ObjectDeletionNotification;
62 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ProblemNotification;
63 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.StructureCurrentProblemTypeG;
64 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
65 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceConfiguration;
66 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceCurrentProblems;
67 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
68 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
69 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
70 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
71 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
72 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.tdm.container.pac.TdmContainerCurrentProblems;
73 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.EventlogBuilder;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.EventlogEntity;
75 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
76 import org.opendaylight.yangtools.yang.binding.NotificationListener;
77 import org.opendaylight.yangtools.yang.common.QName;
78 import org.slf4j.Logger;
79 import org.slf4j.LoggerFactory;
82 public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, MicrowaveModelListener {
84 private static final Logger LOG = LoggerFactory.getLogger(WrapperMicrowaveModelRev181010.class);
86 public static final QName QNAME = MwAirInterfacePac.QNAME;
89 private final NetconfAccessor acessor;
90 private final NotificationService microwaveModelListener;
91 private final TransactionUtils genericTransactionUtils;
92 private final String mountpointId;
93 private final @NonNull FaultService faultService;
95 private Optional<NotificationWorker<EventlogEntity>> notificationQueue;
98 * Handle specific version of microwave model
99 * @param acessor to access device
100 * @param serviceProvider for devicemanager services
102 public WrapperMicrowaveModelRev181010(@NonNull NetconfAccessor acessor, @NonNull DeviceManagerServiceProvider serviceProvider) {
103 this.acessor = acessor;
104 this.genericTransactionUtils = acessor.getTransactionUtils();
105 this.mountpointId = acessor.getNodeId().getValue();
106 this.microwaveModelListener = serviceProvider.getNotificationService();
107 this.faultService = serviceProvider.getFaultService();
108 this.notificationQueue = Optional.empty();
111 /*-----------------------------------------------------------------------------
115 @SuppressWarnings("unchecked")
117 public <T extends NotificationListener> T getNotificationListener() {
122 public void setNotificationQueue(NotificationWorker<EventlogEntity> notificationQueue) {
123 this.notificationQueue = Optional.of(notificationQueue);
126 /*-----------------------------------------------------------------------------
131 public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
132 FaultData resultList) {
136 readTheFaultsOfMwAirInterfacePac(uuid, resultList);
139 case ETHERNETCONTAINER12:
140 readTheFaultsOfMwEthernetContainerPac(uuid, resultList);
144 readTheFaultsOfMwTdmContainerPac(uuid, resultList);
148 if (lpClass == MwHybridMwStructurePac.class) {
149 readTheFaultsOfMwHybridMwStructurePac(uuid, resultList);
151 } else if (lpClass == MwAirInterfaceDiversityPac.class) {
152 readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList);
154 } else if (lpClass == MwPureEthernetStructurePac.class) {
155 readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList);
158 LOG.warn("Unassigned lp model {} class {}", lpName, lpClass);
162 // No alarms supported
164 case ETHERNETCONTAINER10:
166 LOG.warn("Unassigned or not expected lp in model {}", lpName);
171 public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, @NonNull Lp lp) {
172 PerformanceDataLtp res = new PerformanceDataLtp();
175 return readAirInterfacePerformanceData(lp, res);
177 case ETHERNETCONTAINER12:
178 return readEthernetContainerPerformanceData(lp, res);
180 case ETHERNETCONTAINER10:
181 case ETHERNETPHYSICAL:
186 LOG.debug("Do not read HistoricalPM data for {} {}", lpName, Helper.nnGetUniversalId(lp.getUuid()).getValue());
192 public Class<?> getClassForLtpExtension(QName qName) {
194 if (qName.equals(MwAirInterfacePac.QNAME)) {
195 res = MwAirInterfacePac.class;
196 } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
197 res = MwAirInterfaceDiversityPac.class;
198 } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
199 res = MwPureEthernetStructurePac.class;
200 } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
201 res = MwHybridMwStructurePac.class;
202 } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
203 res = MwEthernetContainerPac.class;
204 } else if (qName.equals(MwTdmContainerPac.QNAME)) {
205 res = MwTdmContainerPac.class;
207 LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
212 public void onObjectCreationNotification(ObjectCreationNotification notification) {
213 LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
214 if (notification != null) {
215 microwaveModelListener.creationNotification(acessor.getNodeId(), notification.getCounter(),
216 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
221 public void onObjectDeletionNotification( ObjectDeletionNotification notification) {
222 LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
223 if (notification != null) {
224 microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(),
225 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
230 public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
231 LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
232 EventlogEntity beventlogEntity = new EventlogBuilder().setNodeId(acessor.getNodeId().getValue())
233 .setCounter(notification.getCounter()).setTimestamp(notification.getTimeStamp())
234 .setObjectId(Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue())
235 .setAttributeName(notification.getAttributeName()).setNewValue(notification.getNewValue()).build();
236 microwaveModelListener.eventNotification(beventlogEntity);
237 if (notificationQueue.isPresent()) {
238 notificationQueue.get().put(beventlogEntity);
243 public void onProblemNotification(ProblemNotification notification) {
245 LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
247 faultService.faultNotification(acessor.getNodeId(), notification.getCounter(),
248 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue(),
249 notification.getProblem(), mapSeverity(notification.getSeverity()));
252 /*-----------------------------------------------------------------------------
253 * Reading problems for specific interface pacs
257 * Read problems of specific interfaces
259 * @param uuId Universal Id String of the interface
260 * @return number of alarms
262 private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid,
263 FaultData resultList) {
265 final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
267 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
268 mountpointId, interfacePacUuid.getValue());
270 // Step 2.2: construct data and the relative iid
271 InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID = InstanceIdentifier
272 .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
273 .child(AirInterfaceCurrentProblems.class).build();
275 // Step 2.3: read to the config data store
276 AirInterfaceCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
277 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
279 if (problems == null) {
280 LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
281 } else if (problems.getCurrentProblemList() == null) {
282 LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid);
284 for (AirInterfaceCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
285 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
286 interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
293 * Read problems of specific interfaces
295 * @param uuId Universal index of Interfacepac
296 * @return number of alarms
298 private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid,
299 FaultData resultList) {
301 final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
303 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
304 mountpointId, interfacePacUuid.getValue());
306 InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
307 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
308 .child(EthernetContainerCurrentProblems.class).build();
310 EthernetContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
311 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
312 if (problems == null) {
313 LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
314 } else if (problems.getCurrentProblemList() == null) {
315 LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
317 for (ContainerCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
318 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
319 interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
326 * Read problems of specific interfaces
328 * @param uuId Universal index of Interfacepac
329 * @return number of alarms
331 private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid,
332 FaultData resultList) {
334 final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
335 final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
337 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
338 mountpointId, interfacePacUuid.getValue());
340 InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
341 .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
343 AirInterfaceDiversityCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
344 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
345 if (problems == null) {
346 LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
347 } else if (problems.getCurrentProblemList() == null) {
348 LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid);
350 for (AirInterfaceDiversityCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
351 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
352 interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
359 * Read problems of specific interfaces
361 * @param uuId Universal index of Interfacepac
362 * @return number of alarms
364 private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid,
365 FaultData resultList) {
367 final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
368 final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
370 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
371 mountpointId, interfacePacUuid.getValue());
373 InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
374 .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
376 PureEthernetStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
377 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
378 if (problems == null) {
379 LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
380 } else if (problems.getCurrentProblemList() == null) {
381 LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
383 for (StructureCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
384 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
385 interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
392 * Read problems of specific interfaces
394 * @param uuId Universal index of Interfacepac
395 * @return number of alarms
397 private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid,
398 FaultData resultList) {
400 final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
401 final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
403 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
404 mountpointId, interfacePacUuid.getValue());
406 InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
407 .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
409 HybridMwStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
410 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
411 if (problems == null) {
412 LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
413 } else if (problems.getCurrentProblemList() == null) {
414 LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
416 for (StructureCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
417 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
418 interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
425 * Read problems of specific interfaces. TODO Goal for future implementation
426 * without usage of explicit new. Key is generated by newInstance() function
427 * here to verify this approach.
429 * @param uuId Universal index of Interfacepac
430 * @return number of alarms
431 * @throws SecurityException
432 * @throws NoSuchMethodException
433 * @throws InvocationTargetException
434 * @throws IllegalArgumentException
435 * @throws IllegalAccessException
436 * @throws InstantiationException
438 private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid,
439 FaultData resultList) {
441 final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
442 final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
443 final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
445 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
446 mountpointId, interfacePacUuid.getValue());
449 // -- Specific part 1
450 Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
451 InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
452 .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
454 // -- Specific part 2
455 TdmContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
456 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
457 if (problems == null) {
458 LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
460 // -- Specific part 3
461 for (ContainerCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
462 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
463 interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
466 } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
467 | IllegalArgumentException | InvocationTargetException e) {
468 LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
473 /*-----------------------------------------------------------------------------
474 * Performance related data
478 * Read and add performance data
479 * @param lp to read from
480 * @param result Object to be filled with data
483 private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) {
485 LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid());
487 UniversalId mwAirInterfacePacuuId = lp.getUuid();
488 // Step 2.1: construct data and the relative iid
489 InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = InstanceIdentifier
490 .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
491 .child(AirInterfaceConfiguration.class).build();
492 AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(),
493 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
495 if (airConfiguration == null) {
496 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
499 // Step 2.2: construct data and the relative iid
500 InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = InstanceIdentifier
501 .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
502 .child(AirInterfaceHistoricalPerformances.class).build();
504 // Step 2.3: read to the config data store
505 AirInterfaceHistoricalPerformances airHistoricalPerformanceData = genericTransactionUtils.readData(
506 acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
508 if (airHistoricalPerformanceData == null) {
509 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
510 mwAirInterfacePacuuId);
512 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
513 List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = airHistoricalPerformanceData
514 .nonnullHistoricalPerformanceDataList();
515 LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
516 airHistPMList.size());
517 for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistoricalPerformanceData
518 .nonnullHistoricalPerformanceDataList()) {
519 result.add(new PerformanceDataAirInterface181010Builder(acessor.getNodeId(), lp, pmRecord, airConfiguration));
523 LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, result.size());
527 private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) {
528 final String myName = "MWEthernetContainerPac";
530 LOG.debug("DBRead Get {} : {}", mountpointId, myName, lp.getUuid());
532 UniversalId ethContainerPacuuId = lp.getUuid();
533 // Step 2.2: construct data and the relative iid
534 InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
535 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
536 .child(EthernetContainerHistoricalPerformances.class).build();
538 // Step 2.3: read to the config data store
539 EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = acessor.getTransactionUtils()
540 .readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
542 if (ethContainerHistoricalPerformanceData == null) {
543 LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
545 List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = ethContainerHistoricalPerformanceData
546 .nonnullHistoricalPerformanceDataList();
547 LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
548 for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
549 result.add(new PerformanceDataAirInterface181010Builder(acessor.getNodeId(), lp, pmRecord));
552 LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, result.size());
556 public static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType mapSeverity( SeverityType severity) {
558 Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType> res =
559 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType.forName(severity.name());
560 return res.orElse(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType.NonAlarmed);