1# Copyright (c) 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"""
6CM_09 Validation of TransactionId for Notifications Received After Connect
7Seqeunce
8
9Reference:
10    [1] Universal Serial Bus Communication Class MBIM Compliance Testing: 41
11        http://www.usb.org/developers/docs/devclass_docs/MBIM-Compliance-1.0.pdf
12"""
13import common
14from autotest_lib.client.cros.cellular.mbim_compliance import mbim_errors
15from autotest_lib.client.cros.cellular.mbim_compliance.sequences \
16        import connect_sequence
17from autotest_lib.client.cros.cellular.mbim_compliance.sequences \
18        import mbim_open_generic_sequence
19from autotest_lib.client.cros.cellular.mbim_compliance.tests import test
20
21
22class CM09Test(test.Test):
23    """ Implement the CM_09 test. """
24
25    def run_internal(self):
26        """ Run CM_09 test. """
27        # Precondition
28        mbim_open_generic_sequence.MBIMOpenGenericSequence(
29                self.test_context).run()
30
31        # Step 1
32        _, _, notifications = (
33                connect_sequence.ConnectSequence(self.test_context).run())
34
35        # Step 2
36        for notification in notifications:
37            if notification.transaction_id != 0:
38                mbim_errors.log_and_raise(
39                        mbim_errors.MBIMComplianceAssertionError,
40                        'mbim1.0:9.1#1')
41