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>
This commit is contained in:
parent
973d43f6fb
commit
ef0c72c5bf
@ -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\''
|
||||
|
Loading…
x
Reference in New Issue
Block a user