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.netconf.wrapperc;
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
25 import java.lang.reflect.Constructor;
26 import java.lang.reflect.InvocationTargetException;
27 import java.util.ArrayList;
28 import java.util.List;
30 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
31 import org.opendaylight.yangtools.yang.binding.NotificationListener;
32 import org.opendaylight.yangtools.yang.common.QName;
33 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime;
34 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity;
35 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.ONFCOreNetworkElementCoreData;
36 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.ONFCoreNetworkElement12;
37 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ExtendedAirInterfaceHistoricalPerformanceType1211p;
38 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ONFLayerProtocolName;
39 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.GenericTransactionUtils;
40 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.AttributeValueChangedNotificationXml;
41 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectCreationNotificationXml;
42 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectDeletionNotificationXml;
43 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
44 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
46 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
47 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG;
48 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
49 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceCurrentProblemTypeG;
50 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceDiversityCurrentProblemTypeG;
51 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceHistoricalPerformanceTypeG;
52 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ContainerCurrentProblemTypeG;
53 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ContainerHistoricalPerformanceTypeG;
54 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MicrowaveModelListener;
55 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfaceDiversityPac;
56 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfaceDiversityPacKey;
57 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfacePac;
58 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfacePacKey;
59 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwEthernetContainerPac;
60 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwEthernetContainerPacKey;
61 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwHybridMwStructurePac;
62 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwHybridMwStructurePacKey;
63 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwPureEthernetStructurePac;
64 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwPureEthernetStructurePacKey;
65 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwTdmContainerPac;
66 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwTdmContainerPacKey;
67 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.StructureCurrentProblemTypeG;
68 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
69 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceConfiguration;
70 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceCurrentProblems;
71 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
72 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
73 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
74 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
75 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
76 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.tdm.container.pac.TdmContainerCurrentProblems;
77 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AttributeValueChangedNotification;
78 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ObjectCreationNotification;
79 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ObjectDeletionNotification;
80 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ProblemNotification;
83 public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, MicrowaveModelListener {
85 private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElement12.class);
87 public static final QName QNAME = MwAirInterfacePac.QNAME;
90 private ONFCOreNetworkElementCoreData coreData;
92 private OnfMicrowaveModelNotification microwaveModelListener;
94 /*-----------------------------------------------------------------------------
98 public void setCoreData(ONFCOreNetworkElementCoreData coreData) {
99 this.coreData = coreData;
102 public ONFCOreNetworkElementCoreData getCoreData() {
107 public void setOnfMicrowaveModelListener(OnfMicrowaveModelNotification microwaveModelListener) {
108 this.microwaveModelListener = microwaveModelListener;
111 @SuppressWarnings("unchecked")
113 public <T extends NotificationListener> T getNotificationListener() {
117 /*-----------------------------------------------------------------------------
121 public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
122 List<ProblemNotificationXml> resultList) {
126 readTheFaultsOfMwAirInterfacePac(uuid, resultList);
129 case EthernetContainer12:
130 readTheFaultsOfMwEthernetContainerPac(uuid, resultList);
134 readTheFaultsOfMwTdmContainerPac(uuid, resultList);
138 if (lpClass == MwHybridMwStructurePac.class) {
139 readTheFaultsOfMwHybridMwStructurePac(uuid, resultList);
141 } else if (lpClass == MwAirInterfaceDiversityPac.class) {
142 readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList);
144 } else if (lpClass == MwPureEthernetStructurePac.class) {
145 readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList);
148 LOG.warn("Unassigned lp model {} class {}", lpName, lpClass);
152 // No alarms supported
154 case EthernetContainer10:
156 LOG.warn("Unassigned or not expected lp in model {}", lpName);
160 public List<? extends OtnHistoryDataG> readTheHistoricalPerformanceData(ONFLayerProtocolName lpName, Lp lp) {
163 return readTheHistoricalPerformanceDataOfMwAirInterfacePac(lp);
165 case EthernetContainer12:
166 return readTheHistoricalPerformanceDataOfEthernetContainer(lp);
168 case EthernetContainer10:
169 case EthernetPhysical:
174 LOG.debug("Do not read HistoricalPM data for {} {}", lpName, lp.getUuid().getValue());
177 return new ArrayList<>();
180 public Class<?> getClassForLtpExtension(QName qName) {
182 if (qName.equals(MwAirInterfacePac.QNAME)) {
183 res = MwAirInterfacePac.class;
184 } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
185 res = MwAirInterfaceDiversityPac.class;
186 } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
187 res = MwPureEthernetStructurePac.class;
188 } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
189 res = MwHybridMwStructurePac.class;
190 } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
191 res = MwEthernetContainerPac.class;
192 } else if (qName.equals(MwTdmContainerPac.QNAME)) {
193 res = MwTdmContainerPac.class;
195 LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
199 /*-----------------------------------------------------------------------------
200 * Reading problems for specific interface pacs
204 * Read problems of specific interfaces
206 * @param uuId Universal Id String of the interface
207 * @return number of alarms
209 private List<ProblemNotificationXml> readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid,
210 List<ProblemNotificationXml> resultList) {
212 final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
213 // final Class<MwAirInterfacePacKey> clazzPacKey = MwAirInterfacePacKey.class;
214 // final Class<AirInterfaceCurrentProblems> clazzProblems =
215 // AirInterfaceCurrentProblems.class;
216 // final Class<AirInterfaceCurrentProblemTypeG> clazzProblem =
217 // AirInterfaceCurrentProblemTypeG.class;
219 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
220 coreData.getMountpoint(), interfacePacUuid.getValue());
222 // Step 2.2: construct data and the relative iid
223 InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID = InstanceIdentifier
224 .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
225 .child(AirInterfaceCurrentProblems.class).build();
227 // Step 2.3: read to the config data store
228 AirInterfaceCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
229 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
231 if (problems == null) {
232 LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
233 } else if (problems.getCurrentProblemList() == null) {
234 LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid);
236 for (AirInterfaceCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
237 resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
238 problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
239 problem.getSequenceNumber().toString(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
246 * Read problems of specific interfaces
248 * @param uuId Universal index of Interfacepac
249 * @return number of alarms
251 private List<ProblemNotificationXml> readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid,
252 List<ProblemNotificationXml> resultList) {
254 final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
255 // final Class<MwEthernetContainerPacKey> clazzPacKey =
256 // MwEthernetContainerPacKey.class;
257 // final Class<EthernetContainerCurrentProblems> clazzProblems =
258 // EthernetContainerCurrentProblems.class;
259 // final Class<ContainerCurrentProblemTypeG> clazzProblem =
260 // ContainerCurrentProblemTypeG.class;
262 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
263 coreData.getMountpoint(), interfacePacUuid.getValue());
265 InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
266 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
267 .child(EthernetContainerCurrentProblems.class).build();
269 EthernetContainerCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
270 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
271 if (problems == null) {
272 LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
273 } else if (problems.getCurrentProblemList() == null) {
274 LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
276 for (ContainerCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
277 resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
278 problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
279 problem.getSequenceNumber().toString(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
286 * Read problems of specific interfaces
288 * @param uuId Universal index of Interfacepac
289 * @return number of alarms
291 private List<ProblemNotificationXml> readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid,
292 List<ProblemNotificationXml> resultList) {
294 final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
295 // final Class<MwAirInterfaceDiversityPacKey> clazzPacKey =
296 // MwAirInterfaceDiversityPacKey.class;
297 final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
298 // final Class<AirInterfaceDiversityCurrentProblemTypeG> clazzProblem =
299 // AirInterfaceDiversityCurrentProblemTypeG.class;
301 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
302 coreData.getMountpoint(), interfacePacUuid.getValue());
304 InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
305 .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
307 AirInterfaceDiversityCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
308 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
309 if (problems == null) {
310 LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
311 } else if (problems.getCurrentProblemList() == null) {
312 LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid);
314 for (AirInterfaceDiversityCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
315 resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
316 problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
317 problem.getSequenceNumber().toString(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
324 * Read problems of specific interfaces
326 * @param uuId Universal index of Interfacepac
327 * @return number of alarms
329 private List<ProblemNotificationXml> readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid,
330 List<ProblemNotificationXml> resultList) {
332 final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
333 // final Class<MwPureEthernetStructurePacKey> clazzPacKey =
334 // MwPureEthernetStructurePacKey.class;
335 final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
336 // final Class<StructureCurrentProblemTypeG> clazzProblem =
337 // StructureCurrentProblemTypeG.class;
339 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
340 coreData.getMountpoint(), interfacePacUuid.getValue());
342 InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
343 .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
345 PureEthernetStructureCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
346 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
347 if (problems == null) {
348 LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
349 } else if (problems.getCurrentProblemList() == null) {
350 LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
352 for (StructureCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
353 resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
354 problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
355 problem.getSequenceNumber().toString(), 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);
387 } else if (problems.getCurrentProblemList() == null) {
388 LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
390 for (StructureCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
391 resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
392 problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
393 problem.getSequenceNumber().toString(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
400 * Read problems of specific interfaces. TODO Goal for future implementation
401 * without usage of explicit new. Key is generated by newInstance() function
402 * here to verify this approach.
404 * @param uuId Universal index of Interfacepac
405 * @return number of alarms
406 * @throws SecurityException
407 * @throws NoSuchMethodException
408 * @throws InvocationTargetException
409 * @throws IllegalArgumentException
410 * @throws IllegalAccessException
411 * @throws InstantiationException
413 private List<ProblemNotificationXml> readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid,
414 List<ProblemNotificationXml> resultList) {
416 final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
417 final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
418 final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
419 // final Class<ContainerCurrentProblemTypeG> clazzProblem =
420 // ContainerCurrentProblemTypeG.class;
422 LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
423 coreData.getMountpoint(), interfacePacUuid.getValue());
426 // -- Specific part 1
427 Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
428 InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
429 .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
431 // -- Specific part 2
432 TdmContainerCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
433 LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
434 if (problems == null) {
435 LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
436 } else if (problems.getCurrentProblemList() == null) {
437 LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
439 // -- Specific part 3
440 for (ContainerCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
441 resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
442 problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
443 problem.getSequenceNumber().toString(),
444 InternalDateAndTime.valueOf(problem.getTimeStamp())));
447 } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
448 | IllegalArgumentException | InvocationTargetException e) {
449 LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
454 /*-----------------------------------------------------------------------------
455 * Performance related data
459 * PM MwAirInterfacePac
464 private List<ExtendedAirInterfaceHistoricalPerformanceType1211p> readTheHistoricalPerformanceDataOfMwAirInterfacePac(
467 String uuId = lp.getUuid().getValue();
469 List<ExtendedAirInterfaceHistoricalPerformanceType1211p> resultList = new ArrayList<>();
470 LOG.debug("DBRead Get {} MWAirInterfacePac: {}", coreData.getMountpoint(), uuId);
472 UniversalId mwAirInterfacePacuuId = new UniversalId(uuId);
473 // Step 2.1: construct data and the relative iid
474 InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = InstanceIdentifier
475 .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
476 .child(AirInterfaceConfiguration.class).build();
477 AirInterfaceConfiguration airConfiguration = GenericTransactionUtils.readData(coreData.getDataBroker(),
478 LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
480 if (airConfiguration == null) {
481 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
484 // Step 2.2: construct data and the relative iid
485 InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = InstanceIdentifier
486 .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
487 .child(AirInterfaceHistoricalPerformances.class).build();
489 // Step 2.3: read to the config data store
490 AirInterfaceHistoricalPerformances airHistoricalPerformanceData = GenericTransactionUtils.readData(
491 coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
493 if (airHistoricalPerformanceData == null) {
494 LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
495 mwAirInterfacePacuuId);
497 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
498 List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = airHistoricalPerformanceData
499 .getHistoricalPerformanceDataList();
500 LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
501 airHistPMList.size());
502 if (airHistPMList != null) {
503 for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistoricalPerformanceData
504 .getHistoricalPerformanceDataList()) {
505 resultList.add(new ExtendedAirInterfaceHistoricalPerformanceType1211p(pmRecord, airConfiguration));
510 LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, resultList.size());
514 private List<ContainerHistoricalPerformanceTypeG> readTheHistoricalPerformanceDataOfEthernetContainer(Lp lp) {
516 final String myName = "MWEthernetContainerPac";
517 String uuId = lp.getUuid().getValue();
519 List<ContainerHistoricalPerformanceTypeG> resultList = new ArrayList<>();
520 LOG.debug("DBRead Get {} : {}", coreData.getMountpoint(), myName, uuId);
522 UniversalId ethContainerPacuuId = new UniversalId(uuId);
523 // Step 2.2: construct data and the relative iid
524 InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
525 .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
526 .child(EthernetContainerHistoricalPerformances.class).build();
528 // Step 2.3: read to the config data store
529 EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = GenericTransactionUtils
530 .readData(coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
532 if (ethContainerHistoricalPerformanceData == null) {
533 LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
536 // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.ethernet.container.historical.performances.g.HistoricalPerformanceDataList
537 List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = ethContainerHistoricalPerformanceData
538 .getHistoricalPerformanceDataList();
539 LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
540 if (airHistPMList != null) {
541 for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
542 resultList.add(pmRecord);
546 LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, resultList.size());
550 public void onObjectCreationNotification(ObjectCreationNotification notification) {
551 LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
553 ObjectCreationNotificationXml notificationXml = new ObjectCreationNotificationXml(coreData.getMountpoint(),
554 notification.getCounter().toString(),
555 InternalDateAndTime.valueOf(notification.getTimeStamp()),
556 notification.getObjectIdRef().getValue());
557 microwaveModelListener.onObjectCreationNotification(notificationXml);
561 public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
562 LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
564 ObjectDeletionNotificationXml notificationXml = new ObjectDeletionNotificationXml(coreData.getMountpoint(),
565 notification.getCounter().toString(),
566 InternalDateAndTime.valueOf(notification.getTimeStamp()),
567 notification.getObjectIdRef().getValue()
569 microwaveModelListener.onObjectDeletionNotification(notificationXml);
572 public void onProblemNotification(ProblemNotification notification) {
574 LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
576 ProblemNotificationXml notificationXml = new ProblemNotificationXml(coreData.getMountpoint(), notification.getObjectIdRef().getValue(),
577 notification.getProblem(), InternalSeverity.valueOf(notification.getSeverity()),
578 notification.getCounter().toString(), InternalDateAndTime.valueOf(notification.getTimeStamp()));
580 microwaveModelListener.onProblemNotification(notificationXml);
584 public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
585 LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
587 AttributeValueChangedNotificationXml notificationXml = new AttributeValueChangedNotificationXml(coreData.getMountpoint(),
588 String.valueOf(notification.getCounter()), InternalDateAndTime.valueOf(notification.getTimeStamp()),
589 notification.getObjectIdRef().getValue(), notification.getAttributeName(), notification.getNewValue());
591 microwaveModelListener.onAttributeValueChangedNotification(notificationXml);