2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt
4 * =================================================================================================
5 * Copyright (C) 2020 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.onf14.impl;
20 import java.util.ArrayList;
21 import java.util.Collection;
22 import java.util.List;
23 import java.util.Optional;
24 import org.eclipse.jdt.annotation.NonNull;
25 import org.eclipse.jdt.annotation.Nullable;
26 import org.onap.ccsdk.features.sdnr.wt.common.YangHelper;
27 import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
28 import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
29 import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElementService;
30 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.dataprovider.Onf14ToInternalDataModel;
31 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14AirInterface;
32 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14AirInterfaceNotificationListener;
33 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14EthernetContainer;
34 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14EthernetContainerNotificationListener;
35 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14WireInterface;
36 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14WireInterfaceNotificationListener;
37 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
38 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
39 import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData;
40 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
41 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
42 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
43 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNotifications;
44 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
45 import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.LAYERPROTOCOLNAMETYPEAIRLAYER;
46 import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.air._interface.lp.spec.AirInterfacePac;
47 import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.air._interface.pac.AirInterfaceCurrentProblems;
48 import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.ControlConstruct;
49 import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.LAYERPROTOCOLNAMETYPE;
50 import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.UniversalId;
51 import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.control.construct.Equipment;
52 import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.control.construct.EquipmentKey;
53 import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.control.construct.LogicalTerminationPoint;
54 import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.control.construct.LogicalTerminationPointKey;
55 import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.equipment.ContainedHolder;
56 import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.logical.termination.point.LayerProtocol;
57 import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.logical.termination.point.LayerProtocolKey;
58 import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.LAYERPROTOCOLNAMETYPEETHERNETCONTAINERLAYER;
59 import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.ethernet.container.lp.spec.EthernetContainerPac;
60 import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.ethernet.container.pac.EthernetContainerCurrentProblems;
61 import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.LAYERPROTOCOLNAMETYPEWIRELAYER;
62 import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.wire._interface.lp.spec.WireInterfacePac;
63 import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.wire._interface.pac.WireInterfaceCurrentProblems;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementConnectionBuilder;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementDeviceType;
67 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
68 import org.opendaylight.yangtools.concepts.ListenerRegistration;
69 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
70 import org.opendaylight.yangtools.yang.binding.NotificationListener;
71 import org.opendaylight.yangtools.yang.common.QName;
72 import org.slf4j.Logger;
73 import org.slf4j.LoggerFactory;
76 * Repesentation of ONF Core model 1.4 device Top level element is "ControlConstruct" (replaces "NetworkElement" of
79 public class Onf14NetworkElement implements NetworkElement {
81 private static final Logger log = LoggerFactory.getLogger(Onf14NetworkElement.class);
83 protected static final InstanceIdentifier<ControlConstruct> CONTROLCONSTRUCT_IID =
84 InstanceIdentifier.builder(ControlConstruct.class).build();
86 private static final int EQUIPMENTROOTLEVEL = 0;
88 private final NetconfBindingAccessor netconfAccessor;
89 private final DataProvider databaseService;
90 private final Onf14ToInternalDataModel onf14Mapper;
91 private final @NonNull FaultService faultService;
93 // for storing the Equipment UUIDs that are inserted in the DB
94 private final List<String> equipmentUuidList = new ArrayList<String>();
96 // air interface related members
97 private final List<TechnologySpecificPacKeys> airInterfaceList = new ArrayList<TechnologySpecificPacKeys>();
98 @SuppressWarnings("unused")
99 private ListenerRegistration<NotificationListener> airInterfaceNotificationListenerHandler;
100 private @NonNull final Onf14AirInterfaceNotificationListener airInterfaceNotificationListener;
102 // ethernet container related members
103 private final List<TechnologySpecificPacKeys> ethernetContainerList = new ArrayList<TechnologySpecificPacKeys>();
104 @SuppressWarnings("unused")
105 private ListenerRegistration<NotificationListener> etherneContainerNotificationListenerHandler;
106 private @NonNull final Onf14EthernetContainerNotificationListener ethernetContainerNotificationListener;
108 // wire interface related members
109 private final List<TechnologySpecificPacKeys> wireInterfaceList = new ArrayList<TechnologySpecificPacKeys>();
110 @SuppressWarnings("unused")
111 private ListenerRegistration<NotificationListener> wireInterfaceNotificationListenerHandler;
112 private @NonNull final Onf14WireInterfaceNotificationListener wireInterfaceNotificationListener;
114 Onf14NetworkElement(NetconfBindingAccessor netconfAccess, DeviceManagerServiceProvider serviceProvider) {
115 log.info("Create {}", Onf14NetworkElement.class.getSimpleName());
116 this.netconfAccessor = netconfAccess;
117 this.databaseService = serviceProvider.getDataProvider();
118 this.faultService = serviceProvider.getFaultService();
119 this.onf14Mapper = new Onf14ToInternalDataModel();
120 this.airInterfaceNotificationListenerHandler = null;
121 this.airInterfaceNotificationListener = new Onf14AirInterfaceNotificationListener(netconfAccess, serviceProvider);
122 this.etherneContainerNotificationListenerHandler = null;
123 ethernetContainerNotificationListener =
124 new Onf14EthernetContainerNotificationListener(netconfAccess, serviceProvider);
125 this.wireInterfaceNotificationListenerHandler = null;
126 wireInterfaceNotificationListener = new Onf14WireInterfaceNotificationListener(netconfAccess, serviceProvider);
129 public void initialReadFromNetworkElement() {
131 // reading the inventory (CoreModel 1.4 Equipment Model) and adding it to the DB
134 FaultData resultList = new FaultData();
136 int problems = faultService.removeAllCurrentProblemsOfNode(netconfAccessor.getNodeId());
137 log.debug("Removed all {} problems from database at registration", problems);
139 readAllAirInterfaceCurrentProblems(resultList);
140 problems = resultList.size();
141 log.debug("NETCONF read air interface current problems completed. Got back {} problems.", problems);
143 readAllEhernetContainerCurrentProblems(resultList);
144 problems = resultList.size() - problems;
145 log.debug("NETCONF read current problems completed. Got back {} problems.", resultList.size());
147 readAllWireInterfaceCurrentProblems(resultList);
148 problems = resultList.size();
149 log.debug("NETCONF read wire interface current problems completed. Got back {} problems.", problems);
151 faultService.initCurrentProblemStatus(netconfAccessor.getNodeId(), resultList);
152 log.debug("DB write current problems completed");
156 public void readAllAirInterfaceCurrentProblems(FaultData resultList) {
158 int idxStart; // Start index for debug messages
160 for (TechnologySpecificPacKeys key : airInterfaceList) {
161 idxStart = resultList.size();
163 readAirInterfaceCurrentProblemForLtp(key.getLtpUuid(), key.getLocalId(), resultList);
164 debugResultList(key.getLtpUuid().getValue(), resultList, idxStart);
168 public void readAllEhernetContainerCurrentProblems(FaultData resultList) {
170 int idxStart; // Start index for debug messages
172 for (TechnologySpecificPacKeys key : ethernetContainerList) {
173 idxStart = resultList.size();
175 readEthernetConainerCurrentProblemForLtp(key.getLtpUuid(), key.getLocalId(), resultList);
176 debugResultList(key.getLtpUuid().getValue(), resultList, idxStart);
180 public void readAllWireInterfaceCurrentProblems(FaultData resultList) {
182 int idxStart; // Start index for debug messages
184 for (TechnologySpecificPacKeys key : wireInterfaceList) {
185 idxStart = resultList.size();
187 readWireInterfaceCurrentProblemForLtp(key.getLtpUuid(), key.getLocalId(), resultList);
188 debugResultList(key.getLtpUuid().getValue(), resultList, idxStart);
194 * set core-model-capability
196 public void setCoreModel(@NonNull NetconfNode nNode) {
197 NetworkElementConnectionBuilder eb = new NetworkElementConnectionBuilder();
198 log.info("In setCoreModel for Onf14NetworkElement");
199 String namespaceRevision;
200 QName QNAME_COREMODEL14 = QName.create("urn:onf:yang:core-model-1-4", "2019-11-27", "core-model-1-4").intern();
202 Capabilities availableCapabilities = Capabilities.getAvailableCapabilities(nNode);
203 namespaceRevision = availableCapabilities.getRevisionForNamespace(QNAME_COREMODEL14);
204 log.info("In setCoreModel for Onf14NetworkElement- namespaceRevision = "+namespaceRevision);
205 if (Capabilities.isNamespaceSupported(namespaceRevision)) {
206 eb.setCoreModelCapability(namespaceRevision);
208 eb.setCoreModelCapability("Unsupported");
210 databaseService.updateNetworkConnection22(eb.build(), netconfAccessor.getNodeId().getValue());
214 public void register() {
215 // Set core-model revision value in "core-model-capability" field
216 setCoreModel(netconfAccessor.getNetconfNode());
217 initialReadFromNetworkElement();
219 // Register netconf stream
220 airInterfaceNotificationListenerHandler =
221 netconfAccessor.doRegisterNotificationListener(airInterfaceNotificationListener);
222 etherneContainerNotificationListenerHandler =
223 netconfAccessor.doRegisterNotificationListener(ethernetContainerNotificationListener);
224 wireInterfaceNotificationListenerHandler =
225 netconfAccessor.doRegisterNotificationListener(wireInterfaceNotificationListener);
226 Optional<NetconfNotifications> notificationsSupport = netconfAccessor.getNotificationAccessor();
227 if (notificationsSupport.isPresent()) {
228 notificationsSupport.get().registerNotificationsStream(NetconfBindingAccessor.DefaultNotificationsStream);
233 public void deregister() {}
237 public NodeId getNodeId() {
238 return netconfAccessor.getNodeId();
242 public <L extends NetworkElementService> Optional<L> getService(Class<L> clazz) {
243 return Optional.empty();
247 public void warmstart() {}
250 public Optional<NetconfAccessor> getAcessor() {
251 return Optional.of(netconfAccessor);
255 public NetworkElementDeviceType getDeviceType() {
256 return NetworkElementDeviceType.Wireless;
259 private void readEquipmentData() {
261 Optional<ControlConstruct> controlConstruct = readControlConstruct(netconfAccessor);
263 if (controlConstruct.isPresent()) {
264 // the top-level-equipment list contains the root objects of the Equipment Model
265 log.debug("Getting list of topLevelEquipment for mountpoint {}", netconfAccessor.getNodeId());
267 List<UniversalId> topLevelEquipment = controlConstruct.get().getTopLevelEquipment();
269 if (topLevelEquipment != null) {
270 for (UniversalId uuid : topLevelEquipment) {
271 log.debug("Got back topLevelEquipment with uuid {}", uuid.getValue());
273 // adding all root Equipment objects to the DB
275 Equipment equipmentInstance = readEquipmentInstance(netconfAccessor, uuid);
276 if (equipmentInstance != null) {
277 // recursively adding the root equipment and all its children into the DB
278 addEquipmentToDb(equipmentInstance, null, EQUIPMENTROOTLEVEL);
284 // storing all the LTP UUIDs internally, for later usage, for air-interface and ethernet-container
285 readKeys(controlConstruct);
288 private void addEquipmentToDb(Equipment currentEq, Equipment parentEq, long treeLevel) {
290 // if the Equipment UUID is already in the list, it was already processed
291 // needed for solving possible circular dependencies
292 if (equipmentUuidList.contains(currentEq.getUuid().getValue())) {
293 log.debug("Not adding equipment with uuid {} because it was aleady added...",
294 currentEq.getUuid().getValue());
298 // we add this to our internal list, such that we avoid circular dependencies
299 equipmentUuidList.add(currentEq.getUuid().getValue());
300 log.debug("Adding equipment with uuid {} to the database...", currentEq.getUuid().getValue());
302 // we add our current equipment to the database
303 databaseService.writeInventory(
304 onf14Mapper.getInternalEquipment(netconfAccessor.getNodeId(), currentEq, parentEq, treeLevel));
306 // we iterate the kids of our current equipment and add them to the database recursively
307 // the actual reference is here: /core-model:control-construct/equipment/contained-holder/occupying-fru
309 Collection<ContainedHolder> holderList = YangHelper.getCollection(currentEq.nonnullContainedHolder());
311 for (ContainedHolder holder : holderList) {
313 UniversalId occupyingFru = holder.getOccupyingFru();
314 if (occupyingFru != null) {
316 Equipment childEq = readEquipmentInstance(netconfAccessor, occupyingFru);
318 if (childEq != null) {
319 // current becomes parent and tree level increases by 1
320 addEquipmentToDb(childEq, currentEq, treeLevel + 1);
326 private void readKeys(Optional<ControlConstruct> controlConstruct) {
328 if (controlConstruct.isPresent()) {
330 Collection<LogicalTerminationPoint> ltpList = YangHelper.getCollection(controlConstruct.get().nonnullLogicalTerminationPoint());
331 log.debug("Iterating the LTP list for node {}", netconfAccessor.getNodeId().getValue());
333 // iterating all the Logical Termination Point list
334 for (LogicalTerminationPoint ltp : ltpList) {
336 List<LayerProtocol> lpList = YangHelper.getList(ltp.nonnullLayerProtocol());
337 // the Layer Protocol list should contain only one item, since we have an 1:1 relationship between the LTP and the LP
338 if (lpList.size() != 1) {
339 log.debug("Layer protocol has no 1:1 relationship with the LTP.");
342 // accessing the LP, which should be only 1
343 LayerProtocol lp = lpList.get(0);
345 Class<? extends LAYERPROTOCOLNAMETYPE> layerProtocolName = lp.getLayerProtocolName();
346 if (layerProtocolName != null) {
347 // if the LTP has an airInterface technology extension, the layer protocol name is air-layer
348 if (layerProtocolName.getTypeName() == LAYERPROTOCOLNAMETYPEAIRLAYER.class.getName()) {
349 TechnologySpecificPacKeys airInterfaceKey =
350 new TechnologySpecificPacKeys(ltp.getUuid(), lp.getLocalId());
351 airInterfaceList.add(airInterfaceKey);
352 log.debug("Adding Ltp with uuid {} and local-id {} to the air-interface list",
353 ltp.getUuid().getValue(), lp.getLocalId());
355 // if the LTP has an ethernetContainier technology extension, the layer protocol name is ethernet-container-layer
356 else if (layerProtocolName.getTypeName() == LAYERPROTOCOLNAMETYPEETHERNETCONTAINERLAYER.class
358 TechnologySpecificPacKeys ethernetContainerKey =
359 new TechnologySpecificPacKeys(ltp.getUuid(), lp.getLocalId());
360 ethernetContainerList.add(ethernetContainerKey);
361 log.debug("Adding Ltp with uuid {} and local-id {} to the ethernet-contatinier list",
362 ltp.getUuid().getValue(), lp.getLocalId());
363 } else if (layerProtocolName.getTypeName() == LAYERPROTOCOLNAMETYPEWIRELAYER.class.getName()) {
364 TechnologySpecificPacKeys wireInterfaceKey =
365 new TechnologySpecificPacKeys(ltp.getUuid(), lp.getLocalId());
366 wireInterfaceList.add(wireInterfaceKey);
367 log.debug("Adding Ltp with uuid {} and local-id {} to the wire-interface list",
368 ltp.getUuid().getValue(), lp.getLocalId());
375 private void readAirInterfaceCurrentProblemForLtp(UniversalId ltpUuid, String localId, FaultData resultList) {
377 final Class<AirInterfacePac> clazzPac = AirInterfacePac.class;
379 log.info("DBRead Get current problems for class {} from mountpoint {} for LTP uuid {} and local-id {}",
380 clazzPac.getSimpleName(), netconfAccessor.getNodeId().getValue(), ltpUuid.getValue(), localId);
382 // constructing the IID needs the augmentation exposed byy the air-interface-2-0 model
383 InstanceIdentifier<AirInterfaceCurrentProblems> airInterfaceCurrentProblem_IID = InstanceIdentifier
384 .builder(ControlConstruct.class)
385 .child(LogicalTerminationPoint.class, new LogicalTerminationPointKey(ltpUuid))
386 .child(LayerProtocol.class, new LayerProtocolKey(localId))
388 org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.LayerProtocol1.class)
389 .child(AirInterfacePac.class).child(AirInterfaceCurrentProblems.class).build();
391 // reading all the current-problems list for this specific LTP and LP
392 AirInterfaceCurrentProblems problems = netconfAccessor.getTransactionUtils().readData(
393 netconfAccessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, airInterfaceCurrentProblem_IID);
395 if (problems == null) {
396 log.debug("DBRead Id {} no AirInterfaceCurrentProblems", ltpUuid);
397 } else if (problems.getCurrentProblemList() == null) {
398 log.debug("DBRead Id {} empty CurrentProblemList", ltpUuid);
400 for (org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.air._interface.current.problems.CurrentProblemList problem : YangHelper.getCollection(problems
401 .nonnullCurrentProblemList())) {
402 resultList.add(netconfAccessor.getNodeId(), (int) problem.getSequenceNumber(), problem.getTimestamp(),
403 ltpUuid.getValue(), problem.getProblemName(),
404 Onf14AirInterface.mapSeverity(problem.getProblemSeverity()));
409 private void readEthernetConainerCurrentProblemForLtp(UniversalId ltpUuid, String localId, FaultData resultList) {
411 final Class<EthernetContainerPac> clazzPac = EthernetContainerPac.class;
413 log.info("DBRead Get current problems for class {} from mountpoint {} for LTP uuid {} and local-id {}",
414 clazzPac.getSimpleName(), netconfAccessor.getNodeId().getValue(), ltpUuid.getValue(), localId);
416 // constructing the IID needs the augmentation exposed by the ethernet-container-2-0 model
417 InstanceIdentifier<EthernetContainerCurrentProblems> etherneContainerCurrentProblem_IID = InstanceIdentifier
418 .builder(ControlConstruct.class)
419 .child(LogicalTerminationPoint.class, new LogicalTerminationPointKey(ltpUuid))
420 .child(LayerProtocol.class, new LayerProtocolKey(localId))
422 org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.LayerProtocol1.class)
423 .child(EthernetContainerPac.class).child(EthernetContainerCurrentProblems.class).build();
425 // reading all the current-problems list for this specific LTP and LP
426 EthernetContainerCurrentProblems problems = netconfAccessor.getTransactionUtils().readData(
427 netconfAccessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, etherneContainerCurrentProblem_IID);
429 if (problems == null) {
430 log.debug("DBRead Id {} no EthernetContainerCurrentProblems", ltpUuid);
431 } else if (problems.getCurrentProblemList() == null) {
432 log.debug("DBRead Id {} empty CurrentProblemList", ltpUuid);
434 for (org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.ethernet.container.current.problems.CurrentProblemList problem : YangHelper.getCollection(problems
435 .nonnullCurrentProblemList())) {
436 resultList.add(netconfAccessor.getNodeId(), (int) problem.getSequenceNumber(), problem.getTimestamp(),
437 ltpUuid.getValue(), problem.getProblemName(),
438 Onf14EthernetContainer.mapSeverity(problem.getProblemSeverity()));
443 private void readWireInterfaceCurrentProblemForLtp(UniversalId ltpUuid, String localId, FaultData resultList) {
445 final Class<WireInterfacePac> clazzPac = WireInterfacePac.class;
447 log.info("DBRead Get current problems for class {} from mountpoint {} for LTP uuid {} and local-id {}",
448 clazzPac.getSimpleName(), netconfAccessor.getNodeId().getValue(), ltpUuid.getValue(), localId);
450 // constructing the IID needs the augmentation exposed by the wire-interface-2-0 model
451 InstanceIdentifier<WireInterfaceCurrentProblems> wireInterfaceCurrentProblem_IID = InstanceIdentifier
452 .builder(ControlConstruct.class)
453 .child(LogicalTerminationPoint.class, new LogicalTerminationPointKey(ltpUuid))
454 .child(LayerProtocol.class, new LayerProtocolKey(localId))
456 org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.LayerProtocol1.class)
457 .child(WireInterfacePac.class).child(WireInterfaceCurrentProblems.class).build();
459 // reading all the current-problems list for this specific LTP and LP
460 WireInterfaceCurrentProblems problems = netconfAccessor.getTransactionUtils().readData(
461 netconfAccessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, wireInterfaceCurrentProblem_IID);
463 if (problems == null) {
464 log.debug("DBRead Id {} no WireInterfaceCurrentProblems", ltpUuid);
465 } else if (problems.getCurrentProblemList() == null) {
466 log.debug("DBRead Id {} empty CurrentProblemList", ltpUuid);
468 for (org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.wire._interface.current.problems.CurrentProblemList problem : YangHelper.getCollection(problems
469 .nonnullCurrentProblemList())) {
470 resultList.add(netconfAccessor.getNodeId(), (int) problem.getSequenceNumber(), problem.getTimestamp(),
471 ltpUuid.getValue(), problem.getProblemName(),
472 Onf14WireInterface.mapSeverity(problem.getProblemSeverity()));
477 private Optional<ControlConstruct> readControlConstruct(NetconfBindingAccessor netconfAccessor) {
478 return Optional.ofNullable(netconfAccessor.getTransactionUtils().readData(netconfAccessor.getDataBroker(),
479 LogicalDatastoreType.CONFIGURATION, CONTROLCONSTRUCT_IID));
482 private @Nullable Equipment readEquipmentInstance(NetconfBindingAccessor accessData, UniversalId equipmentUuid) {
484 final Class<?> clazzPac = Equipment.class;
486 log.info("DBRead Get equipment for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
487 accessData.getNodeId().getValue(), equipmentUuid.getValue());
489 InstanceIdentifier<Equipment> equipmentIID = InstanceIdentifier.builder(ControlConstruct.class)
490 .child(Equipment.class, new EquipmentKey(equipmentUuid)).build();
492 return accessData.getTransactionUtils().readData(accessData.getDataBroker(), LogicalDatastoreType.CONFIGURATION,
496 // defining a structure that can map the LP local-id and its corresponding LTP uuid
497 private class TechnologySpecificPacKeys {
499 private UniversalId ltpUuid;
500 private String localId;
502 public TechnologySpecificPacKeys(UniversalId uuid, String lId) {
507 public UniversalId getLtpUuid() {
511 public String getLocalId() {
515 @SuppressWarnings("unused")
516 public void setLtpUuid(UniversalId uuid) {
520 @SuppressWarnings("unused")
521 public void setLocalId(String lId) {
528 * LOG the newly added problems of the interface pac
534 private void debugResultList(String uuid, FaultData resultList, int idxStart) {
535 StringBuilder sb = new StringBuilder();
537 for (int t = idxStart; t < resultList.size(); t++) {
540 sb.append(resultList.get(t));
543 log.debug("Found problems {} {}", uuid, sb);