fix Link Discovery of Juniper driver
The Link Discovery of the Juniper driver leverages on some parameters
that has been changed in ONOS-6323
Change-Id: I6519ba1676de531a74340eaaddc8cc47912bb417
diff --git a/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/JuniperUtils.java b/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/JuniperUtils.java
index 2aeea4f..cd38ff88 100644
--- a/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/JuniperUtils.java
+++ b/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/JuniperUtils.java
@@ -432,7 +432,7 @@
String localPortName = neighbor.getString(LLDP_LO_PORT);
MacAddress mac = MacAddress.valueOf(
neighbor.getString(LLDP_REM_CHASS));
- int remotePortIndex =
+ long remotePortIndex =
neighbor.getInt(LLDP_REM_PORT);
LinkAbstraction link = new LinkAbstraction(
localPortName,
@@ -450,9 +450,9 @@
protected static final class LinkAbstraction {
protected String localPortName;
protected ChassisId remoteChassisId;
- protected int remotePortIndex;
+ protected long remotePortIndex;
- protected LinkAbstraction(String pName, long chassisId, int pIndex) {
+ protected LinkAbstraction(String pName, long chassisId, long pIndex) {
this.localPortName = pName;
this.remoteChassisId = new ChassisId(chassisId);
this.remotePortIndex = pIndex;
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 1c9f208..3b7d5f6 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
@@ -109,15 +109,14 @@
//find destination port by interface index
Optional<Port> remotePort = deviceService.getPorts(remoteDevice.id())
.stream().filter(port -> {
- if (port.annotations().value("index") != null &&
- Integer.parseInt(port.annotations().value("index"))
+ if (port.number().toLong()
== linkAbs.remotePortIndex) {
return true;
}
return false;
}).findAny();
if (!remotePort.isPresent()) {
- log.warn("Port with index {} does not exist in device {}",
+ log.warn("Port number {} does not exist in device {}",
linkAbs.remotePortIndex, remoteDevice.id());
continue;
}