Add separate control files for moblab AU tests.

client_utils.is_moblab() does not work. So just add a new control file
with moblab parameter.

BUG=chromium:936268
TEST=autoupdate_ForcedOOBEUpdate locally

Change-Id: Iad51ed14a87837ce66d28996f60b77850838f763
Reviewed-on: https://chromium-review.googlesource.com/1806149
Tested-by: David Haddock <dhaddock@chromium.org>
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: David Haddock <dhaddock@chromium.org>
diff --git a/server/cros/update_engine/omaha_devserver.py b/server/cros/update_engine/omaha_devserver.py
index bfd48be..b4da22d 100644
--- a/server/cros/update_engine/omaha_devserver.py
+++ b/server/cros/update_engine/omaha_devserver.py
@@ -49,7 +49,7 @@
 
 
     def __init__(self, omaha_host, payload_location, max_updates=1,
-                 critical_update=True):
+                 critical_update=True, moblab=False):
         """Starts a private devserver instance, operating at Omaha capacity.
 
         @param omaha_host: host address where the devserver is spawned.
@@ -57,6 +57,7 @@
         @param max_updates: int number of updates this devserver will handle.
                             This is passed to src/platform/dev/devserver.py.
         @param critical_update: Whether to set a deadline in responses.
+        @param moblab: True if we are running on moblab.
 
         """
         self._critical_update = critical_update
@@ -73,7 +74,7 @@
         self._devserver_pidfile = None
         self._devserver_static_dir = None
 
-        if client_utils.is_moblab():
+        if moblab:
             self._devserver_dir = global_config.global_config.get_config_value(
                 'CROS', 'devserver_dir')
             ssh_user = 'moblab'
diff --git a/server/cros/update_engine/update_engine_test.py b/server/cros/update_engine/update_engine_test.py
index 84b9a60..08e1292 100644
--- a/server/cros/update_engine/update_engine_test.py
+++ b/server/cros/update_engine/update_engine_test.py
@@ -699,7 +699,7 @@
 
     def get_update_url_for_test(self, job_repo_url, full_payload=True,
                                 critical_update=False, max_updates=1,
-                                public=False):
+                                public=False, moblab=False):
         """
         Get the correct update URL for autoupdate tests to use.
 
@@ -723,6 +723,7 @@
                             is passed to src/platform/dev/devserver.py if we
                             create our own deverver.
         @param public: url needs to be publicly accessible.
+        @param moblab: True if we are running on moblab.
 
         @returns an update url string.
 
@@ -773,7 +774,7 @@
         # for the rest of the test scenarios.
         self._omaha_devserver = omaha_devserver.OmahaDevserver(
             lab_devserver.hostname, payload_location, max_updates=max_updates,
-            critical_update=critical_update)
+            critical_update=critical_update, moblab=moblab)
         self._omaha_devserver.start_devserver()
 
         # Stage the payloads on our new devserver.
diff --git a/server/site_tests/autoupdate_ForcedOOBEUpdate/autoupdate_ForcedOOBEUpdate.py b/server/site_tests/autoupdate_ForcedOOBEUpdate/autoupdate_ForcedOOBEUpdate.py
index 82aa3e5..48834a5 100644
--- a/server/site_tests/autoupdate_ForcedOOBEUpdate/autoupdate_ForcedOOBEUpdate.py
+++ b/server/site_tests/autoupdate_ForcedOOBEUpdate/autoupdate_ForcedOOBEUpdate.py
@@ -58,7 +58,8 @@
 
 
     def run_once(self, full_payload=True, cellular=False,
-                 interrupt=None, max_updates=1, job_repo_url=None):
+                 interrupt=None, max_updates=1, job_repo_url=None,
+                 moblab=False):
         """
         Runs a forced autoupdate during ChromeOS OOBE.
 
@@ -72,6 +73,7 @@
                              out the current build and the devserver to use.
                              The test will read this from a host argument
                              when run in the lab.
+        @param moblab: True if we are running on moblab.
 
         """
         # veyron_rialto is a medical device with a different OOBE that auto
@@ -84,7 +86,8 @@
                                                   full_payload=full_payload,
                                                   critical_update=True,
                                                   public=cellular,
-                                                  max_updates=max_updates)
+                                                  max_updates=max_updates,
+                                                  moblab=moblab)
         before = self._get_chromeos_version()
         payload_info = None
         if cellular:
diff --git a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.delta b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.delta
index 4ab6aa7..090a135 100644
--- a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.delta
+++ b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.delta
@@ -9,7 +9,7 @@
 TEST_CATEGORY = "Functional"
 TEST_CLASS = "platform"
 TEST_TYPE = "server"
-ATTRIBUTES = "suite:au_fsi"
+ATTRIBUTES = "suite:au-perbuild"
 DOC = """
 This tests the forced autoupdate flow at OOBE.
 
