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.opendaylight.mdsal.common.api.LogicalDatastoreType;
44 import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.LAYERPROTOCOLNAMETYPEAIRLAYER;
45 import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.air._interface.lp.spec.AirInterfacePac;
46 import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.air._interface.pac.AirInterfaceCurrentProblems;
47 import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.ControlConstruct;
48 import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.LAYERPROTOCOLNAMETYPE;
49 import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.UniversalId;
50 import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.control.construct.Equipment;
51 import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.control.construct.EquipmentKey;
52 import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.control.construct.LogicalTerminationPoint;
53 import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.control.construct.LogicalTerminationPointKey;
54 import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.equipment.ContainedHolder;
55 import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.logical.termination.point.LayerProtocol;
56 import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.logical.termination.point.LayerProtocolKey;
57 import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.LAYERPROTOCOLNAMETYPEETHERNETCONTAINERLAYER;
58 import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.ethernet.container.lp.spec.EthernetContainerPac;
59 import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.ethernet.container.pac.EthernetContainerCurrentProblems;
60 import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.LAYERPROTOCOLNAMETYPEWIRELAYER;
61 import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.wire._interface.lp.spec.WireInterfacePac;
62 import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.wire._interface.pac.WireInterfaceCurrentProblems;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Inventory;
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;
92 private final FaultService faultService;
94 // for storing the Equipment UUIDs that are inserted in the DB
95 private final List<String> equipmentUuidList = new ArrayList<>();
97 // air interface related members
98 private final List<TechnologySpecificPacKeys> airInterfaceList = new ArrayList<>();
99 @SuppressWarnings("unused")
100 private ListenerRegistration<NotificationListener> airInterfaceNotificationListenerHandler;
102 private final Onf14AirInterfaceNotificationListener airInterfaceNotificationListener;
104 // ethernet container related members
105 private final List<TechnologySpecificPacKeys> ethernetContainerList = new ArrayList<>();
106 @SuppressWarnings("unused")
107 private ListenerRegistration<NotificationListener> etherneContainerNotificationListenerHandler;
109 private final Onf14EthernetContainerNotificationListener ethernetContainerNotificationListener;
111 // wire interface related members
112 private final List<TechnologySpecificPacKeys> wireInterfaceList = new ArrayList<>();
113 @SuppressWarnings("unused")
114 private ListenerRegistration<NotificationListener> wireInterfaceNotificationListenerHandler;
116 private final Onf14WireInterfaceNotificationListener wireInterfaceNotificationListener;
118 Onf14NetworkElement(NetconfBindingAccessor netconfAccess, DeviceManagerServiceProvider serviceProvider) {
119 log.info("Create {}", Onf14NetworkElement.class.getSimpleName());
120 this.netconfAccessor = netconfAccess;
121 this.databaseService = serviceProvider.getDataProvider();
122 this.faultService = serviceProvider.getFaultService();
123 this.onf14Mapper = new Onf14ToInternalDataModel();
124 this.airInterfaceNotificationListenerHandler = null;
125 this.airInterfaceNotificationListener =
126 new Onf14AirInterfaceNotificationListener(netconfAccess, serviceProvider);
127 this.etherneContainerNotificationListenerHandler = null;
128 ethernetContainerNotificationListener =
129 new Onf14EthernetContainerNotificationListener(netconfAccess, serviceProvider);
130 this.wireInterfaceNotificationListenerHandler = null;
131 wireInterfaceNotificationListener = new Onf14WireInterfaceNotificationListener(netconfAccess, serviceProvider);
134 public void initialReadFromNetworkElement() {
136 // reading the inventory (CoreModel 1.4 Equipment Model) and adding it to the DB
139 var resultList = new FaultData();
141 int problems = faultService.removeAllCurrentProblemsOfNode(netconfAccessor.getNodeId());
142 log.debug("Removed all {} problems from database at registration", problems);
144 readAllAirInterfaceCurrentProblems(resultList);
145 problems = resultList.size();
146 log.debug("NETCONF read air interface current problems completed. Got back {} problems.", problems);
148 readAllEhernetContainerCurrentProblems(resultList);
149 problems = resultList.size() - problems;
150 log.debug("NETCONF read current problems completed. Got back {} problems.", resultList.size());
152 readAllWireInterfaceCurrentProblems(resultList);
153 problems = resultList.size();
154 log.debug("NETCONF read wire interface current problems completed. Got back {} problems.", problems);
156 faultService.initCurrentProblemStatus(netconfAccessor.getNodeId(), resultList);
157 log.debug("DB write current problems completed");
161 public void readAllAirInterfaceCurrentProblems(FaultData resultList) {
163 int idxStart; // Start index for debug messages
165 for (TechnologySpecificPacKeys key : airInterfaceList) {
166 idxStart = resultList.size();
168 readAirInterfaceCurrentProblemForLtp(key.getLtpUuid(), key.getLocalId(), resultList);
169 debugResultList(key.getLtpUuid().getValue(), resultList, idxStart);
173 public void readAllEhernetContainerCurrentProblems(FaultData resultList) {
175 int idxStart; // Start index for debug messages
177 for (TechnologySpecificPacKeys key : ethernetContainerList) {
178 idxStart = resultList.size();
180 readEthernetConainerCurrentProblemForLtp(key.getLtpUuid(), key.getLocalId(), resultList);
181 debugResultList(key.getLtpUuid().getValue(), resultList, idxStart);
185 public void readAllWireInterfaceCurrentProblems(FaultData resultList) {
187 int idxStart; // Start index for debug messages
189 for (TechnologySpecificPacKeys key : wireInterfaceList) {
190 idxStart = resultList.size();
192 readWireInterfaceCurrentProblemForLtp(key.getLtpUuid(), key.getLocalId(), resultList);
193 debugResultList(key.getLtpUuid().getValue(), resultList, idxStart);
198 * @param nNode set core-model-capability
200 public void setCoreModel(@NonNull NetconfNode nNode) {
201 NetworkElementConnectionBuilder eb = new NetworkElementConnectionBuilder();
202 log.info("In setCoreModel for Onf14NetworkElement");
203 String namespaceRevision;
204 QName QNAME_COREMODEL14 = QName.create("urn:onf:yang:core-model-1-4", "2019-11-27", "core-model-1-4").intern();
206 Capabilities availableCapabilities = Capabilities.getAvailableCapabilities(nNode);
207 namespaceRevision = availableCapabilities.getRevisionForNamespace(QNAME_COREMODEL14);
208 log.info("In setCoreModel for Onf14NetworkElement- namespaceRevision = " + namespaceRevision);
209 if (Capabilities.isNamespaceSupported(namespaceRevision)) {
210 eb.setCoreModelCapability(namespaceRevision);
212 eb.setCoreModelCapability("Unsupported");
214 databaseService.updateNetworkConnection22(eb.build(), netconfAccessor.getNodeId().getValue());
218 public void register() {
219 // Set core-model revision value in "core-model-capability" field
220 setCoreModel(netconfAccessor.getNetconfNode());
221 initialReadFromNetworkElement();
223 // Register netconf stream
224 airInterfaceNotificationListenerHandler =
225 netconfAccessor.doRegisterNotificationListener(airInterfaceNotificationListener);
226 etherneContainerNotificationListenerHandler =
227 netconfAccessor.doRegisterNotificationListener(ethernetContainerNotificationListener);
228 wireInterfaceNotificationListenerHandler =
229 netconfAccessor.doRegisterNotificationListener(wireInterfaceNotificationListener);
230 // Register to default (NETCONF) stream
231 netconfAccessor.registerNotificationsStream();
235 public void deregister() {}
239 public NodeId getNodeId() {
240 return netconfAccessor.getNodeId();
244 public <L extends NetworkElementService> Optional<L> getService(Class<L> clazz) {
245 return Optional.empty();
249 public void warmstart() {}
252 public Optional<NetconfAccessor> getAcessor() {
253 return Optional.of(netconfAccessor);
257 public NetworkElementDeviceType getDeviceType() {
258 return NetworkElementDeviceType.Wireless;
261 private void readEquipmentData() {
263 Optional<ControlConstruct> controlConstruct = readControlConstruct(netconfAccessor);
265 if (controlConstruct.isPresent()) {
266 // the top-level-equipment list contains the root objects of the Equipment Model
267 log.debug("Getting list of topLevelEquipment for mountpoint {}", netconfAccessor.getNodeId());
269 List<UniversalId> topLevelEquipment = controlConstruct.get().getTopLevelEquipment();
271 if (topLevelEquipment != null) {
272 List<Inventory> inventoryList = new ArrayList<>();
273 for (UniversalId uuid : topLevelEquipment) {
274 log.debug("Got back topLevelEquipment with uuid {}", uuid.getValue());
276 // adding all root Equipment objects to the DB
278 Equipment equipmentInstance = readEquipmentInstance(netconfAccessor, uuid);
279 if (equipmentInstance != null) {
280 // recursively adding the root equipment and all its children into the DB
281 collectEquipment(inventoryList, equipmentInstance, null, EQUIPMENTROOTLEVEL);
284 this.databaseService.writeInventory(this.netconfAccessor.getNodeId().getValue(), inventoryList);
288 // storing all the LTP UUIDs internally, for later usage, for air-interface and ethernet-container
289 readKeys(controlConstruct);
292 private List<Inventory> collectEquipment(List<Inventory> list, Equipment currentEq, Equipment parentEq,
295 // if the Equipment UUID is already in the list, it was already processed
296 // needed for solving possible circular dependencies
297 if (equipmentUuidList.contains(currentEq.getUuid().getValue())) {
298 log.debug("Not adding equipment with uuid {} because it was aleady added...",
299 currentEq.getUuid().getValue());
303 // we add this to our internal list, such that we avoid circular dependencies
304 equipmentUuidList.add(currentEq.getUuid().getValue());
305 log.debug("Adding equipment with uuid {} to the database...", currentEq.getUuid().getValue());
307 // we add our current equipment to the database
308 list.add(onf14Mapper.getInternalEquipment(netconfAccessor.getNodeId(), currentEq, parentEq, treeLevel));
310 // we iterate the kids of our current equipment and add them to the database recursively
311 // the actual reference is here: /core-model:control-construct/equipment/contained-holder/occupying-fru
313 Collection<ContainedHolder> holderList = YangHelper.getCollection(currentEq.nonnullContainedHolder());
315 for (ContainedHolder holder : holderList) {
317 UniversalId occupyingFru = holder.getOccupyingFru();
318 if (occupyingFru != null) {
320 Equipment childEq = readEquipmentInstance(netconfAccessor, occupyingFru);
322 if (childEq != null) {
323 // current becomes parent and tree level increases by 1
324 collectEquipment(list, childEq, currentEq, treeLevel + 1);
331 private void readKeys(Optional<ControlConstruct> controlConstruct) {
333 if (controlConstruct.isPresent()) {
335 Collection<LogicalTerminationPoint> ltpList =
336 YangHelper.getCollection(controlConstruct.get().nonnullLogicalTerminationPoint());
337 log.debug("Iterating the LTP list for node {}", netconfAccessor.getNodeId().getValue());
339 // iterating all the Logical Termination Point list
340 for (LogicalTerminationPoint ltp : ltpList) {
342 List<LayerProtocol> lpList = YangHelper.getList(ltp.nonnullLayerProtocol());
343 // the Layer Protocol list should contain only one item, since we have an 1:1 relationship between the LTP and the LP
344 if (lpList.size() != 1) {
345 log.debug("Layer protocol has no 1:1 relationship with the LTP.");
348 // accessing the LP, which should be only 1
349 LayerProtocol lp = lpList.get(0);
351 Class<? extends LAYERPROTOCOLNAMETYPE> layerProtocolName = lp.getLayerProtocolName();
352 if (layerProtocolName != null) {
353 // if the LTP has an airInterface technology extension, the layer protocol name is air-layer
354 if (layerProtocolName.getTypeName().equals(LAYERPROTOCOLNAMETYPEAIRLAYER.class.getName())) {
355 TechnologySpecificPacKeys airInterfaceKey =
356 new TechnologySpecificPacKeys(ltp.getUuid(), lp.getLocalId());
357 airInterfaceList.add(airInterfaceKey);
358 log.debug("Adding Ltp with uuid {} and local-id {} to the air-interface list",
359 ltp.getUuid().getValue(), lp.getLocalId());
361 // if the LTP has an ethernetContainier technology extension, the layer protocol name is ethernet-container-layer
362 else if (layerProtocolName.getTypeName().equals(LAYERPROTOCOLNAMETYPEETHERNETCONTAINERLAYER.class
364 TechnologySpecificPacKeys ethernetContainerKey =
365 new TechnologySpecificPacKeys(ltp.getUuid(), lp.getLocalId());
366 ethernetContainerList.add(ethernetContainerKey);
367 log.debug("Adding Ltp with uuid {} and local-id {} to the ethernet-contatinier list",
368 ltp.getUuid().getValue(), lp.getLocalId());
369 } else if (layerProtocolName.getTypeName().equals(LAYERPROTOCOLNAMETYPEWIRELAYER.class.getName())) {
370 TechnologySpecificPacKeys wireInterfaceKey =
371 new TechnologySpecificPacKeys(ltp.getUuid(), lp.getLocalId());
372 wireInterfaceList.add(wireInterfaceKey);
373 log.debug("Adding Ltp with uuid {} and local-id {} to the wire-interface list",
374 ltp.getUuid().getValue(), lp.getLocalId());
381 private void readAirInterfaceCurrentProblemForLtp(UniversalId ltpUuid, String localId, FaultData resultList) {
383 final Class<AirInterfacePac> clazzPac = AirInterfacePac.class;
385 log.info("DBRead Get current problems for class {} from mountpoint {} for LTP uuid {} and local-id {}",
386 clazzPac.getSimpleName(), netconfAccessor.getNodeId().getValue(), ltpUuid.getValue(), localId);
388 // constructing the IID needs the augmentation exposed byy the air-interface-2-0 model
389 InstanceIdentifier<AirInterfaceCurrentProblems> airInterfaceCurrentProblem_IID = InstanceIdentifier
390 .builder(ControlConstruct.class)
391 .child(LogicalTerminationPoint.class, new LogicalTerminationPointKey(ltpUuid))
392 .child(LayerProtocol.class, new LayerProtocolKey(localId))
394 org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.LayerProtocol1.class)
395 .child(AirInterfacePac.class).child(AirInterfaceCurrentProblems.class).build();
397 // reading all the current-problems list for this specific LTP and LP
398 AirInterfaceCurrentProblems problems = netconfAccessor.getTransactionUtils().readData(
399 netconfAccessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, airInterfaceCurrentProblem_IID);
401 if (problems == null) {
402 log.debug("DBRead Id {} no AirInterfaceCurrentProblems", ltpUuid);
403 } else if (problems.getCurrentProblemList() == null) {
404 log.debug("DBRead Id {} empty CurrentProblemList", ltpUuid);
406 for (org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.air._interface.current.problems.CurrentProblemList problem : YangHelper
407 .getCollection(problems.nonnullCurrentProblemList())) {
408 resultList.add(netconfAccessor.getNodeId(), (int) problem.getSequenceNumber(), problem.getTimestamp(),
409 ltpUuid.getValue(), problem.getProblemName(),
410 Onf14AirInterface.mapSeverity(problem.getProblemSeverity()));
415 private void readEthernetConainerCurrentProblemForLtp(UniversalId ltpUuid, String localId, FaultData resultList) {
417 final Class<EthernetContainerPac> clazzPac = EthernetContainerPac.class;
419 log.info("DBRead Get current problems for class {} from mountpoint {} for LTP uuid {} and local-id {}",
420 clazzPac.getSimpleName(), netconfAccessor.getNodeId().getValue(), ltpUuid.getValue(), localId);
422 // constructing the IID needs the augmentation exposed by the ethernet-container-2-0 model
423 InstanceIdentifier<EthernetContainerCurrentProblems> etherneContainerCurrentProblem_IID = InstanceIdentifier
424 .builder(ControlConstruct.class)
425 .child(LogicalTerminationPoint.class, new LogicalTerminationPointKey(ltpUuid))
426 .child(LayerProtocol.class, new LayerProtocolKey(localId))
428 org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.LayerProtocol1.class)
429 .child(EthernetContainerPac.class).child(EthernetContainerCurrentProblems.class).build();
431 // reading all the current-problems list for this specific LTP and LP
432 EthernetContainerCurrentProblems problems = netconfAccessor.getTransactionUtils().readData(
433 netconfAccessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, etherneContainerCurrentProblem_IID);
435 if (problems == null) {
436 log.debug("DBRead Id {} no EthernetContainerCurrentProblems", ltpUuid);
437 } else if (problems.getCurrentProblemList() == null) {
438 log.debug("DBRead Id {} empty CurrentProblemList", ltpUuid);
440 for (org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.ethernet.container.current.problems.CurrentProblemList problem : YangHelper
441 .getCollection(problems.nonnullCurrentProblemList())) {
442 resultList.add(netconfAccessor.getNodeId(), (int) problem.getSequenceNumber(), problem.getTimestamp(),
443 ltpUuid.getValue(), problem.getProblemName(),
444 Onf14EthernetContainer.mapSeverity(problem.getProblemSeverity()));
449 private void readWireInterfaceCurrentProblemForLtp(UniversalId ltpUuid, String localId, FaultData resultList) {
451 final Class<WireInterfacePac> clazzPac = WireInterfacePac.class;
453 log.info("DBRead Get current problems for class {} from mountpoint {} for LTP uuid {} and local-id {}",
454 clazzPac.getSimpleName(), netconfAccessor.getNodeId().getValue(), ltpUuid.getValue(), localId);
456 // constructing the IID needs the augmentation exposed by the wire-interface-2-0 model
457 InstanceIdentifier<WireInterfaceCurrentProblems> wireInterfaceCurrentProblem_IID = InstanceIdentifier
458 .builder(ControlConstruct.class)
459 .child(LogicalTerminationPoint.class, new LogicalTerminationPointKey(ltpUuid))
460 .child(LayerProtocol.class, new LayerProtocolKey(localId))
462 org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.LayerProtocol1.class)
463 .child(WireInterfacePac.class).child(WireInterfaceCurrentProblems.class).build();
465 // reading all the current-problems list for this specific LTP and LP
466 WireInterfaceCurrentProblems problems = netconfAccessor.getTransactionUtils().readData(
467 netconfAccessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, wireInterfaceCurrentProblem_IID);
469 if (problems == null) {
470 log.debug("DBRead Id {} no WireInterfaceCurrentProblems", ltpUuid);
471 } else if (problems.getCurrentProblemList() == null) {
472 log.debug("DBRead Id {} empty CurrentProblemList", ltpUuid);
474 for (org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.wire._interface.current.problems.CurrentProblemList problem : YangHelper
475 .getCollection(problems.nonnullCurrentProblemList())) {
476 resultList.add(netconfAccessor.getNodeId(), (int) problem.getSequenceNumber(), problem.getTimestamp(),
477 ltpUuid.getValue(), problem.getProblemName(),
478 Onf14WireInterface.mapSeverity(problem.getProblemSeverity()));
483 private Optional<ControlConstruct> readControlConstruct(NetconfBindingAccessor netconfAccessor) {
484 return Optional.ofNullable(netconfAccessor.getTransactionUtils().readData(netconfAccessor.getDataBroker(),
485 LogicalDatastoreType.CONFIGURATION, CONTROLCONSTRUCT_IID));
488 private @Nullable Equipment readEquipmentInstance(NetconfBindingAccessor accessData, UniversalId equipmentUuid) {
490 final Class<?> clazzPac = Equipment.class;
492 log.info("DBRead Get equipment for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
493 accessData.getNodeId().getValue(), equipmentUuid.getValue());
495 InstanceIdentifier<Equipment> equipmentIID = InstanceIdentifier.builder(ControlConstruct.class)
496 .child(Equipment.class, new EquipmentKey(equipmentUuid)).build();
498 return accessData.getTransactionUtils().readData(accessData.getDataBroker(), LogicalDatastoreType.CONFIGURATION,
502 // defining a structure that can map the LP local-id and its corresponding LTP uuid
503 private class TechnologySpecificPacKeys {
505 private UniversalId ltpUuid;
506 private String localId;
508 public TechnologySpecificPacKeys(UniversalId uuid, String lId) {
513 public UniversalId getLtpUuid() {
517 public String getLocalId() {
521 @SuppressWarnings("unused")
522 public void setLtpUuid(UniversalId uuid) {
526 @SuppressWarnings("unused")
527 public void setLocalId(String lId) {
534 * LOG the newly added problems of the interface pac
540 private void debugResultList(String uuid, FaultData resultList, int idxStart) {
541 StringBuilder sb = new StringBuilder();
543 for (int t = idxStart; t < resultList.size(); t++) {
546 sb.append(resultList.get(t));
549 log.debug("Found problems {} {}", uuid, sb);