summaryrefslogtreecommitdiffhomepage
path: root/cli/gobgpcli
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-01-05 17:44:25 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-01-05 17:44:25 -0800
commitb896584828aaf7f6287842f34dc37f15c0cde1b8 (patch)
tree15ce9ca1c9b75cc0e363cb779bdbebd969551075 /cli/gobgpcli
parent626da9416938d54ae6a3925037c13a947d365d44 (diff)
cli: improve the state of neighbor
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'cli/gobgpcli')
-rwxr-xr-xcli/gobgpcli33
1 files changed, 24 insertions, 9 deletions
diff --git a/cli/gobgpcli b/cli/gobgpcli
index b1bb46aa..c973baa1 100755
--- a/cli/gobgpcli
+++ b/cli/gobgpcli
@@ -51,6 +51,13 @@ class Show(object):
return 1
def _neighbors(self, neighbor=None):
+ capdict = {1: "MULTIPROTOCOL",
+ 2: "ROUTE_REFRESH",
+ 4: "CARRYING_LABEL_INFO",
+ 64: "GRACEFUL_RESTART",
+ 65: "FOUR_OCTET_AS_NUMBER",
+ 70: "ENHANCED_ROUTE_REFRESH",
+ 128: "ROUTE_REFRESH_CISCO"}
r = requests.get(self.base_url + "/neighbors")
neighbors = r.json()
if self.options.debug:
@@ -60,19 +67,27 @@ class Show(object):
if neighbor is not None and neighbor != n["conf"]["remote_ip"]:
continue
print("BGP neighbor is {:s}, remote AS {:d}".format(n["conf"]["remote_ip"], n["conf"]["remote_as"]))
- print("BGP state = {:s}, up for {:s}".format(n["info"]["bgp_state"], str(timedelta(seconds=n["info"]["uptime"]))))
- print("Message statistics:")
- print(" Sent Rcvd")
- print(" Opens: {:>10d} {:>10d}".format(n["info"]["open_message_out"], n["info"]["open_message_in"]))
- print(" Notifications: {:>10d} {:>10d}".format(n["info"]["notification_out"], n["info"]["notification_in"]))
- print(" Updates: {:>10d} {:>10d}".format(n["info"]["update_message_out"], n["info"]["update_message_in"]))
- print(" Keepalives: {:>10d} {:>10d}".format(n["info"]["keepalive_message_out"], n["info"]["keepalive_message_in"]))
- print(" Route Refesh: {:>10d} {:>10d}".format(n["info"]["refresh_message_out"], n["info"]["refresh_message_in"]))
- print(" Total: {:>10d} {:>10d}".format(n["info"]["total_message_out"], n["info"]["total_message_in"]))
+ print(" BGP version 4, remote router ID {:s}".format(n["conf"]["id"]))
+ print(" BGP state = {:s}, up for {:s}".format(n["info"]["bgp_state"], str(timedelta(seconds=n["info"]["uptime"]))))
+ print(" Neighbor capabilities:")
+ for i in n["conf"]["CapList"]:
+ if i in capdict:
+ i = capdict[i]
+ print(" {:s}".format(i))
+ print(" Message statistics:")
+ print(" Sent Rcvd")
+ print(" Opens: {:>10d} {:>10d}".format(n["info"]["open_message_out"], n["info"]["open_message_in"]))
+ print(" Notifications: {:>10d} {:>10d}".format(n["info"]["notification_out"], n["info"]["notification_in"]))
+ print(" Updates: {:>10d} {:>10d}".format(n["info"]["update_message_out"], n["info"]["update_message_in"]))
+ print(" Keepalives: {:>10d} {:>10d}".format(n["info"]["keepalive_message_out"], n["info"]["keepalive_message_in"]))
+ print(" Route Refesh: {:>10d} {:>10d}".format(n["info"]["refresh_message_out"], n["info"]["refresh_message_in"]))
+ print(" Total: {:>10d} {:>10d}".format(n["info"]["total_message_out"], n["info"]["total_message_in"]))
print("")
return 0
def do_neighbors(self):
+ if len(self.args) != 1:
+ return 1
return self._neighbors()
def do_neighbor(self):