dut: Add DUT-aware 'VitalProductData' component to replace system.vpd.

To access Vital Product Data, we should use the new DUT-Aware version of VPD
component.

All tests doing 'from cros.factory.system import vpd; vpd.rw.get(key)' should be
changed to self.dut.vpd.rw.get(key).

BUG=chromium:557573
TEST=make test

Change-Id: I02de0a7e58777e56a084976c17bedfdb376f10cc
Reviewed-on: https://chromium-review.googlesource.com/313905
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 a0d28c8..30df6af 100755
--- a/py/tools/regcode.py
+++ b/py/tools/regcode.py
@@ -17,7 +17,7 @@
 import factory_common  # pylint: disable=W0611
 from cros.factory.hacked_argparse import CmdArg, Command, ParseCmdline
 from cros.factory.proto import reg_code_pb2
-from cros.factory.system import vpd
+from cros.factory.test import dut as dut_module
 from cros.factory.test import registration_codes
 from cros.factory.test import utils
 from cros.factory.test.registration_codes import RegistrationCode
@@ -102,6 +102,7 @@
 
   rw_vpd = None
   success = True
+  dut = dut_module.Create()
 
   for code_type, vpd_attribute, code in (
       (RegistrationCode.Type.UNIQUE_CODE,
@@ -115,7 +116,7 @@
           sys.stderr.write('error: cannot read VPD from chroot; use -u/-g\n')
           sys.exit(1)
 
-        rw_vpd = vpd.rw.GetAll()
+        rw_vpd = dut.vpd.rw.GetAll()
         code = rw_vpd.get(vpd_attribute)
       if not code:
         sys.stderr.write('error: %s is not present in RW VPD\n' %