diff options
Diffstat (limited to 'tools/grpc/python')
-rw-r--r-- | tools/grpc/python/list_peer.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/grpc/python/list_peer.py b/tools/grpc/python/list_peer.py new file mode 100644 index 00000000..6f56dd45 --- /dev/null +++ b/tools/grpc/python/list_peer.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +from __future__ import absolute_import +from __future__ import print_function + +import grpc +from google.protobuf.any_pb2 import Any + +import gobgp_pb2 +import gobgp_pb2_grpc +import attribute_pb2 + +_TIMEOUT_SECONDS = 1000 + + +def run(): + channel = grpc.insecure_channel('localhost:50051') + stub = gobgp_pb2_grpc.GobgpApiStub(channel) + + peers = stub.ListPeer( + gobgp_pb2.ListPeerRequest( + ), + _TIMEOUT_SECONDS, + ) + + for peer in peers: + print(peer) + + +if __name__ == '__main__': + run() |