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.NetconfBindingAccessor;
38 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
39 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
40 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
41 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
42 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.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.yangtools.yang.binding.InstanceIdentifier;
78 import org.opendaylight.yangtools.yang.binding.NotificationListener;
79 import org.opendaylight.yangtools.yang.common.QName;
80 import org.slf4j.Logger;
81 import org.slf4j.LoggerFactory;
84 public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, MicrowaveModelListener {
86 private static final Logger LOG = LoggerFactory.getLogger(WrapperMicrowaveModelRev180907.class);
88 public static final QName QNAME = MwAirInterfacePac.QNAME;
91 private final NotificationService microwaveModelListener;
92 private final NetconfBindingAccessor acessor;
93 private final TransactionUtils genericTransactionUtil;
94 private final String mountpointId;
95 private final @NonNull FaultService faultService;
97 private Optional<NotificationWorker<EventlogEntity>> notificationQueue;
101 * Handle specific version of microwave model
103 * @param acessor to access device
104 * @param serviceProvider for devicemanager services
106 public WrapperMicrowaveModelRev180907(@NonNull NetconfBindingAccessor acessor,
107 @NonNull DeviceManagerServiceProvider serviceProvider) {
108 this.acessor = acessor;
109 this.mountpointId = acessor.getNodeId().getValue();
110 this.genericTransactionUtil = acessor.getTransactionUtils();
111 this.microwaveModelListener = serviceProvider.getNotificationService();
112 this.faultService = serviceProvider.getFaultService();
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 /*-----------------------------------------------------------------------------
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();
181 readAirInterfacePerformanceData(lp, res);
184 case ETHERNETCONTAINER12:
185 readEthernetContainerPerformanceData(lp, res);
188 case ETHERNETCONTAINER10:
189 case ETHERNETPHYSICAL:
194 LOG.debug("Do not read HistoricalPM data for {} {}", lpName,
195 Helper.nnGetUniversalId(lp.getUuid()).getValue());
202 public Class<?> getClassForLtpExtension(QName qName) {
204 if (qName.equals(MwAirInterfacePac.QNAME)) {
205 res = MwAirInterfacePac.class;
206 } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
207 res = MwAirInterfaceDiversityPac.class;
208 } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
209 res = MwPureEthernetStructurePac.class;
210 } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
211 res = MwHybridMwStructurePac.class;
212 } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
213 res = MwEthernetContainerPac.class;
214 } else if (qName.equals(MwTdmContainerPac.QNAME)) {
215 res = MwTdmContainerPac.class;
217 LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
222 public void onObjectCreationNotification(ObjectCreationNotification notification) {
223 LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
224 if (notification != null) {
225 microwaveModelListener.creationNotification(acessor.getNodeId(), notification.getCounter(),
226 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
231 public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
232 LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
233 if (notification != null) {
234 microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(),
235 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
240 public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
241 LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
242 EventlogEntity beventlogEntity = new EventlogBuilder().setNodeId(acessor.getNodeId().getValue())
243 .setCounter(notification.getCounter()).setTimestamp(notification.getTimeStamp())
244 .setObjectId(Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue())
245 .setAttributeName(notification.getAttributeName()).setNewValue(notification.getNewValue()).build();
246 microwaveModelListener.eventNotification(beventlogEntity);
247 if (notificationQueue.isPresent()) {
248 notificationQueue.get().put(beventlogEntity);
253 public void onProblemNotification(ProblemNotification notification) {
255 LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
257 faultService.faultNotification(acessor.getNodeId(), notification.getCounter(), notification.getTimeStamp(),
258 Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue(), notification.getProblem(),
259 mapSeverity(notification.getSeverity()));
262 /*-----------------------------------------------------------------------------
263 * Reading problems for specific interface pacs
267 * Read problems of specific interfaces
269 * @param uuId Universal Id String of the interface
270 * @return number of alarms
272 private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, FaultData resultList) {
274 final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
276 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
277 mountpointId, interfacePacUuid.getValue());
279 // Step 2.2: construct data and the relative iid
280 InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID =
281 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
282 .child(AirInterfaceCurrentProblems.class).build();
284 // Step 2.3: read to the config data store
285 AirInterfaceCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
286 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
288 if (problems == null) {
289 LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
291 for (AirInterfaceCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
292 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
293 interfacePacUuid.getValue(), problem.getProblemName(),
294 mapSeverity(problem.getProblemSeverity()));
301 * Read problems of specific interfaces
303 * @param uuId Universal index of Interfacepac
304 * @return number of alarms
306 private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
308 final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
310 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
311 mountpointId, interfacePacUuid.getValue());
313 InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
314 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
315 .child(EthernetContainerCurrentProblems.class).build();
317 EthernetContainerCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
318 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
319 if (problems == null) {
320 LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
322 for (ContainerCurrentProblemTypeG problem : YangHelper.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 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
343 mountpointId, interfacePacUuid.getValue());
345 InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
346 .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
348 AirInterfaceDiversityCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
349 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
350 if (problems == null) {
351 LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
353 for (AirInterfaceDiversityCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
354 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
355 interfacePacUuid.getValue(), problem.getProblemName(),
356 mapSeverity(problem.getProblemSeverity()));
363 * Read problems of specific interfaces
365 * @param uuId Universal index of Interfacepac
366 * @return number of alarms
368 private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
370 final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
371 final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
373 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
374 mountpointId, interfacePacUuid.getValue());
376 InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
377 .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
379 PureEthernetStructureCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
380 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
381 if (problems == null) {
382 LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
384 for (StructureCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
385 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
386 interfacePacUuid.getValue(), problem.getProblemName(),
387 mapSeverity(problem.getProblemSeverity()));
394 * Read problems of specific interfaces
396 * @param uuId Universal index of Interfacepac
397 * @return number of alarms
399 private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
401 final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
402 final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
404 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
405 mountpointId, interfacePacUuid.getValue());
407 InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
408 .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
410 HybridMwStructureCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
411 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
412 if (problems == null) {
413 LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
415 for (StructureCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
416 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
417 interfacePacUuid.getValue(), problem.getProblemName(),
418 mapSeverity(problem.getProblemSeverity()));
425 * Read problems of specific interfaces. TODO Goal for future implementation without usage of explicit new. Key is
426 * generated by newInstance() function here to verify this approach.
428 * @param uuId Universal index of Interfacepac
429 * @return number of alarms
430 * @throws SecurityException
431 * @throws NoSuchMethodException
432 * @throws InvocationTargetException
433 * @throws IllegalArgumentException
434 * @throws IllegalAccessException
435 * @throws InstantiationException
437 private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
439 final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
440 final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
441 final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
443 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
444 mountpointId, interfacePacUuid.getValue());
447 // -- Specific part 1
448 Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
449 InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
450 .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
452 // -- Specific part 2
453 TdmContainerCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
454 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
455 if (problems == null) {
456 LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
458 // -- Specific part 3
459 for (ContainerCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
460 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
461 interfacePacUuid.getValue(), problem.getProblemName(),
462 mapSeverity(problem.getProblemSeverity()));
465 } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
466 | IllegalArgumentException | InvocationTargetException e) {
467 LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
473 * Read and add performance data
475 * @param lp to read from
476 * @param result Object to be filled with data
479 private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) {
481 LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid());
483 UniversalId mwAirInterfacePacuuId = lp.getUuid();
484 // Step 2.1: construct data and the relative iid
485 InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID =
486 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
487 .child(AirInterfaceConfiguration.class).build();
488 AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(),
489 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
491 if (airConfiguration == null) {
492 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
495 // Step 2.2: construct data and the relative iid
496 InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID =
497 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
498 .child(AirInterfaceHistoricalPerformances.class).build();
500 // Step 2.3: read to the config data store
501 AirInterfaceHistoricalPerformances airHistoricalPerformanceData = acessor.getTransactionUtils().readData(
502 acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
504 if (airHistoricalPerformanceData == null) {
505 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
506 mwAirInterfacePacuuId);
508 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
509 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
510 YangHelper.getCollection(airHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
511 LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
512 airHistPMList.size());
513 for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistPMList) {
514 result.add(new PerformanceDataAirInterface180907Builder(acessor.getNodeId(), lp, pmRecord,
519 LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, result.size());
523 private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) {
524 final String myName = "MWEthernetContainerPac";
526 LOG.debug("DBRead Get {} : {}", myName, lp.getUuid());
528 UniversalId ethContainerPacuuId = lp.getUuid();
529 // Step 2.2: construct data and the relative iid
530 InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
531 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
532 .child(EthernetContainerHistoricalPerformances.class).build();
534 // Step 2.3: read to the config data store
535 EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = acessor.getTransactionUtils()
536 .readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
538 if (ethContainerHistoricalPerformanceData == null) {
539 LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
541 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
542 YangHelper.getCollection(ethContainerHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
543 LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
544 for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
545 result.add(new PerformanceDataAirInterface180907Builder(acessor.getNodeId(), lp, pmRecord));
548 LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, result.size());
552 private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType mapSeverity(
553 SeverityType severity) {
555 Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType> res =
556 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType
557 .forName(severity.name());
559 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed);