diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-02-24 18:30:56 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-02-24 18:30:56 +0900 |
commit | 81ffbdf484622065ffc9dae9e28dc1ab83545fc2 (patch) | |
tree | 5c8d87750f217baaba0e152da60881c5c1c29502 /cli | |
parent | 924765a0cb6f32f52d0802fab778b70b5abe75f8 (diff) |
cli: pretty up State printing
Explicitly show adminstate idle.
fujita@ubuntu:~/git/gobgp$ ./cli/gobgpcli show neighbors
Peer AS Up/Down State |#Advertised Received Accepted
10.0.255.1 65001 never Idle(Admin) | 0 0 0
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'cli')
-rwxr-xr-x | cli/gobgpcli | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cli/gobgpcli b/cli/gobgpcli index 29dcecdd..cdf5b56e 100755 --- a/cli/gobgpcli +++ b/cli/gobgpcli @@ -179,7 +179,7 @@ class Show(object): maxtimelen = len(str(t)) n["info"]["time"] = t - h = "{:%ds} {:>%ds} {:%ds} {:8s} |" % (maxaddrlen, maxaslen, maxtimelen) + h = "{:%ds} {:>%ds} {:%ds} {:11s} |" % (maxaddrlen, maxaslen, maxtimelen) f1 = h + "#{:8s} {:8s} {:8s}" print(f1.format("Peer", "AS", "Up/Down", "State", "Advertised", "Received", "Accepted")) for n in sorted_neighbors: @@ -197,6 +197,9 @@ class Show(object): elif s == "BGP_FSM_ESTABLISHED": state = "Establ" + if n["info"]["AdminState"] == "ADMIN_STATE_DOWN": + state = "Idle(Admin)" + f2 = h + " {:>8d} {:>8d} {:>8d}" print f2.format(n["conf"]["remote_ip"], str(n["conf"]["remote_as"]), n["info"]["time"], state, n["info"]["Advertized"], n["info"]["Received"], n["info"]["Accepted"]) return 0 |