• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
5import common
6from autotest_lib.client.cros.cellular.mbim_compliance import mbim_constants
7from autotest_lib.client.cros.cellular.mbim_compliance import mbim_data_transfer
8from autotest_lib.client.cros.cellular.mbim_compliance import mbim_dts_test_base
9from autotest_lib.client.cros.cellular.mbim_compliance import mbim_errors
10from autotest_lib.client.cros.cellular.mbim_compliance.sequences \
11        import loopback_sequence
12
13
14class cellular_MbimComplianceDTS0208(mbim_dts_test_base.MbimDtsTestBase):
15    """
16    Validation of dwSignature.
17
18    This test validates 16-bit/32-bit NCM Transfer Header signature.
19
20    Reference:
21        [1] Universal Serial Bus Communication Class MBIM Compliance Testing: 28
22        http://www.usb.org/developers/docs/devclass_docs/MBIM-Compliance-1.0.pdf
23
24    """
25    version = 1
26
27    def run_internal(self, ntb_format):
28        """
29        Run DTS_02/DTS_08 test.
30
31        @param ntb_format: Whether to send/receive an NTB16 or NTB32 frame.
32                Possible values: NTB_FORMAT_16, NTB_FORMAT_32 (mbim_constants)
33
34        """
35        # Precondition
36        _, _, _ = self.run_precondition(ntb_format)
37
38        # Step 1
39        loopback = loopback_sequence.LoopbackSequence(self.device_context)
40        nth, _, _, _ = loopback.run(ntb_format=ntb_format)
41
42        # Step 2
43        if ntb_format == mbim_constants.NTB_FORMAT_16:
44            if nth.signature != mbim_data_transfer.NTH_SIGNATURE_16:
45                mbim_errors.log_and_raise(
46                        mbim_errors.MBIMComplianceAssertionError,
47                        'ncm1.0:3.2.1#1')
48        else:
49            if nth.signature != mbim_data_transfer.NTH_SIGNATURE_32:
50                mbim_errors.log_and_raise(
51                        mbim_errors.MBIMComplianceAssertionError,
52                        'ncm1.0:3.2.2#1')
53