diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-07-25 14:14:05 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-07-25 14:14:05 +0200 |
commit | d777a19bb804ae1a4268702da00d3138b028b386 (patch) | |
tree | b712eb964be320b142dad087e4713c1690b7cac1 | |
parent | e5a04ea35dc6f8c0f7f19997f89f6bc96a54d605 (diff) |
contrib: Add a python script to start sysmobts-remote and dump docs
This starts sysmobts-remote and dumps the documentation about the
VTY to the doc/ directory.
$ ./contrib/dump_docs.py
this writes doc/vty_reference.xml
-rwxr-xr-x | contrib/dump_docs.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/contrib/dump_docs.py b/contrib/dump_docs.py new file mode 100755 index 00000000..3c4197d6 --- /dev/null +++ b/contrib/dump_docs.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python + +""" +Start the process and dump the documentation to the doc dir +""" + +import socket, subprocess, time,os + +env = os.environ +env['L1FWD_BTS_HOST'] = '127.0.0.1' + +bts_proc = subprocess.Popen(["./src/osmo-bts-sysmo/sysmobts-remote", + "-c", "./doc/examples/osmo-bts.cfg"], env = env, + stdin=None, stdout=None) +time.sleep(1) + +try: + sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + sck.setblocking(1) + sck.connect(("localhost", 4241)) + sck.recv(4096) + + # Now send the command + sck.send("show online-help\r") + xml = "" + while True: + data = sck.recv(4096) + xml = "%s%s" % (xml, data) + if data.endswith('\r\nOsmoBTS> '): + break + + # Now write everything until the end to the file + out = open('doc/vty_reference.xml', 'w') + out.write(xml[18:-11]) + out.close() +finally: + # Clean-up + bts_proc.kill() + bts_proc.wait() + |