[WIP] Upgrade ONOS to karaf version 4.2.1

Change-Id: I7cd40c995bdf1c80f94b1895fb3344e32404c7fa
diff --git a/tools/build/bazel/generate_workspace.bzl b/tools/build/bazel/generate_workspace.bzl
index 44da091..ba08e48 100644
--- a/tools/build/bazel/generate_workspace.bzl
+++ b/tools/build/bazel/generate_workspace.bzl
@@ -1,4 +1,4 @@
-# ***** This file was auto-generated at Mon, 10 Sep 2018 20:10:18 GMT. Do not edit this file manually. *****
+# ***** This file was auto-generated at Wed, 26 Sep 2018 23:17:38 GMT. Do not edit this file manually. *****
 # ***** Use onos-lib-gen *****
 
 load("//tools/build/bazel:variables.bzl", "ONOS_GROUP_ID", "ONOS_VERSION")
@@ -17,13 +17,14 @@
     "@com_google_guava_guava//jar",
     "@slf4j_api//jar",
     "@osgi_core//jar",
-    "@org_osgi_compendium//jar",
-    "@org_apache_felix_scr_annotations//jar",
-    "@org_apache_felix_scr//jar",
+    "@org_osgi_util_promise//jar",
+    "@org_osgi_service_component//jar",
+    "@org_osgi_service_component_annotations//jar",
+    "@org_osgi_service_metatype_annotations//jar",
     "@org_apache_karaf_features_core//jar",
     "@org_apache_karaf_system_core//jar",
-    "@com_google_code_findbugs_jsr305//jar",
     "@org_apache_servicemix_bundles_dom4j//jar",
+    "@com_google_code_findbugs_jsr305//jar",
 ]
 CORE_DEPS = [] + COMPILE + [
     "//core/api:onos-api",
@@ -97,7 +98,7 @@
     "@objenesis//jar",
 ]
 CLI = [
-    "@org_apache_karaf_shell_console//jar",
+    "@org_apache_karaf_shell_core//jar",
     "//cli:onos-cli",
 ]
 REST = [
@@ -150,9 +151,9 @@
     if "asm" not in native.existing_rules():
         java_import_external(
             name = "asm",
-            jar_sha256 = "896618ed8ae62702521a78bc7be42b7c491a08e6920a15f89a3ecdec31e9a220",
+            jar_sha256 = "3e5ea0d7da2c5155ef4f470d9092d42de34e3f53db6589c7c07d6721adf4ba3e",
             licenses = ["notice"],
-            jar_urls = ["http://repo1.maven.org/maven2/org/ow2/asm/asm/5.0.4/asm-5.0.4.jar"],        )
+            jar_urls = ["http://repo1.maven.org/maven2/org/ow2/asm/asm/5.2/asm-5.2.jar"],        )
     if "atomix" not in native.existing_rules():
         java_import_external(
             name = "atomix",
@@ -237,12 +238,6 @@
             jar_sha256 = "f877d304660ac2a142f3865badfc971dec7ed73c747c7f8d5d2f5139ca736513",
             licenses = ["notice"],
             jar_urls = ["http://repo1.maven.org/maven2/commons-io/commons-io/2.6/commons-io-2.6.jar"],        )
-    if "commons_jxpath" not in native.existing_rules():
-        java_import_external(
-            name = "commons_jxpath",
-            jar_sha256 = "fcbc0ad917d9d6a73c6df21fac322e00d213ef19cd94815a007c407a8a3ff449",
-            licenses = ["notice"],
-            jar_urls = ["http://repo1.maven.org/maven2/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar"],        )
     if "commons_beanutils" not in native.existing_rules():
         java_import_external(
             name = "commons_beanutils",
@@ -546,39 +541,45 @@
     if "jetty_util" not in native.existing_rules():
         java_import_external(
             name = "jetty_util",
-            jar_sha256 = "142328025e98dbe91e89b1f0cbd747277d4121dfb0519d946b1a1d0f7fc564a9",
+            jar_sha256 = "936e5ed74275c16164cc1eccaeae55900eb00edd9f1b1d3b83d70782dd25f505",
             licenses = ["notice"],
-            jar_urls = ["http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-util/9.2.21.v20170120/jetty-util-9.2.21.v20170120.jar"],        )
+            jar_urls = ["http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-util/9.4.11.v20180605/jetty-util-9.4.11.v20180605.jar"],        )
+    if "jetty_websocket_api" not in native.existing_rules():
+        java_import_external(
+            name = "jetty_websocket_api",
+            jar_sha256 = "924edcf7fb17f2ff2e541afce7fd692305235e51b5a16f7223d7e8b4de77559d",
+            licenses = ["notice"],
+            jar_urls = ["http://repo1.maven.org/maven2/org/eclipse/jetty/websocket/websocket-api/9.4.11.v20180605/websocket-api-9.4.11.v20180605.jar"],        )
     if "jetty_websocket" not in native.existing_rules():
         java_import_external(
             name = "jetty_websocket",
-            jar_sha256 = "c8c07c9200cc8e3353efa6d9505e8ae4405107c84c282fd595ad83738570a5b8",
+            jar_sha256 = "76f52b482ad174944e07f552cbfaaa2ccf498063e0a3837bb930eee8a06373aa",
             licenses = ["notice"],
-            jar_urls = ["http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-websocket/8.1.19.v20160209/jetty-websocket-8.1.19.v20160209.jar"],        )
+            jar_urls = ["http://repo1.maven.org/maven2/org/eclipse/jetty/websocket/websocket-servlet/9.4.11.v20180605/websocket-servlet-9.4.11.v20180605.jar"],        )
     if "jetty_server" not in native.existing_rules():
         java_import_external(
             name = "jetty_server",
-            jar_sha256 = "b47f7bdf72133e7dfd30fc8ae6f08080f2a808026102bd194b70bba98fd5fa7e",
+            jar_sha256 = "b74af5ac482b05c242ed231e00b7c08a0b6649f76f2e039a0885de0cf1376ef8",
             licenses = ["notice"],
-            jar_urls = ["http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-server/9.2.21.v20170120/jetty-server-9.2.21.v20170120.jar"],        )
+            jar_urls = ["http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-server/9.4.11.v20180605/jetty-server-9.4.11.v20180605.jar"],        )
     if "jetty_continuation" not in native.existing_rules():
         java_import_external(
             name = "jetty_continuation",
-            jar_sha256 = "fb20fe3c416d1f1e24652ab47d2447e2b7a5660c9eb7df558d2d94fa57f01808",
+            jar_sha256 = "0af8353dbe4ab06fb0020a380be60b2c2a63cd9430f5f199509ecd51dc3dd7cd",
             licenses = ["notice"],
-            jar_urls = ["http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-continuation/9.2.21.v20170120/jetty-continuation-9.2.21.v20170120.jar"],        )
+            jar_urls = ["http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-continuation/9.4.11.v20180605/jetty-continuation-9.4.11.v20180605.jar"],        )
     if "jetty_http" not in native.existing_rules():
         java_import_external(
             name = "jetty_http",
-            jar_sha256 = "aa6d9a264789f7f81da2267bc6472ec5ba3e42295fcab2d3e4df31ecd0afb608",
+            jar_sha256 = "963b75730aa92b0dfbe65fe8a2e413edc88aeb53e8686ba6b1617d7caeb14067",
             licenses = ["notice"],
-            jar_urls = ["http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-http/9.2.21.v20170120/jetty-http-9.2.21.v20170120.jar"],        )
+            jar_urls = ["http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-http/9.4.11.v20180605/jetty-http-9.4.11.v20180605.jar"],        )
     if "jetty_io" not in native.existing_rules():
         java_import_external(
             name = "jetty_io",
-            jar_sha256 = "8876d060969e0ea6d761cca5fdab9be703c85b2c9310ea638e5188ab540ebaea",
+            jar_sha256 = "75c82d6e542a3518e2517c4084c83d8216ec2d2458f8747b8b5c944355ebd732",
             licenses = ["notice"],
-            jar_urls = ["http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-io/9.2.21.v20170120/jetty-io-9.2.21.v20170120.jar"],        )
+            jar_urls = ["http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-io/9.4.11.v20180605/jetty-io-9.4.11.v20180605.jar"],        )
     if "javax_servlet_api" not in native.existing_rules():
         java_import_external(
             name = "javax_servlet_api",
@@ -759,36 +760,66 @@
             jar_sha256 = "b5bd490435fd6910ac9d2e0f1b2d71c68d9ff7261bfd0e70c4a0f8ea970c2785",
             licenses = ["notice"],
             jar_urls = ["http://repo1.maven.org/maven2/org/onosproject/openflowj/3.2.1.onos/openflowj-3.2.1.onos.jar"],        )
