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 faultService.faultNotification(faultAlarm);
264 notificationService.sendNotification(notification, acessor.getNodeId().getValue(), ProblemNotification.QNAME,
265 notification.getTimeStamp());
268 /*-----------------------------------------------------------------------------
269 * Reading problems for specific interface pacs
273 * Read problems of specific interfaces
275 * @param uuId Universal Id String of the interface
276 * @return number of alarms
278 private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, FaultData resultList) {
280 final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
282 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
283 mountpointId, interfacePacUuid.getValue());
285 // Step 2.2: construct data and the relative iid
286 InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID =
287 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
288 .child(AirInterfaceCurrentProblems.class).build();
290 // Step 2.3: read to the config data store
291 AirInterfaceCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
292 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
294 if (problems == null) {
295 LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
296 } else if (problems.getCurrentProblemList() == null) {
297 LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid);
299 for (AirInterfaceCurrentProblemTypeG problem : YangHelper
300 .getCollection(problems.nonnullCurrentProblemList())) {
301 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
302 interfacePacUuid.getValue(), problem.getProblemName(),
303 mapSeverity(problem.getProblemSeverity()));
310 * Read problems of specific interfaces
312 * @param uuId Universal index of Interfacepac
313 * @return number of alarms
315 private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
317 final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
319 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
320 mountpointId, interfacePacUuid.getValue());
322 InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
323 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
324 .child(EthernetContainerCurrentProblems.class).build();
326 EthernetContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
327 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
328 if (problems == null) {
329 LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
330 } else if (problems.getCurrentProblemList() == null) {
331 LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
333 for (ContainerCurrentProblemTypeG problem : YangHelper
334 .getCollection(problems.nonnullCurrentProblemList())) {
335 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
336 interfacePacUuid.getValue(), problem.getProblemName(),
337 mapSeverity(problem.getProblemSeverity()));
344 * Read problems of specific interfaces
346 * @param uuId Universal index of Interfacepac
347 * @return number of alarms
349 private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid, FaultData resultList) {
351 final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
352 final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
354 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
355 mountpointId, interfacePacUuid.getValue());
357 InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
358 .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
360 AirInterfaceDiversityCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
361 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
362 if (problems == null) {
363 LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
364 } else if (problems.getCurrentProblemList() == null) {
365 LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid);
367 for (AirInterfaceDiversityCurrentProblemTypeG problem : YangHelper
368 .getCollection(problems.nonnullCurrentProblemList())) {
369 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
370 interfacePacUuid.getValue(), problem.getProblemName(),
371 mapSeverity(problem.getProblemSeverity()));
378 * Read problems of specific interfaces
380 * @param uuId Universal index of Interfacepac
381 * @return number of alarms
383 private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
385 final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
386 final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
388 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
389 mountpointId, interfacePacUuid.getValue());
391 InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
392 .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
394 PureEthernetStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
395 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
396 if (problems == null) {
397 LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
398 } else if (problems.getCurrentProblemList() == null) {
399 LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
401 for (StructureCurrentProblemTypeG problem : YangHelper
402 .getCollection(problems.nonnullCurrentProblemList())) {
403 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
404 interfacePacUuid.getValue(), problem.getProblemName(),
405 mapSeverity(problem.getProblemSeverity()));
412 * Read problems of specific interfaces
414 * @param uuId Universal index of Interfacepac
415 * @return number of alarms
417 private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
419 final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
420 final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
422 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
423 mountpointId, interfacePacUuid.getValue());
425 InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
426 .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
428 HybridMwStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
429 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
430 if (problems == null) {
431 LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
432 } else if (problems.getCurrentProblemList() == null) {
433 LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
435 for (StructureCurrentProblemTypeG problem : YangHelper
436 .getCollection(problems.nonnullCurrentProblemList())) {
437 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
438 interfacePacUuid.getValue(), problem.getProblemName(),
439 mapSeverity(problem.getProblemSeverity()));
446 * Read problems of specific interfaces. TODO Goal for future implementation without usage of explicit new. Key is
447 * generated by newInstance() function here to verify this approach.
449 * @param uuId Universal index of Interfacepac
450 * @return number of alarms
451 * @throws SecurityException
452 * @throws NoSuchMethodException
453 * @throws InvocationTargetException
454 * @throws IllegalArgumentException
455 * @throws IllegalAccessException
456 * @throws InstantiationException
458 private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
460 final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
461 final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
462 final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
464 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
465 mountpointId, interfacePacUuid.getValue());
468 // -- Specific part 1
469 Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
470 InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
471 .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
473 // -- Specific part 2
474 TdmContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
475 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
476 if (problems == null) {
477 LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
479 // -- Specific part 3
480 for (ContainerCurrentProblemTypeG problem : YangHelper
481 .getCollection(problems.nonnullCurrentProblemList())) {
482 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
483 interfacePacUuid.getValue(), problem.getProblemName(),
484 mapSeverity(problem.getProblemSeverity()));
487 } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
488 | IllegalArgumentException | InvocationTargetException e) {
489 LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
494 /*-----------------------------------------------------------------------------
495 * Performance related data
499 * Read and add performance data
501 * @param lp to read from
502 * @param result Object to be filled with data
505 private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) {
507 LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid());
509 UniversalId mwAirInterfacePacuuId = lp.getUuid();
510 // Step 2.1: construct data and the relative iid
511 InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID =
512 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
513 .child(AirInterfaceConfiguration.class).build();
514 AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(),
515 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
517 if (airConfiguration == null) {
518 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
521 // Step 2.2: construct data and the relative iid
522 InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID =
523 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
524 .child(AirInterfaceHistoricalPerformances.class).build();
526 // Step 2.3: read to the config data store
527 AirInterfaceHistoricalPerformances airHistoricalPerformanceData = genericTransactionUtils.readData(
528 acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
530 if (airHistoricalPerformanceData == null) {
531 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
532 mwAirInterfacePacuuId);
534 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
535 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
536 YangHelper.getCollection(airHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
537 LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
538 airHistPMList.size());
539 for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistPMList) {
540 result.add(new PerformanceDataAirInterface181010Builder(acessor.getNodeId(), lp, pmRecord,
545 LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, result.size());
549 private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) {
550 final String myName = "MWEthernetContainerPac";
552 LOG.debug("DBRead Get {} : {}", mountpointId, myName, lp.getUuid());
554 UniversalId ethContainerPacuuId = lp.getUuid();
555 // Step 2.2: construct data and the relative iid
556 InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
557 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
558 .child(EthernetContainerHistoricalPerformances.class).build();
560 // Step 2.3: read to the config data store
561 EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = acessor.getTransactionUtils()
562 .readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
564 if (ethContainerHistoricalPerformanceData == null) {
565 LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
567 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
568 YangHelper.getCollection(
569 ethContainerHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
570 LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
571 for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
572 result.add(new PerformanceDataAirInterface181010Builder(acessor.getNodeId(), lp, pmRecord));
575 LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, result.size());
579 public static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType mapSeverity(
580 SeverityType severity) {
582 Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType> res =
583 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType
584 .forName(severity.name());
586 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed);