Merge branch 'master' into dev-karaf-4.2.1
Change-Id: If6c7d5f1dc6434ac8ea2fd9716b8ebeee38daa50
diff --git a/tools/build/bazel/modules.bzl b/tools/build/bazel/modules.bzl
index 26a5da4..dfa5cfe 100644
--- a/tools/build/bazel/modules.bzl
+++ b/tools/build/bazel/modules.bzl
@@ -77,7 +77,8 @@
"//web/api:onos-rest",
# "//web/gui2:onos-gui2",
"//web/gui:onos-gui",
- # "//incubator/protobuf/models:onos-incubator-protobuf-models",
+ "//incubator/protobuf/models/proto:onos-incubator-protobuf-models-proto",
+ "//incubator/protobuf/models:onos-incubator-protobuf-models",
# "//incubator/protobuf/services/nb:onos-incubator-protobuf-services-nb",
]
@@ -241,7 +242,7 @@
"//apps/powermanagement:onos-apps-powermanagement-oar",
"//apps/t3:onos-apps-t3-oar",
"//apps/simplefabric:onos-apps-simplefabric-oar",
- # "//apps/kafka-integration:onos-apps-kafka-integration-oar",
+ #"//apps/kafka-integration:onos-apps-kafka-integration-oar",
"//apps/rabbitmq:onos-apps-rabbitmq-oar",
"//apps/odtn/api:onos-apps-odtn-api-oar",
"//apps/odtn/service:onos-apps-odtn-service-oar",
@@ -297,8 +298,8 @@
"//apps/vtn/sfcmgr:onos-apps-vtn-sfcmgr",
"//apps/vtn/vtnmgr:onos-apps-vtn-vtnmgr",
"//apps/vtn/vtnweb:onos-apps-vtn-vtnweb",
- "//apps/kafka-integration/api:onos-apps-kafka-integration-api",
- # "//apps/kafka-integration/app:onos-apps-kafka-integration-app",
+ #"//apps/kafka-integration/api:onos-apps-kafka-integration-api",
+ #"//apps/kafka-integration/app:onos-apps-kafka-integration-app",
]
FEATURES = [
diff --git a/tools/dev/mininet/onos.py b/tools/dev/mininet/onos.py
index c656a05..15232ac 100755
--- a/tools/dev/mininet/onos.py
+++ b/tools/dev/mininet/onos.py
@@ -127,7 +127,7 @@
return env
-tarDefaultPath = 'buck-out/gen/tools/package/onos-package/onos.tar.gz'
+tarDefaultPath = "bazel-out/k8-fastbuild/bin/onos.tar.gz"
def unpackONOS( destDir='/tmp', run=quietRun ):
"Unpack ONOS and return its location"
@@ -280,7 +280,7 @@
self.cmd( 'export PATH=%s:%s:$PATH' % ( onosbin, karafbin ) )
self.cmd( 'cd', self.ONOS_HOME )
self.ucmd( 'mkdir -p config && '
- 'onos-gen-partitions config/cluster.json',
+ 'onos-gen-default-cluster config/cluster.json --nodes ',
' '.join( node.IP() for node in nodes ) )
def intfsDown( self ):
@@ -397,6 +397,11 @@
( self.IP(), self.IP(), CopycatPort )
if nodeStr in result:
break
+
+ # just break if state is active
+ if "state=ACTIVE" in result:
+ break
+
info( '.' )
self.sanityCheck()
time.sleep( 1 )
diff --git a/tools/test/bin/onos-gen-default-cluster b/tools/test/bin/onos-gen-default-cluster
new file mode 100755
index 0000000..e557eda
--- /dev/null
+++ b/tools/test/bin/onos-gen-default-cluster
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+"""
+usage: onos-gen-default-cluster [-h] [-s PARTITION_SIZE] [-n NUM_PARTITIONS]
+ [filename] [node_ip [node_ip ...]]
+
+Generate the partitions json file given a list of IPs or from the $OCC*
+environment variables.
+
+positional arguments:
+ filename File to write output to. If none is provided, output
+ is written to stdout.
+ node_ip IP Address(es) of the node(s) in the cluster. If no
+ IPs are given, will use the $OC* environment
+ variables. NOTE: these arguments are only processed
+ after the filename argument.
+
+optional arguments:
+ -h, --help show this help message and exit
+"""
+
+from os import environ
+import argparse
+import re
+import json
+
+convert = lambda text: int(text) if text.isdigit() else text.lower()
+alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key)]
+
+
+def get_vars_by_type(type):
+ vars = []
+ for var in environ:
+ if re.match(r"{}[0-9]+".format(type), var):
+ vars.append(var)
+ return sorted(vars, key=alphanum_key)
+
+
+def get_vars():
+ vars = get_vars_by_type('OCC')
+ if len(vars) == 0:
+ vars = get_vars_by_type('OC')
+ return vars
+
+
+def get_nodes(ips=None, default_port=9876):
+ node = lambda id, ip, port: {'id': id, 'ip': ip, 'port': port}
+ result = []
+ if not ips:
+ ips = [environ[v] for v in get_vars()]
+ i = 1
+ for ip_string in ips:
+ address_tuple = ip_string.split(":")
+ if len(address_tuple) == 3:
+ id = address_tuple[0]
+ ip = address_tuple[1]
+ port = int(address_tuple[2])
+ else:
+ i += 1
+ ip = ip_string
+ id = ip
+ port = default_port
+ result.append(node(id, ip, port))
+ return result
+
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser(
+ description="Generate the partitions json file given a list of IPs or from environment variables.")
+
+ parser.add_argument(
+ 'filename', metavar='filename', type=str, nargs='?',
+ help='File to write output to. If none is provided, output is written to stdout.')
+
+ parser.add_argument(
+ '--nodes', '-n', metavar='node_ip', type=str, nargs='+',
+ help='IP Address(es) of the storage nodes. If no IPs are given, ' +
+ 'will use the $OCC* or $OC* environment variables. NOTE: these arguments' +
+ ' are only processed after the filename argument.')
+
+ args = parser.parse_args()
+ filename = args.filename
+ nodes = get_nodes(args.nodes)
+
+ data = {
+ 'name': 'onos',
+ 'controller': nodes
+ }
+ output = json.dumps(data, indent=4)
+
+ if filename:
+ with open(filename, 'w') as f:
+ f.write(output)
+ else:
+ print output