[PATCH] osmo-gsm-tester[master]: cosmetic: review mo_mt_sms.py's logging

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon May 29 02:33:25 UTC 2017


Review at  https://gerrit.osmocom.org/2775

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
---
M selftest/suite_test/test_suite/mo_mt_sms.py
M src/osmo_gsm_tester/ofono_client.py
M suites/aoip_sms/mo_mt_sms.py
M suites/sms/mo_mt_sms.py
4 files changed, 20 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/75/2775/1

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_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 ce937d0..ac60044 100644
--- a/src/osmo_gsm_tester/ofono_client.py
+++ b/src/osmo_gsm_tester/ofono_client.py
@@ -366,6 +366,13 @@
                 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 @@
 
 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 @@
 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 @@
 
 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)

-- 
To view, visit https://gerrit.osmocom.org/2775
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b17fce0b3b05594fd9038b54e5b65f5127bd0a4
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list