Initial builds using bazel

Change-Id: I38123b396a2ffda5f36cdca43f3ad1fa67a7ab52
diff --git a/.bazelrc b/.bazelrc
new file mode 100644
index 0000000..dfbabc4
--- /dev/null
+++ b/.bazelrc
@@ -0,0 +1 @@
+build --nouse_ijars
diff --git a/BUILD b/BUILD
new file mode 100644
index 0000000..9416716
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,21 @@
+filegroup(
+    name = "onos",
+    srcs = [
+             "//utils/junit:onlab-junit-osgi",
+             "//utils/misc:onlab-misc-osgi",
+             "//utils/osgi:onlab-osgi-osgi",
+             "//utils/rest:onlab-rest-osgi",
+             "//utils/osgiwrap:osgi-jar",
+             "//core/api:onos-api-osgi",
+             "//core/common:onos-core-common-osgi",
+             "//incubator/api:onos-incubator-api-osgi",
+             "//core/store/serializers:onos-core-serializers-osgi",
+             "//core/store/dist:onos-core-dist-osgi",
+             "//incubator/store:onos-incubator-store",
+             "//incubator/net:onos-incubator-net",
+             "//protocols/openflow/api:onos-protocols-openflow-api-osgi",
+             "//drivers/default:onos-drivers-default-osgi",
+             #"//core/net:onos-core-net-osgi",
+           ],
+)
+
diff --git a/WORKSPACE b/WORKSPACE
new file mode 100644
index 0000000..e86cb0d
--- /dev/null
+++ b/WORKSPACE
@@ -0,0 +1,4 @@
+load("//tools/build/bazel:generate_workspace.bzl", "generated_maven_jars")
+generated_maven_jars()
+
+ONOS_VERSION = '1.14.0-SNAPSHOT'
diff --git a/core/api/BUILD b/core/api/BUILD
new file mode 100644
index 0000000..be731ad
--- /dev/null
+++ b/core/api/BUILD
@@ -0,0 +1,27 @@
+COMPILE_DEPS = COMPILE + NETTY + JACKSON + METRICS + KRYO + [
+    '//utils/misc:onlab-misc',
+    '//utils/osgi:onlab-osgi',
+    '//utils/rest:onlab-rest',
+    '@joda_time//jar',
+    '@netty//jar',
+]
+
+osgi_jar_with_tests (
+    name = 'onos-api',
+    deps = COMPILE_DEPS,
+    exclude_tests = [
+       'org.onosproject.net.config.basics.AbstractConfigTest',
+       'org.onosproject.net.driver.AbstractDriverLoaderTest',
+       'org.onosproject.net.intent.AbstractIntentTest',
+       'org.onosproject.net.intent.ConnectivityIntentTest',
+       'org.onosproject.net.intent.IntentTest',
+       'org.onosproject.net.pi.runtime.PiConstantsTest',
+       'org.onosproject.security.SecurityUtilTest',
+       'org.onosproject.ui.AbstractUiTest',
+       'org.onosproject.ui.model.AbstractUiModelTest',
+       'org.onosproject.net.behaviour.QosIdTest',
+    ],
+    visibility = ["//visibility:public"],
+    #javadoc_files = glob(['src/main/javadoc/**/*']),
+    #javadoc_files_root = 'src/main/javadoc',
+)
diff --git a/core/api/src/main/java/org/onosproject/net/intent/IntentData.java b/core/api/src/main/java/org/onosproject/net/intent/IntentData.java
index bb7a710..cad48ab 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/IntentData.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/IntentData.java
@@ -457,6 +457,7 @@
             } else if (currentState == INSTALLED) {
                 return true;
             }
+            // FALLTHROUGH
         case INSTALLED:
             if (currentState == INSTALLED) {
                 return false;
diff --git a/core/api/src/main/java/org/onosproject/net/intent/IntentEvent.java b/core/api/src/main/java/org/onosproject/net/intent/IntentEvent.java
index 47aa94d..fd3d457 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/IntentEvent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/IntentEvent.java
@@ -142,11 +142,10 @@
                 type = Type.PURGED;
                 break;
 
-            // fallthrough to default from here
-            case COMPILING:
-            case INSTALLING:
-            case RECOMPILING:
-            case WITHDRAWING:
+            case COMPILING:     // FALLTHROUGH
+            case INSTALLING:    // FALLTHROUGH
+            case RECOMPILING:   // FALLTHROUGH
+            case WITHDRAWING:   // FALLTHROUGH
             default:
                 return Optional.empty();
         }
diff --git a/core/common/BUILD b/core/common/BUILD
new file mode 100644
index 0000000..7e4e557
--- /dev/null
+++ b/core/common/BUILD
@@ -0,0 +1,11 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON + METRICS + [
+    '//incubator/api:onos-incubator-api',
+]
+
+TEST_DEPS = TEST + ['//core/api:onos-api-tests']
+
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
+    visibility = ["//visibility:public"],
+)
diff --git a/core/store/dist/BUILD b/core/store/dist/BUILD
new file mode 100644
index 0000000..0608650
--- /dev/null
+++ b/core/store/dist/BUILD
@@ -0,0 +1,28 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + JACKSON + KRYO + [
+        '//core/common:onos-core-common',
+        '//utils/rest:onlab-rest',
+        '//core/store/serializers:onos-core-serializers',
+        '@netty_transport//jar',
+        '@netty_codec//jar',
+        '@netty_handler//jar',
+        '@netty_transport_native_epoll//jar',
+        '@netty_resolver//jar',
+        '@commons_math3//jar',
+        '//incubator/api:onos-incubator-api',
+]
+
+TEST_DEPS = TEST + [
+    '//core/api:onos-api-tests',
+    '//core/common:onos-core-common-tests',
+]
+
+osgi_jar_with_tests (
+    name = 'onos-core-dist',
+    deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
+    exclude_tests = [
+        'org.onosproject.store.link.impl.ECLinkStoreTest',
+        'org.onosproject.store.flow.impl.DistributedFlowRuleStoreTest',
+    ],
+    visibility = ["//visibility:public"],
+)
diff --git a/core/store/dist/src/main/java/org/onosproject/store/cluster/messaging/impl/MessageDecoder.java b/core/store/dist/src/main/java/org/onosproject/store/cluster/messaging/impl/MessageDecoder.java
index bdf5cdf..4b9ef6c 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/cluster/messaging/impl/MessageDecoder.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/cluster/messaging/impl/MessageDecoder.java
@@ -69,32 +69,41 @@
             case READ_SENDER_IP_VERSION:
                 ipVersion = buffer.readByte() == 0x0 ? Version.INET : Version.INET6;
                 checkpoint(DecoderState.READ_SENDER_IP);
+                // FALLTHROUGH
             case READ_SENDER_IP:
                 byte[] octets = new byte[IpAddress.byteLength(ipVersion)];
                 buffer.readBytes(octets);
                 senderIp = IpAddress.valueOf(ipVersion, octets);
                 checkpoint(DecoderState.READ_SENDER_PORT);
+                // FALLTHROUGH
             case READ_SENDER_PORT:
                 senderPort = buffer.readInt();
                 checkpoint(DecoderState.READ_TYPE);
+                // FALLTHROUGH
             case READ_TYPE:
                 type = InternalMessage.Type.forId(buffer.readByte());
                 checkpoint(DecoderState.READ_PREAMBLE);
+                // FALLTHROUGH
             case READ_PREAMBLE:
                 preamble = buffer.readInt();
                 checkpoint(DecoderState.READ_LOGICAL_TIME);
+                // FALLTHROUGH
             case READ_LOGICAL_TIME:
                 logicalTime = buffer.readLong();
                 checkpoint(DecoderState.READ_LOGICAL_COUNTER);
+                // FALLTHROUGH
             case READ_LOGICAL_COUNTER:
                 logicalCounter = buffer.readLong();
                 checkpoint(DecoderState.READ_MESSAGE_ID);
+                // FALLTHROUGH
             case READ_MESSAGE_ID:
                 messageId = buffer.readLong();
                 checkpoint(DecoderState.READ_CONTENT_LENGTH);
+                // FALLTHROUGH
             case READ_CONTENT_LENGTH:
                 contentLength = buffer.readInt();
                 checkpoint(DecoderState.READ_CONTENT);
