Update onos-gen-partitions file to match new format
Change-Id: I1cbc5a4b9c5f8219039d518a9949f4cdb48338b2
diff --git a/TestON/tests/HAstopNodes/dependencies/onos-gen-partitions b/TestON/tests/HAstopNodes/dependencies/onos-gen-partitions
index cb0d826..06c5ec9 100755
--- a/TestON/tests/HAstopNodes/dependencies/onos-gen-partitions
+++ b/TestON/tests/HAstopNodes/dependencies/onos-gen-partitions
@@ -27,24 +27,30 @@
node = lambda k: { 'id': k, 'ip': k, 'port': port }
return [ node(environ[v]) for v in vars ]
-def generate_permutations(nodes, k):
+def generate_base_partition(nodes):
+ return {
+ 'id': 0,
+ 'members': nodes
+ }
+
+def generate_extended_partitions(nodes, k):
l = deque(nodes)
perms = []
for i in range(1, len(nodes)+1):
part = {
- 'name': 'p%d' % i,
+ 'id': i,
'members': list(l)[:k]
}
perms.append(part)
l.rotate(-1)
return perms
-def generate_permutations2(nodes, k):
+def generate_extended_partitions_HA(nodes, k):
l = deque(nodes)
perms = []
for i in range(1, (len(nodes) + 1) / 2 + 1):
part = {
- 'name': 'p%d' % i,
+ 'id': i,
'members': list(l)[:k]
}
perms.append(part)
@@ -54,10 +60,14 @@
if __name__ == '__main__':
vars = get_OC_vars()
nodes = get_nodes(vars)
- partitions = generate_permutations2([v.get('id') for v in nodes], 3)
+ base_partition = generate_base_partition([v.get('id') for v in nodes])
+ extended_partitions = generate_extended_partitions_HA([v.get('id') for v in nodes], 3)
+ partitions = []
+ partitions.append(base_partition)
+ partitions.extend(extended_partitions)
name = 0
for node in nodes:
- name = name ^ hash(node['ip'])
+ name = name ^ hash(node['ip'])
data = {
'name': name,
'nodes': nodes,