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 Neels Hofmeyr, Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/5028
to look at the new patch set (#4).
Fix ctrl command parsing for python3
In python3 we got bytes, not string from the socket so we have to decode
it properly before using split().
Change-Id: I599f9f5a18109929f59386ab4416b8bfd75c74d1
---
M osmopy/osmo_ipa.py
M scripts/twisted_ipa.py
2 files changed, 5 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/python/osmo-python-tests refs/changes/28/5028/4
diff --git a/osmopy/osmo_ipa.py b/osmopy/osmo_ipa.py
index 71cbf45..b5d11fc 100755
--- a/osmopy/osmo_ipa.py
+++ b/osmopy/osmo_ipa.py
@@ -28,7 +28,7 @@
"""
Stateless IPA protocol multiplexer: add/remove/parse (extended) header
"""
- version = "0.0.5"
+ version = "0.0.6"
TCP_PORT_OML = 3002
TCP_PORT_RSL = 3003
# OpenBSC extensions: OSMO, MGCP_OLD
@@ -231,12 +231,13 @@
return None
return d
- def parse(self, data, op=None):
+ def parse(self, raw_data, op=None):
"""
Parse Ctrl string returning (var, value) pair
var could be None in case of ERROR message
value could be None in case of GET message
"""
+ data = self.rem_header(raw_data).decode('utf-8')
(s, i, v) = data.split(' ', 2)
if s == self.CTRL_ERR:
return None, v
diff --git a/scripts/twisted_ipa.py b/scripts/twisted_ipa.py
index bb8323d..5bc6740 100755
--- a/scripts/twisted_ipa.py
+++ b/scripts/twisted_ipa.py
@@ -22,7 +22,7 @@
*/
"""
-__version__ = "0.7.0" # bump this on every non-trivial change
+__version__ = "0.7.1" # bump this on every non-trivial change
from osmopy.osmo_ipa import Ctrl, IPA
from twisted.internet.protocol import ReconnectingClientFactory
@@ -243,7 +243,7 @@
OSMO CTRL message dispatcher, lambda default should never happen
For basic tests only, appropriate handling routines should be replaced: see CtrlServer for example
"""
- self.dbg('OSMO CTRL received %s::%s' % Ctrl().parse(data.decode('utf-8')))
+ self.dbg('OSMO CTRL received %s::%s' % Ctrl().parse(data))
(cmd, op_id, v) = data.decode('utf-8').split(' ', 2)
method = getattr(self, 'ctrl_' + cmd, lambda: "CTRL unknown command")
method(data, op_id, v)
--
To view, visit https://gerrit.osmocom.org/5028
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I599f9f5a18109929f59386ab4416b8bfd75c74d1
Gerrit-PatchSet: 4
Gerrit-Project: python/osmo-python-tests
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>