public void onAlarmNotification(AlarmNotification notification) {
List<Nodes> allNodeList = new ArrayList<>();
InstanceIdentifier<ServiceNodelist> serviceNodeListIID = InstanceIdentifier.create(ServiceNodelist.class);
- try {
- ReadTransaction rtx = dataBroker.newReadOnlyTransaction();
+ try (ReadTransaction rtx = dataBroker.newReadOnlyTransaction()) {
Optional<ServiceNodelist> serviceListObject =
rtx.read(LogicalDatastoreType.OPERATIONAL, serviceNodeListIID).get();
if (serviceListObject.isPresent()) {
- for (Nodelist nodelist : serviceListObject.get().getNodelist()) {
- allNodeList.addAll(nodelist.getNodes());
+ for (Nodelist nodelist : serviceListObject.get().nonnullNodelist().values()) {
+ allNodeList.addAll(nodelist.nonnullNodes().values());
}
}
} catch (InterruptedException | ExecutionException ex) {