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.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.rev180907.AirInterfaceCurrentProblemTypeG;
42 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AirInterfaceDiversityCurrentProblemTypeG;
43 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AirInterfaceHistoricalPerformanceTypeG;
44 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AttributeValueChangedNotification;
45 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ContainerCurrentProblemTypeG;
46 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ContainerHistoricalPerformanceTypeG;
47 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MicrowaveModelListener;
48 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfaceDiversityPac;
49 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfaceDiversityPacKey;
50 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfacePac;
51 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfacePacKey;
52 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwEthernetContainerPac;
53 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwEthernetContainerPacKey;
54 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwHybridMwStructurePac;
55 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwHybridMwStructurePacKey;
56 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwPureEthernetStructurePac;
57 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwPureEthernetStructurePacKey;
58 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwTdmContainerPac;
59 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwTdmContainerPacKey;
60 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ObjectCreationNotification;
61 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ObjectDeletionNotification;
62 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ProblemNotification;
63 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.SeverityType;
64 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.StructureCurrentProblemTypeG;
65 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
66 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceConfiguration;
67 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceCurrentProblems;
68 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
69 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
70 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
71 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
72 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
73 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.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 WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, MicrowaveModelListener {
85 private static final Logger LOG = LoggerFactory.getLogger(WrapperMicrowaveModelRev180907.class);
87 public static final QName QNAME = MwAirInterfacePac.QNAME;
90 private final NotificationService microwaveModelListener;
91 private final NetconfAccessor acessor;
92 private final TransactionUtils genericTransactionUtil;
93 private final String mountpointId;
94 private final @NonNull FaultService faultService;
96 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 WrapperMicrowaveModelRev180907(@NonNull NetconfAccessor acessor,
106 @NonNull DeviceManagerServiceProvider serviceProvider) {
107 this.acessor = acessor;
108 this.mountpointId = acessor.getNodeId().getValue();
109 this.genericTransactionUtil = acessor.getTransactionUtils();
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 readAirInterfacePerformanceData(lp, res);
183 case ETHERNETCONTAINER12:
184 readEthernetContainerPerformanceData(lp, res);
187 case ETHERNETCONTAINER10:
188 case ETHERNETPHYSICAL:
193 LOG.debug("Do not read HistoricalPM data for {} {}", lpName,
194 Helper.nnGetUniversalId(lp.getUuid()).getValue());
201 public Class<?> getClassForLtpExtension(QName qName) {
203 if (qName.equals(MwAirInterfacePac.QNAME)) {
204 res = MwAirInterfacePac.class;
205 } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
206 res = MwAirInterfaceDiversityPac.class;
207 } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
208 res = MwPureEthernetStructurePac.class;
209 } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
210 res = MwHybridMwStructurePac.class;
211 } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
212 res = MwEthernetContainerPac.class;
213 } else if (qName.equals(MwTdmContainerPac.QNAME)) {
214 res = MwTdmContainerPac.class;
216 LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
221 public void onObjectCreationNotification(ObjectCreationNotification notification) {
222 LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
223 if (notification != null) {
224 microwaveModelListener.creationNotification(acessor.getNodeId(), notification.getCounter(),
225 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
230 public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
231 LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
232 if (notification != null) {
233 microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(),
234 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
239 public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
240 LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
241 EventlogEntity beventlogEntity = new EventlogBuilder().setNodeId(acessor.getNodeId().getValue())
242 .setCounter(notification.getCounter()).setTimestamp(notification.getTimeStamp())
243 .setObjectId(Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue())
244 .setAttributeName(notification.getAttributeName()).setNewValue(notification.getNewValue()).build();
245 microwaveModelListener.eventNotification(beventlogEntity);
246 if (notificationQueue.isPresent()) {
247 notificationQueue.get().put(beventlogEntity);
252 public void onProblemNotification(ProblemNotification notification) {
254 LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
256 faultService.faultNotification(acessor.getNodeId(), notification.getCounter(), notification.getTimeStamp(),
257 Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue(), notification.getProblem(),
258 mapSeverity(notification.getSeverity()));
261 /*-----------------------------------------------------------------------------
262 * Reading problems for specific interface pacs
266 * Read problems of specific interfaces
268 * @param uuId Universal Id String of the interface
269 * @return number of alarms
271 private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, FaultData resultList) {
273 final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
275 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
276 mountpointId, interfacePacUuid.getValue());
278 // Step 2.2: construct data and the relative iid
279 InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID =
280 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
281 .child(AirInterfaceCurrentProblems.class).build();
283 // Step 2.3: read to the config data store
284 AirInterfaceCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
285 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
287 if (problems == null) {
288 LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
290 for (AirInterfaceCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
291 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
292 interfacePacUuid.getValue(), problem.getProblemName(),
293 mapSeverity(problem.getProblemSeverity()));
300 * Read problems of specific interfaces
302 * @param uuId Universal index of Interfacepac
303 * @return number of alarms
305 private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
307 final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
309 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
310 mountpointId, interfacePacUuid.getValue());
312 InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
313 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
314 .child(EthernetContainerCurrentProblems.class).build();
316 EthernetContainerCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
317 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
318 if (problems == null) {
319 LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
321 for (ContainerCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
322 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
323 interfacePacUuid.getValue(), problem.getProblemName(),
324 mapSeverity(problem.getProblemSeverity()));
331 * Read problems of specific interfaces
333 * @param uuId Universal index of Interfacepac
334 * @return number of alarms
336 private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid, FaultData resultList) {
338 final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
339 final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
341 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
342 mountpointId, interfacePacUuid.getValue());
344 InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
345 .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
347 AirInterfaceDiversityCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
348 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
349 if (problems == null) {
350 LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
352 for (AirInterfaceDiversityCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
353 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
354 interfacePacUuid.getValue(), problem.getProblemName(),
355 mapSeverity(problem.getProblemSeverity()));
362 * Read problems of specific interfaces
364 * @param uuId Universal index of Interfacepac
365 * @return number of alarms
367 private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
369 final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
370 final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
372 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
373 mountpointId, interfacePacUuid.getValue());
375 InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
376 .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
378 PureEthernetStructureCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
379 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
380 if (problems == null) {
381 LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
383 for (StructureCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
384 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
385 interfacePacUuid.getValue(), problem.getProblemName(),
386 mapSeverity(problem.getProblemSeverity()));
393 * Read problems of specific interfaces
395 * @param uuId Universal index of Interfacepac
396 * @return number of alarms
398 private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
400 final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
401 final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
403 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
404 mountpointId, interfacePacUuid.getValue());
406 InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
407 .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
409 HybridMwStructureCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
410 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
411 if (problems == null) {
412 LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
414 for (StructureCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
415 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
416 interfacePacUuid.getValue(), problem.getProblemName(),
417 mapSeverity(problem.getProblemSeverity()));
424 * Read problems of specific interfaces. TODO Goal for future implementation without usage of explicit new. Key is
425 * generated by newInstance() function here to verify this approach.
427 * @param uuId Universal index of Interfacepac
428 * @return number of alarms
429 * @throws SecurityException
430 * @throws NoSuchMethodException
431 * @throws InvocationTargetException
432 * @throws IllegalArgumentException
433 * @throws IllegalAccessException
434 * @throws InstantiationException
436 private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
438 final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
439 final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
440 final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
442 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
443 mountpointId, interfacePacUuid.getValue());
446 // -- Specific part 1
447 Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
448 InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
449 .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
451 // -- Specific part 2
452 TdmContainerCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
453 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
454 if (problems == null) {
455 LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
457 // -- Specific part 3
458 for (ContainerCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
459 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
460 interfacePacUuid.getValue(), problem.getProblemName(),
461 mapSeverity(problem.getProblemSeverity()));
464 } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
465 | IllegalArgumentException | InvocationTargetException e) {
466 LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
472 * Read and add performance data
474 * @param lp to read from
475 * @param result Object to be filled with data
478 private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) {
480 LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid());
482 UniversalId mwAirInterfacePacuuId = lp.getUuid();
483 // Step 2.1: construct data and the relative iid
484 InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID =
485 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
486 .child(AirInterfaceConfiguration.class).build();
487 AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(),
488 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
490 if (airConfiguration == null) {
491 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
494 // Step 2.2: construct data and the relative iid
495 InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID =
496 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
497 .child(AirInterfaceHistoricalPerformances.class).build();
499 // Step 2.3: read to the config data store
500 AirInterfaceHistoricalPerformances airHistoricalPerformanceData = acessor.getTransactionUtils().readData(
501 acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
503 if (airHistoricalPerformanceData == null) {
504 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
505 mwAirInterfacePacuuId);
507 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
508 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
509 YangHelper.getCollection(airHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
510 LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
511 airHistPMList.size());
512 for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistPMList) {
513 result.add(new PerformanceDataAirInterface180907Builder(acessor.getNodeId(), lp, pmRecord,
518 LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, result.size());
522 private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) {
523 final String myName = "MWEthernetContainerPac";
525 LOG.debug("DBRead Get {} : {}", myName, lp.getUuid());
527 UniversalId ethContainerPacuuId = lp.getUuid();
528 // Step 2.2: construct data and the relative iid
529 InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
530 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
531 .child(EthernetContainerHistoricalPerformances.class).build();
533 // Step 2.3: read to the config data store
534 EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = acessor.getTransactionUtils()
535 .readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
537 if (ethContainerHistoricalPerformanceData == null) {
538 LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
540 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
541 YangHelper.getCollection(ethContainerHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
542 LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
543 for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
544 result.add(new PerformanceDataAirInterface180907Builder(acessor.getNodeId(), lp, pmRecord));
547 LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, result.size());
551 private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType mapSeverity(
552 SeverityType severity) {
554 Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType> res =
555 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType
556 .forName(severity.name());
558 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed);