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.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 final NotificationService microwaveModelListener;
 
  90     private final NetconfAccessor acessor;
 
  91     private final TransactionUtils genericTransactionUtils;
 
  92     private final FaultService faultService;
 
  94     private Optional<NotificationWorker<EventlogEntity>> notificationQueue;
 
  97      * @param acessor to access device
 
  99     public WrapperMicrowaveModelRev170324(@NonNull NetconfAccessor acessor, @NonNull DeviceManagerServiceProvider serviceProvider) {
 
 100         this.acessor = acessor;
 
 101         this.genericTransactionUtils = acessor.getTransactionUtils();
 
 102         this.microwaveModelListener = serviceProvider.getNotificationService();
 
 103         this.faultService = serviceProvider.getFaultService();
 
 104         this.notificationQueue = Optional.empty();
 
 107     /*-----------------------------------------------------------------------------
 
 111     @SuppressWarnings("unchecked")
 
 113     public <T extends NotificationListener> T getNotificationListener() {
 
 118     public void setNotificationQueue(NotificationWorker<EventlogEntity> notificationQueue) {
 
 119         this.notificationQueue = Optional.of(notificationQueue);
 
 122     /*-----------------------------------------------------------------------------
 
 123      * Interface functions
 
 127     public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
 
 128             FaultData resultList) {
 
 132             readTheFaultsOfMwAirInterfacePac(uuid, resultList);
 
 135         case ETHERNETCONTAINER12:
 
 136             readTheFaultsOfMwEthernetContainerPac(uuid, resultList);
 
 140             readTheFaultsOfMwTdmContainerPac(uuid, resultList);
 
 144             if (lpClass == MwHybridMwStructurePac.class) {
 
 145                 readTheFaultsOfMwHybridMwStructurePac(uuid, resultList);
 
 147             } else if (lpClass == MwAirInterfaceDiversityPac.class) {
 
 148                 readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList);
 
 150             } else if (lpClass == MwPureEthernetStructurePac.class) {
 
 151                 readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList);
 
 154                 LOG.warn("Unassigned lp model {} class {}", lpName, lpClass);
 
 158             // No alarms supported
 
 160         case ETHERNETCONTAINER10:
 
 162             LOG.warn("Unassigned or not expected lp in model {}", lpName);
 
 167     public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, @NonNull Lp lp) {
 
 168         PerformanceDataLtp res = new PerformanceDataLtp();
 
 169         readAirInterfacePerformanceData(lp, res);
 
 170         readEthernetContainerPerformanceData(lp, res);
 
 176     public Class<?> getClassForLtpExtension(QName qName) {
 
 178         if (qName.equals(MwAirInterfacePac.QNAME)) {
 
 179             res = MwAirInterfacePac.class;
 
 180         } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
 
 181             res = MwAirInterfaceDiversityPac.class;
 
 182         } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
 
 183             res = MwPureEthernetStructurePac.class;
 
 184         } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
 
 185             res = MwHybridMwStructurePac.class;
 
 186         } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
 
 187             res = MwEthernetContainerPac.class;
 
 188         } else if (qName.equals(MwTdmContainerPac.QNAME)) {
 
 189             res = MwTdmContainerPac.class;
 
 191         LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
 
 196     public void onObjectCreationNotification(ObjectCreationNotification notification) {
 
 197         LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
 
 198         if (notification != null) {
 
 199             microwaveModelListener.creationNotification(acessor.getNodeId(), notification.getCounter(),
 
 200                     notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
 
 205     public void onObjectDeletionNotification( ObjectDeletionNotification notification) {
 
 206         LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
 
 207         if (notification != null) {
 
 208             microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(),
 
 209                     notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
 
 214     public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
 
 215         LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
 
 216         EventlogEntity beventlogEntity = new EventlogBuilder().setNodeId(acessor.getNodeId().getValue())
 
 217                 .setCounter(notification.getCounter()).setTimestamp(notification.getTimeStamp())
 
 218                 .setObjectId(Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue())
 
 219                 .setAttributeName(notification.getAttributeName()).setNewValue(notification.getNewValue()).build();
 
 220         microwaveModelListener.eventNotification(beventlogEntity);
 
 221         if (notificationQueue.isPresent()) {
 
 222             notificationQueue.get().put(beventlogEntity);
 
 227     public void onProblemNotification(ProblemNotification notification) {
 
 229         LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
 
 231         faultService.faultNotification(acessor.getNodeId(), notification.getCounter(),
 
 232                 notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue(),
 
 233                 notification.getProblem(), mapSeverity(notification.getSeverity()));
 
 236     /*-----------------------------------------------------------------------------
 
 237      * Reading problems for specific interface pacs
 
 241      * Read problems of specific interfaces
 
 243      * @param uuId Universal Id String of the interface
 
 244      * @return number of alarms
 
 246     private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, FaultData resultList) {
 
 248         final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
 
 250         String mountpointId = acessor.getNodeId().getValue();
 
 251         LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
 
 252                 mountpointId, interfacePacUuid.getValue());
 
 254         // Step 2.2: construct data and the relative iid
 
 255         InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID = InstanceIdentifier
 
 256                 .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
 
 257                 .child(AirInterfaceCurrentProblems.class).build();
 
 259         // Step 2.3: read to the config data store
 
 260         AirInterfaceCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
 
 261                 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
 
 263         if (problems == null) {
 
 264             LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
 
 266             for (AirInterfaceCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
 
 267                 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
 
 268                         interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
 
 276      * Read problems of specific interfaces
 
 278      * @param uuId Universal index of Interfacepac
 
 279      * @return number of alarms
 
 281     private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
 
 283         final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
 
 285         String mountpointId = acessor.getNodeId().getValue();
 
 286         LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
 
 287                 mountpointId, interfacePacUuid.getValue());
 
 289         InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
 
 290                 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
 
 291                 .child(EthernetContainerCurrentProblems.class).build();
 
 293         EthernetContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
 
 294                 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
 
 295         if (problems == null) {
 
 296             LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
 
 298             for (ContainerCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
 
 299                 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
 
 300                         interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
 
 307      * Read problems of specific interfaces
 
 309      * @param uuId Universal index of Interfacepac
 
 310      * @return number of alarms
 
 312     private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid,
 
 313             FaultData resultList) {
 
 315         final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
 
 316         final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
 
 318         String mountpointId = acessor.getNodeId().getValue();
 
 319         LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
 
 320                 mountpointId, interfacePacUuid.getValue());
 
 322         InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
 
 323                 .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
 
 325         AirInterfaceDiversityCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
 
 326                 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
 
 327         if (problems == null) {
 
 328             LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
 
 330             for (AirInterfaceDiversityCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
 
 331                 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
 
 332                         interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
 
 339      * Read problems of specific interfaces
 
 341      * @param uuId Universal index of Interfacepac
 
 342      * @return number of alarms
 
 344     private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid,
 
 345             FaultData resultList) {
 
 347         final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
 
 348         final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
 
 350         String mountpointId = acessor.getNodeId().getValue();
 
 351         LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
 
 352                 mountpointId, interfacePacUuid.getValue());
 
 354         InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
 
 355                 .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
 
 357         PureEthernetStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
 
 358                 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
 
 359         if (problems == null) {
 
 360             LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
 
 362             for (StructureCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
 
 363                 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
 
 364                         interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
 
 371      * Read problems of specific interfaces
 
 373      * @param uuId Universal index of Interfacepac
 
 374      * @return number of alarms
 
 376     private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
 
 378         final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
 
 379         final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
 
 381         String mountpointId = acessor.getNodeId().getValue();
 
 382         LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
 
 383                 mountpointId, interfacePacUuid.getValue());
 
 385         InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
 
 386                 .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
 
 388         HybridMwStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
 
 389                 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
 
 390         if (problems == null) {
 
 391             LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
 
 393             for (StructureCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
 
 394                 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
 
 395                         interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
 
 402      * Read problems of specific interfaces. TODO Goal for future implementation
 
 403      * without usage of explicit new. Key is generated by newInstance() function
 
 404      * here to verify this approach.
 
 406      * @param uuId Universal index of Interfacepac
 
 407      * @return number of alarms
 
 408      * @throws SecurityException
 
 409      * @throws NoSuchMethodException
 
 410      * @throws InvocationTargetException
 
 411      * @throws IllegalArgumentException
 
 412      * @throws IllegalAccessException
 
 413      * @throws InstantiationException
 
 415     private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
 
 417         final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
 
 418         final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
 
 419         final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
 
 421         String mountpointId = acessor.getNodeId().getValue();
 
 422         LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
 
 423                 mountpointId, interfacePacUuid.getValue());
 
 426             // -- Specific part 1
 
 427             Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
 
 428             InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
 
 429                     .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
 
 431             // -- Specific part 2
 
 432             TdmContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
 
 433                     LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
 
 434             if (problems == null) {
 
 435                 LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
 
 437                 // -- Specific part 3
 
 438                 for (ContainerCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
 
 439                     resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
 
 440                             interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity()));
 
 443         } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
 
 444                 | IllegalArgumentException | InvocationTargetException e) {
 
 445             LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
 
 451      * Read and add performance data
 
 452      * @param lp to read from
 
 453      * @param result Object to be filled with data
 
 456     private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) {
 
 458         LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid());
 
 460         UniversalId mwAirInterfacePacuuId = lp.getUuid();
 
 461         // Step 2.1: construct data and the relative iid
 
 462         InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = InstanceIdentifier
 
 463                 .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
 
 464                 .child(AirInterfaceConfiguration.class).build();
 
 465         AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(),
 
 466                 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
 
 468         if (airConfiguration == null) {
 
 469             LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
 
 472             // Step 2.2: construct data and the relative iid
 
 473             InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = InstanceIdentifier
 
 474                     .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
 
 475                     .child(AirInterfaceHistoricalPerformances.class).build();
 
 477             // Step 2.3: read to the config data store
 
 478             AirInterfaceHistoricalPerformances airHistoricalPerformanceData = genericTransactionUtils.readData(
 
 479                     acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
 
 481             if (airHistoricalPerformanceData == null) {
 
 482                 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
 
 483                         mwAirInterfacePacuuId);
 
 485                 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
 
 486                 List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = airHistoricalPerformanceData
 
 487                         .nonnullHistoricalPerformanceDataList();
 
 488                 LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
 
 489                         airHistPMList.size());
 
 490                 for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistoricalPerformanceData
 
 491                         .nonnullHistoricalPerformanceDataList()) {
 
 492                     result.add(new PerformanceDataAirInterface170324Builder(acessor.getNodeId(), lp, pmRecord, airConfiguration));
 
 496         LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, result.size());
 
 501     private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) {
 
 502         final String myName = "MWEthernetContainerPac";
 
 504         String mountpointId = acessor.getNodeId().getValue();
 
 506         LOG.debug("DBRead Get {} : {}", mountpointId, myName, lp.getUuid());
 
 508         UniversalId ethContainerPacuuId = lp.getUuid();
 
 509         // Step 2.2: construct data and the relative iid
 
 510         InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
 
 511                 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
 
 512                 .child(EthernetContainerHistoricalPerformances.class).build();
 
 514         // Step 2.3: read to the config data store
 
 515         EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = acessor.getTransactionUtils()
 
 516                 .readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
 
 518         if (ethContainerHistoricalPerformanceData == null) {
 
 519             LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
 
 521             List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = ethContainerHistoricalPerformanceData
 
 522                     .nonnullHistoricalPerformanceDataList();
 
 523             LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
 
 524             for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
 
 525                 result.add(new PerformanceDataAirInterface170324Builder(acessor.getNodeId(), lp, pmRecord));
 
 528         LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, result.size());
 
 532     private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType mapSeverity( SeverityType severity) {
 
 534         Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType> res =
 
 535                 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType.forName(severity.name());
 
 536         return res.orElse(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType.NonAlarmed);