[autotest] Forward RPCs related to stable version to master

Servo uses following 4 RPCs to get/set/delete stable version.
get_stable_version, get_all_stable_versions,
set_stable_version, and delete_stable_version.
When these RPCs are requested to a shard, then forward them
to the master, because only master DB has data in the
afe_stable_versions table (this table is not synced with shards).

BUG=chromium:487792
TEST=Puppylab. Try to request the 4 RPCs to both the master and
the stumpyshard and check the return.

Change-Id: I39724eab9701e1592a84ae71f101a5a93363986f
Reviewed-on: https://chromium-review.googlesource.com/270819
Tested-by: Mungyung Ryu <mkryu@google.com>
Reviewed-by: Dan Shi <dshi@chromium.org>
Commit-Queue: Mungyung Ryu <mkryu@google.com>
diff --git a/frontend/afe/site_rpc_interface.py b/frontend/afe/site_rpc_interface.py
index 3fce97f..863ee55 100644
--- a/frontend/afe/site_rpc_interface.py
+++ b/frontend/afe/site_rpc_interface.py
@@ -494,6 +494,9 @@
              of CROS.stable_cros_version if stable_versinos table does not have
              entry of board DEFAULT.
     """
+    # This RPC call should be accepted only by master.
+    if utils.is_shard():
+        return rpc_utils.route_rpc_to_master('get_stable_version', board=board)
     return stable_version_utils.get(board)
 
 
@@ -502,6 +505,9 @@
 
     @return: A dictionary of board:version.
     """
+    # This RPC call should be accepted only by master.
+    if utils.is_shard():
+        return rpc_utils.route_rpc_to_master('get_all_stable_versions')
     return stable_version_utils.get_all()
 
 
@@ -511,6 +517,10 @@
     @param version: The new value of stable version for given board.
     @param board: Name of the board, default to value `DEFAULT`.
     """
+    # This RPC call should be accepted only by master.
+    if utils.is_shard():
+        return rpc_utils.route_rpc_to_master('set_stable_version',
+                                             version=version, board=board)
     stable_version_utils.set(version=version, board=board)
 
 
@@ -522,4 +532,8 @@
 
     @param board: Name of the board.
     """
+    # This RPC call should be accepted only by master.
+    if utils.is_shard():
+        return rpc_utils.route_rpc_to_master('delete_stable_version',
+                                             board=board)
     stable_version_utils.delete(board=board)