---
 ryu/topology/switches.py |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ryu/topology/switches.py b/ryu/topology/switches.py
index 644a1fe..31584b6 100644
--- a/ryu/topology/switches.py
+++ b/ryu/topology/switches.py
@@ -249,6 +249,7 @@ class PortData(object):
         self.lldp_data = lldp_data
         self.timestamp = None
         self.sent = 0
+        self.delay = 0
 
     def lldp_sent(self):
         self.timestamp = time.time()
@@ -766,6 +767,7 @@ class Switches(app_manager.RyuApp):
 
     @set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
     def lldp_packet_in_handler(self, ev):
+        recv_timestamp = time.time()
         if not self.link_discovery:
             return
 
@@ -786,6 +788,13 @@ class Switches(app_manager.RyuApp):
             LOG.error('cannot accept LLDP. unsupported version. %x',
                       msg.datapath.ofproto.OFP_VERSION)
 
+        # get the lldp delay
+        for port in self.ports.keys():
+            if src_dpid == port.dpid and src_port_no == port.port_no:
+                send_timestamp = self.ports[port].timestamp
+                if send_timestamp:
+                    self.ports[port].delay = recv_timestamp - send_timestamp
+
         src = self._get_port(src_dpid, src_port_no)
         if not src or src.dpid == dst_dpid:
             return
-- 
1.7.9.5


------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to