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
This commit is contained in:
Neels Hofmeyr 2017-05-29 03:45:24 +02:00 committed by Neels Hofmeyr
parent 0993bf6f98
commit b8011695b8
4 changed files with 20 additions and 8 deletions

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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)