From d168c9032e59e4580ebdc59b9473598ff0159803 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jonas=20M=C3=A5rtensson?= Date: Tue, 5 May 2020 08:48:06 +0200 Subject: [PATCH] Read all LLDP neighbours even if one fails MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Currently in the readLLDP function, when looping over all neighbours in nbrList, if createR2RLink for one neighbour fails, the whole function returns which means that the rest of the neighbors in nbrList are never processed. I think it makes more sense to continue the loop and create R2R links for other neighbors. This patch proposes to do that while still returning false if one createR2RLink fails. Signed-off-by: Jonas MÃ¥rtensson Change-Id: I73d587cc52c1b11e449baf3c69c9179a7dc2483d --- .../transportpce/networkmodel/R2RLinkDiscovery.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/R2RLinkDiscovery.java b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/R2RLinkDiscovery.java index fc4d287e1..a8c34043d 100644 --- a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/R2RLinkDiscovery.java +++ b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/R2RLinkDiscovery.java @@ -71,6 +71,7 @@ public class R2RLinkDiscovery { } NbrList nbrList = protocolObject.get().augmentation(Protocols1.class).getLldp().getNbrList(); LOG.info("LLDP subtree is present. Device has {} neighbours", nbrList.getIfName().size()); + boolean success = true; for (IfName ifName : nbrList.getIfName()) { if (ifName.getRemoteSysName() == null) { LOG.warn("LLDP subtree neighbour is empty for nodeId: {}, ifName: {}", @@ -88,12 +89,12 @@ public class R2RLinkDiscovery { ifName.getRemotePortId())) { LOG.error("Link Creation failed between {} and {} nodes.", nodeId.getValue(), ifName.getRemoteSysName()); - return false; + success = false; } } } } - return true; + return success; } else if (nodeVersion.equals(OPENROADM_DEVICE_VERSION_2_2_1)) { InstanceIdentifier