Fix Bmv2 related issues
- fix pom issues introduced in ONOS-7251
- fix error-prone detected issue
- fix artifactId naming
Change-Id: I4711c14ec25ed83a6e9071c9a0f8a2d606dad877
diff --git a/drivers/bmv2/pom.xml b/drivers/bmv2/pom.xml
index bde8fde..fa6be0d 100644
--- a/drivers/bmv2/pom.xml
+++ b/drivers/bmv2/pom.xml
@@ -74,7 +74,7 @@
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-bmv2-protocol-thrift-api</artifactId>
+ <artifactId>onos-protocols-bmv2-thrift-api</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/impl/Bmv2PreGroupTranslatorImpl.java b/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/impl/Bmv2PreGroupTranslatorImpl.java
index 369b7c5..9e78d2b 100644
--- a/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/impl/Bmv2PreGroupTranslatorImpl.java
+++ b/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/impl/Bmv2PreGroupTranslatorImpl.java
@@ -250,7 +250,7 @@
private static void validatePort(PortNumber portNumber) {
if (portNumber.toLong() < 0 || portNumber.toLong() >= BMV2_PORT_MAP_SIZE) {
throw new IllegalStateException(String.format("Port number %d is not a valid BMv2 physical port number." +
- "Valid port range is [0,255]", portNumber));
+ "Valid port range is [0,255]", portNumber.toLong()));
}
}
diff --git a/protocols/bmv2/pom.xml b/protocols/bmv2/pom.xml
index 13c545e..b3fff8a 100644
--- a/protocols/bmv2/pom.xml
+++ b/protocols/bmv2/pom.xml
@@ -22,11 +22,11 @@
<parent>
<artifactId>onos-protocols</artifactId>
<groupId>org.onosproject</groupId>
- <version>1.13.0-SNAPSHOT</version>
+ <version>1.14.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>onos-bmv2-protocol</artifactId>
+ <artifactId>onos-protocols-bmv2</artifactId>
<modules>
<module>thrift-api</module>
diff --git a/protocols/bmv2/thrift-api/pom.xml b/protocols/bmv2/thrift-api/pom.xml
index f595b68..a0a3785 100644
--- a/protocols/bmv2/thrift-api/pom.xml
+++ b/protocols/bmv2/thrift-api/pom.xml
@@ -20,20 +20,20 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
- <artifactId>onos-bmv2-protocol</artifactId>
+ <artifactId>onos-protocols-bmv2</artifactId>
<groupId>org.onosproject</groupId>
- <version>1.13.0-SNAPSHOT</version>
+ <version>1.14.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>onos-bmv2-protocol-thrift-api</artifactId>
+ <artifactId>onos-protocols-bmv2-thrift-api</artifactId>
<packaging>bundle</packaging>
<properties>
<!-- BMv2 Commit ID and Thrift version -->
- <bmv2.commit>8f675d0284e9e014f1b8ed502ba54e61d68108cf</bmv2.commit>
+ <bmv2.commit>ed130d01be985d814c17de949839d484e76400b1</bmv2.commit>
<bmv2.thrift.version>0.9.3</bmv2.thrift.version>
<bmv2.baseurl>https://cdn.rawgit.com/opennetworkinglab/onos-bmv2/${bmv2.commit}</bmv2.baseurl>
<bmv2.thrift.javanamespace>org.onosproject.bmv2.thriftapi</bmv2.thrift.javanamespace>
@@ -74,7 +74,8 @@
<artifactId>download-maven-plugin</artifactId>
<version>1.3.0</version>
<executions>
- <execution>
+<!--
+ <execution>
<id>download-bmv2-thrift-standard</id>
<phase>initialize</phase>
<goals>
@@ -96,7 +97,8 @@
<outputDirectory>${bmv2.thrift.srcdir}</outputDirectory>
</configuration>
</execution>
- <execution>
+ -->
+ <execution>
<id>download-bmv2-thrift-simple_pre_lag</id>
<phase>initialize</phase>
<goals>
@@ -107,7 +109,8 @@
<outputDirectory>${bmv2.thrift.srcdir}</outputDirectory>
</configuration>
</execution>
- <execution>
+<!--
+ <execution>
<id>download-bmv2-thrift-simple_switch</id>
<phase>initialize</phase>
<goals>
@@ -129,7 +132,8 @@
<outputDirectory>${bmv2.thrift.srcdir}</outputDirectory>
</configuration>
</execution>
- </executions>
+ -->
+ </executions>
</plugin>
<!-- Extract Thrift compiler -->
<plugin>
diff --git a/protocols/bmv2/thrift-api/src/patch.sh b/protocols/bmv2/thrift-api/src/patch.sh
new file mode 100755
index 0000000..7f7ffb9
--- /dev/null
+++ b/protocols/bmv2/thrift-api/src/patch.sh
@@ -0,0 +1,29 @@
+#! /bin/bash
+#
+# Copyright 2014-2016 Open Networking Laboratory
+#
+# Licensed 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.
+
+# exit on errors
+set -e
+
+srcdir=$1
+ns=$2
+
+# add java namespace at beginning of file
+for f in ${srcdir}/*.thrift
+do
+ if ! grep -q ${ns} ${f}; then
+ echo "namespace java ${ns}" | cat - ${f} > temp && mv temp ${f}
+ fi
+done
\ No newline at end of file
diff --git a/protocols/pom.xml b/protocols/pom.xml
index d311ebb..4984f3a 100644
--- a/protocols/pom.xml
+++ b/protocols/pom.xml
@@ -47,6 +47,7 @@
<module>gnmi/stub</module>
<module>p4runtime</module>
<module>xmpp</module>
+ <module>bmv2</module>
</modules>
<dependencies>