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.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.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.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 WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, MicrowaveModelListener {
89 private static final Logger LOG = LoggerFactory.getLogger(WrapperMicrowaveModelRev170324.class);
91 public static final QName QNAME = MwAirInterfacePac.QNAME;
94 private final NotificationService microwaveModelListener;
95 private final NetconfBindingAccessor acessor;
96 private final TransactionUtils genericTransactionUtils;
97 private final FaultService faultService;
99 private Optional<NotificationWorker<EventlogEntity>> notificationQueue;
101 private final WebsocketManagerService notificationService;
104 * @param acessor to access device
106 public WrapperMicrowaveModelRev170324(@NonNull NetconfBindingAccessor acessor,
107 @NonNull DeviceManagerServiceProvider serviceProvider) {
108 this.acessor = acessor;
109 this.genericTransactionUtils = acessor.getTransactionUtils();
110 this.microwaveModelListener = serviceProvider.getNotificationService();
111 this.faultService = serviceProvider.getFaultService();
112 this.notificationService = serviceProvider.getWebsocketService();
113 this.notificationQueue = Optional.empty();
116 /*-----------------------------------------------------------------------------
120 @SuppressWarnings("unchecked")
122 public <T extends NotificationListener> T getNotificationListener() {
127 public void setNotificationQueue(NotificationWorker<EventlogEntity> notificationQueue) {
128 this.notificationQueue = Optional.of(notificationQueue);
131 /*-----------------------------------------------------------------------------
132 * Interface functions
136 public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
137 FaultData resultList) {
141 readTheFaultsOfMwAirInterfacePac(uuid, resultList);
144 case ETHERNETCONTAINER12:
145 readTheFaultsOfMwEthernetContainerPac(uuid, resultList);
149 readTheFaultsOfMwTdmContainerPac(uuid, resultList);
153 if (lpClass == MwHybridMwStructurePac.class) {
154 readTheFaultsOfMwHybridMwStructurePac(uuid, resultList);
156 } else if (lpClass == MwAirInterfaceDiversityPac.class) {
157 readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList);
159 } else if (lpClass == MwPureEthernetStructurePac.class) {
160 readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList);
163 LOG.warn("Unassigned lp model {} class {}", lpName, lpClass);
167 // No alarms supported
169 case ETHERNETCONTAINER10:
171 LOG.warn("Unassigned or not expected lp in model {}", lpName);
176 public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName,
178 PerformanceDataLtp res = new PerformanceDataLtp();
179 readAirInterfacePerformanceData(lp, res);
180 readEthernetContainerPerformanceData(lp, res);
186 public Class<?> getClassForLtpExtension(QName qName) {
188 if (qName.equals(MwAirInterfacePac.QNAME)) {
189 res = MwAirInterfacePac.class;
190 } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
191 res = MwAirInterfaceDiversityPac.class;
192 } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
193 res = MwPureEthernetStructurePac.class;
194 } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
195 res = MwHybridMwStructurePac.class;
196 } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
197 res = MwEthernetContainerPac.class;
198 } else if (qName.equals(MwTdmContainerPac.QNAME)) {
199 res = MwTdmContainerPac.class;
201 LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
206 public void onObjectCreationNotification(ObjectCreationNotification notification) {
207 LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
208 if (notification != null) {
209 microwaveModelListener.creationNotification(acessor.getNodeId(), notification.getCounter(),
210 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
211 notificationService.sendNotification(notification, acessor.getNodeId().getValue(),
212 ObjectCreationNotification.QNAME, notification.getTimeStamp());
217 public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
218 LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
219 if (notification != null) {
220 microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(),
221 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
222 notificationService.sendNotification(notification, acessor.getNodeId().getValue(),
223 ObjectDeletionNotification.QNAME, notification.getTimeStamp());
228 public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
229 LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
230 EventlogEntity beventlogEntity = new EventlogBuilder().setNodeId(acessor.getNodeId().getValue())
231 .setCounter(notification.getCounter()).setTimestamp(notification.getTimeStamp())
232 .setObjectId(Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue())
233 .setAttributeName(notification.getAttributeName()).setNewValue(notification.getNewValue()).build();
234 microwaveModelListener.eventNotification(beventlogEntity);
235 notificationService.sendNotification(notification, acessor.getNodeId().getValue(),
236 AttributeValueChangedNotification.QNAME, notification.getTimeStamp());
237 if (notificationQueue.isPresent()) {
238 notificationQueue.get().put(beventlogEntity);
243 public void onProblemNotification(ProblemNotification notification) {
245 LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
246 FaultlogEntity faultAlarm = new FaultlogBuilder().setObjectId(notification.getObjectIdRef().getValue())
247 .setProblem(notification.getProblem()).setSourceType(SourceType.Netconf)
248 .setTimestamp(notification.getTimeStamp())
249 .setNodeId(this.acessor.getNodeId().getValue())
250 .setSeverity(mapSeverity(notification.getSeverity())).setCounter(notification.getCounter())
252 faultService.faultNotification(faultAlarm);
253 notificationService.sendNotification(notification, acessor.getNodeId().getValue(), ProblemNotification.QNAME,
254 notification.getTimeStamp());
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 String mountpointId = acessor.getNodeId().getValue();
272 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
273 mountpointId, interfacePacUuid.getValue());
275 // Step 2.2: construct data and the relative iid
276 InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID =
277 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
278 .child(AirInterfaceCurrentProblems.class).build();
280 // Step 2.3: read to the config data store
281 AirInterfaceCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
282 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
284 if (problems == null) {
285 LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
287 for (AirInterfaceCurrentProblemTypeG problem : YangHelper
288 .getCollection(problems.nonnullCurrentProblemList())) {
289 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
290 interfacePacUuid.getValue(), problem.getProblemName(),
291 mapSeverity(problem.getProblemSeverity()));
299 * Read problems of specific interfaces
301 * @param uuId Universal index of Interfacepac
302 * @return number of alarms
304 private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
306 final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
308 String mountpointId = acessor.getNodeId().getValue();
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 = genericTransactionUtils.readData(acessor.getDataBroker(),
317 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
318 if (problems == null) {
319 LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
321 for (ContainerCurrentProblemTypeG problem : YangHelper
322 .getCollection(problems.nonnullCurrentProblemList())) {
323 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
324 interfacePacUuid.getValue(), problem.getProblemName(),
325 mapSeverity(problem.getProblemSeverity()));
332 * Read problems of specific interfaces
334 * @param uuId Universal index of Interfacepac
335 * @return number of alarms
337 private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid, FaultData resultList) {
339 final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
340 final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
342 String mountpointId = acessor.getNodeId().getValue();
343 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
344 mountpointId, interfacePacUuid.getValue());
346 InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
347 .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
349 AirInterfaceDiversityCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
350 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
351 if (problems == null) {
352 LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
354 for (AirInterfaceDiversityCurrentProblemTypeG problem : YangHelper
355 .getCollection(problems.nonnullCurrentProblemList())) {
356 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
357 interfacePacUuid.getValue(), problem.getProblemName(),
358 mapSeverity(problem.getProblemSeverity()));
365 * Read problems of specific interfaces
367 * @param uuId Universal index of Interfacepac
368 * @return number of alarms
370 private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
372 final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
373 final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
375 String mountpointId = acessor.getNodeId().getValue();
376 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
377 mountpointId, interfacePacUuid.getValue());
379 InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
380 .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
382 PureEthernetStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
383 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
384 if (problems == null) {
385 LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
387 for (StructureCurrentProblemTypeG problem : YangHelper
388 .getCollection(problems.nonnullCurrentProblemList())) {
389 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
390 interfacePacUuid.getValue(), problem.getProblemName(),
391 mapSeverity(problem.getProblemSeverity()));
398 * Read problems of specific interfaces
400 * @param uuId Universal index of Interfacepac
401 * @return number of alarms
403 private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
405 final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
406 final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
408 String mountpointId = acessor.getNodeId().getValue();
409 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
410 mountpointId, interfacePacUuid.getValue());
412 InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
413 .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
415 HybridMwStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
416 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
417 if (problems == null) {
418 LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
420 for (StructureCurrentProblemTypeG problem : YangHelper
421 .getCollection(problems.nonnullCurrentProblemList())) {
422 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
423 interfacePacUuid.getValue(), problem.getProblemName(),
424 mapSeverity(problem.getProblemSeverity()));
431 * Read problems of specific interfaces. TODO Goal for future implementation without usage of explicit new. Key is
432 * generated by newInstance() function here to verify this approach.
434 * @param uuId Universal index of Interfacepac
435 * @return number of alarms
436 * @throws SecurityException
437 * @throws NoSuchMethodException
438 * @throws InvocationTargetException
439 * @throws IllegalArgumentException
440 * @throws IllegalAccessException
441 * @throws InstantiationException
443 private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
445 final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
446 final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
447 final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
449 String mountpointId = acessor.getNodeId().getValue();
450 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
451 mountpointId, interfacePacUuid.getValue());
454 // -- Specific part 1
455 Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
456 InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
457 .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
459 // -- Specific part 2
460 TdmContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
461 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
462 if (problems == null) {
463 LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
465 // -- Specific part 3
466 for (ContainerCurrentProblemTypeG problem : YangHelper
467 .getCollection(problems.nonnullCurrentProblemList())) {
468 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
469 interfacePacUuid.getValue(), problem.getProblemName(),
470 mapSeverity(problem.getProblemSeverity()));
473 } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
474 | IllegalArgumentException | InvocationTargetException e) {
475 LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
481 * Read and add performance data
483 * @param lp to read from
484 * @param result Object to be filled with data
487 private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) {
489 LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid());
491 UniversalId mwAirInterfacePacuuId = lp.getUuid();
492 // Step 2.1: construct data and the relative iid
493 InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID =
494 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
495 .child(AirInterfaceConfiguration.class).build();
496 AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(),
497 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
499 if (airConfiguration == null) {
500 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
503 // Step 2.2: construct data and the relative iid
504 InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID =
505 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
506 .child(AirInterfaceHistoricalPerformances.class).build();
508 // Step 2.3: read to the config data store
509 AirInterfaceHistoricalPerformances airHistoricalPerformanceData = genericTransactionUtils.readData(
510 acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
512 if (airHistoricalPerformanceData == null) {
513 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
514 mwAirInterfacePacuuId);
516 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
517 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
518 YangHelper.getCollection(airHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
519 LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
520 airHistPMList.size());
521 for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistPMList) {
522 result.add(new PerformanceDataAirInterface170324Builder(acessor.getNodeId(), lp, pmRecord,
527 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 String mountpointId = acessor.getNodeId().getValue();
537 LOG.debug("DBRead Get {} : {}", mountpointId, 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.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
553 YangHelper.getCollection(
554 ethContainerHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
555 LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
556 for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
557 result.add(new PerformanceDataAirInterface170324Builder(acessor.getNodeId(), lp, pmRecord));
560 LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, result.size());
564 private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType mapSeverity(
565 SeverityType severity) {
567 Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType> res =
568 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType
569 .forName(severity.name());
571 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed);