Device-Aware API: Change from DUT API to a more general Device API.

The DUT-Aware API works fine for pytests, but we now realized there are
more to change for station-based environments - especially in the test
controller "Goofy" and test frameworks (for example test list) that
needs to deal with different environments, like offline mode or Windows.

The solution is to extend DUT API to a more general namespace that both
DUT and station can use. It also needs to live outside 'test' sub folder
because many Goofy and core modules will need it, for finding
environment settings like location of factory related folders.

Before:
  from cros.factory.test import dut
  self._dut = dut.Create()

After:
  from cros.factory.device import device_utils
  self._dut = device_utils.CreateDUTInterface()

And the new approach to specify DUT board class is now to use config:
 # chromeos-factory-board/files/config/devices.json
 { "dut": {"board_class": "DaisyBoard", "link_class": "ADBLink"} }

Note this change is backward-compatible and the migrate_dut_api script will
move board implementations to right place.

BUT=chromium:557573
TEST=make test

Change-Id: I4bf2bb22150b3a153c92aea2a7dcfde9d2684f6b
Reviewed-on: https://chromium-review.googlesource.com/349870
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
diff --git a/py/tools/regcode.py b/py/tools/regcode.py
index 6a0ba8d..5b3e62b 100755
--- a/py/tools/regcode.py
+++ b/py/tools/regcode.py
@@ -15,8 +15,8 @@
 import sys
 
 import factory_common  # pylint: disable=W0611
+from cros.factory.device import device_utils
 from cros.factory.proto import reg_code_pb2
-from cros.factory.test import dut as dut_module
 from cros.factory.test.rules import registration_codes
 from cros.factory.test.rules.registration_codes import RegistrationCode
 from cros.factory.tools.build_board import BuildBoard
@@ -104,7 +104,7 @@
 
   rw_vpd = None
   success = True
-  dut = dut_module.Create()
+  dut = device_utils.CreateDUTInterface()
 
   for code_type, vpd_attribute, code in (
       (RegistrationCode.Type.UNIQUE_CODE,