summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorToshiki Tsuboi <t.tsubo2000@gmail.com>2015-02-06 16:30:49 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-02-08 10:16:57 +0900
commitef0c72c5bf0633598caebb61793eac95db8fbedf (patch)
treeabd9bcc04f68569ba9e7406b4532f21556a21e2a
parent973d43f6fb853226bd84ff2b80f23fd3148f766b (diff)
bgp: support of new api for "show neighbor"
You can understand adj-RIB-in information through new api. - received-routes : paths received and not withdrawn by given peer - sent-routes : paths sent and not withdrawn to given peer (sample log of show neighbor) INFO:bgpspeaker.api.base:API method operator.show called with args: {'params': ['neighbor', 'received-routes', '192.168.101.101', 'all'], 'format': 'cli'} Status codes: x filtered Origin codes: i - IGP, e - EGP, ? - incomplete Timestamp Network Labels Next Hop Metric LocPrf Path 2015/02/06 06:52:04 192.168.1.0/30 None 192.168.101.101 100 None [65010] i 2015/02/06 06:52:04 192.168.2.0/30 None 192.168.101.101 100 None [65010] i 2015/02/06 06:52:04 0.0.0.0/0 None 192.168.101.101 100 None [65010, 65001] i Signed-off-by: Toshiki Tsuboi <t.tsubo2000@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/services/protocols/bgp/bgpspeaker.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/ryu/services/protocols/bgp/bgpspeaker.py b/ryu/services/protocols/bgp/bgpspeaker.py
index 2f904a65..e38fe590 100644
--- a/ryu/services/protocols/bgp/bgpspeaker.py
+++ b/ryu/services/protocols/bgp/bgpspeaker.py
@@ -491,6 +491,29 @@ class BGPSpeaker(object):
show['format'] = format
return call('operator.show', **show)
+ def neighbor_get(self, routetype, address, format='json'):
+ """ This method returns the BGP adj-RIB-in information in a json
+ format.
+
+ ``routetype`` This parameter is necessary for only received-routes
+ and sent-routes.
+
+ received-routes : paths received and not withdrawn by given peer
+
+ sent-routes : paths sent and not withdrawn to given peer
+
+ ``address`` specifies the IP address of the peer. It must be
+ the string representation of an IP address.
+
+ """
+ show = {}
+ if routetype == 'sent-routes' or routetype == 'received-routes':
+ show['params'] = ['neighbor', routetype, address, 'all']
+ else:
+ show['params'] = ['neighbor', 'received-routes', address, 'all']
+ show['format'] = format
+ return call('operator.show', **show)
+
def _set_filter(self, filter_type, address, filters):
assert filter_type in ('in', 'out'),\
'filter type must be \'in\' or \'out\''