Skip to content

Commit

Permalink
Refactor getting netconf devices
Browse files Browse the repository at this point in the history
Add a null check to ensure that the values are not null.

JIRA: LIGHTY-235
Signed-off-by: tobias.pobocik <[email protected]>
  • Loading branch information
Tobianas committed Sep 22, 2023
1 parent 962fc7c commit cb72fc9
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,7 @@ public ResponseEntity getNetconfDevicesIds(Authentication authentication) throws
private List<NetconfDeviceResponse> getNetconfDevices(final Topology netconfTopology)
throws InterruptedException, TimeoutException, ExecutionException {
final List<NetconfDeviceResponse> devices = new ArrayList<>();
final Map<NodeKey, Node> netconfNodes =
Optional.ofNullable(netconfTopology.getNode())
.orElse(Collections.emptyMap());

for (Node node : netconfNodes.values()) {
for (Node node : netconfTopology.nonnullNode().values()) {
NetconfDeviceResponse nodeResponse = NetconfDeviceResponse.from(node);
final Optional<MountPoint> netconfMountPoint = mountPointService.getMountPoint(NETCONF_TOPOLOGY_IID
.child(Node.class, new NodeKey(node.getNodeId())));
Expand Down

0 comments on commit cb72fc9

Please sign in to comment.