-    if "org_apache_felix_framework_security" not in native.existing_rules():
+    if "org_osgi_util_function" not in native.existing_rules():
         java_import_external(
-            name = "org_apache_felix_framework_security",
-            jar_sha256 = "53e1333f563b8b00dfb953802ebbc1b91e4bfe2278b79ebdc0e561d46ccb50db",
+            name = "org_osgi_util_function",
+            jar_sha256 = "83d52d198f8bdd4cd9a02ecb7f05e01e0d59d1c960256db6dccd16962f79d7c5",
             licenses = ["notice"],
-            jar_urls = ["http://repo1.maven.org/maven2/org/onosproject/org.apache.felix.framework.security/2.2.0.onos/org.apache.felix.framework.security-2.2.0.onos.jar"],        )
-    if "org_apache_felix_scr" not in native.existing_rules():
+            jar_urls = ["http://repo1.maven.org/maven2/org/osgi/org.osgi.util.function/1.1.0/org.osgi.util.function-1.1.0.jar"],        )
+    if "org_osgi_util_promise" not in native.existing_rules():
         java_import_external(
-            name = "org_apache_felix_scr",
-            jar_sha256 = "19d395d8800d5546397211edc209e2e42d0ee500c93aca9d04ce69e4288f41d9",
+            name = "org_osgi_util_promise",
+            jar_sha256 = "a679e25688e84e1739831e8716a2cc7acbf8348e22f1136d1988e34472e43756",
             licenses = ["notice"],
-            jar_urls = ["http://repo1.maven.org/maven2/org/apache/felix/org.apache.felix.scr/1.8.2/org.apache.felix.scr-1.8.2.jar"],        )
-    if "org_apache_felix_scr_annotations" not in native.existing_rules():
+            jar_urls = ["http://repo1.maven.org/maven2/org/osgi/org.osgi.util.promise/1.1.0/org.osgi.util.promise-1.1.0.jar"],        )
+    if "org_osgi_service_component" not in native.existing_rules():
         java_import_external(
-            name = "org_apache_felix_scr_annotations",
-            jar_sha256 = "c1d6895b5f45351dfbc4290698aeab00ad013339067abfbe73c047b795e72c47",
+            name = "org_osgi_service_component",
+            jar_sha256 = "607b85148c03e9385b91dd355200aeda3cbfaa6374edba737a9460aac5d576e1",
             licenses = ["notice"],
-            jar_urls = ["http://repo1.maven.org/maven2/org/apache/felix/org.apache.felix.scr.annotations/1.9.12/org.apache.felix.scr.annotations-1.9.12.jar"],        )
+            jar_urls = ["http://repo1.maven.org/maven2/org/osgi/org.osgi.service.component/1.4.0/org.osgi.service.component-1.4.0.jar"],        )
+    if "org_osgi_service_component_annotations" not in native.existing_rules():
+        java_import_external(
+            name = "org_osgi_service_component_annotations",
+            jar_sha256 = "8de7c6753f00edc81df24059dcd2efd67fedcd9b020bbcc6aaa170f4a34c010c",
+            licenses = ["notice"],
+            jar_urls = ["http://repo1.maven.org/maven2/org/osgi/org.osgi.service.component.annotations/1.4.0/org.osgi.service.component.annotations-1.4.0.jar"],        )
+    if "org_osgi_service_metatype_annotations" not in native.existing_rules():
+        java_import_external(
+            name = "org_osgi_service_metatype_annotations",
+            jar_sha256 = "c768e569389a25ce0ef2ce32ce9de05624ec093f2f275ce430da573aba554bcb",
+            licenses = ["notice"],
+            jar_urls = ["http://repo1.maven.org/maven2/org/osgi/org.osgi.service.metatype.annotations/1.4.0/org.osgi.service.metatype.annotations-1.4.0.jar"],        )
+    if "org_osgi_service_cm" not in native.existing_rules():
+        java_import_external(
+            name = "org_osgi_service_cm",
+            jar_sha256 = "c1768352603abdeb18ca160ac8c712768f88d2e418fe4c5cf50845e783154233",
+            licenses = ["notice"],
+            jar_urls = ["http://repo1.maven.org/maven2/org/osgi/org.osgi.service.cm/1.6.0/org.osgi.service.cm-1.6.0.jar"],        )
+    if "org_apache_felix_scr_bnd" not in native.existing_rules():
+        java_import_external(
+            name = "org_apache_felix_scr_bnd",
+            jar_sha256 = "fee253dd67f87481c1d29f5ba6e6158604f722eac8b35bce868e3693ee00ccac",
+            licenses = ["notice"],
+            jar_urls = ["http://repo1.maven.org/maven2/org/apache/felix/org.apache.felix.scr.bnd/1.9.0/org.apache.felix.scr.bnd-1.9.0.jar"],        )
     if "org_apache_karaf_features_core" not in native.existing_rules():
         java_import_external(
             name = "org_apache_karaf_features_core",
-            jar_sha256 = "d958d6bdf747576d5a8a878196aabf75dff00d47ccd8eaaa083685ba4394e86d",
+            jar_sha256 = "c659659cd095c6c7026d4f99ebbc5fa946f0177f750e33fca0410cf83d657137",
             licenses = ["notice"],
-            jar_urls = ["http://repo1.maven.org/maven2/org/apache/karaf/features/org.apache.karaf.features.core/3.0.8/org.apache.karaf.features.core-3.0.8.jar"],        )
+            jar_urls = ["http://repo1.maven.org/maven2/org/apache/karaf/features/org.apache.karaf.features.core/4.2.1/org.apache.karaf.features.core-4.2.1.jar"],        )
     if "org_apache_karaf_shell_console" not in native.existing_rules():
         java_import_external(
             name = "org_apache_karaf_shell_console",
-            jar_sha256 = "fbaf38c8dcc5a86116c01c863f0360cab025fbc6b40a08e6823c969c959da716",
+            jar_sha256 = "c87ef5c61745456ded1b2c7652071c83f45de6f3af95b7e290eebafb10870aa3",
             licenses = ["notice"],
-            jar_urls = ["http://repo1.maven.org/maven2/org/apache/karaf/shell/org.apache.karaf.shell.console/3.0.8/org.apache.karaf.shell.console-3.0.8.jar"],        )
+            jar_urls = ["http://repo1.maven.org/maven2/org/apache/karaf/shell/org.apache.karaf.shell.console/4.2.1/org.apache.karaf.shell.console-4.2.1.jar"],        )
+    if "org_apache_karaf_shell_core" not in native.existing_rules():
+        java_import_external(
+            name = "org_apache_karaf_shell_core",
+            jar_sha256 = "7da0d63b450c24c221280be764eae9d117f296c1b5a7e10d424ba14c32f733c8",
+            licenses = ["notice"],
+            jar_urls = ["http://repo1.maven.org/maven2/org/apache/karaf/shell/org.apache.karaf.shell.core/4.2.1/org.apache.karaf.shell.core-4.2.1.jar"],        )
     if "org_apache_httpcomponents_httpasyncclient_osgi" not in native.existing_rules():
         java_import_external(
             name = "org_apache_httpcomponents_httpasyncclient_osgi",
@@ -804,15 +835,15 @@
     if "org_apache_karaf_jaas" not in native.existing_rules():
         java_import_external(
             name = "org_apache_karaf_jaas",
-            jar_sha256 = "c9a0ceba8661947b4f16b3b5d2e9582d75678b315aabd91956d5fdfc3d83b021",
+            jar_sha256 = "86da483352205879822cc014884cf29a54dccc7f9eb19d9c4513b43e1ed7cf25",
             licenses = ["notice"],
-            jar_urls = ["http://repo1.maven.org/maven2/org/apache/karaf/jaas/org.apache.karaf.jaas.modules/3.0.8/org.apache.karaf.jaas.modules-3.0.8.jar"],        )
+            jar_urls = ["http://repo1.maven.org/maven2/org/apache/karaf/jaas/org.apache.karaf.jaas.modules/4.2.1/org.apache.karaf.jaas.modules-4.2.1.jar"],        )
     if "org_apache_karaf_system_core" not in native.existing_rules():
         java_import_external(
             name = "org_apache_karaf_system_core",
-            jar_sha256 = "3e1397c8b09a90ddb591e0815371ffd962d244747c3ddd2dc475f312610cc21b",
+            jar_sha256 = "13a1eafe91f5fd731f0f691b2a9557b7246d5f39d5cfe1ad0913199295efcefe",
             licenses = ["notice"],
-            jar_urls = ["http://repo1.maven.org/maven2/org/apache/karaf/system/org.apache.karaf.system.core/3.0.8/org.apache.karaf.system.core-3.0.8.jar"],        )
+            jar_urls = ["http://repo1.maven.org/maven2/org/apache/karaf/system/org.apache.karaf.system.core/4.2.1/org.apache.karaf.system.core-4.2.1.jar"],        )
     if "org_apache_servicemix_bundles_snmp4j" not in native.existing_rules():
         java_import_external(
             name = "org_apache_servicemix_bundles_snmp4j",
@@ -825,6 +856,12 @@
             jar_sha256 = "f1ef32cc1530f4e66aac606c24363b627ace4780a7737b045bfb3b908d801bcd",
             licenses = ["notice"],
             jar_urls = ["http://repo1.maven.org/maven2/org/osgi/org.osgi.compendium/5.0.0/org.osgi.compendium-5.0.0.jar"],        )
