Fix onos-gen-partitions

Change-Id: I438936994731a96d344dd0205355c4f0cac5ae97
diff --git a/TestON/tests/HA/dependencies/onos-gen-partitions b/TestON/tests/HA/dependencies/onos-gen-partitions
index b83aea6..4275524 100755
--- a/TestON/tests/HA/dependencies/onos-gen-partitions
+++ b/TestON/tests/HA/dependencies/onos-gen-partitions
@@ -2,7 +2,7 @@
 """
   Generate the partitions json file from the $OC* environment variables
 
-  Usage: onos-gen-partitions [output file]
+  Usage: onos-gen-partitions [output file] [node_ip ...]
   If output file is not provided, the json is written to stdout.
 """
 
@@ -23,11 +23,13 @@
       vars.append(var)
   return sorted(vars, key=alphanum_key)
 
-def get_nodes(vars, port=9876):
+def get_nodes(ips=None, port=9876):
   node = lambda k: { 'id': k, 'ip': k, 'port': port }
-  return [ node(environ[v]) for v in vars ]
+  if not ips:
+    ips = [ environ[v] for v in get_OC_vars() ]
+  return [ node(v) for v in ips ]
 
-def generate_extended_partitions(nodes, k):
+def generate_partitions(nodes, k):
   l = deque(nodes)
   perms = []
   for i in range(1, len(nodes)+1):
@@ -39,7 +41,7 @@
     l.rotate(-1)
   return perms
 
-def generate_extended_partitions_HA(nodes, k):
+def generate_partitions_HA(nodes, k):
   l = deque(nodes)
   perms = []
   for i in range(1, (len(nodes) + 1) / 2 + 1):
@@ -52,14 +54,12 @@
   return perms
 
 if __name__ == '__main__':
-  vars = get_OC_vars()
-  nodes = get_nodes(vars)
-  extended_partitions = generate_extended_partitions_HA([v.get('id') for v in nodes], 3)
-  partitions = []
-  partitions.extend(extended_partitions)
-  name = 0
+  nodes = get_nodes(sys.argv[2:])
+  partitions = generate_partitions_HA([v.get('id') for v in nodes], 3)
+  m = hashlib.sha256()
   for node in nodes:
-    name = name ^ hash(node['ip'])
+    m.update(node['ip'])
+  name = int(m.hexdigest()[:8], base=16) # 32-bit int based on SHA256 digest
   data = {
            'name': name,
            'nodes': nodes,