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_MbimComplianceDTS1723(mbim_dts_test_base.MbimDtsTestBase): 14 """ 15 Validation of wDatagramLength[0]. 16 17 This test validates the value in wDatagramLength[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_17/DTS_23 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_length < 20: 44 mbim_errors.log_and_raise( 45 mbim_errors.MBIMComplianceAssertionError, 46 'ncm1.0:3.3.1#3') 47 else: 48 if ndp_entries[0].datagram_length < 20: 49 mbim_errors.log_and_raise( 50 mbim_errors.MBIMComplianceAssertionError, 51 'ncm1.0:3.3.2#3') 52