Home | History | Annotate | Download | only in cellular_MbimComplianceDataTransfer
      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_constants
      7 from autotest_lib.client.cros.cellular.mbim_compliance import mbim_data_transfer
      8 from autotest_lib.client.cros.cellular.mbim_compliance import mbim_dts_test_base
      9 from autotest_lib.client.cros.cellular.mbim_compliance import mbim_errors
     10 from autotest_lib.client.cros.cellular.mbim_compliance.sequences \
     11         import loopback_sequence
     12 
     13 
     14 class cellular_MbimComplianceDTS0410(mbim_dts_test_base.MbimDtsTestBase):
     15     """
     16     Validation of wSequence after function reset.
     17 
     18     This test verifies that function reset properly re-initializes the sequence
     19     number.
     20 
     21     Reference:
     22         [1] Universal Serial Bus Communication Class MBIM Compliance Testing: 28
     23         http://www.usb.org/developers/docs/devclass_docs/MBIM-Compliance-1.0.pdf
     24 
     25     """
     26     version = 1
     27 
     28     def run_internal(self, ntb_format):
     29         """
     30         Run DTS_04/DTS_10 test.
     31 
     32         @param ntb_format: Whether to send/receive an NTB16 or NTB32 frame.
     33                 Possible values: NTB_FORMAT_16, NTB_FORMAT_32 (mbim_constants)
     34 
     35         """
     36         # Precondition
     37         _, open_sequence, connect_sequence = self.run_precondition(ntb_format)
     38 
     39         # Step 1
     40         loopback = loopback_sequence.LoopbackSequence(self.device_context)
     41         _, _, _, _ = loopback.run(ntb_format=ntb_format)
     42 
     43         # Step 2
     44         open_sequence.run(ntb_format=ntb_format)
     45         connect_sequence.run()
     46         mbim_data_transfer.MBIMNtb.reset_sequence_number()
     47 
     48         # Step 3
     49         nth, _, _, _ = loopback.run(ntb_format=ntb_format)
     50 
     51         # Step 4
     52         if ntb_format == mbim_constants.NTB_FORMAT_16:
     53             if nth.sequence_number != 0:
     54                 mbim_errors.log_and_raise(
     55                         mbim_errors.MBIMComplianceAssertionError,
     56                         'ncm1.0:3.2.1#3')
     57         else:
     58             if nth.sequence_number != 0:
     59                 mbim_errors.log_and_raise(
     60                         mbim_errors.MBIMComplianceAssertionError,
     61                         'ncm1.0:3.2.2#3')
     62