Appify fault management and open stack node BUCK files

Change-Id: I9c1574a8360c377bdc1b52e30f136a46cded0abc
diff --git a/apps/faultmanagement/BUCK b/apps/faultmanagement/BUCK
index c18a118..4553a5f 100644
--- a/apps/faultmanagement/BUCK
+++ b/apps/faultmanagement/BUCK
@@ -1,98 +1,14 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
-COMPILE_DEPS = [
-    '//lib:CORE_DEPS',
-    '//lib:org.apache.karaf.shell.console',
-    '//incubator/api:onos-incubator-api',
-    '//cli:onos-cli',
-    '//utils/rest:onlab-rest',
-    '//lib:javax.ws.rs-api',
-    '//utils/osgi:onlab-osgi',
-    '//core/store/serializers:onos-core-serializers',
+BUNDLES = [
+    '//apps/faultmanagement/fmcli:onos-apps-faultmanagement-fmcli',
+    '//apps/faultmanagement/fmgui:onos-apps-faultmanagement-fmgui',
+    '//apps/faultmanagement/fmmgr:onos-apps-faultmanagement-fmmgr',
+    '//apps/faultmanagement/fmweb:onos-apps-faultmanagement-fmweb',
 ]
 
-TEST_DEPS = [
-    '//lib:TEST_ADAPTERS',
-    '//lib:jersey-test-framework-core',
-    '//lib:jersey-test-framework-jetty',
-    '//utils/osgi:onlab-osgi-tests',
-    '//web/api:onos-rest-tests',
-    '//incubator/api:onos-incubator-api-tests',
-]
-
-java_library(
-   name = 'onos-app-fm',
-   visibility = ['PUBLIC'],
-   deps = [':fmcli', ':fmgui', ':fmmgr', ':fmweb'],
-)
-
-java_library(
-    name = 'fmcli',
-    srcs = glob(['fmcli/' + SRC + '*.java']),
-    deps = COMPILE_DEPS,
-    visibility = ['PUBLIC'],
-    resources_root = 'fmcli/src/main/resources',
-    resources = glob(['fmcli/src/main/resources/**']),
-)
-
-java_test(
-    name = 'fmcli-tests',
-    srcs = glob(['fmcli/' + TEST + '*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [':fmcli'],
-    source_under_test = [':fmcli'],
-)
-
-java_library(
-    name = 'fmgui',
-    srcs = glob(['fmgui/' + SRC + '*.java']),
-    deps = COMPILE_DEPS,
-    visibility = ['PUBLIC'],
-    resources_root = 'fmgui/src/main/resources',
-    resources = glob(['fmgui/src/main/resources/**']),
-)
-
-java_test(
-    name = 'fmgui-tests',
-    srcs = glob(['fmgui/' + TEST + '*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [':fmgui'],
-    source_under_test = [':fmgui'],
-)
-
-java_library(
-    name = 'fmmgr',
-    srcs = glob(['fmmgr/' + SRC + '*.java']),
-    deps = COMPILE_DEPS,
-    visibility = ['PUBLIC'],
-)
-
-java_test(
-    name = 'fmmgr-tests',
-    srcs = glob(['fmmgr/' + TEST + '*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [':fmmgr'],
-    source_under_test = [':fmmgr'],
-)
-
-java_library(
-    name = 'fmweb',
-    srcs = glob(['fmweb/' + SRC + '*.java']),
-    deps = COMPILE_DEPS,
-    visibility = ['PUBLIC'],
-)
-
-java_test(
-    name = 'fmweb-tests',
-    srcs = glob(['fmweb/' + TEST + '*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [':fmweb'],
-    source_under_test = [':fmweb'],
-    resources_root = 'fmweb/src/test/resources',
-    resources = glob(['fmweb/src/test/resources/**']),
+onos_app (
+  title = 'Fault Management App',
+  description = 'ONOS fault management application',
+  category = 'Monitoring',
+  url = 'https://wiki.onosproject.org/display/ONOS/Fault+Management',
+  included_bundles = BUNDLES,
 )
diff --git a/apps/faultmanagement/fmcli/BUCK b/apps/faultmanagement/fmcli/BUCK
new file mode 100644
index 0000000..a808ed3
--- /dev/null
+++ b/apps/faultmanagement/fmcli/BUCK
@@ -0,0 +1,16 @@
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//incubator/api:onos-incubator-api',
+    '//cli:onos-cli',
+    '//utils/rest:onlab-rest',
+    '//lib:javax.ws.rs-api',
+    '//utils/osgi:onlab-osgi',
+    '//core/store/serializers:onos-core-serializers',
+]
+
+
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS,
+    import_packages = '*,org.onosproject.cli.net',
+)
diff --git a/apps/faultmanagement/fmgui/BUCK b/apps/faultmanagement/fmgui/BUCK
new file mode 100644
index 0000000..6c3369e
--- /dev/null
+++ b/apps/faultmanagement/fmgui/BUCK
@@ -0,0 +1,10 @@
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//incubator/api:onos-incubator-api',
+    '//cli:onos-cli',
+]
+
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS,
+)
diff --git a/apps/faultmanagement/fmmgr/BUCK b/apps/faultmanagement/fmmgr/BUCK
new file mode 100644
index 0000000..27e6f80
--- /dev/null
+++ b/apps/faultmanagement/fmmgr/BUCK
@@ -0,0 +1,16 @@
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//incubator/api:onos-incubator-api',
+    '//core/store/serializers:onos-core-serializers',
+]
+
+TEST_DEPS = [
+    '//lib:TEST_ADAPTERS',
+    '//utils/osgi:onlab-osgi-tests',
+    '//incubator/api:onos-incubator-api-tests',
+]
+
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
+)
diff --git a/apps/faultmanagement/fmweb/BUCK b/apps/faultmanagement/fmweb/BUCK
new file mode 100644
index 0000000..4e5bcba
--- /dev/null
+++ b/apps/faultmanagement/fmweb/BUCK
@@ -0,0 +1,20 @@
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//incubator/api:onos-incubator-api',
+    '//utils/rest:onlab-rest',
+    '//lib:javax.ws.rs-api',
+]
+
+TEST_DEPS = [
+    '//lib:TEST_ADAPTERS',
+    '//lib:jersey-test-framework-core',
+    '//lib:jersey-test-framework-jetty',
+    '//utils/osgi:onlab-osgi-tests',
+    '//web/api:onos-rest-tests',
+    '//incubator/api:onos-incubator-api-tests',
+]
+
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
+)
diff --git a/apps/openstacknetworking/openstackrouting/BUCK b/apps/openstacknetworking/openstackrouting/BUCK
index fc1bfe2..b691ff9 100644
--- a/apps/openstacknetworking/openstackrouting/BUCK
+++ b/apps/openstacknetworking/openstackrouting/BUCK
@@ -20,4 +20,5 @@
     category = 'Utility',
     url = 'http://onosproject.org',
     description = 'OpenStack routing application.',
+    included_bundles = BUNDLES,
 )
diff --git a/apps/openstacknode/BUCK b/apps/openstacknode/BUCK
index f96abca..e15af2e 100644
--- a/apps/openstacknode/BUCK
+++ b/apps/openstacknode/BUCK
@@ -8,3 +8,11 @@
 osgi_jar_with_tests (
     deps = COMPILE_DEPS,
 )
+
+onos_app (
+    title = 'OpenStack Node Bootstrap App',
+    category = 'Utility',
+    url = 'http://onosproject.org',
+    description = 'SONA Openstack Node Bootstrap Application.',
+    required_app = [ 'org.onosproject.ovsdb' ],
+)