Update gen-partition file to new version
Change-Id: Id514a2a870194c98ae4907318f3a26eb961b2715
diff --git a/TestON/tests/HAminorityRestart/dependencies/onos-gen-partitions b/TestON/tests/HAminorityRestart/dependencies/onos-gen-partitions
index bf9a77b..b73ed4a 100755
--- a/TestON/tests/HAminorityRestart/dependencies/onos-gen-partitions
+++ b/TestON/tests/HAminorityRestart/dependencies/onos-gen-partitions
@@ -23,31 +23,39 @@
return sorted(vars, key=alphanum_key)
def get_nodes(vars, port=9876):
- node = lambda k: { 'id': k, 'ip': k, 'tcpPort': port }
+ node = lambda k: { 'id': k, 'ip': k, 'port': port }
return [ node(environ[v]) for v in vars ]
def generate_permutations(nodes, k):
l = deque(nodes)
- perms = {}
+ perms = []
for i in range(1, len(nodes)+1):
- perms['p%d' % i] = list(l)[:k]
+ part = {
+ 'name': 'p%d' % i,
+ 'members': list(l)[:k]
+ }
+ perms.append(part)
l.rotate(-1)
- return OrderedDict(sorted(perms.iteritems(), key=lambda (k, v): alphanum_key(k)))
+ return perms
def generate_permutations2(nodes, k):
l = deque(nodes)
- perms = {}
+ perms = []
for i in range(1, (len(nodes) + 1) / 2 + 1):
- perms['p%d' % i] = list(l)[:k]
+ part = {
+ 'name': 'p%d' % i,
+ 'members': list(l)[:k]
+ }
+ perms.append(part)
l.rotate(-2)
- return OrderedDict(sorted(perms.iteritems(), key=lambda (k, v): alphanum_key(k)))
-
+ return perms
if __name__ == '__main__':
vars = get_OC_vars()
nodes = get_nodes(vars)
- partitions = generate_permutations2(nodes, 3)
+ partitions = generate_permutations2([v.get('id') for v in nodes], 3)
data = {
+ 'name': 'default',
'nodes': nodes,
'partitions': partitions
}