eed6f5da35267d725f900258b8e5e254bdaf5d67
[ccsdk/features.git] / sdnr / wt / devicemanager-onap / onf14 / provider / src / main / java / org / onap / ccsdk / features / sdnr / wt / devicemanager / onf14 / dom / impl / interfaces / Onf14DomInterfacePacManager.java
1 /*
2  * ============LICENSE_START=======================================================
3  * ONAP : ccsdk features
4  * ================================================================================
5  * Copyright (C) 2022 highstreet technologies GmbH Intellectual Property.
6  * All rights reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *     http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  *
21  */
22 package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.interfaces;
23
24 import com.google.common.collect.Sets;
25 import java.util.ArrayList;
26 import java.util.Collection;
27 import java.util.List;
28 import java.util.Objects;
29 import java.util.Optional;
30 import org.eclipse.jdt.annotation.NonNull;
31 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.Onf14DomAirInterfaceNotificationListener;
32 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.Onf14DomEthernetContainerNotificationListener;
33 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.Onf14DomWireInterfaceNotificationListener;
34 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.dataprovider.InternalDataModelSeverity;
35 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.util.Debug;
36 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.util.Onf14DMDOMUtility;
37 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.util.Onf14DevicemanagerQNames;
38 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
39 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
40 import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData;
41 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor;
42 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
43 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
44 import org.opendaylight.yangtools.yang.common.QName;
45 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
46 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
47 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.InstanceIdentifierBuilder;
48 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
49 import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
50 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
51 import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
52 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
53 import org.slf4j.Logger;
54 import org.slf4j.LoggerFactory;
55
56 /*
57 * Notifications streams provided by device NTSSim ONF14
58 * Stream{getName=StreamNameType{_value=nc-notifications}, isReplaySupport=true, augmentation=[]},
59 * Stream{getName=StreamNameType{_value=hybrid-mw-structure-2-0}, isReplaySupport=true, augmentation=[]},
60 * Stream{getName=StreamNameType{_value=vlan-interface-1-0}, isReplaySupport=true, augmentation=[]},
61 * Stream{getName=StreamNameType{_value=tdm-container-2-0}, isReplaySupport=true, augmentation=[]},
62 * Stream{getName=StreamNameType{_value=ethernet-container-2-0}, isReplaySupport=true, augmentation=[]},
63 * Stream{getName=StreamNameType{_value=ietf-yang-library}, isReplaySupport=false, augmentation=[]},
64 * Stream{getDescription=Default NETCONF stream containing all the Event Notifications., getName=StreamNameType{_value=NETCONF}, isReplaySupport=true, augmentation=[]},
65 * Stream{getName=StreamNameType{_value=vlan-fd-1-0}, isReplaySupport=true, augmentation=[]},
66 * Stream{getName=StreamNameType{_value=wire-interface-2-0}, isReplaySupport=true, augmentation=[]},
67 * Stream{getName=StreamNameType{_value=mac-fd-1-0}, isReplaySupport=true, augmentation=[]},
68 * Stream{getName=StreamNameType{_value=co-channel-profile-1-0}, isReplaySupport=true, augmentation=[]},
69 * Stream{getName=StreamNameType{_value=mac-interface-1-0}, isReplaySupport=true, augmentation=[]},
70 * Stream{getName=StreamNameType{_value=ietf-keystore}, isReplaySupport=true, augmentation=[]},
71 * Stream{getName=StreamNameType{_value=pure-ethernet-structure-2-0}, isReplaySupport=true, augmentation=[]},
72 * Stream{getName=StreamNameType{_value=ietf-netconf-notifications}, isReplaySupport=true, augmentation=[]},
73 * Stream{getName=StreamNameType{_value=mac-fc-1-0}, isReplaySupport=true, augmentation=[]},
74 * Stream{getName=StreamNameType{_value=wred-profile-1-0}, isReplaySupport=true, augmentation=[]},
75 * Stream{getName=StreamNameType{_value=air-interface-2-0}, isReplaySupport=true, augmentation=[]},
76 * Stream{getName=StreamNameType{_value=ip-interface-1-0}, isReplaySupport=true, augmentation=[]},
77 * Stream{getName=StreamNameType{_value=qos-profile-1-0}, isReplaySupport=true, augmentation=[]},
78 * Stream{getName=StreamNameType{_value=vlan-fc-1-0}, isReplaySupport=true, augmentation=[]},
79 * Stream{getName=StreamNameType{_value=l-3vpn-profile-1-0}, isReplaySupport=true, augmentation=[]}]
80 */
81
82 public class Onf14DomInterfacePacManager {
83
84     private static final Logger log = LoggerFactory.getLogger(Onf14DomInterfacePacManager.class);
85
86     private static final YangInstanceIdentifier LTP_IID =
87             YangInstanceIdentifier.builder().node(Onf14DevicemanagerQNames.CORE_MODEL_CONTROL_CONSTRUCT_CONTAINER)
88                     .node(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP).build();
89
90     private final NetconfDomAccessor netconfDomAccessor;
91     private final @NonNull DeviceManagerServiceProvider serviceProvider;
92
93     // air interface related members
94     private final List<TechnologySpecificPacKeys> airInterfaceList = new ArrayList<>();
95     @NonNull
96     private final Onf14DomAirInterfaceNotificationListener airInterfaceNotificationListener;
97
98     // ethernet container related members
99     private final List<TechnologySpecificPacKeys> ethernetContainerList = new ArrayList<>();
100     @NonNull
101     private final Onf14DomEthernetContainerNotificationListener ethernetContainerNotificationListener;
102
103     // wire interface related members
104     private final List<TechnologySpecificPacKeys> wireInterfaceList = new ArrayList<>();
105     @NonNull
106     private final Onf14DomWireInterfaceNotificationListener wireInterfaceNotificationListener;
107
108     private final @NonNull FaultService faultService;
109
110     public Onf14DomInterfacePacManager(@NonNull NetconfDomAccessor netconfDomAccessor,
111             @NonNull DeviceManagerServiceProvider serviceProvider) {
112
113         this.netconfDomAccessor = Objects.requireNonNull(netconfDomAccessor);
114         this.serviceProvider = Objects.requireNonNull(serviceProvider);
115         this.faultService = Objects.requireNonNull(serviceProvider.getFaultService());
116
117         this.airInterfaceNotificationListener =
118                 new Onf14DomAirInterfaceNotificationListener(netconfDomAccessor, serviceProvider);
119         this.ethernetContainerNotificationListener =
120                 new Onf14DomEthernetContainerNotificationListener(netconfDomAccessor, serviceProvider);
121         this.wireInterfaceNotificationListener =
122                 new Onf14DomWireInterfaceNotificationListener(netconfDomAccessor, serviceProvider);
123     }
124
125     public void register() {
126         // storing all the LTP UUIDs internally, for later usage, for air-interface and
127         // ethernet-container and wire-interface
128         readKeys();
129         readAndWriteInterfaceCurrentProblems();
130         registerForNotifications();
131     }
132
133     private void readAndWriteInterfaceCurrentProblems() {
134         // Read all fault data
135         FaultData resultList = new FaultData();
136         int problems;
137         readAllAirInterfaceCurrentProblems(resultList);
138         problems = resultList.size();
139         log.debug("NETCONF read air interface current problems completed. Got back {} problems.", problems);
140
141         readAllEhernetContainerCurrentProblems(resultList);
142         problems = resultList.size() - problems;
143         log.debug("NETCONF read current problems completed. Got back {} problems.", problems);
144
145         readAllWireInterfaceCurrentProblems(resultList);
146         problems = resultList.size();
147         log.debug("NETCONF read wire interface current problems completed. Got back {} problems.", problems);
148
149         faultService.initCurrentProblemStatus(netconfDomAccessor.getNodeId(), resultList);
150         log.debug("DB write current problems completed");
151
152     }
153
154     private void readKeys() {
155         Optional<NormalizedNode> ltpData = readLtpData(netconfDomAccessor);
156         log.info("LTP Data is - {}", ltpData);
157         if (ltpData.isPresent()) {
158             log.debug("In readKeys - ltpData = {}", ltpData.get());
159
160             MapNode ccLtp = (MapNode) ltpData.get();
161             if (ccLtp != null) {
162                 log.debug("Iterating the LTP list for node {}", netconfDomAccessor.getNodeId().getValue());
163                 Collection<MapEntryNode> ltpList = ccLtp.body();
164
165                 // iterating all the Logical Termination Point list
166                 for (MapEntryNode ltp : ltpList) {
167                     MapNode lpList = (MapNode) ltp
168                             .childByArg(new NodeIdentifier(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL));
169                     // the Layer Protocol list should contain only one item, since we have an 1:1
170                     // relationship between the LTP and the LP
171                     if (lpList != null && lpList.size() != 1) {
172                         log.debug("Layer protocol has no 1:1 relationship with the LTP.");
173                         return;
174                     }
175                     // accessing the LP, which should be only 1
176                     Collection<MapEntryNode> lp = lpList.body();
177                     for (MapEntryNode lpEntry : lp) {
178                         String layerProtocolName = Onf14DMDOMUtility.getLeafValue(lpEntry,
179
180                                 Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL_NAME);
181                         if (layerProtocolName != null) {
182                             // if the LTP has an airInterface technology extension, the layer protocol name
183                             // is air-layer
184                             if (layerProtocolName.contains("LAYER_PROTOCOL_NAME_TYPE_AIR_LAYER")) {
185                                 TechnologySpecificPacKeys airInterfaceKey = new TechnologySpecificPacKeys(
186                                         Onf14DMDOMUtility.getLeafValue(ltp,
187                                                 Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_UUID),
188                                         Onf14DMDOMUtility.getLeafValue(lpEntry,
189                                                 Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL_LOCAL_ID));
190                                 airInterfaceList.add(airInterfaceKey);
191                                 log.debug("Adding Ltp with uuid {} and local-id {} to the air-interface list",
192                                         Onf14DMDOMUtility.getLeafValue(ltp,
193                                                 Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_UUID),
194                                         Onf14DMDOMUtility.getLeafValue(lpEntry,
195                                                 Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL_LOCAL_ID));
196                             }
197                             // if the LTP has an ethernetContainier technology extension, the layer protocol
198                             // name is ethernet-container-layer
199                             else if (layerProtocolName.contains("LAYER_PROTOCOL_NAME_TYPE_ETHERNET_CONTAINER_LAYER")) {
200                                 TechnologySpecificPacKeys ethernetContainerKey = new TechnologySpecificPacKeys(
201                                         Onf14DMDOMUtility.getLeafValue(ltp,
202                                                 Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_UUID),
203                                         Onf14DMDOMUtility.getLeafValue(lpEntry,
204                                                 Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL_LOCAL_ID));
205                                 ethernetContainerList.add(ethernetContainerKey);
206                                 log.debug("Adding Ltp with uuid {} and local-id {} to the ethernet-container list",
207                                         Onf14DMDOMUtility.getLeafValue(ltp,
208                                                 Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_UUID),
209                                         Onf14DMDOMUtility.getLeafValue(lpEntry,
210                                                 Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL_LOCAL_ID));
211                             } else if (layerProtocolName.contains("LAYER_PROTOCOL_NAME_TYPE_WIRE_LAYER")) {
212                                 TechnologySpecificPacKeys wireInterfaceKey = new TechnologySpecificPacKeys(
213                                         Onf14DMDOMUtility.getLeafValue(ltp,
214                                                 Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_UUID),
215                                         Onf14DMDOMUtility.getLeafValue(lpEntry,
216                                                 Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL_LOCAL_ID));
217                                 wireInterfaceList.add(wireInterfaceKey);
218                                 log.debug("Adding Ltp with uuid {} and local-id {} to the wire-interface list",
219                                         Onf14DMDOMUtility.getLeafValue(ltp,
220                                                 Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_UUID),
221                                         Onf14DMDOMUtility.getLeafValue(lpEntry,
222                                                 Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL_LOCAL_ID));
223                             }
224                         }
225                     }
226                 }
227             }
228         }
229     }
230
231     private void readAllAirInterfaceCurrentProblems(FaultData resultList) {
232
233         int idxStart; // Start index for debug messages
234
235         for (TechnologySpecificPacKeys key : airInterfaceList) {
236             idxStart = resultList.size();
237
238             readAirInterfaceCurrentProblemForLtp(key.getLtpUuid(), key.getLocalId(), resultList);
239             Debug.debugResultList(key.getLtpUuid(), resultList, idxStart);
240         }
241     }
242
243     private void readAllEhernetContainerCurrentProblems(FaultData resultList) {
244
245         int idxStart; // Start index for debug messages
246
247         for (TechnologySpecificPacKeys key : ethernetContainerList) {
248             idxStart = resultList.size();
249
250             readEthernetContainerCurrentProblemForLtp(key.getLtpUuid(), key.getLocalId(), resultList);
251             Debug.debugResultList(key.getLtpUuid(), resultList, idxStart);
252         }
253     }
254
255     private void readAllWireInterfaceCurrentProblems(FaultData resultList) {
256
257         int idxStart; // Start index for debug messages
258
259         for (TechnologySpecificPacKeys key : wireInterfaceList) {
260             idxStart = resultList.size();
261
262             readWireInterfaceCurrentProblemForLtp(key.getLtpUuid(), key.getLocalId(), resultList);
263             Debug.debugResultList(key.getLtpUuid(), resultList, idxStart);
264         }
265     }
266
267     private void readAirInterfaceCurrentProblemForLtp(String ltpUuid, String localId, FaultData resultList) {
268
269         log.info("DBRead Get current problems for class {} from mountpoint {} for LTP uuid {} and local-id {}",
270                 Onf14DevicemanagerQNames.AIR_INTERFACE_2_0_MODULE, netconfDomAccessor.getNodeId().getValue(), ltpUuid,
271                 localId);
272
273         // constructing the IID needs the augmentation exposed by the air-interface-2-0
274         // model
275
276         InstanceIdentifierBuilder layerProtocolIID =
277                 YangInstanceIdentifier.builder().node(Onf14DevicemanagerQNames.CORE_MODEL_CONTROL_CONSTRUCT_CONTAINER)
278                         .node(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP)
279                         .nodeWithKey(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP,
280                                 QName.create(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP, "uuid").intern(), ltpUuid)
281                         .node(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL)
282                         .nodeWithKey(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL, QName
283                                 .create(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL, "local-id").intern(),
284                                 localId);
285
286         @NonNull
287         AugmentationIdentifier airInterfacePacIID = YangInstanceIdentifier.AugmentationIdentifier
288                 .create(Sets.newHashSet(Onf14DevicemanagerQNames.AIR_INTERFACE_PAC));
289
290         InstanceIdentifierBuilder augmentedAirInterfacePacIID =
291                 YangInstanceIdentifier.builder(layerProtocolIID.build()).node(airInterfacePacIID);
292
293         // reading all the current-problems list for this specific LTP and LP
294         Optional<NormalizedNode> airInterfacePacDataOpt =
295                 netconfDomAccessor.readDataNode(LogicalDatastoreType.OPERATIONAL, augmentedAirInterfacePacIID.build());
296
297         if (airInterfacePacDataOpt.isPresent()) {
298             AugmentationNode airInterfacePacData = (AugmentationNode) airInterfacePacDataOpt.get();
299
300             MapNode airInterfaceCurrentProblemsList = (MapNode) airInterfacePacData
301                     .childByArg(new NodeIdentifier(Onf14DevicemanagerQNames.AIR_INTERFACE_CURRENT_PROBLEMS_LIST));
302             if (airInterfaceCurrentProblemsList != null) {
303                 Collection<MapEntryNode> airInterfaceProblemsCollection = airInterfaceCurrentProblemsList.body();
304                 for (MapEntryNode airInterfaceProblem : airInterfaceProblemsCollection) {
305                     resultList.add(netconfDomAccessor.getNodeId(),
306                             Integer.parseInt(Onf14DMDOMUtility.getLeafValue(airInterfaceProblem,
307                                     Onf14DevicemanagerQNames.AIR_INTERFACE_CURRENT_PROBLEMS_SEQ_NO)),
308                             new DateAndTime(Onf14DMDOMUtility.getLeafValue(airInterfaceProblem,
309                                     Onf14DevicemanagerQNames.AIR_INTERFACE_CURRENT_PROBLEMS_TIMESTAMP)),
310                             ltpUuid,
311                             Onf14DMDOMUtility.getLeafValue(airInterfaceProblem,
312                                     Onf14DevicemanagerQNames.AIR_INTERFACE_CURRENT_PROBLEMS_PROBLEM_NAME),
313                             InternalDataModelSeverity.mapSeverity(Onf14DMDOMUtility.getLeafValue(airInterfaceProblem,
314                                     Onf14DevicemanagerQNames.AIR_INTERFACE_CURRENT_PROBLEMS_PROBLEM_SEVERITY)));
315                 }
316             } else {
317                 log.debug("DBRead Id {} empty CurrentProblemList", ltpUuid);
318             }
319         }
320     }
321
322     private void readEthernetContainerCurrentProblemForLtp(String ltpUuid, String localId, FaultData resultList) {
323
324         log.info(
325                 "DBRead Get current problems for Ethernet Container from mountpoint {} for LTP uuid {} and local-id {}",
326                 netconfDomAccessor.getNodeId().getValue(), ltpUuid, localId);
327
328         // constructing the IID needs the augmentation exposed by the
329         // ethernet-container-2-0 model
330         InstanceIdentifierBuilder layerProtocolIID =
331                 YangInstanceIdentifier.builder().node(Onf14DevicemanagerQNames.CORE_MODEL_CONTROL_CONSTRUCT_CONTAINER)
332                         .node(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP)
333                         .nodeWithKey(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP,
334                                 QName.create(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP, "uuid").intern(), ltpUuid)
335                         .node(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL)
336                         .nodeWithKey(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL, QName
337                                 .create(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL, "local-id").intern(),
338                                 localId);
339
340         @NonNull
341         AugmentationIdentifier ethernetContainerIID = YangInstanceIdentifier.AugmentationIdentifier
342                 .create(Sets.newHashSet(Onf14DevicemanagerQNames.ETHERNET_CONTAINER_PAC));
343
344         InstanceIdentifierBuilder augmentedEthernetContainerConfigurationIID =
345                 YangInstanceIdentifier.builder(layerProtocolIID.build()).node(ethernetContainerIID);
346
347         // reading all the current-problems list for this specific LTP and LP
348         Optional<NormalizedNode> etherntContainerConfigurationOpt = netconfDomAccessor
349                 .readDataNode(LogicalDatastoreType.OPERATIONAL, augmentedEthernetContainerConfigurationIID.build());
350
351         if (etherntContainerConfigurationOpt.isPresent()) {
352             AugmentationNode etherntContainerConfiguration = (AugmentationNode) etherntContainerConfigurationOpt.get();
353             MapNode ethernetContainerCurrentProblemsList = (MapNode) etherntContainerConfiguration
354                     .childByArg(new NodeIdentifier(Onf14DevicemanagerQNames.ETHERNET_CONTAINER_CURRENT_PROBLEMS_LIST));
355             if (ethernetContainerCurrentProblemsList != null) {
356                 Collection<MapEntryNode> ethernetContainerProblemsCollection =
357                         ethernetContainerCurrentProblemsList.body();
358                 for (MapEntryNode ethernetContainerProblem : ethernetContainerProblemsCollection) {
359                     resultList.add(netconfDomAccessor.getNodeId(),
360                             Integer.parseInt(Onf14DMDOMUtility.getLeafValue(ethernetContainerProblem,
361                                     Onf14DevicemanagerQNames.ETHERNET_CONTAINER_CURRENT_PROBLEMS_SEQ_NO)),
362                             new DateAndTime(Onf14DMDOMUtility.getLeafValue(ethernetContainerProblem,
363                                     Onf14DevicemanagerQNames.ETHERNET_CONTAINER_CURRENT_PROBLEMS_TIMESTAMP)),
364                             ltpUuid,
365                             Onf14DMDOMUtility.getLeafValue(ethernetContainerProblem,
366                                     Onf14DevicemanagerQNames.ETHERNET_CONTAINER_CURRENT_PROBLEMS_PROBLEM_NAME),
367                             InternalDataModelSeverity.mapSeverity(Onf14DMDOMUtility.getLeafValue(
368                                     ethernetContainerProblem,
369                                     Onf14DevicemanagerQNames.ETHERNET_CONTAINER_CURRENT_PROBLEMS_PROBLEM_SEVERITY)));
370                 }
371             } else {
372                 log.debug("DBRead Id {} empty CurrentProblemList", ltpUuid);
373             }
374         }
375
376     }
377
378     private void readWireInterfaceCurrentProblemForLtp(String ltpUuid, String localId, FaultData resultList) {
379
380         log.info("DBRead Get current problems for Wire Interface from mountpoint {} for LTP uuid {} and local-id {}",
381                 netconfDomAccessor.getNodeId().getValue(), ltpUuid, localId);
382
383         // constructing the IID needs the augmentation exposed by the wire-interface-2-0
384         // model
385         InstanceIdentifierBuilder layerProtocolIID =
386                 YangInstanceIdentifier.builder().node(Onf14DevicemanagerQNames.CORE_MODEL_CONTROL_CONSTRUCT_CONTAINER)
387                         .node(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP)
388                         .nodeWithKey(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP,
389                                 QName.create(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP, "uuid").intern(), ltpUuid)
390                         .node(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL)
391                         .nodeWithKey(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL, QName
392                                 .create(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL, "local-id").intern(),
393                                 localId);
394
395         @NonNull
396         AugmentationIdentifier wireInterfacePacIID = YangInstanceIdentifier.AugmentationIdentifier
397                 .create(Sets.newHashSet(Onf14DevicemanagerQNames.WIRE_INTERFACE_PAC));
398
399         InstanceIdentifierBuilder augmentedWireInterfaceConfigurationIID =
400                 YangInstanceIdentifier.builder(layerProtocolIID.build()).node(wireInterfacePacIID);
401
402         // reading all the current-problems list for this specific LTP and LP
403         Optional<NormalizedNode> wireInterfaceConfigurationOpt = netconfDomAccessor
404                 .readDataNode(LogicalDatastoreType.OPERATIONAL, augmentedWireInterfaceConfigurationIID.build());
405
406         if (wireInterfaceConfigurationOpt.isPresent()) {
407             AugmentationNode wireInterfaceConfiguration = (AugmentationNode) wireInterfaceConfigurationOpt.get();
408             MapNode wireInterfaceCurrentProblemsList = (MapNode) wireInterfaceConfiguration
409                     .childByArg(new NodeIdentifier(Onf14DevicemanagerQNames.WIRE_INTERFACE_CURRENT_PROBLEMS_LIST));
410             if (wireInterfaceCurrentProblemsList != null) {
411                 Collection<MapEntryNode> wireInterfaceProblemsCollection = wireInterfaceCurrentProblemsList.body();
412                 for (MapEntryNode wireInterfaceProblem : wireInterfaceProblemsCollection) {
413                     resultList.add(netconfDomAccessor.getNodeId(),
414                             Integer.parseInt(Onf14DMDOMUtility.getLeafValue(wireInterfaceProblem,
415                                     Onf14DevicemanagerQNames.WIRE_INTERFACE_CURRENT_PROBLEMS_SEQ_NO)),
416                             new DateAndTime(Onf14DMDOMUtility.getLeafValue(wireInterfaceProblem,
417                                     Onf14DevicemanagerQNames.WIRE_INTERFACE_CURRENT_PROBLEMS_TIMESTAMP)),
418                             ltpUuid,
419                             Onf14DMDOMUtility.getLeafValue(wireInterfaceProblem,
420                                     Onf14DevicemanagerQNames.WIRE_INTERFACE_CURRENT_PROBLEMS_PROBLEM_NAME),
421                             InternalDataModelSeverity.mapSeverity(Onf14DMDOMUtility.getLeafValue(wireInterfaceProblem,
422                                             Onf14DevicemanagerQNames.WIRE_INTERFACE_CURRENT_PROBLEMS_PROBLEM_SEVERITY)));
423                 }
424             } else {
425                 log.debug("DBRead Id {} empty CurrentProblemList", ltpUuid);
426             }
427         }
428
429     }
430
431     private void registerForNotifications() {
432         QName[] airInterfaceNotifications = {Onf14DevicemanagerQNames.AIR_INTERFACE_OBJECT_CREATE_NOTIFICATION,
433                 Onf14DevicemanagerQNames.AIR_INTERFACE_OBJECT_AVC_NOTIFICATION,
434                 Onf14DevicemanagerQNames.AIR_INTERFACE_OBJECT_DELETE_NOTIFICATION,
435                 Onf14DevicemanagerQNames.AIR_INTERFACE_OBJECT_PROBLEM_NOTIFICATION};
436         netconfDomAccessor.doRegisterNotificationListener(airInterfaceNotificationListener, airInterfaceNotifications);
437
438         QName[] ethernetContainerNotifications =
439                 {Onf14DevicemanagerQNames.ETHERNET_CONTAINER_OBJECT_CREATE_NOTIFICATION,
440                         Onf14DevicemanagerQNames.ETHERNET_CONTAINER_OBJECT_AVC_NOTIFICATION,
441                         Onf14DevicemanagerQNames.ETHERNET_CONTAINER_OBJECT_DELETE_NOTIFICATION,
442                         Onf14DevicemanagerQNames.ETHERNET_CONTAINER_OBJECT_PROBLEM_NOTIFICATION};
443         netconfDomAccessor.doRegisterNotificationListener(ethernetContainerNotificationListener,
444                 ethernetContainerNotifications);
445
446         QName[] wireInterfaceNotifications = {Onf14DevicemanagerQNames.WIRE_INTERFACE_OBJECT_CREATE_NOTIFICATION,
447                 Onf14DevicemanagerQNames.WIRE_INTERFACE_OBJECT_AVC_NOTIFICATION,
448                 Onf14DevicemanagerQNames.WIRE_INTERFACE_OBJECT_DELETE_NOTIFICATION,
449                 Onf14DevicemanagerQNames.WIRE_INTERFACE_OBJECT_PROBLEM_NOTIFICATION};
450         netconfDomAccessor.doRegisterNotificationListener(wireInterfaceNotificationListener,
451                 wireInterfaceNotifications);
452     }
453
454     public Optional<NormalizedNode> readLtpData(NetconfDomAccessor netconfDomAccessor) {
455         log.info("Reading Logical Termination Point data");
456         return netconfDomAccessor.readDataNode(LogicalDatastoreType.CONFIGURATION, LTP_IID);
457     }
458 }