diff --git a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.delta.moblab b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.delta.moblab
new file mode 100644
index 0000000..3d89869
--- /dev/null
+++ b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.delta.moblab
@@ -0,0 +1,32 @@
+# Copyright 2017 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+AUTHOR = "dhaddock, Chromium OS"
+NAME = "autoupdate_ForcedOOBEUpdate.delta.moblab"
+PURPOSE = "Test forced update at OOBE."
+TIME = "MEDIUM"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "platform"
+TEST_TYPE = "server"
+ATTRIBUTES = "suite:au_fsi"
+DOC = """
+This tests the forced autoupdate flow at OOBE.
+
+See the control file for the full payload for instructions on running locally.
+Kick it off using this command:
+
+test_that <hostname>.cros autoupdate_ForcedOOBEUpdate.delta --args="job_repo_url='http://<IP>:<port>/static/<board>-release/RXX-XXXX.X.X/autotest/packages'"
+
+"""
+
+from autotest_lib.client.common_lib import utils
+
+args_dict = utils.args_to_dict(args)
+
+def run(machine):
+    host = hosts.create_host(machine)
+    job.run_test('autoupdate_ForcedOOBEUpdate', host=host, full_payload=False,
+                 moblab=True, **args_dict)
+
+job.parallel_simple(run, machines)
diff --git a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.full b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.full
index f784c24..58f2f91 100644
--- a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.full
+++ b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.full
@@ -9,7 +9,7 @@
 TEST_CATEGORY = "Functional"
 TEST_CLASS = "platform"
 TEST_TYPE = "server"
-ATTRIBUTES = "suite:au_fsi"
+ATTRIBUTES = "suite:au-perbuild"
 DOC = """
 This tests the forced autoupdate flow at OOBE.
 
diff --git a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.full.moblab b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.full.moblab
new file mode 100644
index 0000000..0bb6936
--- /dev/null
+++ b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.full.moblab
@@ -0,0 +1,53 @@
+# Copyright 2017 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+AUTHOR = "dhaddock, Chromium OS"
+NAME = "autoupdate_ForcedOOBEUpdate.full.moblab"
+PURPOSE = "Test forced update at OOBE."
+TIME = "MEDIUM"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "platform"
+TEST_TYPE = "server"
+ATTRIBUTES = "suite:au_fsi"
+DOC = """
+This tests the forced autoupdate flow at OOBE.
+
+Debugging steps:
+This test cannot be debugged locally easily because
+1. Using a devserver on your workstation is blocked by SNAX
+2. The test relies on reading a job_repo_url which is only set by runs
+initiated in the lab.
+
+You will need to use a lab DUT and a lab devserver but kick it off from your
+workstation. You can start by going to cautotest and locking a DUT.
+
+You will need to pass a job_repo_url param to test_that.
+
+The test needs to be able to ssh into devservers. To ssh into lab devservers
+Follow these instructions to setup the ssh access to lab devservers:
+https://sites.google.com/a/google.com/chromeos/for-team-members/infrastructure/chromeos-admin/devserver-access
+
+Use this instruction to find the list of lab devservers:
+atest server list | grep devserver
+
+Get access to "Access To Chrome Lab or Cautotest" from:
+https://sphinx.corp.google.com/sphinx/#accessChangeRequest:systemName=default-mnp-use-cases
+
+Then run the test as follows:
+test_that <hostname>.cros autoupdate_ForcedOOBEUpdate.full --args="job_repo_url='http://<IP>:<PORT>/static/<board>-release/RXX-XXXX.X.X/autotest/packages'"
+
+- IP: The IP of the devserver you are running the test agains:
+- PORT: The port of the devserver, normally 8082
+"""
+
+from autotest_lib.client.common_lib import utils
+
+args_dict = utils.args_to_dict(args)
+
+def run(machine):
+    host = hosts.create_host(machine)
+    job.run_test('autoupdate_ForcedOOBEUpdate', host=host, full_payload=True,
+                 moblab=True, **args_dict)
+
+job.parallel_simple(run, machines)
diff --git a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.network.full b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.network.full
index 363534a..f0aa0b8 100644
--- a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.network.full
+++ b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.network.full
@@ -9,7 +9,7 @@
 TEST_CATEGORY = "Functional"
 TEST_CLASS = "platform"
 TEST_TYPE = "server"
-ATTRIBUTES = "suite:au_fsi"
+ATTRIBUTES = "suite:au-perbuild"
 DOC = """
 This tests the forced autoupdate flow at OOBE with interruptions.
 
