On Mon, 17 Aug 2015 23:19:55 +0900 (JST) FUJITA Tomonori <fujita.tomon...@lab.ntt.co.jp> wrote:
> Oops, looks like I left out exporting the important API (I'll export > this soon). But, you can easily do such. How about the following? = >From ba66fb909eda153b215f2d7440c8e649a04a6da3 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori <fujita.tomon...@lab.ntt.co.jp> Date: Wed, 19 Aug 2015 09:27:24 +0900 Subject: [PATCH] bgp: add neighbor_state_get method Can be used to get the state of peer(s). Signed-off-by: FUJITA Tomonori <fujita.tomon...@lab.ntt.co.jp> --- ryu/services/protocols/bgp/bgpspeaker.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ryu/services/protocols/bgp/bgpspeaker.py b/ryu/services/protocols/bgp/bgpspeaker.py index 8998d7e..5fe381f 100644 --- a/ryu/services/protocols/bgp/bgpspeaker.py +++ b/ryu/services/protocols/bgp/bgpspeaker.py @@ -376,6 +376,21 @@ class BGPSpeaker(object): neighbors.CHANGES: attribute_param} call(func_name, **param) + def neighbor_state_get(self, address=None, format='json'): + """ This method returns the state of peer(s) in a json + format. + + ``address`` specifies the address of a peer. If not given, the + state of all the peers return. + + """ + show = {} + show['params'] = ['neighbor', 'summary'] + if address: + show['params'].append(address) + show['format'] = format + return call('operator.show', **show) + def prefix_add(self, prefix, next_hop=None, route_dist=None): """ This method adds a new prefix to be advertized. -- 1.9.1 ------------------------------------------------------------------------------ _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel