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.Collection;
25 import java.util.Optional;
26 import org.eclipse.jdt.annotation.NonNull;
27 import org.onap.ccsdk.features.sdnr.wt.common.YangHelper;
28 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.pm.PerformanceDataAirInterface181010Builder;
29 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.notifications.NotificationWorker;
30 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.util.ONFLayerProtocolName;
31 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
32 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
33 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService;
34 import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData;
35 import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp;
36 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
37 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
38 import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
39 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
40 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
41 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
42 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceCurrentProblemTypeG;
43 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceDiversityCurrentProblemTypeG;
44 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceHistoricalPerformanceTypeG;
45 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AttributeValueChangedNotification;
46 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ContainerCurrentProblemTypeG;
47 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ContainerHistoricalPerformanceTypeG;
48 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MicrowaveModelListener;
49 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfaceDiversityPac;
50 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfaceDiversityPacKey;
51 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfacePac;
52 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfacePacKey;
53 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwEthernetContainerPac;
54 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwEthernetContainerPacKey;
55 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwHybridMwStructurePac;
56 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwHybridMwStructurePacKey;
57 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwPureEthernetStructurePac;
58 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwPureEthernetStructurePacKey;
59 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwTdmContainerPac;
60 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwTdmContainerPacKey;
61 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ObjectCreationNotification;
62 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ObjectDeletionNotification;
63 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ProblemNotification;
64 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.SeverityType;
65 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.StructureCurrentProblemTypeG;
66 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
67 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceConfiguration;
68 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceCurrentProblems;
69 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
70 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
71 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
72 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
73 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
74 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.tdm.container.pac.TdmContainerCurrentProblems;
75 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder;
76 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity;
77 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogBuilder;
78 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogEntity;
79 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType;
80 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
81 import org.opendaylight.yangtools.yang.binding.NotificationListener;
82 import org.opendaylight.yangtools.yang.common.QName;
83 import org.slf4j.Logger;
84 import org.slf4j.LoggerFactory;
87 public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, MicrowaveModelListener {
89 private static final Logger LOG = LoggerFactory.getLogger(WrapperMicrowaveModelRev181010.class);
91 public static final QName QNAME = MwAirInterfacePac.QNAME;
94 private final NetconfBindingAccessor acessor;
95 private final NotificationService microwaveModelListener;
96 private final TransactionUtils genericTransactionUtils;
97 private final String mountpointId;
98 private final @NonNull FaultService faultService;
99 private final WebsocketManagerService notificationService;
101 private Optional<NotificationWorker<EventlogEntity>> notificationQueue;
104 * Handle specific version of microwave model
106 * @param acessor to access device
107 * @param serviceProvider for devicemanager services
109 public WrapperMicrowaveModelRev181010(@NonNull NetconfBindingAccessor acessor,
110 @NonNull DeviceManagerServiceProvider serviceProvider) {
111 this.acessor = acessor;
112 this.genericTransactionUtils = acessor.getTransactionUtils();
113 this.mountpointId = acessor.getNodeId().getValue();
114 this.microwaveModelListener = serviceProvider.getNotificationService();
115 this.faultService = serviceProvider.getFaultService();
116 this.notificationService = serviceProvider.getWebsocketService();
117 this.notificationQueue = Optional.empty();
120 /*-----------------------------------------------------------------------------
124 @SuppressWarnings("unchecked")
126 public <T extends NotificationListener> T getNotificationListener() {
131 public void setNotificationQueue(NotificationWorker<EventlogEntity> notificationQueue) {
132 this.notificationQueue = Optional.of(notificationQueue);
135 /*-----------------------------------------------------------------------------
140 public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
141 FaultData resultList) {
145 readTheFaultsOfMwAirInterfacePac(uuid, resultList);
148 case ETHERNETCONTAINER12:
149 readTheFaultsOfMwEthernetContainerPac(uuid, resultList);
153 readTheFaultsOfMwTdmContainerPac(uuid, resultList);
157 if (lpClass == MwHybridMwStructurePac.class) {
158 readTheFaultsOfMwHybridMwStructurePac(uuid, resultList);
160 } else if (lpClass == MwAirInterfaceDiversityPac.class) {
161 readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList);
163 } else if (lpClass == MwPureEthernetStructurePac.class) {
164 readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList);
167 LOG.warn("Unassigned lp model {} class {}", lpName, lpClass);
171 // No alarms supported
173 case ETHERNETCONTAINER10:
175 LOG.warn("Unassigned or not expected lp in model {}", lpName);
180 public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName,
182 PerformanceDataLtp res = new PerformanceDataLtp();
185 return readAirInterfacePerformanceData(lp, res);
187 case ETHERNETCONTAINER12:
188 return readEthernetContainerPerformanceData(lp, res);
190 case ETHERNETCONTAINER10:
191 case ETHERNETPHYSICAL:
196 LOG.debug("Do not read HistoricalPM data for {} {}", lpName,
197 Helper.nnGetUniversalId(lp.getUuid()).getValue());
203 public Class<?> getClassForLtpExtension(QName qName) {
205 if (qName.equals(MwAirInterfacePac.QNAME)) {
206 res = MwAirInterfacePac.class;
207 } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
208 res = MwAirInterfaceDiversityPac.class;
209 } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
210 res = MwPureEthernetStructurePac.class;
211 } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
212 res = MwHybridMwStructurePac.class;
213 } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
214 res = MwEthernetContainerPac.class;
215 } else if (qName.equals(MwTdmContainerPac.QNAME)) {
216 res = MwTdmContainerPac.class;
218 LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
223 public void onObjectCreationNotification(ObjectCreationNotification notification) {
224 LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
225 if (notification != null) {
226 microwaveModelListener.creationNotification(acessor.getNodeId(), notification.getCounter(),
227 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
232 public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
233 LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
234 if (notification != null) {
235 microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(),
236 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
241 public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
242 LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
243 EventlogEntity beventlogEntity = new EventlogBuilder().setNodeId(acessor.getNodeId().getValue())
244 .setCounter(notification.getCounter()).setTimestamp(notification.getTimeStamp())
245 .setObjectId(Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue())
246 .setAttributeName(notification.getAttributeName()).setNewValue(notification.getNewValue()).build();
247 microwaveModelListener.eventNotification(beventlogEntity);
248 if (notificationQueue.isPresent()) {
249 notificationQueue.get().put(beventlogEntity);
254 public void onProblemNotification(ProblemNotification notification) {
256 LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
257 FaultlogEntity faultAlarm = new FaultlogBuilder().setObjectId(notification.getObjectIdRef().getValue())
258 .setProblem(notification.getProblem()).setSourceType(SourceType.Netconf)
259 .setTimestamp(notification.getTimeStamp())
260 .setNodeId(this.acessor.getNodeId().getValue())
261 .setSeverity(mapSeverity(notification.getSeverity())).setCounter(notification.getCounter())
263 // Send devicemanager specific notification for database and ODLUX
264 faultService.faultNotification(faultAlarm);
265 // Send model specific notification to WebSocketManager
266 notificationService.sendNotification(notification, acessor.getNodeId(), ProblemNotification.QNAME,
267 notification.getTimeStamp());
270 /*-----------------------------------------------------------------------------
271 * Reading problems for specific interface pacs
275 * Read problems of specific interfaces
277 * @param uuId Universal Id String of the interface
278 * @return number of alarms
280 private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, FaultData resultList) {
282 final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
284 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
285 mountpointId, interfacePacUuid.getValue());
287 // Step 2.2: construct data and the relative iid
288 InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID =
289 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
290 .child(AirInterfaceCurrentProblems.class).build();
292 // Step 2.3: read to the config data store
293 AirInterfaceCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
294 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
296 if (problems == null) {
297 LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
298 } else if (problems.getCurrentProblemList() == null) {
299 LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid);
301 for (AirInterfaceCurrentProblemTypeG problem : YangHelper
302 .getCollection(problems.nonnullCurrentProblemList())) {
303 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
304 interfacePacUuid.getValue(), problem.getProblemName(),
305 mapSeverity(problem.getProblemSeverity()));
312 * Read problems of specific interfaces
314 * @param uuId Universal index of Interfacepac
315 * @return number of alarms
317 private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
319 final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
321 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
322 mountpointId, interfacePacUuid.getValue());
324 InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
325 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
326 .child(EthernetContainerCurrentProblems.class).build();
328 EthernetContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
329 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
330 if (problems == null) {
331 LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
332 } else if (problems.getCurrentProblemList() == null) {
333 LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
335 for (ContainerCurrentProblemTypeG problem : YangHelper
336 .getCollection(problems.nonnullCurrentProblemList())) {
337 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
338 interfacePacUuid.getValue(), problem.getProblemName(),
339 mapSeverity(problem.getProblemSeverity()));
346 * Read problems of specific interfaces
348 * @param uuId Universal index of Interfacepac
349 * @return number of alarms
351 private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid, FaultData resultList) {
353 final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
354 final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
356 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
357 mountpointId, interfacePacUuid.getValue());
359 InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
360 .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
362 AirInterfaceDiversityCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
363 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
364 if (problems == null) {
365 LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
366 } else if (problems.getCurrentProblemList() == null) {
367 LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid);
369 for (AirInterfaceDiversityCurrentProblemTypeG problem : YangHelper
370 .getCollection(problems.nonnullCurrentProblemList())) {
371 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
372 interfacePacUuid.getValue(), problem.getProblemName(),
373 mapSeverity(problem.getProblemSeverity()));
380 * Read problems of specific interfaces
382 * @param uuId Universal index of Interfacepac
383 * @return number of alarms
385 private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
387 final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
388 final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
390 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
391 mountpointId, interfacePacUuid.getValue());
393 InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
394 .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
396 PureEthernetStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
397 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
398 if (problems == null) {
399 LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
400 } else if (problems.getCurrentProblemList() == null) {
401 LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
403 for (StructureCurrentProblemTypeG problem : YangHelper
404 .getCollection(problems.nonnullCurrentProblemList())) {
405 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
406 interfacePacUuid.getValue(), problem.getProblemName(),
407 mapSeverity(problem.getProblemSeverity()));
414 * Read problems of specific interfaces
416 * @param uuId Universal index of Interfacepac
417 * @return number of alarms
419 private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
421 final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
422 final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
424 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
425 mountpointId, interfacePacUuid.getValue());
427 InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
428 .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
430 HybridMwStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
431 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
432 if (problems == null) {
433 LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
434 } else if (problems.getCurrentProblemList() == null) {
435 LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
437 for (StructureCurrentProblemTypeG problem : YangHelper
438 .getCollection(problems.nonnullCurrentProblemList())) {
439 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
440 interfacePacUuid.getValue(), problem.getProblemName(),
441 mapSeverity(problem.getProblemSeverity()));
448 * Read problems of specific interfaces. TODO Goal for future implementation without usage of explicit new. Key is
449 * generated by newInstance() function here to verify this approach.
451 * @param uuId Universal index of Interfacepac
452 * @return number of alarms
453 * @throws SecurityException
454 * @throws NoSuchMethodException
455 * @throws InvocationTargetException
456 * @throws IllegalArgumentException
457 * @throws IllegalAccessException
458 * @throws InstantiationException
460 private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
462 final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
463 final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
464 final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
466 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
467 mountpointId, interfacePacUuid.getValue());
470 // -- Specific part 1
471 Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
472 InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
473 .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
475 // -- Specific part 2
476 TdmContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
477 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
478 if (problems == null) {
479 LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
481 // -- Specific part 3
482 for (ContainerCurrentProblemTypeG problem : YangHelper
483 .getCollection(problems.nonnullCurrentProblemList())) {
484 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
485 interfacePacUuid.getValue(), problem.getProblemName(),
486 mapSeverity(problem.getProblemSeverity()));
489 } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
490 | IllegalArgumentException | InvocationTargetException e) {
491 LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
496 /*-----------------------------------------------------------------------------
497 * Performance related data
501 * Read and add performance data
503 * @param lp to read from
504 * @param result Object to be filled with data
507 private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) {
509 LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid());
511 UniversalId mwAirInterfacePacuuId = lp.getUuid();
512 // Step 2.1: construct data and the relative iid
513 InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID =
514 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
515 .child(AirInterfaceConfiguration.class).build();
516 AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(),
517 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
519 if (airConfiguration == null) {
520 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
523 // Step 2.2: construct data and the relative iid
524 InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID =
525 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
526 .child(AirInterfaceHistoricalPerformances.class).build();
528 // Step 2.3: read to the config data store
529 AirInterfaceHistoricalPerformances airHistoricalPerformanceData = genericTransactionUtils.readData(
530 acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
532 if (airHistoricalPerformanceData == null) {
533 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
534 mwAirInterfacePacuuId);
536 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
537 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
538 YangHelper.getCollection(airHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
539 LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
540 airHistPMList.size());
541 for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistPMList) {
542 result.add(new PerformanceDataAirInterface181010Builder(acessor.getNodeId(), lp, pmRecord,
547 LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, result.size());
551 private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) {
552 final String myName = "MWEthernetContainerPac";
554 LOG.debug("DBRead Get {} : {}", mountpointId, myName, lp.getUuid());
556 UniversalId ethContainerPacuuId = lp.getUuid();
557 // Step 2.2: construct data and the relative iid
558 InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
559 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
560 .child(EthernetContainerHistoricalPerformances.class).build();
562 // Step 2.3: read to the config data store
563 EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = acessor.getTransactionUtils()
564 .readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
566 if (ethContainerHistoricalPerformanceData == null) {
567 LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
569 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
570 YangHelper.getCollection(
571 ethContainerHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
572 LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
573 for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
574 result.add(new PerformanceDataAirInterface181010Builder(acessor.getNodeId(), lp, pmRecord));
577 LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, result.size());
581 public static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType mapSeverity(
582 SeverityType severity) {
584 Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType> res =
585 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType
586 .forName(severity.name());
588 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed);