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.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.rev181010.AirInterfaceCurrentProblemTypeG;
42 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceDiversityCurrentProblemTypeG;
43 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceHistoricalPerformanceTypeG;
44 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AttributeValueChangedNotification;
45 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ContainerCurrentProblemTypeG;
46 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ContainerHistoricalPerformanceTypeG;
47 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MicrowaveModelListener;
48 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfaceDiversityPac;
49 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfaceDiversityPacKey;
50 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfacePac;
51 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfacePacKey;
52 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwEthernetContainerPac;
53 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwEthernetContainerPacKey;
54 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwHybridMwStructurePac;
55 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwHybridMwStructurePacKey;
56 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwPureEthernetStructurePac;
57 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwPureEthernetStructurePacKey;
58 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwTdmContainerPac;
59 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwTdmContainerPacKey;
60 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ObjectCreationNotification;
61 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ObjectDeletionNotification;
62 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ProblemNotification;
63 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.SeverityType;
64 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.StructureCurrentProblemTypeG;
65 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
66 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceConfiguration;
67 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceCurrentProblems;
68 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
69 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
70 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
71 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
72 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
73 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.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 WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, MicrowaveModelListener {
85 private static final Logger LOG = LoggerFactory.getLogger(WrapperMicrowaveModelRev181010.class);
87 public static final QName QNAME = MwAirInterfacePac.QNAME;
90 private final NetconfAccessor acessor;
91 private final NotificationService microwaveModelListener;
92 private final TransactionUtils genericTransactionUtils;
93 private final String mountpointId;
94 private final @NonNull FaultService faultService;
96 private Optional<NotificationWorker<EventlogEntity>> notificationQueue;
99 * Handle specific version of microwave model
101 * @param acessor to access device
102 * @param serviceProvider for devicemanager services
104 public WrapperMicrowaveModelRev181010(@NonNull NetconfAccessor acessor,
105 @NonNull DeviceManagerServiceProvider serviceProvider) {
106 this.acessor = acessor;
107 this.genericTransactionUtils = acessor.getTransactionUtils();
108 this.mountpointId = acessor.getNodeId().getValue();
109 this.microwaveModelListener = serviceProvider.getNotificationService();
110 this.faultService = serviceProvider.getFaultService();
111 this.notificationQueue = Optional.empty();
114 /*-----------------------------------------------------------------------------
118 @SuppressWarnings("unchecked")
120 public <T extends NotificationListener> T getNotificationListener() {
125 public void setNotificationQueue(NotificationWorker<EventlogEntity> notificationQueue) {
126 this.notificationQueue = Optional.of(notificationQueue);
129 /*-----------------------------------------------------------------------------
134 public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
135 FaultData resultList) {
139 readTheFaultsOfMwAirInterfacePac(uuid, resultList);
142 case ETHERNETCONTAINER12:
143 readTheFaultsOfMwEthernetContainerPac(uuid, resultList);
147 readTheFaultsOfMwTdmContainerPac(uuid, resultList);
151 if (lpClass == MwHybridMwStructurePac.class) {
152 readTheFaultsOfMwHybridMwStructurePac(uuid, resultList);
154 } else if (lpClass == MwAirInterfaceDiversityPac.class) {
155 readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList);
157 } else if (lpClass == MwPureEthernetStructurePac.class) {
158 readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList);
161 LOG.warn("Unassigned lp model {} class {}", lpName, lpClass);
165 // No alarms supported
167 case ETHERNETCONTAINER10:
169 LOG.warn("Unassigned or not expected lp in model {}", lpName);
174 public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName,
176 PerformanceDataLtp res = new PerformanceDataLtp();
179 return readAirInterfacePerformanceData(lp, res);
181 case ETHERNETCONTAINER12:
182 return readEthernetContainerPerformanceData(lp, res);
184 case ETHERNETCONTAINER10:
185 case ETHERNETPHYSICAL:
190 LOG.debug("Do not read HistoricalPM data for {} {}", lpName,
191 Helper.nnGetUniversalId(lp.getUuid()).getValue());
197 public Class<?> getClassForLtpExtension(QName qName) {
199 if (qName.equals(MwAirInterfacePac.QNAME)) {
200 res = MwAirInterfacePac.class;
201 } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
202 res = MwAirInterfaceDiversityPac.class;
203 } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
204 res = MwPureEthernetStructurePac.class;
205 } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
206 res = MwHybridMwStructurePac.class;
207 } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
208 res = MwEthernetContainerPac.class;
209 } else if (qName.equals(MwTdmContainerPac.QNAME)) {
210 res = MwTdmContainerPac.class;
212 LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
217 public void onObjectCreationNotification(ObjectCreationNotification notification) {
218 LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
219 if (notification != null) {
220 microwaveModelListener.creationNotification(acessor.getNodeId(), notification.getCounter(),
221 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
226 public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
227 LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
228 if (notification != null) {
229 microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(),
230 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
235 public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
236 LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
237 EventlogEntity beventlogEntity = new EventlogBuilder().setNodeId(acessor.getNodeId().getValue())
238 .setCounter(notification.getCounter()).setTimestamp(notification.getTimeStamp())
239 .setObjectId(Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue())
240 .setAttributeName(notification.getAttributeName()).setNewValue(notification.getNewValue()).build();
241 microwaveModelListener.eventNotification(beventlogEntity);
242 if (notificationQueue.isPresent()) {
243 notificationQueue.get().put(beventlogEntity);
248 public void onProblemNotification(ProblemNotification notification) {
250 LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
252 faultService.faultNotification(acessor.getNodeId(), notification.getCounter(), notification.getTimeStamp(),
253 Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue(), notification.getProblem(),
254 mapSeverity(notification.getSeverity()));
257 /*-----------------------------------------------------------------------------
258 * Reading problems for specific interface pacs
262 * Read problems of specific interfaces
264 * @param uuId Universal Id String of the interface
265 * @return number of alarms
267 private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, FaultData resultList) {
269 final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
271 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
272 mountpointId, interfacePacUuid.getValue());
274 // Step 2.2: construct data and the relative iid
275 InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID =
276 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
277 .child(AirInterfaceCurrentProblems.class).build();
279 // Step 2.3: read to the config data store
280 AirInterfaceCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
281 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
283 if (problems == null) {
284 LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
285 } else if (problems.getCurrentProblemList() == null) {
286 LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid);
288 for (AirInterfaceCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
289 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
290 interfacePacUuid.getValue(), problem.getProblemName(),
291 mapSeverity(problem.getProblemSeverity()));
298 * Read problems of specific interfaces
300 * @param uuId Universal index of Interfacepac
301 * @return number of alarms
303 private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
305 final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
307 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
308 mountpointId, interfacePacUuid.getValue());
310 InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
311 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
312 .child(EthernetContainerCurrentProblems.class).build();
314 EthernetContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
315 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
316 if (problems == null) {
317 LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
318 } else if (problems.getCurrentProblemList() == null) {
319 LOG.debug("DBRead Id {} empty CurrentProblemsList", 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 = genericTransactionUtils.readData(acessor.getDataBroker(),
348 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
349 if (problems == null) {
350 LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
351 } else if (problems.getCurrentProblemList() == null) {
352 LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid);
354 for (AirInterfaceDiversityCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
355 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
356 interfacePacUuid.getValue(), problem.getProblemName(),
357 mapSeverity(problem.getProblemSeverity()));
364 * Read problems of specific interfaces
366 * @param uuId Universal index of Interfacepac
367 * @return number of alarms
369 private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
371 final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
372 final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
374 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
375 mountpointId, interfacePacUuid.getValue());
377 InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
378 .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
380 PureEthernetStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
381 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
382 if (problems == null) {
383 LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
384 } else if (problems.getCurrentProblemList() == null) {
385 LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
387 for (StructureCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
388 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
389 interfacePacUuid.getValue(), problem.getProblemName(),
390 mapSeverity(problem.getProblemSeverity()));
397 * Read problems of specific interfaces
399 * @param uuId Universal index of Interfacepac
400 * @return number of alarms
402 private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
404 final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
405 final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
407 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
408 mountpointId, interfacePacUuid.getValue());
410 InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
411 .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
413 HybridMwStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
414 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
415 if (problems == null) {
416 LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
417 } else if (problems.getCurrentProblemList() == null) {
418 LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
420 for (StructureCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
421 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
422 interfacePacUuid.getValue(), problem.getProblemName(),
423 mapSeverity(problem.getProblemSeverity()));
430 * Read problems of specific interfaces. TODO Goal for future implementation without usage of explicit new. Key is
431 * generated by newInstance() function here to verify this approach.
433 * @param uuId Universal index of Interfacepac
434 * @return number of alarms
435 * @throws SecurityException
436 * @throws NoSuchMethodException
437 * @throws InvocationTargetException
438 * @throws IllegalArgumentException
439 * @throws IllegalAccessException
440 * @throws InstantiationException
442 private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
444 final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
445 final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
446 final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
448 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
449 mountpointId, interfacePacUuid.getValue());
452 // -- Specific part 1
453 Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
454 InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
455 .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
457 // -- Specific part 2
458 TdmContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
459 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
460 if (problems == null) {
461 LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
463 // -- Specific part 3
464 for (ContainerCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
465 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
466 interfacePacUuid.getValue(), problem.getProblemName(),
467 mapSeverity(problem.getProblemSeverity()));
470 } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
471 | IllegalArgumentException | InvocationTargetException e) {
472 LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
477 /*-----------------------------------------------------------------------------
478 * Performance related data
482 * Read and add performance data
484 * @param lp to read from
485 * @param result Object to be filled with data
488 private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) {
490 LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid());
492 UniversalId mwAirInterfacePacuuId = lp.getUuid();
493 // Step 2.1: construct data and the relative iid
494 InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID =
495 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
496 .child(AirInterfaceConfiguration.class).build();
497 AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(),
498 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
500 if (airConfiguration == null) {
501 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
504 // Step 2.2: construct data and the relative iid
505 InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID =
506 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
507 .child(AirInterfaceHistoricalPerformances.class).build();
509 // Step 2.3: read to the config data store
510 AirInterfaceHistoricalPerformances airHistoricalPerformanceData = genericTransactionUtils.readData(
511 acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
513 if (airHistoricalPerformanceData == null) {
514 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
515 mwAirInterfacePacuuId);
517 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
518 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
519 YangHelper.getCollection(airHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
520 LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
521 airHistPMList.size());
522 for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistPMList) {
523 result.add(new PerformanceDataAirInterface181010Builder(acessor.getNodeId(), lp, pmRecord,
528 LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, result.size());
532 private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) {
533 final String myName = "MWEthernetContainerPac";
535 LOG.debug("DBRead Get {} : {}", mountpointId, myName, lp.getUuid());
537 UniversalId ethContainerPacuuId = lp.getUuid();
538 // Step 2.2: construct data and the relative iid
539 InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
540 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
541 .child(EthernetContainerHistoricalPerformances.class).build();
543 // Step 2.3: read to the config data store
544 EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = acessor.getTransactionUtils()
545 .readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
547 if (ethContainerHistoricalPerformanceData == null) {
548 LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
550 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
551 YangHelper.getCollection(ethContainerHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
552 LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
553 for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
554 result.add(new PerformanceDataAirInterface181010Builder(acessor.getNodeId(), lp, pmRecord));
557 LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, result.size());
561 public static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType mapSeverity(
562 SeverityType severity) {
564 Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType> res =
565 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType
566 .forName(severity.name());
568 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed);