cellular: Add support for MBIM modem in test environment
BUG=chromium:414125
TEST=Run network_3GSmokeTest on MBIM modem
Change-Id: I88653a57ca9245e45d336ed5dfd2cedabc50465a
Reviewed-on: https://chromium-review.googlesource.com/218321
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
Commit-Queue: Thieu Le <thieule@chromium.org>
diff --git a/client/cros/cellular/modem1.py b/client/cros/cellular/modem1.py
index 7d6ebf8..0519e3c 100644
--- a/client/cros/cellular/modem1.py
+++ b/client/cros/cellular/modem1.py
@@ -144,6 +144,18 @@
"""Returns the modem version information."""
return self.GetModemProperties()['Revision']
+ def _IsCDMAModem(self, capabilities):
+ return mm1_constants.MM_MODEM_CAPABILITY_CDMA_EVDO in capabilities
+
+ def _Is3GPPModem(self, capabilities):
+ for capability in capabilities:
+ if (capability &
+ (mm1_constants.MM_MODEM_CAPABILITY_LTE |
+ mm1_constants.MM_MODEM_CAPABILITY_LTE_ADVANCED |
+ mm1_constants.MM_MODEM_CAPABILITY_GSM_UMTS)):
+ return True
+ return False
+
def _CDMAModemIsRegistered(self):
modem_status = self.SimpleModem().GetStatus()
cdma1x_state = modem_status.get(
@@ -167,11 +179,9 @@
"""Ensure that modem is registered on the network."""
props = self.GetAll(mm1.MODEM_INTERFACE)
capabilities = props.get('SupportedCapabilities')
- if mm1_constants.MM_MODEM_CAPABILITY_CDMA_EVDO in capabilities:
+ if self._IsCDMAModem(capabilities):
return self._CDMAModemIsRegistered()
- elif (mm1_constants.MM_MODEM_CAPABILITY_LTE in capabilities or
- mm1_constants.MM_MODEM_CAPABILITY_LTE_ADVANCED in capabilities or
- mm1_constants.MM_MODEM_CAPABILITY_GSM_UMTS in capabilities):
+ elif self._Is3GPPModem(capabilities):
return self._3GPPModemIsRegistered()
else:
raise error.TestError('Invalid modem type')
diff --git a/client/cros/cellular/test_environment.py b/client/cros/cellular/test_environment.py
index ca03a6d..2cf504d 100644
--- a/client/cros/cellular/test_environment.py
+++ b/client/cros/cellular/test_environment.py
@@ -135,17 +135,23 @@
timeout=shill_proxy.ShillProxy.DEVICE_ENABLE_DISABLE_TIMEOUT)
+ def _is_unsupported_error(self, e):
+ return (e.get_dbus_name() ==
+ shill_proxy.ShillProxy.ERROR_NOT_SUPPORTED or
+ (e.get_dbus_name() ==
+ shill_proxy.ShillProxy.ERROR_FAILURE and
+ 'operation not supported' in e.get_dbus_message()))
+
def _reset_modem(self):
modem_device = self.shill.find_cellular_device_object()
if not modem_device:
raise error.TestError('Cannot find cellular device in shill. '
'Is the modem plugged in?')
try:
- # Cromo modems do not support being reset.
+ # Cromo/MBIM modems do not support being reset.
self.shill.reset_modem(modem_device, expect_service=False)
except dbus.DBusException as e:
- if (e.get_dbus_name() !=
- cellular_proxy.CellularProxy.ERROR_NOT_SUPPORTED):
+ if not self._is_unsupported_error(e):
raise