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.PerformanceDataAirInterface170324Builder;
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.rev170324.AirInterfaceCurrentProblemTypeG;
41 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceDiversityCurrentProblemTypeG;
42 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceHistoricalPerformanceTypeG;
43 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AttributeValueChangedNotification;
44 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ContainerCurrentProblemTypeG;
45 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ContainerHistoricalPerformanceTypeG;
46 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MicrowaveModelListener;
47 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfaceDiversityPac;
48 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfaceDiversityPacKey;
49 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfacePac;
50 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfacePacKey;
51 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwEthernetContainerPac;
52 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwEthernetContainerPacKey;
53 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwHybridMwStructurePac;
54 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwHybridMwStructurePacKey;
55 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwPureEthernetStructurePac;
56 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwPureEthernetStructurePacKey;
57 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwTdmContainerPac;
58 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwTdmContainerPacKey;
59 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ObjectCreationNotification;
60 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ObjectDeletionNotification;
61 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ProblemNotification;
62 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.SeverityType;
63 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.StructureCurrentProblemTypeG;
64 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
65 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceConfiguration;
66 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceCurrentProblems;
67 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
68 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
69 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
70 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
71 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
72 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.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 WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, MicrowaveModelListener {
84 private static final Logger LOG = LoggerFactory.getLogger(WrapperMicrowaveModelRev170324.class);
86 public static final QName QNAME = MwAirInterfacePac.QNAME;
89 //private NetworkElementCoreData coreData;
90 private final NotificationService microwaveModelListener;
91 private final NetconfAccessor acessor;
92 private final TransactionUtils genericTransactionUtils;
93 private final FaultService faultService;
95 private Optional<NotificationWorker<EventlogEntity>> notificationQueue;
98 * @param acessor to access device
100 public WrapperMicrowaveModelRev170324(@NonNull NetconfAccessor acessor, @NonNull DeviceManagerServiceProvider serviceProvider) {
101 this.acessor = acessor;
102 this.genericTransactionUtils = acessor.getTransactionUtils();
103 this.microwaveModelListener = serviceProvider.getNotificationService();
104 this.faultService = serviceProvider.getFaultService();
105 this.notificationQueue = Optional.empty();
108 /*-----------------------------------------------------------------------------
112 @SuppressWarnings("unchecked")
114 public <T extends NotificationListener> T getNotificationListener() {
119 public void setNotificationQueue(NotificationWorker<EventlogEntity> notificationQueue) {
120 this.notificationQueue = Optional.of(notificationQueue);
123 /*-----------------------------------------------------------------------------
124 * Interface functions
128 public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
129 FaultData resultList) {
133 readTheFaultsOfMwAirInterfacePac(uuid, resultList);
136 case EthernetContainer12:
137 readTheFaultsOfMwEthernetContainerPac(uuid, resultList);
141 readTheFaultsOfMwTdmContainerPac(uuid, resultList);
145 if (lpClass == MwHybridMwStructurePac.class) {
146 readTheFaultsOfMwHybridMwStructurePac(uuid, resultList);
148 } else if (lpClass == MwAirInterfaceDiversityPac.class) {
149 readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList);
151 } else if (lpClass == MwPureEthernetStructurePac.class) {
152 readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList);
155 LOG.warn("Unassigned lp model {} class {}", lpName, lpClass);
159 // No alarms supported
161 case EthernetContainer10:
163 LOG.warn("Unassigned or not expected lp in model {}", lpName);
168 public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, @NonNull Lp lp) {
169 PerformanceDataLtp res = new PerformanceDataLtp();
170 res = readAirInterfacePerformanceData(lp, res);
171 res = readEthernetContainerPerformanceData(lp, res);
176 // public @NonNull List<? extends OtnHistoryDataG> readTheHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, @NonNull Lp lp) {
178 // case MWAirInterface:
179 // return readTheHistoricalPerformanceDataOfMwAirInterfacePac(lp);
181 // case EthernetContainer12:
182 // return readTheHistoricalPerformanceDataOfEthernetContainer(lp);
184 // case EthernetContainer10:
185 // case EthernetPhysical:
187 // case TDMContainer:
190 // LOG.debug("Do not read HistoricalPM data for {} {}", lpName, getUuid(lp));
193 // return new ArrayList<>();
196 public Class<?> getClassForLtpExtension(QName qName) {
198 if (qName.equals(MwAirInterfacePac.QNAME)) {
199 res = MwAirInterfacePac.class;
200 } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
201 res = MwAirInterfaceDiversityPac.class;
202 } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
203 res = MwPureEthernetStructurePac.class;
204 } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
205 res = MwHybridMwStructurePac.class;
206 } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
207 res = MwEthernetContainerPac.class;
208 } else if (qName.equals(MwTdmContainerPac.QNAME)) {
209 res = MwTdmContainerPac.class;
211 LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
216 public void onObjectCreationNotification(ObjectCreationNotification notification) {
217 LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
218 if (notification != null) {
219 microwaveModelListener.creationNotification(acessor.getNodeId(), notification.getCounter(),
220 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
225 public void onObjectDeletionNotification( ObjectDeletionNotification notification) {
226 LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
227 if (notification != null) {
228 microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(),
229 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
234 public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
235 LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
236 EventlogEntity beventlogEntity = new EventlogBuilder().setNodeId(acessor.getNodeId().getValue())
237 .setCounter(notification.getCounter()).setTimestamp(notification.getTimeStamp())
238 .setObjectId(Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue())
239 .setAttributeName(notification.getAttributeName()).setNewValue(notification.getNewValue()).build();
240 microwaveModelListener.eventNotification(beventlogEntity);
241 if (notificationQueue.isPresent()) {
242 notificationQueue.get().put(beventlogEntity);
247 public void onProblemNotification(ProblemNotification notification) {
249 LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
251 faultService.faultNotification(acessor.getNodeId(), notification.getCounter(),
252 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue(),
253 notification.getProblem(), mapSeverity(notification.getSeverity()));
256 /*-----------------------------------------------------------------------------
257 * Reading problems for specific interface pacs
261 * Read problems of specific interfaces
263 * @param uuId Universal Id String of the interface
264 * @return number of alarms
266 private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, FaultData resultList) {
268 final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
269 // final Class<MwAirInterfacePacKey> clazzPacKey = MwAirInterfacePacKey.class;
270 // final Class<AirInterfaceCurrentProblems> clazzProblems =
271 // AirInterfaceCurrentProblems.class;
272 // final Class<AirInterfaceCurrentProblemTypeG> clazzProblem =
273 // AirInterfaceCurrentProblemTypeG.class;
275 String mountpointId = acessor.getNodeId().getValue();
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 = InstanceIdentifier
281 .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
282 .child(AirInterfaceCurrentProblems.class).build();
284 // Step 2.3: read to the config data store
285 AirInterfaceCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
286 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
288 if (problems == null) {
289 LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
291 for (AirInterfaceCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
292 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
293 interfacePacUuid.getValue(), problem.getProblemName(), 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;
309 // final Class<MwEthernetContainerPacKey> clazzPacKey =
310 // MwEthernetContainerPacKey.class;
311 // final Class<EthernetContainerCurrentProblems> clazzProblems =
312 // EthernetContainerCurrentProblems.class;
313 // final Class<ContainerCurrentProblemTypeG> clazzProblem =
314 // ContainerCurrentProblemTypeG.class;
316 String mountpointId = acessor.getNodeId().getValue();
317 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
318 mountpointId, interfacePacUuid.getValue());
320 InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
321 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
322 .child(EthernetContainerCurrentProblems.class).build();
324 EthernetContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
325 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
326 if (problems == null) {
327 LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
329 for (ContainerCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
330 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
331 interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
338 * Read problems of specific interfaces
340 * @param uuId Universal index of Interfacepac
341 * @return number of alarms
343 private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid,
344 FaultData resultList) {
346 final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
347 // final Class<MwAirInterfaceDiversityPacKey> clazzPacKey =
348 // MwAirInterfaceDiversityPacKey.class;
349 final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
350 // final Class<AirInterfaceDiversityCurrentProblemTypeG> clazzProblem =
351 // AirInterfaceDiversityCurrentProblemTypeG.class;
353 String mountpointId = acessor.getNodeId().getValue();
354 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
355 mountpointId, interfacePacUuid.getValue());
357 InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
358 .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
360 AirInterfaceDiversityCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
361 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
362 if (problems == null) {
363 LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
365 for (AirInterfaceDiversityCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
366 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
367 interfacePacUuid.getValue(), problem.getProblemName(), 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,
380 FaultData resultList) {
382 final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
383 // final Class<MwPureEthernetStructurePacKey> clazzPacKey =
384 // MwPureEthernetStructurePacKey.class;
385 final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
386 // final Class<StructureCurrentProblemTypeG> clazzProblem =
387 // StructureCurrentProblemTypeG.class;
389 String mountpointId = acessor.getNodeId().getValue();
390 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
391 mountpointId, interfacePacUuid.getValue());
393 InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
394 .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
396 PureEthernetStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
397 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
398 if (problems == null) {
399 LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
401 for (StructureCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
402 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
403 interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
410 * Read problems of specific interfaces
412 * @param uuId Universal index of Interfacepac
413 * @return number of alarms
415 private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
417 final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
418 // final Class<MwHybridMwStructurePacKey> clazzPacKey =
419 // MwHybridMwStructurePacKey.class;
420 final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
421 // final Class<HybridMwStructureCurrentProblemsG> clazzProblem =
422 // HybridMwStructureCurrentProblemsG.class;
424 String mountpointId = acessor.getNodeId().getValue();
425 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
426 mountpointId, interfacePacUuid.getValue());
428 InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
429 .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
431 HybridMwStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
432 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
433 if (problems == null) {
434 LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
436 for (StructureCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
437 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
438 interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
445 * Read problems of specific interfaces. TODO Goal for future implementation
446 * without usage of explicit new. Key is generated by newInstance() function
447 * here to verify this approach.
449 * @param uuId Universal index of Interfacepac
450 * @return number of alarms
451 * @throws SecurityException
452 * @throws NoSuchMethodException
453 * @throws InvocationTargetException
454 * @throws IllegalArgumentException
455 * @throws IllegalAccessException
456 * @throws InstantiationException
458 private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
460 final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
461 final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
462 final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
463 // final Class<ContainerCurrentProblemTypeG> clazzProblem =
464 // ContainerCurrentProblemTypeG.class;
466 String mountpointId = acessor.getNodeId().getValue();
467 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
468 mountpointId, interfacePacUuid.getValue());
471 // -- Specific part 1
472 Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
473 InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
474 .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
476 // -- Specific part 2
477 TdmContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
478 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
479 if (problems == null) {
480 LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
482 // -- Specific part 3
483 for (ContainerCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
484 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
485 interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
488 } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
489 | IllegalArgumentException | InvocationTargetException e) {
490 LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
495 /*-----------------------------------------------------------------------------
496 * Performance related data
500 // * PM MwAirInterfacePac
505 // private @NonNull List<ExtendedAirInterfaceHistoricalPerformanceType12> readTheHistoricalPerformanceDataOfMwAirInterfacePac(
508 // List<ExtendedAirInterfaceHistoricalPerformanceType12> resultList = new ArrayList<>();
509 // LOG.debug("DBRead Get {} MWAirInterfacePac: {}", coreData.getMountpoint(), lp.getUuid());
511 // UniversalId mwAirInterfacePacuuId = lp.getUuid();
512 // // Step 2.1: construct data and the relative iid
513 // InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = InstanceIdentifier
514 // .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
515 // .child(AirInterfaceConfiguration.class).build();
516 // AirInterfaceConfiguration airConfiguration = genericTransactionUtils.readData(coreData.getDataBroker(),
517 // LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
519 // if (airConfiguration == null) {
520 // LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
523 // // Step 2.2: construct data and the relative iid
524 // InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = InstanceIdentifier
525 // .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
526 // .child(AirInterfaceHistoricalPerformances.class).build();
528 // // Step 2.3: read to the config data store
529 // AirInterfaceHistoricalPerformances airHistoricalPerformanceData = genericTransactionUtils.readData(
530 // coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
532 // if (airHistoricalPerformanceData == null) {
533 // LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
534 // mwAirInterfacePacuuId);
536 // // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
537 // List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = airHistoricalPerformanceData
538 // .nonnullHistoricalPerformanceDataList();
539 // LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
540 // airHistPMList.size());
541 // for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistoricalPerformanceData
542 // .nonnullHistoricalPerformanceDataList()) {
543 // resultList.add(new ExtendedAirInterfaceHistoricalPerformanceType12(pmRecord, airConfiguration));
547 // LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, resultList.size());
548 // return resultList;
552 * Read and add performance data
553 * @param lp to read from
554 * @param result Object to be filled with data
557 private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) {
559 LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid());
561 UniversalId mwAirInterfacePacuuId = lp.getUuid();
562 // Step 2.1: construct data and the relative iid
563 InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = InstanceIdentifier
564 .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
565 .child(AirInterfaceConfiguration.class).build();
566 AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(),
567 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
569 if (airConfiguration == null) {
570 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
573 // Step 2.2: construct data and the relative iid
574 InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = InstanceIdentifier
575 .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
576 .child(AirInterfaceHistoricalPerformances.class).build();
578 // Step 2.3: read to the config data store
579 AirInterfaceHistoricalPerformances airHistoricalPerformanceData = genericTransactionUtils.readData(
580 acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
582 if (airHistoricalPerformanceData == null) {
583 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
584 mwAirInterfacePacuuId);
586 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
587 List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = airHistoricalPerformanceData
588 .nonnullHistoricalPerformanceDataList();
589 LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
590 airHistPMList.size());
591 for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistoricalPerformanceData
592 .nonnullHistoricalPerformanceDataList()) {
593 result.add(new PerformanceDataAirInterface170324Builder(acessor.getNodeId(), lp, pmRecord, airConfiguration));
597 LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, result.size());
601 // private @NonNull List<ContainerHistoricalPerformanceTypeG> readTheHistoricalPerformanceDataOfEthernetContainer(Lp lp) {
603 // final String myName = "MWEthernetContainerPac";
605 // List<ContainerHistoricalPerformanceTypeG> resultList = new ArrayList<>();
606 // LOG.debug("DBRead Get {} : {}", coreData.getMountpoint(), myName, lp.getUuid());
608 // UniversalId ethContainerPacuuId = lp.getUuid();
609 // // Step 2.2: construct data and the relative iid
610 // InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
611 // .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
612 // .child(EthernetContainerHistoricalPerformances.class).build();
614 // // Step 2.3: read to the config data store
615 // EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = genericTransactionUtils
616 // .readData(coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
618 // if (ethContainerHistoricalPerformanceData == null) {
619 // LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
622 // // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.ethernet.container.historical.performances.g.HistoricalPerformanceDataList
623 // // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataList
624 // List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = ethContainerHistoricalPerformanceData
625 // .nonnullHistoricalPerformanceDataList();
626 // LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
627 // for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
628 // resultList.add(pmRecord);
631 // LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, resultList.size());
632 // return resultList;
635 private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) {
636 final String myName = "MWEthernetContainerPac";
638 String mountpointId = acessor.getNodeId().getValue();
640 LOG.debug("DBRead Get {} : {}", mountpointId, myName, lp.getUuid());
642 UniversalId ethContainerPacuuId = lp.getUuid();
643 // Step 2.2: construct data and the relative iid
644 InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
645 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
646 .child(EthernetContainerHistoricalPerformances.class).build();
648 // Step 2.3: read to the config data store
649 EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = acessor.getTransactionUtils()
650 .readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
652 if (ethContainerHistoricalPerformanceData == null) {
653 LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
655 List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = ethContainerHistoricalPerformanceData
656 .nonnullHistoricalPerformanceDataList();
657 LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
658 for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
659 result.add(new PerformanceDataAirInterface170324Builder(acessor.getNodeId(), lp, pmRecord));
662 LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, result.size());
666 // private static String getUuid(Lp lp) {
667 // UniversalId uuid = lp.getUuid();
668 // return uuid != null ? uuid.getValue() : null;
671 private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType mapSeverity( SeverityType severity) {
673 Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType> res =
674 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType.forName(severity.name());
675 return res.orElse(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType.NonAlarmed);