1 /*******************************************************************************
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==========================================================================
17 ******************************************************************************/
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.List;
25 import java.util.Optional;
26 import org.eclipse.jdt.annotation.NonNull;
27 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.pm.PerformanceDataAirInterface180907Builder;
28 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.notifications.NotificationWorker;
29 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.util.ONFLayerProtocolName;
30 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
31 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
32 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService;
33 import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData;
34 import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp;
35 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
36 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
37 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
38 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
39 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
40 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.SeverityType;
41 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AirInterfaceCurrentProblemTypeG;
42 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AirInterfaceDiversityCurrentProblemTypeG;
43 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AirInterfaceHistoricalPerformanceTypeG;
44 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AttributeValueChangedNotification;
45 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ContainerCurrentProblemTypeG;
46 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ContainerHistoricalPerformanceTypeG;
47 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MicrowaveModelListener;
48 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfaceDiversityPac;
49 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfaceDiversityPacKey;
50 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfacePac;
51 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfacePacKey;
52 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwEthernetContainerPac;
53 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwEthernetContainerPacKey;
54 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwHybridMwStructurePac;
55 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwHybridMwStructurePacKey;
56 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwPureEthernetStructurePac;
57 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwPureEthernetStructurePacKey;
58 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwTdmContainerPac;
59 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwTdmContainerPacKey;
60 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ObjectCreationNotification;
61 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ObjectDeletionNotification;
62 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ProblemNotification;
63 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.StructureCurrentProblemTypeG;
64 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
65 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceConfiguration;
66 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceCurrentProblems;
67 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
68 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
69 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
70 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
71 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
72 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.tdm.container.pac.TdmContainerCurrentProblems;
73 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.EventlogBuilder;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.EventlogEntity;
75 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
76 import org.opendaylight.yangtools.yang.binding.NotificationListener;
77 import org.opendaylight.yangtools.yang.common.QName;
78 import org.slf4j.Logger;
79 import org.slf4j.LoggerFactory;
82 public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, MicrowaveModelListener {
84 private static final Logger LOG = LoggerFactory.getLogger(WrapperMicrowaveModelRev180907.class);
86 public static final QName QNAME = MwAirInterfacePac.QNAME;
89 private final NotificationService microwaveModelListener;
90 private final NetconfAccessor acessor;
91 private final TransactionUtils genericTransactionUtil;
92 private final String mountpointId;
93 private final @NonNull FaultService faultService;
95 private Optional<NotificationWorker<EventlogEntity>> notificationQueue;
99 * Handle specific version of microwave model
100 * @param acessor to access device
101 * @param serviceProvider for devicemanager services
103 public WrapperMicrowaveModelRev180907(@NonNull NetconfAccessor acessor, @NonNull DeviceManagerServiceProvider serviceProvider) {
104 this.acessor = acessor;
105 this.mountpointId = acessor.getNodeId().getValue();
106 this.genericTransactionUtil = acessor.getTransactionUtils();
107 this.microwaveModelListener = serviceProvider.getNotificationService();
108 this.faultService = serviceProvider.getFaultService();
109 this.notificationQueue = Optional.empty();
112 /*-----------------------------------------------------------------------------
116 @SuppressWarnings("unchecked")
118 public <T extends NotificationListener> T getNotificationListener() {
123 public void setNotificationQueue(NotificationWorker<EventlogEntity> notificationQueue) {
124 this.notificationQueue = Optional.of(notificationQueue);
127 /*-----------------------------------------------------------------------------
132 public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
133 FaultData resultList) {
137 readTheFaultsOfMwAirInterfacePac(uuid, resultList);
140 case EthernetContainer12:
141 readTheFaultsOfMwEthernetContainerPac(uuid, resultList);
145 readTheFaultsOfMwTdmContainerPac(uuid, resultList);
149 if (lpClass == MwHybridMwStructurePac.class) {
150 readTheFaultsOfMwHybridMwStructurePac(uuid, resultList);
152 } else if (lpClass == MwAirInterfaceDiversityPac.class) {
153 readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList);
155 } else if (lpClass == MwPureEthernetStructurePac.class) {
156 readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList);
159 LOG.warn("Unassigned lp model {} class {}", lpName, lpClass);
163 // No alarms supported
165 case EthernetContainer10:
167 LOG.warn("Unassigned or not expected lp in model {}", lpName);
172 public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, @NonNull Lp lp) {
173 PerformanceDataLtp res = new PerformanceDataLtp();
176 res = readAirInterfacePerformanceData(lp, res);
179 case EthernetContainer12:
180 res = readEthernetContainerPerformanceData(lp, res);
183 case EthernetContainer10:
184 case EthernetPhysical:
189 LOG.debug("Do not read HistoricalPM data for {} {}", lpName, Helper.nnGetUniversalId(lp.getUuid()).getValue());
196 // public @NonNull List<? extends OtnHistoryDataG> readTheHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, @NonNull Lp lp) {
198 // case MWAirInterface:
199 // return readTheHistoricalPerformanceDataOfMwAirInterfacePac(lp);
201 // case EthernetContainer12:
202 // return readTheHistoricalPerformanceDataOfEthernetContainer(lp);
204 // case EthernetContainer10:
205 // case EthernetPhysical:
207 // case TDMContainer:
210 // LOG.debug("Do not read HistoricalPM data for {} {}", lpName, Helper.nnGetUniversalId(lp.getUuid()).getValue());
213 // return new ArrayList<>();
217 public Class<?> getClassForLtpExtension(QName qName) {
219 if (qName.equals(MwAirInterfacePac.QNAME)) {
220 res = MwAirInterfacePac.class;
221 } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
222 res = MwAirInterfaceDiversityPac.class;
223 } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
224 res = MwPureEthernetStructurePac.class;
225 } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
226 res = MwHybridMwStructurePac.class;
227 } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
228 res = MwEthernetContainerPac.class;
229 } else if (qName.equals(MwTdmContainerPac.QNAME)) {
230 res = MwTdmContainerPac.class;
232 LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
237 public void onObjectCreationNotification(ObjectCreationNotification notification) {
238 LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
239 if (notification != null) {
240 microwaveModelListener.creationNotification(acessor.getNodeId(), notification.getCounter(),
241 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
246 public void onObjectDeletionNotification( ObjectDeletionNotification notification) {
247 LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
248 if (notification != null) {
249 microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(),
250 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
255 public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
256 LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
257 EventlogEntity beventlogEntity = new EventlogBuilder().setNodeId(acessor.getNodeId().getValue())
258 .setCounter(notification.getCounter()).setTimestamp(notification.getTimeStamp())
259 .setObjectId(Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue())
260 .setAttributeName(notification.getAttributeName()).setNewValue(notification.getNewValue()).build();
261 microwaveModelListener.eventNotification(beventlogEntity);
262 if (notificationQueue.isPresent()) {
263 notificationQueue.get().put(beventlogEntity);
268 public void onProblemNotification(ProblemNotification notification) {
270 LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
272 faultService.faultNotification(acessor.getNodeId(), notification.getCounter(),
273 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue(),
274 notification.getProblem(), mapSeverity(notification.getSeverity()));
277 /*-----------------------------------------------------------------------------
278 * Reading problems for specific interface pacs
282 * Read problems of specific interfaces
284 * @param uuId Universal Id String of the interface
285 * @return number of alarms
287 private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid,
288 FaultData resultList) {
290 final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
291 // final Class<MwAirInterfacePacKey> clazzPacKey = MwAirInterfacePacKey.class;
292 // final Class<AirInterfaceCurrentProblems> clazzProblems =
293 // AirInterfaceCurrentProblems.class;
294 // final Class<AirInterfaceCurrentProblemTypeG> clazzProblem =
295 // AirInterfaceCurrentProblemTypeG.class;
297 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
298 mountpointId, interfacePacUuid.getValue());
300 // Step 2.2: construct data and the relative iid
301 InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID = InstanceIdentifier
302 .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
303 .child(AirInterfaceCurrentProblems.class).build();
305 // Step 2.3: read to the config data store
306 AirInterfaceCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
307 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
309 if (problems == null) {
310 LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
312 for (AirInterfaceCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
313 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
314 interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
321 * Read problems of specific interfaces
323 * @param uuId Universal index of Interfacepac
324 * @return number of alarms
326 private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid,
327 FaultData resultList) {
329 final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
330 // final Class<MwEthernetContainerPacKey> clazzPacKey =
331 // MwEthernetContainerPacKey.class;
332 // final Class<EthernetContainerCurrentProblems> clazzProblems =
333 // EthernetContainerCurrentProblems.class;
334 // final Class<ContainerCurrentProblemTypeG> clazzProblem =
335 // ContainerCurrentProblemTypeG.class;
337 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
338 mountpointId, interfacePacUuid.getValue());
340 InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
341 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
342 .child(EthernetContainerCurrentProblems.class).build();
344 EthernetContainerCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
345 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
346 if (problems == null) {
347 LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
349 for (ContainerCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
350 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
351 interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
358 * Read problems of specific interfaces
360 * @param uuId Universal index of Interfacepac
361 * @return number of alarms
363 private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid,
364 FaultData resultList) {
366 final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
367 // final Class<MwAirInterfaceDiversityPacKey> clazzPacKey =
368 // MwAirInterfaceDiversityPacKey.class;
369 final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
370 // final Class<AirInterfaceDiversityCurrentProblemTypeG> clazzProblem =
371 // AirInterfaceDiversityCurrentProblemTypeG.class;
373 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
374 mountpointId, interfacePacUuid.getValue());
376 InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
377 .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
379 AirInterfaceDiversityCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
380 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
381 if (problems == null) {
382 LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
384 for (AirInterfaceDiversityCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
385 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
386 interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
393 * Read problems of specific interfaces
395 * @param uuId Universal index of Interfacepac
396 * @return number of alarms
398 private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid,
399 FaultData resultList) {
401 final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
402 // final Class<MwPureEthernetStructurePacKey> clazzPacKey =
403 // MwPureEthernetStructurePacKey.class;
404 final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
405 // final Class<StructureCurrentProblemTypeG> clazzProblem =
406 // StructureCurrentProblemTypeG.class;
408 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
409 mountpointId, interfacePacUuid.getValue());
411 InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
412 .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
414 PureEthernetStructureCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
415 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
416 if (problems == null) {
417 LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
419 for (StructureCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
420 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
421 interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
428 * Read problems of specific interfaces
430 * @param uuId Universal index of Interfacepac
431 * @return number of alarms
433 private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid,
434 FaultData resultList) {
436 final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
437 // final Class<MwHybridMwStructurePacKey> clazzPacKey =
438 // MwHybridMwStructurePacKey.class;
439 final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
440 // final Class<HybridMwStructureCurrentProblemsG> clazzProblem =
441 // HybridMwStructureCurrentProblemsG.class;
443 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
444 mountpointId, interfacePacUuid.getValue());
446 InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
447 .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
449 HybridMwStructureCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
450 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
451 if (problems == null) {
452 LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
454 for (StructureCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
455 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
456 interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
463 * Read problems of specific interfaces. TODO Goal for future implementation
464 * without usage of explicit new. Key is generated by newInstance() function
465 * here to verify this approach.
467 * @param uuId Universal index of Interfacepac
468 * @return number of alarms
469 * @throws SecurityException
470 * @throws NoSuchMethodException
471 * @throws InvocationTargetException
472 * @throws IllegalArgumentException
473 * @throws IllegalAccessException
474 * @throws InstantiationException
476 private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid,
477 FaultData resultList) {
479 final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
480 final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
481 final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
482 // final Class<ContainerCurrentProblemTypeG> clazzProblem =
483 // ContainerCurrentProblemTypeG.class;
485 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
486 mountpointId, interfacePacUuid.getValue());
489 // -- Specific part 1
490 Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
491 InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
492 .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
494 // -- Specific part 2
495 TdmContainerCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
496 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
497 if (problems == null) {
498 LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
500 // -- Specific part 3
501 for (ContainerCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
502 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
503 interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
506 } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
507 | IllegalArgumentException | InvocationTargetException e) {
508 LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
513 /*-----------------------------------------------------------------------------
514 * Performance related data
518 // * PM MwAirInterfacePac
523 // private @NonNull List<ExtendedAirInterfaceHistoricalPerformanceType1211> readTheHistoricalPerformanceDataOfMwAirInterfacePac(
526 // String uuId = Helper.nnGetUniversalId(lp.getUuid()).getValue();
528 // List<ExtendedAirInterfaceHistoricalPerformanceType1211> resultList = new ArrayList<>();
529 // LOG.debug("DBRead Get {} MWAirInterfacePac: {}", coreData.getMountpoint(), uuId);
531 // UniversalId mwAirInterfacePacuuId = new UniversalId(uuId);
532 // // Step 2.1: construct data and the relative iid
533 // InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = InstanceIdentifier
534 // .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
535 // .child(AirInterfaceConfiguration.class).build();
536 // AirInterfaceConfiguration airConfiguration = genericTransactionUtil.readData(coreData.getDataBroker(),
537 // LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
539 // if (airConfiguration == null) {
540 // LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
543 // // Step 2.2: construct data and the relative iid
544 // InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = InstanceIdentifier
545 // .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
546 // .child(AirInterfaceHistoricalPerformances.class).build();
548 // // Step 2.3: read to the config data store
549 // AirInterfaceHistoricalPerformances airHistoricalPerformanceData = genericTransactionUtil.readData(
550 // coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
552 // if (airHistoricalPerformanceData == null) {
553 // LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
554 // mwAirInterfacePacuuId);
556 // List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = airHistoricalPerformanceData
557 // .nonnullHistoricalPerformanceDataList();
558 // LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
559 // airHistPMList.size());
560 // for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistPMList) {
561 // resultList.add(new ExtendedAirInterfaceHistoricalPerformanceType1211(pmRecord, airConfiguration));
565 // LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, resultList.size());
566 // return resultList;
569 // private @NonNull List<ContainerHistoricalPerformanceTypeG> readTheHistoricalPerformanceDataOfEthernetContainer(Lp lp) {
571 // final String myName = "MWEthernetContainerPac";
572 // String uuId = Helper.nnGetUniversalId(lp.getUuid()).getValue();
574 // List<ContainerHistoricalPerformanceTypeG> resultList = new ArrayList<>();
575 // LOG.debug("DBRead Get {} : {}", coreData.getMountpoint(), myName, uuId);
577 // UniversalId ethContainerPacuuId = new UniversalId(uuId);
578 // // Step 2.2: construct data and the relative iid
579 // InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
580 // .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
581 // .child(EthernetContainerHistoricalPerformances.class).build();
583 // // Step 2.3: read to the config data store
584 // EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = genericTransactionUtil
585 // .readData(coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
587 // if (ethContainerHistoricalPerformanceData == null) {
588 // LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
591 // // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.ethernet.container.historical.performances.g.HistoricalPerformanceDataList
592 // List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = ethContainerHistoricalPerformanceData
593 // .nonnullHistoricalPerformanceDataList();
594 // LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
595 // for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
596 // resultList.add(pmRecord);
599 // LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, resultList.size());
600 // return resultList;
604 * Read and add performance data
605 * @param lp to read from
606 * @param result Object to be filled with data
609 private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) {
611 LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid());
613 UniversalId mwAirInterfacePacuuId = lp.getUuid();
614 // Step 2.1: construct data and the relative iid
615 InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = InstanceIdentifier
616 .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
617 .child(AirInterfaceConfiguration.class).build();
618 AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(),
619 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
621 if (airConfiguration == null) {
622 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
625 // Step 2.2: construct data and the relative iid
626 InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = InstanceIdentifier
627 .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
628 .child(AirInterfaceHistoricalPerformances.class).build();
630 // Step 2.3: read to the config data store
631 AirInterfaceHistoricalPerformances airHistoricalPerformanceData = acessor.getTransactionUtils().readData(
632 acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
634 if (airHistoricalPerformanceData == null) {
635 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
636 mwAirInterfacePacuuId);
638 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
639 List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = airHistoricalPerformanceData
640 .nonnullHistoricalPerformanceDataList();
641 LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
642 airHistPMList.size());
643 for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistoricalPerformanceData
644 .nonnullHistoricalPerformanceDataList()) {
645 result.add(new PerformanceDataAirInterface180907Builder(acessor.getNodeId(), lp, pmRecord, airConfiguration));
649 LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, result.size());
653 private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) {
654 final String myName = "MWEthernetContainerPac";
656 LOG.debug("DBRead Get {} : {}", myName, lp.getUuid());
658 UniversalId ethContainerPacuuId = lp.getUuid();
659 // Step 2.2: construct data and the relative iid
660 InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
661 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
662 .child(EthernetContainerHistoricalPerformances.class).build();
664 // Step 2.3: read to the config data store
665 EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = acessor.getTransactionUtils()
666 .readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
668 if (ethContainerHistoricalPerformanceData == null) {
669 LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
671 List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = ethContainerHistoricalPerformanceData
672 .nonnullHistoricalPerformanceDataList();
673 LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
674 for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
675 result.add(new PerformanceDataAirInterface180907Builder(acessor.getNodeId(), lp, pmRecord));
678 LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, result.size());
682 private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType mapSeverity( SeverityType severity) {
684 Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType> res =
685 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType.forName(severity.name());
686 return res.orElse(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType.NonAlarmed);