[ONOS-7740] Support lldp-port-description message during link discovery with Juniper
Change-Id: I6f399eb2565ac3a7ba5b41d0e1ea25ab59986bc5
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 613f6d4..af93653 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
@@ -19,6 +19,7 @@
import com.google.common.annotations.Beta;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
+import org.onosproject.net.AnnotationKeys;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
import org.onosproject.net.Port;
@@ -109,15 +110,18 @@
//find destination port by interface index
Optional<Port> remotePort = deviceService.getPorts(remoteDevice.id())
.stream().filter(port -> {
- if (port.number().toLong()
- == linkAbs.remotePortIndex) {
+ 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 (!remotePort.isPresent()) {
- log.warn("Port number {} does not exist in device {}",
- linkAbs.remotePortIndex, remoteDevice.id());
+ log.warn("Port number {} and Port description {} do not exist in device {}",
+ linkAbs.remotePortIndex, linkAbs.remotePortDescription, remoteDevice.id());
continue;
}