2  * ============LICENSE_START========================================================================
 
   3  * ONAP : ccsdk feature sdnr wt
 
   4  * =================================================================================================
 
   5  * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
 
   6  * =================================================================================================
 
   7  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 
   8  * in compliance with the License. You may obtain a copy of the License at
 
  10  * http://www.apache.org/licenses/LICENSE-2.0
 
  12  * Unless required by applicable law or agreed to in writing, software distributed under the License
 
  13  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 
  14  * or implied. See the License for the specific language governing permissions and limitations under
 
  16  * ============LICENSE_END==========================================================================
 
  18 package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave;
 
  22 import java.lang.reflect.Constructor;
 
  23 import java.lang.reflect.InvocationTargetException;
 
  24 import java.util.Collection;
 
  25 import java.util.Optional;
 
  26 import org.eclipse.jdt.annotation.NonNull;
 
  27 import org.onap.ccsdk.features.sdnr.wt.common.YangHelper;
 
  28 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.pm.PerformanceDataAirInterface181010Builder;
 
  29 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.notifications.NotificationWorker;
 
  30 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.util.ONFLayerProtocolName;
 
  31 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
 
  32 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
 
  33 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService;
 
  34 import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData;
 
  35 import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp;
 
  36 import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException;
 
  37 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
 
  38 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
 
  39 import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
 
  40 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 
  41 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
 
  42 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
 
  43 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceCurrentProblemTypeG;
 
  44 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceDiversityCurrentProblemTypeG;
 
  45 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceHistoricalPerformanceTypeG;
 
  46 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AttributeValueChangedNotification;
 
  47 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ContainerCurrentProblemTypeG;
 
  48 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ContainerHistoricalPerformanceTypeG;
 
  49 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MicrowaveModelListener;
 
  50 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfaceDiversityPac;
 
  51 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfaceDiversityPacKey;
 
  52 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfacePac;
 
  53 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfacePacKey;
 
  54 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwEthernetContainerPac;
 
  55 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwEthernetContainerPacKey;
 
  56 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwHybridMwStructurePac;
 
  57 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwHybridMwStructurePacKey;
 
  58 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwPureEthernetStructurePac;
 
  59 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwPureEthernetStructurePacKey;
 
  60 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwTdmContainerPac;
 
  61 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwTdmContainerPacKey;
 
  62 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ObjectCreationNotification;
 
  63 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ObjectDeletionNotification;
 
  64 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ProblemNotification;
 
  65 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.SeverityType;
 
  66 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.StructureCurrentProblemTypeG;
 
  67 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
 
  68 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceConfiguration;
 
  69 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceCurrentProblems;
 
  70 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
 
  71 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
 
  72 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
 
  73 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
 
  74 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
 
  75 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.tdm.container.pac.TdmContainerCurrentProblems;
 
  76 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder;
 
  77 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity;
 
  78 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogBuilder;
 
  79 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogEntity;
 
  80 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType;
 
  81 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
  82 import org.opendaylight.yangtools.yang.binding.NotificationListener;
 
  83 import org.opendaylight.yangtools.yang.common.QName;
 
  84 import org.slf4j.Logger;
 
  85 import org.slf4j.LoggerFactory;
 
  88 public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, MicrowaveModelListener {
 
  90     private static final Logger LOG = LoggerFactory.getLogger(WrapperMicrowaveModelRev181010.class);
 
  92     public static final QName QNAME = MwAirInterfacePac.QNAME;
 
  95     private final NetconfBindingAccessor acessor;
 
  96     private final NotificationService microwaveModelListener;
 
  97     private final TransactionUtils genericTransactionUtils;
 
  98     private final String mountpointId;
 
  99     private final @NonNull FaultService faultService;
 
 100     private final WebsocketManagerService notificationService;
 
 102     private Optional<NotificationWorker<EventlogEntity>> notificationQueue;
 
 105      * Handle specific version of microwave model
 
 107      * @param acessor to access device
 
 108      * @param serviceProvider for devicemanager services
 
 110     public WrapperMicrowaveModelRev181010(@NonNull NetconfBindingAccessor acessor,
 
 111             @NonNull DeviceManagerServiceProvider serviceProvider) {
 
 112         this.acessor = acessor;
 
 113         this.genericTransactionUtils = acessor.getTransactionUtils();
 
 114         this.mountpointId = acessor.getNodeId().getValue();
 
 115         this.microwaveModelListener = serviceProvider.getNotificationService();
 
 116         this.faultService = serviceProvider.getFaultService();
 
 117         this.notificationService = serviceProvider.getWebsocketService();
 
 118         this.notificationQueue = Optional.empty();
 
 121     /*-----------------------------------------------------------------------------
 
 125     @SuppressWarnings("unchecked")
 
 127     public <T extends NotificationListener> T getNotificationListener() {
 
 132     public void setNotificationQueue(NotificationWorker<EventlogEntity> notificationQueue) {
 
 133         this.notificationQueue = Optional.of(notificationQueue);
 
 136     /*-----------------------------------------------------------------------------
 
 141     public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
 
 142             FaultData resultList) {
 
 146                 readTheFaultsOfMwAirInterfacePac(uuid, resultList);
 
 149             case ETHERNETCONTAINER12:
 
 150                 readTheFaultsOfMwEthernetContainerPac(uuid, resultList);
 
 154                 readTheFaultsOfMwTdmContainerPac(uuid, resultList);
 
 158                 if (lpClass == MwHybridMwStructurePac.class) {
 
 159                     readTheFaultsOfMwHybridMwStructurePac(uuid, resultList);
 
 161                 } else if (lpClass == MwAirInterfaceDiversityPac.class) {
 
 162                     readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList);
 
 164                 } else if (lpClass == MwPureEthernetStructurePac.class) {
 
 165                     readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList);
 
 168                     LOG.warn("Unassigned lp model {} class {}", lpName, lpClass);
 
 172                 // No alarms supported
 
 174             case ETHERNETCONTAINER10:
 
 176                 LOG.warn("Unassigned or not expected lp in model {}", lpName);
 
 181     public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName,
 
 182             @NonNull Lp lp) throws InconsistentPMDataException {
 
 183         PerformanceDataLtp res = new PerformanceDataLtp();
 
 186                 return readAirInterfacePerformanceData(lp, res);
 
 188             case ETHERNETCONTAINER12:
 
 189                 return readEthernetContainerPerformanceData(lp, res);
 
 191             case ETHERNETCONTAINER10:
 
 192             case ETHERNETPHYSICAL:
 
 197                 LOG.debug("Do not read HistoricalPM data for {} {}", lpName,
 
 198                         Helper.nnGetUniversalId(lp.getUuid()).getValue());
 
 204     public Class<?> getClassForLtpExtension(QName qName) {
 
 206         if (qName.equals(MwAirInterfacePac.QNAME)) {
 
 207             res = MwAirInterfacePac.class;
 
 208         } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
 
 209             res = MwAirInterfaceDiversityPac.class;
 
 210         } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
 
 211             res = MwPureEthernetStructurePac.class;
 
 212         } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
 
 213             res = MwHybridMwStructurePac.class;
 
 214         } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
 
 215             res = MwEthernetContainerPac.class;
 
 216         } else if (qName.equals(MwTdmContainerPac.QNAME)) {
 
 217             res = MwTdmContainerPac.class;
 
 219         LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
 
 224     public void onObjectCreationNotification(ObjectCreationNotification notification) {
 
 225         LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
 
 226         if (notification != null) {
 
 227             microwaveModelListener.creationNotification(acessor.getNodeId(), notification.getCounter(),
 
 228                     notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
 
 233     public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
 
 234         LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
 
 235         if (notification != null) {
 
 236             microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(),
 
 237                     notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
 
 242     public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
 
 243         LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
 
 244         EventlogEntity beventlogEntity = new EventlogBuilder().setNodeId(acessor.getNodeId().getValue())
 
 245                 .setCounter(notification.getCounter()).setTimestamp(notification.getTimeStamp())
 
 246                 .setObjectId(Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue())
 
 247                 .setAttributeName(notification.getAttributeName()).setNewValue(notification.getNewValue()).build();
 
 248         microwaveModelListener.eventNotification(beventlogEntity);
 
 249         if (notificationQueue.isPresent()) {
 
 250             notificationQueue.get().put(beventlogEntity);
 
 255     public void onProblemNotification(ProblemNotification notification) {
 
 257         LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
 
 258         FaultlogEntity faultAlarm = new FaultlogBuilder().setObjectId(notification.getObjectIdRef().getValue())
 
 259                 .setProblem(notification.getProblem()).setSourceType(SourceType.Netconf)
 
 260                 .setTimestamp(notification.getTimeStamp()).setNodeId(this.acessor.getNodeId().getValue())
 
 261                 .setSeverity(mapSeverity(notification.getSeverity())).setCounter(notification.getCounter()).build();
 
 262         // Send devicemanager specific notification for database and ODLUX
 
 263         faultService.faultNotification(faultAlarm);
 
 264         // Send model specific notification to WebSocketManager
 
 265         notificationService.sendNotification(notification, acessor.getNodeId(), ProblemNotification.QNAME,
 
 266                 notification.getTimeStamp());
 
 269     /*-----------------------------------------------------------------------------
 
 270      * Reading problems for specific interface pacs
 
 274      * Read problems of specific interfaces
 
 276      * @param uuId Universal Id String of the interface
 
 277      * @return number of alarms
 
 279     private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, FaultData resultList) {
 
 281         final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
 
 283         LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
 
 284                 mountpointId, interfacePacUuid.getValue());
 
 286         // Step 2.2: construct data and the relative iid
 
 287         InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID =
 
 288                 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
 
 289                         .child(AirInterfaceCurrentProblems.class).build();
 
 291         // Step 2.3: read to the config data store
 
 292         AirInterfaceCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
 
 293                 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
 
 295         if (problems == null) {
 
 296             LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
 
 297         } else if (problems.getCurrentProblemList() == null) {
 
 298             LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid);
 
 300             for (AirInterfaceCurrentProblemTypeG problem : YangHelper
 
 301                     .getCollection(problems.nonnullCurrentProblemList())) {
 
 302                 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
 
 303                         interfacePacUuid.getValue(), problem.getProblemName(),
 
 304                         mapSeverity(problem.getProblemSeverity()));
 
 311      * Read problems of specific interfaces
 
 313      * @param uuId Universal index of Interfacepac
 
 314      * @return number of alarms
 
 316     private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
 
 318         final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
 
 320         LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
 
 321                 mountpointId, interfacePacUuid.getValue());
 
 323         InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
 
 324                 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
 
 325                 .child(EthernetContainerCurrentProblems.class).build();
 
 327         EthernetContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
 
 328                 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
 
 329         if (problems == null) {
 
 330             LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
 
 331         } else if (problems.getCurrentProblemList() == null) {
 
 332             LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
 
 334             for (ContainerCurrentProblemTypeG problem : YangHelper
 
 335                     .getCollection(problems.nonnullCurrentProblemList())) {
 
 336                 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
 
 337                         interfacePacUuid.getValue(), problem.getProblemName(),
 
 338                         mapSeverity(problem.getProblemSeverity()));
 
 345      * Read problems of specific interfaces
 
 347      * @param uuId Universal index of Interfacepac
 
 348      * @return number of alarms
 
 350     private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid, FaultData resultList) {
 
 352         final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
 
 353         final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
 
 355         LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
 
 356                 mountpointId, interfacePacUuid.getValue());
 
 358         InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
 
 359                 .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
 
 361         AirInterfaceDiversityCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
 
 362                 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
 
 363         if (problems == null) {
 
 364             LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
 
 365         } else if (problems.getCurrentProblemList() == null) {
 
 366             LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid);
 
 368             for (AirInterfaceDiversityCurrentProblemTypeG problem : YangHelper
 
 369                     .getCollection(problems.nonnullCurrentProblemList())) {
 
 370                 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
 
 371                         interfacePacUuid.getValue(), problem.getProblemName(),
 
 372                         mapSeverity(problem.getProblemSeverity()));
 
 379      * Read problems of specific interfaces
 
 381      * @param uuId Universal index of Interfacepac
 
 382      * @return number of alarms
 
 384     private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
 
 386         final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
 
 387         final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
 
 389         LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
 
 390                 mountpointId, interfacePacUuid.getValue());
 
 392         InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
 
 393                 .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
 
 395         PureEthernetStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
 
 396                 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
 
 397         if (problems == null) {
 
 398             LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
 
 399         } else if (problems.getCurrentProblemList() == null) {
 
 400             LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
 
 402             for (StructureCurrentProblemTypeG problem : YangHelper
 
 403                     .getCollection(problems.nonnullCurrentProblemList())) {
 
 404                 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
 
 405                         interfacePacUuid.getValue(), problem.getProblemName(),
 
 406                         mapSeverity(problem.getProblemSeverity()));
 
 413      * Read problems of specific interfaces
 
 415      * @param uuId Universal index of Interfacepac
 
 416      * @return number of alarms
 
 418     private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
 
 420         final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
 
 421         final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
 
 423         LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
 
 424                 mountpointId, interfacePacUuid.getValue());
 
 426         InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
 
 427                 .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
 
 429         HybridMwStructureCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
 
 430                 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
 
 431         if (problems == null) {
 
 432             LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
 
 433         } else if (problems.getCurrentProblemList() == null) {
 
 434             LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
 
 436             for (StructureCurrentProblemTypeG problem : YangHelper
 
 437                     .getCollection(problems.nonnullCurrentProblemList())) {
 
 438                 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
 
 439                         interfacePacUuid.getValue(), problem.getProblemName(),
 
 440                         mapSeverity(problem.getProblemSeverity()));
 
 447      * Read problems of specific interfaces. TODO Goal for future implementation without usage of explicit new. Key is
 
 448      * generated by newInstance() function here to verify this approach.
 
 450      * @param uuId Universal index of Interfacepac
 
 451      * @return number of alarms
 
 452      * @throws SecurityException
 
 453      * @throws NoSuchMethodException
 
 454      * @throws InvocationTargetException
 
 455      * @throws IllegalArgumentException
 
 456      * @throws IllegalAccessException
 
 457      * @throws InstantiationException
 
 459     private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
 
 461         final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
 
 462         final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
 
 463         final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
 
 465         LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
 
 466                 mountpointId, interfacePacUuid.getValue());
 
 469             // -- Specific part 1
 
 470             Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
 
 471             InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
 
 472                     .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
 
 474             // -- Specific part 2
 
 475             TdmContainerCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(),
 
 476                     LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
 
 477             if (problems == null) {
 
 478                 LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
 
 480                 // -- Specific part 3
 
 481                 for (ContainerCurrentProblemTypeG problem : YangHelper
 
 482                         .getCollection(problems.nonnullCurrentProblemList())) {
 
 483                     resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
 
 484                             interfacePacUuid.getValue(), problem.getProblemName(),
 
 485                             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      * Read and add performance data
 
 502      * @param lp to read from
 
 503      * @param result Object to be filled with data
 
 505      * @throws InconsistentPMDataException
 
 507     private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result)
 
 508             throws InconsistentPMDataException {
 
 510         LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid());
 
 512         UniversalId mwAirInterfacePacuuId = lp.getUuid();
 
 513         // Step 2.1: construct data and the relative iid
 
 514         InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID =
 
 515                 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
 
 516                         .child(AirInterfaceConfiguration.class).build();
 
 517         AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(),
 
 518                 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
 
 520         if (airConfiguration == null) {
 
 521             LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
 
 524             // Step 2.2: construct data and the relative iid
 
 525             InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID =
 
 526                     InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
 
 527                             .child(AirInterfaceHistoricalPerformances.class).build();
 
 529             // Step 2.3: read to the config data store
 
 530             AirInterfaceHistoricalPerformances airHistoricalPerformanceData = genericTransactionUtils.readData(
 
 531                     acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
 
 533             if (airHistoricalPerformanceData == null) {
 
 534                 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
 
 535                         mwAirInterfacePacuuId);
 
 537                 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
 
 538                 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
 
 539                         YangHelper.getCollection(airHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
 
 540                 LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
 
 541                         airHistPMList.size());
 
 542                 for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistPMList) {
 
 543                     result.add(new PerformanceDataAirInterface181010Builder(acessor.getNodeId(), lp, pmRecord,
 
 548         LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, result.size());
 
 552     private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result)
 
 553             throws InconsistentPMDataException {
 
 554         final String myName = "MWEthernetContainerPac";
 
 556         LOG.debug("DBRead Get {} : {}", mountpointId, myName, lp.getUuid());
 
 558         UniversalId ethContainerPacuuId = lp.getUuid();
 
 559         // Step 2.2: construct data and the relative iid
 
 560         InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
 
 561                 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
 
 562                 .child(EthernetContainerHistoricalPerformances.class).build();
 
 564         // Step 2.3: read to the config data store
 
 565         EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = acessor.getTransactionUtils()
 
 566                 .readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
 
 568         if (ethContainerHistoricalPerformanceData == null) {
 
 569             LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
 
 571             Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
 
 572                     YangHelper.getCollection(
 
 573                             ethContainerHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
 
 574             LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
 
 575             for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
 
 576                 result.add(new PerformanceDataAirInterface181010Builder(acessor.getNodeId(), lp, pmRecord));
 
 579         LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, result.size());
 
 583     public static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType mapSeverity(
 
 584             SeverityType severity) {
 
 586         Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType> res =
 
 587                 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType
 
 588                         .forName(severity.name());
 
 590                 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed);