ONOS-6987 To enable declarlation of required permissions of application in BUCK file

Change-Id: I7081769474d7a40ad527c56bf74bfba105ef6af3
diff --git a/buck-tools/onos_app.py b/buck-tools/onos_app.py
index 119d9f6..bbb053c 100755
--- a/buck-tools/onos_app.py
+++ b/buck-tools/onos_app.py
@@ -26,6 +26,10 @@
     <description>%(description)s</description>
 '''
 ARTIFACT = '    <artifact>%s</artifact>\n'
+SECURITY = '''\
+    <security>
+%s
+    </security>\n'''
 APP_FOOTER = '</app>'
 
 NON_OSGI_TAG = 'NON-OSGI'
@@ -103,6 +107,7 @@
                     description = None,
                     apps = [],
                     artifacts = [],
+                    security= None,
                     **kwargs):
     values = {
         'app_name' : app_name,
@@ -123,6 +128,9 @@
     for artifact in artifacts:
         output += ARTIFACT % mvnUrl(artifact)
 
+    if security is not None:
+        output += SECURITY % security
+
     output += APP_FOOTER
     return output
 
@@ -140,6 +148,7 @@
     parser.add_option("-t", "--title",    dest="title",        help="Title")
     parser.add_option("-r", "--repo",     dest="repo_name",    help="Repo Name")
     parser.add_option('-D', '--desc',     dest='desc',         help='Application description')
+    parser.add_option('-s', '--security', dest='security',     help='Application security')
 
     parser.add_option('-b', '--bundle',
                       action="append", dest='included_bundles',
@@ -206,4 +215,5 @@
     if options.write_app:
         print generateAppFile(artifacts=options.included_bundles,
                               apps=options.apps,
+                              security=options.security,
                               **values)
\ No newline at end of file
diff --git a/bucklets/onos_app.bucklet b/bucklets/onos_app.bucklet
index 14e1d72..193574b 100644
--- a/bucklets/onos_app.bucklet
+++ b/bucklets/onos_app.bucklet
@@ -136,6 +136,7 @@
         included_bundles = None,
         excluded_bundles = [],
         visibility = [ 'PUBLIC' ],
+        security = None,
         **kwargs):
     if name is None:
         name = _get_name()
@@ -174,6 +175,8 @@
     args += [ '-d %s' % a for a in required_apps ]
     if description is not None:
         args += [ '-D "%s"' % description ]
+    if security is not None:
+        args += [ '-s "%s"' % security ]
 
     # cmd = '$(exe //buck-tools:onos-app-writer) -F ' + ' '.join(args) + ' > $OUT'
     # genrule(