Add bazel rule to run buildifier; fix up formatting problems in bazel files

Change-Id: Ifa8ab12ed564fa2eaf5edd781281aa5cae52d17a
diff --git a/tools/build/bazel/bazel_version.bzl b/tools/build/bazel/bazel_version.bzl
index 4aa4b1c..cd175b0 100644
--- a/tools/build/bazel/bazel_version.bzl
+++ b/tools/build/bazel/bazel_version.bzl
@@ -15,12 +15,12 @@
 """
 
 def check_bazel_version():
-  if "bazel_version" not in dir(native):
-    fail("\nBazel version is too old; please use 0.15.* official release!\n\n")
-  elif not native.bazel_version:
-    print("\nBazel is not a release version; please use 0.15.* official release!\n\n")
-    return
+    if "bazel_version" not in dir(native):
+        fail("\nBazel version is too old; please use 0.15.* official release!\n\n")
+    elif not native.bazel_version:
+        print("\nBazel is not a release version; please use 0.15.* official release!\n\n")
+        return
 
-  if not native.bazel_version.startswith("0.15."):
-    fail("\nBazel version %s is not supported; please use 0.15.* official release!\n\n"
-            % native.bazel_version)
+    if not native.bazel_version.startswith("0.15."):
+        fail("\nBazel version %s is not supported; please use 0.15.* official release!\n\n" %
+             native.bazel_version)
diff --git a/tools/build/bazel/checkstyle.bzl b/tools/build/bazel/checkstyle.bzl
index 92d3adb..bd8eeb1 100644
--- a/tools/build/bazel/checkstyle.bzl
+++ b/tools/build/bazel/checkstyle.bzl
@@ -14,10 +14,10 @@
  limitations under the License.
 """
 
-
 """
     Implementation of the rule to call checkstyle
 """
+
 def _checkstyle_impl(ctx):
     classpath = ""
     need_colon = False
