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.orgHello Harald Welte,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/645
to look at the new patch set (#2).
Add python functions to get/set ctrl variables
Add get_var and set_var functions which handle requested variable while
checking for proper response and id.
Change-Id: I2bc275b801a4b78642653f5b0a91e8cbea25422a
Related: OS#1646
---
M openbsc/contrib/bsc_control.py
1 file changed, 22 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/45/645/2
diff --git a/openbsc/contrib/bsc_control.py b/openbsc/contrib/bsc_control.py
index 4fc8b4d..dda319b 100755
--- a/openbsc/contrib/bsc_control.py
+++ b/openbsc/contrib/bsc_control.py
@@ -44,6 +44,28 @@
getmsg = "GET %s %s" %(op_id, var)
send(sck, getmsg)
+def do_set_get(sck, var, is_get = True, value = None):
+ r = random.randint(1, sys.maxint)
+ if (is_get):
+ s = 'GET_REPLY'
+ do_get(var, r, sck)
+ else:
+ s = 'SET_REPLY'
+ do_set(var, value, r, sck)
+ (answer, data) = remove_ipa_ctrl_header(sck.recv(4096))
+ x = answer.split()
+ if (s == x[0] and str(r) == x[1] and var == x[2]):
+ if (not is_get and value != x[3]):
+ return None
+ return x[3]
+ return None
+
+def set_var(sck, var, val):
+ return do_set_get(sck, var, False, val)
+
+def get_var(sck, var):
+ return do_set_get(sck, var)
+
if __name__ == '__main__':
random.seed()
--
To view, visit https://gerrit.osmocom.org/645
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I2bc275b801a4b78642653f5b0a91e8cbea25422a
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>