From: Jonas MÃ¥rtensson Date: Tue, 5 May 2020 06:48:06 +0000 (+0200) Subject: Read all LLDP neighbours even if one fails X-Git-Tag: 2.0.0~136 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=transportpce.git;a=commitdiff_plain;h=d168c9032e59e4580ebdc59b9473598ff0159803 Read all LLDP neighbours even if one fails 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 --- 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