[MERGED] osmo-gsm-tester[master]: modem: Abstract the list of required ofono interfaces

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

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Mon Nov 27 10:27:52 UTC 2017


Pau Espin Pedrol has submitted this change and it was merged.

Change subject: modem: Abstract the list of required ofono interfaces
......................................................................


modem: Abstract the list of required ofono interfaces

* We want to add more interfaces to this list when we add more features
(such as waiting for ConnectionManager if we want to use GPRS).

* We want to require some ifaces only if we are planning to use those
features in osmo-gsm-tester (driven by config features attribute set to
the modem in resources.conf).

* Previous usage during shutdown was wrong, as it was waiting for any of
them to be down to continue instead of waiting for all of them to be
down.

Change-Id: I56a289360018aa56fe25b3dd328ffe9194b65f6b
---
M src/osmo_gsm_tester/modem.py
1 file changed, 13 insertions(+), 2 deletions(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  Harald Welte: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/osmo_gsm_tester/modem.py b/src/osmo_gsm_tester/modem.py
index ca8387b..e73ae4e 100644
--- a/src/osmo_gsm_tester/modem.py
+++ b/src/osmo_gsm_tester/modem.py
@@ -421,6 +421,15 @@
     def auth_algo(self):
         return self.conf.get('auth_algo', None)
 
+    def features(self):
+        return self.conf.get('features', [])
+
+    def _required_ifaces(self):
+        req_ifaces = (I_NETREG,)
+        req_ifaces += (I_SMS,) if 'sms' in self.features() else ()
+        req_ifaces += (I_SS,) if 'ussd' in self.features() else ()
+        return req_ifaces
+
     def _on_netreg_property_changed(self, name, value):
         self.dbg('%r.PropertyChanged() -> %s=%s' % (I_NETREG, name, value))
 
@@ -521,16 +530,18 @@
 
     def power_cycle(self):
         'Power the modem and put it online, power cycle it if it was already on'
+        req_ifaces = self._required_ifaces()
         if self.is_powered():
             self.dbg('Power cycling')
             self.set_online(False)
             self.set_powered(False)
-            event_loop.wait(self, lambda: not self.dbus.has_interface(I_NETREG, I_SMS), timeout=10)
+            for iface in req_ifaces:
+                event_loop.wait(self, lambda: not self.dbus.has_interface(iface), timeout=10)
         else:
             self.dbg('Powering on')
         self.set_powered()
         self.set_online()
-        event_loop.wait(self, self.dbus.has_interface, I_NETREG, I_SMS, timeout=10)
+        event_loop.wait(self, self.dbus.has_interface, *req_ifaces, timeout=10)
 
     def connect(self, mcc_mnc=None):
         'Connect to MCC+MNC'

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I56a289360018aa56fe25b3dd328ffe9194b65f6b
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list