ONOS-7832 - query device services for the latest chassis ID for lldp
Change-Id: Ic57bdd589e25f889f46edaac527469be9d319979
diff --git a/providers/lldpcommon/src/main/java/org/onosproject/provider/lldpcommon/LinkDiscovery.java b/providers/lldpcommon/src/main/java/org/onosproject/provider/lldpcommon/LinkDiscovery.java
index 3d69235..33e5f4d 100644
--- a/providers/lldpcommon/src/main/java/org/onosproject/provider/lldpcommon/LinkDiscovery.java
+++ b/providers/lldpcommon/src/main/java/org/onosproject/provider/lldpcommon/LinkDiscovery.java
@@ -20,6 +20,7 @@
import io.netty.util.Timeout;
import io.netty.util.TimerTask;
import io.netty.util.internal.StringUtil;
+import org.onlab.packet.ChassisId;
import org.onlab.packet.Ethernet;
import org.onlab.packet.MacAddress;
import org.onlab.packet.ONOSLLDP;
@@ -249,7 +250,8 @@
if (portNumber == null) {
return null;
}
- ONOSLLDP lldp = getLinkProbe(portNumber, portDesc);
+ ONOSLLDP lldp = getLinkProbe(context.deviceService().getDevice(device.id()).chassisId(),
+ portNumber, portDesc);
ethPacket.setSourceMACAddress(context.fingerprint()).setPayload(lldp);
return new DefaultOutboundPacket(device.id(),
builder().setOutput(portNumber(portNumber)).build(),
@@ -267,15 +269,16 @@
if (portNumber == null) {
return null;
}
- ONOSLLDP lldp = getLinkProbe(portNumber, portDesc);
+ ONOSLLDP lldp = getLinkProbe(context.deviceService().getDevice(device.id()).chassisId(),
+ portNumber, portDesc);
bddpEth.setSourceMACAddress(context.fingerprint()).setPayload(lldp);
return new DefaultOutboundPacket(device.id(),
builder().setOutput(portNumber(portNumber)).build(),
ByteBuffer.wrap(bddpEth.serialize()));
}
- private ONOSLLDP getLinkProbe(Long portNumber, String portDesc) {
- return ONOSLLDP.onosSecureLLDP(device.id().toString(), device.chassisId(), portNumber.intValue(), portDesc,
+ private ONOSLLDP getLinkProbe(ChassisId chassisId, Long portNumber, String portDesc) {
+ return ONOSLLDP.onosSecureLLDP(device.id().toString(), chassisId, portNumber.intValue(),
context.lldpSecret());
}