blob: aecae619c2456c1d48e0ed5a0d7fb0ee779ba57a [file] [log] [blame]
Aviv Keshet5ab8b692013-05-07 14:03:14 -07001#!/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
6import common
7import autotest_lib.server.frontend as frontend
Aviv Keshet5ab8b692013-05-07 14:03:14 -07008from autotest_lib.frontend.afe import rpc_interface
9
10class directAFE(frontend.AFE):
11 """
12 A wrapper for frontend.AFE which exposes all of the AFE
Allen Licdd00f22017-02-01 18:01:52 -080013 functionality, but makes direct calls to rpc_interface rather than
14 making RPC calls to an RPC server.
Aviv Keshet5ab8b692013-05-07 14:03:14 -070015 """
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 Keshet5ab8b692013-05-07 14:03:14 -070024 if not func:
Allen Licdd00f22017-02-01 18:01:52 -080025 raise AttributeError('No function %s in rpc_interface' % call)
Aviv Keshet5ab8b692013-05-07 14:03:14 -070026
Allen Licdd00f22017-02-01 18:01:52 -080027 return func(**dargs)