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.netconfnodestateservice.NetconfAccessor;
37 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
38 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
39 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
40 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
41 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceCurrentProblemTypeG;
42 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceDiversityCurrentProblemTypeG;
43 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceHistoricalPerformanceTypeG;
44 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AttributeValueChangedNotification;
45 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ContainerCurrentProblemTypeG;
46 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ContainerHistoricalPerformanceTypeG;
47 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MicrowaveModelListener;
48 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfaceDiversityPac;
49 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfaceDiversityPacKey;
50 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfacePac;
51 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfacePacKey;
52 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwEthernetContainerPac;
53 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwEthernetContainerPacKey;
54 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwHybridMwStructurePac;
55 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwHybridMwStructurePacKey;
56 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwPureEthernetStructurePac;
57 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwPureEthernetStructurePacKey;
58 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwTdmContainerPac;
59 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwTdmContainerPacKey;
60 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ObjectCreationNotification;
61 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ObjectDeletionNotification;
62 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ProblemNotification;
63 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.SeverityType;
64 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.StructureCurrentProblemTypeG;
65 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
66 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceConfiguration;
67 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceCurrentProblems;
68 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
69 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
70 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
71 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
72 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
73 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.tdm.container.pac.TdmContainerCurrentProblems;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder;
75 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity;
76 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
77 import org.opendaylight.yangtools.yang.binding.NotificationListener;
78 import org.opendaylight.yangtools.yang.common.QName;
79 import org.slf4j.Logger;
80 import org.slf4j.LoggerFactory;
83 public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, MicrowaveModelListener {
85 private static final Logger LOG = LoggerFactory.getLogger(WrapperMicrowaveModelRev170324.class);
87 public static final QName QNAME = MwAirInterfacePac.QNAME;
90 private final NotificationService microwaveModelListener;
91 private final NetconfAccessor acessor;
92 private final TransactionUtils genericTransactionUtils;
93 private final FaultService faultService;
95 private Optional<NotificationWorker<EventlogEntity>> notificationQueue;
98 * @param acessor to access device
100 public WrapperMicrowaveModelRev170324(@NonNull NetconfAccessor acessor,
101 @NonNull DeviceManagerServiceProvider serviceProvider) {
102 this.acessor = acessor;
103 this.genericTransactionUtils = acessor.getTransactionUtils();
104 this.microwaveModelListener = serviceProvider.getNotificationService();
105 this.faultService = serviceProvider.getFaultService();
106 this.notificationQueue = Optional.empty();
109 /*-----------------------------------------------------------------------------
113 @SuppressWarnings("unchecked")
115 public <T extends NotificationListener> T getNotificationListener() {
120 public void setNotificationQueue(NotificationWorker<EventlogEntity> notificationQueue) {
121 this.notificationQueue = Optional.of(notificationQueue);
124 /*-----------------------------------------------------------------------------
125 * Interface functions
129 public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
130 FaultData resultList) {
134 readTheFaultsOfMwAirInterfacePac(uuid, resultList);
137 case ETHERNETCONTAINER12:
138 readTheFaultsOfMwEthernetContainerPac(uuid, resultList);
142 readTheFaultsOfMwTdmContainerPac(uuid, resultList);
146 if (lpClass == MwHybridMwStructurePac.class) {
147 readTheFaultsOfMwHybridMwStructurePac(uuid, resultList);
149 } else if (lpClass == MwAirInterfaceDiversityPac.class) {
150 readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList);
152 } else if (lpClass == MwPureEthernetStructurePac.class) {
153 readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList);
156 LOG.warn("Unassigned lp model {} class {}", lpName, lpClass);
160 // No alarms supported
162 case ETHERNETCONTAINER10:
164 LOG.warn("Unassigned or not expected lp in model {}", lpName);
169 public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName,
171 PerformanceDataLtp res = new PerformanceDataLtp();
172 readAirInterfacePerformanceData(lp, res);
173 readEthernetContainerPerformanceData(lp, res);
179 public Class<?> getClassForLtpExtension(QName qName) {
181 if (qName.equals(MwAirInterfacePac.QNAME)) {
182 res = MwAirInterfacePac.class;
183 } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
184 res = MwAirInterfaceDiversityPac.class;
185 } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
186 res = MwPureEthernetStructurePac.class;
187 } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
188 res = MwHybridMwStructurePac.class;
189 } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
190 res = MwEthernetContainerPac.class;
191 } else if (qName.equals(MwTdmContainerPac.QNAME)) {
192 res = MwTdmContainerPac.class;
194 LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
199 public void onObjectCreationNotification(ObjectCreationNotification notification) {
200 LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
201 if (notification != null) {
202 microwaveModelListener.creationNotification(acessor.getNodeId(), notification.getCounter(),
203 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
208 public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
209 LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
210 if (notification != null) {
211 microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(),
212 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
217 public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
218 LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
219 EventlogEntity beventlogEntity = new EventlogBuilder().setNodeId(acessor.getNodeId().getValue())
220 .setCounter(notification.getCounter()).setTimestamp(notification.getTimeStamp())
221 .setObjectId(Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue())
222 .setAttributeName(notification.getAttributeName()).setNewValue(notification.getNewValue()).build();
223 microwaveModelListener.eventNotification(beventlogEntity);
224 if (notificationQueue.isPresent()) {
225 notificationQueue.get().put(beventlogEntity);
230 public void onProblemNotification(ProblemNotification notification) {
232 LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
234 faultService.faultNotification(acessor.getNodeId(), notification.getCounter(), notification.getTimeStamp(),
235 Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue(), notification.getProblem(),
236 mapSeverity(notification.getSeverity()));
239 /*-----------------------------------------------------------------------------
240 * Reading problems for specific interface pacs
244 * Read problems of specific interfaces
246 * @param uuId Universal Id String of the interface
247 * @return number of alarms
249 private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, FaultData resultList) {
251 final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
253 String mountpointId = acessor.getNodeId().getValue();
254 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
255 mountpointId, interfacePacUuid.getValue());
257 // Step 2.2: construct data and the relative iid
258 InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID =
259 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
260 .child(AirInterfaceCurrentProblems.class).build();
262 // Step 2.3: read to the config data store
263 AirInterfaceCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
264 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
266 if (problems == null) {
267 LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
269 for (AirInterfaceCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
270 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
271 interfacePacUuid.getValue(), problem.getProblemName(),
272 mapSeverity(problem.getProblemSeverity()));
280 * Read problems of specific interfaces
282 * @param uuId Universal index of Interfacepac
283 * @return number of alarms
285 private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
287 final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
289 String mountpointId = acessor.getNodeId().getValue();
290 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
291 mountpointId, interfacePacUuid.getValue());
293 InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
294 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
295 .child(EthernetContainerCurrentProblems.class).build();
297 EthernetContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
298 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
299 if (problems == null) {
300 LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
302 for (ContainerCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
303 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
304 interfacePacUuid.getValue(), problem.getProblemName(),
305 mapSeverity(problem.getProblemSeverity()));
312 * Read problems of specific interfaces
314 * @param uuId Universal index of Interfacepac
315 * @return number of alarms
317 private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid, FaultData resultList) {
319 final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
320 final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
322 String mountpointId = acessor.getNodeId().getValue();
323 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
324 mountpointId, interfacePacUuid.getValue());
326 InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
327 .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
329 AirInterfaceDiversityCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
330 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
331 if (problems == null) {
332 LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
334 for (AirInterfaceDiversityCurrentProblemTypeG problem : YangHelper.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 readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
351 final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
352 final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
354 String mountpointId = acessor.getNodeId().getValue();
355 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
356 mountpointId, interfacePacUuid.getValue());
358 InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
359 .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
361 PureEthernetStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
362 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
363 if (problems == null) {
364 LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
366 for (StructureCurrentProblemTypeG 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 readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
383 final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
384 final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
386 String mountpointId = acessor.getNodeId().getValue();
387 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
388 mountpointId, interfacePacUuid.getValue());
390 InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
391 .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
393 HybridMwStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
394 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
395 if (problems == null) {
396 LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
398 for (StructureCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
399 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
400 interfacePacUuid.getValue(), problem.getProblemName(),
401 mapSeverity(problem.getProblemSeverity()));
408 * Read problems of specific interfaces. TODO Goal for future implementation without usage of explicit new. Key is
409 * generated by newInstance() function here to verify this approach.
411 * @param uuId Universal index of Interfacepac
412 * @return number of alarms
413 * @throws SecurityException
414 * @throws NoSuchMethodException
415 * @throws InvocationTargetException
416 * @throws IllegalArgumentException
417 * @throws IllegalAccessException
418 * @throws InstantiationException
420 private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
422 final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
423 final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
424 final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
426 String mountpointId = acessor.getNodeId().getValue();
427 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
428 mountpointId, interfacePacUuid.getValue());
431 // -- Specific part 1
432 Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
433 InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
434 .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
436 // -- Specific part 2
437 TdmContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
438 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
439 if (problems == null) {
440 LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
442 // -- Specific part 3
443 for (ContainerCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
444 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
445 interfacePacUuid.getValue(), problem.getProblemName(),
446 mapSeverity(problem.getProblemSeverity()));
449 } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
450 | IllegalArgumentException | InvocationTargetException e) {
451 LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
457 * Read and add performance data
459 * @param lp to read from
460 * @param result Object to be filled with data
463 private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) {
465 LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid());
467 UniversalId mwAirInterfacePacuuId = lp.getUuid();
468 // Step 2.1: construct data and the relative iid
469 InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID =
470 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
471 .child(AirInterfaceConfiguration.class).build();
472 AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(),
473 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
475 if (airConfiguration == null) {
476 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
479 // Step 2.2: construct data and the relative iid
480 InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID =
481 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
482 .child(AirInterfaceHistoricalPerformances.class).build();
484 // Step 2.3: read to the config data store
485 AirInterfaceHistoricalPerformances airHistoricalPerformanceData = genericTransactionUtils.readData(
486 acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
488 if (airHistoricalPerformanceData == null) {
489 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
490 mwAirInterfacePacuuId);
492 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
493 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
494 YangHelper.getCollection(airHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
495 LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
496 airHistPMList.size());
497 for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistPMList) {
498 result.add(new PerformanceDataAirInterface170324Builder(acessor.getNodeId(), lp, pmRecord,
503 LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, result.size());
508 private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) {
509 final String myName = "MWEthernetContainerPac";
511 String mountpointId = acessor.getNodeId().getValue();
513 LOG.debug("DBRead Get {} : {}", mountpointId, myName, lp.getUuid());
515 UniversalId ethContainerPacuuId = lp.getUuid();
516 // Step 2.2: construct data and the relative iid
517 InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
518 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
519 .child(EthernetContainerHistoricalPerformances.class).build();
521 // Step 2.3: read to the config data store
522 EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = acessor.getTransactionUtils()
523 .readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
525 if (ethContainerHistoricalPerformanceData == null) {
526 LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
528 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
529 YangHelper.getCollection(ethContainerHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
530 LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
531 for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
532 result.add(new PerformanceDataAirInterface170324Builder(acessor.getNodeId(), lp, pmRecord));
535 LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, result.size());
539 private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType mapSeverity(
540 SeverityType severity) {
542 Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType> res =
543 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType
544 .forName(severity.name());
546 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed);