Added checkstyle validation and fixed checkstyle errors.

Change-Id: I3815b2ccd27a69e749e5e18ea1ce4a404368774e
diff --git a/pom.xml b/pom.xml
index 98aea8f..9483615 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,6 +30,7 @@
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <onos-build-conf.version>1.3</onos-build-conf.version>
     </properties>
 
     <modules>
@@ -88,6 +89,42 @@
                 <version>2.5.4</version>
                 <extensions>true</extensions>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <version>2.17</version>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.onosproject</groupId>
+                        <artifactId>onos-build-conf</artifactId>
+                        <version>${onos-build-conf.version}</version>
+                    </dependency>
+                </dependencies>
+                <configuration>
+                    <!-- begin: workaround for unexpected NullPointerException on Eclipse -->
+                    <sourceDirectory>${project.build.sourceDirectory}
+                    </sourceDirectory>
+                    <testSourceDirectory>${project.build.testSourceDirectory}
+                    </testSourceDirectory>
+                    <!-- end: workaround for unexpected NullPointerException on Eclipse -->
+                    <configLocation>onos/checkstyle.xml</configLocation>
+                    <suppressionsLocation>onos/suppressions.xml
+                    </suppressionsLocation>
+                    <failsOnError>false</failsOnError>
+                    <logViolationsToConsole>true</logViolationsToConsole>
+                    <includeTestSourceDirectory>true
+                    </includeTestSourceDirectory>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>validate-checkstyle</id>
+                        <phase>verify</phase>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 </project>