File: list_peer.py

package info (click to toggle)
gobgp 3.36.0-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid, trixie
  • size: 5,916 kB
  • sloc: python: 11,743; sh: 3,653; makefile: 90; cpp: 70
file content (31 lines) | stat: -rw-r--r-- 544 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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()