Update ctrl command parsing for python3
* make parse() return command id in addition to variable name and value
* introduce parse_kv() wrapper which ignores that id and use it instead
of old parse()
* make parse() compatible with python3 where we got bytes, not string
from the socket so we have to decode it properly before using split()
* expand test_py3.py with simply asyn server which verifies that
osmo_ctrl.py works properly
Change-Id: I599f9f5a18109929f59386ab4416b8bfd75c74d1
diff --git a/scripts/osmo_ctrl.py b/scripts/osmo_ctrl.py
index 8c0608f..ac20050 100755
--- a/scripts/osmo_ctrl.py
+++ b/scripts/osmo_ctrl.py
@@ -40,8 +40,8 @@
def do_set_get(sck, var, value = None):
(r, c) = Ctrl().cmd(var, value)
sck.send(c)
- answer = Ctrl().rem_header(sck.recv(4096))
- return (answer,) + Ctrl().verify(answer, r, var, value)
+ ret = sck.recv(4096)
+ return (Ctrl().rem_header(ret),) + Ctrl().verify(ret, r, var, value)
def set_var(sck, var, val):
(a, _, _) = do_set_get(sck, var, val)