2  * ============LICENSE_START========================================================================
 
   3  * ONAP : ccsdk feature sdnr wt
 
   4  * =================================================================================================
 
   5  * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
 
   6  * =================================================================================================
 
   7  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 
   8  * in compliance with the License. You may obtain a copy of the License at
 
  10  * http://www.apache.org/licenses/LICENSE-2.0
 
  12  * Unless required by applicable law or agreed to in writing, software distributed under the License
 
  13  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 
  14  * or implied. See the License for the specific language governing permissions and limitations under
 
  16  * ============LICENSE_END==========================================================================
 
  18 package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave;
 
  22 import java.lang.reflect.Constructor;
 
  23 import java.lang.reflect.InvocationTargetException;
 
  24 import java.util.Collection;
 
  25 import java.util.Optional;
 
  26 import org.eclipse.jdt.annotation.NonNull;
 
  27 import org.onap.ccsdk.features.sdnr.wt.common.YangHelper;
 
  28 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.pm.PerformanceDataAirInterface180907Builder;
 
  29 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.notifications.NotificationWorker;
 
  30 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.util.ONFLayerProtocolName;
 
  31 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
 
  32 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
 
  33 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService;
 
  34 import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData;
 
  35 import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp;
 
  36 import org.onap.ccsdk.features.sdnr.wt.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.rev180907.AirInterfaceCurrentProblemTypeG;
 
  44 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AirInterfaceDiversityCurrentProblemTypeG;
 
  45 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AirInterfaceHistoricalPerformanceTypeG;
 
  46 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AttributeValueChangedNotification;
 
  47 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ContainerCurrentProblemTypeG;
 
  48 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ContainerHistoricalPerformanceTypeG;
 
  49 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MicrowaveModelListener;
 
  50 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfaceDiversityPac;
 
  51 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfaceDiversityPacKey;
 
  52 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfacePac;
 
  53 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfacePacKey;
 
  54 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwEthernetContainerPac;
 
  55 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwEthernetContainerPacKey;
 
  56 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwHybridMwStructurePac;
 
  57 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwHybridMwStructurePacKey;
 
  58 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwPureEthernetStructurePac;
 
  59 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwPureEthernetStructurePacKey;
 
  60 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwTdmContainerPac;
 
  61 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwTdmContainerPacKey;
 
  62 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ObjectCreationNotification;
 
  63 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ObjectDeletionNotification;
 
  64 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ProblemNotification;
 
  65 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.SeverityType;
 
  66 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.StructureCurrentProblemTypeG;
 
  67 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
 
  68 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceConfiguration;
 
  69 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceCurrentProblems;
 
  70 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
 
  71 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
 
  72 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
 
  73 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
 
  74 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
 
  75 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.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 WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, MicrowaveModelListener {
 
  90     private static final Logger LOG = LoggerFactory.getLogger(WrapperMicrowaveModelRev180907.class);
 
  92     public static final QName QNAME = MwAirInterfacePac.QNAME;
 
  95     private final NotificationService microwaveModelListener;
 
  96     private final NetconfBindingAccessor acessor;
 
  97     private final TransactionUtils genericTransactionUtil;
 
  98     private final String mountpointId;
 
  99     private final @NonNull FaultService faultService;
 
 100     private final WebsocketManagerService notificationService;
 
 102     private Optional<NotificationWorker<EventlogEntity>> notificationQueue;
 
 107      * Handle specific version of microwave model
 
 109      * @param acessor to access device
 
 110      * @param serviceProvider for devicemanager services
 
 112     public WrapperMicrowaveModelRev180907(@NonNull NetconfBindingAccessor acessor,
 
 113             @NonNull DeviceManagerServiceProvider serviceProvider) {
 
 114         this.acessor = acessor;
 
 115         this.mountpointId = acessor.getNodeId().getValue();
 
 116         this.genericTransactionUtil = acessor.getTransactionUtils();
 
 117         this.microwaveModelListener = serviceProvider.getNotificationService();
 
 118         this.faultService = serviceProvider.getFaultService();
 
 119         this.notificationService = serviceProvider.getWebsocketService();
 
 120         this.notificationQueue = Optional.empty();
 
 123     /*-----------------------------------------------------------------------------
 
 127     @SuppressWarnings("unchecked")
 
 129     public <T extends NotificationListener> T getNotificationListener() {
 
 134     public void setNotificationQueue(NotificationWorker<EventlogEntity> notificationQueue) {
 
 135         this.notificationQueue = Optional.of(notificationQueue);
 
 138     /*-----------------------------------------------------------------------------
 
 143     public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
 
 144             FaultData resultList) {
 
 148                 readTheFaultsOfMwAirInterfacePac(uuid, resultList);
 
 151             case ETHERNETCONTAINER12:
 
 152                 readTheFaultsOfMwEthernetContainerPac(uuid, resultList);
 
 156                 readTheFaultsOfMwTdmContainerPac(uuid, resultList);
 
 160                 if (lpClass == MwHybridMwStructurePac.class) {
 
 161                     readTheFaultsOfMwHybridMwStructurePac(uuid, resultList);
 
 163                 } else if (lpClass == MwAirInterfaceDiversityPac.class) {
 
 164                     readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList);
 
 166                 } else if (lpClass == MwPureEthernetStructurePac.class) {
 
 167                     readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList);
 
 170                     LOG.warn("Unassigned lp model {} class {}", lpName, lpClass);
 
 174                 // No alarms supported
 
 176             case ETHERNETCONTAINER10:
 
 178                 LOG.warn("Unassigned or not expected lp in model {}", lpName);
 
 183     public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName,
 
 184             @NonNull Lp lp) throws InconsistentPMDataException {
 
 185         PerformanceDataLtp res = new PerformanceDataLtp();
 
 188                 readAirInterfacePerformanceData(lp, res);
 
 191             case ETHERNETCONTAINER12:
 
 192                 readEthernetContainerPerformanceData(lp, res);
 
 195             case ETHERNETCONTAINER10:
 
 196             case ETHERNETPHYSICAL:
 
 201                 LOG.debug("Do not read HistoricalPM data for {} {}", lpName,
 
 202                         Helper.nnGetUniversalId(lp.getUuid()).getValue());
 
 209     public Class<?> getClassForLtpExtension(QName qName) {
 
 211         if (qName.equals(MwAirInterfacePac.QNAME)) {
 
 212             res = MwAirInterfacePac.class;
 
 213         } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
 
 214             res = MwAirInterfaceDiversityPac.class;
 
 215         } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
 
 216             res = MwPureEthernetStructurePac.class;
 
 217         } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
 
 218             res = MwHybridMwStructurePac.class;
 
 219         } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
 
 220             res = MwEthernetContainerPac.class;
 
 221         } else if (qName.equals(MwTdmContainerPac.QNAME)) {
 
 222             res = MwTdmContainerPac.class;
 
 224         LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
 
 229     public void onObjectCreationNotification(ObjectCreationNotification notification) {
 
 230         LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
 
 231         if (notification != null) {
 
 232             microwaveModelListener.creationNotification(acessor.getNodeId(), notification.getCounter(),
 
 233                     notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
 
 238     public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
 
 239         LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
 
 240         if (notification != null) {
 
 241             microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(),
 
 242                     notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue());
 
 247     public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
 
 248         LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
 
 249         EventlogEntity beventlogEntity = new EventlogBuilder().setNodeId(acessor.getNodeId().getValue())
 
 250                 .setCounter(notification.getCounter()).setTimestamp(notification.getTimeStamp())
 
 251                 .setObjectId(Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue())
 
 252                 .setAttributeName(notification.getAttributeName()).setNewValue(notification.getNewValue()).build();
 
 253         microwaveModelListener.eventNotification(beventlogEntity);
 
 254         if (notificationQueue.isPresent()) {
 
 255             notificationQueue.get().put(beventlogEntity);
 
 260     public void onProblemNotification(ProblemNotification notification) {
 
 262         LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
 
 263         FaultlogEntity faultAlarm = new FaultlogBuilder().setObjectId(notification.getObjectIdRef().getValue())
 
 264                 .setProblem(notification.getProblem()).setSourceType(SourceType.Netconf)
 
 265                 .setTimestamp(notification.getTimeStamp())
 
 266                 .setNodeId(this.acessor.getNodeId().getValue())
 
 267                 .setSeverity(mapSeverity(notification.getSeverity())).setCounter(notification.getCounter())
 
 269         // Send devicemanager specific notification for database and ODLUX
 
 270         faultService.faultNotification(faultAlarm);
 
 271         // Send model specific notification to WebSocketManager
 
 272         notificationService.sendNotification(notification, acessor.getNodeId(), ProblemNotification.QNAME,
 
 273                 notification.getTimeStamp());
 
 276     /*-----------------------------------------------------------------------------
 
 277      * Reading problems for specific interface pacs
 
 281      * Read problems of specific interfaces
 
 283      * @param uuId Universal Id String of the interface
 
 284      * @return number of alarms
 
 286     private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, FaultData resultList) {
 
 288         final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
 
 290         LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
 
 291                 mountpointId, interfacePacUuid.getValue());
 
 293         // Step 2.2: construct data and the relative iid
 
 294         InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID =
 
 295                 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
 
 296                         .child(AirInterfaceCurrentProblems.class).build();
 
 298         // Step 2.3: read to the config data store
 
 299         AirInterfaceCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
 
 300                 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
 
 302         if (problems == null) {
 
 303             LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
 
 305             for (AirInterfaceCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
 
 306                 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
 
 307                         interfacePacUuid.getValue(), problem.getProblemName(),
 
 308                         mapSeverity(problem.getProblemSeverity()));
 
 315      * Read problems of specific interfaces
 
 317      * @param uuId Universal index of Interfacepac
 
 318      * @return number of alarms
 
 320     private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
 
 322         final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
 
 324         LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
 
 325                 mountpointId, interfacePacUuid.getValue());
 
 327         InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
 
 328                 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
 
 329                 .child(EthernetContainerCurrentProblems.class).build();
 
 331         EthernetContainerCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
 
 332                 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
 
 333         if (problems == null) {
 
 334             LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
 
 336             for (ContainerCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
 
 337                 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
 
 338                         interfacePacUuid.getValue(), problem.getProblemName(),
 
 339                         mapSeverity(problem.getProblemSeverity()));
 
 346      * Read problems of specific interfaces
 
 348      * @param uuId Universal index of Interfacepac
 
 349      * @return number of alarms
 
 351     private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid, FaultData resultList) {
 
 353         final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
 
 354         final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
 
 356         LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
 
 357                 mountpointId, interfacePacUuid.getValue());
 
 359         InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
 
 360                 .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
 
 362         AirInterfaceDiversityCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
 
 363                 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
 
 364         if (problems == null) {
 
 365             LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
 
 367             for (AirInterfaceDiversityCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
 
 368                 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
 
 369                         interfacePacUuid.getValue(), problem.getProblemName(),
 
 370                         mapSeverity(problem.getProblemSeverity()));
 
 377      * Read problems of specific interfaces
 
 379      * @param uuId Universal index of Interfacepac
 
 380      * @return number of alarms
 
 382     private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
 
 384         final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
 
 385         final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
 
 387         LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
 
 388                 mountpointId, interfacePacUuid.getValue());
 
 390         InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
 
 391                 .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
 
 393         PureEthernetStructureCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
 
 394                 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
 
 395         if (problems == null) {
 
 396             LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
 
 398             for (StructureCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
 
 399                 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
 
 400                         interfacePacUuid.getValue(), problem.getProblemName(),
 
 401                         mapSeverity(problem.getProblemSeverity()));
 
 408      * Read problems of specific interfaces
 
 410      * @param uuId Universal index of Interfacepac
 
 411      * @return number of alarms
 
 413     private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid, FaultData resultList) {
 
 415         final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
 
 416         final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
 
 418         LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
 
 419                 mountpointId, interfacePacUuid.getValue());
 
 421         InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
 
 422                 .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
 
 424         HybridMwStructureCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
 
 425                 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
 
 426         if (problems == null) {
 
 427             LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
 
 429             for (StructureCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
 
 430                 resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
 
 431                         interfacePacUuid.getValue(), problem.getProblemName(),
 
 432                         mapSeverity(problem.getProblemSeverity()));
 
 439      * Read problems of specific interfaces. TODO Goal for future implementation without usage of explicit new. Key is
 
 440      * generated by newInstance() function here to verify this approach.
 
 442      * @param uuId Universal index of Interfacepac
 
 443      * @return number of alarms
 
 444      * @throws SecurityException
 
 445      * @throws NoSuchMethodException
 
 446      * @throws InvocationTargetException
 
 447      * @throws IllegalArgumentException
 
 448      * @throws IllegalAccessException
 
 449      * @throws InstantiationException
 
 451     private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid, FaultData resultList) {
 
 453         final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
 
 454         final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
 
 455         final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
 
 457         LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
 
 458                 mountpointId, interfacePacUuid.getValue());
 
 461             // -- Specific part 1
 
 462             Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
 
 463             InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
 
 464                     .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
 
 466             // -- Specific part 2
 
 467             TdmContainerCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(),
 
 468                     LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
 
 469             if (problems == null) {
 
 470                 LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
 
 472                 // -- Specific part 3
 
 473                 for (ContainerCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) {
 
 474                     resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(),
 
 475                             interfacePacUuid.getValue(), problem.getProblemName(),
 
 476                             mapSeverity(problem.getProblemSeverity()));
 
 479         } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
 
 480                 | IllegalArgumentException | InvocationTargetException e) {
 
 481             LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
 
 487      * Read and add performance data
 
 489      * @param lp to read from
 
 490      * @param result Object to be filled with data
 
 492      * @throws InconsistentPMDataException
 
 494     private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) throws InconsistentPMDataException {
 
 496         LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid());
 
 498         UniversalId mwAirInterfacePacuuId = lp.getUuid();
 
 499         // Step 2.1: construct data and the relative iid
 
 500         InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID =
 
 501                 InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
 
 502                         .child(AirInterfaceConfiguration.class).build();
 
 503         AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(),
 
 504                 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
 
 506         if (airConfiguration == null) {
 
 507             LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
 
 510             // Step 2.2: construct data and the relative iid
 
 511             InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID =
 
 512                     InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
 
 513                             .child(AirInterfaceHistoricalPerformances.class).build();
 
 515             // Step 2.3: read to the config data store
 
 516             AirInterfaceHistoricalPerformances airHistoricalPerformanceData = acessor.getTransactionUtils().readData(
 
 517                     acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
 
 519             if (airHistoricalPerformanceData == null) {
 
 520                 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
 
 521                         mwAirInterfacePacuuId);
 
 523                 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
 
 524                 Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
 
 525                         YangHelper.getCollection(airHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
 
 526                 LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
 
 527                         airHistPMList.size());
 
 528                 for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistPMList) {
 
 529                     result.add(new PerformanceDataAirInterface180907Builder(acessor.getNodeId(), lp, pmRecord,
 
 534         LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, result.size());
 
 538     private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) throws InconsistentPMDataException {
 
 539         final String myName = "MWEthernetContainerPac";
 
 541         LOG.debug("DBRead Get {} : {}", myName, lp.getUuid());
 
 543         UniversalId ethContainerPacuuId = lp.getUuid();
 
 544         // Step 2.2: construct data and the relative iid
 
 545         InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
 
 546                 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
 
 547                 .child(EthernetContainerHistoricalPerformances.class).build();
 
 549         // Step 2.3: read to the config data store
 
 550         EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = acessor.getTransactionUtils()
 
 551                 .readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
 
 553         if (ethContainerHistoricalPerformanceData == null) {
 
 554             LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
 
 556             Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList =
 
 557                     YangHelper.getCollection(ethContainerHistoricalPerformanceData.nonnullHistoricalPerformanceDataList());
 
 558             LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
 
 559             for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
 
 560                 result.add(new PerformanceDataAirInterface180907Builder(acessor.getNodeId(), lp, pmRecord));
 
 563         LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, result.size());
 
 567     private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType mapSeverity(
 
 568             SeverityType severity) {
 
 570         Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType> res =
 
 571                 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType
 
 572                         .forName(severity.name());
 
 574                 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed);