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.PerformanceDataAirInterface170324Builder;
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.devicemanager.util.InconsistentPMDataException;
37 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
38 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
39 import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
40 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
41 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
42 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
43 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceCurrentProblemTypeG;
44 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceDiversityCurrentProblemTypeG;
45 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceHistoricalPerformanceTypeG;
46 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AttributeValueChangedNotification;
47 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ContainerCurrentProblemTypeG;
48 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ContainerHistoricalPerformanceTypeG;
49 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MicrowaveModelListener;
50 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfaceDiversityPac;
51 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfaceDiversityPacKey;
52 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfacePac;
53 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfacePacKey;
54 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwEthernetContainerPac;
55 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwEthernetContainerPacKey;
56 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwHybridMwStructurePac;
57 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwHybridMwStructurePacKey;
58 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwPureEthernetStructurePac;
59 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwPureEthernetStructurePacKey;
60 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwTdmContainerPac;
61 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwTdmContainerPacKey;
62 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ObjectCreationNotification;
63 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ObjectDeletionNotification;
64 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ProblemNotification;
65 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.SeverityType;
66 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.StructureCurrentProblemTypeG;
67 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
68 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceConfiguration;
69 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceCurrentProblems;
70 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
71 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
72 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
73 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
74 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
75 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.tdm.container.pac.TdmContainerCurrentProblems;
76 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder;
77 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity;
78 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogBuilder;
79 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogEntity;
80 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType;
81 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
82 import org.opendaylight.yangtools.yang.binding.NotificationListener;
83 import org.opendaylight.yangtools.yang.common.QName;
84 import org.slf4j.Logger;
85 import org.slf4j.LoggerFactory;
88 public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, MicrowaveModelListener {
90 private static final Logger LOG = LoggerFactory.getLogger(WrapperMicrowaveModelRev170324.class);
92 public static final QName QNAME = MwAirInterfacePac.QNAME;
95 private final NotificationService microwaveModelListener;
96 private final NetconfBindingAccessor acessor;
97 private final TransactionUtils genericTransactionUtils;
98 private final FaultService faultService;
100 private Optional<NotificationWorker<EventlogEntity>> notificationQueue;
102 private final WebsocketManagerService notificationService;
105 * @param acessor to access device
107 public WrapperMicrowaveModelRev170324(@NonNull NetconfBindingAccessor acessor,
108 @NonNull DeviceManagerServiceProvider serviceProvider) {
109 this.acessor = acessor;
110 this.genericTransactionUtils = acessor.getTransactionUtils();
111 this.microwaveModelListener = serviceProvider.getNotificationService();
112 this.faultService = serviceProvider.getFaultService();
113 this.notificationService = serviceProvider.getWebsocketService();
114 this.notificationQueue = Optional.empty();
117 /*-----------------------------------------------------------------------------
121 @SuppressWarnings("unchecked")
123 public <T extends NotificationListener> T getNotificationListener() {
128 public void setNotificationQueue(NotificationWorker<EventlogEntity> notificationQueue) {
129 this.notificationQueue = Optional.of(notificationQueue);
132 /*-----------------------------------------------------------------------------
133 * Interface functions
137 public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
138 FaultData resultList) {
142 readTheFaultsOfMwAirInterfacePac(uuid, resultList);
145 case ETHERNETCONTAINER12:
146 readTheFaultsOfMwEthernetContainerPac(uuid, resultList);
150 readTheFaultsOfMwTdmContainerPac(uuid, resultList);
154 if (lpClass == MwHybridMwStructurePac.class) {
155 readTheFaultsOfMwHybridMwStructurePac(uuid, resultList);
157 } else if (lpClass == MwAirInterfaceDiversityPac.class) {
158 readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList);
160 } else if (lpClass == MwPureEthernetStructurePac.class) {
161 readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList);
164 LOG.warn("Unassigned lp model {} class {}", lpName, lpClass);
168 // No alarms supported
170 case ETHERNETCONTAINER10:
172 LOG.warn("Unassigned or not expected lp in model {}", lpName);
177 public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName,
178 @NonNull Lp lp) throws InconsistentPMDataException {
179 PerformanceDataLtp res = new PerformanceDataLtp();
180 readAirInterfacePerformanceData(lp, res);
181 readEthernetContainerPerformanceData(lp, res);
187 public Class<?> getClassForLtpExtension(QName qName) {
189 if (qName.equals(MwAirInterfacePac.QNAME)) {
190 res = MwAirInterfacePac.class;
191 } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
192 res = MwAirInterfaceDiversityPac.class;
193 } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
194 res = MwPureEthernetStructurePac.class;
195 } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
196 res = MwHybridMwStructurePac.class;
197 } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
198 res = MwEthernetContainerPac.class;
199 } else if (qName.equals(MwTdmContainerPac.QNAME)) {
200 res = MwTdmContainerPac.class;
202 LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
207 public void onObjectCreationNotification(ObjectCreationNotification notification) {
208 LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
209 if (notification != null) {
210 // Send devicemanager specific notification for database and ODLUX
211 microwaveModelListener.creationNotification(acessor.getNodeId(), notification.getCounter(),
212 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
213 // Send model specific notification to WebSocketManager
214 notificationService.sendNotification(notification, acessor.getNodeId(),
215 ObjectCreationNotification.QNAME, notification.getTimeStamp());
220 public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
221 LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
222 if (notification != null) {
223 // Send devicemanager specific notification for database and ODLUX
224 microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(),
225 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
226 // Send model specific notification to WebSocketManager
227 notificationService.sendNotification(notification, acessor.getNodeId(),
228 ObjectDeletionNotification.QNAME, notification.getTimeStamp());
233 public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
234 LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
235 EventlogEntity beventlogEntity = new EventlogBuilder().setNodeId(acessor.getNodeId().getValue())
236 .setCounter(notification.getCounter()).setTimestamp(notification.getTimeStamp())
237 .setObjectId(Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue())
238 .setAttributeName(notification.getAttributeName()).setNewValue(notification.getNewValue()).build();
239 // Send devicemanager specific notification for database and ODLUX
240 microwaveModelListener.eventNotification(beventlogEntity);
241 // Send model specific notification to WebSocketManager
242 notificationService.sendNotification(notification, acessor.getNodeId(),
243 AttributeValueChangedNotification.QNAME, notification.getTimeStamp());
244 if (notificationQueue.isPresent()) {
245 notificationQueue.get().put(beventlogEntity);
250 public void onProblemNotification(ProblemNotification notification) {
252 LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
253 FaultlogEntity faultAlarm = new FaultlogBuilder().setObjectId(notification.getObjectIdRef().getValue())
254 .setProblem(notification.getProblem()).setSourceType(SourceType.Netconf)
255 .setTimestamp(notification.getTimeStamp())
256 .setNodeId(this.acessor.getNodeId().getValue())
257 .setSeverity(mapSeverity(notification.getSeverity())).setCounter(notification.getCounter())
259 // Send devicemanager specific notification for database and ODLUX
260 faultService.faultNotification(faultAlarm);
261 // Send model specific notification to WebSocketManager
262 notificationService.sendNotification(notification, acessor.getNodeId(), ProblemNotification.QNAME,
263 notification.getTimeStamp());
266 /*-----------------------------------------------------------------------------
267 * Reading problems for specific interface pacs
271 * Read problems of specific interfaces
273 * @param uuId Universal Id String of the interface
274 * @return number of alarms
276 private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, FaultData resultList) {
278 final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
280 String mountpointId = acessor.getNodeId().getValue();
281 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
282 mountpointId, interfacePacUuid.getValue());
284 // Step 2.2: construct data and the relative iid
285 InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID =
286 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
287 .child(AirInterfaceCurrentProblems.class).build();
289 // Step 2.3: read to the config data store
290 AirInterfaceCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
291 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
293 if (problems == null) {
294 LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
296 for (AirInterfaceCurrentProblemTypeG problem : YangHelper
297 .getCollection(problems.nonnullCurrentProblemList())) {
298 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
299 interfacePacUuid.getValue(), problem.getProblemName(),
300 mapSeverity(problem.getProblemSeverity()));
308 * Read problems of specific interfaces
310 * @param uuId Universal index of Interfacepac
311 * @return number of alarms
313 private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
315 final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
317 String mountpointId = acessor.getNodeId().getValue();
318 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
319 mountpointId, interfacePacUuid.getValue());
321 InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
322 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
323 .child(EthernetContainerCurrentProblems.class).build();
325 EthernetContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
326 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
327 if (problems == null) {
328 LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
330 for (ContainerCurrentProblemTypeG problem : YangHelper
331 .getCollection(problems.nonnullCurrentProblemList())) {
332 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
333 interfacePacUuid.getValue(), problem.getProblemName(),
334 mapSeverity(problem.getProblemSeverity()));
341 * Read problems of specific interfaces
343 * @param uuId Universal index of Interfacepac
344 * @return number of alarms
346 private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid, FaultData resultList) {
348 final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
349 final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
351 String mountpointId = acessor.getNodeId().getValue();
352 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
353 mountpointId, interfacePacUuid.getValue());
355 InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
356 .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
358 AirInterfaceDiversityCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
359 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
360 if (problems == null) {
361 LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
363 for (AirInterfaceDiversityCurrentProblemTypeG problem : YangHelper
364 .getCollection(problems.nonnullCurrentProblemList())) {
365 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
366 interfacePacUuid.getValue(), problem.getProblemName(),
367 mapSeverity(problem.getProblemSeverity()));
374 * Read problems of specific interfaces
376 * @param uuId Universal index of Interfacepac
377 * @return number of alarms
379 private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
381 final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
382 final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
384 String mountpointId = acessor.getNodeId().getValue();
385 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
386 mountpointId, interfacePacUuid.getValue());
388 InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
389 .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
391 PureEthernetStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
392 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
393 if (problems == null) {
394 LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
396 for (StructureCurrentProblemTypeG problem : YangHelper
397 .getCollection(problems.nonnullCurrentProblemList())) {
398 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
399 interfacePacUuid.getValue(), problem.getProblemName(),
400 mapSeverity(problem.getProblemSeverity()));
407 * Read problems of specific interfaces
409 * @param uuId Universal index of Interfacepac
410 * @return number of alarms
412 private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
414 final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
415 final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
417 String mountpointId = acessor.getNodeId().getValue();
418 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
419 mountpointId, interfacePacUuid.getValue());
421 InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
422 .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
424 HybridMwStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
425 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
426 if (problems == null) {
427 LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
429 for (StructureCurrentProblemTypeG problem : YangHelper
430 .getCollection(problems.nonnullCurrentProblemList())) {
431 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
432 interfacePacUuid.getValue(), problem.getProblemName(),
433 mapSeverity(problem.getProblemSeverity()));
440 * Read problems of specific interfaces. TODO Goal for future implementation without usage of explicit new. Key is
441 * generated by newInstance() function here to verify this approach.
443 * @param uuId Universal index of Interfacepac
444 * @return number of alarms
445 * @throws SecurityException
446 * @throws NoSuchMethodException
447 * @throws InvocationTargetException
448 * @throws IllegalArgumentException
449 * @throws IllegalAccessException
450 * @throws InstantiationException
452 private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
454 final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
455 final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
456 final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
458 String mountpointId = acessor.getNodeId().getValue();
459 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
460 mountpointId, interfacePacUuid.getValue());
463 // -- Specific part 1
464 Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
465 InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
466 .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
468 // -- Specific part 2
469 TdmContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
470 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
471 if (problems == null) {
472 LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
474 // -- Specific part 3
475 for (ContainerCurrentProblemTypeG problem : YangHelper
476 .getCollection(problems.nonnullCurrentProblemList())) {
477 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
478 interfacePacUuid.getValue(), problem.getProblemName(),
479 mapSeverity(problem.getProblemSeverity()));
482 } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
483 | IllegalArgumentException | InvocationTargetException e) {
484 LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
490 * Read and add performance data
492 * @param lp to read from
493 * @param result Object to be filled with data
495 * @throws InconsistentPMDataException
497 private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) throws InconsistentPMDataException {
499 LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid());
501 UniversalId mwAirInterfacePacuuId = lp.getUuid();
502 // Step 2.1: construct data and the relative iid
503 InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID =
504 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
505 .child(AirInterfaceConfiguration.class).build();
506 AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(),
507 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
509 if (airConfiguration == null) {
510 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
513 // Step 2.2: construct data and the relative iid
514 InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID =
515 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
516 .child(AirInterfaceHistoricalPerformances.class).build();
518 // Step 2.3: read to the config data store
519 AirInterfaceHistoricalPerformances airHistoricalPerformanceData = genericTransactionUtils.readData(
520 acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
522 if (airHistoricalPerformanceData == null) {
523 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
524 mwAirInterfacePacuuId);
526 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
527 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
528 YangHelper.getCollection(airHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
529 LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
530 airHistPMList.size());
531 for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistPMList) {
532 result.add(new PerformanceDataAirInterface170324Builder(acessor.getNodeId(), lp, pmRecord,
537 LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, result.size());
542 private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) throws InconsistentPMDataException {
543 final String myName = "MWEthernetContainerPac";
545 String mountpointId = acessor.getNodeId().getValue();
547 LOG.debug("DBRead Get {} : {}", mountpointId, myName, lp.getUuid());
549 UniversalId ethContainerPacuuId = lp.getUuid();
550 // Step 2.2: construct data and the relative iid
551 InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
552 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
553 .child(EthernetContainerHistoricalPerformances.class).build();
555 // Step 2.3: read to the config data store
556 EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = acessor.getTransactionUtils()
557 .readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
559 if (ethContainerHistoricalPerformanceData == null) {
560 LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
562 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
563 YangHelper.getCollection(
564 ethContainerHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
565 LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
566 for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
567 result.add(new PerformanceDataAirInterface170324Builder(acessor.getNodeId(), lp, pmRecord));
570 LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, result.size());
574 private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType mapSeverity(
575 SeverityType severity) {
577 Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType> res =
578 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType
579 .forName(severity.name());
581 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed);