Break down platform_ExternalUsbperipherals tests cases & add to new suite: usb_detect

BUG=chromium:621966
TEST=None

Change-Id: I3ca405567fad9e1f91b9b64770035f1719f5b165
Reviewed-on: https://chromium-review.googlesource.com/355720
Reviewed-by: Kalin Stoyanov <kalin@chromium.org>
Tested-by: Helen Zhang <helenzhang@google.com>
diff --git a/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_suspend_resume b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_suspend_resume
new file mode 100644
index 0000000..303480d
--- /dev/null
+++ b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_suspend_resume
@@ -0,0 +1,84 @@
+# Copyright 2016 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.
+
+from autotest_lib.server import utils
+
+AUTHOR = "Chrome OS Team"
+NAME = "platform_ExternalUsbPeripherals.detect.login_suspend_resume"
+PURPOSE = "Servo based USB boot stress test"
+CRITERIA = "This test will fail if any of the actions or checks fail."
+TIME = "SHORT"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "platform"
+TEST_TYPE = "server"
+ATTRIBUTES = "suite:usb_detect"
+DEPENDENCIES = "servo, usb_detect"
+
+DOC = """
+This test uses servo to connect/disconnect servo USB hub before and
+after events like reboot, login, suspend, resume etc.
+
+The test fails if
+- device is pingable when suspended
+- wrong action passed through action_sequence flag
+- USB detected peripherals are different than expected
+- there is no servo board attached
+- USB peripherals checks(usb_checks below) on command line fail
+Other detection checks can be added for each peripheral
+
+Set of four USB peripherals plugged
+- USB headset
+- USB HD Webcam - should be Logitech HD Pro Webcam C920
+- USB stick with four partitions named ExFAT  Ext4  FAT  NTFS
+- USB mouse
+- USB 3G modem
+- USB SD card reader(one microSD card plugged)
+- USB connected phone(optional)
+"""
+
+args_dict = utils.args_to_dict(args)
+servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
+
+def run(machine):
+    host = hosts.create_host(machine, servo_args=servo_args)
+
+    repeat = int(args_dict.get("repeat", 1))
+
+    default_actions = str("login,suspend,resume")
+
+    action_sequence = str(args_dict.get("action_sequence", default_actions))
+
+    usb_list = ["\"Chicony Electronics Co., Ltd\"",
+                "\"Kingston Technology Company Inc.\"",
+                "\"Alcor Micro Corp.\"",
+                "\"Microsoft Corp.|C-Media Electronics, Inc. Audio Adapter\"",
+                "\"Huawei Technologies Co., Ltd. Modem/Networkcard\"",
+                "\"Realtek Semiconductor Corp.\"",
+                # Commenting out due to crbug.com/488667.
+                #"LG Electronics, Inc.",
+               ]
+    usb_checks = {
+        # USB Audio Output devices
+        str("cras_test_client --dump_server_info | "
+            "awk \"/Output Devices:/,/Output Nodes:/\" | grep -E ") :
+            ["\"Microsoft LifeChat LX-3000: USB Audio|C-Media USB Headphone Set: USB Audio\"" ],
+        # USB Audio Input devices
+        str("loggedin:cras_test_client --dump_server_info | "
+            "awk \"/Input Devices:/,/Input Nodes:/\" | grep -E ") :
+            ["\"TeckNet: USB Audio|USB 2.0 PC Camera\"",
+             "\"Microsoft LifeChat LX-3000: USB Audio|C-Media USB Headphone Set: USB Audio\""],
+        # USB stick four partitions volumes
+        "loggedin:ls -l /media/removable/ | grep -i " :
+            ["\"USB Drive\"", "\"SD Card\"", "ExFAT", "Ext4", "FAT", "NTFS"],
+        # USB Web camera
+        "cat /sys/class/video4linux/video*/name | grep -E " :
+            ["\"TeckNet|USB 2.0 PC Camera\""],
+        }
+
+    job.run_test("platform_ExternalUsbPeripherals", host=host,
+                 disable_sysinfo=True, client_autotest="desktopui_SimpleLogin",
+                 action_sequence=action_sequence, repeat=repeat,
+                 usb_list=usb_list, usb_checks=usb_checks, tag="detect")
+
+parallel_simple(run, machines)
diff --git a/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_suspend_unplug_resume_plug b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_suspend_unplug_resume_plug
new file mode 100644
index 0000000..f3d766a
--- /dev/null
+++ b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_suspend_unplug_resume_plug
@@ -0,0 +1,84 @@
+# Copyright 2016 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.
+
+from autotest_lib.server import utils
+
+AUTHOR = "Chrome OS Team"
+NAME = "platform_ExternalUsbPeripherals.detect.login_suspend_unplug_resume_plug"
+PURPOSE = "Servo based USB boot stress test"
+CRITERIA = "This test will fail if any of the actions or checks fail."
+TIME = "SHORT"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "platform"
+TEST_TYPE = "server"
+ATTRIBUTES = "suite:usb_detect"
+DEPENDENCIES = "servo, usb_detect"
+
+DOC = """
+This test uses servo to connect/disconnect servo USB hub before and
+after events like reboot, login, suspend, resume etc.
+
+The test fails if
+- device is pingable when suspended
+- wrong action passed through action_sequence flag
+- USB detected peripherals are different than expected
+- there is no servo board attached
+- USB peripherals checks(usb_checks below) on command line fail
+Other detection checks can be added for each peripheral
+
+Set of four USB peripherals plugged
+- USB headset
+- USB HD Webcam - should be Logitech HD Pro Webcam C920
+- USB stick with four partitions named ExFAT  Ext4  FAT  NTFS
+- USB mouse
+- USB 3G modem
+- USB SD card reader(one microSD card plugged)
+- USB connected phone(optional)
+"""
+
+args_dict = utils.args_to_dict(args)
+servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
+
+def run(machine):
+    host = hosts.create_host(machine, servo_args=servo_args)
+
+    repeat = int(args_dict.get("repeat", 1))
+
+    default_actions = str("login,suspend,unplug,resume,plug")
+
+    action_sequence = str(args_dict.get("action_sequence", default_actions))
+
+    usb_list = ["\"Chicony Electronics Co., Ltd\"",
+                "\"Kingston Technology Company Inc.\"",
+                "\"Alcor Micro Corp.\"",
+                "\"Microsoft Corp.|C-Media Electronics, Inc. Audio Adapter\"",
+                "\"Huawei Technologies Co., Ltd. Modem/Networkcard\"",
+                "\"Realtek Semiconductor Corp.\"",
+                # Commenting out due to crbug.com/488667.
+                #"LG Electronics, Inc.",
+               ]
+    usb_checks = {
+        # USB Audio Output devices
+        str("cras_test_client --dump_server_info | "
+            "awk \"/Output Devices:/,/Output Nodes:/\" | grep -E ") :
+            ["\"Microsoft LifeChat LX-3000: USB Audio|C-Media USB Headphone Set: USB Audio\"" ],
+        # USB Audio Input devices
+        str("loggedin:cras_test_client --dump_server_info | "
+            "awk \"/Input Devices:/,/Input Nodes:/\" | grep -E ") :
+            ["\"TeckNet: USB Audio|USB 2.0 PC Camera\"",
+             "\"Microsoft LifeChat LX-3000: USB Audio|C-Media USB Headphone Set: USB Audio\""],
+        # USB stick four partitions volumes
+        "loggedin:ls -l /media/removable/ | grep -i " :
+            ["\"USB Drive\"", "\"SD Card\"", "ExFAT", "Ext4", "FAT", "NTFS"],
+        # USB Web camera
+        "cat /sys/class/video4linux/video*/name | grep -E " :
+            ["\"TeckNet|USB 2.0 PC Camera\""],
+        }
+
+    job.run_test("platform_ExternalUsbPeripherals", host=host,
+                 disable_sysinfo=True, client_autotest="desktopui_SimpleLogin",
+                 action_sequence=action_sequence, repeat=repeat,
+                 usb_list=usb_list, usb_checks=usb_checks, tag="detect")
+
+parallel_simple(run, machines)
diff --git a/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_unplug_plug b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_unplug_plug
new file mode 100644
index 0000000..9401a93
--- /dev/null
+++ b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_unplug_plug
@@ -0,0 +1,84 @@
+# Copyright 2016 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.
+
+from autotest_lib.server import utils
+
+AUTHOR = "Chrome OS Team"
+NAME = "platform_ExternalUsbPeripherals.detect.login_unplug_plug"
+PURPOSE = "Servo based USB boot stress test"
+CRITERIA = "This test will fail if any of the actions or checks fail."
+TIME = "SHORT"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "platform"
+TEST_TYPE = "server"
+ATTRIBUTES = "suite:usb_detect"
+DEPENDENCIES = "servo, usb_detect"
+
+DOC = """
+This test uses servo to connect/disconnect servo USB hub before and
+after events like reboot, login, suspend, resume etc.
+
+The test fails if
+- device is pingable when suspended
+- wrong action passed through action_sequence flag
+- USB detected peripherals are different than expected
+- there is no servo board attached
+- USB peripherals checks(usb_checks below) on command line fail
+Other detection checks can be added for each peripheral
+
+Set of four USB peripherals plugged
+- USB headset
+- USB HD Webcam - should be Logitech HD Pro Webcam C920
+- USB stick with four partitions named ExFAT  Ext4  FAT  NTFS
+- USB mouse
+- USB 3G modem
+- USB SD card reader(one microSD card plugged)
+- USB connected phone(optional)
+"""
+
+args_dict = utils.args_to_dict(args)
+servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
+
+def run(machine):
+    host = hosts.create_host(machine, servo_args=servo_args)
+
+    repeat = int(args_dict.get("repeat", 1))
+
+    default_actions = str("login,unplug,plug")
+
+    action_sequence = str(args_dict.get("action_sequence", default_actions))
+
+    usb_list = ["\"Chicony Electronics Co., Ltd\"",
+                "\"Kingston Technology Company Inc.\"",
+                "\"Alcor Micro Corp.\"",
+                "\"Microsoft Corp.|C-Media Electronics, Inc. Audio Adapter\"",
+                "\"Huawei Technologies Co., Ltd. Modem/Networkcard\"",
+                "\"Realtek Semiconductor Corp.\"",
+                # Commenting out due to crbug.com/488667.
+                #"LG Electronics, Inc.",
+               ]
+    usb_checks = {
+        # USB Audio Output devices
+        str("cras_test_client --dump_server_info | "
+            "awk \"/Output Devices:/,/Output Nodes:/\" | grep -E ") :
+            ["\"Microsoft LifeChat LX-3000: USB Audio|C-Media USB Headphone Set: USB Audio\"" ],
+        # USB Audio Input devices
+        str("loggedin:cras_test_client --dump_server_info | "
+            "awk \"/Input Devices:/,/Input Nodes:/\" | grep -E ") :
+            ["\"TeckNet: USB Audio|USB 2.0 PC Camera\"",
+             "\"Microsoft LifeChat LX-3000: USB Audio|C-Media USB Headphone Set: USB Audio\""],
+        # USB stick four partitions volumes
+        "loggedin:ls -l /media/removable/ | grep -i " :
+            ["\"USB Drive\"", "\"SD Card\"", "ExFAT", "Ext4", "FAT", "NTFS"],
+        # USB Web camera
+        "cat /sys/class/video4linux/video*/name | grep -E " :
+            ["\"TeckNet|USB 2.0 PC Camera\""],
+        }
+
+    job.run_test("platform_ExternalUsbPeripherals", host=host,
+                 disable_sysinfo=True, client_autotest="desktopui_SimpleLogin",
+                 action_sequence=action_sequence, repeat=repeat,
+                 usb_list=usb_list, usb_checks=usb_checks, tag="detect")
+
+parallel_simple(run, machines)
diff --git a/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_unplug_suspend_plug_resume b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_unplug_suspend_plug_resume
new file mode 100644
index 0000000..651b61a
--- /dev/null
+++ b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_unplug_suspend_plug_resume
@@ -0,0 +1,84 @@
+# Copyright 2016 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.
+
+from autotest_lib.server import utils
+
+AUTHOR = "Chrome OS Team"
+NAME = "platform_ExternalUsbPeripherals.detect.login_unplug_suspend_plug_resume"
+PURPOSE = "Servo based USB boot stress test"
+CRITERIA = "This test will fail if any of the actions or checks fail."
+TIME = "SHORT"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "platform"
+TEST_TYPE = "server"
+ATTRIBUTES = "suite:usb_detect"
+DEPENDENCIES = "servo, usb_detect"
+
+DOC = """
+This test uses servo to connect/disconnect servo USB hub before and
+after events like reboot, login, suspend, resume etc.
+
+The test fails if
+- device is pingable when suspended
+- wrong action passed through action_sequence flag
+- USB detected peripherals are different than expected
+- there is no servo board attached
+- USB peripherals checks(usb_checks below) on command line fail
+Other detection checks can be added for each peripheral
+
+Set of four USB peripherals plugged
+- USB headset
+- USB HD Webcam - should be Logitech HD Pro Webcam C920
+- USB stick with four partitions named ExFAT  Ext4  FAT  NTFS
+- USB mouse
+- USB 3G modem
+- USB SD card reader(one microSD card plugged)
+- USB connected phone(optional)
+"""
+
+args_dict = utils.args_to_dict(args)
+servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
+
+def run(machine):
+    host = hosts.create_host(machine, servo_args=servo_args)
+
+    repeat = int(args_dict.get("repeat", 1))
+
+    default_actions = str("login,unplug,suspend,plug,resume")
+
+    action_sequence = str(args_dict.get("action_sequence", default_actions))
+
+    usb_list = ["\"Chicony Electronics Co., Ltd\"",
+                "\"Kingston Technology Company Inc.\"",
+                "\"Alcor Micro Corp.\"",
+                "\"Microsoft Corp.|C-Media Electronics, Inc. Audio Adapter\"",
+                "\"Huawei Technologies Co., Ltd. Modem/Networkcard\"",
+                "\"Realtek Semiconductor Corp.\"",
+                # Commenting out due to crbug.com/488667.
+                #"LG Electronics, Inc.",
+               ]
+    usb_checks = {
+        # USB Audio Output devices
+        str("cras_test_client --dump_server_info | "
+            "awk \"/Output Devices:/,/Output Nodes:/\" | grep -E ") :
+            ["\"Microsoft LifeChat LX-3000: USB Audio|C-Media USB Headphone Set: USB Audio\"" ],
+        # USB Audio Input devices
+        str("loggedin:cras_test_client --dump_server_info | "
+            "awk \"/Input Devices:/,/Input Nodes:/\" | grep -E ") :
+            ["\"TeckNet: USB Audio|USB 2.0 PC Camera\"",
+             "\"Microsoft LifeChat LX-3000: USB Audio|C-Media USB Headphone Set: USB Audio\""],
+        # USB stick four partitions volumes
+        "loggedin:ls -l /media/removable/ | grep -i " :
+            ["\"USB Drive\"", "\"SD Card\"", "ExFAT", "Ext4", "FAT", "NTFS"],
+        # USB Web camera
+        "cat /sys/class/video4linux/video*/name | grep -E " :
+            ["\"TeckNet|USB 2.0 PC Camera\""],
+        }
+
+    job.run_test("platform_ExternalUsbPeripherals", host=host,
+                 disable_sysinfo=True, client_autotest="desktopui_SimpleLogin",
+                 action_sequence=action_sequence, repeat=repeat,
+                 usb_list=usb_list, usb_checks=usb_checks, tag="detect")
+
+parallel_simple(run, machines)
diff --git a/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_unplug_suspend_resume_plug b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_unplug_suspend_resume_plug
new file mode 100644
index 0000000..92c8de5
--- /dev/null
+++ b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_unplug_suspend_resume_plug
@@ -0,0 +1,84 @@
+# Copyright 2016 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.
+
+from autotest_lib.server import utils
+
+AUTHOR = "Chrome OS Team"
+NAME = "platform_ExternalUsbPeripherals.detect.login_unplug_suspend_resume_plug"
+PURPOSE = "Servo based USB boot stress test"
+CRITERIA = "This test will fail if any of the actions or checks fail."
+TIME = "SHORT"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "platform"
+TEST_TYPE = "server"
+ATTRIBUTES = "suite:usb_detect"
+DEPENDENCIES = "servo, usb_detect"
+
+DOC = """
+This test uses servo to connect/disconnect servo USB hub before and
+after events like reboot, login, suspend, resume etc.
+
+The test fails if
+- device is pingable when suspended
+- wrong action passed through action_sequence flag
+- USB detected peripherals are different than expected
+- there is no servo board attached
+- USB peripherals checks(usb_checks below) on command line fail
+Other detection checks can be added for each peripheral
+
+Set of four USB peripherals plugged
+- USB headset
+- USB HD Webcam - should be Logitech HD Pro Webcam C920
+- USB stick with four partitions named ExFAT  Ext4  FAT  NTFS
+- USB mouse
+- USB 3G modem
+- USB SD card reader(one microSD card plugged)
+- USB connected phone(optional)
+"""
+
+args_dict = utils.args_to_dict(args)
+servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
+
+def run(machine):
+    host = hosts.create_host(machine, servo_args=servo_args)
+
+    repeat = int(args_dict.get("repeat", 1))
+
+    default_actions = str("login,unplug,suspend,resume,plug")
+
+    action_sequence = str(args_dict.get("action_sequence", default_actions))
+
+    usb_list = ["\"Chicony Electronics Co., Ltd\"",
+                "\"Kingston Technology Company Inc.\"",
+                "\"Alcor Micro Corp.\"",
+                "\"Microsoft Corp.|C-Media Electronics, Inc. Audio Adapter\"",
+                "\"Huawei Technologies Co., Ltd. Modem/Networkcard\"",
+                "\"Realtek Semiconductor Corp.\"",
+                # Commenting out due to crbug.com/488667.
+                #"LG Electronics, Inc.",
+               ]
+    usb_checks = {
+        # USB Audio Output devices
+        str("cras_test_client --dump_server_info | "
+            "awk \"/Output Devices:/,/Output Nodes:/\" | grep -E ") :
+            ["\"Microsoft LifeChat LX-3000: USB Audio|C-Media USB Headphone Set: USB Audio\"" ],
+        # USB Audio Input devices
+        str("loggedin:cras_test_client --dump_server_info | "
+            "awk \"/Input Devices:/,/Input Nodes:/\" | grep -E ") :
+            ["\"TeckNet: USB Audio|USB 2.0 PC Camera\"",
+             "\"Microsoft LifeChat LX-3000: USB Audio|C-Media USB Headphone Set: USB Audio\""],
+        # USB stick four partitions volumes
+        "loggedin:ls -l /media/removable/ | grep -i " :
+            ["\"USB Drive\"", "\"SD Card\"", "ExFAT", "Ext4", "FAT", "NTFS"],
+        # USB Web camera
+        "cat /sys/class/video4linux/video*/name | grep -E " :
+            ["\"TeckNet|USB 2.0 PC Camera\""],
+        }
+
+    job.run_test("platform_ExternalUsbPeripherals", host=host,
+                 disable_sysinfo=True, client_autotest="desktopui_SimpleLogin",
+                 action_sequence=action_sequence, repeat=repeat,
+                 usb_list=usb_list, usb_checks=usb_checks, tag="detect")
+
+parallel_simple(run, machines)
diff --git a/server/site_tests/platform_ExternalUsbPeripherals/control.detect.reboot-login b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.reboot-login
new file mode 100644
index 0000000..82106d1
--- /dev/null
+++ b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.reboot-login
@@ -0,0 +1,84 @@
+# Copyright 2016 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.
+
+from autotest_lib.server import utils
+
+AUTHOR = "Chrome OS Team"
+NAME = "platform_ExternalUsbPeripherals.detect.unplug_plug"
+PURPOSE = "Servo based USB boot stress test"
+CRITERIA = "This test will fail if any of the actions or checks fail."
+TIME = "SHORT"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "platform"
+TEST_TYPE = "server"
+ATTRIBUTES = "suite:usb_detect"
+DEPENDENCIES = "servo, usb_detect"
+
+DOC = """
+This test uses servo to connect/disconnect servo USB hub before and
+after events like reboot, login, suspend, resume etc.
+
+The test fails if
+- device is pingable when suspended
+- wrong action passed through action_sequence flag
+- USB detected peripherals are different than expected
+- there is no servo board attached
+- USB peripherals checks(usb_checks below) on command line fail
+Other detection checks can be added for each peripheral
+
+Set of four USB peripherals plugged
+- USB headset
+- USB HD Webcam - should be Logitech HD Pro Webcam C920
+- USB stick with four partitions named ExFAT  Ext4  FAT  NTFS
+- USB mouse
+- USB 3G modem
+- USB SD card reader(one microSD card plugged)
+- USB connected phone(optional)
+"""
+
+args_dict = utils.args_to_dict(args)
+servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
+
+def run(machine):
+    host = hosts.create_host(machine, servo_args=servo_args)
+
+    repeat = int(args_dict.get("repeat", 1))
+
+    default_actions = str("unplug,plug")
+
+    action_sequence = str(args_dict.get("action_sequence", default_actions))
+
+    usb_list = ["\"Chicony Electronics Co., Ltd\"",
+                "\"Kingston Technology Company Inc.\"",
+                "\"Alcor Micro Corp.\"",
+                "\"Microsoft Corp.|C-Media Electronics, Inc. Audio Adapter\"",
+                "\"Huawei Technologies Co., Ltd. Modem/Networkcard\"",
+                "\"Realtek Semiconductor Corp.\"",
+                # Commenting out due to crbug.com/488667.
+                #"LG Electronics, Inc.",
+               ]
+    usb_checks = {
+        # USB Audio Output devices
+        str("cras_test_client --dump_server_info | "
+            "awk \"/Output Devices:/,/Output Nodes:/\" | grep -E ") :
+            ["\"Microsoft LifeChat LX-3000: USB Audio|C-Media USB Headphone Set: USB Audio\"" ],
+        # USB Audio Input devices
+        str("loggedin:cras_test_client --dump_server_info | "
+            "awk \"/Input Devices:/,/Input Nodes:/\" | grep -E ") :
+            ["\"TeckNet: USB Audio|USB 2.0 PC Camera\"",
+             "\"Microsoft LifeChat LX-3000: USB Audio|C-Media USB Headphone Set: USB Audio\""],
+        # USB stick four partitions volumes
+        "loggedin:ls -l /media/removable/ | grep -i " :
+            ["\"USB Drive\"", "\"SD Card\"", "ExFAT", "Ext4", "FAT", "NTFS"],
+        # USB Web camera
+        "cat /sys/class/video4linux/video*/name | grep -E " :
+            ["\"TeckNet|USB 2.0 PC Camera\""],
+        }
+
+    job.run_test("platform_ExternalUsbPeripherals", host=host,
+                 disable_sysinfo=True, client_autotest="desktopui_SimpleLogin",
+                 action_sequence=action_sequence, repeat=repeat,
+                 usb_list=usb_list, usb_checks=usb_checks, tag="detect")
+
+parallel_simple(run, machines)
diff --git a/server/site_tests/platform_ExternalUsbPeripherals/control.detect.unplug_login_plug b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.unplug_login_plug
new file mode 100644
index 0000000..32f2b3a
--- /dev/null
+++ b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.unplug_login_plug
@@ -0,0 +1,84 @@
+# Copyright 2016 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.
+
+from autotest_lib.server import utils
+
+AUTHOR = "Chrome OS Team"
+NAME = "platform_ExternalUsbPeripherals.detect.unplug_login_plug"
+PURPOSE = "Servo based USB boot stress test"
+CRITERIA = "This test will fail if any of the actions or checks fail."
+TIME = "SHORT"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "platform"
+TEST_TYPE = "server"
+ATTRIBUTES = "suite:usb_detect"
+DEPENDENCIES = "servo, usb_detect"
+
+DOC = """
+This test uses servo to connect/disconnect servo USB hub before and
+after events like reboot, login, suspend, resume etc.
+
+The test fails if
+- device is pingable when suspended
+- wrong action passed through action_sequence flag
+- USB detected peripherals are different than expected
+- there is no servo board attached
+- USB peripherals checks(usb_checks below) on command line fail
+Other detection checks can be added for each peripheral
+
+Set of four USB peripherals plugged
+- USB headset
+- USB HD Webcam - should be Logitech HD Pro Webcam C920
+- USB stick with four partitions named ExFAT  Ext4  FAT  NTFS
+- USB mouse
+- USB 3G modem
+- USB SD card reader(one microSD card plugged)
+- USB connected phone(optional)
+"""
+
+args_dict = utils.args_to_dict(args)
+servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
+
+def run(machine):
+    host = hosts.create_host(machine, servo_args=servo_args)
+
+    repeat = int(args_dict.get("repeat", 1))
+
+    default_actions = str("unplug,login,plug")
+
+    action_sequence = str(args_dict.get("action_sequence", default_actions))
+
+    usb_list = ["\"Chicony Electronics Co., Ltd\"",
+                "\"Kingston Technology Company Inc.\"",
+                "\"Alcor Micro Corp.\"",
+                "\"Microsoft Corp.|C-Media Electronics, Inc. Audio Adapter\"",
+                "\"Huawei Technologies Co., Ltd. Modem/Networkcard\"",
+                "\"Realtek Semiconductor Corp.\"",
+                # Commenting out due to crbug.com/488667.
+                #"LG Electronics, Inc.",
+               ]
+    usb_checks = {
+        # USB Audio Output devices
+        str("cras_test_client --dump_server_info | "
+            "awk \"/Output Devices:/,/Output Nodes:/\" | grep -E ") :
+            ["\"Microsoft LifeChat LX-3000: USB Audio|C-Media USB Headphone Set: USB Audio\"" ],
+        # USB Audio Input devices
+        str("loggedin:cras_test_client --dump_server_info | "
+            "awk \"/Input Devices:/,/Input Nodes:/\" | grep -E ") :
+            ["\"TeckNet: USB Audio|USB 2.0 PC Camera\"",
+             "\"Microsoft LifeChat LX-3000: USB Audio|C-Media USB Headphone Set: USB Audio\""],
+        # USB stick four partitions volumes
+        "loggedin:ls -l /media/removable/ | grep -i " :
+            ["\"USB Drive\"", "\"SD Card\"", "ExFAT", "Ext4", "FAT", "NTFS"],
+        # USB Web camera
+        "cat /sys/class/video4linux/video*/name | grep -E " :
+            ["\"TeckNet|USB 2.0 PC Camera\""],
+        }
+
+    job.run_test("platform_ExternalUsbPeripherals", host=host,
+                 disable_sysinfo=True, client_autotest="desktopui_SimpleLogin",
+                 action_sequence=action_sequence, repeat=repeat,
+                 usb_list=usb_list, usb_checks=usb_checks, tag="detect")
+
+parallel_simple(run, machines)
diff --git a/server/site_tests/platform_ExternalUsbPeripherals/control.detect.unplug_plug b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.unplug_plug
new file mode 100644
index 0000000..82106d1
--- /dev/null
+++ b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.unplug_plug
@@ -0,0 +1,84 @@
+# Copyright 2016 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.
+
+from autotest_lib.server import utils
+
+AUTHOR = "Chrome OS Team"
+NAME = "platform_ExternalUsbPeripherals.detect.unplug_plug"
+PURPOSE = "Servo based USB boot stress test"
+CRITERIA = "This test will fail if any of the actions or checks fail."
+TIME = "SHORT"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "platform"
+TEST_TYPE = "server"
+ATTRIBUTES = "suite:usb_detect"
+DEPENDENCIES = "servo, usb_detect"
+
+DOC = """
+This test uses servo to connect/disconnect servo USB hub before and
+after events like reboot, login, suspend, resume etc.
+
+The test fails if
+- device is pingable when suspended
+- wrong action passed through action_sequence flag
+- USB detected peripherals are different than expected
+- there is no servo board attached
+- USB peripherals checks(usb_checks below) on command line fail
+Other detection checks can be added for each peripheral
+
+Set of four USB peripherals plugged
+- USB headset
+- USB HD Webcam - should be Logitech HD Pro Webcam C920
+- USB stick with four partitions named ExFAT  Ext4  FAT  NTFS
+- USB mouse
+- USB 3G modem
+- USB SD card reader(one microSD card plugged)
+- USB connected phone(optional)
+"""
+
+args_dict = utils.args_to_dict(args)
+servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
+
+def run(machine):
+    host = hosts.create_host(machine, servo_args=servo_args)
+
+    repeat = int(args_dict.get("repeat", 1))
+
+    default_actions = str("unplug,plug")
+
+    action_sequence = str(args_dict.get("action_sequence", default_actions))
+
+    usb_list = ["\"Chicony Electronics Co., Ltd\"",
+                "\"Kingston Technology Company Inc.\"",
+                "\"Alcor Micro Corp.\"",
+                "\"Microsoft Corp.|C-Media Electronics, Inc. Audio Adapter\"",
+                "\"Huawei Technologies Co., Ltd. Modem/Networkcard\"",
+                "\"Realtek Semiconductor Corp.\"",
+                # Commenting out due to crbug.com/488667.
+                #"LG Electronics, Inc.",
+               ]
+    usb_checks = {
+        # USB Audio Output devices
+        str("cras_test_client --dump_server_info | "
+            "awk \"/Output Devices:/,/Output Nodes:/\" | grep -E ") :
+            ["\"Microsoft LifeChat LX-3000: USB Audio|C-Media USB Headphone Set: USB Audio\"" ],
+        # USB Audio Input devices
+        str("loggedin:cras_test_client --dump_server_info | "
+            "awk \"/Input Devices:/,/Input Nodes:/\" | grep -E ") :
+            ["\"TeckNet: USB Audio|USB 2.0 PC Camera\"",
+             "\"Microsoft LifeChat LX-3000: USB Audio|C-Media USB Headphone Set: USB Audio\""],
+        # USB stick four partitions volumes
+        "loggedin:ls -l /media/removable/ | grep -i " :
+            ["\"USB Drive\"", "\"SD Card\"", "ExFAT", "Ext4", "FAT", "NTFS"],
+        # USB Web camera
+        "cat /sys/class/video4linux/video*/name | grep -E " :
+            ["\"TeckNet|USB 2.0 PC Camera\""],
+        }
+
+    job.run_test("platform_ExternalUsbPeripherals", host=host,
+                 disable_sysinfo=True, client_autotest="desktopui_SimpleLogin",
+                 action_sequence=action_sequence, repeat=repeat,
+                 usb_list=usb_list, usb_checks=usb_checks, tag="detect")
+
+parallel_simple(run, machines)
diff --git a/suite_scheduler.ini b/suite_scheduler.ini
index 571c997..9e7d297 100644
--- a/suite_scheduler.ini
+++ b/suite_scheduler.ini
@@ -564,9 +564,15 @@
 pool: stress5
 file_bugs: True
 
-[NightlyKernelUsb]
-run_on: new_build
+[UsbDetectStress]
+run_on: nightly
 suite: kernel_usb
+branch_specs: ==tot
+pool: usb_peripherals
+
+[UsbDetect]
+run_on: new_build
+suite: usb_detect
 branch_specs: >=tot-2
 pool: usb_peripherals
 
diff --git a/test_suites/control.usb_detect b/test_suites/control.usb_detect
new file mode 100644
index 0000000..6a0c918
--- /dev/null
+++ b/test_suites/control.usb_detect
@@ -0,0 +1,49 @@
+# Copyright 2016 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 = "Chrome OS Team"
+NAME = "usb_detect"
+PURPOSE = "USB peripherals detection."
+
+TIME = "LONG"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "suite"
+TEST_TYPE = "Server"
+
+DOC = """
+This is the usb_detect test suite.
+
+This suite is meant to cover boards on different kernel version
+for ARM and non-ARM boards. USB detection tests will be exercizing
+short detect tests and stress scenarios.
+Consistent failure to detect peripherals will indicate kernel
+regression.
+
+@param build: The name of the image to test.
+              Ex: x86-mario-release/R17-1412.33.0-a1-b29
+@param board: The board to test on.  Ex: x86-mario
+@param pool: The pool of machines to utilize for scheduling. If pool=None
+             board is used.
+@param check_hosts: require appropriate live hosts to exist in the lab.
+@param SKIP_IMAGE: (optional) If present and True, don't re-image devices.
+"""
+
+import common
+from autotest_lib.server.cros import provision
+from autotest_lib.server.cros.dynamic_suite import dynamic_suite
+
+_BUG_TEMPLATE = {
+    'labels': ['OS-Chrome', 'UsbDetect-Bug'],
+    'components': ['OS>Kernel'],
+    'owner': 'kalin@chromium.org',
+}
+
+
+args_dict['add_experimental'] = True
+args_dict['bug_template'] = _BUG_TEMPLATE
+args_dict['name'] = 'usb_detect'
+args_dict['version_prefix'] = provision.CROS_VERSION_PREFIX
+args_dict['job'] = job
+
+dynamic_suite.reimage_and_run(**args_dict)