Autotest: Move moblab-related RPC to moblab_rpc_interface.py.
This CL moves all RPCs that can only be run on moblab to moblab_rpc_interface.
Also move related unittests to moblab_rpc_interface_unittest.
BUG=chromium:641549
TEST=cros flash to a local moblab, upload boto key, then run a suite on it.
Change-Id: I8246282a4c7250350dd9a4e9043eaeba293ccb34
Reviewed-on: https://chromium-review.googlesource.com/377418
Commit-Ready: Xixuan Wu <xixuan@chromium.org>
Tested-by: Xixuan Wu <xixuan@chromium.org>
Reviewed-by: Fang Deng <fdeng@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
diff --git a/frontend/afe/rpc_utils.py b/frontend/afe/rpc_utils.py
index 4b3e383..95206bb 100644
--- a/frontend/afe/rpc_utils.py
+++ b/frontend/afe/rpc_utils.py
@@ -1,5 +1,5 @@
#pylint: disable-msg=C0111
-"""\
+"""
Utility functions for rpc_interface.py. We keep them in a separate file so that
only RPC interface functions go into that file.
"""
@@ -1277,6 +1277,17 @@
return label
+# TODO: hide the following rpcs under is_moblab
+def moblab_only(func):
+ """Ensure moblab specific functions only run on Moblab devices."""
+ def verify(*args, **kwargs):
+ if not server_utils.is_moblab():
+ raise error.RPCException('RPC: %s can only run on Moblab Systems!',
+ func.__name__)
+ return func(*args, **kwargs)
+ return verify
+
+
def route_rpc_to_master(func):
"""Route RPC to master AFE.