diff options
-rw-r--r-- | ryu/services/protocols/bgp/bgpspeaker.py | 8 | ||||
-rw-r--r-- | ryu/services/protocols/bgp/info_base/ipv4.py | 4 | ||||
-rw-r--r-- | ryu/services/protocols/bgp/info_base/ipv6.py | 4 | ||||
-rw-r--r-- | ryu/services/protocols/bgp/signals/emit.py | 4 |
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}) |