summaryrefslogtreecommitdiffstats
path: root/tests/topotests/bgp_peer_type_multipath_relax/peer2/exa_readpipe.py
blob: 0f998c16131c855efefcc86689990aedd52e1b1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python2
"Helper script to read api commands from a pipe and feed them to ExaBGP"

import sys

if len(sys.argv) != 2:
    sys.exit(1)
fifo = sys.argv[1]

while True:
    pipe = open(fifo, "r")
    with pipe:
        line = pipe.readline().strip()
        if line != "":
            sys.stdout.write("{}\n".format(line))
            sys.stdout.flush()
        pipe.close()

sys.exit(0)