I am also working with extending LLDP in ONOS. I am not going to replace it, but I am definitely extending the functionality. :)
I have not made a deep reading of the link provider/discovery app, but maybe I can help on my knowledge about it.
I think we have one place to look at in the LinkDiscovery
class. Furthermore, I assume you are only interested in ONOSLLDP
packets, which, btw, extends the LLDP packet. But the process of identifying the source device and port, are not the exactly same.
If you check the code in processOnosLldp
, you will notice that if everything is fine with the packet, ONOS will store the information as a LinkDescription
object. This object takes the source and destination ConnectPoints
as input when creating it. The ConnecPoints
(one for source device
and one for destination device
) are, from a simple point of view, a combination of source device id & port and also destination device id & port. In summary, it seems that link information is stored as a combination of ConnecPoints
involved in an LLDP transaction.
Now, you asked if it keeps any reference to switch/device MAC address. Well, if you check the code from LinkDiscovery, you can see that the app is extracting a value from an LLDP TLV (idString
). This value should represent de source device id. This value is used, with the source port, as the input to create a Connecpoint
ONOS knows both the source device and port, when the OPENFLOW PACKET_IN arrives from the destination device, because it was at first ONOS that told the source device to output the LLDP packet to the port towards the destination device. And because it was ONOS itself telling it to do so, it also serialized the device id and source port as part of TLVs. It is the LLDP deserializer (when the packet arrives to ONOS again) that extracts this information. See the deserializer here
. Of course, you can find the part of the code that created the ONOS LLDP packet and serialized the information in the beginning.
I think the one-to-one mapping you ask about is clear in this
line. I believe it does not store a MAC-port relation, but it keeps track of ConnecPoints
). Likewise, I have not analyzed the app, entirely, but that is my opinion so far.
I hope it helps,