[ 6322 ] Update the code to only accept a MAC address as a datapath id (DPID). If
one is provided and it is already assigned to a logical device then an exception
 will be raised.

VOL-500 : Allow adapters to set the datapath id using the MAC address of the OLT device.  The logical device id will use this datapath id as well

Change-Id: Ib6ae48861c3a449000360469f7fb7332ff39961a
diff --git a/common/utils/id_generation.py b/common/utils/id_generation.py
index 59535b8..bb2e144 100644
--- a/common/utils/id_generation.py
+++ b/common/utils/id_generation.py
@@ -35,16 +35,17 @@
 def create_cluster_logical_device_ids(core_id, switch_id):
     """
     Creates a logical device id and an OpenFlow datapath id that is unique 
-    across the Voltha cluster. Both ids represents a 64 bits integer where 
-    the lower 48 bits represents the switch id and the upper 16 bits  
-    represents the core id.  
+    across the Voltha cluster.
+    The returned ids represents a 64 bits integer where the lower 48 bits is
+    the switch id and the upper 16 bits is the core id.
     :param core_id: string
+    :param switch_id:int
     :return: cluster logical device id and OpenFlow datapath id
     """
     switch_id = format(switch_id, '012x')
-    id = '{}{}'.format(format(int(core_id), '04x'), switch_id)
-    hex_int = int(id, 16)
-    return id, hex_int
+    core_in_hex=format(int(core_id, 16), '04x')
+    id = '{}{}'.format(core_in_hex[-4:], switch_id[-12:])
+    return id, int(id, 16)
 
 def is_broadcast_core_id(id):
     assert id and len(id) == 16