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;
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 =
122 new Onf14AirInterfaceNotificationListener(netconfAccess, serviceProvider);
123 this.etherneContainerNotificationListenerHandler = null;
124 ethernetContainerNotificationListener =
125 new Onf14EthernetContainerNotificationListener(netconfAccess, serviceProvider);
126 this.wireInterfaceNotificationListenerHandler = null;
127 wireInterfaceNotificationListener = new Onf14WireInterfaceNotificationListener(netconfAccess, serviceProvider);
130 public void initialReadFromNetworkElement() {
132 // reading the inventory (CoreModel 1.4 Equipment Model) and adding it to the DB
135 FaultData resultList = new FaultData();
137 int problems = faultService.removeAllCurrentProblemsOfNode(netconfAccessor.getNodeId());
138 log.debug("Removed all {} problems from database at registration", problems);
140 readAllAirInterfaceCurrentProblems(resultList);
141 problems = resultList.size();
142 log.debug("NETCONF read air interface current problems completed. Got back {} problems.", problems);
144 readAllEhernetContainerCurrentProblems(resultList);
145 problems = resultList.size() - problems;
146 log.debug("NETCONF read current problems completed. Got back {} problems.", resultList.size());
148 readAllWireInterfaceCurrentProblems(resultList);
149 problems = resultList.size();
150 log.debug("NETCONF read wire interface current problems completed. Got back {} problems.", problems);
152 faultService.initCurrentProblemStatus(netconfAccessor.getNodeId(), resultList);
153 log.debug("DB write current problems completed");
157 public void readAllAirInterfaceCurrentProblems(FaultData resultList) {
159 int idxStart; // Start index for debug messages
161 for (TechnologySpecificPacKeys key : airInterfaceList) {
162 idxStart = resultList.size();
164 readAirInterfaceCurrentProblemForLtp(key.getLtpUuid(), key.getLocalId(), resultList);
165 debugResultList(key.getLtpUuid().getValue(), resultList, idxStart);
169 public void readAllEhernetContainerCurrentProblems(FaultData resultList) {
171 int idxStart; // Start index for debug messages
173 for (TechnologySpecificPacKeys key : ethernetContainerList) {
174 idxStart = resultList.size();
176 readEthernetConainerCurrentProblemForLtp(key.getLtpUuid(), key.getLocalId(), resultList);
177 debugResultList(key.getLtpUuid().getValue(), resultList, idxStart);
181 public void readAllWireInterfaceCurrentProblems(FaultData resultList) {
183 int idxStart; // Start index for debug messages
185 for (TechnologySpecificPacKeys key : wireInterfaceList) {
186 idxStart = resultList.size();
188 readWireInterfaceCurrentProblemForLtp(key.getLtpUuid(), key.getLocalId(), resultList);
189 debugResultList(key.getLtpUuid().getValue(), resultList, idxStart);
194 * @param nNode 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 netconfAccessor.registerNotificationsStream(NetconfBindingAccessor.DefaultNotificationsStream);
230 public void deregister() {}
234 public NodeId getNodeId() {
235 return netconfAccessor.getNodeId();
239 public <L extends NetworkElementService> Optional<L> getService(Class<L> clazz) {
240 return Optional.empty();
244 public void warmstart() {}
247 public Optional<NetconfAccessor> getAcessor() {
248 return Optional.of(netconfAccessor);
252 public NetworkElementDeviceType getDeviceType() {
253 return NetworkElementDeviceType.Wireless;
256 private void readEquipmentData() {
258 Optional<ControlConstruct> controlConstruct = readControlConstruct(netconfAccessor);
260 if (controlConstruct.isPresent()) {
261 // the top-level-equipment list contains the root objects of the Equipment Model
262 log.debug("Getting list of topLevelEquipment for mountpoint {}", netconfAccessor.getNodeId());
264 List<UniversalId> topLevelEquipment = controlConstruct.get().getTopLevelEquipment();
266 if (topLevelEquipment != null) {
267 List<Inventory> inventoryList = new ArrayList<>();
268 for (UniversalId uuid : topLevelEquipment) {
269 log.debug("Got back topLevelEquipment with uuid {}", uuid.getValue());
271 // adding all root Equipment objects to the DB
273 Equipment equipmentInstance = readEquipmentInstance(netconfAccessor, uuid);
274 if (equipmentInstance != null) {
275 // recursively adding the root equipment and all its children into the DB
276 collectEquipment(inventoryList, equipmentInstance, null, EQUIPMENTROOTLEVEL);
279 this.databaseService.writeInventory(this.netconfAccessor.getNodeId().getValue(), inventoryList);
284 // storing all the LTP UUIDs internally, for later usage, for air-interface and ethernet-container
285 readKeys(controlConstruct);
288 private List<Inventory> collectEquipment(List<Inventory> list, Equipment currentEq, Equipment parentEq,
291 // if the Equipment UUID is already in the list, it was already processed
292 // needed for solving possible circular dependencies
293 if (equipmentUuidList.contains(currentEq.getUuid().getValue())) {
294 log.debug("Not adding equipment with uuid {} because it was aleady added...",
295 currentEq.getUuid().getValue());
299 // we add this to our internal list, such that we avoid circular dependencies
300 equipmentUuidList.add(currentEq.getUuid().getValue());
301 log.debug("Adding equipment with uuid {} to the database...", currentEq.getUuid().getValue());
303 // we add our current equipment to the database
304 list.add(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 collectEquipment(list, childEq, currentEq, treeLevel + 1);
327 private void readKeys(Optional<ControlConstruct> controlConstruct) {
329 if (controlConstruct.isPresent()) {
331 Collection<LogicalTerminationPoint> ltpList =
332 YangHelper.getCollection(controlConstruct.get().nonnullLogicalTerminationPoint());
333 log.debug("Iterating the LTP list for node {}", netconfAccessor.getNodeId().getValue());
335 // iterating all the Logical Termination Point list
336 for (LogicalTerminationPoint ltp : ltpList) {
338 List<LayerProtocol> lpList = YangHelper.getList(ltp.nonnullLayerProtocol());
339 // the Layer Protocol list should contain only one item, since we have an 1:1 relationship between the LTP and the LP
340 if (lpList.size() != 1) {
341 log.debug("Layer protocol has no 1:1 relationship with the LTP.");
344 // accessing the LP, which should be only 1
345 LayerProtocol lp = lpList.get(0);
347 Class<? extends LAYERPROTOCOLNAMETYPE> layerProtocolName = lp.getLayerProtocolName();
348 if (layerProtocolName != null) {
349 // if the LTP has an airInterface technology extension, the layer protocol name is air-layer
350 if (layerProtocolName.getTypeName() == LAYERPROTOCOLNAMETYPEAIRLAYER.class.getName()) {
351 TechnologySpecificPacKeys airInterfaceKey =
352 new TechnologySpecificPacKeys(ltp.getUuid(), lp.getLocalId());
353 airInterfaceList.add(airInterfaceKey);
354 log.debug("Adding Ltp with uuid {} and local-id {} to the air-interface list",
355 ltp.getUuid().getValue(), lp.getLocalId());
357 // if the LTP has an ethernetContainier technology extension, the layer protocol name is ethernet-container-layer
358 else if (layerProtocolName.getTypeName() == LAYERPROTOCOLNAMETYPEETHERNETCONTAINERLAYER.class
360 TechnologySpecificPacKeys ethernetContainerKey =
361 new TechnologySpecificPacKeys(ltp.getUuid(), lp.getLocalId());
362 ethernetContainerList.add(ethernetContainerKey);
363 log.debug("Adding Ltp with uuid {} and local-id {} to the ethernet-contatinier list",
364 ltp.getUuid().getValue(), lp.getLocalId());
365 } else if (layerProtocolName.getTypeName() == LAYERPROTOCOLNAMETYPEWIRELAYER.class.getName()) {
366 TechnologySpecificPacKeys wireInterfaceKey =
367 new TechnologySpecificPacKeys(ltp.getUuid(), lp.getLocalId());
368 wireInterfaceList.add(wireInterfaceKey);
369 log.debug("Adding Ltp with uuid {} and local-id {} to the wire-interface list",
370 ltp.getUuid().getValue(), lp.getLocalId());
377 private void readAirInterfaceCurrentProblemForLtp(UniversalId ltpUuid, String localId, FaultData resultList) {
379 final Class<AirInterfacePac> clazzPac = AirInterfacePac.class;
381 log.info("DBRead Get current problems for class {} from mountpoint {} for LTP uuid {} and local-id {}",
382 clazzPac.getSimpleName(), netconfAccessor.getNodeId().getValue(), ltpUuid.getValue(), localId);
384 // constructing the IID needs the augmentation exposed byy the air-interface-2-0 model
385 InstanceIdentifier<AirInterfaceCurrentProblems> airInterfaceCurrentProblem_IID = InstanceIdentifier
386 .builder(ControlConstruct.class)
387 .child(LogicalTerminationPoint.class, new LogicalTerminationPointKey(ltpUuid))
388 .child(LayerProtocol.class, new LayerProtocolKey(localId))
390 org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.LayerProtocol1.class)
391 .child(AirInterfacePac.class).child(AirInterfaceCurrentProblems.class).build();
393 // reading all the current-problems list for this specific LTP and LP
394 AirInterfaceCurrentProblems problems = netconfAccessor.getTransactionUtils().readData(
395 netconfAccessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, airInterfaceCurrentProblem_IID);
397 if (problems == null) {
398 log.debug("DBRead Id {} no AirInterfaceCurrentProblems", ltpUuid);
399 } else if (problems.getCurrentProblemList() == null) {
400 log.debug("DBRead Id {} empty CurrentProblemList", ltpUuid);
402 for (org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.air._interface.current.problems.CurrentProblemList problem : YangHelper
403 .getCollection(problems.nonnullCurrentProblemList())) {
404 resultList.add(netconfAccessor.getNodeId(), (int) problem.getSequenceNumber(), problem.getTimestamp(),
405 ltpUuid.getValue(), problem.getProblemName(),
406 Onf14AirInterface.mapSeverity(problem.getProblemSeverity()));
411 private void readEthernetConainerCurrentProblemForLtp(UniversalId ltpUuid, String localId, FaultData resultList) {
413 final Class<EthernetContainerPac> clazzPac = EthernetContainerPac.class;
415 log.info("DBRead Get current problems for class {} from mountpoint {} for LTP uuid {} and local-id {}",
416 clazzPac.getSimpleName(), netconfAccessor.getNodeId().getValue(), ltpUuid.getValue(), localId);
418 // constructing the IID needs the augmentation exposed by the ethernet-container-2-0 model
419 InstanceIdentifier<EthernetContainerCurrentProblems> etherneContainerCurrentProblem_IID = InstanceIdentifier
420 .builder(ControlConstruct.class)
421 .child(LogicalTerminationPoint.class, new LogicalTerminationPointKey(ltpUuid))
422 .child(LayerProtocol.class, new LayerProtocolKey(localId))
424 org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.LayerProtocol1.class)
425 .child(EthernetContainerPac.class).child(EthernetContainerCurrentProblems.class).build();
427 // reading all the current-problems list for this specific LTP and LP
428 EthernetContainerCurrentProblems problems = netconfAccessor.getTransactionUtils().readData(
429 netconfAccessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, etherneContainerCurrentProblem_IID);
431 if (problems == null) {
432 log.debug("DBRead Id {} no EthernetContainerCurrentProblems", ltpUuid);
433 } else if (problems.getCurrentProblemList() == null) {
434 log.debug("DBRead Id {} empty CurrentProblemList", ltpUuid);
436 for (org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.ethernet.container.current.problems.CurrentProblemList problem : YangHelper
437 .getCollection(problems.nonnullCurrentProblemList())) {
438 resultList.add(netconfAccessor.getNodeId(), (int) problem.getSequenceNumber(), problem.getTimestamp(),
439 ltpUuid.getValue(), problem.getProblemName(),
440 Onf14EthernetContainer.mapSeverity(problem.getProblemSeverity()));
445 private void readWireInterfaceCurrentProblemForLtp(UniversalId ltpUuid, String localId, FaultData resultList) {
447 final Class<WireInterfacePac> clazzPac = WireInterfacePac.class;
449 log.info("DBRead Get current problems for class {} from mountpoint {} for LTP uuid {} and local-id {}",
450 clazzPac.getSimpleName(), netconfAccessor.getNodeId().getValue(), ltpUuid.getValue(), localId);
452 // constructing the IID needs the augmentation exposed by the wire-interface-2-0 model
453 InstanceIdentifier<WireInterfaceCurrentProblems> wireInterfaceCurrentProblem_IID = InstanceIdentifier
454 .builder(ControlConstruct.class)
455 .child(LogicalTerminationPoint.class, new LogicalTerminationPointKey(ltpUuid))
456 .child(LayerProtocol.class, new LayerProtocolKey(localId))
458 org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.LayerProtocol1.class)
459 .child(WireInterfacePac.class).child(WireInterfaceCurrentProblems.class).build();
461 // reading all the current-problems list for this specific LTP and LP
462 WireInterfaceCurrentProblems problems = netconfAccessor.getTransactionUtils().readData(
463 netconfAccessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, wireInterfaceCurrentProblem_IID);
465 if (problems == null) {
466 log.debug("DBRead Id {} no WireInterfaceCurrentProblems", ltpUuid);
467 } else if (problems.getCurrentProblemList() == null) {
468 log.debug("DBRead Id {} empty CurrentProblemList", ltpUuid);
470 for (org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.wire._interface.current.problems.CurrentProblemList problem : YangHelper
471 .getCollection(problems.nonnullCurrentProblemList())) {
472 resultList.add(netconfAccessor.getNodeId(), (int) problem.getSequenceNumber(), problem.getTimestamp(),
473 ltpUuid.getValue(), problem.getProblemName(),
474 Onf14WireInterface.mapSeverity(problem.getProblemSeverity()));
479 private Optional<ControlConstruct> readControlConstruct(NetconfBindingAccessor netconfAccessor) {
480 return Optional.ofNullable(netconfAccessor.getTransactionUtils().readData(netconfAccessor.getDataBroker(),
481 LogicalDatastoreType.CONFIGURATION, CONTROLCONSTRUCT_IID));
484 private @Nullable Equipment readEquipmentInstance(NetconfBindingAccessor accessData, UniversalId equipmentUuid) {
486 final Class<?> clazzPac = Equipment.class;
488 log.info("DBRead Get equipment for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
489 accessData.getNodeId().getValue(), equipmentUuid.getValue());
491 InstanceIdentifier<Equipment> equipmentIID = InstanceIdentifier.builder(ControlConstruct.class)
492 .child(Equipment.class, new EquipmentKey(equipmentUuid)).build();
494 return accessData.getTransactionUtils().readData(accessData.getDataBroker(), LogicalDatastoreType.CONFIGURATION,
498 // defining a structure that can map the LP local-id and its corresponding LTP uuid
499 private class TechnologySpecificPacKeys {
501 private UniversalId ltpUuid;
502 private String localId;
504 public TechnologySpecificPacKeys(UniversalId uuid, String lId) {
509 public UniversalId getLtpUuid() {
513 public String getLocalId() {
517 @SuppressWarnings("unused")
518 public void setLtpUuid(UniversalId uuid) {
522 @SuppressWarnings("unused")
523 public void setLocalId(String lId) {
530 * LOG the newly added problems of the interface pac
536 private void debugResultList(String uuid, FaultData resultList, int idxStart) {
537 StringBuilder sb = new StringBuilder();
539 for (int t = idxStart; t < resultList.size(); t++) {
542 sb.append(resultList.get(t));
545 log.debug("Found problems {} {}", uuid, sb);