+    if "org_osgi_cmpn" not in native.existing_rules():
+        java_import_external(
+            name = "org_osgi_cmpn",
+            jar_sha256 = "8e6445afe1abb3dcd43c60c8cd6c0f15b052a8f4228812559ba521c5ce91db34",
+            licenses = ["notice"],
+            jar_urls = ["http://repo1.maven.org/maven2/org/osgi/osgi.cmpn/7.0.0/osgi.cmpn-7.0.0.jar"],        )
     if "osgi_core" not in native.existing_rules():
         java_import_external(
             name = "osgi_core",
@@ -834,9 +871,9 @@
     if "reflectasm" not in native.existing_rules():
         java_import_external(
             name = "reflectasm",
-            jar_sha256 = "eef46e43a6861cdbb3356295644341a48d9a4c1cf753eb5f03cf7bff3a07d180",
+            jar_sha256 = "7cd978191b9ff6159810a8ab4646a3e696388c5c41ce25ffcc554d4ec77f3a93",
             licenses = ["notice"],
-            jar_urls = ["http://repo1.maven.org/maven2/com/esotericsoftware/reflectasm/1.11.0/reflectasm-1.11.0.jar"],        )
+            jar_urls = ["http://repo1.maven.org/maven2/com/esotericsoftware/reflectasm/1.11.7/reflectasm-1.11.7.jar"],        )
     if "remotetea_oncrpc" not in native.existing_rules():
         java_import_external(
             name = "remotetea_oncrpc",
@@ -939,12 +976,6 @@
             jar_sha256 = "5753628390f7ac1665f813bf610b708cc489f3347b9813389e6c052346527cca",
             licenses = ["notice"],
             jar_urls = ["http://repo1.maven.org/maven2/com/thoughtworks/qdox/qdox/2.0-M3/qdox-2.0-M3.jar"],        )
