Aviv Keshet | 5ab8b69 | 2013-05-07 14:03:14 -0700 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | # Copyright (c) 2013 The Chromium OS Authors. All rights reserved. |
| 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
| 5 | |
| 6 | import common |
| 7 | import autotest_lib.server.frontend as frontend |
Aviv Keshet | 5ab8b69 | 2013-05-07 14:03:14 -0700 | [diff] [blame] | 8 | from autotest_lib.frontend.afe import rpc_interface |
| 9 | |
| 10 | class directAFE(frontend.AFE): |
| 11 | """ |
| 12 | A wrapper for frontend.AFE which exposes all of the AFE |
Allen Li | cdd00f2 | 2017-02-01 18:01:52 -0800 | [diff] [blame^] | 13 | functionality, but makes direct calls to rpc_interface rather than |
| 14 | making RPC calls to an RPC server. |
Aviv Keshet | 5ab8b69 | 2013-05-07 14:03:14 -0700 | [diff] [blame] | 15 | """ |
| 16 | def run(self, call, **dargs): |
| 17 | func = None |
| 18 | |
| 19 | try: |
| 20 | func = rpc_interface.__getattribute__(call) |
| 21 | except AttributeError: |
| 22 | pass |
| 23 | |
Aviv Keshet | 5ab8b69 | 2013-05-07 14:03:14 -0700 | [diff] [blame] | 24 | if not func: |
Allen Li | cdd00f2 | 2017-02-01 18:01:52 -0800 | [diff] [blame^] | 25 | raise AttributeError('No function %s in rpc_interface' % call) |
Aviv Keshet | 5ab8b69 | 2013-05-07 14:03:14 -0700 | [diff] [blame] | 26 | |
Allen Li | cdd00f2 | 2017-02-01 18:01:52 -0800 | [diff] [blame^] | 27 | return func(**dargs) |