Add NSH Subtype patch capability

The patch should be explicitly enabled, since its build time is 1 hour
and only applies while the openvswitch in fuel-plugin-ovs is not
compatible with the actual NSH openflow implementation of OpenDayLight.

The patch's ODLTAG (can be set via environment variable) should mach with
OpenDayLight release being patched. Normally it is
- release/beryllium-sr1 for ditribution-karaf-0.4.1-Beryllium-SR1.tar.gz
- release/beryllium-sr2 for ditribution-karaf-0.4.2-Beryllium-SR2.tar.gz
- stable/beryllium      for ditribution-karaf-0.4.x-SNAPSHOT.tar.gz

There is a possibility to build the patch separately and put into
folder odl_package/nsh-pritesh-patch. Remember checking the file's naming
in this case. If the plugin encounters with the supplied jarball it won't
build itself but will try using the supplied one.

Technically the patch's jarball is produced by docker following the way
jenkins job integration-distribution-verify-beryllium of
jenkins.opendaylight.org uses.

Change-Id: Icea96a0f8879d1d1a1df235002f947ce81b79b11
Signed-off-by: Ferenc Cserepkei <ferenc.cserepkei@ericsson.com>
(cherry picked from commit 66738acba8)
This commit is contained in:
Ferenc Cserepkei 2016-05-06 10:42:22 +02:00
parent d6966850f1
commit c0890e101f
5 changed files with 285 additions and 0 deletions

View File

19
ofjavansh/Dockerfile Normal file
View File

@ -0,0 +1,19 @@
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install -y apt-utils build-essential git libmaven-jar-plugin-java libmaven-javadoc-plugin-java\
libxml-xpath-perl maven openjdk-8-jdk python-software-properties software-properties-common\
sudo wget
RUN echo "ALL ALL=NOPASSWD: ALL" > /etc/sudoers.d/open-sudo
RUN chmod 0440 /etc/sudoers.d/open-sudo
ENV HOME=/root
ADD ./patches /root/patches
ADD settings.xml /root/.m2/settings.xml
ADD ./env.sh /root/env.sh
ADD ./buildPatchedOpenflowjavaJarball.sh /root/buildPatchedOpenflowjavaJarball.sh
RUN chmod +x /root/buildPatchedOpenflowjavaJarball.sh
RUN /root/buildPatchedOpenflowjavaJarball.sh

View File

@ -0,0 +1,24 @@
#!/bin/bash
source /root/env.sh
REPO=${REPO:-openflowplugin}
REPOURL="https://github.com/opendaylight/${REPO}.git"
ODLTAG=${ODLTAG:-'stable/beryllium'}
MVNREM="/tmp/r"
PDIR="${HOME}/patches"
PFIL="openflowplugin_modify_nsh_subtype.patch"
echo "env:"
echo "HOME: ${HOME}"
echo "REPOURL: ${REPOURL}"
echo "REPO: ${REPO}"
echo "ODLTAG: ${ODLTAG}"
echo "-----------------"
cd $HOME
git clone -b $ODLTAG "$REPOURL" $REPO
cd $REPO
patch -p1 < ${PDIR}/${PFIL}
rm -rf $MVNREM
mvn clean install -Dmaven.repo.local=$MVNREM -Dorg.ops4j.pax.url.mvn.localRepository=$MVNREM source:jar javadoc:jar -nsu -DskipTests

View File

@ -0,0 +1,144 @@
diff -ruN a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNshc1Codec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNshc1Codec.java
--- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNshc1Codec.java 2015-09-30 10:48:23.542944040 +0800
+++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNshc1Codec.java 2015-09-30 10:52:57.218939666 +0800
@@ -29,7 +29,7 @@
private static final Logger LOG = LoggerFactory.getLogger(SetNshc1Codec.class);
public static final int LENGTH = 16;
- public static final byte NXAST_SET_NSC_SUBTYPE = 34;
+ public static final byte NXAST_SET_NSC_SUBTYPE = 107;
public static final NiciraActionSerializerKey SERIALIZER_KEY =
new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionSetNshc1.class);
public static final NiciraActionDeserializerKey DESERIALIZER_KEY =
diff -ruN a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNshc2Codec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNshc2Codec.java
--- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNshc2Codec.java 2015-09-30 10:48:23.542944040 +0800
+++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNshc2Codec.java 2015-09-30 10:53:04.550939549 +0800
@@ -24,7 +24,7 @@
*/
public class SetNshc2Codec extends AbstractActionCodec {
public static final int LENGTH = 16;
- public static final byte NXAST_SET_NSC_SUBTYPE = 35;
+ public static final byte NXAST_SET_NSC_SUBTYPE = 108;
public static final NiciraActionSerializerKey SERIALIZER_KEY =
new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionSetNshc2.class);
public static final NiciraActionDeserializerKey DESERIALIZER_KEY =
diff -ruN a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNshc3Codec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNshc3Codec.java
--- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNshc3Codec.java 2015-09-30 10:48:23.542944040 +0800
+++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNshc3Codec.java 2015-09-30 10:53:11.622939436 +0800
@@ -24,7 +24,7 @@
*/
public class SetNshc3Codec extends AbstractActionCodec {
public static final int LENGTH = 16;
- public static final byte NXAST_SET_NSC_SUBTYPE = 36;
+ public static final byte NXAST_SET_NSC_SUBTYPE = 109;
public static final NiciraActionSerializerKey SERIALIZER_KEY =
new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionSetNshc3.class);
public static final NiciraActionDeserializerKey DESERIALIZER_KEY =
diff -ruN a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNshc4Codec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNshc4Codec.java
--- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNshc4Codec.java 2015-09-30 10:48:23.542944040 +0800
+++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNshc4Codec.java 2015-09-30 10:53:18.511939325 +0800
@@ -24,7 +24,7 @@
*/
public class SetNshc4Codec extends AbstractActionCodec {
public static final int LENGTH = 16;
- public static final byte NXAST_SET_NSC_SUBTYPE = 37;
+ public static final byte NXAST_SET_NSC_SUBTYPE = 110;
public static final NiciraActionSerializerKey SERIALIZER_KEY =
new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionSetNshc4.class);
public static final NiciraActionDeserializerKey DESERIALIZER_KEY =
diff -ruN a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNsiCodec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNsiCodec.java
--- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNsiCodec.java 2015-09-30 10:48:23.542944040 +0800
+++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNsiCodec.java 2015-09-30 10:52:47.236939825 +0800
@@ -25,7 +25,7 @@
*/
public class SetNsiCodec extends AbstractActionCodec {
public static final int LENGTH = 16;
- public static final byte NXAST_SET_NSI_SUBTYPE = 33;
+ public static final byte NXAST_SET_NSI_SUBTYPE = 106;
public static final NiciraActionSerializerKey SERIALIZER_KEY =
new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionSetNsi.class);
public static final NiciraActionDeserializerKey DESERIALIZER_KEY =
diff -ruN a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNspCodec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNspCodec.java
--- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNspCodec.java 2015-09-30 10:48:23.541944040 +0800
+++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNspCodec.java 2015-09-30 10:52:39.654939947 +0800
@@ -25,7 +25,7 @@
*/
public class SetNspCodec extends AbstractActionCodec {
public static final int LENGTH = 16;
- public static final byte NXAST_SET_NSP_SUBTYPE = 32;
+ public static final byte NXAST_SET_NSP_SUBTYPE = 105;
public static final NiciraActionSerializerKey SERIALIZER_KEY =
new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionSetNsp.class);
public static final NiciraActionDeserializerKey DESERIALIZER_KEY =
diff -ruN a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/Nshc1Codec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/Nshc1Codec.java
--- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/Nshc1Codec.java 2015-09-30 10:48:23.542944040 +0800
+++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/Nshc1Codec.java 2015-09-30 10:52:05.113940499 +0800
@@ -27,7 +27,7 @@
public class Nshc1Codec extends AbstractMatchCodec {
private static final int VALUE_LENGTH = 4;
- private static final int NXM_FIELD_CODE = 39;
+ private static final int NXM_FIELD_CODE = 107;
public static final MatchEntrySerializerKey<Nxm1Class, NxmNxNshc1> SERIALIZER_KEY = new MatchEntrySerializerKey<>(
EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxNshc1.class);
public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey(
diff -ruN a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/Nshc2Codec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/Nshc2Codec.java
--- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/Nshc2Codec.java 2015-09-30 10:48:23.542944040 +0800
+++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/Nshc2Codec.java 2015-09-30 10:52:03.282940528 +0800
@@ -27,7 +27,7 @@
public class Nshc2Codec extends AbstractMatchCodec {
private static final int VALUE_LENGTH = 4;
- private static final int NXM_FIELD_CODE = 40;
+ private static final int NXM_FIELD_CODE = 108;
public static final MatchEntrySerializerKey<Nxm1Class, NxmNxNshc2> SERIALIZER_KEY = new MatchEntrySerializerKey<>(
EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxNshc2.class);
public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey(
diff -ruN a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/Nshc3Codec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/Nshc3Codec.java
--- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/Nshc3Codec.java 2015-09-30 10:48:23.543944040 +0800
+++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/Nshc3Codec.java 2015-09-30 10:52:14.114940355 +0800
@@ -27,7 +27,7 @@
public class Nshc3Codec extends AbstractMatchCodec {
private static final int VALUE_LENGTH = 4;
- private static final int NXM_FIELD_CODE = 41;
+ private static final int NXM_FIELD_CODE = 109;
public static final MatchEntrySerializerKey<Nxm1Class, NxmNxNshc3> SERIALIZER_KEY = new MatchEntrySerializerKey<>(
EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxNshc3.class);
public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey(
diff -ruN a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/Nshc4Codec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/Nshc4Codec.java
--- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/Nshc4Codec.java 2015-09-30 10:48:23.543944040 +0800
+++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/Nshc4Codec.java 2015-09-30 10:52:22.790940216 +0800
@@ -27,7 +27,7 @@
public class Nshc4Codec extends AbstractMatchCodec {
private static final int VALUE_LENGTH = 4;
- private static final int NXM_FIELD_CODE = 42;
+ private static final int NXM_FIELD_CODE = 110;
public static final MatchEntrySerializerKey<Nxm1Class, NxmNxNshc4> SERIALIZER_KEY = new MatchEntrySerializerKey<>(
EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxNshc4.class);
public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey(
diff -ruN a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/NsiCodec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/NsiCodec.java
--- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/NsiCodec.java 2015-09-30 10:48:23.543944040 +0800
+++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/NsiCodec.java 2015-09-30 10:51:49.440940749 +0800
@@ -28,7 +28,7 @@
public class NsiCodec extends AbstractMatchCodec {
private static final int VALUE_LENGTH = 1;
- private static final int NXM_FIELD_CODE = 38;
+ private static final int NXM_FIELD_CODE = 106;
public static final MatchEntrySerializerKey<Nxm1Class, NxmNxNsi> SERIALIZER_KEY = new MatchEntrySerializerKey<>(
EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxNsi.class);
public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey(
diff -ruN a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/NspCodec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/NspCodec.java
--- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/NspCodec.java 2015-09-30 10:48:23.543944040 +0800
+++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/NspCodec.java 2015-09-30 10:51:41.146940882 +0800
@@ -28,7 +28,7 @@
public class NspCodec extends AbstractMatchCodec {
private static final int VALUE_LENGTH = 4;
- private static final int NXM_FIELD_CODE = 37;
+ private static final int NXM_FIELD_CODE = 105;
public static final MatchEntrySerializerKey<Nxm1Class, NxmNxNsp> SERIALIZER_KEY = new MatchEntrySerializerKey<>(
EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxNsp.class);
public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey(

View File

@ -10,6 +10,23 @@ set -eux
ODL_TARBALL_LOCATION=${ODL_TARBALL_LOCATION:-https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/integration/distribution-karaf/0.4.1-Beryllium-SR1/distribution-karaf-0.4.1-Beryllium-SR1.tar.gz}
JAVA8_URL=${JAVA8_URL:-https://launchpad.net/~openjdk-r/+archive/ubuntu/ppa/+files/openjdk-8-jre-headless_8u72-b15-1~trusty1_amd64.deb}
#ODL openflowjava NSH subtype patch related
# The patch's TAG should mach with ODL release being patched
# Normally it is release/beryllium-sr1 for ditribution-karaf-0.4.1-Beryllium-SR1.tar.gz
# release/beryllium-sr2 for ditribution-karaf-0.4.2-Beryllium-SR2.tar.gz
# stable/beryllium for ditribution-karaf-0.4.x-SNAPSHOT.tar.gz
# The patch should be explicitly enabled, since its build time is 1 hour and only applies
# while the openvswitch in fuel-plugin-ovs is not compatible with the actual openflow
# implementation of OpenDayLight. There is a possibility to build the patch separately
# and put into folder odl_package/nsh-pritesh-patch. Remember checking the file's naming
# in this case. If the plugin encounters the supplied jarball it wont build itself but
# will try using the supplied one.
ENA_NSH_SUB_PATCH=${ENA_NSH_SUB_PATCH:-false}
REPO=${REPO:-'openflowplugin'}
ODLTAG=${ODLTAG:-'release/beryllium-sr2'}
JARBALL=${JARBALL:-'openflowjava-extension-nicira'}
bdart=''
#Verion number used in deb/rpm package
ODL_VERSION_NUMBER=${ODL_VERSION_NUMBER:-0.4.1}
ODL_DESCRIPTION="OpenDaylight SDN Controller"
@ -80,6 +97,79 @@ function download_dependencies {
fi
}
#
#ODL patch related
function putbldenv() {
cat >env.sh <<EOF
#!bin/bash
REPO=${REPO}
ODLTAG=${ODLTAG}
EOF
}
function compute_ver() {
local ret=''
local rel=''
local amm=''
local tag=$(echo $1 | cut -d '/' -f 2)
if [ "$tag" != "${tag/-/}" ]; then
rel=$(echo $tag | cut -d '-' -f 1 | sed 's/.*/\u&/')
amm=$(echo $tag | cut -d '-' -f 2 | tr '[:lower:]' '[:upper:]')
ret="${rel}-${amm}"
else
rel=$(echo $tag | sed 's/.*/\u&/')
ret="${rel}"
fi
echo $ret
}
function build_jarball() {
local reporoot="/root/${REPO}"
local niciart="extension/${JARBALL}/target"
local artexp="odl_package/nsh-pritesh-patch"
local bld=''
local ver=''
case $1 in
ubuntu)
pushd ${DIR}/ofjavansh
putbldenv
wget -N https://raw.githubusercontent.com/opendaylight/odlparent/stable/beryllium/settings.xml
sudo docker build -t ofjavansh .
container_id=$(sudo docker run -d ofjavansh)
bld=$(echo $ODLTAG | cut -d '/' -f 1)
if [ "$bld" == "release" ] ; then
ver=$(compute_ver $ODLTAG)
else
ver='SNAPSHOT'
fi
mkdir -p ${DIR}/d
sudo docker cp $container_id:${reporoot}/${niciart}/. ${DIR}/d
pushd ${DIR}/d
bdart=$(echo ${JARBALL}-[0-9].[0-9].[0-9]-${ver}.jar)
cp $bdart ${DIR}/${artexp}/
popd
sudo rm -rf ${DIR}/d
popd
;;
*)
echo "Not supported system"
exit 1
;;
esac
}
function patch_odl {
local artexp="odl_package/nsh-pritesh-patch"
local TARBASE="opendaylight_src/system/org/opendaylight/openflowplugin/openflowjava-extension-nicira"
local SRC="${DIR}/${artexp}/${bdart}"
echo "patching..."
TARGET=$(echo ${TMP_DIR}/${TARBASE}/*/${bdart})
cp $SRC $TARGET
}
function build_pkg {
case $1 in
centos)
@ -121,6 +211,14 @@ else
unpack $ODL_TARBALL_LOCATION 'opendaylight_src'
fi
if [ "$ENA_NSH_SUB_PATCH" = true ] ; then
jarpatch=$(echo ${DIR}/odl_package/nsh-pritesh-patch/${JARBALL}-*.jar)
if [ ! -f "$jarpatch" ] ; then
build_jarball $BUILD_FOR
fi
patch_odl
fi
git clone $NETWORKING_ODL_REPO networking_odl
pushd networking_odl
git checkout $NETWORKING_ODL_BRANCH