aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo_gsm_tester/osmo_nitb.py
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-04-09 18:46:48 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-04-09 19:11:25 +0200
commitb02c21115d1f2c76aa134ce7447998e9b26cc0b7 (patch)
tree5a34ac5183f1e22e2f2a6b29095077bcbdd8b0ad /src/osmo_gsm_tester/osmo_nitb.py
parentb3daaea6b5207b3b19c9ccd10b8f76a56d2e6711 (diff)
wip
Diffstat (limited to 'src/osmo_gsm_tester/osmo_nitb.py')
-rw-r--r--src/osmo_gsm_tester/osmo_nitb.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/osmo_gsm_tester/osmo_nitb.py b/src/osmo_gsm_tester/osmo_nitb.py
index 8fce371..4cd6055 100644
--- a/src/osmo_gsm_tester/osmo_nitb.py
+++ b/src/osmo_gsm_tester/osmo_nitb.py
@@ -95,15 +95,16 @@ class OsmoNitb(log.Origin):
OsmoNitbCtrl(self).subscriber_add(modem.imsi(), msisdn, modem.ki())
def subscriber_attached(self, *modems):
- return self.imsi_attached([m.imsi() for m in modems])
+ return self.imsi_attached(*[m.imsi() for m in modems])
def imsi_attached(self, *imsis):
attached = self.imsi_list_attached()
- return all([imsi in attached for imsi in imsis])
+ self.dbg('attached:', attached)
+ return all([(imsi in attached) for imsi in imsis])
def imsi_list_attached(self):
with self:
- OsmoNitbCtrl(self).subscriber_list_active()
+ return OsmoNitbCtrl(self).subscriber_list_active()
def running(self):
return not self.process.terminated()
@@ -133,7 +134,7 @@ class OsmoNitbCtrl(log.Origin):
else:
value = '%s,%s' % (imsi, msisdn)
- with osmo_ctrl.OsmoCtrl(self.nitb.addr(), OsmoNitbCtrl.PORT) as ctrl:
+ with self.ctrl() as ctrl:
ctrl.do_set(OsmoNitbCtrl.SUBSCR_MODIFY_VAR, value)
data = ctrl.receive()
(answer, data) = ctrl.remove_ipa_ctrl_header(data)
@@ -147,15 +148,16 @@ class OsmoNitbCtrl(log.Origin):
def subscriber_list_active(self):
var = 'subscriber-list-active-v1'
aslist_str = ""
- with osmo_ctrl.OsmoCtrl(self.nitb.addr(), OsmoNitbCtrl.PORT) as ctrl:
- self.ctrl.do_get(OsmoNitbCtrl.SUBSCR_LIST_ACTIVE_VAR)
+ with self.ctrl() as ctrl:
+ ctrl.do_get(OsmoNitbCtrl.SUBSCR_LIST_ACTIVE_VAR)
# This is legacy code from the old osmo-gsm-tester.
# looks like this doesn't work for long data.
- data = self.ctrl.receive()
+ data = ctrl.receive()
while (len(data) > 0):
- (answer, data) = self.ctrl.remove_ipa_ctrl_header(data)
- answer = answer.replace('\n', ' ')
- aslist_str = answer
+ (answer, data) = ctrl.remove_ipa_ctrl_header(data)
+ answer_str = answer.decode('utf-8')
+ answer_str = answer_str.replace('\n', ' ')
+ aslist_str = answer_str
return aslist_str
# vim: expandtab tabstop=4 shiftwidth=4