-    if "org_apache_felix_scr_bnd" not in native.existing_rules():
-        java_import_external(
-            name = "org_apache_felix_scr_bnd",
-            jar_sha256 = "acd4ffafbeb517774b7445c6d38a46af982bb81ae631156ce5817979950a24a6",
-            licenses = ["notice"],
-            jar_urls = ["https://oss.sonatype.org/content/repositories/snapshots/org/onosproject/org.apache.felix.scr.bnd/1.4.1-SNAPSHOT/org.apache.felix.scr.bnd-1.4.1-20160328.235003-2.jar"],        )
     if "snmp_core" not in native.existing_rules():
         java_import_external(
             name = "snmp_core",
@@ -1326,7 +1357,7 @@
 artifact_map = {}
 artifact_map["@aopalliance_repackaged//:aopalliance_repackaged"] = "mvn:org.glassfish.hk2.external:aopalliance-repackaged:jar:2.5.0-b42"
 artifact_map["@amqp_client//:amqp_client"] = "mvn:com.rabbitmq:amqp-client:jar:3.6.1"
-artifact_map["@asm//:asm"] = "mvn:org.ow2.asm:asm:jar:5.0.4"
+artifact_map["@asm//:asm"] = "mvn:org.ow2.asm:asm:jar:5.2"
 artifact_map["@atomix//:atomix"] = "mvn:io.atomix:atomix:jar:3.0.5"
 artifact_map["@atomix_cluster//:atomix_cluster"] = "mvn:io.atomix:atomix-cluster:jar:3.0.5"
 artifact_map["@atomix_gossip//:atomix_gossip"] = "mvn:io.atomix:atomix-gossip:jar:3.0.5"
@@ -1341,7 +1372,6 @@
 artifact_map["@commons_collections//:commons_collections"] = "mvn:commons-collections:commons-collections:jar:3.2.2"
 artifact_map["@commons_configuration//:commons_configuration"] = "mvn:commons-configuration:commons-configuration:jar:1.10"
 artifact_map["@commons_io//:commons_io"] = "mvn:commons-io:commons-io:jar:2.6"
-artifact_map["@commons_jxpath//:commons_jxpath"] = "mvn:commons-jxpath:commons-jxpath:jar:1.3"
 artifact_map["@commons_beanutils//:commons_beanutils"] = "mvn:commons-beanutils:commons-beanutils:jar:1.9.3"
 artifact_map["@fast_classpath_scanner//:fast_classpath_scanner"] = "mvn:io.github.lukehutch:fast-classpath-scanner:jar:2.21"
 artifact_map["@jdom//:jdom"] = "mvn:jdom:jdom:jar:NON-OSGI:1.0"
@@ -1392,12 +1422,13 @@
 artifact_map["@jersey_hk2//:jersey_hk2"] = "mvn:org.glassfish.jersey.inject:jersey-hk2:jar:2.26"
 artifact_map["@jersey_test_framework_core//:jersey_test_framework_core"] = "mvn:org.glassfish.jersey.test-framework:jersey-test-framework-core:jar:NON-OSGI:2.26"
 artifact_map["@jersey_test_framework_jetty//:jersey_test_framework_jetty"] = "mvn:org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-jetty:jar:NON-OSGI:2.26"
-artifact_map["@jetty_util//:jetty_util"] = "mvn:org.eclipse.jetty:jetty-util:jar:9.2.21.v20170120"
-artifact_map["@jetty_websocket//:jetty_websocket"] = "mvn:org.eclipse.jetty:jetty-websocket:jar:8.1.19.v20160209"
-artifact_map["@jetty_server//:jetty_server"] = "mvn:org.eclipse.jetty:jetty-server:jar:9.2.21.v20170120"
-artifact_map["@jetty_continuation//:jetty_continuation"] = "mvn:org.eclipse.jetty:jetty-continuation:jar:9.2.21.v20170120"
-artifact_map["@jetty_http//:jetty_http"] = "mvn:org.eclipse.jetty:jetty-http:jar:9.2.21.v20170120"
-artifact_map["@jetty_io//:jetty_io"] = "mvn:org.eclipse.jetty:jetty-io:jar:9.2.21.v20170120"
+artifact_map["@jetty_util//:jetty_util"] = "mvn:org.eclipse.jetty:jetty-util:jar:9.4.11.v20180605"
+artifact_map["@jetty_websocket_api//:jetty_websocket_api"] = "mvn:org.eclipse.jetty.websocket:websocket-api:jar:9.4.11.v20180605"
+artifact_map["@jetty_websocket//:jetty_websocket"] = "mvn:org.eclipse.jetty.websocket:websocket-servlet:jar:9.4.11.v20180605"
+artifact_map["@jetty_server//:jetty_server"] = "mvn:org.eclipse.jetty:jetty-server:jar:9.4.11.v20180605"
+artifact_map["@jetty_continuation//:jetty_continuation"] = "mvn:org.eclipse.jetty:jetty-continuation:jar:9.4.11.v20180605"
+artifact_map["@jetty_http//:jetty_http"] = "mvn:org.eclipse.jetty:jetty-http:jar:9.4.11.v20180605"
+artifact_map["@jetty_io//:jetty_io"] = "mvn:org.eclipse.jetty:jetty-io:jar:9.4.11.v20180605"
 artifact_map["@javax_servlet_api//:javax_servlet_api"] = "mvn:javax.servlet:javax.servlet-api:jar:3.1.0"
 artifact_map["@joda_time//:joda_time"] = "mvn:joda-time:joda-time:jar:2.9.3"
 artifact_map["@jsch//:jsch"] = "mvn:com.jcraft:jsch:jar:NON-OSGI:0.1.53"
@@ -1428,19 +1459,25 @@
 artifact_map["@io_netty_netty_codec_socks//:io_netty_netty_codec_socks"] = "mvn:io.netty:netty-codec-socks:jar:4.1.27.Final"
 artifact_map["@objenesis//:objenesis"] = "mvn:org.objenesis:objenesis:jar:2.6"
 artifact_map["@openflowj//:openflowj"] = "mvn:org.onosproject:openflowj:jar:3.2.1.onos"
-artifact_map["@org_apache_felix_framework_security//:org_apache_felix_framework_security"] = "mvn:org.onosproject:org.apache.felix.framework.security:jar:2.2.0.onos"
-artifact_map["@org_apache_felix_scr//:org_apache_felix_scr"] = "mvn:org.apache.felix:org.apache.felix.scr:jar:1.8.2"
-artifact_map["@org_apache_felix_scr_annotations//:org_apache_felix_scr_annotations"] = "mvn:org.apache.felix:org.apache.felix.scr.annotations:jar:NON-OSGI:1.9.12"
-artifact_map["@org_apache_karaf_features_core//:org_apache_karaf_features_core"] = "mvn:org.apache.karaf.features:org.apache.karaf.features.core:jar:3.0.8"
-artifact_map["@org_apache_karaf_shell_console//:org_apache_karaf_shell_console"] = "mvn:org.apache.karaf.shell:org.apache.karaf.shell.console:jar:3.0.8"
+artifact_map["@org_osgi_util_function//:org_osgi_util_function"] = "mvn:org.osgi:org.osgi.util.function:jar:1.1.0"
+artifact_map["@org_osgi_util_promise//:org_osgi_util_promise"] = "mvn:org.osgi:org.osgi.util.promise:jar:1.1.0"
+artifact_map["@org_osgi_service_component//:org_osgi_service_component"] = "mvn:org.osgi:org.osgi.service.component:jar:1.4.0"
+artifact_map["@org_osgi_service_component_annotations//:org_osgi_service_component_annotations"] = "mvn:org.osgi:org.osgi.service.component.annotations:jar:1.4.0"
+artifact_map["@org_osgi_service_metatype_annotations//:org_osgi_service_metatype_annotations"] = "mvn:org.osgi:org.osgi.service.metatype.annotations:jar:1.4.0"
+artifact_map["@org_osgi_service_cm//:org_osgi_service_cm"] = "mvn:org.osgi:org.osgi.service.cm:jar:1.6.0"
+artifact_map["@org_apache_felix_scr_bnd//:org_apache_felix_scr_bnd"] = "mvn:org.apache.felix:org.apache.felix.scr.bnd:jar:NON-OSGI:1.9.0"
+artifact_map["@org_apache_karaf_features_core//:org_apache_karaf_features_core"] = "mvn:org.apache.karaf.features:org.apache.karaf.features.core:jar:4.2.1"
+artifact_map["@org_apache_karaf_shell_console//:org_apache_karaf_shell_console"] = "mvn:org.apache.karaf.shell:org.apache.karaf.shell.console:jar:4.2.1"
+artifact_map["@org_apache_karaf_shell_core//:org_apache_karaf_shell_core"] = "mvn:org.apache.karaf.shell:org.apache.karaf.shell.core:jar:4.2.1"
 artifact_map["@org_apache_httpcomponents_httpasyncclient_osgi//:org_apache_httpcomponents_httpasyncclient_osgi"] = "mvn:org.apache.httpcomponents:httpasyncclient-osgi:jar:4.1.2"
 artifact_map["@org_apache_httpcomponents_httpcore_nio//:org_apache_httpcomponents_httpcore_nio"] = "mvn:org.apache.httpcomponents:httpcore-nio:jar:NON-OSGI:4.4.4"
-artifact_map["@org_apache_karaf_jaas//:org_apache_karaf_jaas"] = "mvn:org.apache.karaf.jaas:org.apache.karaf.jaas.modules:jar:3.0.8"
-artifact_map["@org_apache_karaf_system_core//:org_apache_karaf_system_core"] = "mvn:org.apache.karaf.system:org.apache.karaf.system.core:jar:3.0.8"
+artifact_map["@org_apache_karaf_jaas//:org_apache_karaf_jaas"] = "mvn:org.apache.karaf.jaas:org.apache.karaf.jaas.modules:jar:4.2.1"
+artifact_map["@org_apache_karaf_system_core//:org_apache_karaf_system_core"] = "mvn:org.apache.karaf.system:org.apache.karaf.system.core:jar:4.2.1"
 artifact_map["@org_apache_servicemix_bundles_snmp4j//:org_apache_servicemix_bundles_snmp4j"] = "mvn:org.apache.servicemix.bundles:org.apache.servicemix.bundles.snmp4j:jar:2.3.4_1"
 artifact_map["@org_osgi_compendium//:org_osgi_compendium"] = "mvn:org.osgi:org.osgi.compendium:jar:5.0.0"
+artifact_map["@org_osgi_cmpn//:org_osgi_cmpn"] = "mvn:org.osgi:osgi.cmpn:jar:7.0.0"
 artifact_map["@osgi_core//:osgi_core"] = "mvn:org.osgi:org.osgi.core:jar:5.0.0"
-artifact_map["@reflectasm//:reflectasm"] = "mvn:com.esotericsoftware:reflectasm:jar:1.11.0"
+artifact_map["@reflectasm//:reflectasm"] = "mvn:com.esotericsoftware:reflectasm:jar:1.11.7"
 artifact_map["@remotetea_oncrpc//:remotetea_oncrpc"] = "mvn:org.acplt.remotetea:remotetea-oncrpc:jar:1.1.3"
 artifact_map["@rrd4j//:rrd4j"] = "mvn:org.rrd4j:rrd4j:jar:NON-OSGI:3.1"
 artifact_map["@javassist//:javassist"] = "mvn:org.javassist:javassist:jar:3.22.0-GA"
@@ -1458,7 +1495,6 @@
 artifact_map["@bndexe//:bndexe"] = "mvn:biz.aQute.bnd:biz.aQute.bnd:jar:4.0.0"
 artifact_map["@libthrift//:libthrift"] = "mvn:org.apache.thrift:libthrift:jar:0.9.3"
 artifact_map["@qdox//:qdox"] = "mvn:com.thoughtworks.qdox:qdox:jar:NON-OSGI:2.0-M3"
-artifact_map["@org_apache_felix_scr_bnd//:org_apache_felix_scr_bnd"] = "https://oss.sonatype.org/content/repositories/snapshots/org/onosproject/org.apache.felix.scr.bnd/1.4.1-SNAPSHOT/org.apache.felix.scr.bnd-1.4.1-20160328.235003-2.jar"
 artifact_map["@snmp_core//:snmp_core"] = "mvn:org.onosproject:snmp-core:jar:1.3-20161021.1"
 artifact_map["@mibs_net_snmp//:mibs_net_snmp"] = "mvn:org.onosproject:mibbler-mibs-net-snmp:jar:1.0-20151221.1"
 artifact_map["@mibs_rfc//:mibs_rfc"] = "mvn:org.onosproject:mibbler-mibs-rfc:jar:1.0-20151221.1"
diff --git a/tools/build/bazel/osgi_features.bzl b/tools/build/bazel/osgi_features.bzl
index d2c8a1e..30f00a8 100644
--- a/tools/build/bazel/osgi_features.bzl
+++ b/tools/build/bazel/osgi_features.bzl
@@ -102,7 +102,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
           name="onos-%s">
-    <repository>mvn:org.apache.karaf.features/standard/3.0.8/xml/features</repository>
+    <repository>mvn:org.apache.karaf.features/standard/4.2.1/xml/features</repository>
 ''' % ONOS_VERSION
 
 FEATURES_FOOTER = "</features>"
diff --git a/tools/build/bazel/osgi_java_library.bzl b/tools/build/bazel/osgi_java_library.bzl
index bd68a30..91ecc850 100644
--- a/tools/build/bazel/osgi_java_library.bzl
+++ b/tools/build/bazel/osgi_java_library.bzl
@@ -83,6 +83,7 @@
         web_context = "NONE"
     web_xml = ctx.attr.web_xml
     dynamicimportPackages = ""
+    karaf_commands = ctx.attr.karaf_commands
     cp = ""
 
     inputDependencies = [input_file]
@@ -119,6 +120,7 @@
         dynamicimportPackages,
         "classes",
         bundle_classpath,
+        karaf_commands,
     ]
 
     ctx.actions.run(
@@ -151,6 +153,7 @@
         "web_context": attr.string(),
         "web_xml": attr.label_list(allow_files = True),
         "include_resources": attr.string(),
+        "karaf_commands": attr.string(),
         "_bnd_exe": attr.label(
             executable = True,
             cfg = "host",
@@ -384,7 +387,8 @@
         api_description = "",
         api_package = "",
         import_packages = None,
-        bundle_classpath = ""):
+        bundle_classpath = "",
+        karaf_command_packages = []):
     if name == None:
         name = _auto_name()
     if srcs == None:
@@ -410,7 +414,7 @@
 
     native_srcs = srcs
     native_resources = resources
-    if web_context != None and api_title != "" and len(resources) != 0:
+    if web_context != None and api_title != "" and len(resources) != 0 and 1 == 0:
         # generate Swagger files if needed
         _swagger_java(
             name = name + "_swagger_java",
@@ -465,6 +469,7 @@
             javacopts = javacopts,
         )
 
+    karaf_command_packages_string = ",".join(karaf_command_packages)
     _bnd(
         name = name,
         source = name + "-native",
@@ -477,6 +482,7 @@
         web_context = web_context,
         web_xml = web_xml,
         include_resources = _include_resources_to_string(include_resources),
+        karaf_commands = karaf_command_packages_string,
     )
 
     # rule for generating pom file for publishing
@@ -564,7 +570,8 @@
         api_version = "",
         api_description = "",
         api_package = "",
-        bundle_classpath = ""):
+        bundle_classpath = "",
+        karaf_command_packages = []):
     if srcs == None:
         srcs = _all_java_sources()
     if deps == None:
@@ -594,6 +601,7 @@
         api_package = api_package,
         web_context = web_context,
         bundle_classpath = bundle_classpath,
+        karaf_command_packages = karaf_command_packages,
     )
 
 """
@@ -637,7 +645,8 @@
         deps = [],
         group = "org.onosproject",
         visibility = ["//visibility:public"],
-        version = ONOS_VERSION):
+        version = ONOS_VERSION,
+        karaf_command_packages = []):
     if name == None:
         name = _auto_name()
     native.java_proto_library(
@@ -679,4 +688,5 @@
         suppress_errorprone = True,
         suppress_checkstyle = True,
         suppress_javadocs = True,
+        karaf_command_packages = karaf_command_packages,
     )
diff --git a/tools/build/onos-lib-gen b/tools/build/onos-lib-gen
index 3a083f8..82ddc5f 100755
--- a/tools/build/onos-lib-gen
+++ b/tools/build/onos-lib-gen
@@ -21,5 +21,4 @@
     [ -f $JAR ] && printf "Done.\n"
 fi
 
-[ -z "$1" -o "$1" = "bazel" ] && java -jar $JAR lib/deps.json tools/build/bazel/generate_workspace.bzl --bazel
-[ -z "$1" -o "$1" = "buck" ] && java -jar $JAR lib/deps.json lib/BUCK
+[ -z "$1" -o "$1" = "bazel" ] && java -jar $JAR lib/deps.json tools/build/bazel/generate_workspace.bzl --bazel
\ No newline at end of file
diff --git a/tools/build/publish-target-list b/tools/build/publish-target-list
index ca03dec..bf8607c 100644
--- a/tools/build/publish-target-list
+++ b/tools/build/publish-target-list
@@ -12,6 +12,8 @@
     //core/store/dist:onos-core-dist
     //core/store/persistence:onos-core-persistence
     //core/store/serializers:onos-core-serializers
+    //drivers/utilities:onos-drivers-utilities
+    //drivers/nettconf:onos-drivers-netconf
     //incubator/api:onos-incubator-api
     //incubator/net:onos-incubator-net
     //incubator/rpc:onos-incubator-rpc
diff --git a/tools/package/archetypes/bundle/src/main/resources/archetype-resources/src/main/java/AppComponent.java b/tools/package/archetypes/bundle/src/main/resources/archetype-resources/src/main/java/AppComponent.java
index 047561b..6ccc181 100644
--- a/tools/package/archetypes/bundle/src/main/resources/archetype-resources/src/main/java/AppComponent.java
+++ b/tools/package/archetypes/bundle/src/main/resources/archetype-resources/src/main/java/AppComponent.java
@@ -18,10 +18,10 @@
  */
 package ${package};
 
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Service;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Service;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiComponent.java b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiComponent.java
index c59fb64..4522692 100644
--- a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiComponent.java
+++ b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiComponent.java
@@ -19,11 +19,11 @@
 package ${package};
 
 import com.google.common.collect.ImmutableList;
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
 import org.onosproject.ui.UiExtension;
 import org.onosproject.ui.UiExtensionService;
 import org.onosproject.ui.UiMessageHandlerFactory;
@@ -44,7 +44,7 @@
 
     private final Logger log = LoggerFactory.getLogger(getClass());
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
     protected UiExtensionService uiExtensionService;
 
     // List of application views
diff --git a/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/java/AppUiTableComponent.java b/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/java/AppUiTableComponent.java
index 2e82cb6..655fd03 100644
--- a/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/java/AppUiTableComponent.java
+++ b/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/java/AppUiTableComponent.java
@@ -19,11 +19,11 @@
 package ${package};
 
 import com.google.common.collect.ImmutableList;
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
 import org.onosproject.ui.UiExtension;
 import org.onosproject.ui.UiExtensionService;
 import org.onosproject.ui.UiMessageHandlerFactory;
@@ -44,7 +44,7 @@
 
     private final Logger log = LoggerFactory.getLogger(getClass());
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
     protected UiExtensionService uiExtensionService;
 
     // List of application views
diff --git a/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/java/AppUiTopovComponent.java b/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/java/AppUiTopovComponent.java
index 55b1e6f..193e41f 100644
--- a/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/java/AppUiTopovComponent.java
+++ b/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/java/AppUiTopovComponent.java
@@ -19,11 +19,11 @@
 package ${package};
 
 import com.google.common.collect.ImmutableList;
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
 import org.onosproject.ui.UiExtension;
 import org.onosproject.ui.UiExtensionService;
 import org.onosproject.ui.UiMessageHandlerFactory;
@@ -46,7 +46,7 @@
 
     private final Logger log = LoggerFactory.getLogger(getClass());
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
     protected UiExtensionService uiExtensionService;
 
     // List of application views
diff --git a/tools/package/bin/onos-service b/tools/package/bin/onos-service
index d3717ac..467a04a 100755
--- a/tools/package/bin/onos-service
+++ b/tools/package/bin/onos-service
@@ -19,7 +19,7 @@
 # If ONOS_HOME is not set (e.g. in the init or service environment),
 # set it based on this script's path.
 ONOS_HOME=${ONOS_HOME:-$(cd $(dirname $0)/.. >/dev/null 2>&1 && pwd)}
-KARAF_ARGS=
+KARAF_ARGS=server
 SYS_APPS=drivers
 ONOS_APPS=${ONOS_APPS:-}  # Empty means don't activate any new apps
 
@@ -52,4 +52,6 @@
     fi
 done
 
+KARAF_ARGS+=" server"
+
 exec ${ONOS_HOME}/apache-karaf-$KARAF_VERSION/bin/karaf $KARAF_ARGS
diff --git a/tools/package/branding/src/main/resources/org/apache/karaf/branding/branding.properties b/tools/package/branding/src/main/resources/org/apache/karaf/branding/branding.properties
index 69a74ba..e04d327 100644
--- a/tools/package/branding/src/main/resources/org/apache/karaf/branding/branding.properties
+++ b/tools/package/branding/src/main/resources/org/apache/karaf/branding/branding.properties
@@ -27,5 +27,4 @@
 \r\n\
   Hit '\u001B[1m<tab>\u001B[0m' for a list of available commands\r\n\
      and '\u001B[1m[cmd] --help\u001B[0m' for help on a specific command.\r\n\
-  Hit '\u001B[1m<ctrl-d>\u001B[0m' or type '\u001B[1msystem:shutdown\u001B[0m' or '\u001B[1mlogout\u001B[0m' to shutdown ONOS.\r\n
-prompt = \u001B[32monos> \u001B[0m
+  Hit '\u001B[1m<ctrl-d>\u001B[0m' or type '\u001B[1mlogout\u001B[0m' to exit ONOS session.\r\n
diff --git a/tools/package/etc/keys.properties b/tools/package/etc/keys.properties
new file mode 100644
index 0000000..463a0bb
--- /dev/null
+++ b/tools/package/etc/keys.properties
@@ -0,0 +1,35 @@
+################################################################################
+#
+#    Licensed to the Apache Software Foundation (ASF) under one or more
+#    contributor license agreements.  See the NOTICE file distributed with
+#    this work for additional information regarding copyright ownership.
+#    The ASF licenses this file to You 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.
+#
+################################################################################
+
+#
+# This file contains the valid users who can log into Karaf. Each line have to be of
+# the format:
+#
+# USER=KEY,ROLE1,ROLE2,...
+#
+# All users and roles entered in this file are available after Karaf startup
+# and modifiable via the JAAS command group. These users reside in a JAAS domain
+# with the name "karaf"..
+#
+
+#
+# For security reason, the default auto-signed key is disabled.
+# The user guide describes how to generate/update the key.
+#
+_g_\:admingroup = group,admin,manager,viewer,systembundles,ssh
diff --git a/tools/package/etc/org.apache.karaf.features.cfg b/tools/package/etc/org.apache.karaf.features.cfg
new file mode 100644
index 0000000..d986a57
--- /dev/null
+++ b/tools/package/etc/org.apache.karaf.features.cfg
@@ -0,0 +1,107 @@
+################################################################################
+#
+#    Licensed to the Apache Software Foundation (ASF) under one or more
+#    contributor license agreements.  See the NOTICE file distributed with
+#    this work for additional information regarding copyright ownership.
+#    The ASF licenses this file to You 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.
+#
+################################################################################
+
+#
+# Comma separated list of features repositories to register by default
+#
+featuresRepositories = \
+    mvn:org.apache.karaf.features/standard/4.2.1/xml/features, \
+    mvn:org.onosproject/onos-features/$ONOS_VERSION/xml/features, \
+    mvn:org.apache.karaf.features/enterprise/4.2.1/xml/features, \
+    mvn:org.apache.karaf.features/spring/4.2.1/xml/features, \
+    mvn:org.apache.karaf.features/standard/4.2.1/xml/features, \
+    mvn:org.apache.karaf.features/framework/4.2.1/xml/features
+
+#
+# Comma separated list of features to install at startup
+#
+featuresBoot = \
+    instance/4.2.1, \
+    package/4.2.1, \
+    log/4.2.1, \
+    ssh/4.2.1, \
+    framework/4.2.1, \
+    system/4.2.1, \
+    eventadmin/4.2.1, \
+    feature/4.2.1, \
+    shell/4.2.1, \
+    management/4.2.1, \
+    service/4.2.1, \
+    jaas/4.2.1, \
+    deployer/4.2.1, \
+    diagnostic/4.2.1, \
+    (wrap/2.5.4), \
+    bundle/4.2.1, \
+    config/4.2.1, \
+    kar/4.2.1, \
+    webconsole/4.2.1, \
+    scr/4.2.1, \
+    war/4.2.1, \
+    onos-api, \
+    onos-core, \
+    onos-incubator
+    #onos-cli,
+    #onos-gui,
+    #onos-rest
+
+
+#
+# Resource repositories (OBR) that the features resolver can use
+# to resolve requirements/capabilities
+#
+# The format of the resourceRepositories is
+# resourceRepositories=[xml:url|json:url],...
+# for Instance:
+#
+#resourceRepositories=xml:http://host/path/to/index.xml
+# or
+#resourceRepositories=json:http://host/path/to/index.json
+#
+
+#
+# Defines if the boot features are started in asynchronous mode (in a dedicated thread)
+#
+featuresBootAsynchronous=false
+
+#
+# Service requirements enforcement
+#
+# By default, the feature resolver checks the service requirements/capabilities of
+# bundles for new features (xml schema >= 1.3.0) in order to automatically installs
+# the required bundles.
+# The following flag can have those values:
+#   - disable: service requirements are completely ignored
+#   - default: service requirements are ignored for old features
+#   - enforce: service requirements are always verified
+#
+#serviceRequirements=default
+
+#
+# Store cfg file for config element in feature
+#
+#configCfgStore=true
+
+#
+# Configuration of features processing mechanism (overrides, blacklisting, modification of features)
+# XML file defines instructions related to features processing
+# versions.properties may declare properties to resolve placeholders in XML file
+# both files are relative to ${karaf.etc}
+#
+#featureProcessing=org.apache.karaf.features.xml
+#featureProcessingVersions=versions.properties
diff --git a/tools/package/etc/shell.init.script b/tools/package/etc/shell.init.script
new file mode 100644
index 0000000..ac55755
--- /dev/null
+++ b/tools/package/etc/shell.init.script
@@ -0,0 +1,65 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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.
+//
+// This script is run each time a shell is created.
+// You can define here closures or variables that will be available
+// in each session.
+//
+ld = { log:display $args } ;
+lde = { log:exception-display $args } ;
+la = { bundle:list -t 0 $args } ;
+ls = { service:list $args } ;
+cl = { config:list "(service.pid=$args)" } ;
+halt = { system:shutdown -h -f $args } ;
+help = { *:help $args | more } ;
+man = { help $args } ;
+log:list = { log:get ALL } ;
+service:get = { $.context getService ($.context getServiceReference $args) };
+
+env = { shell:set $args }
+edit = { shell:nano $args }
+more = { shell:less -F $args }
+
+\#prompt = { "${USER}@${APPLICATION} ${SUBSHELL}> "?};
+
+__load_class = {
+  (($.reader class) classLoader) loadClass $1
+}
+
+// make sure that we catch exceptions
+// as they do occur if the session is headless / non-interactive
+jlineReader = $.reader
+if { %(jlineReader != null) } {
+
+  # On 256 colors terminal, add a right prompt
+  max_colors = ($.jline.terminal getNumericCapability max_colors)
+  if { %(max_colors >= 256) } {
+    __rprompt_formatter = (((__load_class java.text.SimpleDateFormat) getConstructor (__load_class java.lang.String)) newInstance \'$'\u001B\[90m'\'HH:mm:ss)
+    __date_class = (__load_class java.util.Date)
+    \#rprompt = { $__rprompt_formatter format ($__date_class newInstance) }
+  }
+
+  setopt group
+  setopt auto-fresh-line
+  unsetopt insert-tab
+  keymap "^[OA" up-line-or-search
+  keymap "^[[A" up-line-or-search
+  keymap "^[OB" down-line-or-search
+  keymap "^[[B" down-line-or-search
+
+}
diff --git a/tools/package/etc/users.properties b/tools/package/etc/users.properties
index 95a97bc..cacc254 100644
--- a/tools/package/etc/users.properties
+++ b/tools/package/etc/users.properties
@@ -28,10 +28,11 @@
 # All users, groups, and roles entered in this file are available after Karaf startup
 # and modifiable via the JAAS command group. These users reside in a JAAS domain
 # with the name "karaf".
-#
 karaf = karaf,_g_:admingroup
 onos = rocks,_g_:admingroup
 guest = guest,_g_:guestgroup
-_g_\:admingroup = group,admin,manager,viewer,webconsole
+
+_g_\:admingroup = group,admin,manager,viewer,systembundles,ssh,webconsole
 _g_\:guestgroup = group,viewer
 
+
diff --git a/tools/package/features/BUILD b/tools/package/features/BUILD
index f8355c0..d9ae32b 100644
--- a/tools/package/features/BUILD
+++ b/tools/package/features/BUILD
@@ -45,10 +45,11 @@
         "@mapdb//jar",
         "@bcpkix_jdk15on//jar",
         "@bcprov_jdk15on//jar",
-        "@commons_jxpath//jar",
         "@commons_beanutils//jar",
         "@jdom//jar",
         "@sigar//jar",
+        "@org_osgi_util_function//jar",
+        "@org_osgi_util_promise//jar",
     ],
     required_features = [],
     visibility = ["//visibility:public"],
@@ -154,6 +155,16 @@
 )
 
 osgi_feature(
+    name = "onos-cli2",
+    description = "stripped down ONOS admin command console components",
+    included_bundles = [
+        "//cli2:onos-cli2",
+    ],
+    required_features = ["onos-api"],
+    visibility = ["//visibility:public"],
+)
+
+osgi_feature(
     name = "onos-gui",
     description = "ONOS GUI console components",
     included_bundles = [
diff --git a/tools/package/onos-prep-karaf b/tools/package/onos-prep-karaf
index 1cc21e2..b77d7e6 100755
--- a/tools/package/onos-prep-karaf
+++ b/tools/package/onos-prep-karaf
@@ -3,17 +3,17 @@
 # Packages ONOS distributable into onos.tar.gz, onos.zip or a deb file
 # -----------------------------------------------------------------------------
 
-set -e
+set -eu -o pipefail
 
 OUT=$1
-KARAF_TAR=$2
+#export HOME=/Users/tom
+KARAF_TAR="$HOME/Downloads/apache-karaf-4.2.1.tar.gz"
 ONOS_VERSION=$3
 BRANDING=$4
 KARAF_PATCHES=$5
 SANDBOX=${6:-.}
 
-#FIXME karaf version
-KARAF_VERSION="3.0.8"
+KARAF_VERSION="4.2.1"
 ONOS_SECURITY_MODE="false"
 
 PREFIX="onos-$ONOS_VERSION"
@@ -22,9 +22,9 @@
 tar xf $KARAF_TAR
 
 # rename path name to match what was distributed with vicci
-mv "$(ls -d apache*)" "apache-karaf-$KARAF_VERSION" || true
+# mv "$(ls -d apache*)" "apache-karaf-$KARAF_VERSION" || true
 
-tar xf $KARAF_PATCHES
+#tar xf $KARAF_PATCHES
 
 # Unroll the Apache Karaf bits, prune them and make ONOS top-level directories.
 KARAF_DIR=$(ls -d apache*)
@@ -43,17 +43,6 @@
 rm -f bin/*.bk
 chmod a+x $SANDBOX/bin/onos-service $SANDBOX/bin/onos
 
-export BOOT_FEATURES="standard,ssh,scr,war,webconsole,onos-api,onos-core,onos-incubator,onos-cli,onos-rest,onos-gui"
-
-# Patch the Apache Karaf distribution file to add ONOS features repository
-perl -pi.old -e "s|^(featuresRepositories=).*|\1mvn:org.apache.karaf.features/standard/$KARAF_VERSION/xml/features,mvn:org.onosproject/onos-features/$ONOS_VERSION/xml/features|" \
-    $KARAF_DIR/etc/org.apache.karaf.features.cfg
-
-# Patch the Apache Karaf distribution file to load default ONOS boot features
-perl -pi.old -e "s|^(featuresBoot ?= ?).*|\1$BOOT_FEATURES|" \
-    $KARAF_DIR/etc/org.apache.karaf.features.cfg
-
-
 # Patch the Apache Karaf distribution with ONOS branding bundle
 cp $BRANDING $KARAF_DIR/lib/onos-tools-package-branding.jar
 
@@ -67,6 +56,9 @@
 cp -r $SANDBOX/init $PREFIX
 cp -r $SANDBOX/etc/* $PREFIX/$KARAF_DIR/etc/
 
+# Fix the onos version string in the features config
+sed -i".VERBACK" -E "s/.ONOS_VERSION/${ONOS_VERSION}/" $PREFIX/$KARAF_DIR/etc/org.apache.karaf.features.cfg
+
 if [ "$ONOS_SECURITY_MODE" = true ]
 then
     # ONOS Patching ----------------------------------------------------------------
diff --git a/tools/package/onos-run-karaf b/tools/package/onos-run-karaf
index b0c371f..7068802 100755
--- a/tools/package/onos-run-karaf
+++ b/tools/package/onos-run-karaf
@@ -7,8 +7,14 @@
 
 [ -f $ONOS_TAR ] || (echo "$ONOS_TAR not found" && exit 1)
 
+
+function killServer() {
+    echo "Killing ONOS server..."
+    ps -e | grep apache.karaf.main.Main | grep -v grep | cut -d\  -f1 | xargs kill -9 &>/dev/null
+}
+
 # Kill any running instances
-[ -f /tmp/onos.pid ] && kill -9 $(cat /tmp/onos.pid) &>/dev/null
+killServer
 
 ONOS_DIR=/tmp/$(tar tf $ONOS_TAR | head -n 1 | cut -d/ -f1)
 ONOS_MD5=$ONOS_DIR/CHECKSUM
@@ -75,15 +81,15 @@
 cd $ONOS_DIR
 export ONOS_HOME=$PWD
 
+# FIXME
+#export HOME=/Users/tom
+cp $HOME/Downloads/reflectasm-1.11.7.jar \
+    $ONOS_DIR/apache-karaf-4.2.1/system/com/esotericsoftware/reflectasm/1.11.7/reflectasm-1.11.7.jar
+
 # Start ONOS as a server, but include any specified options
 ./bin/onos-service server "$@" &>onos.log &
 echo "$!" > /tmp/onos.pid
 
-function killServer() {
-    echo "Killing ONOS server..."
-    cat /tmp/onos.pid | xargs kill -9
-}
-
 # Hang-on a bit and then start tailing the ONOS log output
 MAX_RETRY=30
 echo "Waiting for karaf.log"
diff --git a/tools/package/onos_stage.py b/tools/package/onos_stage.py
index a9f519f..a6b46d4 100755
--- a/tools/package/onos_stage.py
+++ b/tools/package/onos_stage.py
@@ -27,6 +27,8 @@
 
 written_files = set()
 now = time.time()
+karaf_version = "4.2.1"
+karaf_system = "apache-karaf-" + karaf_version + "/system/"
 
 def addFile(tar, dest, file, file_size):
     if dest not in written_files:
@@ -69,7 +71,7 @@
                     for f in zip_part.infolist():
                         dest = f.filename
                         if base not in dest:
-                            dest = base + 'apache-karaf-3.0.8/system/' + f.filename
+                            dest = base + karaf_system + f.filename
                         addFile(output, dest, zip_part.open(f), f.file_size)
             elif '.oar' in file:
                 with ZipFile(file, 'r') as oar:
@@ -82,12 +84,12 @@
                     for f in oar.infolist():
                         filename = f.filename
                         if 'm2' in filename:
-                            dest = base + 'apache-karaf-3.0.8/system/' + filename[3:]
+                            dest = base + karaf_system + filename[3:]
                             if dest not in written_files:
                                 addFile(output, dest, oar.open(f), f.file_size)
                                 written_files.add(dest)
             elif 'features.xml' in file:
-                dest = base + 'apache-karaf-3.0.8/system/org/onosproject/onos-features/%s/' % version
+                dest = base + karaf_system + 'org/onosproject/onos-features/%s/' % version
                 dest += 'onos-features-%s-features.xml' % version
                 with open(file, 'rb') as f:
                     addFile(output, dest, f, os.stat(file).st_size)
diff --git a/tools/test/bin/onos-secure-ssh b/tools/test/bin/onos-secure-ssh
index 45f0401..e62e5dd7 100755
--- a/tools/test/bin/onos-secure-ssh
+++ b/tools/test/bin/onos-secure-ssh
@@ -23,10 +23,11 @@
 
 # ensure known_hosts file exist
 (umask 077; touch "$HOME/.ssh/known_hosts")
-
+set -x
 for node in $nodes; do
     # Setup passwordless login for the local user on the remote node
     ssh $ONOS_USER@$node "
+        set -x
         [ ! -f ~/.ssh/id_rsa.pub ] && ssh-keygen -t rsa -f ~/.ssh/id_rsa -P '' -q
         $ONOS_INSTALL_DIR/bin/onos-user-key \$(id -un) \$(cut -d\\  -f2 ~/.ssh/id_rsa.pub)
         $ONOS_INSTALL_DIR/bin/onos-user-password $user $password