From 643ee33289bd2cb9e6afbfb09b4ed72d467ba1c2 Mon Sep 17 00:00:00 2001 From: Ashlee Young Date: Tue, 3 Nov 2015 14:08:10 -0800 Subject: This updates ONOS src tree to commit id 03fa5e571cabbd001ddb1598847e1150b11c7333 Change-Id: I13b554026d6f902933e35887d29bd5fdb669c0bd Signed-off-by: Ashlee Young --- framework/src/onos/tools/test/bin/onos-gen-partitions | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'framework/src/onos/tools/test/bin/onos-gen-partitions') diff --git a/framework/src/onos/tools/test/bin/onos-gen-partitions b/framework/src/onos/tools/test/bin/onos-gen-partitions index a2558392..35195b04 100755 --- a/framework/src/onos/tools/test/bin/onos-gen-partitions +++ b/framework/src/onos/tools/test/bin/onos-gen-partitions @@ -23,22 +23,27 @@ def get_OC_vars(): 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 if __name__ == '__main__': vars = get_OC_vars() nodes = get_nodes(vars) - partitions = generate_permutations(nodes, 3) - data = { + partitions = generate_permutations([v.get('id') for v in nodes], 3) + data = { + 'name': 'default', 'nodes': nodes, 'partitions': partitions } -- cgit 1.2.3-korg