Home | History | Annotate | Download | only in cellular_MbimComplianceControlCommand
      1 # Copyright 2015 The Chromium OS Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 import common
      6 from autotest_lib.client.cros.cellular.mbim_compliance import mbim_constants
      7 from autotest_lib.client.cros.cellular.mbim_compliance import mbim_errors
      8 from autotest_lib.client.cros.cellular.mbim_compliance import mbim_test_base
      9 from autotest_lib.client.cros.cellular.mbim_compliance.sequences \
     10         import get_descriptors_sequence
     11 from autotest_lib.client.cros.cellular.mbim_compliance.sequences \
     12         import mbim_cid_device_caps_sequence
     13 from autotest_lib.client.cros.cellular.mbim_compliance.sequences \
     14         import mbim_open_generic_sequence
     15 
     16 
     17 class cellular_MbimComplianceCID01(mbim_test_base.MbimTestBase):
     18     """
     19     Validation of IP flags for functions that support CDMA.
     20 
     21     This test verifies that a function that supports CDMA specifies at least
     22     one of the following IP flags: MBIMCtrlCapsCdmaMobileIP,
     23     MBIMCtrlCapsCdmaSimpleIP.
     24 
     25     Reference:
     26         [1] Universal Serial Bus Communication Class MBIM Compliance Testing: 52
     27         http://www.usb.org/developers/docs/devclass_docs/MBIM-Compliance-1.0.pdf
     28 
     29     """
     30     version = 1
     31 
     32     def run_internal(self):
     33         """ Run the CM_01 test. """
     34         # Precondition.
     35         desc_sequence = get_descriptors_sequence.GetDescriptorsSequence(
     36                 self.device_context)
     37         descriptors = desc_sequence.run()
     38         self.device_context.update_descriptor_cache(descriptors)
     39         open_sequence = mbim_open_generic_sequence.MBIMOpenGenericSequence(
     40                 self.device_context)
     41         open_sequence.run()
     42         caps_sequence = mbim_cid_device_caps_sequence.MBIMCIDDeviceCapsSequence(
     43                 self.device_context)
     44         _, caps_response = caps_sequence.run()
     45 
     46         # Step1
     47         if (caps_response.cellular_class &
     48             mbim_constants.CELLULAR_CLASS_MASK_CDMA):
     49             if not ((caps_response.control_caps &
     50                      mbim_constants.CTRL_CAPS_MASK_CDMA_MOBILE_IP) or
     51                     (caps_response.control_caps &
     52                      mbim_constants.CTRL_CAPS_MASK_CDMA_SIMPLE_IP)):
     53                 mbim_errors.log_and_raise(
     54                         mbim_errors.MBIMComplianceAssertionError,
     55                         'mbim1.0:10.5.1.3#1')
     56