Home | History | Annotate | Download | only in cellular_MbimComplianceControlRequest
      1 # Copyright 2014 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_errors
      7 from autotest_lib.client.cros.cellular.mbim_compliance \
      8         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_MbimComplianceCM04(mbim_test_base.MbimTestBase):
     18     """
     19     CM_04 Validation of |transaction_id| in modem's response to MBIM_COMMAND_MSG
     20 
     21     This section contains tests that validate the specifics of MBIM_COMMAND_MSG
     22     request and the function's response.
     23 
     24     Reference:
     25         [1] Universal Serial Bus Communication Class MBIM Compliance Testing: 38
     26         http://www.usb.org/developers/docs/devclass_docs/MBIM-Compliance-1.0.pdf
     27     """
     28     version = 1
     29 
     30     def run_internal(self):
     31         """ Run CM_04 test. """
     32         # Precondition
     33         descriptors = get_descriptors_sequence.GetDescriptorsSequence(
     34                 self.device_context).run()
     35         self.device_context.update_descriptor_cache(descriptors)
     36         mbim_open_generic_sequence.MBIMOpenGenericSequence(
     37                 self.device_context).run()
     38 
     39         # Step 1
     40         command_message, response_message = (
     41                 mbim_cid_device_caps_sequence.MBIMCIDDeviceCapsSequence(
     42                         self.device_context).run())
     43         # Validate |transaction_id| in the response to MBIM_COMMAND_MSG.
     44         if response_message.transaction_id != command_message.transaction_id:
     45             mbim_errors.log_and_raise(mbim_errors.MBIMComplianceAssertionError,
     46                                       'mbim1.0:9.4.3')
     47