summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-06-30 21:30:02 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-06-30 21:50:49 +0900
commit24220ea2e8c007f99e9e64934cfb865bd25d85d0 (patch)
treec889ef34b84d2e1a660f5482530746eef7118d27
parent736e877540a531fb6e4947df0072d209c252626e (diff)
bgp: fix withdraw in EventPrefix notification
A lost path's is_withdraw is not True so we can't use it. Let's pass path and is_withdraw information separately to emit_signal(). Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Reviewed-by: Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>
-rw-r--r--ryu/services/protocols/bgp/bgpspeaker.py8
-rw-r--r--ryu/services/protocols/bgp/info_base/ipv4.py4
-rw-r--r--ryu/services/protocols/bgp/info_base/ipv6.py4
-rw-r--r--ryu/services/protocols/bgp/signals/emit.py4
4 files changed, 11 insertions, 9 deletions
diff --git a/ryu/services/protocols/bgp/bgpspeaker.py b/ryu/services/protocols/bgp/bgpspeaker.py
index 4f176709..73bc72d4 100644
--- a/ryu/services/protocols/bgp/bgpspeaker.py
+++ b/ryu/services/protocols/bgp/bgpspeaker.py
@@ -132,21 +132,23 @@ class BGPSpeaker(object):
ssh_cli = app_mgr.instantiate(ssh.Cli)
ssh_cli.start()
- def _notify_best_path_changed(self, path):
+ def _notify_best_path_changed(self, path, is_withdraw):
if not path.source:
# ours
return
ev = EventPrefix(remote_as=path.source.remote_as,
route_dist=None,
prefix=path.nlri.addr + '/' + str(path.nlri.length),
- nexthop=path.nexthop, is_withdraw=path.is_withdraw)
+ nexthop=path.nexthop, is_withdraw=is_withdraw)
if self._best_path_change_handler:
self._best_path_change_handler(ev)
def _init_signal_listeners(self):
CORE_MANAGER.get_core_service()._signal_bus.register_listener(
BgpSignalBus.BGP_BEST_PATH_CHANGED,
- lambda _, dest: self._notify_best_path_changed(dest)
+ lambda _, info:
+ self._notify_best_path_changed(info['path'],
+ info['is_withdraw'])
)
def _core_start(self, settings):
diff --git a/ryu/services/protocols/bgp/info_base/ipv4.py b/ryu/services/protocols/bgp/info_base/ipv4.py
index 13d7f62d..cf18c237 100644
--- a/ryu/services/protocols/bgp/info_base/ipv4.py
+++ b/ryu/services/protocols/bgp/info_base/ipv4.py
@@ -39,11 +39,11 @@ class IPv4Dest(Destination, NonVrfPathProcessingMixin):
def _best_path_lost(self):
old_best_path = self._best_path
NonVrfPathProcessingMixin._best_path_lost(self)
- self._core_service._signal_bus.best_path_changed(old_best_path)
+ self._core_service._signal_bus.best_path_changed(old_best_path, True)
def _new_best_path(self, best_path):
NonVrfPathProcessingMixin._new_best_path(self, best_path)
- self._core_service._signal_bus.best_path_changed(best_path)
+ self._core_service._signal_bus.best_path_changed(best_path, False)
class Ipv4Table(Table):
diff --git a/ryu/services/protocols/bgp/info_base/ipv6.py b/ryu/services/protocols/bgp/info_base/ipv6.py
index 670f9964..01d68bb4 100644
--- a/ryu/services/protocols/bgp/info_base/ipv6.py
+++ b/ryu/services/protocols/bgp/info_base/ipv6.py
@@ -39,11 +39,11 @@ class IPv6Dest(Destination, NonVrfPathProcessingMixin):
def _best_path_lost(self):
old_best_path = self._best_path
NonVrfPathProcessingMixin._best_path_lost(self)
- self._core_service._signal_bus.best_path_changed(old_best_path)
+ self._core_service._signal_bus.best_path_changed(old_best_path, True)
def _new_best_path(self, best_path):
NonVrfPathProcessingMixin._new_best_path(self, best_path)
- self._core_service._signal_bus.best_path_changed(best_path)
+ self._core_service._signal_bus.best_path_changed(best_path, False)
class Ipv6Table(Table):
diff --git a/ryu/services/protocols/bgp/signals/emit.py b/ryu/services/protocols/bgp/signals/emit.py
index 18a12871..890c1bc7 100644
--- a/ryu/services/protocols/bgp/signals/emit.py
+++ b/ryu/services/protocols/bgp/signals/emit.py
@@ -55,7 +55,7 @@ class BgpSignalBus(SignalBus):
vrf_conf
)
- def best_path_changed(self, best_path):
+ def best_path_changed(self, path, is_withdraw):
return self.emit_signal(
self.BGP_BEST_PATH_CHANGED,
- best_path)
+ {'path': path, 'is_withdraw': is_withdraw})