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_dts_test_base
      8 from autotest_lib.client.cros.cellular.mbim_compliance import mbim_errors
      9 from autotest_lib.client.cros.cellular.mbim_compliance.sequences \
     10         import loopback_sequence
     11 
     12 
     13 class cellular_MbimComplianceDTS1622(mbim_dts_test_base.MbimDtsTestBase):
     14     """
     15     Validation of wDatagramIndex[0].
     16 
     17     This test validates the value in wDatagramIndex[0] field of NDP16/32.
     18 
     19     Reference:
     20         [1] Universal Serial Bus Communication Class MBIM Compliance Testing: 33
     21         http://www.usb.org/developers/docs/devclass_docs/MBIM-Compliance-1.0.pdf
     22 
     23     """
     24     version = 1
     25 
     26     def run_internal(self, ntb_format):
     27         """
     28         Run DTS_16/DTS_22 test.
     29 
     30         @param ntb_format: Whether to send/receive an NTB16 or NTB32 frame.
     31                 Possible values: NTB_FORMAT_16, NTB_FORMAT_32 (mbim_constants)
     32 
     33         """
     34         # Precondition
     35         _, _, _ = self.run_precondition(ntb_format)
     36 
     37         # Step 1
     38         loopback = loopback_sequence.LoopbackSequence(self.device_context)
     39         _, _, ndp_entries, _ = loopback.run(ntb_format=ntb_format)
     40 
     41         # Step 2
     42         if ntb_format == mbim_constants.NTB_FORMAT_16:
     43             if ndp_entries[0].datagram_index < 12:
     44                 mbim_errors.log_and_raise(
     45                         mbim_errors.MBIMComplianceAssertionError,
     46                         'ncm1.0:3.3.1#2')
     47         else:
     48             if ndp_entries[0].datagram_index < 16:
     49                 mbim_errors.log_and_raise(
     50                         mbim_errors.MBIMComplianceAssertionError,
     51                         'ncm1.0:3.3.2#2')
     52