diff --git a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.network.full.moblab b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.network.full.moblab
new file mode 100644
index 0000000..bcb0631
--- /dev/null
+++ b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.network.full.moblab
@@ -0,0 +1,32 @@
+# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+AUTHOR = "dhaddock, Chromium OS"
+NAME = "autoupdate_ForcedOOBEUpdate.interrupt.network.full.moblab"
+PURPOSE = "Test forced update at OOBE with network interruptions."
+TIME = "MEDIUM"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "platform"
+TEST_TYPE = "server"
+ATTRIBUTES = "suite:au_fsi"
+DOC = """
+This tests the forced autoupdate flow at OOBE with interruptions.
+
+During the update it will
+1. Reboot
+2. Disconnect the network for X minutes (X is configurable in the test).
+3. Use powerd to suspend/resume.
+
+"""
+
+from autotest_lib.client.common_lib import utils
+
+args_dict = utils.args_to_dict(args)
+
+def run(machine):
+    host = hosts.create_host(machine)
+    job.run_test('autoupdate_ForcedOOBEUpdate', host=host, full_payload=True,
+                 interrupt='network', max_updates=2, moblab=True, **args_dict)
+
+job.parallel_simple(run, machines)
diff --git a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.reboot.full b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.reboot.full
index 8f78f4e..e127d1d 100644
--- a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.reboot.full
+++ b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.reboot.full
@@ -9,7 +9,7 @@
 TEST_CATEGORY = "Functional"
 TEST_CLASS = "platform"
 TEST_TYPE = "server"
-ATTRIBUTES = "suite:au_fsi"
+ATTRIBUTES = "suite:au-perbuild"
 DOC = """
 This tests the forced autoupdate flow at OOBE with interruptions.
 
diff --git a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.reboot.full.moblab b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.reboot.full.moblab
new file mode 100644
index 0000000..675642b
--- /dev/null
+++ b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.reboot.full.moblab
@@ -0,0 +1,29 @@
+# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+AUTHOR = "dhaddock, Chromium OS"
+NAME = "autoupdate_ForcedOOBEUpdate.interrupt.reboot.full.moblab"
+PURPOSE = "Test forced update at OOBE with reboot interruptions."
+TIME = "MEDIUM"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "platform"
+TEST_TYPE = "server"
+ATTRIBUTES = "suite:au_fsi"
+DOC = """
+This tests the forced autoupdate flow at OOBE with interruptions.
+
+During the update it will reboot.
+
+"""
+
+from autotest_lib.client.common_lib import utils
+
+args_dict = utils.args_to_dict(args)
+
+def run(machine):
+    host = hosts.create_host(machine)
+    job.run_test('autoupdate_ForcedOOBEUpdate', host=host, full_payload=True,
+                 interrupt='reboot', max_updates=2, moblab=True, **args_dict)
+
+job.parallel_simple(run, machines)
diff --git a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.suspend.full b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.suspend.full
index cb51111..7a3e8bd 100644
--- a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.suspend.full
+++ b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.suspend.full
@@ -9,7 +9,7 @@
 TEST_CATEGORY = "Functional"
 TEST_CLASS = "platform"
 TEST_TYPE = "server"
-ATTRIBUTES = "suite:au_fsi"
+ATTRIBUTES = "suite:au-perbuild"
 DOC = """
 This tests the forced autoupdate flow at OOBE with interruptions.
 
diff --git a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.suspend.full.moblab b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.suspend.full.moblab
new file mode 100644
index 0000000..3402ede
--- /dev/null
+++ b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.suspend.full.moblab
@@ -0,0 +1,29 @@
+# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+AUTHOR = "dhaddock, Chromium OS"
+NAME = "autoupdate_ForcedOOBEUpdate.interrupt.suspend.full.moblab"
+PURPOSE = "Test forced update at OOBE with suspend/resume interruptions."
+TIME = "MEDIUM"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "platform"
+TEST_TYPE = "server"
+ATTRIBUTES = "suite:au_fsi"
+DOC = """
+This tests the forced autoupdate flow at OOBE with interruptions.
+
+During the update it will use powerd to suspend/resume.
+
+"""
+
+from autotest_lib.client.common_lib import utils
+
+args_dict = utils.args_to_dict(args)
+
+def run(machine):
+    host = hosts.create_host(machine)
+    job.run_test('autoupdate_ForcedOOBEUpdate', host=host, full_payload=True,
+                 interrupt='suspend', max_updates=2, moblab=True, **args_dict)
+
+job.parallel_simple(run, machines)