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.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.rev170324.AirInterfaceCurrentProblemTypeG;
43 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceDiversityCurrentProblemTypeG;
44 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceHistoricalPerformanceTypeG;
45 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AttributeValueChangedNotification;
46 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ContainerCurrentProblemTypeG;
47 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ContainerHistoricalPerformanceTypeG;
48 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MicrowaveModelListener;
49 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfaceDiversityPac;
50 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfaceDiversityPacKey;
51 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfacePac;
52 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfacePacKey;
53 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwEthernetContainerPac;
54 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwEthernetContainerPacKey;
55 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwHybridMwStructurePac;
56 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwHybridMwStructurePacKey;
57 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwPureEthernetStructurePac;
58 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwPureEthernetStructurePacKey;
59 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwTdmContainerPac;
60 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwTdmContainerPacKey;
61 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ObjectCreationNotification;
62 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ObjectDeletionNotification;
63 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ProblemNotification;
64 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.SeverityType;
65 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.StructureCurrentProblemTypeG;
66 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
67 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceConfiguration;
68 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceCurrentProblems;
69 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
70 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
71 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
72 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
73 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
74 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.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 WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, MicrowaveModelListener {
86 private static final Logger LOG = LoggerFactory.getLogger(WrapperMicrowaveModelRev170324.class);
88 public static final QName QNAME = MwAirInterfacePac.QNAME;
91 private final NotificationService microwaveModelListener;
92 private final NetconfBindingAccessor acessor;
93 private final TransactionUtils genericTransactionUtils;
94 private final FaultService faultService;
96 private Optional<NotificationWorker<EventlogEntity>> notificationQueue;
99 * @param acessor to access device
101 public WrapperMicrowaveModelRev170324(@NonNull NetconfBindingAccessor acessor,
102 @NonNull DeviceManagerServiceProvider serviceProvider) {
103 this.acessor = acessor;
104 this.genericTransactionUtils = acessor.getTransactionUtils();
105 this.microwaveModelListener = serviceProvider.getNotificationService();
106 this.faultService = serviceProvider.getFaultService();
107 this.notificationQueue = Optional.empty();
110 /*-----------------------------------------------------------------------------
114 @SuppressWarnings("unchecked")
116 public <T extends NotificationListener> T getNotificationListener() {
121 public void setNotificationQueue(NotificationWorker<EventlogEntity> notificationQueue) {
122 this.notificationQueue = Optional.of(notificationQueue);
125 /*-----------------------------------------------------------------------------
126 * Interface functions
130 public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
131 FaultData resultList) {
135 readTheFaultsOfMwAirInterfacePac(uuid, resultList);
138 case ETHERNETCONTAINER12:
139 readTheFaultsOfMwEthernetContainerPac(uuid, resultList);
143 readTheFaultsOfMwTdmContainerPac(uuid, resultList);
147 if (lpClass == MwHybridMwStructurePac.class) {
148 readTheFaultsOfMwHybridMwStructurePac(uuid, resultList);
150 } else if (lpClass == MwAirInterfaceDiversityPac.class) {
151 readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList);
153 } else if (lpClass == MwPureEthernetStructurePac.class) {
154 readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList);
157 LOG.warn("Unassigned lp model {} class {}", lpName, lpClass);
161 // No alarms supported
163 case ETHERNETCONTAINER10:
165 LOG.warn("Unassigned or not expected lp in model {}", lpName);
170 public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName,
172 PerformanceDataLtp res = new PerformanceDataLtp();
173 readAirInterfacePerformanceData(lp, res);
174 readEthernetContainerPerformanceData(lp, res);
180 public Class<?> getClassForLtpExtension(QName qName) {
182 if (qName.equals(MwAirInterfacePac.QNAME)) {
183 res = MwAirInterfacePac.class;
184 } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
185 res = MwAirInterfaceDiversityPac.class;
186 } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
187 res = MwPureEthernetStructurePac.class;
188 } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
189 res = MwHybridMwStructurePac.class;
190 } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
191 res = MwEthernetContainerPac.class;
192 } else if (qName.equals(MwTdmContainerPac.QNAME)) {
193 res = MwTdmContainerPac.class;
195 LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
200 public void onObjectCreationNotification(ObjectCreationNotification notification) {
201 LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
202 if (notification != null) {
203 microwaveModelListener.creationNotification(acessor.getNodeId(), notification.getCounter(),
204 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
209 public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
210 LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
211 if (notification != null) {
212 microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(),
213 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
218 public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
219 LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
220 EventlogEntity beventlogEntity = new EventlogBuilder().setNodeId(acessor.getNodeId().getValue())
221 .setCounter(notification.getCounter()).setTimestamp(notification.getTimeStamp())
222 .setObjectId(Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue())
223 .setAttributeName(notification.getAttributeName()).setNewValue(notification.getNewValue()).build();
224 microwaveModelListener.eventNotification(beventlogEntity);
225 if (notificationQueue.isPresent()) {
226 notificationQueue.get().put(beventlogEntity);
231 public void onProblemNotification(ProblemNotification notification) {
233 LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
235 faultService.faultNotification(acessor.getNodeId(), notification.getCounter(), notification.getTimeStamp(),
236 Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue(), notification.getProblem(),
237 mapSeverity(notification.getSeverity()));
240 /*-----------------------------------------------------------------------------
241 * Reading problems for specific interface pacs
245 * Read problems of specific interfaces
247 * @param uuId Universal Id String of the interface
248 * @return number of alarms
250 private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, FaultData resultList) {
252 final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
254 String mountpointId = acessor.getNodeId().getValue();
255 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
256 mountpointId, interfacePacUuid.getValue());
258 // Step 2.2: construct data and the relative iid
259 InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID =
260 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
261 .child(AirInterfaceCurrentProblems.class).build();
263 // Step 2.3: read to the config data store
264 AirInterfaceCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
265 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
267 if (problems == null) {
268 LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
270 for (AirInterfaceCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
271 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
272 interfacePacUuid.getValue(), problem.getProblemName(),
273 mapSeverity(problem.getProblemSeverity()));
281 * Read problems of specific interfaces
283 * @param uuId Universal index of Interfacepac
284 * @return number of alarms
286 private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
288 final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
290 String mountpointId = acessor.getNodeId().getValue();
291 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
292 mountpointId, interfacePacUuid.getValue());
294 InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
295 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
296 .child(EthernetContainerCurrentProblems.class).build();
298 EthernetContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
299 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
300 if (problems == null) {
301 LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
303 for (ContainerCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
304 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
305 interfacePacUuid.getValue(), problem.getProblemName(),
306 mapSeverity(problem.getProblemSeverity()));
313 * Read problems of specific interfaces
315 * @param uuId Universal index of Interfacepac
316 * @return number of alarms
318 private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid, FaultData resultList) {
320 final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
321 final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
323 String mountpointId = acessor.getNodeId().getValue();
324 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
325 mountpointId, interfacePacUuid.getValue());
327 InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
328 .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
330 AirInterfaceDiversityCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
331 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
332 if (problems == null) {
333 LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
335 for (AirInterfaceDiversityCurrentProblemTypeG 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 readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
352 final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
353 final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
355 String mountpointId = acessor.getNodeId().getValue();
356 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
357 mountpointId, interfacePacUuid.getValue());
359 InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
360 .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
362 PureEthernetStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
363 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
364 if (problems == null) {
365 LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
367 for (StructureCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
368 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
369 interfacePacUuid.getValue(), problem.getProblemName(),
370 mapSeverity(problem.getProblemSeverity()));
377 * Read problems of specific interfaces
379 * @param uuId Universal index of Interfacepac
380 * @return number of alarms
382 private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
384 final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
385 final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
387 String mountpointId = acessor.getNodeId().getValue();
388 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
389 mountpointId, interfacePacUuid.getValue());
391 InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
392 .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
394 HybridMwStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
395 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
396 if (problems == null) {
397 LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
399 for (StructureCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
400 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
401 interfacePacUuid.getValue(), problem.getProblemName(),
402 mapSeverity(problem.getProblemSeverity()));
409 * Read problems of specific interfaces. TODO Goal for future implementation without usage of explicit new. Key is
410 * generated by newInstance() function here to verify this approach.
412 * @param uuId Universal index of Interfacepac
413 * @return number of alarms
414 * @throws SecurityException
415 * @throws NoSuchMethodException
416 * @throws InvocationTargetException
417 * @throws IllegalArgumentException
418 * @throws IllegalAccessException
419 * @throws InstantiationException
421 private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
423 final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
424 final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
425 final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
427 String mountpointId = acessor.getNodeId().getValue();
428 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
429 mountpointId, interfacePacUuid.getValue());
432 // -- Specific part 1
433 Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
434 InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
435 .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
437 // -- Specific part 2
438 TdmContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
439 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
440 if (problems == null) {
441 LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
443 // -- Specific part 3
444 for (ContainerCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
445 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
446 interfacePacUuid.getValue(), problem.getProblemName(),
447 mapSeverity(problem.getProblemSeverity()));
450 } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
451 | IllegalArgumentException | InvocationTargetException e) {
452 LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
458 * Read and add performance data
460 * @param lp to read from
461 * @param result Object to be filled with data
464 private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) {
466 LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid());
468 UniversalId mwAirInterfacePacuuId = lp.getUuid();
469 // Step 2.1: construct data and the relative iid
470 InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID =
471 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
472 .child(AirInterfaceConfiguration.class).build();
473 AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(),
474 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
476 if (airConfiguration == null) {
477 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
480 // Step 2.2: construct data and the relative iid
481 InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID =
482 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
483 .child(AirInterfaceHistoricalPerformances.class).build();
485 // Step 2.3: read to the config data store
486 AirInterfaceHistoricalPerformances airHistoricalPerformanceData = genericTransactionUtils.readData(
487 acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
489 if (airHistoricalPerformanceData == null) {
490 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
491 mwAirInterfacePacuuId);
493 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
494 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
495 YangHelper.getCollection(airHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
496 LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
497 airHistPMList.size());
498 for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistPMList) {
499 result.add(new PerformanceDataAirInterface170324Builder(acessor.getNodeId(), lp, pmRecord,
504 LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, result.size());
509 private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) {
510 final String myName = "MWEthernetContainerPac";
512 String mountpointId = acessor.getNodeId().getValue();
514 LOG.debug("DBRead Get {} : {}", mountpointId, myName, lp.getUuid());
516 UniversalId ethContainerPacuuId = lp.getUuid();
517 // Step 2.2: construct data and the relative iid
518 InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
519 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
520 .child(EthernetContainerHistoricalPerformances.class).build();
522 // Step 2.3: read to the config data store
523 EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = acessor.getTransactionUtils()
524 .readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
526 if (ethContainerHistoricalPerformanceData == null) {
527 LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
529 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
530 YangHelper.getCollection(ethContainerHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
531 LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
532 for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
533 result.add(new PerformanceDataAirInterface170324Builder(acessor.getNodeId(), lp, pmRecord));
536 LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, result.size());
540 private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType mapSeverity(
541 SeverityType severity) {
543 Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType> res =
544 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType
545 .forName(severity.name());
547 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed);