diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-11-05 19:41:37 -0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-11-05 19:41:37 -0800 |
commit | 0f555dfc902206193f164030a162229f40ad813e (patch) | |
tree | b318c3e7e0eeeb17857d3014fa51fafbc248c190 | |
parent | 1cc19fd2800f047795473c5e2d6dbdfb86e24a70 (diff) |
tool: update grpc python example code
for the latest API.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | tools/grpc/python/get_neighbor.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tools/grpc/python/get_neighbor.py b/tools/grpc/python/get_neighbor.py index 590599d2..91dc6d2c 100644 --- a/tools/grpc/python/get_neighbor.py +++ b/tools/grpc/python/get_neighbor.py @@ -7,16 +7,15 @@ _TIMEOUT_SECONDS = 10 def run(gobgpd_addr, neighbor_addr): with gobgp_pb2.early_adopter_create_GobgpApi_stub(gobgpd_addr, 8080) as stub: peer = stub.GetNeighbor(gobgp_pb2.Arguments(rf=4, name=neighbor_addr), _TIMEOUT_SECONDS) - print("BGP neighbor is %s, remote AS %d" % (peer.conf.remote_ip, peer.conf.remote_as)) - print(" BGP version 4, remote router ID %s" % ( peer.conf.id)) - print(" BGP state = %s, up for %s" % ( peer.info.bgp_state, peer.info.uptime)) + print("BGP neighbor is %s, remote AS %d" % (peer.conf.neighbor_address, peer.conf.peer_as)) + print(" BGP version 4, remote router ID %s" % (peer.conf.id)) + print(" BGP state = %s, up for %s" % (peer.info.bgp_state, peer.timers.state.uptime)) print(" BGP OutQ = %d, Flops = %d" % (peer.info.out_q, peer.info.flops)) - print(" Hold time is %d, keepalive interval is %d seconds" % ( peer.info.negotiated_holdtime, peer.info.keepalive_interval)) - print(" Configured hold time is %d, keepalive interval is %d seconds" % ( peer.conf.holdtime, peer.conf.keepalive_interval)) + print(" Hold time is %d, keepalive interval is %d seconds" % (peer.timers.state.negotiated_hold_time, peer.timers.state.keepalive_interval)) + print(" Configured hold time is %d, keepalive interval is %d seconds" % (peer.timers.config.hold_time, peer.timers.config.keepalive_interval)) if __name__ == '__main__': gobgp = sys.argv[1] neighbor = sys.argv[2] run(gobgp, neighbor) - |