[PATCH] openbsc[master]: Add python function to get ctrl variable

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Mon Aug 1 16:56:45 UTC 2016


Review at  https://gerrit.osmocom.org/645

Add python function to get ctrl variable

Add get_var function which obtains requested variable while checking for
proper response and id.

Change-Id: I2bc275b801a4b78642653f5b0a91e8cbea25422a
Related: OS#1646
---
M openbsc/contrib/bsc_control.py
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/45/645/1

diff --git a/openbsc/contrib/bsc_control.py b/openbsc/contrib/bsc_control.py
index 4fc8b4d..f8136f1 100755
--- a/openbsc/contrib/bsc_control.py
+++ b/openbsc/contrib/bsc_control.py
@@ -44,6 +44,15 @@
 	getmsg = "GET %s %s" %(op_id, var)
 	send(sck, getmsg)
 
+def get_var(var, sck):
+        r = random.randint(1, sys.maxint)
+        do_get(var, r, sck)
+        (answer, data) = remove_ipa_ctrl_header(sck.recv(4096))
+        x  = answer.split()
+        if ('GET_REPLY' == x[0] and str(r) == x[1] and var == x[2]):
+                return x[3]
+        return None
+
 if __name__ == '__main__':
         random.seed()
 

-- 
To view, visit https://gerrit.osmocom.org/645
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2bc275b801a4b78642653f5b0a91e8cbea25422a
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list