summaryrefslogtreecommitdiff
path: root/tests/topotests/bgp_features/peer3/exa_readpipe.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/topotests/bgp_features/peer3/exa_readpipe.py')
-rw-r--r--tests/topotests/bgp_features/peer3/exa_readpipe.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/topotests/bgp_features/peer3/exa_readpipe.py b/tests/topotests/bgp_features/peer3/exa_readpipe.py
new file mode 100644
index 0000000000..dba1536388
--- /dev/null
+++ b/tests/topotests/bgp_features/peer3/exa_readpipe.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+"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)