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 <[email protected]>
---
ryu/services/protocols/bgp/bgpspeaker.py | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/ryu/services/protocols/bgp/bgpspeaker.py
b/ryu/services/protocols/bgp/bgpspeaker.py
index 2f904a6..e38fe59 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\''
--
1.9.1
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel