First round of ClusterMetadata improvements:
Introduced a PartitionId type for identifying partitions
Introduced a admin service for making metadata updates
Update cluster.json format to specify all partitions (including p0) and changed partitionId to be an int.
Change-Id: Ia0617f1ed0ce886680dcee4f5396a4bbdfa225da
diff --git a/tools/dev/bin/onos-setup-karaf b/tools/dev/bin/onos-setup-karaf
index 4814715..81168d4 100755
--- a/tools/dev/bin/onos-setup-karaf
+++ b/tools/dev/bin/onos-setup-karaf
@@ -150,7 +150,7 @@
{
"name": "default",
"nodes": [ {"id": "$IP", "ip": "$IP", "port": 9876 } ],
- "partitions": [ { "name": "p1", "members": [ "$IP" ] } ]
+ "partitions": [ { "id": 0, "members": [ "$IP" ] }, { "id": 1, "members": [ "$IP" ] } ]
}
EOF
diff --git a/tools/test/bin/onos-gen-partitions b/tools/test/bin/onos-gen-partitions
index 5da0807..7f3a865 100755
--- a/tools/test/bin/onos-gen-partitions
+++ b/tools/test/bin/onos-gen-partitions
@@ -27,12 +27,18 @@
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)
@@ -42,10 +48,14 @@
if __name__ == '__main__':
vars = get_OC_vars()
nodes = get_nodes(vars)
- partitions = generate_permutations([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([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,