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_dts_test_base 8from autotest_lib.client.cros.cellular.mbim_compliance import mbim_errors 9from autotest_lib.client.cros.cellular.mbim_compliance.sequences \ 10 import loopback_sequence 11 12 13class cellular_MbimComplianceDTS1824(mbim_dts_test_base.MbimDtsTestBase): 14 """ 15 Validation of the Last wDatagramIndex. 16 17 This test validates the value in wDatagramIndex[(wLength-8)/4 - 1] field of 18 NDP16/32. 19 20 Reference: 21 [1] Universal Serial Bus Communication Class MBIM Compliance Testing: 34 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_18/DTS_24 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_entries, _ = loopback.run(ntb_format=ntb_format) 41 42 # Step 2 43 if ntb_format == mbim_constants.NTB_FORMAT_16: 44 if ndp_entries[-1].datagram_index != 0: 45 mbim_errors.log_and_raise( 46 mbim_errors.MBIMComplianceAssertionError, 47 'ncm1.0:3.3.1#4') 48 else: 49 if ndp_entries[-1].datagram_index != 0: 50 mbim_errors.log_and_raise( 51 mbim_errors.MBIMComplianceAssertionError, 52 'ncm1.0:3.3.2#4') 53