In case of selecting new best path, Ryu BGPSpeaker send withdraw messages.

Signed-off-by: Toshiki Tsuboi <[email protected]>
---
 ryu/services/protocols/bgp/info_base/base.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/ryu/services/protocols/bgp/info_base/base.py 
b/ryu/services/protocols/bgp/info_base/base.py
index d3bc445..8ddbb0a 100644
--- a/ryu/services/protocols/bgp/info_base/base.py
+++ b/ryu/services/protocols/bgp/info_base/base.py
@@ -257,6 +257,16 @@ class NonVrfPathProcessingMixin(object):
         pm = self._core_service.peer_manager
         pm.comm_new_best_to_bgp_peers(new_best_path)
 
+        # withdraw old best path
+        if old_best_path and self._sent_routes:
+            for sent_route in self._sent_routes.values():
+                sent_path = sent_route.path
+                withdraw_clone = sent_path.clone(for_withdrawal=True)
+                outgoing_route = OutgoingRoute(withdraw_clone)
+                sent_route.sent_peer.enque_outgoing_msg(outgoing_route)
+                LOG.debug('Sending withdrawal to %s for %s' %
+                          (sent_route.sent_peer, outgoing_route))
+
 
 class Destination(object):
     """State about a particular destination.
-- 
1.9.3 (Apple Git-50)
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to