aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-05-29 03:45:24 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-05-30 15:38:52 +0000
commitb8011695b8c771f157d83de3239cfd6ecf2e967f (patch)
tree9aedcce4d3d01e61bcb68817cc3407a0f593fe8f
parent0993bf6f980b1673df46be9f89206c1f860b1d45 (diff)
cosmetic: review mo_mt_sms.py's logging
Implement the Modem.log_info() function, use that instead of logging all modem properties. Tweak mo_mt_sms.py print() statements. Pass modem object to SMS generation to inlcude the modem name as SMS token. Change-Id: I2b17fce0b3b05594fd9038b54e5b65f5127bd0a4
-rw-r--r--selftest/suite_test/test_suite/mo_mt_sms.py2
-rw-r--r--src/osmo_gsm_tester/ofono_client.py7
-rwxr-xr-xsuites/aoip_sms/mo_mt_sms.py7
-rwxr-xr-xsuites/sms/mo_mt_sms.py12
4 files changed, 20 insertions, 8 deletions
diff --git a/selftest/suite_test/test_suite/mo_mt_sms.py b/selftest/suite_test/test_suite/mo_mt_sms.py
index 8b5e1ec..c9558d8 100644
--- a/selftest/suite_test/test_suite/mo_mt_sms.py
+++ b/selftest/suite_test/test_suite/mo_mt_sms.py
@@ -14,5 +14,5 @@ ms_mo.start()
ms_mt.start()
wait(nitb.subscriber_attached, ms_mo, ms_mt)
-sms = ms_mo.sms_send(ms_mt.msisdn)
+sms = ms_mo.sms_send(ms_mt)
wait(nitb.sms_received, sms)
diff --git a/src/osmo_gsm_tester/ofono_client.py b/src/osmo_gsm_tester/ofono_client.py
index 38e5772..5494ec2 100644
--- a/src/osmo_gsm_tester/ofono_client.py
+++ b/src/osmo_gsm_tester/ofono_client.py
@@ -357,6 +357,13 @@ class Modem(log.Origin):
return True
return False
+ def info(self, keys=('Manufacturer', 'Model', 'Revision')):
+ props = self.properties()
+ return ', '.join(['%s: %r'%(k,props.get(k)) for k in keys])
+
+ def log_info(self, *args, **kwargs):
+ self.log(self.info(*args, **kwargs))
+
class Sms:
_last_sms_idx = 0
msg = None
diff --git a/suites/aoip_sms/mo_mt_sms.py b/suites/aoip_sms/mo_mt_sms.py
index 96e1caf..b9383ea 100755
--- a/suites/aoip_sms/mo_mt_sms.py
+++ b/suites/aoip_sms/mo_mt_sms.py
@@ -23,7 +23,12 @@ hlr.subscriber_add(ms_mt)
ms_mo.connect(bsc)
ms_mt.connect(bsc)
+
+ms_mo.log_info()
+ms_mt.log_info()
+
+print('waiting for modems to attach...')
wait(msc.subscriber_attached, ms_mo, ms_mt)
-sms = ms_mo.sms_send(ms_mt.msisdn)
+sms = ms_mo.sms_send(ms_mt)
wait(ms_mt.sms_was_received, sms)
diff --git a/suites/sms/mo_mt_sms.py b/suites/sms/mo_mt_sms.py
index 7176197..860f5e7 100755
--- a/suites/sms/mo_mt_sms.py
+++ b/suites/sms/mo_mt_sms.py
@@ -1,7 +1,6 @@
#!/usr/bin/env python3
from osmo_gsm_tester.test import *
-print('use resources...')
nitb = suite.nitb()
bts = suite.bts()
ms_mo = suite.modem()
@@ -10,8 +9,6 @@ ms_mt = suite.modem()
print('start nitb and bts...')
nitb.bts_add(bts)
nitb.start()
-sleep(1)
-assert nitb.running()
bts.start()
nitb.subscriber_add(ms_mo)
@@ -19,9 +16,12 @@ nitb.subscriber_add(ms_mt)
ms_mo.connect(nitb)
ms_mt.connect(nitb)
-print(ms_mo.properties())
-print(ms_mt.properties())
+
+ms_mo.log_info()
+ms_mt.log_info()
+
+print('waiting for modems to attach...')
wait(nitb.subscriber_attached, ms_mo, ms_mt)
-sms = ms_mo.sms_send(ms_mt.msisdn)
+sms = ms_mo.sms_send(ms_mt)
wait(ms_mt.sms_was_received, sms)