From f5c52caac2e153756b1e17cf752ac2ba21b3522f Mon Sep 17 00:00:00 2001 From: Michal Skalski Date: Sun, 20 Nov 2016 22:21:00 +0100 Subject: [PATCH] Use integration-packaging project to build ODL Deb Use docker container from integration-packaging project to build OpenDaylight deb packages. This change introduce support for systemd and is a part of uplifting plugin to Fuel 10. Notice: to build plugin with more than one version of ODL fuel-plugin-builder needs to be installed from sources, this change is required: https://review.openstack.org/#/c/311031/ Change-Id: Ib6204c1fa71a844fe42b878352bd987c192ee9dd Signed-off-by: Michal Skalski --- README.md | 21 +- .../parser/functions/odl_hiera_overrides.rb | 28 +- .../parser/functions/odl_package_name.rb | 15 - .../modules/opendaylight/manifests/install.pp | 37 ++- .../opendaylight/templates/override.conf.erb | 2 + .../modules/opendaylight/templates/setenv.erb | 3 + environment_config.yaml | 28 +- odl_package/centos/dependencies.txt | 13 - odl_package/centos/opendaylight | 31 -- odl_package/centos/opendaylight-post | 6 - odl_package/nsh-pritesh-patch/.gitkeep | 0 odl_package/ubuntu/opendaylight | 47 --- odl_package/ubuntu/opendaylight-post | 6 - ofjavansh/Dockerfile | 19 -- ofjavansh/buildPatchedOpenflowjavaJarball.sh | 24 -- .../openflowplugin_modify_nsh_subtype.patch | 144 --------- pre_build_hook | 286 ++++-------------- 17 files changed, 136 insertions(+), 574 deletions(-) delete mode 100644 deployment_scripts/puppet/modules/opendaylight/lib/puppet/parser/functions/odl_package_name.rb create mode 100644 deployment_scripts/puppet/modules/opendaylight/templates/override.conf.erb create mode 100644 deployment_scripts/puppet/modules/opendaylight/templates/setenv.erb delete mode 100644 odl_package/centos/dependencies.txt delete mode 100644 odl_package/centos/opendaylight delete mode 100644 odl_package/centos/opendaylight-post delete mode 100644 odl_package/nsh-pritesh-patch/.gitkeep delete mode 100644 odl_package/ubuntu/opendaylight delete mode 100644 odl_package/ubuntu/opendaylight-post delete mode 100644 ofjavansh/Dockerfile delete mode 100644 ofjavansh/buildPatchedOpenflowjavaJarball.sh delete mode 100644 ofjavansh/patches/openflowplugin_modify_nsh_subtype.patch diff --git a/README.md b/README.md index 3c638c8..e1233f2 100644 --- a/README.md +++ b/README.md @@ -38,25 +38,21 @@ OpenDaylight plugin installation pip install fuel-plugin-builder -3. Install the [fpm gem](https://github.com/jordansissel/fpm): - - gem install fpm - -4. Build OpenDaylight Fuel plugin: +3. Build OpenDaylight Fuel plugin: fpb --build fuel-plugin-opendaylight/ -5. The *opendaylight-[x.x.x].rpm* plugin package will be created in the plugin folder. +4. The *opendaylight-[x.x.x].rpm* plugin package will be created in the plugin folder. -6. Move this file to the Fuel Master node with secure copy (scp): +5. Move this file to the Fuel Master node with secure copy (scp): scp opendaylight-[x.x.x].rpm root@:/tmp -7. While logged in Fuel Master install the OpenDaylight plugin: +6. While logged in Fuel Master install the OpenDaylight plugin: fuel plugins --install opendaylight-[x.x.x].rpm -8. Check if the plugin was installed successfully: +7. Check if the plugin was installed successfully: fuel plugins @@ -64,7 +60,7 @@ OpenDaylight plugin installation ---|--------------|---------|---------------- 1 | opendaylight | 0.5.2 | 2.0.0 -9. Plugin is ready to use and can be enabled on the Settings tab of the Fuel web UI. +8. Plugin is ready to use and can be enabled on the Settings tab of the Fuel web UI. User Guide @@ -75,7 +71,7 @@ OpenDaylight plugin configuration 1. Create a new environment with the Fuel UI wizard. 2. Click on the Settings tab of the Fuel web UI. -3. Select "OpenDaylight plugin" section. +3. Select "OpenDaylight plugin" section in "Other" tab. 4. Tick the checkbox and click "Save Settings" button. 5. Assign role OPENDAYLIGHT to one of the node. @@ -84,6 +80,9 @@ Build options ------------- It is possible to modify process of building plugin by setting environment variables. Look into [pre_build_hook file](pre_build_hook) for more details. +For example include 2 versions of opendaylight controller in plugin: + + ODL_VERSIONS="5.1.0.1 5.0.0.1" fpb --build fuel-plugin-opendaylight/ Testing diff --git a/deployment_scripts/puppet/modules/opendaylight/lib/puppet/parser/functions/odl_hiera_overrides.rb b/deployment_scripts/puppet/modules/opendaylight/lib/puppet/parser/functions/odl_hiera_overrides.rb index 0c726cc..471da9b 100644 --- a/deployment_scripts/puppet/modules/opendaylight/lib/puppet/parser/functions/odl_hiera_overrides.rb +++ b/deployment_scripts/puppet/modules/opendaylight/lib/puppet/parser/functions/odl_hiera_overrides.rb @@ -28,24 +28,30 @@ module Puppet::Parser::Functions # Without this floating IPs doesn't work. # This option will be no longer used in Mitaka release. # Must be changed before that! - l3_agent = {'neutron_l3_agent_config' => - {'DEFAULT/external_network_bridge' => - {'value' => 'br-ex'} - } - } + l3_agent = { + 'neutron_l3_agent_config' => { + 'DEFAULT/external_network_bridge' => {'value' => 'br-ex'}, + 'ovs/ovsdb_interface' => {'value' => 'vsctl'} + } + } # When L3 forward is enabled in odl there is no neutron l3 agent # which normally proxy request to metadata agent. Dhcp agent can # takeover this task - dhcp_agent = {'neutron_dhcp_agent_config' => - {'DEFAULT/force_metadata' => - {'value' => true} - } - } + # Use vsctl ovsdb interface instead of native which is default + # since Newton release. Using older interface prevents neutron + # from switching ovs to listen in passive mode (ptcp:6640) + # https://bugs.launchpad.net/neutron/+bug/1614766 + dhcp_agent = { + 'neutron_dhcp_agent_config' => { + 'DEFAULT/force_metadata' => {'value' => true}, + 'ovs/ovsdb_interface' => {'value' => 'vsctl'} + } + } configuration.merge! ml2_plugin configuration.merge! l3_agent - configuration.merge! dhcp_agent if odl['enable_l3_odl'] + configuration.merge! dhcp_agent hiera_overrides['configuration'] = configuration # override neutron_config/quantum_settings diff --git a/deployment_scripts/puppet/modules/opendaylight/lib/puppet/parser/functions/odl_package_name.rb b/deployment_scripts/puppet/modules/opendaylight/lib/puppet/parser/functions/odl_package_name.rb deleted file mode 100644 index ea6fca0..0000000 --- a/deployment_scripts/puppet/modules/opendaylight/lib/puppet/parser/functions/odl_package_name.rb +++ /dev/null @@ -1,15 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:odl_package_name, :arity => 1, :type => :rvalue, :doc => <<-EOS - @desc Check if feature which require experimental odl is enabled. - @return String with odl deb package name. - EOS - ) do |args| - odl_settings = args[0] - experimental_odl = odl_settings['metadata']['use_experimental_odl'] - if experimental_odl.is_a?(Array) and experimental_odl.any? { |feature| odl_settings[feature] } - odl_settings['metadata']['experimental_odl_deb'] - else - odl_settings['metadata']['odl_deb'] - end - end -end diff --git a/deployment_scripts/puppet/modules/opendaylight/manifests/install.pp b/deployment_scripts/puppet/modules/opendaylight/manifests/install.pp index 1962609..2c3d776 100644 --- a/deployment_scripts/puppet/modules/opendaylight/manifests/install.pp +++ b/deployment_scripts/puppet/modules/opendaylight/manifests/install.pp @@ -6,20 +6,33 @@ class opendaylight::install ( $management_vip = hiera('management_vip') $conf_dir = '/opt/opendaylight/etc' $jetty_port = $opendaylight::jetty_port - $odl_package = odl_package_name($opendaylight::odl_settings) + $odl_package = $opendaylight::odl_settings['deb_version'] + $java_min_mem = $opendaylight::odl_settings['java_min_mem'] + $java_max_mem = $opendaylight::odl_settings['java_max_mem'] + $java_extra_opts = $opendaylight::odl_settings['java_extra_opts'] $manage_l3_traffic = $opendaylight::odl_settings['enable_l3_odl'] ? { true => 'yes', default => 'no', } - package { $odl_package: - ensure => installed, + package { 'opendaylight': + ensure => $odl_package, } - # quagga - class { 'opendaylight::quagga': - before => Service['opendaylight'] + #Temporary solution until number of allowed open files + #will be fixed in main systemd service file + file {'/etc/systemd/system/opendaylight.service.d': + ensure => directory, + } -> + file {'/etc/systemd/system/opendaylight.service.d/override.conf': + ensure => file, + content => template('opendaylight/override.conf.erb'), + } ~> + exec {'systemctl-daemon-reload': + refreshonly => true, + command => 'systemctl daemon-reload', + path => ['/bin', '/user/bin'], } firewall {'215 odl': @@ -40,6 +53,12 @@ class opendaylight::install ( owner => 'odl', content => template('opendaylight/jetty.xml.erb') } + file { '/opt/opendaylight/bin/setenv': + ensure => file, + owner => 'odl', + mode => '0755', + content => template('opendaylight/setenv.erb') + } $karaf_custom_properties_file = { 'path' => "${conf_dir}/custom.properties", @@ -48,8 +67,6 @@ class opendaylight::install ( } $karaf_custom_properties = { '' => { - 'of.address' => $bind_address, - 'of.listenPort' => '6653', 'ovsdb.of.version' => '1.3', 'ovsdb.l3.fwd.enabled' => $manage_l3_traffic, } @@ -68,9 +85,9 @@ class opendaylight::install ( value => $enabled_features, } - Package[$odl_package] -> + Package['opendaylight'] -> Ini_setting <||> -> Firewall <||> -> - File <||> -> + File <||> ~> Service['opendaylight'] } diff --git a/deployment_scripts/puppet/modules/opendaylight/templates/override.conf.erb b/deployment_scripts/puppet/modules/opendaylight/templates/override.conf.erb new file mode 100644 index 0000000..e18b259 --- /dev/null +++ b/deployment_scripts/puppet/modules/opendaylight/templates/override.conf.erb @@ -0,0 +1,2 @@ +[Service] +LimitNOFILE=102400 diff --git a/deployment_scripts/puppet/modules/opendaylight/templates/setenv.erb b/deployment_scripts/puppet/modules/opendaylight/templates/setenv.erb new file mode 100644 index 0000000..a9d2252 --- /dev/null +++ b/deployment_scripts/puppet/modules/opendaylight/templates/setenv.erb @@ -0,0 +1,3 @@ +export JAVA_MIN_MEM=<%= @java_min_mem %> +export JAVA_MAX_MEM=<%= @java_max_mem %> +export EXTRA_JAVA_OPTS=<%= @java_extra_opts %> diff --git a/environment_config.yaml b/environment_config.yaml index c2aae46..3e9ef5e 100644 --- a/environment_config.yaml +++ b/environment_config.yaml @@ -68,6 +68,30 @@ attributes: regex: source: ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$ error: 'Invalid port number' + java_min_mem: + value: '1g' + label: 'Java -Xms option' + description: 'Initial memory allocation pool.' + weight: 80 + type: "text" + java_max_mem: + value: '2g' + label: 'Java -Xmx option' + description: 'Maximum memory allocation pool.' + weight: 81 + type: "text" + java_extra_opts: + value: '-XX:+UseG1GC' + label: 'Java extra options' + description: 'Additional options.' + weight: 82 + type: "text" + deb_version: + value: '5.0.0-1' + label: 'OpenDaylight package version' + description: 'Plugin can be build with more than one version of ODL.' + weight: 90 + type: "text" metadata: restrictions: - "cluster:net_provider != 'neutron'": "Only neutron is supported by OpenDaylight" @@ -99,10 +123,6 @@ attributes: - odl-sfc-provider-rest - odl-sfc-ovs - odl-sfc-openflow-renderer - odl_deb: opendaylight - experimental_odl_deb: opendaylight-experimental - use_experimental_odl: - - enable_bgpvpn default_credentials: user: admin password: admin diff --git a/odl_package/centos/dependencies.txt b/odl_package/centos/dependencies.txt deleted file mode 100644 index 1eb217f..0000000 --- a/odl_package/centos/dependencies.txt +++ /dev/null @@ -1,13 +0,0 @@ -http://mirror.centos.org/centos/6/os/x86_64/Packages/java-1.7.0-openjdk-1.7.0.79-2.5.5.4.el6.x86_64.rpm -http://mirror.centos.org/centos/6/os/x86_64/Packages/gdk-pixbuf2-2.24.1-5.el6.x86_64.rpm -http://mirror.centos.org/centos/6/os/x86_64/Packages/sgml-common-0.6.3-33.el6.noarch.rpm -http://mirror.centos.org/centos/6/os/x86_64/Packages/GConf2-2.28.0-6.el6.x86_64.rpm -http://mirror.centos.org/centos/6/os/x86_64/Packages/ORBit2-2.14.17-5.el6.x86_64.rpm -http://mirror.centos.org/centos/6/os/x86_64/Packages/ttmkfdir-3.0.9-32.1.el6.x86_64.rpm -http://mirror.centos.org/centos/6/os/x86_64/Packages/libIDL-0.8.13-2.1.el6.x86_64.rpm -http://mirror.centos.org/centos/6/os/x86_64/Packages/jpackage-utils-1.7.5-3.14.el6.noarch.rpm -http://mirror.centos.org/centos/6/os/x86_64/Packages/tzdata-java-2015e-1.el6.noarch.rpm -http://mirror.centos.org/centos/6/os/x86_64/Packages/xorg-x11-fonts-Type1-7.2-11.el6.noarch.rpm -http://mirror.centos.org/centos/6/os/x86_64/Packages/giflib-4.1.6-3.1.el6.x86_64.rpm -http://mirror.centos.org/centos/6/os/x86_64//Packages/gtk2-2.24.23-6.el6.x86_64.rpm -http://mirror.centos.org/centos/6/os/x86_64//Packages/glib2-2.28.8-4.el6.x86_64.rpm diff --git a/odl_package/centos/opendaylight b/odl_package/centos/opendaylight deleted file mode 100644 index be4f347..0000000 --- a/odl_package/centos/opendaylight +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# chkconfig: 345 98 2 -# description: ODL controller -# OpenDaylight service controller script -export JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64 -USER=odl - -cd /opt/opendaylight -case "$1" in - start) - /bin/su -m $USER -s /bin/bash -c ./bin/start - ;; - stop) - /bin/su -m $USER -s /bin/bash -c ./bin/stop - ;; - status) - PID=`ps aux | grep java | grep karaf | awk '{print $2}'` - if test -z $PID - then - echo "ODL is down..." - exit 1 - else - echo "ODL is running... PID $PID" - exit 0 - fi - ;; - *) - echo "Usage: $0 {start|stop|status}" - exit 1 - ;; -esac diff --git a/odl_package/centos/opendaylight-post b/odl_package/centos/opendaylight-post deleted file mode 100644 index 36e46b6..0000000 --- a/odl_package/centos/opendaylight-post +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -set -e - -adduser --system --home /opt/opendaylight --shell /sbin/nologin odl -/sbin/chkconfig --add opendaylight -chown -R odl:odl /opt/opendaylight diff --git a/odl_package/nsh-pritesh-patch/.gitkeep b/odl_package/nsh-pritesh-patch/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/odl_package/ubuntu/opendaylight b/odl_package/ubuntu/opendaylight deleted file mode 100644 index fd84376..0000000 --- a/odl_package/ubuntu/opendaylight +++ /dev/null @@ -1,47 +0,0 @@ -# vim:set ft=upstart ts=2 et: -description "OpenDaylight controller" -author "mskalski@miranits.com" - -start on runlevel [2345] -stop on runlevel [!2345] - -setgid odl -setuid odl - -env KARAF_HOME="/opt/opendaylight" -env JAVA_OPTS="-server -Xms1g -Xmx2g -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -Dcom.sun.management.jmxremote" -env OPTS="-Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true" -env MAIN="org.apache.karaf.main.Main" -env DEBUG="false" - -limit nofile 102400 112640 -chdir /opt/opendaylight - -script - # Try to find lang used in system - test -f /etc/default/locale && . /etc/default/locale || true - export LANG=$LANG - export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:/jre/bin/java::") - export KARAF_BASE="$KARAF_HOME" - export KARAF_DATA="$KARAF_BASE/data" - export KARAF_ETC="$KARAF_BASE/etc" - export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:$KARAF_BASE/lib" - export JAVA_ENDORSED_DIRS="${JAVA_HOME}/jre/lib/endorsed:${JAVA_HOME}/lib/endorsed:${KARAF_HOME}/lib/endorsed" - export JAVA_EXT_DIRS="${JAVA_HOME}/jre/lib/ext:${JAVA_HOME}/lib/ext:${KARAF_HOME}/lib/ext" - - if [ "$DEBUG" = true ]; then - JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7586 ${JAVA_OPTS}" - fi - - for file in "$KARAF_HOME"/lib/karaf*.jar - do - if [ -z "$CLASSPATH" ]; then - CLASSPATH="$file" - else - CLASSPATH="$CLASSPATH:$file" - fi - done - - exec ${JAVA_HOME}/bin/java $JAVA_OPTS -Djava.endorsed.dirs="${JAVA_ENDORSED_DIRS}" -Djava.ext.dirs="${JAVA_EXT_DIRS}" -Dkaraf.instances="${KARAF_HOME}/instances" -Dkaraf.home="$KARAF_HOME" -Dkaraf.base="$KARAF_BASE" -Dkaraf.data="$KARAF_DATA" -Dkaraf.etc="$KARAF_ETC" -Djava.io.tmpdir="$KARAF_DATA/tmp" -Djava.util.logging.config.file="$KARAF_BASE/etc/java.util.logging.properties" $KARAF_OPTS $OPTS -classpath "$CLASSPATH" $MAIN - -end script diff --git a/odl_package/ubuntu/opendaylight-post b/odl_package/ubuntu/opendaylight-post deleted file mode 100644 index df6c600..0000000 --- a/odl_package/ubuntu/opendaylight-post +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -set -e - -adduser --quiet --system --group --no-create-home --home /opt/opendaylight odl -chown -R odl:odl /opt/opendaylight -chown odl:odl /etc/init/opendaylight.conf diff --git a/ofjavansh/Dockerfile b/ofjavansh/Dockerfile deleted file mode 100644 index a29e86f..0000000 --- a/ofjavansh/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ - -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 diff --git a/ofjavansh/buildPatchedOpenflowjavaJarball.sh b/ofjavansh/buildPatchedOpenflowjavaJarball.sh deleted file mode 100644 index 8f8f8ee..0000000 --- a/ofjavansh/buildPatchedOpenflowjavaJarball.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/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 diff --git a/ofjavansh/patches/openflowplugin_modify_nsh_subtype.patch b/ofjavansh/patches/openflowplugin_modify_nsh_subtype.patch deleted file mode 100644 index 5a2f1bb..0000000 --- a/ofjavansh/patches/openflowplugin_modify_nsh_subtype.patch +++ /dev/null @@ -1,144 +0,0 @@ -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 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 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 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 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 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 SERIALIZER_KEY = new MatchEntrySerializerKey<>( - EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxNsp.class); - public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey( diff --git a/pre_build_hook b/pre_build_hook index cb5b0bd..617b25a 100755 --- a/pre_build_hook +++ b/pre_build_hook @@ -1,250 +1,70 @@ #!/bin/bash - -# Add here any the actions which are required before plugin build -# like packages building, packages downloading from mirrors and so on. -# The script should return 0 if there were no errors. set -eux -CACHE=${CACHE:-false} -RENEW=${RENEW:-false} -DIR="$(dirname `readlink -f $0`)" +USE_CACHE=${USE_CACHE:-true} +ODL_INTEGRATION_PACKAGING=${ODL_INTEGRATION_PACKAGING:-https://github.com/opendaylight/integration-packaging} -if [ "$CACHE" == true ];then - export cache_dir=$DIR/.cache/; - if [ -e $cache_dir ] && [[ "$RENEW" == false ]];then - export OPNFV_QUAGGE_PACKAGING_REPO=$cache_dir/opnfv-quagga/; - export NETWORKING_ODL_REPO=$cache_dir/networking_odl/; - export ODL_TARBALL_LOCATION=$cache_dir/karaf-odl.tar.gz; - fi -fi -# Where we can find odl karaf distribution tarball -# can be http(s) url or absolute path -ODL_TARBALL_LOCATION=${ODL_TARBALL_LOCATION:-https://nexus.opendaylight.org/content/groups/public/org/opendaylight/integration/distribution-karaf/0.5.0-Boron/distribution-karaf-0.5.0-Boron.tar.gz} -ODL_EXPERIMENTAL_TARBALL_LOCATION=${ODL_EXPERIMENTAL_TARBALL_LOCATION:-https://nexus.opendaylight.org/content/repositories/public/org/opendaylight/integration/distribution-karaf/0.5.1-Boron-SR1/distribution-karaf-0.5.1-Boron-SR1.tar.gz} -ODL_EXPERIMENTAL_DEB_NAME=${ODL_EXPERIMENTAL_DEB_NAME:-opendaylight-experimental} - -#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.5.0} -ODL_EXPERIMENTAL_VERSION_NUMBER=${ODL_EXPERIMENTAL_VERSION_NUMBER:-0.5.1} -ODL_DESCRIPTION="OpenDaylight SDN Controller" -TMP_NAME="karaf-odl.tar.gz" +# ODL versions to build, separated by space +# Taken from https://github.com/opendaylight/integration-packaging/blob/master/deb/build_vars.yaml +# If more than one version of ODL are included make sure that local +# fpb contain this commit https://review.openstack.org/#/c/311031/ +ODL_VERSIONS=${ODL_VERSIONS:-5.0.0.1} #Networking odl -NETWORKING_ODL_REPO=${NETWORKING_ODL_REPO:-https://github.com/openstack/networking-odl.git} -NETWORKING_ODL_BRANCH=${NETWORKING_ODL_BRANCH:-stable/mitaka} - -#Opnfv-quagga-packaging -OPNFV_QUAGGE_PACKAGING_REPO=${OPNFV_QUAGGE_PACKAGING_REPO:-https://github.com/nikolas-hermanns/opnfv-quagga-packaging} -OPNFV_QUAGGE_PACKAGING_BRANCH=stable/colorado - -# For which systems odl package should be build -BUILD_FOR=${BUILD_FOR:-ubuntu} +NETWORKING_ODL_REPO=${NETWORKING_ODL_REPO:-http://ubuntu-cloud.archive.canonical.com/ubuntu/pool/main/n/networking-odl/} +NETWORKING_ODL_DEB=${NETWORKING_ODL_DEB:-python-networking-odl_2.0.1~git20160926.416a5c7-0ubuntu1~cloud0_all.deb} DIR="$(dirname `readlink -f $0`)" -TMP_DIR="${DIR}/tmp" -MODULES="${DIR}/deployment_scripts/puppet/modules" +CACHE_DIR="${DIR}/.cache" +CACHE_DEB_DIR="${CACHE_DIR}/integration-packaging/deb/cache" -#Remove temporary files -CLEANUP=${CLEANUP:-true} - -function cleanup { - rm -rf "${TMP_DIR}" -} - -function download { - wget "$1" -qO $2 -} - -function unpack { - mkdir "${TMP_DIR}/${2}" - tar xzf $1 --strip-components=1 -C "${TMP_DIR}/${2}" -} - -function add_opnfv_quagga { - path=$1 - pushd ${TMP_DIR} - git clone $OPNFV_QUAGGE_PACKAGING_REPO opnfv-quagga - pushd opnfv-quagga - git checkout $OPNFV_QUAGGE_PACKAGING_BRANCH - if [ ! -e debian_package/ ];then - sudo apt-get -y install `cat requirements.txt` - make -j6 - fi - cp debian_package/* $path - popd - popd - -} - -# -#ODL patch related -function putbldenv() { - cat >env.sh <=0.1.0" $1 - then - sed -i -e "s/neutron-lib>=0.1.0/neutron-lib>=0.0.1/" $1 - fi -} - -function get_karaf { - if [[ "$1" =~ ^http.* ]] - then - download $1 $2 - unpack $2 $3 - else - unpack $1 $3 - fi -} - -function build_pkg { - # clean up - rm -rf ${DIR}/repositories/${1}/* - case $1 in - centos) - pushd "${DIR}/repositories/${1}/" - fpm --force -s dir -t rpm --version "${ODL_VERSION_NUMBER}" --description "${ODL_DESCRIPTION}" --prefix /opt/opendaylight --rpm-init "${DIR}/odl_package/${1}/opendaylight" --after-install "${DIR}/odl_package/${1}/opendaylight-post" --name opendaylight -d "java-1.7.0-openjdk" -C "${TMP_DIR}/opendaylight_src" - popd - ;; - ubuntu) - pushd "${DIR}/repositories/${1}/" - fpm --architecture all --force -s dir -t deb -m 'mskalski@mirantis.com' --version "${ODL_VERSION_NUMBER}" --description "${ODL_DESCRIPTION}" --prefix /opt/opendaylight --deb-upstart "${DIR}/odl_package/${1}/opendaylight" --after-install "${DIR}/odl_package/${1}/opendaylight-post" --name opendaylight -d openjdk-8-jre-headless -C "${TMP_DIR}/opendaylight_src" - if [ "$ODL_EXPERIMENTAL_TARBALL_LOCATION" != false ] ; then - fpm --architecture all --force -s dir -t deb -m 'mskalski@mirantis.com' --version "${ODL_EXPERIMENTAL_VERSION_NUMBER}" --description "${ODL_DESCRIPTION}" --prefix /opt/opendaylight --deb-upstart "${DIR}/odl_package/${1}/opendaylight" --after-install "${DIR}/odl_package/${1}/opendaylight-post" --name "${ODL_EXPERIMENTAL_DEB_NAME}" -d openjdk-8-jre-headless -C "${TMP_DIR}/${ODL_EXPERIMENTAL_DEB_NAME}_src" - fi - patch_networking_odl_deb ${TMP_DIR}/networking_odl/requirements.txt - fpm --architecture all --force -s python -t deb -m 'mskalski@mirantis.com' --python-install-lib /usr/lib/python2.7/dist-packages ${TMP_DIR}/networking_odl/setup.py - popd - add_opnfv_quagga "${DIR}/repositories/${1}/" - ;; - *) echo "Not supported system"; exit 1;; - esac -} - -command -v fpm >/dev/null 2>&1 || { echo >&2 "fpm ruby gem required but it's not installed. Aborting."; exit 1; } - -cleanup - -mkdir -p "${TMP_DIR}" - -pushd $TMP_DIR - -get_karaf $ODL_TARBALL_LOCATION "karaf-odl.tar.gz" "opendaylight_src" - -if [ "$ODL_EXPERIMENTAL_TARBALL_LOCATION" != false ] ; then - get_karaf $ODL_EXPERIMENTAL_TARBALL_LOCATION "karaf-experimental-odl.tar.gz" "${ODL_EXPERIMENTAL_DEB_NAME}_src" +# OPNFV builds plugin inside container, in that case +# we need to use sudo to have access to docker +OPNFV_BUILD=${OPNFV_BUILD:-false} +if [ "$OPNFV_BUILD" == true ] ;then + SUDO="sudo" +else + SUDO=" " 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 +function prep_build_env { + docker_build_opts="-t odl_deb" + if [ "$USE_CACHE" != true ] || [ ! -d "${CACHE_DIR}/integration-packaging" ] ;then + rm -rf ${CACHE_DIR}/integration-packaging + git clone ${ODL_INTEGRATION_PACKAGING} ${CACHE_DIR}/integration-packaging + docker_build_opts+=" --no-cache" fi - patch_odl -fi + $SUDO docker build ${docker_build_opts} ${CACHE_DIR}/integration-packaging/deb +} -git clone $NETWORKING_ODL_REPO networking_odl -pushd networking_odl -git checkout $NETWORKING_ODL_BRANCH -popd +function build_odl_deb { + $SUDO docker run -u $(id -u) --rm -v ${CACHE_DIR}/integration-packaging/deb:/build odl_deb -v ${1//./ } + rm -rf ${CACHE_DIR}/integration-packaging/deb/opendaylight +} -for system in $BUILD_FOR +function in_cache { + [ -f "${CACHE_DEB_DIR}/${1}" ] +} + +function copy_from_cache { + cp ${CACHE_DEB_DIR}/${1} ${DIR}/repositories/ubuntu/${1} +} + +command -v docker >/dev/null 2>&1 || { echo >&2 "Docker is required but it's not installed. Aborting."; exit 1; } + +mkdir -p "${CACHE_DIR}" +prep_build_env +rm -f ${DIR}/repositories/ubuntu/*.deb + +for v in $ODL_VERSIONS do - build_pkg $system + deb_name="opendaylight_${v%.*}-${v##*.}_all.deb" + if ! in_cache $deb_name ;then + build_odl_deb $v + fi + copy_from_cache $deb_name done -if [ "$CACHE" == true ];then - if [ ! -e $cache_dir ] || [[ "$RENEW" == true ]];then - rm -rf $cache_dir - mkdir -p $cache_dir - cp -r ${DIR}/tmp/* $cache_dir/ - fi -fi - -if [ "$CLEANUP" != false ];then - cleanup +if ! in_cache $NETWORKING_ODL_DEB ;then + wget -O ${CACHE_DEB_DIR}/${NETWORKING_ODL_DEB} ${NETWORKING_ODL_REPO}/${NETWORKING_ODL_DEB} fi +copy_from_cache $NETWORKING_ODL_DEB