@@ -28,9 +28,10 @@
         classpath += file.path
 
     cmd = " ".join(
-            ["java -cp %s com.puppycrawl.tools.checkstyle.Main" % classpath] +
-            ["-c %s" % ctx.attr._config.files.to_list()[0].path] +
-            [src_file.path for src_file in ctx.files.srcs])
+        ["java -cp %s com.puppycrawl.tools.checkstyle.Main" % classpath] +
+        ["-c %s" % ctx.attr._config.files.to_list()[0].path] +
+        [src_file.path for src_file in ctx.files.srcs],
+    )
 
     ctx.actions.write(
         output = ctx.outputs.executable,
@@ -46,28 +47,26 @@
     runfiles = ctx.runfiles(files = inputs)
     return [DefaultInfo(runfiles = runfiles)]
 
-
 """
     Rule definition for calling checkstyle
 """
 _execute_checkstyle_test = rule(
     test = True,
     attrs = {
-        "_classpath": attr.label_list(default=[
-                    Label("@checkstyle//jar"),
-                    Label("@commons_beanutils//jar"),
-                    Label("@commons_cli//jar"),
-                    Label("@commons_collections//jar"),
-                    Label("@antlr//jar"),
-                    Label("@com_google_guava_guava//jar"),
-                    Label("@commons_logging//jar"),
-                ]),
+        "_classpath": attr.label_list(default = [
+            Label("@checkstyle//jar"),
+            Label("@commons_beanutils//jar"),
+            Label("@commons_cli//jar"),
+            Label("@commons_collections//jar"),
+            Label("@antlr//jar"),
+            Label("@com_google_guava_guava//jar"),
+            Label("@commons_logging//jar"),
+        ]),
         "srcs": attr.label_list(allow_files = FileType([".java"])),
-        "_config": attr.label(default=Label("//tools/build/conf:checkstyle_xml")),
-        "_suppressions": attr.label(default=Label("//tools/build/conf:suppressions_xml")),
-        "_java_header": attr.label(default=Label("//tools/build/conf:onos_java_header")),
+        "_config": attr.label(default = Label("//tools/build/conf:checkstyle_xml")),
+        "_suppressions": attr.label(default = Label("//tools/build/conf:suppressions_xml")),
+        "_java_header": attr.label(default = Label("//tools/build/conf:onos_java_header")),
     },
-
     implementation = _checkstyle_impl,
 )
 
@@ -79,7 +78,6 @@
         srcs: list of source file targets to run checkstyle on. Required.
         size: test size constraint. Optional, defaults to "small"
 """
+
 def checkstyle_test(name, srcs):
     _execute_checkstyle_test(name = name, srcs = srcs, size = "small")
-
-
diff --git a/tools/build/bazel/generate_workspace.bzl b/tools/build/bazel/generate_workspace.bzl
index afc9768..8d2f855 100644
--- a/tools/build/bazel/generate_workspace.bzl
+++ b/tools/build/bazel/generate_workspace.bzl
@@ -2709,4 +2709,3 @@
     if type(label) == "string":
         return "mvn:%s:%s:%s" % (ONOS_GROUP_ID, label_string, ONOS_VERSION)
     return "mvn:%s:%s:%s" % (ONOS_GROUP_ID, label.name, ONOS_VERSION)
-
diff --git a/tools/build/bazel/grpc_workspace.bzl b/tools/build/bazel/grpc_workspace.bzl
index 72b5769..a14b1a5 100644
--- a/tools/build/bazel/grpc_workspace.bzl
+++ b/tools/build/bazel/grpc_workspace.bzl
@@ -14,11 +14,12 @@
         sha256 = GRPC_SHA,
         strip_prefix = "grpc-java-%s-patched" % GRPC_VER,
     )
+
     # Google APIs protos (status.proto, etc.)
     http_archive(
         name = "com_github_googleapis",
         urls = ["https://github.com/googleapis/googleapis/archive/%s.zip" % GAPIS_COMMIT],
         sha256 = GAPIS_SHA,
         strip_prefix = "googleapis-" + GAPIS_COMMIT,
-        build_file = "//tools/build/bazel:googleapis_BUILD"
+        build_file = "//tools/build/bazel:googleapis_BUILD",
     )
diff --git a/tools/build/bazel/java_sources.bzl b/tools/build/bazel/java_sources.bzl
index 734d048..a45ae60 100644
--- a/tools/build/bazel/java_sources.bzl
+++ b/tools/build/bazel/java_sources.bzl
@@ -13,25 +13,25 @@
 # limitations under the License.
 
 def _impl(ctx):
-  jar = ctx.outputs.jar
+    jar = ctx.outputs.jar
 
-  src_list = ""
-  for src in ctx.files.srcs:
-    if src.path.endswith(".srcjar"):
-      src_list += " " + src.path
+    src_list = ""
+    for src in ctx.files.srcs:
+        if src.path.endswith(".srcjar"):
+            src_list += " " + src.path
 
-  cmd = [
-      "for sj in %s; do jar xf $sj; done" % src_list,
-      "dir=$(find . -type d -name java)",
-      "[ -n \"$dir\" -a -d \"$dir\" ] && jar cf %s -C $dir ." % jar.path,
-  ]
+    cmd = [
+        "for sj in %s; do jar xf $sj; done" % src_list,
+        "dir=$(find . -type d -name java)",
+        "[ -n \"$dir\" -a -d \"$dir\" ] && jar cf %s -C $dir ." % jar.path,
+    ]
 
-  ctx.action(
-      inputs = ctx.files.srcs,
-      outputs = [jar],
-      progress_message = "Generating source jar for %s" %  ctx.attr.name,
-      command = ";\n".join(cmd)
-  )
+    ctx.action(
+        inputs = ctx.files.srcs,
+        outputs = [jar],
+        progress_message = "Generating source jar for %s" % ctx.attr.name,
+        command = ";\n".join(cmd),
+    )
 
 def _impl_alt(ctx):
     ending = "-src.jar"
@@ -46,15 +46,15 @@
             out_file = ctx.actions.declare_file(prefix + ".srcjar")
             out_files.append(out_file)
     if len(src_files) == 0:
-            fail("None of the given input files is a valid source jar (%s)"
-                % ", ".join([s.path for s in ctx.files.srcs]))
+        fail("None of the given input files is a valid source jar (%s)" %
+             ", ".join([s.path for s in ctx.files.srcs]))
     for i in range(len(src_files)):
         cmd = "cp %s %s" % (src_files[i].path, out_files[i].path)
         ctx.actions.run_shell(
             inputs = [src_files[i]],
             outputs = [out_files[i]],
-            progress_message = "Generating source jar %s" %  out_files[i].basename,
-            command = cmd
+            progress_message = "Generating source jar %s" % out_files[i].basename,
+            command = cmd,
         )
     return DefaultInfo(files = depset(out_files))
 
@@ -70,7 +70,7 @@
         "srcs": attr.label_list(allow_files = True),
     },
     implementation = _impl,
-    outputs = {"jar" : "%{name}.jar"},
+    outputs = {"jar": "%{name}.jar"},
 )
 
 """
diff --git a/tools/build/bazel/javadoc.bzl b/tools/build/bazel/javadoc.bzl
index e073426..87e5592 100644
--- a/tools/build/bazel/javadoc.bzl
+++ b/tools/build/bazel/javadoc.bzl
@@ -12,33 +12,33 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-JAVA_DOCS="-link https://docs.oracle.com/javase/8/docs/api/"
+JAVA_DOCS = "-link https://docs.oracle.com/javase/8/docs/api/"
 
 def _impl(ctx):
-  dir = ctx.label.name
-  jar = ctx.outputs.jar
+    dir = ctx.label.name
+    jar = ctx.outputs.jar
 
-  dep_list = []
-  for dep in ctx.files.deps:
-    dep_list += [dep.path]
+    dep_list = []
+    for dep in ctx.files.deps:
+        dep_list += [dep.path]
 
-  src_list = []
-  for src in ctx.files.srcs:
-    src_list += [src.path]
+    src_list = []
+    for src in ctx.files.srcs:
+        src_list += [src.path]
 
-  cmd = [
-      "mkdir %s" % dir,
-      "javadoc -encoding UTF-8 -quiet -tag onos.rsModel:a:\"onos model\" %s -d %s -cp %s %s" \
-          % (JAVA_DOCS, dir, ":".join(dep_list), " ".join(src_list)),
-      "jar cf %s -C %s ." % (jar.path, dir),
-  ]
+    cmd = [
+        "mkdir %s" % dir,
+        "javadoc -encoding UTF-8 -quiet -tag onos.rsModel:a:\"onos model\" %s -d %s -cp %s %s" %
+        (JAVA_DOCS, dir, ":".join(dep_list), " ".join(src_list)),
+        "jar cf %s -C %s ." % (jar.path, dir),
+    ]
 
-  ctx.action(
-      inputs = ctx.files.srcs + ctx.files.deps,
-      outputs = [jar],
-      progress_message = "Generating javadocs jar for %s" %  ctx.attr.name,
-      command = ";\n".join(cmd)
-  )
+    ctx.action(
+        inputs = ctx.files.srcs + ctx.files.deps,
+        outputs = [jar],
+        progress_message = "Generating javadocs jar for %s" % ctx.attr.name,
+        command = ";\n".join(cmd),
+    )
 
 javadoc = rule(
     attrs = {
@@ -46,6 +46,5 @@
         "srcs": attr.label_list(allow_files = True),
     },
     implementation = _impl,
-    outputs = {"jar" : "%{name}.jar"},
+    outputs = {"jar": "%{name}.jar"},
 )
-
diff --git a/tools/build/bazel/onos_app.bzl b/tools/build/bazel/onos_app.bzl
index c5563b1..6bf8df3 100644
--- a/tools/build/bazel/onos_app.bzl
+++ b/tools/build/bazel/onos_app.bzl
@@ -60,14 +60,22 @@
 def _onos_app_xml_impl(ctx):
     # Build-up arguments for the app.xml and feature.xml generator
     arguments = [
-        "-n", ctx.attr.feature_coords,
-        "-a", ctx.attr.app_name,
-        "-o", ctx.attr.origin,
-        "-c", ctx.attr.category,
-        "-u", ctx.attr.url,
-        "-v", ctx.attr.version,
-        "-t", ctx.attr.title,
-        "-D", ctx.attr.description,
+        "-n",
+        ctx.attr.feature_coords,
+        "-a",
+        ctx.attr.app_name,
+        "-o",
+        ctx.attr.origin,
+        "-c",
+        ctx.attr.category,
+        "-u",
+        ctx.attr.url,
+        "-v",
+        ctx.attr.version,
+        "-t",
+        ctx.attr.title,
+        "-D",
+        ctx.attr.description,
     ]
 
     for bundle in ctx.attr.included_bundles:
@@ -83,7 +91,7 @@
     ctx.actions.run(
         inputs = [],
         outputs = [ctx.outputs.app_xml],
-        arguments = arguments + [ "-A", "-O", ctx.outputs.app_xml.path ],
+        arguments = arguments + ["-A", "-O", ctx.outputs.app_xml.path],
         progress_message = "Generating app.xml descriptor for app: %s" % ctx.attr.name,
         executable = ctx.executable._onos_app_tools,
     )
@@ -92,12 +100,18 @@
 def _onos_feature_xml_impl(ctx):
     # Build-up arguments
     arguments = [
-        "-n", ctx.attr.feature_coords,
-        "-a", ctx.attr.app_name,
-        "-u", ctx.attr.url,
-        "-v", ctx.attr.version,
-        "-t", ctx.attr.title,
-        "-D", ctx.attr.description,
+        "-n",
+        ctx.attr.feature_coords,
+        "-a",
+        ctx.attr.app_name,
+        "-u",
+        ctx.attr.url,
+        "-v",
+        ctx.attr.version,
+        "-t",
+        ctx.attr.title,
+        "-D",
+        ctx.attr.description,
     ]
 
     for bundle in ctx.attr.included_bundles:
@@ -108,12 +122,11 @@
     ctx.actions.run(
         inputs = [],
         outputs = [ctx.outputs.feature_xml],
-        arguments = arguments + [ "-F", "-O", ctx.outputs.feature_xml.path ],
+        arguments = arguments + ["-F", "-O", ctx.outputs.feature_xml.path],
         progress_message = "Generating feature.xml for app: %s" % ctx.attr.name,
         executable = ctx.executable._onos_app_tools,
     )
 
-
 # Rule to generate the ONOS app OAR file.
 _onos_oar = rule(
     attrs = {
@@ -269,7 +282,7 @@
         required_apps = required_apps,
     )
 
-   # Generate feature.xml file
+    # Generate feature.xml file
     _onos_feature_xml(
         name = name + "-feature-xml",
         app_name = app_name,
diff --git a/tools/build/bazel/osgi_java_library.bzl b/tools/build/bazel/osgi_java_library.bzl
index 43873a4..b2505a4 100644
--- a/tools/build/bazel/osgi_java_library.bzl
+++ b/tools/build/bazel/osgi_java_library.bzl
@@ -443,15 +443,27 @@
         native_srcs = srcs + [name + "_swagger_java"]
         native_resources.append(name + "_swagger_json")
 
-    javacopts = [ "-XepDisableAllChecks" ] if suppress_errorprone else []
+    javacopts = ["-XepDisableAllChecks"] if suppress_errorprone else []
 
     # compile the Java code
     if len(resource_jars) > 0:
-        native.java_library(name = name + "-native", srcs = native_srcs, resource_jars = resource_jars,
-                            deps = deps, visibility = visibility, javacopts = javacopts)
+        native.java_library(
+            name = name + "-native",
+            srcs = native_srcs,
+            resource_jars = resource_jars,
+            deps = deps,
+            visibility = visibility,
+            javacopts = javacopts,
+        )
     else:
-        native.java_library(name = name + "-native", srcs = native_srcs, resources = native_resources,
-                            deps = deps, visibility = visibility, javacopts = javacopts)
+        native.java_library(
+            name = name + "-native",
+            srcs = native_srcs,
+            resources = native_resources,
+            deps = deps,
+            visibility = visibility,
+            javacopts = javacopts,
+        )
 
     _bnd(
         name = name,
@@ -472,11 +484,11 @@
 
     # rule for building source jar
     if not suppress_javadocs:
-      java_sources(name = name + "-sources", srcs = srcs, visibility = visibility)
+        java_sources(name = name + "-sources", srcs = srcs, visibility = visibility)
 
     # rule for building javadocs
     if not suppress_javadocs:
-      javadoc(name = name + "-javadoc", deps = deps, srcs = srcs, visibility = visibility)
+        javadoc(name = name + "-javadoc", deps = deps, srcs = srcs, visibility = visibility)
 
     if test_srcs != []:
         native.java_library(
@@ -579,7 +591,6 @@
         bundle_classpath = bundle_classpath,
     )
 
-
 """
     Creates an OSGI jar file from a set of protobuf and gRPC libraries.
 
@@ -621,8 +632,7 @@
         deps = [],
         group = "org.onosproject",
         visibility = ["//visibility:public"],
-        version = ONOS_VERSION
-    ):
+        version = ONOS_VERSION):
     if name == None:
         name = _auto_name()
     native.java_proto_library(
@@ -646,7 +656,7 @@
             deps = [":%s-java-proto" % name],
         )
         osgi_srcs.append(
-            ":%s-java-grpc__do_not_reference__srcjar" % name
+            ":%s-java-grpc__do_not_reference__srcjar" % name,
         )
         base_deps.extend([
             "@com_google_guava_guava//jar",
diff --git a/tools/build/bazel/p4lang_workspace.bzl b/tools/build/bazel/p4lang_workspace.bzl
index abf4c5c..d4d966c 100644
--- a/tools/build/bazel/p4lang_workspace.bzl
+++ b/tools/build/bazel/p4lang_workspace.bzl
@@ -12,13 +12,14 @@
         urls = ["https://github.com/p4lang/p4runtime/archive/%s.zip" % P4RUNTIME_COMMIT],
         sha256 = P4RUNTIME_SHA,
         strip_prefix = "p4runtime-%s/proto" % P4RUNTIME_COMMIT,
-        build_file = "//tools/build/bazel:p4runtime_BUILD"
+        build_file = "//tools/build/bazel:p4runtime_BUILD",
     )
+
     # Needed for PI/proto/p4/tmp/p4config.proto
     http_archive(
         name = "com_github_p4lang_pi",
         urls = ["https://github.com/p4lang/PI/archive/%s.zip" % PI_COMMIT],
         sha256 = PI_SHA,
         strip_prefix = "PI-%s/proto" % PI_COMMIT,
-        build_file = "//tools/build/bazel:pi_BUILD"
+        build_file = "//tools/build/bazel:pi_BUILD",
     )
diff --git a/tools/build/bazel/pom_file.bzl b/tools/build/bazel/pom_file.bzl
index 792d35a..e3c5689 100644
--- a/tools/build/bazel/pom_file.bzl
+++ b/tools/build/bazel/pom_file.bzl
@@ -15,21 +15,21 @@
 load("//tools/build/bazel:generate_workspace.bzl", "maven_coordinates")
 
 def _impl(ctx):
-  arguments = [
-      ctx.outputs.pom.path,
-      maven_coordinates(ctx.attr.artifact)
-  ]
+    arguments = [
+        ctx.outputs.pom.path,
+        maven_coordinates(ctx.attr.artifact),
+    ]
 
-  for dep in ctx.attr.deps:
-    arguments += [ maven_coordinates(dep.label) ]
+    for dep in ctx.attr.deps:
+        arguments += [maven_coordinates(dep.label)]
 
-  ctx.actions.run(
-      inputs = ctx.files.deps,
-      outputs = [ctx.outputs.pom],
-      progress_message = "Generating pom file for %s" %  ctx.attr.name,
-      arguments = arguments,
-      executable = ctx.executable._pom_generator,
-  )
+    ctx.actions.run(
+        inputs = ctx.files.deps,
+        outputs = [ctx.outputs.pom],
+        progress_message = "Generating pom file for %s" % ctx.attr.name,
+        arguments = arguments,
+        executable = ctx.executable._pom_generator,
+    )
 
 pom_file = rule(
     attrs = {
@@ -40,9 +40,8 @@
             cfg = "host",
             allow_files = True,
             default = Label("//tools/build/bazel:pom_generator"),
-        )
+        ),
     },
     implementation = _impl,
-    outputs = {"pom" : "%{name}.pom"},
+    outputs = {"pom": "%{name}.pom"},
 )
-
diff --git a/tools/build/bazel/project_javadoc.bzl b/tools/build/bazel/project_javadoc.bzl
index 86b61d5..171b846 100644
--- a/tools/build/bazel/project_javadoc.bzl
+++ b/tools/build/bazel/project_javadoc.bzl
@@ -12,10 +12,10 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-JAVA_DOCS="-link https://docs.oracle.com/javase/8/docs/api/"
+JAVA_DOCS = "-link https://docs.oracle.com/javase/8/docs/api/"
 
 def dump(obj):
-    print (dir(obj))
+    print(dir(obj))
     for attr in dir(obj):
         print("obj.%s = %r" % (attr, getattr(obj, attr)))
 
@@ -54,8 +54,8 @@
         cmd += ["find src -type f | egrep -v 'src/(OSGI|WEB)-INF' | egrep -v '/(impl|internal)/' >> FILES"]
 
     cmd += [
-        "javadoc -encoding UTF-8 -overview overview.html -doctitle '%s' -windowtitle '%s' %s -d apidocs -classpath %s -sourcepath src %s @FILES" \
-              % (ctx.attr.title, ctx.attr.title, group_list, classpath.replace(":", "", 1), JAVA_DOCS),
+        "javadoc -encoding UTF-8 -overview overview.html -doctitle '%s' -windowtitle '%s' %s -d apidocs -classpath %s -sourcepath src %s @FILES" %
+        (ctx.attr.title, ctx.attr.title, group_list, classpath.replace(":", "", 1), JAVA_DOCS),
         "cp -r doc-files apidocs/doc-files",
         "jar cf %s apidocs" % jar.path,
     ]
@@ -63,8 +63,8 @@
     ctx.action(
         inputs = ctx.files.srcs + ctx.files.deps,
         outputs = [jar],
-        progress_message = "Generating javadocs jar for %s" %  ctx.attr.name,
-        command = ";\n".join(cmd)
+        progress_message = "Generating javadocs jar for %s" % ctx.attr.name,
+        command = ";\n".join(cmd),
     )
 
 project_javadoc = rule(
@@ -77,6 +77,5 @@
         "internal": attr.bool(default = False),
     },
     implementation = _impl,
-    outputs = {"jar" : "%{name}.jar"},
+    outputs = {"jar": "%{name}.jar"},
 )
-
diff --git a/tools/build/bazel/protobuf_workspace.bzl b/tools/build/bazel/protobuf_workspace.bzl
index 1932b57..4a65eab 100644
--- a/tools/build/bazel/protobuf_workspace.bzl
+++ b/tools/build/bazel/protobuf_workspace.bzl
@@ -6,8 +6,8 @@
 def generate_protobuf():
     http_archive(
         name = "com_google_protobuf",
-        urls = ["https://github.com/google/protobuf/releases/download/v%s/protobuf-all-%s.zip"
-            % (PROTOBUF_VER, PROTOBUF_VER)],
+        urls = ["https://github.com/google/protobuf/releases/download/v%s/protobuf-all-%s.zip" %
+                (PROTOBUF_VER, PROTOBUF_VER)],
         sha256 = SHA,
         strip_prefix = "protobuf-" + PROTOBUF_VER,
     )
diff --git a/tools/build/bazel/publish_catalog.bzl b/tools/build/bazel/publish_catalog.bzl
index ef277e8..edf9569 100644
--- a/tools/build/bazel/publish_catalog.bzl
+++ b/tools/build/bazel/publish_catalog.bzl
@@ -8,7 +8,7 @@
 def _remote(group_id, artifact_id, version, packaging, classifier):
     p = group_id.replace(".", "/") + "/" + artifact_id + "/" + version + "/" + artifact_id + "-" + version
     if classifier != None:
-      p += "-" + classifier
+        p += "-" + classifier
     p += "." + packaging
     return p
 
@@ -26,15 +26,15 @@
 
     c = artifact_id.split("-")
 
-    if len(c) > 1 and c[len(c)-1] in ("javadoc", "sources", "tests", "pom"):
-        classifier = c[len(c)-1]
-        artifact_id = "-".join(c[:len(c)-1])
+    if len(c) > 1 and c[len(c) - 1] in ("javadoc", "sources", "tests", "pom"):
+        classifier = c[len(c) - 1]
+        artifact_id = "-".join(c[:len(c) - 1])
         if classifier == "pom":
             packaging = classifier
             classifier = None
 
     for f in target.files:
-        print ("%s\t%s" % (f.path, _remote(group_id, artifact_id, version, packaging, classifier)))
+        print("%s\t%s" % (f.path, _remote(group_id, artifact_id, version, packaging, classifier)))
     return []
 
 publish_catalog = aspect(
diff --git a/tools/build/bazel/yang.bzl b/tools/build/bazel/yang.bzl
index 3b123b2..93b619c 100644
--- a/tools/build/bazel/yang.bzl
+++ b/tools/build/bazel/yang.bzl
@@ -85,13 +85,12 @@
         outputs = [ctx.outputs.schema],
         arguments = [
             ctx.outputs.schema.path,
-            generated_sources.path
+            generated_sources.path,
         ],
         command = "jar cf $1 -C $2 schema",
         progress_message = "Assembling YANG compiled schema: %s" % ctx.attr.name,
     )
 
-
 # Rule to generate YANG library from the specified set of YANG models.
 _yang_library = rule(
     attrs = {
@@ -114,13 +113,12 @@
 )
 
 def yang_library(
-    name = None,
-    deps = None,
-    yang_srcs = None,
-    java_srcs = None,
-    custom_registrator = False,
-    visibility = ["//visibility:public"]):
-
+        name = None,
+        deps = None,
+        yang_srcs = None,
+        java_srcs = None,
+        custom_registrator = False,
+        visibility = ["//visibility:public"]):
     if name == None:
         name = "onos-" + native.package_name().replace("/", "-")
     if yang_srcs == None:
@@ -132,7 +130,7 @@
 
     deps += CORE_DEPS + ONOS_YANG + [
         "@onos_yang_runtime//jar",
-        "//apps/yang:onos-apps-yang"
+        "//apps/yang:onos-apps-yang",
     ]
 
     # Generate the Java sources from YANG model
@@ -146,7 +144,7 @@
             name = name + "-srcjar",
             srcs = java_srcs,
             outs = [name + ".srcjar"],
-            cmd = "jar cf $(location %s.srcjar) $(SRCS)" % name
+            cmd = "jar cf $(location %s.srcjar) $(SRCS)" % name,
         )
 
     if not custom_registrator:
@@ -154,38 +152,44 @@
         native.genrule(
             name = name + "-registrator",
             outs = [REGISTRATOR_FILE],
-            cmd = "echo '%s' > $(location %s)" % (REGISTRATOR, REGISTRATOR_FILE)
+            cmd = "echo '%s' > $(location %s)" % (REGISTRATOR, REGISTRATOR_FILE),
         )
 
     # Produce a Java library from the generated Java sources
-    osgi_jar(name = name, srcs = srcs,
-             resource_jars = [name + "-generate"], deps = deps,
-             visibility = ["//visibility:public"],
-             suppress_errorprone = True,
-             suppress_checkstyle = True,
-             suppress_javadocs = True,
+    osgi_jar(
+        name = name,
+        srcs = srcs,
+        resource_jars = [name + "-generate"],
+        deps = deps,
+        visibility = ["//visibility:public"],
+        suppress_errorprone = True,
+        suppress_checkstyle = True,
+        suppress_javadocs = True,
     )
 
 def yang_model(
-    name = None,
-    app_name = None,
-    title = None,
-    description = None,
-    url = "http://onosproject.org/",
-    custom_registrator = False,
-    deps = None,
-    yang_srcs = None,
-    java_srcs = None,
-    required_apps = [],
-    visibility = ["//visibility:public"]):
-
+        name = None,
+        app_name = None,
+        title = None,
+        description = None,
+        url = "http://onosproject.org/",
+        custom_registrator = False,
+        deps = None,
+        yang_srcs = None,
+        java_srcs = None,
+        required_apps = [],
+        visibility = ["//visibility:public"]):
     if name == None:
         name = "onos-" + native.package_name().replace("/", "-")
 
-    yang_library(name = name, deps = deps,
-                 yang_srcs = yang_srcs, java_srcs = java_srcs,
-                 custom_registrator = custom_registrator,
-                 visibility = ["//visibility:public"])
+    yang_library(
+        name = name,
+        deps = deps,
+        yang_srcs = yang_srcs,
+        java_srcs = java_srcs,
+        custom_registrator = custom_registrator,
+        visibility = ["//visibility:public"],
+    )
 
     onos_app(
         app_name = app_name,
@@ -195,7 +199,7 @@
         version = ONOS_VERSION,
         url = url,
         category = "Models",
-        included_bundles = [ name ],
+        included_bundles = [name],
         required_apps = required_apps + ["org.onosproject.yang"],
         visibility = ["//visibility:public"],
-    )
\ No newline at end of file
+    )