ONOS-7750
Support Juniper "lldp-remote-port-id" message as String during link discovery
Change-Id: Ic1881c973e07df780692b34772a61dec6cbdc157
diff --git a/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/LinkDiscoveryJuniperImpl.java b/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/LinkDiscoveryJuniperImpl.java
index af93653..37e655a 100644
--- a/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/LinkDiscoveryJuniperImpl.java
+++ b/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/LinkDiscoveryJuniperImpl.java
@@ -110,18 +110,29 @@
//find destination port by interface index
Optional<Port> remotePort = deviceService.getPorts(remoteDevice.id())
.stream().filter(port -> {
- if (port.number().toLong() == linkAbs.remotePortIndex) {
- return true;
- }
- if (port.annotations().value(AnnotationKeys.PORT_NAME) != null
- && port.annotations().value(AnnotationKeys.PORT_NAME).equals(linkAbs.remotePortDescription)) {
- return true;
- }
- return false;
- }).findAny();
+ if (port.number().toLong() == linkAbs.remotePortIndex) {
+ return true;
+ }
+ if (port.annotations().value(AnnotationKeys.PORT_MAC) != null
+ && linkAbs.remotePortId != null
+ && port.annotations().value(AnnotationKeys.PORT_MAC).equals(linkAbs.remotePortId)) {
+ return true;
+ }
+ if (port.annotations().value(AnnotationKeys.PORT_NAME) != null
+ && linkAbs.remotePortId != null
+ && port.annotations().value(AnnotationKeys.PORT_NAME).equals(linkAbs.remotePortId)) {
+ return true;
+ }
+ if (port.annotations().value(AnnotationKeys.PORT_NAME) != null
+ && linkAbs.remotePortDescription != null
+ && port.annotations().value(AnnotationKeys.PORT_NAME)
+ .equals(linkAbs.remotePortDescription)) {
+ return true;
+ }
+ return false;
+ }).findAny();
if (!remotePort.isPresent()) {
- log.warn("Port number {} and Port description {} do not exist in device {}",
- linkAbs.remotePortIndex, linkAbs.remotePortDescription, remoteDevice.id());
+ log.warn("Port Index and Port Id and Port description do not exist in device {}", remoteDevice.id());
continue;
}