If remove port data from self.port_state first,
self.get_port method can't get the port data,
this problem will cause link can't immediately be removed.
This patch remove port data after get_port and link delete.

Signed-off-by: Yu Ren <j6y4u4x...@gmail.com>
Signed-off-by: mgrex97 <j6y4u4x...@gmail.com>
---
 ryu/topology/switches.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ryu/topology/switches.py b/ryu/topology/switches.py
index 644a1fe..7264075 100644
--- a/ryu/topology/switches.py
+++ b/ryu/topology/switches.py
@@ -717,7 +717,6 @@ class Switches(app_manager.RyuApp):
             # LOG.debug('A port was deleted.' +
             #           '(datapath id = %s, port number = %s)',
             #           dp.id, ofpport.port_no)
-            self.port_state[dp.id].remove(ofpport.port_no)
             self.send_event_to_observers(
                 event.EventPortDelete(Port(dp.id, dp.ofproto, ofpport)))
 
@@ -730,6 +729,8 @@ class Switches(app_manager.RyuApp):
                 self._link_down(port)
                 self.lldp_event.set()
 
+            self.port_state[dp.id].remove(ofpport.port_no)
+
         else:
             assert reason == dp.ofproto.OFPPR_MODIFY
             # LOG.debug('A port was modified.' +
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to