[moblab] Fix the unique id generation to fallback to mac address.

For next gen moblab we moved to using the serial number in the
vpd, however it seems some guado moblabs in the field do not have
a serial number so for now fall back to the mac address in the vpd.

TEST=ad hoc testing on moblab
BUG=chromium:866913

Change-Id: I3efa4d12e0fbce0bb257174d805a433f811f549b
Reviewed-on: https://chromium-review.googlesource.com/1148642
Commit-Ready: Keith Haddow <haddowk@chromium.org>
Tested-by: Keith Haddow <haddowk@chromium.org>
Reviewed-by: Keith Haddow <haddowk@chromium.org>
Reviewed-by: Matt Mallett <mattmallett@chromium.org>
(cherry picked from commit d2798fe07a9fb64a9d2c052969a82b24057273ac)
Reviewed-on: https://chromium-review.googlesource.com/1149997
Commit-Queue: Keith Haddow <haddowk@chromium.org>
Trybot-Ready: Keith Haddow <haddowk@chromium.org>
diff --git a/client/common_lib/utils.py b/client/common_lib/utils.py
index a2e1d41..c2ec523 100644
--- a/client/common_lib/utils.py
+++ b/client/common_lib/utils.py
@@ -1833,19 +1833,20 @@
 
 
 def get_moblab_serial_number():
-    """Gets the moblab public network interface.
+    """Gets a unique identifier for the moblab.
 
-    If the eth0 is an USB interface, try to use eth1 instead. Otherwise
-    use eth0 by default.
+    Serial number is the prefered identifier, use it if
+    present, however fallback is the ethernet mac address.
     """
-    try:
-        cmd_result = run('sudo vpd -g serial_number')
-        if cmd_result.stdout:
-          return cmd_result.stdout
-    except error.CmdError as e:
-        logging.error(str(e))
-        logging.info('Serial number ')
-        pass
+    for vpd_key in ['serial_number', 'ethernet_mac']:
+      try:
+          cmd_result = run('sudo vpd -g %s' % vpd_key)
+          if cmd_result and cmd_result.stdout:
+            return cmd_result.stdout
+      except error.CmdError as e:
+          logging.error(str(e))
+          logging.info(vpd_key)
+          pass
     return 'NoSerialNumber'