Host could be added into edge port if host packet arrived before lldp
packet.

Signed-off-by: Takeshi <[email protected]>
---
 ryu/topology/switches.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ryu/topology/switches.py b/ryu/topology/switches.py
index 382e555..af4bf80 100644
--- a/ryu/topology/switches.py
+++ b/ryu/topology/switches.py
@@ -803,6 +803,11 @@ class Switches(app_manager.RyuApp):
         if link not in self.links:
             self.send_event_to_observers(event.EventLinkAdd(link))

+            # remove hosts from edge port
+            for host in self.hosts.values():
+                if self._is_edge_port(host.port):
+                    del self.hosts[host.mac]
+
         if not self.links.update_link(src, dst):
             # reverse link is not detected yet.
             # So schedule the check early because it's very likely it's up
-- 
2.3.2 (Apple Git-55)


-- 
Yi Tseng (a.k.a Takeshi)
Taiwan National Chiao Tung University
Department of Computer Science
W2CNLab

http://blog.takeshi.tw
From ba9faae2a4937652dc7b9878f59f79bb3db01249 Mon Sep 17 00:00:00 2001
From: Takeshi <[email protected]>
Date: Fri, 21 Aug 2015 23:53:13 +0800
Subject: [PATCH] Remove hosts from edge port when link added

Host could be added into edge port if host packet arrived before lldp
packet.

Signed-off-by: Takeshi <[email protected]>
---
 ryu/topology/switches.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ryu/topology/switches.py b/ryu/topology/switches.py
index 382e555..af4bf80 100644
--- a/ryu/topology/switches.py
+++ b/ryu/topology/switches.py
@@ -803,6 +803,11 @@ class Switches(app_manager.RyuApp):
         if link not in self.links:
             self.send_event_to_observers(event.EventLinkAdd(link))
 
+            # remove hosts from edge port
+            for host in self.hosts.values():
+                if self._is_edge_port(host.port):
+                    del self.hosts[host.mac]
+
         if not self.links.update_link(src, dst):
             # reverse link is not detected yet.
             # So schedule the check early because it's very likely it's up
-- 
2.3.2 (Apple Git-55)

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

Reply via email to