1 /*******************************************************************************
2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
17 ******************************************************************************/
18 package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.onfcore.wrapperc;
22 import java.lang.reflect.Constructor;
23 import java.lang.reflect.InvocationTargetException;
24 import java.util.ArrayList;
25 import java.util.List;
26 import javax.annotation.Nonnull;
27 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.NetworkElementCoreData;
28 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.onfcore.container.ExtendedAirInterfaceHistoricalPerformanceType12;
29 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.onfcore.container.ONFLayerProtocolName;
30 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime;
31 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalSeverity;
32 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.AttributeValueChangedNotificationXml;
33 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectCreationNotificationXml;
34 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectDeletionNotificationXml;
35 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
36 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.INetconfAcessor;
37 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
38 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
39 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
40 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
41 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG;
42 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceCurrentProblemTypeG;
43 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceDiversityCurrentProblemTypeG;
44 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceHistoricalPerformanceTypeG;
45 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AttributeValueChangedNotification;
46 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ContainerCurrentProblemTypeG;
47 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ContainerHistoricalPerformanceTypeG;
48 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MicrowaveModelListener;
49 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfaceDiversityPac;
50 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfaceDiversityPacKey;
51 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfacePac;
52 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfacePacKey;
53 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwEthernetContainerPac;
54 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwEthernetContainerPacKey;
55 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwHybridMwStructurePac;
56 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwHybridMwStructurePacKey;
57 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwPureEthernetStructurePac;
58 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwPureEthernetStructurePacKey;
59 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwTdmContainerPac;
60 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwTdmContainerPacKey;
61 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ObjectCreationNotification;
62 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ObjectDeletionNotification;
63 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ProblemNotification;
64 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.StructureCurrentProblemTypeG;
65 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
66 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceConfiguration;
67 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceCurrentProblems;
68 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
69 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
70 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
71 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
72 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
73 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.tdm.container.pac.TdmContainerCurrentProblems;
74 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
75 import org.opendaylight.yangtools.yang.binding.NotificationListener;
76 import org.opendaylight.yangtools.yang.common.QName;
77 import org.slf4j.Logger;
78 import org.slf4j.LoggerFactory;
81 public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, MicrowaveModelListener {
83 private static final Logger LOG = LoggerFactory.getLogger(WrapperMicrowaveModelRev170324.class);
85 public static final QName QNAME = MwAirInterfacePac.QNAME;
88 private NetworkElementCoreData coreData;
89 private OnfMicrowaveModelNotification microwaveModelListener;
90 private final TransactionUtils genericTransactionUtils;
92 /*-----------------------------------------------------------------------------
99 public WrapperMicrowaveModelRev170324(INetconfAcessor acessor) {
100 genericTransactionUtils = acessor.getTransactionUtils();
104 public void setCoreData(NetworkElementCoreData coreData) {
105 this.coreData = coreData;
108 public NetworkElementCoreData getCoreData() {
113 public void setOnfMicrowaveModelListener(OnfMicrowaveModelNotification microwaveModelListener) {
114 this.microwaveModelListener = microwaveModelListener;
117 @SuppressWarnings("unchecked")
119 public <T extends NotificationListener> T getNotificationListener() {
123 /*-----------------------------------------------------------------------------
128 public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
129 List<ProblemNotificationXml> resultList) {
133 readTheFaultsOfMwAirInterfacePac(uuid, resultList);
136 case EthernetContainer12:
137 readTheFaultsOfMwEthernetContainerPac(uuid, resultList);
141 readTheFaultsOfMwTdmContainerPac(uuid, resultList);
145 if (lpClass == MwHybridMwStructurePac.class) {
146 readTheFaultsOfMwHybridMwStructurePac(uuid, resultList);
148 } else if (lpClass == MwAirInterfaceDiversityPac.class) {
149 readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList);
151 } else if (lpClass == MwPureEthernetStructurePac.class) {
152 readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList);
155 LOG.warn("Unassigned lp model {} class {}", lpName, lpClass);
159 // No alarms supported
161 case EthernetContainer10:
163 LOG.warn("Unassigned or not expected lp in model {}", lpName);
168 public List<? extends OtnHistoryDataG> readTheHistoricalPerformanceData(@Nonnull ONFLayerProtocolName lpName, Lp lp) {
171 return readTheHistoricalPerformanceDataOfMwAirInterfacePac(lp);
173 case EthernetContainer12:
174 return readTheHistoricalPerformanceDataOfEthernetContainer(lp);
176 case EthernetContainer10:
177 case EthernetPhysical:
182 LOG.debug("Do not read HistoricalPM data for {} {}", lpName, getUuid(lp));
185 return new ArrayList<>();
188 public Class<?> getClassForLtpExtension(QName qName) {
190 if (qName.equals(MwAirInterfacePac.QNAME)) {
191 res = MwAirInterfacePac.class;
192 } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
193 res = MwAirInterfaceDiversityPac.class;
194 } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
195 res = MwPureEthernetStructurePac.class;
196 } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
197 res = MwHybridMwStructurePac.class;
198 } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
199 res = MwEthernetContainerPac.class;
200 } else if (qName.equals(MwTdmContainerPac.QNAME)) {
201 res = MwTdmContainerPac.class;
203 LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
207 /*-----------------------------------------------------------------------------
208 * Reading problems for specific interface pacs
212 * Read problems of specific interfaces
214 * @param uuId Universal Id String of the interface
215 * @return number of alarms
217 private List<ProblemNotificationXml> readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid,
218 List<ProblemNotificationXml> resultList) {
220 final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
221 // final Class<MwAirInterfacePacKey> clazzPacKey = MwAirInterfacePacKey.class;
222 // final Class<AirInterfaceCurrentProblems> clazzProblems =
223 // AirInterfaceCurrentProblems.class;
224 // final Class<AirInterfaceCurrentProblemTypeG> clazzProblem =
225 // AirInterfaceCurrentProblemTypeG.class;
227 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
228 coreData.getMountpoint(), interfacePacUuid.getValue());
230 // Step 2.2: construct data and the relative iid
231 InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID = InstanceIdentifier
232 .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
233 .child(AirInterfaceCurrentProblems.class).build();
235 // Step 2.3: read to the config data store
236 AirInterfaceCurrentProblems problems = genericTransactionUtils.readData(coreData.getDataBroker(),
237 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
239 if (problems == null) {
240 LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
242 for (AirInterfaceCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
243 resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
244 problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
245 problem.getSequenceNumber(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
252 * Read problems of specific interfaces
254 * @param uuId Universal index of Interfacepac
255 * @return number of alarms
257 private List<ProblemNotificationXml> readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid,
258 List<ProblemNotificationXml> resultList) {
260 final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
261 // final Class<MwEthernetContainerPacKey> clazzPacKey =
262 // MwEthernetContainerPacKey.class;
263 // final Class<EthernetContainerCurrentProblems> clazzProblems =
264 // EthernetContainerCurrentProblems.class;
265 // final Class<ContainerCurrentProblemTypeG> clazzProblem =
266 // ContainerCurrentProblemTypeG.class;
268 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
269 coreData.getMountpoint(), interfacePacUuid.getValue());
271 InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
272 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
273 .child(EthernetContainerCurrentProblems.class).build();
275 EthernetContainerCurrentProblems problems = genericTransactionUtils.readData(coreData.getDataBroker(),
276 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
277 if (problems == null) {
278 LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
280 for (ContainerCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
281 resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
282 problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
283 problem.getSequenceNumber(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
290 * Read problems of specific interfaces
292 * @param uuId Universal index of Interfacepac
293 * @return number of alarms
295 private List<ProblemNotificationXml> readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid,
296 List<ProblemNotificationXml> resultList) {
298 final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
299 // final Class<MwAirInterfaceDiversityPacKey> clazzPacKey =
300 // MwAirInterfaceDiversityPacKey.class;
301 final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
302 // final Class<AirInterfaceDiversityCurrentProblemTypeG> clazzProblem =
303 // AirInterfaceDiversityCurrentProblemTypeG.class;
305 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
306 coreData.getMountpoint(), interfacePacUuid.getValue());
308 InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
309 .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
311 AirInterfaceDiversityCurrentProblems problems = genericTransactionUtils.readData(coreData.getDataBroker(),
312 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
313 if (problems == null) {
314 LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
316 for (AirInterfaceDiversityCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
317 resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
318 problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
319 problem.getSequenceNumber(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
326 * Read problems of specific interfaces
328 * @param uuId Universal index of Interfacepac
329 * @return number of alarms
331 private List<ProblemNotificationXml> readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid,
332 List<ProblemNotificationXml> resultList) {
334 final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
335 // final Class<MwPureEthernetStructurePacKey> clazzPacKey =
336 // MwPureEthernetStructurePacKey.class;
337 final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
338 // final Class<StructureCurrentProblemTypeG> clazzProblem =
339 // StructureCurrentProblemTypeG.class;
341 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
342 coreData.getMountpoint(), interfacePacUuid.getValue());
344 InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
345 .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
347 PureEthernetStructureCurrentProblems problems = genericTransactionUtils.readData(coreData.getDataBroker(),
348 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
349 if (problems == null) {
350 LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
352 for (StructureCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
353 resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
354 problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
355 problem.getSequenceNumber(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
362 * Read problems of specific interfaces
364 * @param uuId Universal index of Interfacepac
365 * @return number of alarms
367 private List<ProblemNotificationXml> readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid,
368 List<ProblemNotificationXml> resultList) {
370 final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
371 // final Class<MwHybridMwStructurePacKey> clazzPacKey =
372 // MwHybridMwStructurePacKey.class;
373 final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
374 // final Class<HybridMwStructureCurrentProblemsG> clazzProblem =
375 // HybridMwStructureCurrentProblemsG.class;
377 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
378 coreData.getMountpoint(), interfacePacUuid.getValue());
380 InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
381 .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
383 HybridMwStructureCurrentProblems problems = genericTransactionUtils.readData(coreData.getDataBroker(),
384 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
385 if (problems == null) {
386 LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
388 for (StructureCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
389 resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
390 problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
391 problem.getSequenceNumber(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
398 * Read problems of specific interfaces. TODO Goal for future implementation
399 * without usage of explicit new. Key is generated by newInstance() function
400 * here to verify this approach.
402 * @param uuId Universal index of Interfacepac
403 * @return number of alarms
404 * @throws SecurityException
405 * @throws NoSuchMethodException
406 * @throws InvocationTargetException
407 * @throws IllegalArgumentException
408 * @throws IllegalAccessException
409 * @throws InstantiationException
411 private List<ProblemNotificationXml> readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid,
412 List<ProblemNotificationXml> resultList) {
414 final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
415 final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
416 final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
417 // final Class<ContainerCurrentProblemTypeG> clazzProblem =
418 // ContainerCurrentProblemTypeG.class;
420 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
421 coreData.getMountpoint(), interfacePacUuid.getValue());
424 // -- Specific part 1
425 Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
426 InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
427 .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
429 // -- Specific part 2
430 TdmContainerCurrentProblems problems = genericTransactionUtils.readData(coreData.getDataBroker(),
431 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
432 if (problems == null) {
433 LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
435 // -- Specific part 3
436 for (ContainerCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) {
437 resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
438 problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
439 problem.getSequenceNumber(),
440 InternalDateAndTime.valueOf(problem.getTimeStamp())));
443 } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
444 | IllegalArgumentException | InvocationTargetException e) {
445 LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
450 /*-----------------------------------------------------------------------------
451 * Performance related data
455 * PM MwAirInterfacePac
460 private List<ExtendedAirInterfaceHistoricalPerformanceType12> readTheHistoricalPerformanceDataOfMwAirInterfacePac(
463 List<ExtendedAirInterfaceHistoricalPerformanceType12> resultList = new ArrayList<>();
464 LOG.debug("DBRead Get {} MWAirInterfacePac: {}", coreData.getMountpoint(), lp.getUuid());
466 UniversalId mwAirInterfacePacuuId = lp.getUuid();
467 // Step 2.1: construct data and the relative iid
468 InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = InstanceIdentifier
469 .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
470 .child(AirInterfaceConfiguration.class).build();
471 AirInterfaceConfiguration airConfiguration = genericTransactionUtils.readData(coreData.getDataBroker(),
472 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
474 if (airConfiguration == null) {
475 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
478 // Step 2.2: construct data and the relative iid
479 InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = InstanceIdentifier
480 .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
481 .child(AirInterfaceHistoricalPerformances.class).build();
483 // Step 2.3: read to the config data store
484 AirInterfaceHistoricalPerformances airHistoricalPerformanceData = genericTransactionUtils.readData(
485 coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
487 if (airHistoricalPerformanceData == null) {
488 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
489 mwAirInterfacePacuuId);
491 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
492 List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = airHistoricalPerformanceData
493 .nonnullHistoricalPerformanceDataList();
494 LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
495 airHistPMList.size());
496 for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistoricalPerformanceData
497 .nonnullHistoricalPerformanceDataList()) {
498 resultList.add(new ExtendedAirInterfaceHistoricalPerformanceType12(pmRecord, airConfiguration));
502 LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, resultList.size());
506 private List<ContainerHistoricalPerformanceTypeG> readTheHistoricalPerformanceDataOfEthernetContainer(Lp lp) {
508 final String myName = "MWEthernetContainerPac";
510 List<ContainerHistoricalPerformanceTypeG> resultList = new ArrayList<>();
511 LOG.debug("DBRead Get {} : {}", coreData.getMountpoint(), myName, lp.getUuid());
513 UniversalId ethContainerPacuuId = lp.getUuid();
514 // Step 2.2: construct data and the relative iid
515 InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
516 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
517 .child(EthernetContainerHistoricalPerformances.class).build();
519 // Step 2.3: read to the config data store
520 EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = genericTransactionUtils
521 .readData(coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
523 if (ethContainerHistoricalPerformanceData == null) {
524 LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
527 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.ethernet.container.historical.performances.g.HistoricalPerformanceDataList
528 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataList
529 List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = ethContainerHistoricalPerformanceData
530 .nonnullHistoricalPerformanceDataList();
531 LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
532 for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
533 resultList.add(pmRecord);
536 LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, resultList.size());
541 public void onObjectCreationNotification(ObjectCreationNotification notification) {
542 LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
543 if (notification != null) {
544 ObjectCreationNotificationXml notificationXml = new ObjectCreationNotificationXml(coreData.getMountpoint(),
545 notification.getCounter(), InternalDateAndTime.valueOf(notification.getTimeStamp()),
546 notification.getObjectIdRef().getValue());
547 microwaveModelListener.onObjectCreationNotification(notificationXml);
554 public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
555 LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
557 ObjectDeletionNotificationXml notificationXml = new ObjectDeletionNotificationXml(coreData.getMountpoint(),
558 notification.getCounter(),
559 InternalDateAndTime.valueOf(notification.getTimeStamp()),
560 notification.getObjectIdRef().getValue()
562 microwaveModelListener.onObjectDeletionNotification(notificationXml);
566 public void onProblemNotification(ProblemNotification notification) {
568 LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
570 ProblemNotificationXml notificationXml = new ProblemNotificationXml(coreData.getMountpoint(), notification.getObjectIdRef().getValue(),
571 notification.getProblem(), InternalSeverity.valueOf(notification.getSeverity()),
572 notification.getCounter(), InternalDateAndTime.valueOf(notification.getTimeStamp()));
574 microwaveModelListener.onProblemNotification(notificationXml);
578 public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
579 LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
581 AttributeValueChangedNotificationXml notificationXml = new AttributeValueChangedNotificationXml(coreData.getMountpoint(),
582 notification.getCounter(), InternalDateAndTime.valueOf(notification.getTimeStamp()),
583 notification.getObjectIdRef().getValue(), notification.getAttributeName(), notification.getNewValue());
585 microwaveModelListener.onAttributeValueChangedNotification(notificationXml);
588 private static String getUuid(Lp lp) {
589 UniversalId uuid = lp.getUuid();
590 return uuid != null ? uuid.getValue() : null;