'core.reset_neighbor' was synchronous API and the caller had to wait until neighbor comes up. This behavior doesn't work well with rpc_cli.
Signed-off-by: ISHIDA Wataru <ishida.wat...@lab.ntt.co.jp> --- ryu/services/protocols/bgp/api/core.py | 11 +++++++---- ryu/services/protocols/bgp/net_ctrl.py | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ryu/services/protocols/bgp/api/core.py b/ryu/services/protocols/bgp/api/core.py index e45adf2..4d9a516 100644 --- a/ryu/services/protocols/bgp/api/core.py +++ b/ryu/services/protocols/bgp/api/core.py @@ -69,10 +69,13 @@ def reset_neighor(ip_address): if neigh_conf.enabled: # Disable neighbor to close existing session. neigh_conf.enabled = False - # Yield here so that we give chance for neighbor to be disabled. - hub.sleep(NEIGHBOR_RESET_WAIT_TIME) - # Enable neighbor, so that we have a new session with it. - neigh_conf.enabled = True + # Enable neighbor after NEIGHBOR_RESET_WAIT_TIME + # this API works asynchronously + # it's recommended to check it really reset neighbor later + + def up(): + neigh_conf.enabled = True + hub.spawn_after(NEIGHBOR_RESET_WAIT_TIME, up) else: raise RuntimeConfigError('Neighbor %s is not enabled, hence cannot' ' reset.' % ip_address) diff --git a/ryu/services/protocols/bgp/net_ctrl.py b/ryu/services/protocols/bgp/net_ctrl.py index fec29ee..f0dd888 100644 --- a/ryu/services/protocols/bgp/net_ctrl.py +++ b/ryu/services/protocols/bgp/net_ctrl.py @@ -94,7 +94,7 @@ class RpcSession(Activity): """ def __init__(self, socket, outgoing_msg_sink_iter): - super(RpcSession, self).__init__() + super(RpcSession, self).__init__("RpcSession(%s)" % socket) import msgpack self._packer = msgpack.Packer() -- 1.7.10.4 ------------------------------------------------------------------------------ Infragistics Professional Build stunning WinForms apps today! Reboot your WinForms applications with our WinForms controls. Build a bridge from your legacy apps to the future. http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel