summaryrefslogtreecommitdiffhomepage
path: root/tools/grpc
diff options
context:
space:
mode:
authorHiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>2015-12-07 16:37:31 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-12-07 05:18:46 -0800
commit3213eed6a5aca1625ffa03ab410ffc587121b9da (patch)
tree4ec12e689aad0b5287e67e4a9ec77cb00ab44ed7 /tools/grpc
parentff5663a7c9c47989623bdf9b9d78a1030b2ed1e8 (diff)
doc: update python grpc instruction
Signed-off-by: Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>
Diffstat (limited to 'tools/grpc')
-rw-r--r--tools/grpc/python/get_neighbor.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/grpc/python/get_neighbor.py b/tools/grpc/python/get_neighbor.py
index 91dc6d2c..867f1124 100644
--- a/tools/grpc/python/get_neighbor.py
+++ b/tools/grpc/python/get_neighbor.py
@@ -1,11 +1,14 @@
import gobgp_pb2
import sys
+from grpc.beta import implementations
+
_TIMEOUT_SECONDS = 10
def run(gobgpd_addr, neighbor_addr):
- with gobgp_pb2.early_adopter_create_GobgpApi_stub(gobgpd_addr, 8080) as stub:
+ channel = implementations.insecure_channel(gobgpd_addr, 8080)
+ with gobgp_pb2.beta_create_GobgpApi_stub(channel) 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.neighbor_address, peer.conf.peer_as))
print(" BGP version 4, remote router ID %s" % (peer.conf.id))