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.PerformanceDataAirInterface180907Builder;
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.rev180907.AirInterfaceCurrentProblemTypeG;
43 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AirInterfaceDiversityCurrentProblemTypeG;
44 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AirInterfaceHistoricalPerformanceTypeG;
45 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AttributeValueChangedNotification;
46 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ContainerCurrentProblemTypeG;
47 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ContainerHistoricalPerformanceTypeG;
48 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MicrowaveModelListener;
49 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfaceDiversityPac;
50 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfaceDiversityPacKey;
51 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfacePac;
52 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfacePacKey;
53 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwEthernetContainerPac;
54 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwEthernetContainerPacKey;
55 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwHybridMwStructurePac;
56 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwHybridMwStructurePacKey;
57 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwPureEthernetStructurePac;
58 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwPureEthernetStructurePacKey;
59 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwTdmContainerPac;
60 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwTdmContainerPacKey;
61 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ObjectCreationNotification;
62 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ObjectDeletionNotification;
63 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ProblemNotification;
64 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.SeverityType;
65 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.StructureCurrentProblemTypeG;
66 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
67 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceConfiguration;
68 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceCurrentProblems;
69 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
70 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
71 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
72 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
73 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
74 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.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 WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, MicrowaveModelListener {
89 private static final Logger LOG = LoggerFactory.getLogger(WrapperMicrowaveModelRev180907.class);
91 public static final QName QNAME = MwAirInterfacePac.QNAME;
94 private final NotificationService microwaveModelListener;
95 private final NetconfBindingAccessor acessor;
96 private final TransactionUtils genericTransactionUtil;
97 private final String mountpointId;
98 private final @NonNull FaultService faultService;
99 private final WebsocketManagerService notificationService;
101 private Optional<NotificationWorker<EventlogEntity>> notificationQueue;
106 * Handle specific version of microwave model
108 * @param acessor to access device
109 * @param serviceProvider for devicemanager services
111 public WrapperMicrowaveModelRev180907(@NonNull NetconfBindingAccessor acessor,
112 @NonNull DeviceManagerServiceProvider serviceProvider) {
113 this.acessor = acessor;
114 this.mountpointId = acessor.getNodeId().getValue();
115 this.genericTransactionUtil = acessor.getTransactionUtils();
116 this.microwaveModelListener = serviceProvider.getNotificationService();
117 this.faultService = serviceProvider.getFaultService();
118 this.notificationService = serviceProvider.getWebsocketService();
119 this.notificationQueue = Optional.empty();
122 /*-----------------------------------------------------------------------------
126 @SuppressWarnings("unchecked")
128 public <T extends NotificationListener> T getNotificationListener() {
133 public void setNotificationQueue(NotificationWorker<EventlogEntity> notificationQueue) {
134 this.notificationQueue = Optional.of(notificationQueue);
137 /*-----------------------------------------------------------------------------
142 public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
143 FaultData resultList) {
147 readTheFaultsOfMwAirInterfacePac(uuid, resultList);
150 case ETHERNETCONTAINER12:
151 readTheFaultsOfMwEthernetContainerPac(uuid, resultList);
155 readTheFaultsOfMwTdmContainerPac(uuid, resultList);
159 if (lpClass == MwHybridMwStructurePac.class) {
160 readTheFaultsOfMwHybridMwStructurePac(uuid, resultList);
162 } else if (lpClass == MwAirInterfaceDiversityPac.class) {
163 readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList);
165 } else if (lpClass == MwPureEthernetStructurePac.class) {
166 readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList);
169 LOG.warn("Unassigned lp model {} class {}", lpName, lpClass);
173 // No alarms supported
175 case ETHERNETCONTAINER10:
177 LOG.warn("Unassigned or not expected lp in model {}", lpName);
182 public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName,
184 PerformanceDataLtp res = new PerformanceDataLtp();
187 readAirInterfacePerformanceData(lp, res);
190 case ETHERNETCONTAINER12:
191 readEthernetContainerPerformanceData(lp, res);
194 case ETHERNETCONTAINER10:
195 case ETHERNETPHYSICAL:
200 LOG.debug("Do not read HistoricalPM data for {} {}", lpName,
201 Helper.nnGetUniversalId(lp.getUuid()).getValue());
208 public Class<?> getClassForLtpExtension(QName qName) {
210 if (qName.equals(MwAirInterfacePac.QNAME)) {
211 res = MwAirInterfacePac.class;
212 } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
213 res = MwAirInterfaceDiversityPac.class;
214 } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
215 res = MwPureEthernetStructurePac.class;
216 } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
217 res = MwHybridMwStructurePac.class;
218 } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
219 res = MwEthernetContainerPac.class;
220 } else if (qName.equals(MwTdmContainerPac.QNAME)) {
221 res = MwTdmContainerPac.class;
223 LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
228 public void onObjectCreationNotification(ObjectCreationNotification notification) {
229 LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
230 if (notification != null) {
231 microwaveModelListener.creationNotification(acessor.getNodeId(), notification.getCounter(),
232 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
237 public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
238 LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
239 if (notification != null) {
240 microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(),
241 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
246 public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
247 LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
248 EventlogEntity beventlogEntity = new EventlogBuilder().setNodeId(acessor.getNodeId().getValue())
249 .setCounter(notification.getCounter()).setTimestamp(notification.getTimeStamp())
250 .setObjectId(Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue())
251 .setAttributeName(notification.getAttributeName()).setNewValue(notification.getNewValue()).build();
252 microwaveModelListener.eventNotification(beventlogEntity);
253 if (notificationQueue.isPresent()) {
254 notificationQueue.get().put(beventlogEntity);
259 public void onProblemNotification(ProblemNotification notification) {
261 LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
262 FaultlogEntity faultAlarm = new FaultlogBuilder().setObjectId(notification.getObjectIdRef().getValue())
263 .setProblem(notification.getProblem()).setSourceType(SourceType.Netconf)
264 .setTimestamp(notification.getTimeStamp())
265 .setNodeId(this.acessor.getNodeId().getValue())
266 .setSeverity(mapSeverity(notification.getSeverity())).setCounter(notification.getCounter())
268 // Send devicemanager specific notification for database and ODLUX
269 faultService.faultNotification(faultAlarm);
270 // Send model specific notification to WebSocketManager
271 notificationService.sendNotification(notification, acessor.getNodeId(), ProblemNotification.QNAME,
272 notification.getTimeStamp());
275 /*-----------------------------------------------------------------------------
276 * Reading problems for specific interface pacs
280 * Read problems of specific interfaces
282 * @param uuId Universal Id String of the interface
283 * @return number of alarms
285 private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, FaultData resultList) {
287 final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
289 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
290 mountpointId, interfacePacUuid.getValue());
292 // Step 2.2: construct data and the relative iid
293 InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID =
294 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
295 .child(AirInterfaceCurrentProblems.class).build();
297 // Step 2.3: read to the config data store
298 AirInterfaceCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
299 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
301 if (problems == null) {
302 LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
304 for (AirInterfaceCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
305 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
306 interfacePacUuid.getValue(), problem.getProblemName(),
307 mapSeverity(problem.getProblemSeverity()));
314 * Read problems of specific interfaces
316 * @param uuId Universal index of Interfacepac
317 * @return number of alarms
319 private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
321 final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
323 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
324 mountpointId, interfacePacUuid.getValue());
326 InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
327 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
328 .child(EthernetContainerCurrentProblems.class).build();
330 EthernetContainerCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
331 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
332 if (problems == null) {
333 LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
335 for (ContainerCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
336 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
337 interfacePacUuid.getValue(), problem.getProblemName(),
338 mapSeverity(problem.getProblemSeverity()));
345 * Read problems of specific interfaces
347 * @param uuId Universal index of Interfacepac
348 * @return number of alarms
350 private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid, FaultData resultList) {
352 final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
353 final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
355 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
356 mountpointId, interfacePacUuid.getValue());
358 InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
359 .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
361 AirInterfaceDiversityCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
362 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
363 if (problems == null) {
364 LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
366 for (AirInterfaceDiversityCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
367 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
368 interfacePacUuid.getValue(), problem.getProblemName(),
369 mapSeverity(problem.getProblemSeverity()));
376 * Read problems of specific interfaces
378 * @param uuId Universal index of Interfacepac
379 * @return number of alarms
381 private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
383 final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
384 final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
386 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
387 mountpointId, interfacePacUuid.getValue());
389 InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
390 .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
392 PureEthernetStructureCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
393 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
394 if (problems == null) {
395 LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
397 for (StructureCurrentProblemTypeG problem : YangHelper.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 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
418 mountpointId, interfacePacUuid.getValue());
420 InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
421 .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
423 HybridMwStructureCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
424 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
425 if (problems == null) {
426 LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
428 for (StructureCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
429 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
430 interfacePacUuid.getValue(), problem.getProblemName(),
431 mapSeverity(problem.getProblemSeverity()));
438 * Read problems of specific interfaces. TODO Goal for future implementation without usage of explicit new. Key is
439 * generated by newInstance() function here to verify this approach.
441 * @param uuId Universal index of Interfacepac
442 * @return number of alarms
443 * @throws SecurityException
444 * @throws NoSuchMethodException
445 * @throws InvocationTargetException
446 * @throws IllegalArgumentException
447 * @throws IllegalAccessException
448 * @throws InstantiationException
450 private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
452 final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
453 final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
454 final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
456 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
457 mountpointId, interfacePacUuid.getValue());
460 // -- Specific part 1
461 Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
462 InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
463 .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
465 // -- Specific part 2
466 TdmContainerCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
467 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
468 if (problems == null) {
469 LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
471 // -- Specific part 3
472 for (ContainerCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
473 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
474 interfacePacUuid.getValue(), problem.getProblemName(),
475 mapSeverity(problem.getProblemSeverity()));
478 } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
479 | IllegalArgumentException | InvocationTargetException e) {
480 LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
486 * Read and add performance data
488 * @param lp to read from
489 * @param result Object to be filled with data
492 private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) {
494 LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid());
496 UniversalId mwAirInterfacePacuuId = lp.getUuid();
497 // Step 2.1: construct data and the relative iid
498 InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID =
499 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
500 .child(AirInterfaceConfiguration.class).build();
501 AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(),
502 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
504 if (airConfiguration == null) {
505 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
508 // Step 2.2: construct data and the relative iid
509 InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID =
510 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
511 .child(AirInterfaceHistoricalPerformances.class).build();
513 // Step 2.3: read to the config data store
514 AirInterfaceHistoricalPerformances airHistoricalPerformanceData = acessor.getTransactionUtils().readData(
515 acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
517 if (airHistoricalPerformanceData == null) {
518 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
519 mwAirInterfacePacuuId);
521 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
522 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
523 YangHelper.getCollection(airHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
524 LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
525 airHistPMList.size());
526 for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistPMList) {
527 result.add(new PerformanceDataAirInterface180907Builder(acessor.getNodeId(), lp, pmRecord,
532 LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, result.size());
536 private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) {
537 final String myName = "MWEthernetContainerPac";
539 LOG.debug("DBRead Get {} : {}", myName, lp.getUuid());
541 UniversalId ethContainerPacuuId = lp.getUuid();
542 // Step 2.2: construct data and the relative iid
543 InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
544 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
545 .child(EthernetContainerHistoricalPerformances.class).build();
547 // Step 2.3: read to the config data store
548 EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = acessor.getTransactionUtils()
549 .readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
551 if (ethContainerHistoricalPerformanceData == null) {
552 LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
554 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
555 YangHelper.getCollection(ethContainerHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
556 LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
557 for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
558 result.add(new PerformanceDataAirInterface180907Builder(acessor.getNodeId(), lp, pmRecord));
561 LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, result.size());
565 private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType mapSeverity(
566 SeverityType severity) {
568 Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType> res =
569 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType
570 .forName(severity.name());
572 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed);