• 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_MbimComplianceDTS1420(mbim_dts_test_base.MbimDtsTestBase):
15    """
16    Validation of dwSignature for IP Stream.
17
18    This test validates 16/32-bit NCM Datagram Pointer signature for IP stream.
19
20    Reference:
21        [1] Universal Serial Bus Communication Class MBIM Compliance Testing: 33
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_14/DTS_20 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        _, ndp, _, _ = loopback.run(ntb_format=ntb_format)
41
42        # Step 2
43        if ntb_format == mbim_constants.NTB_FORMAT_16:
44            if ndp.signature != mbim_data_transfer.NDP_SIGNATURE_IPS_16:
45                mbim_errors.log_and_raise(
46                        mbim_errors.MBIMComplianceAssertionError,
47                        'mbim1.0:7#1')
48        else:
49            if ndp.signature != mbim_data_transfer.NDP_SIGNATURE_IPS_32:
50                mbim_errors.log_and_raise(
51                        mbim_errors.MBIMComplianceAssertionError,
52                        'mbim1.0:7#3')
53