+                // FALLTHROUGH
             case READ_CONTENT:
                 if (contentLength > 0) {
                     //TODO Perform a sanity check on the size before allocating
@@ -125,6 +134,7 @@
                     case READ_SUBJECT_LENGTH:
                         subjectLength = buffer.readShort();
                         checkpoint(DecoderState.READ_SUBJECT);
+                        // FALLTHROUGH
                     case READ_SUBJECT:
                         byte[] messageTypeBytes = new byte[subjectLength];
                         buffer.readBytes(messageTypeBytes);
diff --git a/core/store/serializers/BUILD b/core/store/serializers/BUILD
new file mode 100644
index 0000000..83c05e3
--- /dev/null
+++ b/core/store/serializers/BUILD
@@ -0,0 +1,12 @@
+COMPILE_DEPS = CORE_DEPS + KRYO + [
+    '//incubator/api:onos-incubator-api',
+]
+
+TEST_DEPS = TEST
+
+osgi_jar_with_tests (
+    name = 'onos-core-serializers',
+    deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
+    visibility = ["//visibility:public"],
+)
diff --git a/drivers/default/BUILD b/drivers/default/BUILD
new file mode 100644
index 0000000..faf4933
--- /dev/null
+++ b/drivers/default/BUILD
@@ -0,0 +1,17 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON + KRYO + [
+    '@openflowj//jar',
+    '//protocols/openflow/api:onos-protocols-openflow-api',
+    '//core/store/serializers:onos-core-serializers',
+]
+
+TEST_DEPS = TEST_ADAPTERS + [
+    '//core/api:onos-api-tests',
+]
+
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
+    #resources_root = 'src/main/resources',
+    resources = glob(['src/main/resources/**']),
+    visibility = ["//visibility:public"],
+)
diff --git a/incubator/api/BUILD b/incubator/api/BUILD
new file mode 100644
index 0000000..c0beb98
--- /dev/null
+++ b/incubator/api/BUILD
@@ -0,0 +1,9 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON
+
+TEST_DEPS = TEST_ADAPTERS
+
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
+    visibility = ["//visibility:public"],
+)
diff --git a/incubator/net/BUILD b/incubator/net/BUILD
new file mode 100644
index 0000000..d6ed989
--- /dev/null
+++ b/incubator/net/BUILD
@@ -0,0 +1,18 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON + METRICS + KRYO + [
+    '//incubator/store:onos-incubator-store',
+    '//incubator/api:onos-incubator-api',
+    '//core/common:onos-core-common',
+]
+
+TEST_DEPS = TEST_REST + [
+    '//incubator/api:onos-incubator-api-tests',
+]
+
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
+    exclude_tests = [
+        'org.onosproject.incubator.net.virtual.impl.VirtualNetworkIntentManagerTest',
+    ],
+    visibility = ["//visibility:public"],
+)
diff --git a/incubator/store/BUILD b/incubator/store/BUILD
new file mode 100644
index 0000000..37ce25a
--- /dev/null
+++ b/incubator/store/BUILD
@@ -0,0 +1,15 @@
+COMPILE_DEPS = CORE_DEPS + KRYO + [
+    '//core/common:onos-core-common',
+    '//utils/rest:onlab-rest',
+    '//core/store/serializers:onos-core-serializers',
+    '@concurrent_trees//jar',
+    '//incubator/api:onos-incubator-api',
+]
+
+TEST_DEPS = TEST_ADAPTERS
+
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
+    visibility = ["//visibility:public"],
+)
diff --git a/lib/BUCK b/lib/BUCK
index 07fa1de..409182c 100644
--- a/lib/BUCK
+++ b/lib/BUCK
@@ -1,4 +1,4 @@
-# ***** This file was auto-generated at Fri, 18 May 2018 23:14:52 GMT. Do not edit this file manually. *****
+# ***** This file was auto-generated at Tue, 22 May 2018 17:57:55 GMT. Do not edit this file manually. *****
 # ***** Use onos-lib-gen *****
 
 pass_thru_pom(
diff --git a/protocols/openflow/api/BUILD b/protocols/openflow/api/BUILD
new file mode 100644
index 0000000..35abad3
--- /dev/null
+++ b/protocols/openflow/api/BUILD
@@ -0,0 +1,17 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + [
+    '//incubator/store:onos-incubator-store',
+    '//incubator/api:onos-incubator-api',
+    '//core/common:onos-core-common',
+    '@openflowj//jar',
+    '@netty_transport//jar',
+]
+
+TEST_DEPS = TEST + [
+    '//core/api:onos-api-tests',
+]
+
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
+    visibility = ["//visibility:public"],
+)
diff --git a/protocols/p4runtime/api/BUILD b/protocols/p4runtime/api/BUILD
new file mode 100644
index 0000000..2936d86
--- /dev/null
+++ b/protocols/p4runtime/api/BUILD
@@ -0,0 +1,14 @@
+GRPC_VER = '1.3.1'
+
+COMPILE_DEPS = CORE_DEPS + [
+#    '@grpc//jar',
+]
+
+TEST_DEPS = TEST + [
+    '//core/api:onos-api-tests',
+]
+
+#osgi_jar_with_tests (
+#    deps = COMPILE_DEPS,
+#    test_deps = TEST_DEPS,
+#)
diff --git a/protocols/p4runtime/model/BUILD b/protocols/p4runtime/model/BUILD
new file mode 100644
index 0000000..490ea94
--- /dev/null
+++ b/protocols/p4runtime/model/BUILD
@@ -0,0 +1,10 @@
+PROTOBUF_VER = '3_2_0'
+
+COMPILE_DEPS = CORE_DEPS + [
+    #'//protocols/p4runtime/proto:onos-protocols-p4runtime-proto',
+    #'@grpc_protobuf_' + PROTOBUF_VER + "//jar",
+]
+
+#osgi_jar_with_tests (
+#    deps = COMPILE_DEPS,
+#)
diff --git a/tools/build/bazel/BUILD b/tools/build/bazel/BUILD
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tools/build/bazel/BUILD
@@ -0,0 +1 @@
+
diff --git a/tools/build/bazel/generate_test_rules.bzl b/tools/build/bazel/generate_test_rules.bzl
new file mode 100644
index 0000000..c8c3976
--- /dev/null
+++ b/tools/build/bazel/generate_test_rules.bzl
@@ -0,0 +1,113 @@
+# -*- mode:python; -*-
+#
+# Copyright 2016 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Generate java test rules from given test_files.
+Instead of having to create one test rule per test in the BUILD file, this rule
+provides a handy way to create a bunch of test rules for the specified test
+files.
+"""
+
+def testIsExcluded(exclude_tests, test):
+  for excluded_test in exclude_tests:
+    normalized_excluded_test = excluded_test.replace('.', '/')
+    if test.endswith(normalized_excluded_test):
+      return True;
+  return False
+
+def generate_test_rules(name,
+                 test_files,
+                 deps,
+                 exclude_tests=[],
+                 default_test_size="small",
+                 small_tests=[],
+                 medium_tests=[],
+                 large_tests=[],
+                 enormous_tests=[],
+                 resources=[],
+                 flaky_tests=[],
+                 tags=[],
+                 prefix="",
+                 jvm_flags=["-XX:MaxPermSize=128m"],
+                 args=[],
+                 visibility=None,
+                 shard_count=1):
+  for test in _get_test_names(test_files):
+    if testIsExcluded(exclude_tests, test):
+      continue
+    test_size = default_test_size
+    if test in small_tests:
+      test_size = "small"
+    if test in medium_tests:
+      test_size = "medium"
+    if test in large_tests:
+      test_size = "large"
+    if test in enormous_tests:
+      test_size = "enormous"
+    flaky = 0
+    if (test in flaky_tests) or ("flaky" in tags):
+      flaky = 1
+    java_class = _package_from_path(
+        PACKAGE_NAME + "/" + _strip_right(test, ".java"))
+    package = java_class[:java_class.rfind(".")]
+    native.java_test(name = prefix + test,
+                     runtime_deps = deps,
+                     resources = resources,
+                     size = test_size,
+                     jvm_flags = jvm_flags,
+                     args = args,
+                     flaky = flaky,
+                     tags = tags,
+                     test_class = java_class,
+                     visibility = visibility,
+                     shard_count = shard_count)
+
+
+def _get_test_names(test_files):
+  test_names = []
+  for test_file in test_files:
+    if not test_file.endswith("Test.java"):
+      continue
+    test_names += [test_file[:-5]]
+  return test_names
+
+
+def _package_from_path(package_path, src_impls=None):
+  src_impls = src_impls or ['javatests/', 'java/']
+  for src_impl in src_impls:
+    if not src_impl.endswith('/'):
+      src_impl += '/'
+    index = _index_of_end(package_path, src_impl)
+    if index >= 0:
+      package_path = package_path[index:]
+      break
+  return package_path.replace('/', '.')
+
+
+def _strip_right(str, suffix):
+  """Returns str without the suffix if it ends with suffix."""
+  if str.endswith(suffix):
+    return str[0: len(str) - len(suffix)]
+  else:
+    return str
+
+
+def _index_of_end(str, part):
+  """If part is in str, return the index of the first character after part.
+  Return -1 if part is not in str."""
+  index = str.find(part)
+  if index >= 0:
+    return index + len(part)
+  return -1
diff --git a/tools/build/bazel/generate_workspace.bzl b/tools/build/bazel/generate_workspace.bzl
new file mode 100644
index 0000000..8dfa931
--- /dev/null
+++ b/tools/build/bazel/generate_workspace.bzl
@@ -0,0 +1,2104 @@
+# ***** This file was auto-generated at Tue, 22 May 2018 18:04:59 GMT. Do not edit this file manually. *****
+# ***** Use onos-lib-gen *****
+COMPILE = [
+    '@commons_configuration//jar',
+    '@commons_logging//jar',
+    '@commons_collections//jar',
+    '@commons_lang//jar',
+    '@commons_lang3//jar',
+    '@commons_io//jar',
+    '@commons_pool//jar',
+    '@guava//jar',
+    '@slf4j_api//jar',
+    '@osgi_core//jar',
+    '@org_osgi_compendium//jar',
+    '@org_apache_felix_scr_annotations//jar',
+    '@org_apache_felix_scr//jar',
+    '@org_apache_karaf_features_core//jar',
+    '@org_apache_karaf_system_core//jar',
+    '@jsr305//jar',
+    '@org_apache_servicemix_bundles_dom4j//jar',
+]
+CORE_DEPS = [] + COMPILE + [
+    '//core/api:onos-api',
+    '//utils/misc:onlab-misc',
+    '//utils/osgi:onlab-osgi',
+]
+TEST = [
+    '@junit//jar',
+    '@easymock//jar',
+    '@hamcrest_all//jar',
+    '@hamcrest_optional//jar',
+    '@guava_testlib//jar',
+    '//utils/junit:onlab-junit',
+]
+TEST_ADAPTERS = [] + TEST + [
+    '//core/common:onos-core-common',
+    '//core/api:onos-api-tests',
+    '//core/common:onos-core-common-tests',
+]
+TEST_REST = [] + TEST_ADAPTERS + [
+    '@jersey_client//jar',
+    '@jersey_server//jar',
+    '@jersey_common//jar',
+    '@jersey_hk2//jar',
+    '@jersey_test_framework_core//jar',
+    '@jersey_test_framework_jetty//jar',
+    '@jersey_container_jetty_http//jar',
+    '@jetty_continuation//jar',
+    '@jetty_http//jar',
+    '@jetty_server//jar',
+    '@jetty_io//jar',
+    '@jetty_util//jar',
+    '@javax_servlet_api//jar',
+    '@hk2_api//jar',
+    '@hk2_locator//jar',
+    '@hk2_utils//jar',
+    '@javax_inject//jar',
+    '@hk2_osgi_resource_locator//jar',
+    '@javax_annotation_api//jar',
+    '@validation_api//jar',
+    '//core/common:onos-core-common',
+    '//core/api:onos-api-tests',
+    '//core/common:onos-core-common-tests',
+    '//utils/osgi:onlab-osgi-tests',
+]
+NETTY = [
+    '@netty_buffer//jar',
+    '@netty_common//jar',
+]
+GRPC_1_3 = [
+    '@grpc_protobuf_1_3_1//jar',
+    '@grpc_stub_1_3_1//jar',
+    '@grpc_netty_1_3_1//jar',
+    '@grpc_auth_1_3_1//jar',
+    '@grpc_context_1_3_1//jar',
+    '@google_truth_0_28//jar',
+]
+GRPC_TEST_1_3 = [
+    '@grpc_testing_1_3_1//jar',
+    '@grpc_testing_proto_1_3_1//jar',
+    '@google_code_findbugs_3_0_0//jar',
+    '@google_errorprone_2_0_19//jar',
+    '@google_instrumentation_0_3_0//jar',
+    '@junit_dep//jar',
+    '@objenesis//jar',
+]
+ONOS_YANG = [
+    '@onos_yang_model//jar',
+    '@onos_yang_compiler_api//jar',
+    '@onos_yang_serializers_json//jar',
+    '@onos_yang_serializers_xml//jar',
+    '@onos_yang_serializers_utils//jar',
+]
+JACKSON = [
+    '@jackson_annotations//jar',
+    '@jackson_core//jar',
+    '@jackson_databind//jar',
+]
+METRICS = [
+    '@metrics_core//jar',
+    '@metrics_json//jar',
+]
+KRYO = [
+    '@kryo//jar',
+    '@reflectasm//jar',
+    '@asm//jar',
+    '@minlog//jar',
+    '@objenesis//jar',
+]
+def generated_maven_jars():
+  native.maven_jar (
+    name = 'aopalliance_repackaged',
+    artifact = 'org.glassfish.hk2.external:aopalliance-repackaged:2.5.0-b42',
+    sha1 = 'e74beab6ca12e9e745eb47ca61729d9452b96f0c',
+  )
+
+  native.maven_jar (
+    name = 'amqp_client',
+    artifact = 'com.rabbitmq:amqp-client:3.6.1',
+    sha1 = '089be4acfa8a0fa48a775a82d20632f90aecf10b',
+  )
+
+  native.maven_jar (
+    name = 'asm',
+    artifact = 'org.ow2.asm:asm:5.0.4',
+    sha1 = '0da08b8cce7bbf903602a25a3a163ae252435795',
+  )
+
+  native.maven_jar (
+    name = 'atomix',
+    artifact = 'io.atomix:atomix:2.0.20',
+    sha1 = '7039de42423b8cd80d6a99208d61f7ee7ec52e50',
+  )
+
+  native.maven_jar (
+    name = 'commons_codec',
+    artifact = 'commons-codec:commons-codec:1.10',
+    sha1 = '4b95f4897fa13f2cd904aee711aeafc0c5295cd8',
+  )
+
+  native.maven_jar (
+    name = 'commons_collections',
+    artifact = 'commons-collections:commons-collections:3.2.2',
+    sha1 = '8ad72fe39fa8c91eaaf12aadb21e0c3661fe26d5',
+  )
+
+  native.maven_jar (
+    name = 'commons_configuration',
+    artifact = 'commons-configuration:commons-configuration:1.10',
+    sha1 = '2b36e4adfb66d966c5aef2d73deb6be716389dc9',
+  )
+
+  native.maven_jar (
+    name = 'commons_io',
+    artifact = 'commons-io:commons-io:2.6',
+    sha1 = '815893df5f31da2ece4040fe0a12fd44b577afaf',
+  )
+
+  native.maven_jar (
+    name = 'commons_jxpath',
+    artifact = 'commons-jxpath:commons-jxpath:1.3',
+    sha1 = 'c22d7d0f0f40eb7059a23cfa61773a416768b137',
+  )
+
+  native.maven_jar (
+    name = 'commons_beanutils',
+    artifact = 'commons-beanutils:commons-beanutils:1.9.2',
+    sha1 = '7a87d845ad3a155297e8f67d9008f4c1e5656b71',
+  )
+
+  native.maven_jar (
+    name = 'jdom',
+    artifact = 'jdom:jdom:1.0',
+    sha1 = 'a2ac1cd690ab4c80defe7f9bce14d35934c35cec',
+  )
+
+  native.maven_jar (
+    name = 'commons_lang',
+    artifact = 'commons-lang:commons-lang:2.6',
+    sha1 = '0ce1edb914c94ebc388f086c6827e8bdeec71ac2',
+  )
+
+  native.maven_jar (
+    name = 'commons_lang3',
+    artifact = 'org.apache.commons:commons-lang3:3.6',
+    sha1 = '9d28a6b23650e8a7e9063c04588ace6cf7012c17',
+  )
+
+  native.maven_jar (
+    name = 'commons_logging',
+    artifact = 'commons-logging:commons-logging:1.2',
+    sha1 = '4bfc12adfe4842bf07b657f0369c4cb522955686',
+  )
+
+  native.maven_jar (
+    name = 'commons_math3',
+    artifact = 'org.apache.commons:commons-math3:3.6.1',
+    sha1 = 'e4ba98f1d4b3c80ec46392f25e094a6a2e58fcbf',
+  )
+
+  native.maven_jar (
+    name = 'commons_pool',
+    artifact = 'commons-pool:commons-pool:1.6',
+    sha1 = '4572d589699f09d866a226a14b7f4323c6d8f040',
+  )
+
+  native.maven_jar (
+    name = 'commons_text',
+    artifact = 'org.apache.commons:commons-text:1.2',
+    sha1 = '74acdec7237f576c4803fff0c1008ab8a3808b2b',
+  )
+
+  native.maven_jar (
+    name = 'concurrent_trees',
+    artifact = 'com.googlecode.concurrent-trees:concurrent-trees:2.6.1',
+    sha1 = '9b647240522ab67c003de9b6702ca81ac0c15efc',
+  )
+
+  native.maven_jar (
+    name = 'easymock',
+    artifact = 'org.easymock:easymock:3.4',
+    sha1 = '9fdeea183a399f25c2469497612cad131e920fa3',
+  )
+
+  native.maven_jar (
+    name = 'antlr',
+    artifact = 'antlr:antlr:2.7.7',
+    sha1 = '83cd2cd674a217ade95a4bb83a8a14f351f48bd0',
+  )
+
+  native.maven_jar (
+    name = 'error_prone_annotations',
+    artifact = 'com.google.errorprone:error_prone_annotations:2.0.11',
+    sha1 = '3624d81fca4e93c67f43bafc222b06e1b1e3b260',
+  )
+
+  native.maven_jar (
+    name = 'ganymed_ssh2',
+    artifact = 'ch.ethz.ganymed:ganymed-ssh2:262',
+    sha1 = '7761dc665d0f6993dc846d914214fb93291e2bdf',
+  )
+
+  native.maven_jar (
+    name = 'gmetric4j',
+    artifact = 'info.ganglia.gmetric4j:gmetric4j:1.0.10',
+    sha1 = '3d62003123b586adb86cb028cc0f8a8c3a701d81',
+  )
+
+  native.maven_jar (
+    name = 'gson',
+    artifact = 'com.google.code.gson:gson:2.7',
+    sha1 = '751f548c85fa49f330cecbb1875893f971b33c4e',
+  )
+
+  native.maven_jar (
+    name = 'guava',
+    artifact = 'com.google.guava:guava:22.0',
+    sha1 = '3564ef3803de51fb0530a8377ec6100b33b0d073',
+  )
+
+  native.maven_jar (
+    name = 'guava_testlib',
+    artifact = 'com.google.guava:guava-testlib:22.0',
+    sha1 = '3be1b88f1cfc6592acbcbfe1f3a420f79eb2b146',
+  )
+
+  native.maven_jar (
+    name = 'hamcrest_all',
+    artifact = 'org.hamcrest:hamcrest-all:1.3',
+    sha1 = '63a21ebc981131004ad02e0434e799fd7f3a8d5a',
+  )
+
+  native.maven_jar (
+    name = 'hk2_api',
+    artifact = 'org.glassfish.hk2:hk2-api:2.5.0-b42',
+    sha1 = '7fd4e3d0f2cb37c80ad0dedee3f5ee69503eaf52',
+  )
+
+  native.maven_jar (
+    name = 'hk2_locator',
+    artifact = 'org.glassfish.hk2:hk2-locator:2.5.0-b42',
+    sha1 = '9d6edc0cb226401a8316e67d81bfc37cb626ef91',
+  )
+
+  native.maven_jar (
+    name = 'hk2_osgi_resource_locator',
+    artifact = 'org.glassfish.hk2:osgi-resource-locator:1.0.1',
+    sha1 = '4ed2b2d4738aed5786cfa64cba5a332779c4c708',
+  )
+
+  native.maven_jar (
+    name = 'hk2_utils',
+    artifact = 'org.glassfish.hk2:hk2-utils:2.5.0-b42',
+    sha1 = '102a344e1728825e865a8986d7605602aba3c3b6',
+  )
+
+  native.maven_jar (
+    name = 'httpclient_osgi',
+    artifact = 'org.apache.httpcomponents:httpclient-osgi:4.5.1',
+    sha1 = '0220a68ff36e5b0fa71b5dc0b1dc1d4ad2dcf524',
+  )
+
+  native.maven_jar (
+    name = 'httpcore_osgi',
+    artifact = 'org.apache.httpcomponents:httpcore-osgi:4.4.4',
+    sha1 = 'd5c14055e569afca96f4603d6f9d467bc72ccba8',
+  )
+
+  native.maven_jar (
+    name = 'influxdb_java',
+    artifact = 'org.influxdb:influxdb-java:2.9',
+    sha1 = '3c1c2b9b977d4ee67b2877eb89943add248a50db',
+  )
+
+  native.maven_jar (
+    name = 'retrofit',
+    artifact = 'com.squareup.retrofit2:retrofit:2.3.0',
+    sha1 = 'bcacde6a8ccedcc56c127403d26b76072fe6214d',
+  )
+
+  native.maven_jar (
+    name = 'converter_moshi',
+    artifact = 'com.squareup.retrofit2:converter-moshi:2.3.0',
+    sha1 = '6ad87c2038269d2574fcd90765ce15c74d6bb993',
+  )
+
+  native.maven_jar (
+    name = 'okhttp',
+    artifact = 'com.squareup.okhttp3:okhttp:3.9.1',
+    sha1 = '84b4b7d1c4a238e7899972b7446c250691e65f1f',
+  )
+
+  native.maven_jar (
+    name = 'logging_interceptor',
+    artifact = 'com.squareup.okhttp3:logging-interceptor:3.9.1',
+    sha1 = '36e71ab9e903fc4d1b4a58d80572a91d9fd60caf',
+  )
+
+  native.maven_jar (
+    name = 'moshi',
+    artifact = 'com.squareup.moshi:moshi:1.4.0',
+    sha1 = 'd67ad038adfd55dc276488a54f4944dfae5ff8ec',
+  )
+
+  native.maven_jar (
+    name = 'okio',
+    artifact = 'com.squareup.okio:okio:1.11.0',
+    sha1 = '840897fcd7223a8143f1d9b6f69714e7be34fd50',
+  )
+
+  native.maven_jar (
+    name = 'jackson_annotations',
+    artifact = 'com.fasterxml.jackson.core:jackson-annotations:2.9.5',
+    sha1 = '9056ec9db21c57d43219a84bb18c129ae51c6a5d',
+  )
+
+  native.maven_jar (
+    name = 'jackson_core',
+    artifact = 'com.fasterxml.jackson.core:jackson-core:2.9.5',
+    sha1 = 'a22ac51016944b06fd9ffbc9541c6e7ce5eea117',
+  )
+
+  native.maven_jar (
+    name = 'jackson_databind',
+    artifact = 'com.fasterxml.jackson.core:jackson-databind:2.9.5',
+    sha1 = '3490508379d065fe3fcb80042b62f630f7588606',
+  )
+
+  native.maven_jar (
+    name = 'javax_annotation_api',
+    artifact = 'javax.annotation:javax.annotation-api:1.2',
+    sha1 = '479c1e06db31c432330183f5cae684163f186146',
+  )
+
+  native.maven_jar (
+    name = 'javax_inject',
+    artifact = 'org.glassfish.hk2.external:javax.inject:2.5.0-b42',
+    sha1 = '98e0b7dcef77dc04809f0603868140a1c60bea71',
+  )
+
+  native.maven_jar (
+    name = 'javax_ws_rs_api',
+    artifact = 'javax.ws.rs:javax.ws.rs-api:2.1',
+    sha1 = '426a0862406536e690c7caa8bb6ed32191986fac',
+  )
+
+  native.maven_jar (
+    name = 'jersey_client',
+    artifact = 'org.glassfish.jersey.core:jersey-client:2.26',
+    sha1 = '125b8d1040d121a5dc4ce6858e21a6160bed7afa',
+  )
+
+  native.maven_jar (
+    name = 'jersey_security',
+    artifact = 'org.glassfish.jersey.security:oauth2-client:2.26',
+    sha1 = '968e1d99c9460e29bdb447114fa8440c3dbafb14',
+  )
+
+  native.maven_jar (
+    name = 'jersey_common',
+    artifact = 'org.glassfish.jersey.core:jersey-common:2.26',
+    sha1 = 'd96475745c5e72cafcbc4dc9e2e725f4d9683f21',
+  )
+
+  native.maven_jar (
+    name = 'jersey_container_jetty_http',
+    artifact = 'org.glassfish.jersey.containers:jersey-container-jetty-http:2.26',
+    sha1 = 'c20d58ceb1a5d98aad2b2032ca200403622fe9d6',
+  )
+
+  native.maven_jar (
+    name = 'jersey_container_servlet',
+    artifact = 'org.glassfish.jersey.containers:jersey-container-servlet:2.26',
+    sha1 = '8723d05d1fe2fdda54d0921836ea5daa5abe5f00',
+  )
+
+  native.maven_jar (
+    name = 'jersey_container_servlet_core',
+    artifact = 'org.glassfish.jersey.containers:jersey-container-servlet-core:2.26',
+    sha1 = '66a0d51facf1e49e2353ff0d2a2d4a9e2fa3f836',
+  )
+
+  native.maven_jar (
+    name = 'jersey_media_multipart',
+    artifact = 'org.glassfish.jersey.media:jersey-media-multipart:2.26',
+    sha1 = 'c7ea0a5819e4688317024c9f4b6e3de54f9d0f3d',
+  )
+
+  native.maven_jar (
+    name = 'jersey_server',
+    artifact = 'org.glassfish.jersey.core:jersey-server:2.26',
+    sha1 = 'aa8eff3d591641dadd7c9880bb73b59bf46d4c82',
+  )
+
+  native.maven_jar (
+    name = 'jersey_hk2',
+    artifact = 'org.glassfish.jersey.inject:jersey-hk2:2.26',
+    sha1 = 'df27f7d7577acf4b532684448021632098924dab',
+  )
+
+  native.maven_jar (
+    name = 'jersey_test_framework_core',
+    artifact = 'org.glassfish.jersey.test-framework:jersey-test-framework-core:2.26',
+    sha1 = '92698666ae89db58074001a34f09b8233ef5effa',
+  )
+
+  native.maven_jar (
+    name = 'jersey_test_framework_jetty',
+    artifact = 'org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-jetty:2.26',
+    sha1 = '6be06684283e7c90036d9e24f7793fd8bbb04f6a',
+  )
+
+  native.maven_jar (
+    name = 'jetty_util',
+    artifact = 'org.eclipse.jetty:jetty-util:9.2.21.v20170120',
+    sha1 = '58d9c3a134dc6d6d84b555758015ab3585b88464',
+  )
+
+  native.maven_jar (
+    name = 'jetty_websocket',
+    artifact = 'org.eclipse.jetty:jetty-websocket:8.1.19.v20160209',
+    sha1 = 'a423ddda13e52a65d604320472af598ca7122a60',
+  )
+
+  native.maven_jar (
+    name = 'jetty_server',
+    artifact = 'org.eclipse.jetty:jetty-server:9.2.21.v20170120',
+    sha1 = 'bdf6a2d58f878652e4b8c3af913e9c56b995e87d',
+  )
+
+  native.maven_jar (
+    name = 'jetty_continuation',
+    artifact = 'org.eclipse.jetty:jetty-continuation:9.2.21.v20170120',
+    sha1 = '38c35ef850d508aa0fae450eee72d784a5dd2d06',
+  )
+
+  native.maven_jar (
+    name = 'jetty_http',
+    artifact = 'org.eclipse.jetty:jetty-http:9.2.21.v20170120',
+    sha1 = '24c5a91c48cfd73b863962ec36ba4dc2bb6552ea',
+  )
+
+  native.maven_jar (
+    name = 'jetty_io',
+    artifact = 'org.eclipse.jetty:jetty-io:9.2.21.v20170120',
+    sha1 = 'a25222b557823b59a7b6d121f951926be20cff85',
+  )
+
+  native.maven_jar (
+    name = 'javax_servlet_api',
+    artifact = 'javax.servlet:javax.servlet-api:3.1.0',
+    sha1 = '3cd63d075497751784b2fa84be59432f4905bf7c',
+  )
+
+  native.maven_jar (
+    name = 'joda_time',
+    artifact = 'joda-time:joda-time:2.9.3',
+    sha1 = '9e46be514a4ed60bcfbaaba88a3c668cf30476ab',
+  )
+
+  native.maven_jar (
+    name = 'jsch',
+    artifact = 'com.jcraft:jsch:0.1.53',
+    sha1 = '658b682d5c817b27ae795637dfec047c63d29935',
+  )
+
+  native.maven_jar (
+    name = 'jsr305',
+    artifact = 'com.google.code.findbugs:jsr305:3.0.1',
+    sha1 = 'f7be08ec23c21485b9b5a1cf1654c2ec8c58168d',
+  )
+
+  native.maven_jar (
+    name = 'junit',
+    artifact = 'junit:junit:4.12',
+    sha1 = '2973d150c0dc1fefe998f834810d68f278ea58ec',
+  )
+
+  native.maven_jar (
+    name = 'junit_dep',
+    artifact = 'junit:junit:4.10',
+    sha1 = 'e4f1766ce7404a08f45d859fb9c226fc9e41a861',
+  )
+
+  native.maven_jar (
+    name = 'kryo',
+    artifact = 'com.esotericsoftware:kryo:4.0.1',
+    sha1 = '5053899c213a6ce50a800d4902c5a9de49fe0098',
+  )
+
+  native.maven_jar (
+    name = 'mapdb',
+    artifact = 'org.mapdb:mapdb:1.0.9',
+    sha1 = 'f8df5e15778eb3e88c03b77aca70c318c6b7c9d0',
+  )
+
+  native.maven_jar (
+    name = 'metrics_core',
+    artifact = 'io.dropwizard.metrics:metrics-core:3.2.2',
+    sha1 = 'cd9886f498ee2ab2d994f0c779e5553b2c450416',
+  )
+
+  native.maven_jar (
+    name = 'metrics_ganglia',
+    artifact = 'io.dropwizard.metrics:metrics-ganglia:3.2.2',
+    sha1 = 'd5bb1883e9b0daf0e4187e558746f5058f4585c1',
+  )
+
+  native.maven_jar (
+    name = 'metrics_graphite',
+    artifact = 'io.dropwizard.metrics:metrics-graphite:3.2.2',
+    sha1 = '908e8cbec1bbdb2f4023334e424c7de2832a95af',
+  )
+
+  native.maven_jar (
+    name = 'metrics_influxdb',
+    artifact = 'com.izettle:metrics-influxdb:1.1.1',
+    sha1 = 'a911d778c2f8607dd4e7a4cdb9b0cd97adcd0343',
+  )
+
+  native.maven_jar (
+    name = 'metrics_json',
+    artifact = 'io.dropwizard.metrics:metrics-json:3.2.2',
+    sha1 = '234612b9739a651eb2b71a8f9e9c4d11d7ccf849',
+  )
+
+  native.maven_jar (
+    name = 'minimal_json',
+    artifact = 'com.eclipsesource.minimal-json:minimal-json:0.9.4',
+    sha1 = 'd6e7dd22569de97c2697a4af301a623f35028972',
+  )
+
+  native.maven_jar (
+    name = 'minlog',
+    artifact = 'com.esotericsoftware:minlog:1.3.0',
+    sha1 = 'ff07b5f1b01d2f92bb00a337f9a94873712f0827',
+  )
+
+  native.maven_jar (
+    name = 'netty',
+    artifact = 'io.netty:netty:3.10.5.Final',
+    sha1 = '9ca7d55d246092bddd29b867706e2f6c7db701a0',
+  )
+
+  native.maven_jar (
+    name = 'netty_buffer',
+    artifact = 'io.netty:netty-buffer:4.1.8.Final',
+    sha1 = '43292c2622e340a0d07178c341ca3bdf3d662034',
+  )
+
+  native.maven_jar (
+    name = 'netty_codec',
+    artifact = 'io.netty:netty-codec:4.1.8.Final',
+    sha1 = '1bd0a2d032e5c7fc3f42c1b483d0f4c57eb516a3',
+  )
+
+  native.maven_jar (
+    name = 'netty_common',
+    artifact = 'io.netty:netty-common:4.1.8.Final',
+    sha1 = 'ee62c80318413d2375d145e51e48d7d35c901324',
+  )
+
+  native.maven_jar (
+    name = 'netty_handler',
+    artifact = 'io.netty:netty-handler:4.1.8.Final',
+    sha1 = 'db01139bfb11afd009a695eef55b43bbf22c4ef5',
+  )
+
+  native.maven_jar (
+    name = 'netty_transport',
+    artifact = 'io.netty:netty-transport:4.1.8.Final',
+    sha1 = '905b5dadce881c9824b3039c0df36dabbb7b6a07',
+  )
+
+  native.maven_jar (
+    name = 'netty_transport_native_epoll',
+    artifact = 'io.netty:netty-transport-native-epoll:4.1.8.Final',
+    sha1 = 'de9052874d9ff9b411bfc465869f620cab643d8d',
+  )
+
+  native.maven_jar (
+    name = 'netty_resolver',
+    artifact = 'io.netty:netty-resolver:4.1.8.Final',
+    sha1 = '2e116cdd5edc01b2305072b1dbbd17c0595dbfef',
+  )
+
+  native.maven_jar (
+    name = 'netty_codec_http2',
+    artifact = 'io.netty:netty-codec-http2:4.1.8.Final',
+    sha1 = '105a99ee5767463370ccc3d2e16800bd99f5648e',
+  )
+
+  native.maven_jar (
+    name = 'netty_codec_http',
+    artifact = 'io.netty:netty-codec-http:4.1.8.Final',
+    sha1 = '1e88617c4a6c88da7e86fdbbd9494d22a250c879',
+  )
+
+  native.maven_jar (
+    name = 'objenesis',
+    artifact = 'org.objenesis:objenesis:2.6',
+    sha1 = '639033469776fd37c08358c6b92a4761feb2af4b',
+  )
+
+  native.maven_jar (
+    name = 'openflowj',
+    artifact = 'org.onosproject:openflowj:3.2.1.onos',
+    sha1 = '66544b285cddc8d53485107310f07b7bc90ac63b',
+  )
+
+  native.maven_jar (
+    name = 'org_apache_felix_framework_security',
+    artifact = 'org.onosproject:org.apache.felix.framework.security:2.2.0.onos',
+    sha1 = '5d39a4ff4a5d3daec8c404789d398c780151de8c',
+  )
+
+  native.maven_jar (
+    name = 'org_apache_felix_scr',
+    artifact = 'org.apache.felix:org.apache.felix.scr:1.8.2',
+    sha1 = 'c3047d56ee57de0752821fd9c3894dda664f2e37',
+  )
+
+  native.maven_jar (
+    name = 'org_apache_felix_scr_annotations',
+    artifact = 'org.apache.felix:org.apache.felix.scr.annotations:1.9.12',
+    sha1 = '5fdc34da641dda8b9165c2be93211479a186da9c',
+  )
+
+  native.maven_jar (
+    name = 'org_apache_karaf_features_core',
+    artifact = 'org.apache.karaf.features:org.apache.karaf.features.core:3.0.8',
+    sha1 = '4a8bf5dbe10e120158cb69295388274f834ae37a',
+  )
+
+  native.maven_jar (
+    name = 'org_apache_karaf_shell_console',
+    artifact = 'org.apache.karaf.shell:org.apache.karaf.shell.console:3.0.8',
+    sha1 = '5bf3e409d2e73bef560face9740b8c1234909b83',
+  )
+
+  native.maven_jar (
+    name = 'org_apache_httpcomponents_httpasyncclient_osgi',
+    artifact = 'org.apache.httpcomponents:httpasyncclient-osgi:4.1.2',
+    sha1 = '17eccd8d9f2803ee95e80ee8283155432600e17b',
+  )
+
+  native.maven_jar (
+    name = 'org_apache_httpcomponents_httpcore_nio',
+    artifact = 'org.apache.httpcomponents:httpcore-nio:4.4.4',
+    sha1 = '16badfc2d99db264c486ba8c57ae577301a58bd9',
+  )
+
+  native.maven_jar (
+    name = 'org_apache_karaf_jaas',
+    artifact = 'org.apache.karaf.jaas:org.apache.karaf.jaas.modules:3.0.8',
+    sha1 = 'e4c97dac488898af1dda2b2cbf5b66318339cd29',
+  )
+
+  native.maven_jar (
+    name = 'org_apache_karaf_system_core',
+    artifact = 'org.apache.karaf.system:org.apache.karaf.system.core:3.0.8',
+    sha1 = '80378de4aeae603889d3408489ff5b9918e6064c',
+  )
+
+  native.maven_jar (
+    name = 'org_apache_servicemix_bundles_snmp4j',
+    artifact = 'org.apache.servicemix.bundles:org.apache.servicemix.bundles.snmp4j:2.3.4_1',
+    sha1 = '5134e0b60a6d88b26fe4dec03488efe4f2463e65',
+  )
+
+  native.maven_jar (
+    name = 'org_osgi_compendium',
+    artifact = 'org.osgi:org.osgi.compendium:5.0.0',
+    sha1 = '9d7a9c35591f6fa1c98ac85af32775c12361aee4',
+  )
+
+  native.maven_jar (
+    name = 'osgi_core',
+    artifact = 'org.osgi:org.osgi.core:5.0.0',
+    sha1 = '6e5e8cd3c9059c08e1085540442a490b59a7783c',
+  )
+
+  native.maven_jar (
+    name = 'reflectasm',
+    artifact = 'com.esotericsoftware:reflectasm:1.11.0',
+    sha1 = 'f747d8b017a26bac575f8da14e8c1df6aecd3154',
+  )
+
+  native.maven_jar (
+    name = 'remotetea_oncrpc',
+    artifact = 'org.acplt.remotetea:remotetea-oncrpc:1.1.3',
+    sha1 = '2f7d94c5179b0267a882259a03a83eaa320cbcce',
+  )
+
+  native.maven_jar (
+    name = 'rrd4j',
+    artifact = 'org.rrd4j:rrd4j:3.1',
+    sha1 = 'e533553fbf52f241dcb0c468b2052a3814dd6722',
+  )
+
+  native.maven_jar (
+    name = 'javassist',
+    artifact = 'org.javassist:javassist:3.22.0-GA',
+    sha1 = '3e83394258ae2089be7219b971ec21a8288528ad',
+  )
+
+  native.maven_jar (
+    name = 'mimepull',
+    artifact = 'org.jvnet.mimepull:mimepull:1.9.6',
+    sha1 = '41c913d791e16f93bc712a8c8a30bb64daa2e9bd',
+  )
+
+  native.maven_jar (
+    name = 'servlet_api',
+    artifact = 'javax.servlet:servlet-api:2.5',
+    sha1 = '5959582d97d8b61f4d154ca9e495aafd16726e34',
+  )
+
+  native.maven_jar (
+    name = 'slf4j_api',
+    artifact = 'org.slf4j:slf4j-api:1.7.25',
+    sha1 = 'da76ca59f6a57ee3102f8f9bd9cee742973efa8a',
+  )
+
+  native.maven_jar (
+    name = 'slf4j_jdk14',
+    artifact = 'org.slf4j:slf4j-jdk14:1.7.25',
+    sha1 = 'bccda40ebc8067491b32a88f49615a747d20082d',
+  )
+
+  native.maven_jar (
+    name = 'typesafe_config',
+    artifact = 'com.typesafe:config:1.2.1',
+    sha1 = 'f771f71fdae3df231bcd54d5ca2d57f0bf93f467',
+  )
+
+  native.maven_jar (
+    name = 'validation_api',
+    artifact = 'javax.validation:validation-api:1.1.0.Final',
+    sha1 = '8613ae82954779d518631e05daa73a6a954817d5',
+  )
+
+  native.maven_jar (
+    name = 'checkstyle',
+    artifact = 'com.puppycrawl.tools:checkstyle:8.10',
+    sha1 = 'd7cd09c4d1240b3acc3041fcb47fd74ae351698b',
+  )
+
+  native.http_jar (
+    name = 'apache_karaf',
+    url = 'mvn:org.onosproject:apache-karaf-offline:tar.gz:3.0.8',
+    sha256 = '2503c5853285e3414da15aef8d8f3f629747c927',
+  )
+
+  native.http_jar (
+    name = 'apache_karaf_patches',
+    url = 'mvn:org.onosproject:onos-apache-karaf-patches:tar.gz:3.0.8',
+    sha256 = 'be5d620a2c4f4c5faa520d2c1b949ad0cc29c84f',
+  )
+
+  native.maven_jar (
+    name = 'bndlib',
+    artifact = 'biz.aQute.bnd:biz.aQute.bndlib:3.1.0',
+    sha1 = '8e45564ca80bf089276a35f916e8702e7b798cbb',
+  )
+
+  native.maven_jar (
+    name = 'bndexe',
+    artifact = 'biz.aQute.bnd:biz.aQute.bnd:3.1.0',
+    sha1 = 'ebd6c2af025b66ea94a9fcb217c2699ba23d3ca2',
+  )
+
+  native.maven_jar (
+    name = 'libthrift',
+    artifact = 'org.apache.thrift:libthrift:0.9.3',
+    sha1 = '8625e8f9b6f49b881fa5fd143172c2833df1ce47',
+  )
+
+  native.maven_jar (
+    name = 'qdox',
+    artifact = 'com.thoughtworks.qdox:qdox:2.0-M3',
+    sha1 = 'f1e9ac82735dc3f2afc38cc051ae0e405f367434',
+  )
+
+  native.maven_jar (
+    name = 'org_apache_felix_scr_bnd',
+    artifact = 'org.onosproject:org.apache.felix.scr.bnd:1.4.1-SNAPSHOT',
+    sha1 = '607cac6eaba5b0eb0787a343b83fe535c42c09aa',
+    repository = 'https://oss.sonatype.org/content/repositories/snapshots/',
+  )
+
+  native.maven_jar (
+    name = 'snmp_core',
+    artifact = 'org.onosproject:snmp-core:1.3-20161021.1',
+    sha1 = '65e1b71d9d0e2fc60c45f631decdb41da3253778',
+  )
+
+  native.maven_jar (
+    name = 'bti7000',
+    artifact = 'org.onosproject:mibbler-mibs-bti7000:1.0-20151221.1',
+    sha1 = 'aebb218bd04e29d8a1ea9036de715919bb7a73e5',
+  )
+
+  native.maven_jar (
+    name = 'mibs_net_snmp',
+    artifact = 'org.onosproject:mibbler-mibs-net-snmp:1.0-20151221.1',
+    sha1 = 'd2cb918e46f06d4ee764d4a96b2b6fb0ba9bc60c',
+  )
+
+  native.maven_jar (
+    name = 'mibs_rfc',
+    artifact = 'org.onosproject:mibbler-mibs-rfc:1.0-20151221.1',
+    sha1 = '06ac2a3bf48c79ab444a9deede9d554ccd355a16',
+  )
+
+  native.maven_jar (
+    name = 'openstack4j_core',
+    artifact = 'org.pacesys:openstack4j-core:3.1.0',
+    sha1 = '634c2ad6728bb6e4cd91c950dd654aacb6f107a6',
+  )
+
+  native.maven_jar (
+    name = 'openstack4j_http_connector',
+    artifact = 'org.pacesys.openstack4j.connectors:openstack4j-http-connector:3.1.0',
+    sha1 = '5bbd558313f13daac819bbbe56ae8432e64409d9',
+  )
+
+  native.maven_jar (
+    name = 'openstack4j_httpclient',
+    artifact = 'org.pacesys.openstack4j.connectors:openstack4j-httpclient:3.1.0',
+    sha1 = 'acb413e27cc43f4bbcee99300befffcf667de579',
+  )
+
+  native.maven_jar (
+    name = 'json_patch',
+    artifact = 'com.github.fge:json-patch:1.9',
+    sha1 = '0a4c3c97a0f5965dec15795acf40d3fbc897af4b',
+  )
+
+  native.maven_jar (
+    name = 'jackson_coreutils',
+    artifact = 'com.github.fge:jackson-coreutils:1.6',
+    sha1 = '9e6af56eb7cc2a65700b289abc7ee2bd170fd231',
+  )
+
+  native.maven_jar (
+    name = 'btf',
+    artifact = 'com.github.fge:btf:1.2',
+    sha1 = '9e66651022eb86301b348d57e6f59459effc343b',
+  )
+
+  native.maven_jar (
+    name = 'msg_simple',
+    artifact = 'com.github.fge:msg-simple:1.1',
+    sha1 = 'f261263e13dd4cfa93cc6b83f1f58f619097a2c4',
+  )
+
+  native.maven_jar (
+    name = 'snakeyaml',
+    artifact = 'org.yaml:snakeyaml:1.15',
+    sha1 = '3b132bea69e8ee099f416044970997bde80f4ea6',
+  )
+
+  native.maven_jar (
+    name = 'onos_yang_model',
+    artifact = 'org.onosproject:onos-yang-model:2.4.7',
+    sha1 = 'c459be8b61650d1e8860b4d13b7ec867a6072b55',
+  )
+
+  native.maven_jar (
+    name = 'onos_yang_compiler_api',
+    artifact = 'org.onosproject:onos-yang-compiler-api:2.4.7',
+    sha1 = 'f087fa5c52b0cb3c56624519f5631b819d59dd28',
+  )
+
+  native.maven_jar (
+    name = 'onos_yang_runtime',
+    artifact = 'org.onosproject:onos-yang-runtime:2.4.7',
+    sha1 = '12e139467380f54891a5cf29f12d717d22e4cb42',
+  )
+
+  native.maven_jar (
+    name = 'onos_yang_serializers_json',
+    artifact = 'org.onosproject:onos-yang-serializers-json:2.4.7',
+    sha1 = '2784dca04f444e218667760b39ca5c74b743f168',
+  )
+
+  native.maven_jar (
+    name = 'onos_yang_serializers_xml',
+    artifact = 'org.onosproject:onos-yang-serializers-xml:2.4.7',
+    sha1 = 'fcf7b98b1bfaaab7d34a2f47eadb0a8c51e34a37',
+  )
+
+  native.maven_jar (
+    name = 'onos_yang_serializers_utils',
+    artifact = 'org.onosproject:onos-yang-serializers-utils:2.4.7',
+    sha1 = '6c6ed696ae7a23b6d0a45138ef6bc07768f4a9b5',
+  )
+
+  native.maven_jar (
+    name = 'org_apache_servicemix_bundles_dom4j',
+    artifact = 'org.apache.servicemix.bundles:org.apache.servicemix.bundles.dom4j:1.6.1_5',
+    sha1 = 'f5da21ae9508008f7b28001983adc143cb310ad7',
+  )
+
+  native.maven_jar (
+    name = 'plexus_utils',
+    artifact = 'org.codehaus.plexus:plexus-utils:3.0.24',
+    sha1 = 'b4ac9780b37cb1b736eae9fbcef27609b7c911ef',
+  )
+
+  native.maven_jar (
+    name = 'sshd_core',
+    artifact = 'org.apache.sshd:sshd-core:1.4.0',
+    sha1 = 'c8f3d7457fc9979d1b9ec319f0229b89793c8e56',
+  )
+
+  native.maven_jar (
+    name = 'grpc_core_1_3_1',
+    artifact = 'io.grpc:grpc-core:1.3.1',
+    sha1 = 'a9b38b4a19af3ef208f4f6bf7871876d959c5eb1',
+  )
+
+  native.maven_jar (
+    name = 'grpc_protobuf_1_3_1',
+    artifact = 'io.grpc:grpc-protobuf:1.3.1',
+    sha1 = '9562e977cacd6e128a31686c3e6948d61873c496',
+  )
+
+  native.maven_jar (
+    name = 'grpc_protobuf_lite_1_3_1',
+    artifact = 'io.grpc:grpc-protobuf-lite:1.3.1',
+    sha1 = '98d1d3d100fdcf92c4331999a504a1a72a5f6e52',
+  )
+
+  native.maven_jar (
+    name = 'grpc_stub_1_3_1',
+    artifact = 'io.grpc:grpc-stub:1.3.1',
+    sha1 = '60bdfa9d8c664a9d87ae461106eff6eed8da6c54',
+  )
+
+  native.maven_jar (
+    name = 'grpc_netty_1_3_1',
+    artifact = 'io.grpc:grpc-netty:1.3.1',
+    sha1 = 'cc3831fccb76cfe21445f75cc055b5ffd979dc54',
+  )
+
+  native.maven_jar (
+    name = 'grpc_auth_1_3_1',
+    artifact = 'io.grpc:grpc-auth:1.3.1',
+    sha1 = '57a0e0b9e474842801521fae76f955dd28ad3ae0',
+  )
+
+  native.maven_jar (
+    name = 'protobuf_java_3_3_0',
+    artifact = 'com.google.protobuf:protobuf-java:3.3.0',
+    sha1 = '9f301d1a27501b1afcb2ed16aad428337dabf9e4',
+  )
+
+  native.maven_jar (
+    name = 'protobuf_java_3_2_0',
+    artifact = 'com.google.protobuf:protobuf-java:3.2.0',
+    sha1 = '62ccf171a106ff6791507f2d5364c275f9a3131d',
+  )
+
+  native.maven_jar (
+    name = 'grpc_testing_1_3_1',
+    artifact = 'io.grpc:grpc-testing:1.3.1',
+    sha1 = 'fd6c4081cd3415684a0b655327e210aa10153eec',
+  )
+
+  native.maven_jar (
+    name = 'grpc_testing_proto_1_3_1',
+    artifact = 'io.grpc:grpc-testing-proto:1.3.1',
+    sha1 = '170f0406457b44695562ccd5ec8d0da9cb762643',
+  )
+
+  native.maven_jar (
+    name = 'grpc_context_1_3_1',
+    artifact = 'io.grpc:grpc-context:1.3.1',
+    sha1 = '28accd419b18d59055b8999f78f5cb7767c7bde8',
+  )
+
+  native.maven_jar (
+    name = 'google_truth_0_28',
+    artifact = 'com.google.truth:truth:0.28',
+    sha1 = '0a388c7877c845ff4b8e19689dda5ac9d34622c4',
+  )
+
+  native.maven_jar (
+    name = 'google_code_findbugs_3_0_0',
+    artifact = 'com.google.code.findbugs:jsr305:3.0.0',
+    sha1 = '5871fb60dc68d67da54a663c3fd636a10a532948',
+  )
+
+  native.maven_jar (
+    name = 'google_errorprone_2_0_19',
+    artifact = 'com.google.errorprone:error_prone_annotations:2.0.19',
+    sha1 = 'c3754a0bdd545b00ddc26884f9e7624f8b6a14de',
+  )
+
+  native.maven_jar (
+    name = 'google_instrumentation_0_3_0',
+    artifact = 'com.google.instrumentation:instrumentation-api:0.3.0',
+    sha1 = 'a2e145e7a7567c6372738f5c5a6f3ba6407ac354',
+  )
+
+  native.maven_jar (
+    name = 'bcpkix_jdk15on',
+    artifact = 'org.bouncycastle:bcpkix-jdk15on:1.58',
+    sha1 = '15a760a039b040e767a75c77ffcc4ff62558f903',
+  )
+
+  native.maven_jar (
+    name = 'bcprov_jdk15on',
+    artifact = 'org.bouncycastle:bcprov-jdk15on:1.58',
+    sha1 = '2c9aa1c4e3372b447ba5daabade4adf2a2264b12',
+  )
+
+  native.maven_jar (
+    name = 'hamcrest_optional',
+    artifact = 'com.spotify:hamcrest-optional:1.1.0',
+    sha1 = 'c2dfe3a43794b15fb4c28de0027fe6e249855b3b',
+  )
+
+  native.maven_jar (
+    name = 'swagger_annotations',
+    artifact = 'io.swagger:swagger-annotations:1.5.16',
+    sha1 = '935f1f2fed2cbdd7a0513981d6c53201e21155f4',
+  )
+
+  native.maven_jar (
+    name = 'kafka_clients',
+    artifact = 'org.apache.servicemix.bundles:org.apache.servicemix.bundles.kafka-clients:0.8.2.2_1',
+    sha1 = '19ba66200cc3617fad12843788dff818b9882008',
+  )
+
+  native.maven_jar (
+    name = 'tinder_xmpp',
+    artifact = 'org.igniterealtime:tinder:1.3.0',
+    sha1 = '46353ded2a1d1a87d17600206d61814eb0b8a711',
+  )
+
+  native.maven_jar (
+    name = 'aalto_xml',
+    artifact = 'com.fasterxml:aalto-xml:1.0.0',
+    sha1 = 'aeae9e8a71914e7f5efc8a69d2f5cb1f2224f2c6',
+  )
+
+  native.maven_jar (
+    name = 'stax2_api',
+    artifact = 'org.codehaus.woodstox:stax2-api:4.0.0',
+    sha1 = '6fa8b05f7587a3cb819d223ee0b0de0c126e3dd1',
+  )
+
+  native.maven_jar (
+    name = 'concurrent_hashmap',
+    artifact = 'com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.0',
+    sha1 = 'db7b7a28b835db4717d4aaf31f5d4441887a6d46',
+  )
+
+  native.maven_jar (
+    name = 'gnu_idn',
+    artifact = 'org.gnu.inet:libidn:1.15',
+    sha1 = 'b5bede3c1c031a827b604da31768ddaf833495c6',
+  )
+
+  native.maven_jar (
+    name = 'sigar',
+    artifact = 'org.knowhowlab.osgi:sigar:1.6.5_01',
+    sha1 = '58eb4af0dc4a1d331cd7620767216494e2984dea',
+  )
+
+def generated_java_libraries():
+  native.java_library (
+    name = 'aopalliance_repackaged',
+    visibility = ['//visibility:public'],
+    exports = ['@aopalliance_repackaged//jar'],
+  )
+
+  native.java_library (
+    name = 'amqp_client',
+    visibility = ['//visibility:public'],
+    exports = ['@amqp_client//jar'],
+  )
+
+  native.java_library (
+    name = 'asm',
+    visibility = ['//visibility:public'],
+    exports = ['@asm//jar'],
+  )
+
+  native.java_library (
+    name = 'atomix',
+    visibility = ['//visibility:public'],
+    exports = ['@atomix//jar'],
+  )
+
+  native.java_library (
+    name = 'commons_codec',
+    visibility = ['//visibility:public'],
+    exports = ['@commons_codec//jar'],
+  )
+
+  native.java_library (
+    name = 'commons_collections',
+    visibility = ['//visibility:public'],
+    exports = ['@commons_collections//jar'],
+  )
+
+  native.java_library (
+    name = 'commons_configuration',
+    visibility = ['//visibility:public'],
+    exports = ['@commons_configuration//jar'],
+  )
+
+  native.java_library (
+    name = 'commons_io',
+    visibility = ['//visibility:public'],
+    exports = ['@commons_io//jar'],
+  )
+
+  native.java_library (
+    name = 'commons_jxpath',
+    visibility = ['//visibility:public'],
+    exports = ['@commons_jxpath//jar'],
+  )
+
+  native.java_library (
+    name = 'commons_beanutils',
+    visibility = ['//visibility:public'],
+    exports = ['@commons_beanutils//jar'],
+  )
+
+  native.java_library (
+    name = 'jdom',
+    visibility = ['//visibility:public'],
+    exports = ['@jdom//jar'],
+  )
+
+  native.java_library (
+    name = 'commons_lang',
+    visibility = ['//visibility:public'],
+    exports = ['@commons_lang//jar'],
+  )
+
+  native.java_library (
+    name = 'commons_lang3',
+    visibility = ['//visibility:public'],
+    exports = ['@commons_lang3//jar'],
+  )
+
+  native.java_library (
+    name = 'commons_logging',
+    visibility = ['//visibility:public'],
+    exports = ['@commons_logging//jar'],
+  )
+
+  native.java_library (
+    name = 'commons_math3',
+    visibility = ['//visibility:public'],
+    exports = ['@commons_math3//jar'],
+  )
+
+  native.java_library (
+    name = 'commons_pool',
+    visibility = ['//visibility:public'],
+    exports = ['@commons_pool//jar'],
+  )
+
+  native.java_library (
+    name = 'commons_text',
+    visibility = ['//visibility:public'],
+    exports = ['@commons_text//jar'],
+  )
+
+  native.java_library (
+    name = 'concurrent_trees',
+    visibility = ['//visibility:public'],
+    exports = ['@concurrent_trees//jar'],
+  )
+
+  native.java_library (
+    name = 'easymock',
+    visibility = ['//visibility:public'],
+    exports = ['@easymock//jar'],
+  )
+
+  native.java_library (
+    name = 'antlr',
+    visibility = ['//visibility:public'],
+    exports = ['@antlr//jar'],
+  )
+
+  native.java_library (
+    name = 'error_prone_annotations',
+    visibility = ['//visibility:public'],
+    exports = ['@error_prone_annotations//jar'],
+  )
+
+  native.java_library (
+    name = 'ganymed_ssh2',
+    visibility = ['//visibility:public'],
+    exports = ['@ganymed_ssh2//jar'],
+  )
+
+  native.java_library (
+    name = 'gmetric4j',
+    visibility = ['//visibility:public'],
+    exports = ['@gmetric4j//jar'],
+  )
+
+  native.java_library (
+    name = 'gson',
+    visibility = ['//visibility:public'],
+    exports = ['@gson//jar'],
+  )
+
+  native.java_library (
+    name = 'guava',
+    visibility = ['//visibility:public'],
+    exports = ['@guava//jar'],
+  )
+
+  native.java_library (
+    name = 'guava_testlib',
+    visibility = ['//visibility:public'],
+    exports = ['@guava_testlib//jar'],
+  )
+
+  native.java_library (
+    name = 'hamcrest_all',
+    visibility = ['//visibility:public'],
+    exports = ['@hamcrest_all//jar'],
+  )
+
+  native.java_library (
+    name = 'hk2_api',
+    visibility = ['//visibility:public'],
+    exports = ['@hk2_api//jar'],
+  )
+
+  native.java_library (
+    name = 'hk2_locator',
+    visibility = ['//visibility:public'],
+    exports = ['@hk2_locator//jar'],
+  )
+
+  native.java_library (
+    name = 'hk2_osgi_resource_locator',
+    visibility = ['//visibility:public'],
+    exports = ['@hk2_osgi_resource_locator//jar'],
+  )
+
+  native.java_library (
+    name = 'hk2_utils',
+    visibility = ['//visibility:public'],
+    exports = ['@hk2_utils//jar'],
+  )
+
+  native.java_library (
+    name = 'httpclient_osgi',
+    visibility = ['//visibility:public'],
+    exports = ['@httpclient_osgi//jar'],
+  )
+
+  native.java_library (
+    name = 'httpcore_osgi',
+    visibility = ['//visibility:public'],
+    exports = ['@httpcore_osgi//jar'],
+  )
+
+  native.java_library (
+    name = 'influxdb_java',
+    visibility = ['//visibility:public'],
+    exports = ['@influxdb_java//jar'],
+  )
+
+  native.java_library (
+    name = 'retrofit',
+    visibility = ['//visibility:public'],
+    exports = ['@retrofit//jar'],
+  )
+
+  native.java_library (
+    name = 'converter_moshi',
+    visibility = ['//visibility:public'],
+    exports = ['@converter_moshi//jar'],
+  )
+
+  native.java_library (
+    name = 'okhttp',
+    visibility = ['//visibility:public'],
+    exports = ['@okhttp//jar'],
+  )
+
+  native.java_library (
+    name = 'logging_interceptor',
+    visibility = ['//visibility:public'],
+    exports = ['@logging_interceptor//jar'],
+  )
+
+  native.java_library (
+    name = 'moshi',
+    visibility = ['//visibility:public'],
+    exports = ['@moshi//jar'],
+  )
+
+  native.java_library (
+    name = 'okio',
+    visibility = ['//visibility:public'],
+    exports = ['@okio//jar'],
+  )
+
+  native.java_library (
+    name = 'jackson_annotations',
+    visibility = ['//visibility:public'],
+    exports = ['@jackson_annotations//jar'],
+  )
+
+  native.java_library (
+    name = 'jackson_core',
+    visibility = ['//visibility:public'],
+    exports = ['@jackson_core//jar'],
+  )
+
+  native.java_library (
+    name = 'jackson_databind',
+    visibility = ['//visibility:public'],
+    exports = ['@jackson_databind//jar'],
+  )
+
+  native.java_library (
+    name = 'javax_annotation_api',
+    visibility = ['//visibility:public'],
+    exports = ['@javax_annotation_api//jar'],
+  )
+
+  native.java_library (
+    name = 'javax_inject',
+    visibility = ['//visibility:public'],
+    exports = ['@javax_inject//jar'],
+  )
+
+  native.java_library (
+    name = 'javax_ws_rs_api',
+    visibility = ['//visibility:public'],
+    exports = ['@javax_ws_rs_api//jar'],
+  )
+
+  native.java_library (
+    name = 'jersey_client',
+    visibility = ['//visibility:public'],
+    exports = ['@jersey_client//jar'],
+  )
+
+  native.java_library (
+    name = 'jersey_security',
+    visibility = ['//visibility:public'],
+    exports = ['@jersey_security//jar'],
+  )
+
+  native.java_library (
+    name = 'jersey_common',
+    visibility = ['//visibility:public'],
+    exports = ['@jersey_common//jar'],
+  )
+
+  native.java_library (
+    name = 'jersey_container_jetty_http',
+    visibility = ['//visibility:public'],
+    exports = ['@jersey_container_jetty_http//jar'],
+  )
+
+  native.java_library (
+    name = 'jersey_container_servlet',
+    visibility = ['//visibility:public'],
+    exports = ['@jersey_container_servlet//jar'],
+  )
+
+  native.java_library (
+    name = 'jersey_container_servlet_core',
+    visibility = ['//visibility:public'],
+    exports = ['@jersey_container_servlet_core//jar'],
+  )
+
+  native.java_library (
+    name = 'jersey_media_multipart',
+    visibility = ['//visibility:public'],
+    exports = ['@jersey_media_multipart//jar'],
+  )
+
+  native.java_library (
+    name = 'jersey_server',
+    visibility = ['//visibility:public'],
+    exports = ['@jersey_server//jar'],
+  )
+
+  native.java_library (
+    name = 'jersey_hk2',
+    visibility = ['//visibility:public'],
+    exports = ['@jersey_hk2//jar'],
+  )
+
+  native.java_library (
+    name = 'jersey_test_framework_core',
+    visibility = ['//visibility:public'],
+    exports = ['@jersey_test_framework_core//jar'],
+  )
+
+  native.java_library (
+    name = 'jersey_test_framework_jetty',
+    visibility = ['//visibility:public'],
+    exports = ['@jersey_test_framework_jetty//jar'],
+  )
+
+  native.java_library (
+    name = 'jetty_util',
+    visibility = ['//visibility:public'],
+    exports = ['@jetty_util//jar'],
+  )
+
+  native.java_library (
+    name = 'jetty_websocket',
+    visibility = ['//visibility:public'],
+    exports = ['@jetty_websocket//jar'],
+  )
+
+  native.java_library (
+    name = 'jetty_server',
+    visibility = ['//visibility:public'],
+    exports = ['@jetty_server//jar'],
+  )
+
+  native.java_library (
+    name = 'jetty_continuation',
+    visibility = ['//visibility:public'],
+    exports = ['@jetty_continuation//jar'],
+  )
+
+  native.java_library (
+    name = 'jetty_http',
+    visibility = ['//visibility:public'],
+    exports = ['@jetty_http//jar'],
+  )
+
+  native.java_library (
+    name = 'jetty_io',
+    visibility = ['//visibility:public'],
+    exports = ['@jetty_io//jar'],
+  )
+
+  native.java_library (
+    name = 'javax_servlet_api',
+    visibility = ['//visibility:public'],
+    exports = ['@javax_servlet_api//jar'],
+  )
+
+  native.java_library (
+    name = 'joda_time',
+    visibility = ['//visibility:public'],
+    exports = ['@joda_time//jar'],
+  )
+
+  native.java_library (
+    name = 'jsch',
+    visibility = ['//visibility:public'],
+    exports = ['@jsch//jar'],
+  )
+
+  native.java_library (
+    name = 'jsr305',
+    visibility = ['//visibility:public'],
+    exports = ['@jsr305//jar'],
+  )
+
+  native.java_library (
+    name = 'junit',
+    visibility = ['//visibility:public'],
+    exports = ['@junit//jar'],
+  )
+
+  native.java_library (
+    name = 'junit_dep',
+    visibility = ['//visibility:public'],
+    exports = ['@junit_dep//jar'],
+  )
+
+  native.java_library (
+    name = 'kryo',
+    visibility = ['//visibility:public'],
+    exports = ['@kryo//jar'],
+  )
+
+  native.java_library (
+    name = 'mapdb',
+    visibility = ['//visibility:public'],
+    exports = ['@mapdb//jar'],
+  )
+
+  native.java_library (
+    name = 'metrics_core',
+    visibility = ['//visibility:public'],
+    exports = ['@metrics_core//jar'],
+  )
+
+  native.java_library (
+    name = 'metrics_ganglia',
+    visibility = ['//visibility:public'],
+    exports = ['@metrics_ganglia//jar'],
+  )
+
+  native.java_library (
+    name = 'metrics_graphite',
+    visibility = ['//visibility:public'],
+    exports = ['@metrics_graphite//jar'],
+  )
+
+  native.java_library (
+    name = 'metrics_influxdb',
+    visibility = ['//visibility:public'],
+    exports = ['@metrics_influxdb//jar'],
+  )
+
+  native.java_library (
+    name = 'metrics_json',
+    visibility = ['//visibility:public'],
+    exports = ['@metrics_json//jar'],
+  )
+
+  native.java_library (
+    name = 'minimal_json',
+    visibility = ['//visibility:public'],
+    exports = ['@minimal_json//jar'],
+  )
+
+  native.java_library (
+    name = 'minlog',
+    visibility = ['//visibility:public'],
+    exports = ['@minlog//jar'],
+  )
+
+  native.java_library (
+    name = 'netty',
+    visibility = ['//visibility:public'],
+    exports = ['@netty//jar'],
+  )
+
+  native.java_library (
+    name = 'netty_buffer',
+    visibility = ['//visibility:public'],
+    exports = ['@netty_buffer//jar'],
+  )
+
+  native.java_library (
+    name = 'netty_codec',
+    visibility = ['//visibility:public'],
+    exports = ['@netty_codec//jar'],
+  )
+
+  native.java_library (
+    name = 'netty_common',
+    visibility = ['//visibility:public'],
+    exports = ['@netty_common//jar'],
+  )
+
+  native.java_library (
+    name = 'netty_handler',
+    visibility = ['//visibility:public'],
+    exports = ['@netty_handler//jar'],
+  )
+
+  native.java_library (
+    name = 'netty_transport',
+    visibility = ['//visibility:public'],
+    exports = ['@netty_transport//jar'],
+  )
+
+  native.java_library (
+    name = 'netty_transport_native_epoll',
+    visibility = ['//visibility:public'],
+    exports = ['@netty_transport_native_epoll//jar'],
+  )
+
+  native.java_library (
+    name = 'netty_resolver',
+    visibility = ['//visibility:public'],
+    exports = ['@netty_resolver//jar'],
+  )
+
+  native.java_library (
+    name = 'netty_codec_http2',
+    visibility = ['//visibility:public'],
+    exports = ['@netty_codec_http2//jar'],
+  )
+
+  native.java_library (
+    name = 'netty_codec_http',
+    visibility = ['//visibility:public'],
+    exports = ['@netty_codec_http//jar'],
+  )
+
+  native.java_library (
+    name = 'objenesis',
+    visibility = ['//visibility:public'],
+    exports = ['@objenesis//jar'],
+  )
+
+  native.java_library (
+    name = 'openflowj',
+    visibility = ['//visibility:public'],
+    exports = ['@openflowj//jar'],
+  )
+
+  native.java_library (
+    name = 'org_apache_felix_framework_security',
+    visibility = ['//visibility:public'],
+    exports = ['@org_apache_felix_framework_security//jar'],
+  )
+
+  native.java_library (
+    name = 'org_apache_felix_scr',
+    visibility = ['//visibility:public'],
+    exports = ['@org_apache_felix_scr//jar'],
+  )
+
+  native.java_library (
+    name = 'org_apache_felix_scr_annotations',
+    visibility = ['//visibility:public'],
+    exports = ['@org_apache_felix_scr_annotations//jar'],
+  )
+
+  native.java_library (
+    name = 'org_apache_karaf_features_core',
+    visibility = ['//visibility:public'],
+    exports = ['@org_apache_karaf_features_core//jar'],
+  )
+
+  native.java_library (
+    name = 'org_apache_karaf_shell_console',
+    visibility = ['//visibility:public'],
+    exports = ['@org_apache_karaf_shell_console//jar'],
+  )
+
+  native.java_library (
+    name = 'org_apache_httpcomponents_httpasyncclient_osgi',
+    visibility = ['//visibility:public'],
+    exports = ['@org_apache_httpcomponents_httpasyncclient_osgi//jar'],
+  )
+
+  native.java_library (
+    name = 'org_apache_httpcomponents_httpcore_nio',
+    visibility = ['//visibility:public'],
+    exports = ['@org_apache_httpcomponents_httpcore_nio//jar'],
+  )
+
+  native.java_library (
+    name = 'org_apache_karaf_jaas',
+    visibility = ['//visibility:public'],
+    exports = ['@org_apache_karaf_jaas//jar'],
+  )
+
+  native.java_library (
+    name = 'org_apache_karaf_system_core',
+    visibility = ['//visibility:public'],
+    exports = ['@org_apache_karaf_system_core//jar'],
+  )
+
+  native.java_library (
+    name = 'org_apache_servicemix_bundles_snmp4j',
+    visibility = ['//visibility:public'],
+    exports = ['@org_apache_servicemix_bundles_snmp4j//jar'],
+  )
+
+  native.java_library (
+    name = 'org_osgi_compendium',
+    visibility = ['//visibility:public'],
+    exports = ['@org_osgi_compendium//jar'],
+  )
+
+  native.java_library (
+    name = 'osgi_core',
+    visibility = ['//visibility:public'],
+    exports = ['@osgi_core//jar'],
+  )
+
+  native.java_library (
+    name = 'reflectasm',
+    visibility = ['//visibility:public'],
+    exports = ['@reflectasm//jar'],
+  )
+
+  native.java_library (
+    name = 'remotetea_oncrpc',
+    visibility = ['//visibility:public'],
+    exports = ['@remotetea_oncrpc//jar'],
+  )
+
+  native.java_library (
+    name = 'rrd4j',
+    visibility = ['//visibility:public'],
+    exports = ['@rrd4j//jar'],
+  )
+
+  native.java_library (
+    name = 'javassist',
+    visibility = ['//visibility:public'],
+    exports = ['@javassist//jar'],
+  )
+
+  native.java_library (
+    name = 'mimepull',
+    visibility = ['//visibility:public'],
+    exports = ['@mimepull//jar'],
+  )
+
+  native.java_library (
+    name = 'servlet_api',
+    visibility = ['//visibility:public'],
+    exports = ['@servlet_api//jar'],
+  )
+
+  native.java_library (
+    name = 'slf4j_api',
+    visibility = ['//visibility:public'],
+    exports = ['@slf4j_api//jar'],
+  )
+
+  native.java_library (
+    name = 'slf4j_jdk14',
+    visibility = ['//visibility:public'],
+    exports = ['@slf4j_jdk14//jar'],
+  )
+
+  native.java_library (
+    name = 'typesafe_config',
+    visibility = ['//visibility:public'],
+    exports = ['@typesafe_config//jar'],
+  )
+
+  native.java_library (
+    name = 'validation_api',
+    visibility = ['//visibility:public'],
+    exports = ['@validation_api//jar'],
+  )
+
+  native.java_library (
+    name = 'checkstyle',
+    visibility = ['//visibility:public'],
+    exports = ['@checkstyle//jar'],
+  )
+
+  native.java_library (
+    name = 'bndlib',
+    visibility = ['//visibility:public'],
+    exports = ['@bndlib//jar'],
+  )
+
+  native.java_library (
+    name = 'bndexe',
+    visibility = ['//visibility:public'],
+    exports = ['@bndexe//jar'],
+  )
+
+  native.java_library (
+    name = 'libthrift',
+    visibility = ['//visibility:public'],
+    exports = ['@libthrift//jar'],
+  )
+
+  native.java_library (
+    name = 'qdox',
+    visibility = ['//visibility:public'],
+    exports = ['@qdox//jar'],
+  )
+
+  native.java_library (
+    name = 'org_apache_felix_scr_bnd',
+    visibility = ['//visibility:public'],
+    exports = ['@org_apache_felix_scr_bnd//jar'],
+  )
+
+  native.java_library (
+    name = 'snmp_core',
+    visibility = ['//visibility:public'],
+    exports = ['@snmp_core//jar'],
+  )
+
+  native.java_library (
+    name = 'bti7000',
+    visibility = ['//visibility:public'],
+    exports = ['@bti7000//jar'],
+  )
+
+  native.java_library (
+    name = 'mibs_net_snmp',
+    visibility = ['//visibility:public'],
+    exports = ['@mibs_net_snmp//jar'],
+  )
+
+  native.java_library (
+    name = 'mibs_rfc',
+    visibility = ['//visibility:public'],
+    exports = ['@mibs_rfc//jar'],
+  )
+
+  native.java_library (
+    name = 'openstack4j_core',
+    visibility = ['//visibility:public'],
+    exports = ['@openstack4j_core//jar'],
+  )
+
+  native.java_library (
+    name = 'openstack4j_http_connector',
+    visibility = ['//visibility:public'],
+    exports = ['@openstack4j_http_connector//jar'],
+  )
+
+  native.java_library (
+    name = 'openstack4j_httpclient',
+    visibility = ['//visibility:public'],
+    exports = ['@openstack4j_httpclient//jar'],
+  )
+
+  native.java_library (
+    name = 'json_patch',
+    visibility = ['//visibility:public'],
+    exports = ['@json_patch//jar'],
+  )
+
+  native.java_library (
+    name = 'jackson_coreutils',
+    visibility = ['//visibility:public'],
+    exports = ['@jackson_coreutils//jar'],
+  )
+
+  native.java_library (
+    name = 'btf',
+    visibility = ['//visibility:public'],
+    exports = ['@btf//jar'],
+  )
+
+  native.java_library (
+    name = 'msg_simple',
+    visibility = ['//visibility:public'],
+    exports = ['@msg_simple//jar'],
+  )
+
+  native.java_library (
+    name = 'snakeyaml',
+    visibility = ['//visibility:public'],
+    exports = ['@snakeyaml//jar'],
+  )
+
+  native.java_library (
+    name = 'onos_yang_model',
+    visibility = ['//visibility:public'],
+    exports = ['@onos_yang_model//jar'],
+  )
+
+  native.java_library (
+    name = 'onos_yang_compiler_api',
+    visibility = ['//visibility:public'],
+    exports = ['@onos_yang_compiler_api//jar'],
+  )
+
+  native.java_library (
+    name = 'onos_yang_runtime',
+    visibility = ['//visibility:public'],
+    exports = ['@onos_yang_runtime//jar'],
+  )
+
+  native.java_library (
+    name = 'onos_yang_serializers_json',
+    visibility = ['//visibility:public'],
+    exports = ['@onos_yang_serializers_json//jar'],
+  )
+
+  native.java_library (
+    name = 'onos_yang_serializers_xml',
+    visibility = ['//visibility:public'],
+    exports = ['@onos_yang_serializers_xml//jar'],
+  )
+
+  native.java_library (
+    name = 'onos_yang_serializers_utils',
+    visibility = ['//visibility:public'],
+    exports = ['@onos_yang_serializers_utils//jar'],
+  )
+
+  native.java_library (
+    name = 'org_apache_servicemix_bundles_dom4j',
+    visibility = ['//visibility:public'],
+    exports = ['@org_apache_servicemix_bundles_dom4j//jar'],
+  )
+
+  native.java_library (
+    name = 'plexus_utils',
+    visibility = ['//visibility:public'],
+    exports = ['@plexus_utils//jar'],
+  )
+
+  native.java_library (
+    name = 'sshd_core',
+    visibility = ['//visibility:public'],
+    exports = ['@sshd_core//jar'],
+  )
+
+  native.java_library (
+    name = 'grpc_core_1_3_1',
+    visibility = ['//visibility:public'],
+    exports = ['@grpc_core_1_3_1//jar'],
+  )
+
+  native.java_library (
+    name = 'grpc_protobuf_1_3_1',
+    visibility = ['//visibility:public'],
+    exports = ['@grpc_protobuf_1_3_1//jar'],
+  )
+
+  native.java_library (
+    name = 'grpc_protobuf_lite_1_3_1',
+    visibility = ['//visibility:public'],
+    exports = ['@grpc_protobuf_lite_1_3_1//jar'],
+  )
+
+  native.java_library (
+    name = 'grpc_stub_1_3_1',
+    visibility = ['//visibility:public'],
+    exports = ['@grpc_stub_1_3_1//jar'],
+  )
+
+  native.java_library (
+    name = 'grpc_netty_1_3_1',
+    visibility = ['//visibility:public'],
+    exports = ['@grpc_netty_1_3_1//jar'],
+  )
+
+  native.java_library (
+    name = 'grpc_auth_1_3_1',
+    visibility = ['//visibility:public'],
+    exports = ['@grpc_auth_1_3_1//jar'],
+  )
+
+  native.java_library (
+    name = 'protobuf_java_3_3_0',
+    visibility = ['//visibility:public'],
+    exports = ['@protobuf_java_3_3_0//jar'],
+  )
+
+  native.java_library (
+    name = 'protobuf_java_3_2_0',
+    visibility = ['//visibility:public'],
+    exports = ['@protobuf_java_3_2_0//jar'],
+  )
+
+  native.java_library (
+    name = 'grpc_testing_1_3_1',
+    visibility = ['//visibility:public'],
+    exports = ['@grpc_testing_1_3_1//jar'],
+  )
+
+  native.java_library (
+    name = 'grpc_testing_proto_1_3_1',
+    visibility = ['//visibility:public'],
+    exports = ['@grpc_testing_proto_1_3_1//jar'],
+  )
+
+  native.java_library (
+    name = 'grpc_context_1_3_1',
+    visibility = ['//visibility:public'],
+    exports = ['@grpc_context_1_3_1//jar'],
+  )
+
+  native.java_library (
+    name = 'google_truth_0_28',
+    visibility = ['//visibility:public'],
+    exports = ['@google_truth_0_28//jar'],
+  )
+
+  native.java_library (
+    name = 'google_code_findbugs_3_0_0',
+    visibility = ['//visibility:public'],
+    exports = ['@google_code_findbugs_3_0_0//jar'],
+  )
+
+  native.java_library (
+    name = 'google_errorprone_2_0_19',
+    visibility = ['//visibility:public'],
+    exports = ['@google_errorprone_2_0_19//jar'],
+  )
+
+  native.java_library (
+    name = 'google_instrumentation_0_3_0',
+    visibility = ['//visibility:public'],
+    exports = ['@google_instrumentation_0_3_0//jar'],
+  )
+
+  native.java_library (
+    name = 'bcpkix_jdk15on',
+    visibility = ['//visibility:public'],
+    exports = ['@bcpkix_jdk15on//jar'],
+  )
+
+  native.java_library (
+    name = 'bcprov_jdk15on',
+    visibility = ['//visibility:public'],
+    exports = ['@bcprov_jdk15on//jar'],
+  )
+
+  native.java_library (
+    name = 'hamcrest_optional',
+    visibility = ['//visibility:public'],
+    exports = ['@hamcrest_optional//jar'],
+  )
+
+  native.java_library (
+    name = 'swagger_annotations',
+    visibility = ['//visibility:public'],
+    exports = ['@swagger_annotations//jar'],
+  )
+
+  native.java_library (
+    name = 'kafka_clients',
+    visibility = ['//visibility:public'],
+    exports = ['@kafka_clients//jar'],
+  )
+
+  native.java_library (
+    name = 'tinder_xmpp',
+    visibility = ['//visibility:public'],
+    exports = ['@tinder_xmpp//jar'],
+  )
+
+  native.java_library (
+    name = 'aalto_xml',
+    visibility = ['//visibility:public'],
+    exports = ['@aalto_xml//jar'],
+  )
+
+  native.java_library (
+    name = 'stax2_api',
+    visibility = ['//visibility:public'],
+    exports = ['@stax2_api//jar'],
+  )
+
+  native.java_library (
+    name = 'concurrent_hashmap',
+    visibility = ['//visibility:public'],
+    exports = ['@concurrent_hashmap//jar'],
+  )
+
+  native.java_library (
+    name = 'gnu_idn',
+    visibility = ['//visibility:public'],
+    exports = ['@gnu_idn//jar'],
+  )
+
+  native.java_library (
+    name = 'sigar',
+    visibility = ['//visibility:public'],
+    exports = ['@sigar//jar'],
+  )
+
diff --git a/tools/build/bazel/osgi-java-library.bzl b/tools/build/bazel/osgi-java-library.bzl
new file mode 100644
index 0000000..680ecc9
--- /dev/null
+++ b/tools/build/bazel/osgi-java-library.bzl
@@ -0,0 +1,182 @@
+load("//tools/build/bazel:generate_workspace.bzl", "COMPILE", "TEST")
+load("//tools/build/bazel:variables.bzl", "ONOS_VERSION")
+load("//tools/build/bazel:generate_test_rules.bzl", "generate_test_rules")
+
+def all_java_sources():
+  return native.glob(["src/main/java/**/*.java"])
+
+def all_java_test_sources():
+  return native.glob(["src/test/java/**/*.java"])
+
+def all_test_resources():
+  return native.glob(["src/test/resources/**"])
+
+def all_resources(resources_root):
+  if resources_root == None:
+    return native.glob(["src/main/resources/**"])
+  else:
+    return native.glob([resources_root + '**'])
+
+# Implementation of the rule to call bnd to make an OSGI jar file
+def _bnd_impl(ctx):
+
+  jar = ctx.file.source.path
+  output = ctx.outputs.osgi_jar.path
+  cp = ""
+  name = ctx.attr.source.label.name
+  group = ctx.attr.package_name_root
+  version = ctx.attr.version
+  license = ""
+  importPackages = "*"
+  exportPackages = "*"
+  includeResources = ""
+  webContext = "NONE"
+  dynamicimportPackages = ""
+
+  inputDependencies = [ctx.file.source]
+
+  # determine the dependencies and build the class path
+  for dep in ctx.attr.deps:
+      file = dep.java.outputs.jars[0].class_jar
+
+      if cp:
+         cp += ":"
+      cp += file.path
+      inputDependencies = inputDependencies + [file]
+
+  # extract the class files for use by bnd
+  classes = ctx.actions.declare_file("classes")
+  classesPath = classes.path
+  jarCommand = "mkdir -p %s && cp %s %s && cd %s && jar xf *.jar" % (classesPath, jar, classesPath, classesPath)
+  ctx.actions.run_shell(
+      inputs=inputDependencies,
+            outputs=[classes],
+            command=jarCommand,
+            progress_message="Expanding jar file: %s" % jar,
+        )
+  inputDependencies += [classes]
+
+  # call bnd to make the OSGI jar file
+  arguments=[
+            jar,
+            output,
+            cp,
+            name,
+            group,
+            version,
+            license,
+            importPackages,
+            exportPackages,
+            includeResources,
+            webContext,
+            dynamicimportPackages,
+            classesPath,
+        ]
+  ctx.actions.run(
+      inputs=inputDependencies,
+      outputs=[ctx.outputs.osgi_jar],
+      arguments=arguments,
+      progress_message="Running bnd wrapper on: %s" % ctx.attr.name,
+      executable=ctx.executable._bnd_exe,
+  )
+
+bnd = rule(
+    attrs = {
+        "deps": attr.label_list(),
+        "version": attr.string(),
+        "package_name_root": attr.string(),
+        "source": attr.label(allow_single_file = True),
+        "_bnd_exe": attr.label(
+            executable = True,
+            cfg = "host",
+            allow_files = True,
+            default = Label("//utils/osgiwrap:osgi-jar"),
+        ),
+    },
+    fragments = ["java"],
+    outputs = {
+        "osgi_jar": "lib%{name}.jar",
+    },
+    implementation = _bnd_impl,
+)
+
+def _fwd_bnd(name, source, deps, version, package_name_root, visibility):
+  bnd(name = name, source = source, deps = deps, version = version, package_name_root = package_name_root, visibility = visibility)
+
+def wrapped_osgi_library(name, jar, deps, version = ONOS_VERSION, package_name_root = "org.onosproject", visibility = [ "//visibility:private" ]):
+  _fwd_bnd(name, jar, deps, version, package_name_root, visibility)
+
+def osgi_jar_with_tests(name = None,
+                        deps = None,
+                        test_deps = None,
+                        package_name_root = "org.onosproject",
+                        srcs = None,
+                        resources_root = None,
+                        resources = None,
+                        test_srcs = None,
+                        exclude_tests = None,
+                        test_resources = None,
+                        visibility = [ "//visibility:public" ],
+                        version = ONOS_VERSION):
+  if name == None:
+    name = "onos-" + native.package_name().replace("/", "-")
+  if srcs == None:
+    srcs = all_java_sources()
+  if resources == None:
+    resources = all_resources(resources_root)
+  if test_srcs == None:
+    test_srcs = all_java_test_sources()
+  if test_resources == None:
+    test_resources = all_test_resources()
+  if exclude_tests == None:
+    exclude_tests = []
+  if deps == None:
+    deps = COMPILE
+  if test_deps == None:
+    test_deps = TEST
+  tests_name = name + '-tests'
+  tests_jar_deps = list(depset(deps + test_deps)) + [ name ]
+  all_test_deps = tests_jar_deps + [ tests_name ]
+
+  native.java_library(name = name, srcs = srcs, resources = resources, deps = deps, visibility = visibility)
+  _fwd_bnd(name + '-osgi', name, deps, version, package_name_root, visibility)
+  if test_srcs != []:
+    native.java_library(name = tests_name,
+                        srcs = test_srcs,
+                        resources = test_resources,
+                        deps = tests_jar_deps,
+                        visibility = visibility)
+
+    generate_test_rules(
+      name = name + "-tests-gen",
+      test_files = test_srcs,
+      exclude_tests = exclude_tests,
+      deps = all_test_deps
+    )
+
+def osgi_jar(name = None,
+             deps = None,
+             package_name_root = "org.onosproject",
+             srcs = None,
+             resources_root = None,
+             resources = None,
+             visibility = [ "//visibility:public" ],
+             version = ONOS_VERSION):
+    if srcs == None:
+      srcs = all_java_sources()
+    if deps == None:
+      deps = COMPILE
+
+    osgi_jar_with_tests(name = name,
+                        deps = deps,
+                        test_deps = [],
+                        package_name_root = package_name_root,
+                        srcs = srcs,
+                        resources = resources,
+                        resources_root = resources_root,
+                        test_srcs = [],
+                        exclude_tests = [],
+                        test_resources = [],
+                        visibility = visibility,
+                        version = version)
+
diff --git a/tools/build/bazel/rules.bzl b/tools/build/bazel/rules.bzl
new file mode 100644
index 0000000..3dd5922
--- /dev/null
+++ b/tools/build/bazel/rules.bzl
@@ -0,0 +1,9 @@
+load("//tools/build/bazel:generate_workspace.bzl",
+        "generated_java_libraries", "COMPILE", "CORE_DEPS", "JACKSON",
+        "TEST_ADAPTERS", "TEST", "TEST_REST", "METRICS", "KRYO", "NETTY")
+
+def onos_bazel_rules() :
+    return
+
+def g() :
+    generated_java_libraries()
\ No newline at end of file
diff --git a/tools/build/bazel/variables.bzl b/tools/build/bazel/variables.bzl
new file mode 100644
index 0000000..1ef7121
--- /dev/null
+++ b/tools/build/bazel/variables.bzl
@@ -0,0 +1,2 @@
+ONOS_VERSION = "1.13.0-SNAPSHOT"
+
diff --git a/tools/build/libgen/src/main/java/org/onosproject/libgen/AetherResolver.java b/tools/build/libgen/src/main/java/org/onosproject/libgen/AetherResolver.java
index 1850779..4f5dcfa 100644
--- a/tools/build/libgen/src/main/java/org/onosproject/libgen/AetherResolver.java
+++ b/tools/build/libgen/src/main/java/org/onosproject/libgen/AetherResolver.java
@@ -91,15 +91,15 @@
         AetherResolver.session = session;
     }
 
-    public static BuckArtifact getArtifact(String name, String uri, String repo) {
-        return new AetherResolver(repo).build(name, uri);
+    public static BuckArtifact getArtifact(String name, String uri, String repo, boolean generateForBazel) {
+        return new AetherResolver(repo).build(name, uri, generateForBazel);
     }
 
     private AetherResolver(String repoUrl) {
         this.repoUrl = repoUrl;
     }
 
-    private BuckArtifact build(String name, String uri) {
+    private BuckArtifact build(String name, String uri, boolean generateForBazel) {
         uri = uri.replaceFirst("mvn:", "");
         Artifact artifact = new DefaultArtifact(uri);
         String originalVersion = artifact.getVersion();
@@ -122,9 +122,9 @@
                                                    artifact.getGroupId(),
                                                    artifact.getArtifactId(),
                                                    originalVersion);
-                return BuckArtifact.getArtifact(name, url, sha, mavenCoords, osgiReady);
+                return BuckArtifact.getArtifact(name, url, sha, mavenCoords, osgiReady, generateForBazel);
             }
-            return BuckArtifact.getArtifact(name, artifact, sha, repoUrl, osgiReady);
+            return BuckArtifact.getArtifact(name, artifact, sha, repoUrl, osgiReady, generateForBazel);
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
diff --git a/tools/build/libgen/src/main/java/org/onosproject/libgen/BuckArtifact.java b/tools/build/libgen/src/main/java/org/onosproject/libgen/BuckArtifact.java
index 15e14be..215b5a8 100644
--- a/tools/build/libgen/src/main/java/org/onosproject/libgen/BuckArtifact.java
+++ b/tools/build/libgen/src/main/java/org/onosproject/libgen/BuckArtifact.java
@@ -25,25 +25,33 @@
     private final String name;
     private final String sha;
     private final boolean osgiReady;
+    private final boolean generateForBazel;
 
-    public static BuckArtifact getArtifact(String name, Artifact artifact, String sha, String repo, boolean osgiReady) {
-        return new MavenArtifact(name, artifact, sha, repo, osgiReady);
+    public static BuckArtifact getArtifact(String name, Artifact artifact, String sha, String repo,
+                                           boolean osgiReady, boolean generateForBazel) {
+        return new MavenArtifact(name, artifact, sha, repo, osgiReady, generateForBazel);
     }
-    public static BuckArtifact getArtifact(String name, String url, String sha, String mavenCoords, boolean osgiReady) {
-        return new HTTPArtifact(name, url, sha, mavenCoords, osgiReady);
+    public static BuckArtifact getArtifact(String name, String url, String sha, String mavenCoords,
+                                           boolean osgiReady, boolean generateForBazel) {
+        return new HTTPArtifact(name, url, sha, mavenCoords, osgiReady, generateForBazel);
     }
-    public static BuckArtifact getArtifact(String name, String url, String sha) {
-        return new HTTPArtifact(name, url, sha, null, true);
+    public static BuckArtifact getArtifact(String name, String url, String sha, boolean generateForBazel) {
+        return new HTTPArtifact(name, url, sha, null, true, generateForBazel);
     }
 
-    public BuckArtifact(String name, String sha, boolean osgiReady) {
+    public BuckArtifact(String name, String sha, boolean osgiReady, boolean generateForBazel) {
         this.name = name;
         this.sha = sha;
         this.osgiReady = osgiReady;
+        this.generateForBazel = generateForBazel;
     }
 
     public String name() {
-        return name;
+        if (!generateForBazel) {
+            return name;
+        } else {
+            return name.replaceAll("[.-]", "_");
+        }
     }
 
     abstract String fileName();
@@ -51,7 +59,7 @@
     abstract String url();
 
     private String jarTarget() {
-        return name != null ? name : fileName();
+        return name != null ? name() : fileName();
     }
 
     private boolean isPublic() {
@@ -62,20 +70,82 @@
         return osgiReady;
     }
 
+    boolean isGenerateForBazel() {
+        return generateForBazel;
+    }
+
+
     String mavenCoords() {
         return null;
     }
 
+    private boolean isJar() {
+        return fileName().endsWith(".jar");
+    }
+
+    private boolean isHttp() {
+        return url().startsWith("http");
+    }
+
+    String getBazelJavaLibraryFragment() {
+        if (isJar()) {
+            String format =
+                    "  native.java_library (\n" +
+                            "    name = '%s',\n" +
+                            "    visibility = ['//visibility:public'],\n" +
+                            "    exports = ['@%s//jar'],\n" +
+                            "  )\n\n";
+            return String.format(format, jarTarget(), jarTarget());
+        }
+        return "";
+    }
+
+    private String extractRepo() {
+        // This is a hack because the code above us already got rid of the maven repo
+        // info for artifacts
+        String url = url();
+        if (url.startsWith("http")) {
+            return url.substring(0, url.indexOf(fileName()) - mavenCoords().length() - 1);
+        } else {
+            return "";
+        }
+    }
+
+    String getBazelMavenJarFragment() {
+        if (isJar() && mavenCoords() != null) {
+            String repo = extractRepo();
+            String repoAttribute = "";
+            if (!"".equals(repo)) {
+                repoAttribute = "    repository = '" + repo + "',\n";
+            }
+            String format =
+                    "  native.maven_jar (\n" +
+                            "    name = '%s',\n" +
+                            "    artifact = '%s',\n" +
+                            "    sha1 = '%s',\n" +
+                            "%s" +
+                            "  )\n\n";
+            return String.format(format, jarTarget(), mavenCoords(), sha, repoAttribute);
+        } else {
+            String format =
+                    "  native.http_jar (\n" +
+                            "    name = '%s',\n" +
+                            "    url = '%s',\n" +
+                            "    sha256 = '%s',\n" +
+                            "  )\n\n";
+            return String.format(format, jarTarget(), url(), sha);
+        }
+    }
+
     public String getBuckFragment() {
         String visibility = isPublic() ? "[ 'PUBLIC' ]" : "[]";
 
-        boolean isJar = fileName().endsWith(".jar");
-        String output = (isJar ? "remote_jar" : "remote_file") + " (\n" +
+        String output = (isJar() ? "remote_jar" : "remote_file") + " (\n" +
                 "  name = '%s',\n" + // jar target
                 "  out = '%s',\n" + // jar file name
                 "  url = '%s',\n" + // maven url
                 "  sha1 = '%s',\n" + // artifact sha
-                ( isJar && mavenCoords() != null ?
+                ( isJar() && mavenCoords() != null ?
                 "  maven_coords = '"+ mavenCoords()+"',\n" : "" ) +
                 "  visibility = %s,\n" +
                 ")\n\n";
@@ -87,8 +157,9 @@
         private final String url;
         private final String mavenCoords;
 
-        public HTTPArtifact(String name, String url, String sha, String mavenCoords, boolean osgiReady) {
-            super(name, sha, osgiReady);
+        public HTTPArtifact(String name, String url, String sha,
+                            String mavenCoords, boolean osgiReady, boolean generateForBazel) {
+            super(name, sha, osgiReady, generateForBazel);
             this.url = url;
             this.mavenCoords = mavenCoords;
         }
@@ -114,8 +185,9 @@
         private final Artifact artifact;
         private final String repo;
 
-        private MavenArtifact(String name, Artifact artifact, String sha, String repo, boolean osgiReady) {
-            super(name, sha, osgiReady);
+        private MavenArtifact(String name, Artifact artifact, String sha,
+                              String repo, boolean osgiReady, boolean generateForBazel) {
+            super(name, sha, osgiReady, generateForBazel);
             this.artifact = artifact;
             this.repo = repo;
         }
@@ -142,7 +214,7 @@
         @Override
         String mavenCoords() {
             String classifer = artifact.getClassifier();
-            if (!isOsgiReady()) {
+            if (!isOsgiReady() && !isGenerateForBazel()) {
                 classifer = "NON-OSGI" + classifer;
             }
 
diff --git a/tools/build/libgen/src/main/java/org/onosproject/libgen/BuckLibGenerator.java b/tools/build/libgen/src/main/java/org/onosproject/libgen/BuckLibGenerator.java
index 0fddf1b..b49c7b7 100644
--- a/tools/build/libgen/src/main/java/org/onosproject/libgen/BuckLibGenerator.java
+++ b/tools/build/libgen/src/main/java/org/onosproject/libgen/BuckLibGenerator.java
@@ -55,6 +55,8 @@
     private final List<BuckArtifact> artifacts = new ArrayList<>();
     private final List<BuckLibrary> libraries = new ArrayList<>();
 
+    private static boolean generateForBazel = false;
+
     /**
      * Main entry point.
      *
@@ -66,6 +68,10 @@
             System.exit(5);
         }
 
+        if (args.length == 3 && "--bazel".equals(args[2])) {
+            generateForBazel = true;
+        }
+
         // Parse args
         String jsonFilePath = args[0];
         String outputBuckPath = args[1];
@@ -107,14 +113,14 @@
         System.out.flush();
         BuckArtifact buckArtifact;
         if (uri.startsWith("http")) {
-            String sha = getHttpSha(name, uri);
-            buckArtifact = BuckArtifact.getArtifact(name, uri, sha);
+            String sha = generateForBazel ? getHttpSha256(name, uri) : getHttpSha1(name, uri);
+            buckArtifact = BuckArtifact.getArtifact(name, uri, sha, generateForBazel);
         } else if (uri.startsWith("mvn")) {
             uri = uri.replaceFirst("mvn:", "");
 //            if (repo != null) {
 //                System.out.println(name + " " + repo);
 //            }
-            buckArtifact = AetherResolver.getArtifact(name, uri, repo);
+            buckArtifact = AetherResolver.getArtifact(name, uri, repo, generateForBazel);
         } else {
             throw new RuntimeException("Unsupported artifact uri: " + uri);
         }
@@ -145,7 +151,7 @@
             libraryTargets.add(name);
         });
 
-        return BuckLibrary.getLibrary(libraryName, libraryTargets);
+        return BuckLibrary.getLibrary(libraryName, libraryTargets, generateForBazel);
     }
 
     public BuckLibGenerator resolve() {
@@ -170,6 +176,27 @@
         return this;
     }
 
+    private String generateArtifacts() {
+        StringBuilder sb = new StringBuilder();
+        if (!generateForBazel) {
+            artifacts.forEach(artifact -> sb.append(artifact.getBuckFragment()));
+        } else {
+            StringBuilder mavenJars = new StringBuilder();
+            StringBuilder javaLibraries = new StringBuilder();
+
+            mavenJars.append("def generated_maven_jars():\n");
+            javaLibraries.append("def generated_java_libraries():\n");
+
+            artifacts.forEach(artifact -> {
+                mavenJars.append(artifact.getBazelMavenJarFragment());
+                javaLibraries.append(artifact.getBazelJavaLibraryFragment());
+            });
+
+            sb.append(mavenJars).append(javaLibraries);
+        }
+        return sb.toString();
+    }
+
     void write(String outputFilePath) {
         DateTimeFormatter formatter = DateTimeFormatter.RFC_1123_DATE_TIME.withZone(ZoneId.of("UTC"));
         File outputFile = new File(outputFilePath);
@@ -182,17 +209,19 @@
                     formatter.format(Instant.now())));
             writer.write("# ***** Use onos-lib-gen *****\n");
 
-            // rule to publish the onos dependency pom
-            writer.write("\npass_thru_pom(\n" +
-                         "    name = 'onos-dependencies-pom',\n" +
-                         "    src = 'pom.xml',\n" +
-                         "    out = 'onos-dependencies.pom',\n" +
-                         "    artifactId = 'onos-dependencies',\n" +
-                         ")\n\n");
+            if (!generateForBazel) {
+                // TODO - have to do this somehow for bazel
+                // rule to publish the onos dependency pom
+                writer.write("\npass_thru_pom(\n" +
+                        "    name = 'onos-dependencies-pom',\n" +
+                        "    src = 'pom.xml',\n" +
+                        "    out = 'onos-dependencies.pom',\n" +
+                        "    artifactId = 'onos-dependencies',\n" +
+                        ")\n\n");
+            }
 
-
-            libraries.forEach(library -> writer.print(library.getBuckFragment()));
-            artifacts.forEach(artifact -> writer.print(artifact.getBuckFragment()));
+            libraries.forEach(library -> writer.print(library.getFragment()));
+            writer.print(generateArtifacts());
             writer.flush();
         } catch (FileNotFoundException e) {
             error("File not found: %s", outputFilePath);
@@ -202,10 +231,18 @@
         }
     }
 
-    String getHttpSha(String name, String urlStr) {
+    String getHttpSha1(String name, String urlStr) {
+        return getHttpSha(name, urlStr, "SHA-1");
+    }
+
+    String getHttpSha256(String name, String urlStr) {
+        return getHttpSha(name, urlStr, "SHA-256");
+    }
+
+    String getHttpSha(String name, String urlStr, String algorithm) {
         //FIXME need http download cache
         try {
-            MessageDigest md = MessageDigest.getInstance("SHA-1");
+            MessageDigest md = MessageDigest.getInstance(algorithm);
             byte[] buffer = new byte[8192];
 
             URL url = new URL(urlStr);
@@ -225,7 +262,7 @@
                 .filter(File::canRead)
                 .findAny();
 
-            if (cache.isPresent()) {
+            if (cache.isPresent() && !generateForBazel) {
                 try (FileInputStream stream = new FileInputStream(cache.get())) {
                     int read;
                     while ((read = stream.read(buffer)) >= 0) {
diff --git a/tools/build/libgen/src/main/java/org/onosproject/libgen/BuckLibrary.java b/tools/build/libgen/src/main/java/org/onosproject/libgen/BuckLibrary.java
index df33c0f..b082aa3 100644
--- a/tools/build/libgen/src/main/java/org/onosproject/libgen/BuckLibrary.java
+++ b/tools/build/libgen/src/main/java/org/onosproject/libgen/BuckLibrary.java
@@ -28,24 +28,73 @@
 
     private final String name;
     private final List<String> targets;
+    private final boolean generateForBazel;
 
     private final Set<Artifact> provided = new HashSet<>();
     private final Set<Artifact> runtime = new HashSet<>();
 
-    public static BuckLibrary getLibrary(String libraryName, List<String> libraryTargets) {
-        return new BuckLibrary(libraryName, libraryTargets);
+    public static BuckLibrary getLibrary(String libraryName, List<String> libraryTargets, boolean generateForBazel) {
+        return new BuckLibrary(libraryName, libraryTargets, generateForBazel);
     }
 
-    private BuckLibrary(String name, List<String> targets) {
+    private BuckLibrary(String name, List<String> targets, boolean generateForBazel) {
         this.name = name;
         this.targets = targets;
+        this.generateForBazel = generateForBazel;
+    }
+
+    private String normalizeName(String name) {
+        if (!name.startsWith("//")) {
+            return name.replaceAll("[.-]", "_");
+        } else {
+            return name;
+        }
+    }
+
+    private String convertBuckTargetName(String buckTargetName) {
+        return normalizeName((buckTargetName.startsWith("//") ?
+                buckTargetName : buckTargetName.replaceFirst(":", "@")));
+    }
+
+    private boolean isAllUpper(String s) {
+        return s.toUpperCase().equals(s);
     }
 
     public String name() {
-        return name;
+        if (!generateForBazel) {
+            return name;
+        } else {
+            return normalizeName(name);
+        }
     }
 
-    public String getBuckFragment() {
+    public String getFragment() {
+        if (generateForBazel) {
+            return getBazelFragment();
+        } else {
+            return getBuckFragment();
+        }
+    }
+
+    private String getBazelFragment() {
+        StringBuilder output = new StringBuilder()
+                .append(name())
+                .append(" = [");
+
+        targets.forEach(target -> {
+            if (isAllUpper(target)) {
+                output.append(String.format("] + %s + [", target.replaceFirst(":", "")));
+            } else {
+                String pathEnd = target.startsWith("//") ? "" : "//jar";
+                output.append(String.format("\n    '%s%s',", convertBuckTargetName(target), pathEnd));
+            }
+        });
+        output.append("\n]\n");
+
+        return output.toString();
+    }
+
+    private String getBuckFragment() {
         StringBuilder output = new StringBuilder()
                 .append("osgi_feature_group(\n")
                 .append(String.format("  name = '%s',\n", name))
diff --git a/tools/build_rules/BUILD b/tools/build_rules/BUILD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/build_rules/BUILD
diff --git a/tools/build_rules/prelude_bazel b/tools/build_rules/prelude_bazel
new file mode 100644
index 0000000..138126c
--- /dev/null
+++ b/tools/build_rules/prelude_bazel
@@ -0,0 +1,7 @@
+load("//tools/build/bazel:generate_workspace.bzl",
+        "generated_java_libraries", "COMPILE", "CORE_DEPS", "JACKSON",
+        "TEST_ADAPTERS", "TEST", "TEST_REST", "METRICS", "KRYO", "NETTY")
+
+load("//tools/build/bazel:osgi-java-library.bzl", "osgi_jar_with_tests", "osgi_jar")
+
+generated_java_libraries()
diff --git a/utils/junit/BUILD b/utils/junit/BUILD
new file mode 100644
index 0000000..13a2068
--- /dev/null
+++ b/utils/junit/BUILD
@@ -0,0 +1,25 @@
+SRC = 'src/main/java/org/onlab/**/'
+TEST_SRC = 'src/test/java/org/onlab/**/'
+
+COMPILE_DEPS = [
+        "@guava//jar",
+        "@slf4j_api//jar",
+        "@hamcrest_all//jar",
+        "@junit//jar",
+]
+
+TEST_DEPS = [
+    "@guava_testlib//jar",
+]
+
+osgi_jar_with_tests(
+    name = 'onlab-junit',
+    srcs = glob([SRC + '*.java']),
+    deps = COMPILE_DEPS,
+    test_srcs = glob([TEST_SRC + '*.java']),
+    test_deps = TEST_DEPS,
+    package_name_root = 'org.onlab',
+    visibility = ["//visibility:public"],
+)
+
+
diff --git a/utils/misc/BUILD b/utils/misc/BUILD
new file mode 100644
index 0000000..3635a41
--- /dev/null
+++ b/utils/misc/BUILD
@@ -0,0 +1,17 @@
+COMPILE_DEPS = COMPILE + JACKSON + [
+        "@kryo//jar",
+        "@metrics_core//jar",
+        "@netty//jar",
+        "@netty_common//jar",
+        "@objenesis//jar",
+]
+
+osgi_jar_with_tests(
+    name = 'onlab-misc',
+    deps = COMPILE_DEPS,
+    package_name_root = 'org.onlab',
+    exclude_tests = ['org.onlab.graph.AbstractGraphPathSearchTest',
+                     'org.onlab.graph.GraphTest',
+                     'org.onlab.util.SlidingWindowCounterTest'],
+    visibility = ["//visibility:public"],
+)
diff --git a/utils/misc/src/test/java/org/onlab/MiscTestSuite.java b/utils/misc/src/test/java/org/onlab/MiscTestSuite.java
new file mode 100644
index 0000000..33eb892
--- /dev/null
+++ b/utils/misc/src/test/java/org/onlab/MiscTestSuite.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2016-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onlab;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.onlab.graph.AbstractEdgeTest;
+import org.onlab.graph.AdjacencyListsGraphTest;
+import org.onlab.graph.BellmanFordGraphSearchTest;
+import org.onlab.graph.BreadthFirstSearchTest;
+import org.onlab.graph.DefaultMutablePathTest;
+import org.onlab.graph.DefaultPathTest;
+import org.onlab.graph.DepthFirstSearchTest;
+import org.onlab.graph.DijkstraGraphSearchTest;
+import org.onlab.graph.DisjointPathPairTest;
+import org.onlab.graph.HeapTest;
+import org.onlab.graph.KShortestPathsSearchTest;
+import org.onlab.graph.LazyKShortestPathsSearchTest;
+import org.onlab.graph.SrlgGraphSearchTest;
+import org.onlab.graph.SuurballeGraphSearchTest;
+import org.onlab.graph.TarjanGraphSearchTest;
+import org.onlab.util.ImmutableByteSequenceTest;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+        AbstractEdgeTest.class,
+        AdjacencyListsGraphTest.class,
+        BellmanFordGraphSearchTest.class,
+        BreadthFirstSearchTest.class,
+        DefaultMutablePathTest.class,
+        DefaultPathTest.class,
+        DepthFirstSearchTest.class,
+        DijkstraGraphSearchTest.class,
+        DisjointPathPairTest.class,
+        HeapTest.class,
+        KShortestPathsSearchTest.class,
+        LazyKShortestPathsSearchTest.class,
+        SrlgGraphSearchTest.class,
+        SuurballeGraphSearchTest.class,
+        TarjanGraphSearchTest.class,
+        ImmutableByteSequenceTest.class,
+})
+
+public class MiscTestSuite {
+
+}
diff --git a/utils/osgi/BUILD b/utils/osgi/BUILD
new file mode 100644
index 0000000..91dd172
--- /dev/null
+++ b/utils/osgi/BUILD
@@ -0,0 +1,8 @@
+COMPILE_DEPS = COMPILE
+
+osgi_jar_with_tests(
+    name = 'onlab-osgi',
+    deps = COMPILE_DEPS,
+    package_name_root = 'org.onlab',
+    visibility = ["//visibility:public"],
+)
diff --git a/utils/osgiwrap/BUILD b/utils/osgiwrap/BUILD
new file mode 100644
index 0000000..8e1e872
--- /dev/null
+++ b/utils/osgiwrap/BUILD
@@ -0,0 +1,15 @@
+OSGIWRAP_EXECUTABLE = 'osgi-jar'
+
+COMPILE_DEPS = [
+    '@guava//jar',
+    '@bndlib//jar',
+    '@org_apache_felix_scr_bnd//jar'
+]
+
+java_binary(
+    name = OSGIWRAP_EXECUTABLE,
+    srcs = glob(['src/main/java/**/*.java']),
+    deps = COMPILE_DEPS,
+    main_class = 'org.onlab.osgiwrap.OSGiWrapper',
+    visibility = ["//visibility:public"]
+)
diff --git a/utils/osgiwrap/src/main/java/org/onlab/osgiwrap/OSGiWrapper.java b/utils/osgiwrap/src/main/java/org/onlab/osgiwrap/OSGiWrapper.java
index 8a10992..fe286cb 100644
--- a/utils/osgiwrap/src/main/java/org/onlab/osgiwrap/OSGiWrapper.java
+++ b/utils/osgiwrap/src/main/java/org/onlab/osgiwrap/OSGiWrapper.java
@@ -74,10 +74,11 @@
     private String bundleLicense;
 
     private String webContext;
+    private String destdir;
 
     // FIXME should consider using Commons CLI, etc.
     public static void main(String[] args) {
-        if (args.length < 12) {
+        if (args.length < 13) {
             System.err.println("Not enough args");
             System.exit(1);
         }
@@ -94,6 +95,7 @@
         String includeResources = args[9];
         String webContext = args[10];
         String dynamicimportPackages = args[11];
+        String destdir = args[12];
         String desc = Joiner.on(' ').join(Arrays.copyOfRange(args, 12, args.length));
 
         OSGiWrapper wrapper = new OSGiWrapper(jar, output, cp,
@@ -103,7 +105,8 @@
                                               includeResources,
                                               webContext,
                                               dynamicimportPackages,
-                                              desc);
+                                              desc,
+                                              destdir);
         wrapper.log(wrapper + "\n");
         if (!wrapper.execute()) {
             System.err.printf("Error generating %s\n", name);
@@ -124,7 +127,8 @@
                        String includeResources,
                        String webContext,
                        String dynamicimportPackages,
-                       String bundleDescription) {
+                       String bundleDescription,
+                       String destdir) {
         this.inputJar = inputJar;
         this.classpath = Lists.newArrayList(classpath.split(":"));
         if (!this.classpath.contains(inputJar)) {
@@ -151,6 +155,7 @@
         }
 
         this.webContext = webContext;
+        this.destdir = destdir;
     }
 
     private void setProperties(Analyzer analyzer) {
@@ -209,6 +214,8 @@
 
             // Scan the JAR for Felix SCR annotations and generate XML files
             Map<String, String> properties = Maps.newHashMap();
+            // destdir hack
+            properties.put("destdir", destdir);
             SCRDescriptorBndPlugin scrDescriptorBndPlugin = new SCRDescriptorBndPlugin();
             scrDescriptorBndPlugin.setProperties(properties);
             scrDescriptorBndPlugin.setReporter(analyzer);
diff --git a/utils/rest/BUILD b/utils/rest/BUILD
new file mode 100644
index 0000000..0538ba6
--- /dev/null
+++ b/utils/rest/BUILD
@@ -0,0 +1,13 @@
+COMPILE_DEPS = COMPILE + JACKSON + [
+  "//utils/osgi:onlab-osgi",
+  "//utils/misc:onlab-misc",
+  "@javax_ws_rs_api//jar",
+  "@jersey_server//jar",
+]
+
+osgi_jar(
+    name = 'onlab-rest',
+    deps = COMPILE_DEPS,
+    package_name_root = 'org.onlab',
+    visibility = ["//visibility:public"],
+)