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.NetconfAccessor;
37 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
38 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
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.yangtools.yang.binding.InstanceIdentifier;
78 import org.opendaylight.yangtools.yang.binding.NotificationListener;
79 import org.opendaylight.yangtools.yang.common.QName;
80 import org.slf4j.Logger;
81 import org.slf4j.LoggerFactory;
84 public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, MicrowaveModelListener {
86 private static final Logger LOG = LoggerFactory.getLogger(WrapperMicrowaveModelRev181010.class);
88 public static final QName QNAME = MwAirInterfacePac.QNAME;
91 private final NetconfBindingAccessor acessor;
92 private final NotificationService microwaveModelListener;
93 private final TransactionUtils genericTransactionUtils;
94 private final String mountpointId;
95 private final @NonNull FaultService faultService;
97 private Optional<NotificationWorker<EventlogEntity>> notificationQueue;
100 * Handle specific version of microwave model
102 * @param acessor to access device
103 * @param serviceProvider for devicemanager services
105 public WrapperMicrowaveModelRev181010(@NonNull NetconfBindingAccessor acessor,
106 @NonNull DeviceManagerServiceProvider serviceProvider) {
107 this.acessor = acessor;
108 this.genericTransactionUtils = acessor.getTransactionUtils();
109 this.mountpointId = acessor.getNodeId().getValue();
110 this.microwaveModelListener = serviceProvider.getNotificationService();
111 this.faultService = serviceProvider.getFaultService();
112 this.notificationQueue = Optional.empty();
115 /*-----------------------------------------------------------------------------
119 @SuppressWarnings("unchecked")
121 public <T extends NotificationListener> T getNotificationListener() {
126 public void setNotificationQueue(NotificationWorker<EventlogEntity> notificationQueue) {
127 this.notificationQueue = Optional.of(notificationQueue);
130 /*-----------------------------------------------------------------------------
135 public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
136 FaultData resultList) {
140 readTheFaultsOfMwAirInterfacePac(uuid, resultList);
143 case ETHERNETCONTAINER12:
144 readTheFaultsOfMwEthernetContainerPac(uuid, resultList);
148 readTheFaultsOfMwTdmContainerPac(uuid, resultList);
152 if (lpClass == MwHybridMwStructurePac.class) {
153 readTheFaultsOfMwHybridMwStructurePac(uuid, resultList);
155 } else if (lpClass == MwAirInterfaceDiversityPac.class) {
156 readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList);
158 } else if (lpClass == MwPureEthernetStructurePac.class) {
159 readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList);
162 LOG.warn("Unassigned lp model {} class {}", lpName, lpClass);
166 // No alarms supported
168 case ETHERNETCONTAINER10:
170 LOG.warn("Unassigned or not expected lp in model {}", lpName);
175 public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName,
177 PerformanceDataLtp res = new PerformanceDataLtp();
180 return readAirInterfacePerformanceData(lp, res);
182 case ETHERNETCONTAINER12:
183 return readEthernetContainerPerformanceData(lp, res);
185 case ETHERNETCONTAINER10:
186 case ETHERNETPHYSICAL:
191 LOG.debug("Do not read HistoricalPM data for {} {}", lpName,
192 Helper.nnGetUniversalId(lp.getUuid()).getValue());
198 public Class<?> getClassForLtpExtension(QName qName) {
200 if (qName.equals(MwAirInterfacePac.QNAME)) {
201 res = MwAirInterfacePac.class;
202 } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
203 res = MwAirInterfaceDiversityPac.class;
204 } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
205 res = MwPureEthernetStructurePac.class;
206 } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
207 res = MwHybridMwStructurePac.class;
208 } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
209 res = MwEthernetContainerPac.class;
210 } else if (qName.equals(MwTdmContainerPac.QNAME)) {
211 res = MwTdmContainerPac.class;
213 LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
218 public void onObjectCreationNotification(ObjectCreationNotification notification) {
219 LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
220 if (notification != null) {
221 microwaveModelListener.creationNotification(acessor.getNodeId(), notification.getCounter(),
222 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
227 public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
228 LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
229 if (notification != null) {
230 microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(),
231 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
236 public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
237 LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
238 EventlogEntity beventlogEntity = new EventlogBuilder().setNodeId(acessor.getNodeId().getValue())
239 .setCounter(notification.getCounter()).setTimestamp(notification.getTimeStamp())
240 .setObjectId(Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue())
241 .setAttributeName(notification.getAttributeName()).setNewValue(notification.getNewValue()).build();
242 microwaveModelListener.eventNotification(beventlogEntity);
243 if (notificationQueue.isPresent()) {
244 notificationQueue.get().put(beventlogEntity);
249 public void onProblemNotification(ProblemNotification notification) {
251 LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
253 faultService.faultNotification(acessor.getNodeId(), notification.getCounter(), notification.getTimeStamp(),
254 Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue(), notification.getProblem(),
255 mapSeverity(notification.getSeverity()));
258 /*-----------------------------------------------------------------------------
259 * Reading problems for specific interface pacs
263 * Read problems of specific interfaces
265 * @param uuId Universal Id String of the interface
266 * @return number of alarms
268 private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, FaultData resultList) {
270 final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
272 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
273 mountpointId, interfacePacUuid.getValue());
275 // Step 2.2: construct data and the relative iid
276 InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID =
277 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
278 .child(AirInterfaceCurrentProblems.class).build();
280 // Step 2.3: read to the config data store
281 AirInterfaceCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
282 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
284 if (problems == null) {
285 LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
286 } else if (problems.getCurrentProblemList() == null) {
287 LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid);
289 for (AirInterfaceCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
290 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
291 interfacePacUuid.getValue(), problem.getProblemName(),
292 mapSeverity(problem.getProblemSeverity()));
299 * Read problems of specific interfaces
301 * @param uuId Universal index of Interfacepac
302 * @return number of alarms
304 private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
306 final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
308 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
309 mountpointId, interfacePacUuid.getValue());
311 InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
312 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
313 .child(EthernetContainerCurrentProblems.class).build();
315 EthernetContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
316 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
317 if (problems == null) {
318 LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
319 } else if (problems.getCurrentProblemList() == null) {
320 LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
322 for (ContainerCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
323 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
324 interfacePacUuid.getValue(), problem.getProblemName(),
325 mapSeverity(problem.getProblemSeverity()));
332 * Read problems of specific interfaces
334 * @param uuId Universal index of Interfacepac
335 * @return number of alarms
337 private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid, FaultData resultList) {
339 final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
340 final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
342 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
343 mountpointId, interfacePacUuid.getValue());
345 InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
346 .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
348 AirInterfaceDiversityCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
349 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
350 if (problems == null) {
351 LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
352 } else if (problems.getCurrentProblemList() == null) {
353 LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid);
355 for (AirInterfaceDiversityCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
356 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
357 interfacePacUuid.getValue(), problem.getProblemName(),
358 mapSeverity(problem.getProblemSeverity()));
365 * Read problems of specific interfaces
367 * @param uuId Universal index of Interfacepac
368 * @return number of alarms
370 private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
372 final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
373 final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
375 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
376 mountpointId, interfacePacUuid.getValue());
378 InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
379 .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
381 PureEthernetStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
382 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
383 if (problems == null) {
384 LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
385 } else if (problems.getCurrentProblemList() == null) {
386 LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
388 for (StructureCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
389 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
390 interfacePacUuid.getValue(), problem.getProblemName(),
391 mapSeverity(problem.getProblemSeverity()));
398 * Read problems of specific interfaces
400 * @param uuId Universal index of Interfacepac
401 * @return number of alarms
403 private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
405 final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
406 final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
408 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
409 mountpointId, interfacePacUuid.getValue());
411 InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
412 .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
414 HybridMwStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
415 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
416 if (problems == null) {
417 LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
418 } else if (problems.getCurrentProblemList() == null) {
419 LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
421 for (StructureCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
422 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
423 interfacePacUuid.getValue(), problem.getProblemName(),
424 mapSeverity(problem.getProblemSeverity()));
431 * Read problems of specific interfaces. TODO Goal for future implementation without usage of explicit new. Key is
432 * generated by newInstance() function here to verify this approach.
434 * @param uuId Universal index of Interfacepac
435 * @return number of alarms
436 * @throws SecurityException
437 * @throws NoSuchMethodException
438 * @throws InvocationTargetException
439 * @throws IllegalArgumentException
440 * @throws IllegalAccessException
441 * @throws InstantiationException
443 private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
445 final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
446 final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
447 final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
449 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
450 mountpointId, interfacePacUuid.getValue());
453 // -- Specific part 1
454 Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
455 InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
456 .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
458 // -- Specific part 2
459 TdmContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
460 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
461 if (problems == null) {
462 LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
464 // -- Specific part 3
465 for (ContainerCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
466 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
467 interfacePacUuid.getValue(), problem.getProblemName(),
468 mapSeverity(problem.getProblemSeverity()));
471 } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
472 | IllegalArgumentException | InvocationTargetException e) {
473 LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
478 /*-----------------------------------------------------------------------------
479 * Performance related data
483 * Read and add performance data
485 * @param lp to read from
486 * @param result Object to be filled with data
489 private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) {
491 LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid());
493 UniversalId mwAirInterfacePacuuId = lp.getUuid();
494 // Step 2.1: construct data and the relative iid
495 InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID =
496 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
497 .child(AirInterfaceConfiguration.class).build();
498 AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(),
499 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
501 if (airConfiguration == null) {
502 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
505 // Step 2.2: construct data and the relative iid
506 InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID =
507 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
508 .child(AirInterfaceHistoricalPerformances.class).build();
510 // Step 2.3: read to the config data store
511 AirInterfaceHistoricalPerformances airHistoricalPerformanceData = genericTransactionUtils.readData(
512 acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
514 if (airHistoricalPerformanceData == null) {
515 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
516 mwAirInterfacePacuuId);
518 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
519 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
520 YangHelper.getCollection(airHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
521 LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
522 airHistPMList.size());
523 for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistPMList) {
524 result.add(new PerformanceDataAirInterface181010Builder(acessor.getNodeId(), lp, pmRecord,
529 LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, result.size());
533 private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) {
534 final String myName = "MWEthernetContainerPac";
536 LOG.debug("DBRead Get {} : {}", mountpointId, myName, lp.getUuid());
538 UniversalId ethContainerPacuuId = lp.getUuid();
539 // Step 2.2: construct data and the relative iid
540 InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
541 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
542 .child(EthernetContainerHistoricalPerformances.class).build();
544 // Step 2.3: read to the config data store
545 EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = acessor.getTransactionUtils()
546 .readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
548 if (ethContainerHistoricalPerformanceData == null) {
549 LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
551 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
552 YangHelper.getCollection(ethContainerHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
553 LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
554 for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
555 result.add(new PerformanceDataAirInterface181010Builder(acessor.getNodeId(), lp, pmRecord));
558 LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, result.size());
562 public static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType mapSeverity(
563 SeverityType severity) {
565 Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType> res =
566 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType
567 .forName(severity.name());
569 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed);