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.NetconfBindingAccessor;
37 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
38 import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
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.rev180907.AirInterfaceCurrentProblemTypeG;
43 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AirInterfaceDiversityCurrentProblemTypeG;
44 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AirInterfaceHistoricalPerformanceTypeG;
45 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AttributeValueChangedNotification;
46 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ContainerCurrentProblemTypeG;
47 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ContainerHistoricalPerformanceTypeG;
48 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MicrowaveModelListener;
49 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfaceDiversityPac;
50 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfaceDiversityPacKey;
51 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfacePac;
52 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfacePacKey;
53 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwEthernetContainerPac;
54 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwEthernetContainerPacKey;
55 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwHybridMwStructurePac;
56 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwHybridMwStructurePacKey;
57 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwPureEthernetStructurePac;
58 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwPureEthernetStructurePacKey;
59 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwTdmContainerPac;
60 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwTdmContainerPacKey;
61 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ObjectCreationNotification;
62 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ObjectDeletionNotification;
63 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ProblemNotification;
64 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.SeverityType;
65 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.StructureCurrentProblemTypeG;
66 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
67 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceConfiguration;
68 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceCurrentProblems;
69 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
70 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
71 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
72 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
73 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
74 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogBuilder;
78 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogEntity;
79 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType;
80 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
81 import org.opendaylight.yangtools.yang.binding.NotificationListener;
82 import org.opendaylight.yangtools.yang.common.QName;
83 import org.slf4j.Logger;
84 import org.slf4j.LoggerFactory;
87 public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, MicrowaveModelListener {
89 private static final Logger LOG = LoggerFactory.getLogger(WrapperMicrowaveModelRev180907.class);
91 public static final QName QNAME = MwAirInterfacePac.QNAME;
94 private final NotificationService microwaveModelListener;
95 private final NetconfBindingAccessor acessor;
96 private final TransactionUtils genericTransactionUtil;
97 private final String mountpointId;
98 private final @NonNull FaultService faultService;
99 private final WebsocketManagerService notificationService;
101 private Optional<NotificationWorker<EventlogEntity>> notificationQueue;
106 * Handle specific version of microwave model
108 * @param acessor to access device
109 * @param serviceProvider for devicemanager services
111 public WrapperMicrowaveModelRev180907(@NonNull NetconfBindingAccessor acessor,
112 @NonNull DeviceManagerServiceProvider serviceProvider) {
113 this.acessor = acessor;
114 this.mountpointId = acessor.getNodeId().getValue();
115 this.genericTransactionUtil = acessor.getTransactionUtils();
116 this.microwaveModelListener = serviceProvider.getNotificationService();
117 this.faultService = serviceProvider.getFaultService();
118 this.notificationService = serviceProvider.getWebsocketService();
119 this.notificationQueue = Optional.empty();
122 /*-----------------------------------------------------------------------------
126 @SuppressWarnings("unchecked")
128 public <T extends NotificationListener> T getNotificationListener() {
133 public void setNotificationQueue(NotificationWorker<EventlogEntity> notificationQueue) {
134 this.notificationQueue = Optional.of(notificationQueue);
137 /*-----------------------------------------------------------------------------
142 public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
143 FaultData resultList) {
147 readTheFaultsOfMwAirInterfacePac(uuid, resultList);
150 case ETHERNETCONTAINER12:
151 readTheFaultsOfMwEthernetContainerPac(uuid, resultList);
155 readTheFaultsOfMwTdmContainerPac(uuid, resultList);
159 if (lpClass == MwHybridMwStructurePac.class) {
160 readTheFaultsOfMwHybridMwStructurePac(uuid, resultList);
162 } else if (lpClass == MwAirInterfaceDiversityPac.class) {
163 readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList);
165 } else if (lpClass == MwPureEthernetStructurePac.class) {
166 readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList);
169 LOG.warn("Unassigned lp model {} class {}", lpName, lpClass);
173 // No alarms supported
175 case ETHERNETCONTAINER10:
177 LOG.warn("Unassigned or not expected lp in model {}", lpName);
182 public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName,
184 PerformanceDataLtp res = new PerformanceDataLtp();
187 readAirInterfacePerformanceData(lp, res);
190 case ETHERNETCONTAINER12:
191 readEthernetContainerPerformanceData(lp, res);
194 case ETHERNETCONTAINER10:
195 case ETHERNETPHYSICAL:
200 LOG.debug("Do not read HistoricalPM data for {} {}", lpName,
201 Helper.nnGetUniversalId(lp.getUuid()).getValue());
208 public Class<?> getClassForLtpExtension(QName qName) {
210 if (qName.equals(MwAirInterfacePac.QNAME)) {
211 res = MwAirInterfacePac.class;
212 } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
213 res = MwAirInterfaceDiversityPac.class;
214 } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
215 res = MwPureEthernetStructurePac.class;
216 } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
217 res = MwHybridMwStructurePac.class;
218 } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
219 res = MwEthernetContainerPac.class;
220 } else if (qName.equals(MwTdmContainerPac.QNAME)) {
221 res = MwTdmContainerPac.class;
223 LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
228 public void onObjectCreationNotification(ObjectCreationNotification notification) {
229 LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
230 if (notification != null) {
231 microwaveModelListener.creationNotification(acessor.getNodeId(), notification.getCounter(),
232 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
237 public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
238 LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
239 if (notification != null) {
240 microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(),
241 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
246 public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
247 LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
248 EventlogEntity beventlogEntity = new EventlogBuilder().setNodeId(acessor.getNodeId().getValue())
249 .setCounter(notification.getCounter()).setTimestamp(notification.getTimeStamp())
250 .setObjectId(Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue())
251 .setAttributeName(notification.getAttributeName()).setNewValue(notification.getNewValue()).build();
252 microwaveModelListener.eventNotification(beventlogEntity);
253 if (notificationQueue.isPresent()) {
254 notificationQueue.get().put(beventlogEntity);
259 public void onProblemNotification(ProblemNotification notification) {
261 LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
262 FaultlogEntity faultAlarm = new FaultlogBuilder().setObjectId(notification.getObjectIdRef().getValue())
263 .setProblem(notification.getProblem()).setSourceType(SourceType.Netconf)
264 .setTimestamp(notification.getTimeStamp())
265 .setNodeId(this.acessor.getNodeId().getValue())
266 .setSeverity(mapSeverity(notification.getSeverity())).setCounter(notification.getCounter())
268 faultService.faultNotification(faultAlarm);
269 notificationService.sendNotification(notification, acessor.getNodeId().getValue(), ProblemNotification.QNAME,
270 notification.getTimeStamp());
273 /*-----------------------------------------------------------------------------
274 * Reading problems for specific interface pacs
278 * Read problems of specific interfaces
280 * @param uuId Universal Id String of the interface
281 * @return number of alarms
283 private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, FaultData resultList) {
285 final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
287 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
288 mountpointId, interfacePacUuid.getValue());
290 // Step 2.2: construct data and the relative iid
291 InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID =
292 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
293 .child(AirInterfaceCurrentProblems.class).build();
295 // Step 2.3: read to the config data store
296 AirInterfaceCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
297 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
299 if (problems == null) {
300 LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
302 for (AirInterfaceCurrentProblemTypeG 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 readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
319 final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
321 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
322 mountpointId, interfacePacUuid.getValue());
324 InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
325 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
326 .child(EthernetContainerCurrentProblems.class).build();
328 EthernetContainerCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
329 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
330 if (problems == null) {
331 LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
333 for (ContainerCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
334 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
335 interfacePacUuid.getValue(), problem.getProblemName(),
336 mapSeverity(problem.getProblemSeverity()));
343 * Read problems of specific interfaces
345 * @param uuId Universal index of Interfacepac
346 * @return number of alarms
348 private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid, FaultData resultList) {
350 final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
351 final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
353 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
354 mountpointId, interfacePacUuid.getValue());
356 InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
357 .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
359 AirInterfaceDiversityCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
360 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
361 if (problems == null) {
362 LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
364 for (AirInterfaceDiversityCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
365 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
366 interfacePacUuid.getValue(), problem.getProblemName(),
367 mapSeverity(problem.getProblemSeverity()));
374 * Read problems of specific interfaces
376 * @param uuId Universal index of Interfacepac
377 * @return number of alarms
379 private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
381 final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
382 final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
384 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
385 mountpointId, interfacePacUuid.getValue());
387 InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
388 .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
390 PureEthernetStructureCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
391 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
392 if (problems == null) {
393 LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
395 for (StructureCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
396 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
397 interfacePacUuid.getValue(), problem.getProblemName(),
398 mapSeverity(problem.getProblemSeverity()));
405 * Read problems of specific interfaces
407 * @param uuId Universal index of Interfacepac
408 * @return number of alarms
410 private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
412 final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
413 final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
415 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
416 mountpointId, interfacePacUuid.getValue());
418 InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
419 .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
421 HybridMwStructureCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
422 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
423 if (problems == null) {
424 LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
426 for (StructureCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
427 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
428 interfacePacUuid.getValue(), problem.getProblemName(),
429 mapSeverity(problem.getProblemSeverity()));
436 * Read problems of specific interfaces. TODO Goal for future implementation without usage of explicit new. Key is
437 * generated by newInstance() function here to verify this approach.
439 * @param uuId Universal index of Interfacepac
440 * @return number of alarms
441 * @throws SecurityException
442 * @throws NoSuchMethodException
443 * @throws InvocationTargetException
444 * @throws IllegalArgumentException
445 * @throws IllegalAccessException
446 * @throws InstantiationException
448 private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
450 final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
451 final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
452 final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
454 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
455 mountpointId, interfacePacUuid.getValue());
458 // -- Specific part 1
459 Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
460 InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
461 .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
463 // -- Specific part 2
464 TdmContainerCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
465 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
466 if (problems == null) {
467 LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
469 // -- Specific part 3
470 for (ContainerCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
471 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
472 interfacePacUuid.getValue(), problem.getProblemName(),
473 mapSeverity(problem.getProblemSeverity()));
476 } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
477 | IllegalArgumentException | InvocationTargetException e) {
478 LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
484 * Read and add performance data
486 * @param lp to read from
487 * @param result Object to be filled with data
490 private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) {
492 LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid());
494 UniversalId mwAirInterfacePacuuId = lp.getUuid();
495 // Step 2.1: construct data and the relative iid
496 InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID =
497 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
498 .child(AirInterfaceConfiguration.class).build();
499 AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(),
500 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
502 if (airConfiguration == null) {
503 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
506 // Step 2.2: construct data and the relative iid
507 InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID =
508 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
509 .child(AirInterfaceHistoricalPerformances.class).build();
511 // Step 2.3: read to the config data store
512 AirInterfaceHistoricalPerformances airHistoricalPerformanceData = acessor.getTransactionUtils().readData(
513 acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
515 if (airHistoricalPerformanceData == null) {
516 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
517 mwAirInterfacePacuuId);
519 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
520 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
521 YangHelper.getCollection(airHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
522 LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
523 airHistPMList.size());
524 for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistPMList) {
525 result.add(new PerformanceDataAirInterface180907Builder(acessor.getNodeId(), lp, pmRecord,
530 LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, result.size());
534 private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) {
535 final String myName = "MWEthernetContainerPac";
537 LOG.debug("DBRead Get {} : {}", myName, lp.getUuid());
539 UniversalId ethContainerPacuuId = lp.getUuid();
540 // Step 2.2: construct data and the relative iid
541 InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
542 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
543 .child(EthernetContainerHistoricalPerformances.class).build();
545 // Step 2.3: read to the config data store
546 EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = acessor.getTransactionUtils()
547 .readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
549 if (ethContainerHistoricalPerformanceData == null) {
550 LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
552 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
553 YangHelper.getCollection(ethContainerHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
554 LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
555 for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
556 result.add(new PerformanceDataAirInterface180907Builder(acessor.getNodeId(), lp, pmRecord));
559 LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, result.size());
563 private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType mapSeverity(
564 SeverityType severity) {
566 Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType> res =
567 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType
568 .forName(severity.name());
570 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed);