diff options
author | Wojciech Dec <wdec@cisco.com> | 2016-08-16 19:27:01 +0200 |
---|---|---|
committer | Wojciech Dec <wdec@cisco.com> | 2016-08-16 19:29:27 +0200 |
commit | c3b2c2a9a22bac5cf17813c589444d3abebaa23b (patch) | |
tree | 68c2fc0cb8c32cbb8fabf69ac81e1e0ba50cff2a /networking-odl/devstack | |
parent | 3285c8e93ea59d98b392591ef6dfa5b1de3bb92d (diff) |
Adding Mitaka networking-old module with the ODL topology based port
binding resolution mechanism from https://review.openstack.org/333186
Change-Id: I10d400aac9bb639c146527f0f93e6925cb74d9de
Signed-off-by: Wojciech Dec <wdec@cisco.com>
Diffstat (limited to 'networking-odl/devstack')
26 files changed, 1397 insertions, 0 deletions
diff --git a/networking-odl/devstack/README.rst b/networking-odl/devstack/README.rst new file mode 100644 index 0000000..2b4bd1c --- /dev/null +++ b/networking-odl/devstack/README.rst @@ -0,0 +1,80 @@ +====================== + Enabling in Devstack +====================== + +1. Download DevStack + +2. Copy the sample local.conf over:: + + cp devstack/local.conf.example local.conf + +3. Optionally, to manually configure this: + + Add this repo as an external repository:: + + > cat local.conf + [[local|localrc]] + enable_plugin networking-odl http://git.openstack.org/openstack/networking-odl + +4. Optionally, to enable support for OpenDaylight L3 router functionality, + add the below. + Note: This is only relevant when using old netvirt (ovsdb based, default):: + + > cat local.conf + [[local|localrc]] + ODL_L3=True + +5. If you need to route the traffic out of the box (e.g. br-ex), set + ODL_PROVIDER_MAPPINGS to map the physical provider network to device + mapping, as shown below:: + + > cat local.conf + [[local|localrc]] + ODL_L3=True + ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS:-br-ex:eth2} # for old netvirt (ovsdb based) + ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS:-physnet1:eth2} # for new netvirt (vpnservice based) + +6. Optionally, to enable support for OpenDaylight with LBaaS V2, add this:: + + > cat local.conf + [[local|localrc]] + enable_plugin neutron-lbaas http://git.openstack.org/openstack/neutron-lbaas + enable_service q-lbaasv2 + NEUTRON_LBAAS_SERVICE_PROVIDERV2="LOADBALANCERV2:opendaylight:networking_odl.lbaas.driver_v2.OpenDaylightLbaasDriverV2:default" + +7. run ``stack.sh`` + +8. Note: In a multi-node devstack environment, for each compute node you will + want to add this to the local.conf file:: + + > cat local.conf + [[local|localrc]] + enable_plugin networking-odl http://git.openstack.org/openstack/networking-odl + ODL_MODE=compute + +9. Note: In a node using a release of Open vSwitch provided from another source + than your Linux distribution you have to enable in your local.conf skipping + of OVS installation step by setting *SKIP_OVS_INSTALL=True*. For example + when stacking together with `networking-ovs-dpdk + <https://github.com/openstack/networking-ovs-dpdk/>`_ Neutron plug-in to + avoid conflicts between openvswitch and ovs-dpdk you have to add this to + the local.conf file:: + + > cat local.conf + [[local|localrc]] + enable_plugin networking-ovs-dpdk http://git.openstack.org/openstack/networking-ovs-dpdk + enable_plugin networking-odl http://git.openstack.org/openstack/networking-odl + SKIP_OVS_INSTALL=True + Q_ML2_PLUGIN_MECHANISM_DRIVERS=opendaylight + +10. Note: Optionally, to use the new netvirt implementation + (netvirt-vpnservice-openstack), add the following to the local.conf file + (only allinone topology is currently supported by devstack, since tunnel + endpoints are not automatically configured). For tunnel configurations + after loading devstack, please refer to this guide + https://wiki.opendaylight.org/view/Netvirt:_L2Gateway_HowTo#Configuring_Tunnels:: + + > cat local.conf + [[local|localrc]] + ODL_NETVIRT_KARAF_FEATURE=odl-restconf-all,odl-aaa-authn,odl-dlux-core,odl-mdsal-apidocs,odl-netvirt-vpnservice-openstack + ODL_BOOT_WAIT_URL=restconf/operational/network-topology:network-topology/ # Workaround since netvirt:1 no longer exists in DS! diff --git a/networking-odl/devstack/devstackgaterc b/networking-odl/devstack/devstackgaterc new file mode 100644 index 0000000..474cdc0 --- /dev/null +++ b/networking-odl/devstack/devstackgaterc @@ -0,0 +1,62 @@ +# 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. + +# +# This script is executed in the OpenStack CI job that runs DevStack + tempest. +# You can find the CI job configuration here: +# +# http://git.openstack.org/cgit/openstack-infra/project-config/tree/jenkins/jobs/networking-odl.yaml +# + +export OVERRIDE_ENABLED_SERVICES=q-svc,q-dhcp,q-meta,quantum,tempest,n-api,n-cond,n-cpu,n-crt,n-obj,n-sch,g-api,g-reg,mysql,rabbit,key,dstat + +# By default this variable is set to br100, and it is used to determine the value of PUBLIC_INTERFACE. +# PUBLIC_INTERFACE is wired to PUBLIC_BRIDGE to route traffic externally. Since, we don't currently +# need to route external traffic in the gate (no multi-node testing), this can be unset. +unset PUBLIC_INTERFACE + +# Begin list of exclusions. +r="^(?!.*" + +# exclude the slow tag (part of the default for 'full') +r="$r(?:.*\[.*\bslow\b.*\])" + +# exclude things that just aren't enabled: +r="$r|(?:tempest\.api\.network\.admin\.test_quotas\.QuotasTest\.test_lbaas_quotas.*)" +r="$r|(?:tempest\.api\.network\.test_load_balancer.*)" +r="$r|(?:tempest\.scenario\.test_load_balancer.*)" +r="$r|(?:tempest\.scenario\.test_network_basic_ops.*)" +r="$r|(?:tempest\.scenario\.test_security_groups_basic_ops.*)" +r="$r|(?:tempest\.api\.network\.admin\.test_load_balancer.*)" +r="$r|(?:tempest\.api\.network\.admin\.test_lbaas.*)" +r="$r|(?:tempest\.api\.network\.test_fwaas_extensions.*)" +r="$r|(?:tempest\.api\.network\.test_vpnaas_extensions.*)" +r="$r|(?:tempest\.api\.network\.test_metering_extensions.*)" +r="$r|(?:tempest\.thirdparty\.boto\.test_s3.*)" + +# exclude stuff we're less likely to break because i'm impatient +r="$r|(?:tempest\.api\.identity.*)" +r="$r|(?:tempest\.api\.image.*)" +r="$r|(?:tempest\.api\.volume.*)" + +# Current list of failing tests that need to be triaged, have bugs filed, and +# fixed as appropriate. +# (none) + +# End list of exclusions. +r="$r)" + +# only run tempest.api/scenario/thirdparty tests (part of the default for 'full') +r="$r(tempest\.(api|scenario|thirdparty)).*$" + +export DEVSTACK_GATE_TEMPEST_REGEX="$r" +enable_service "$OVERRIDE_ENABLED_SERVICES" diff --git a/networking-odl/devstack/entry_points b/networking-odl/devstack/entry_points new file mode 100644 index 0000000..647960f --- /dev/null +++ b/networking-odl/devstack/entry_points @@ -0,0 +1,307 @@ +#!/bin/bash + + +# cleanup_opendaylight() - Remove residual data files, anything left over +# from previous runs that a clean run would need to clean up +function cleanup_opendaylight { + # Wipe out the data, journal and snapshots directories ... grumble grumble grumble + rm -rf $ODL_DIR/$ODL_NAME/{data,journal,snapshots} + + # Remove existing logfiles + if [[ -n "$LOGDIR" ]]; then + rm -f "$LOGDIR/$ODL_KARAF_LOG_BASE*" + fi + if [[ -n "$SCREEN_LOGDIR" ]]; then + rm -f "$SCREEN_LOGDIR/$ODL_KARAF_LOG_BASE*" + fi + rm -f "$DEST/logs/$ODL_KARAF_LOG_BASE*" + + move_interface_addresses "outof_bridge" + + unbind_opendaylight_controller +} + + +# configure_opendaylight() - Set config files, create data dirs, etc +function configure_opendaylight { + echo "Configuring OpenDaylight" + + # The logging config file in ODL + local ODL_LOGGING_CONFIG=${ODL_DIR}/${ODL_NAME}/etc/org.ops4j.pax.logging.cfg + + # Add netvirt feature in Karaf, if it's not already there + local ODLFEATUREMATCH=$(cat $ODL_DIR/$ODL_NAME/etc/org.apache.karaf.features.cfg | \ + grep featuresBoot= | grep $ODL_NETVIRT_KARAF_FEATURE) + if [ "$ODLFEATUREMATCH" == "" ]; then + sed -i "/^featuresBoot=/ s/$/,$ODL_NETVIRT_KARAF_FEATURE/" \ + $ODL_DIR/$ODL_NAME/etc/org.apache.karaf.features.cfg + fi + + if [[ "$ODL_RELEASE" =~ "helium" ]]; then + # Move Tomcat to $ODL_PORT + local _ODLPORT=$(cat $ODL_DIR/$ODL_NAME/configuration/tomcat-server.xml | \ + grep $ODL_PORT) + if [ "$_ODLPORT" == "" ]; then + sed -i "/\<Connector port/ s/808./$ODL_PORT/" \ + $ODL_DIR/$ODL_NAME/configuration/tomcat-server.xml + fi + else + # Move Jetty to $ODL_PORT + local _ODLPORT=$(cat $ODL_DIR/$ODL_NAME/etc/jetty.xml | grep $ODL_PORT) + if [ "$_ODLPORT" == "" ]; then + sed -i "/\<Property name\=\"jetty\.port/ s/808./$ODL_PORT/" \ + $ODL_DIR/$ODL_NAME/etc/jetty.xml + fi + fi + + # Configure L3 if the user wants it for NETVIRT_OVSDB + # L3 is always enabled in NETVIRT_VPNSERVICE + if [[ ",$ODL_NETVIRT_KARAF_FEATURE," =~ ",$ODL_NETVIRT_KARAF_FEATURE_OVSDB," ]] && [ "${ODL_L3}" == "True" ]; then + # Configure L3 FWD if it's not there + local L3FWD=$(cat $ODL_DIR/$ODL_NAME/etc/custom.properties | \ + grep ^ovsdb.l3.fwd.enabled) + if [ "$L3FWD" == "" ]; then + echo "ovsdb.l3.fwd.enabled=yes" >> $ODL_DIR/$ODL_NAME/etc/custom.properties + fi + + # Configure L3 GW MAC if it's not there + local L3GW_MAC=$(cat $ODL_DIR/$ODL_NAME/etc/custom.properties | \ + grep ^ovsdb.l3gateway.mac) + if [[ -z "$L3GW_MAC" && -n "$ODL_L3GW_MAC" ]]; then + echo "ovsdb.l3gateway.mac=$ODL_L3GW_MAC" >> $ODL_DIR/$ODL_NAME/etc/custom.properties + fi + fi + + # Remove existing logfiles + local ODL_LOGDIR=$DEST/logs + if [[ -n "$LOGDIR" ]]; then + ODL_LOGDIR=$LOGDIR + fi + + rm -f "$ODL_LOGDIR/$ODL_KARAF_LOG_BASE*" + # Log karaf output to a file + _LF=$ODL_LOGDIR/$ODL_KARAF_LOG_NAME + LF=$(echo $_LF | sed 's/\//\\\//g') + # Soft link for easy consumption + sudo mkdir -p "$ODL_LOGDIR" + ln -sf $_LF "$ODL_LOGDIR/screen-karaf.log" + if [[ -n $SCREEN_LOGDIR ]]; then + ln -sf $_LF "$SCREEN_LOGDIR/screen-karaf.log" + fi + + # Change the karaf logfile + # disable log rotation by setting max fiel size large enough + sed -i -e "/^log4j\.appender\.out\.file/ s/.*/log4j\.appender\.out\.file\=$LF/" \ + -e "/^log4j\.appender\.out\.maxFileSize/ s/.*/log4j\.appender\.out\.maxFileSize\=1024GB/" \ + $ODL_DIR/$ODL_NAME/etc/org.ops4j.pax.logging.cfg + + # Configure DEBUG logs for network virtualization in odl, if the user wants it + if [ "${ODL_NETVIRT_DEBUG_LOGS}" == "True" ]; then + local OVSDB_DEBUG_LOGS=$(cat $ODL_LOGGING_CONFIG | grep ^log4j.logger.org.opendaylight.ovsdb) + if [ "${OVSDB_DEBUG_LOGS}" == "" ]; then + echo 'log4j.logger.org.opendaylight.ovsdb = TRACE, out' >> $ODL_LOGGING_CONFIG + echo 'log4j.logger.org.opendaylight.ovsdb.lib = INFO, out' >> $ODL_LOGGING_CONFIG + echo 'log4j.logger.org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter = DEBUG, out' >> $ODL_LOGGING_CONFIG + echo 'log4j.logger.org.opendaylight.ovsdb.openstack.netvirt.impl.TenantNetworkManagerImpl = DEBUG, out' >> $ODL_LOGGING_CONFIG + echo 'log4j.logger.org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services.arp.GatewayMacResolverService = DEBUG, out' >> $ODL_LOGGING_CONFIG + echo 'log4j.logger.org.opendaylight.ovsdb.plugin.md.OvsdbInventoryManager = INFO, out' >> $ODL_LOGGING_CONFIG + fi + if [[ "$ODL_RELEASE" =~ "helium" ]]; then + local ODL_NEUTRON_DEBUG_LOGS=$(cat $ODL_LOGGING_CONFIG | \ + grep ^log4j.logger.org.opendaylight.controller.networkconfig.neutron) + if [ "${ODL_NEUTRON_DEBUG_LOGS}" == "" ]; then + echo 'log4j.logger.org.opendaylight.controller.networkconfig.neutron = TRACE, out' >> $ODL_LOGGING_CONFIG + fi + else + local ODL_NEUTRON_DEBUG_LOGS=$(cat $ODL_LOGGING_CONFIG | \ + grep ^log4j.logger.org.opendaylight.neutron) + if [ "${ODL_NEUTRON_DEBUG_LOGS}" == "" ]; then + echo 'log4j.logger.org.opendaylight.neutron = TRACE, out' >> $ODL_LOGGING_CONFIG + fi + fi + fi +} + +# configure_neutron_opendaylight() - Set Neutron config files according to ODL settings +function configure_neutron_odl { + echo "Configuring ML2 for OpenDaylight" + populate_ml2_config /$Q_PLUGIN_CONF_FILE ml2_odl url=$ODL_ENDPOINT + populate_ml2_config /$Q_PLUGIN_CONF_FILE ml2_odl username=$ODL_USERNAME + populate_ml2_config /$Q_PLUGIN_CONF_FILE ml2_odl password=$ODL_PASSWORD + populate_ml2_config /$Q_PLUGIN_CONF_FILE ml2_odl port_binding_controller=$ODL_PORT_BINDING_CONTROLLER + # When it's not set, the default value is set by networking-odl + if [[ -n "$ODL_HOSTCONF_URI" ]]; then + populate_ml2_config /$Q_PLUGIN_CONF_FILE ml2_odl odl_hostconf_uri=$ODL_HOSTCONF_URI + fi +} + +function configure_neutron_odl_lightweight_testing { + echo "Configuring lightweight testing for OpenDaylight" + populate_ml2_config /$Q_PLUGIN_CONF_FILE ml2_odl enable_lightweight_testing=True +} + +# init_opendaylight() - Initialize databases, etc. +function init_opendaylight { + # clean up from previous (possibly aborted) runs + # create required data files + : +} + + +# install_opendaylight() - Collect source and prepare +function install_opendaylight { + echo "Installing OpenDaylight and dependent packages" + if [[ "$ODL_USING_EXISTING_JAVA" != "True" ]] + then + if ! setup_java "${ODL_REQUIRED_JAVA_VERSION:-7}"; then + exit 1 + fi + fi + + install_opendaylight_neutron_thin_ml2_driver + + # Download OpenDaylight + cd $ODL_DIR + + if [[ "$OFFLINE" != "True" ]]; then + wget -N $ODL_URL/$ODL_PKG + fi + unzip -u -o $ODL_PKG +} + + +# install_opendaylight_neutron_thin_ml2_driver() - Install the ML2 driver +function install_opendaylight_neutron_thin_ml2_driver { + echo "Installing the Networking-ODL driver for OpenDaylight" + setup_develop $NETWORKING_ODL_DIR +} + + +# install_opendaylight_compute() - Make sure OVS is installed +function install_opendaylight_compute { + if [[ "$SKIP_OVS_INSTALL" = "True" ]]; then + echo "Skipping OVS installation." + else + # packages are the same as for Neutron OVS agent + _neutron_ovs_base_install_agent_packages + fi +} + + +# start_opendaylight() - Start running processes, including screen +function start_opendaylight { + echo "Starting OpenDaylight" + + # Wipe out the data and journal directories ... grumble grumble grumble + rm -rf $ODL_DIR/$ODL_NAME/{data,journal} + + # The following variables are needed by the running karaf process. + # See the "bin/setenv" file in the OpenDaylight distribution for + # their individual meaning. + setup_java_env + export JAVA_MIN_MEM=$ODL_JAVA_MIN_MEM + export JAVA_MAX_MEM=$ODL_JAVA_MAX_MEM + export JAVA_MAX_PERM_MEM=$ODL_JAVA_MAX_PERM_MEM + run_process odl-server "$ODL_DIR/$ODL_NAME/bin/start" + + if [ -n "$ODL_BOOT_WAIT_URL" ]; then + echo "Waiting for Opendaylight to start via $ODL_BOOT_WAIT_URL ..." + # Probe ODL restconf for netvirt until it is operational + local testcmd="curl -o /dev/null --fail --silent --head -u \ + ${ODL_USERNAME}:${ODL_PASSWORD} http://${ODL_MGR_IP}:${ODL_PORT}/${ODL_BOOT_WAIT_URL}" + test_with_retry "$testcmd" "Opendaylight did not start after $ODL_BOOT_WAIT" \ + $ODL_BOOT_WAIT $ODL_RETRY_SLEEP_INTERVAL + else + echo "Waiting for Opendaylight to start ..." + # Sleep a bit to let OpenDaylight finish starting up + sleep $ODL_BOOT_WAIT + fi +} + + +# stop_opendaylight() - Stop running processes (non-screen) +function stop_opendaylight { + # Stop the karaf container + $ODL_DIR/$ODL_NAME/bin/stop + stop_process odl-server +} + + +# cleanup_opendaylight_compute() - Remove all OVS ports, bridges and disconnects +# controller from switch +function cleanup_opendaylight_compute { + # Remove the patch ports + for port in $(sudo ovs-vsctl show | grep Port | awk '{print $2}' | cut -d '"' -f 2 | grep patch); do + sudo ovs-vsctl del-port ${port} + done + + # remove all OVS ports that look like Neutron created ports + for port in $(sudo ovs-vsctl list port | grep -o -e tap[0-9a-f\-]* -e q[rg]-[0-9a-f\-]*); do + sudo ovs-vsctl del-port ${port} + done + + # Remove all the vxlan ports + for port in $(sudo ovs-vsctl list port | grep name | grep vxlan | awk '{print $3}' | cut -d '"' -f 2); do + sudo ovs-vsctl del-port ${port} + done + + # Disconnect controller from switch + unbind_opendaylight_controller + + # remove all OVS bridges created by ODL + for bridge in $(sudo ovs-vsctl list-br | grep -o -e ${OVS_BR} -e ${PUBLIC_BRIDGE}); do + sudo ovs-vsctl del-br ${bridge} + done +} + +# bind_opendaylight_controller() - set control manager to OVS +function bind_opendaylight_controller { + echo_summary "Initializing OpenDaylight" + ODL_LOCAL_IP=${ODL_LOCAL_IP:-$HOST_IP} + ODL_MGR_PORT=${ODL_MGR_PORT:-6640} + ODL_OVS_MANAGERS=${ODL_OVS_MANAGERS:-$ODL_MGR_IP} + read ovstbl <<< $(sudo ovs-vsctl get Open_vSwitch . _uuid) + local ODL_MANAGERS_PARAM=() + for manager in $(echo $ODL_OVS_MANAGERS | tr "," "\n"); do + # ovsdbd doesn't understand localhost. replace it to numerical ip address + ODL_MANAGERS_PARAM=( "${ODL_MANAGERS_PARAM[@]}" "tcp:${manager/localhost/127.0.0.1}:$ODL_MGR_PORT" ) + done + # don't overwrite the already existing managers + local ODL_MANAGERS_OLD=$(sudo ovs-vsctl get-manager) + local ODL_MANAGERS=$(echo $ODL_MANAGERS_OLD ${ODL_MANAGERS_PARAM[@]} | tr ' ' '\n' | sort | uniq | tr '\n' ' ') + sudo ovs-vsctl set-manager ${ODL_MANAGERS} + if [[ -n "$ODL_PROVIDER_MAPPINGS" ]]; then + sudo ovs-vsctl set Open_vSwitch $ovstbl \ + other_config:provider_mappings=$ODL_PROVIDER_MAPPINGS + fi + sudo ovs-vsctl set Open_vSwitch $ovstbl other_config:local_ip=$ODL_LOCAL_IP +} + +# unbind_opendaylight_controller() - disconnect controller from switch and clear bridges +function unbind_opendaylight_controller { + sudo ovs-vsctl del-manager + BRIDGES=$(sudo ovs-vsctl list-br) + for bridge in $BRIDGES ; do + sudo ovs-vsctl del-controller $bridge + done +} + + +# configure_opendaylight_l3() - configure bridges for OpenDaylight L3 forwarding +function configure_opendaylight_l3 { + wait_for_active_bridge $PUBLIC_BRIDGE $ODL_RETRY_SLEEP_INTERVAL $ODL_BOOT_WAIT + + # Note: as of Lithium-SR3 and Beryllium releases, ODL will add the OVS port(s) + # to the external bridge via the ODL_PROVIDER_MAPPINGS method. Being so, + # the usage of PUBLIC_INTERFACE is no longer necessary in ODL devstack. + + # DEPRECATED: Add public interface to public bridge, if needed + if [[ -n "$PUBLIC_INTERFACE" && "$PUBLIC_INTERFACE" != "br100" ]]; then + deprecated "Adding $PUBLIC_INTERFACE to $PUBLIC_BRIDGE." + deprecated "Use ODL_PROVIDER_MAPPINGS instead of PUBLIC_INTERFACE." + sudo ovs-vsctl --no-wait -- --may-exist add-port $PUBLIC_BRIDGE $PUBLIC_INTERFACE + sudo ip link set $PUBLIC_INTERFACE up + fi + + move_interface_addresses "into_bridge" +} diff --git a/networking-odl/devstack/functions b/networking-odl/devstack/functions new file mode 100644 index 0000000..ebd14da --- /dev/null +++ b/networking-odl/devstack/functions @@ -0,0 +1,120 @@ +#!/bin/bash +# +# functions - OpenDaylight driver utility functions + +# Get build information +function odl_update_maven_metadata_xml { + local MAVENMETAFILE=$1 + local NEXUSPATH=$2 + local BUNDLEVERSION=$3 + local OFFLINE=$4 + + if [[ "$OFFLINE" == "True" ]]; then + return + fi + + # Remove stale MAVENMETAFILE for cases where you switch releases + rm -f $MAVENMETAFILE + + # Acquire the timestamp information from maven-metadata.xml + wget -O $MAVENMETAFILE ${NEXUSPATH}/${BUNDLEVERSION}/maven-metadata.xml +} + +function _odl_export_snapshot_url_pkg { + local ODL_DIR=$1 + local ODL_URL_PREFIX=$2 + local BUNDLEVERSION=$3 + local OFFLINE=$4 + local BUNDLE_TIMESTAMP=$5 + + local MAVENMETAFILE=$ODL_DIR/maven-metadata.xml + local NEXUSPATH="${ODL_URL_PREFIX}/${ODL_URL_SNAPSHOT_REPOSITORY_PATH}/org/opendaylight/integration/distribution-karaf" + + if [ "$BUNDLE_TIMESTAMP" == "latest" ]; then + odl_update_maven_metadata_xml $MAVENMETAFILE $NEXUSPATH $BUNDLEVERSION $OFFLINE + if is_ubuntu; then + install_package libxml-xpath-perl + BUNDLE_TIMESTAMP=`xpath -e "//snapshotVersion[extension='zip'][1]/value/text()" $MAVENMETAFILE 2>/dev/null` + else + yum_install perl-XML-XPath + BUNDLE_TIMESTAMP=`xpath $MAVENMETAFILE "//snapshotVersion[extension='zip'][1]/value/text()" 2>/dev/null` + fi + fi + + export ODL_URL=${NEXUSPATH}/${BUNDLEVERSION} + export ODL_PKG=distribution-karaf-${BUNDLE_TIMESTAMP}.zip +} + +function _odl_export_release_url_pkg { + local ODL_URL_PREFIX=$1 + local BUNDLEVERSION=$2 + local NEXUSPATH="${ODL_URL_PREFIX}/${ODL_URL_RELEASE_REPOSITORY_PATH}/org/opendaylight/integration/distribution-karaf" + + export ODL_URL=${NEXUSPATH}/${BUNDLEVERSION} + export ODL_PKG=distribution-karaf-${BUNDLEVERSION}.zip +} + +function setup_opendaylight_package { + if [[ -n "$ODL_SNAPSHOT_VERSION" ]]; then + _odl_export_snapshot_url_pkg ${ODL_DIR} ${ODL_URL_PREFIX} ${ODL_BUNDLEVERSION} ${OFFLINE} ${ODL_SNAPSHOT_VERSION} + else + _odl_export_release_url_pkg ${ODL_URL_PREFIX} ${ODL_BUNDLEVERSION} + fi +} + +# Test if OpenDaylight is enabled +function is_opendaylight_enabled { + [[ ,${ENABLED_SERVICES} =~ ,"odl-" ]] && return 0 + return 1 +} + + +# Check that the bridge is up and running +function wait_for_active_bridge { + local BRIDGE=$1 + local SLEEP_INTERVAL=$2 + local MAX_WAIT=$3 + + echo "Waiting for bridge $BRIDGE to be available..." + local testcmd="sudo ovs-vsctl list Bridge | grep $BRIDGE" + test_with_retry "$testcmd" \ + "$BRIDGE did not become available in $MAX_WAIT seconds." \ + $MAX_WAIT $SLEEP_INTERVAL + echo "Bridge $BRIDGE is available." +} + +# Move the public IP addresses to the OVS bridge on startup, +# or back to the public interface on cleanup +function move_interface_addresses { + local direction=$1 + + if [[ -n "$ODL_PROVIDER_MAPPINGS" ]]; then + local VETH_INTERFACE=$(echo $ODL_PROVIDER_MAPPINGS | cut -d ':' -f1) + local PHYSICAL_INTERFACE=$(echo $ODL_PROVIDER_MAPPINGS | cut -d ':' -f2) + + if [[ "$direction" == "into_bridge" ]]; then + _move_neutron_addresses_route "$PHYSICAL_INTERFACE" "$VETH_INTERFACE" True False "inet" + if _has_public_ipv6_address "$PHYSICAL_INTERFACE"; then + _move_neutron_addresses_route "$PHYSICAL_INTERFACE" "$VETH_INTERFACE" False False "inet6" + fi + elif [[ "$direction" == "outof_bridge" ]]; then + _move_neutron_addresses_route "$VETH_INTERFACE" "$PHYSICAL_INTERFACE" False True "inet" + if _has_public_ipv6_address "$VETH_INTERFACE"; then + _move_neutron_addresses_route "$VETH_INTERFACE" "$PHYSICAL_INTERFACE" False False "inet6" + fi + fi + fi +} + +# Check that the interface has an IP v6 address which +# is routable on external network +function _has_public_ipv6_address { + local interface=$1 + local interface_public_ipv6_addresses=$(ip -f inet6 a s dev "$interface" | grep -c 'global') + echo "$interface public IPv6 address count: $interface_public_ipv6_addresses" + if [[ "$interface_public_ipv6_addresses" != 0 ]]; then + return 0 + else + return 1 + fi +} diff --git a/networking-odl/devstack/local.conf.example b/networking-odl/devstack/local.conf.example new file mode 100644 index 0000000..9a6bd97 --- /dev/null +++ b/networking-odl/devstack/local.conf.example @@ -0,0 +1,42 @@ +[[local|localrc]] +LOGFILE=stack.sh.log +SCREEN_LOGDIR=/opt/stack/data/log +LOG_COLOR=False + +disable_service swift +disable_service cinder +disable_service n-net +enable_service q-svc +enable_service q-dhcp +enable_service q-l3 +enable_service q-meta +enable_service q-vpn +enable_service q-metering +enable_service q-lbaas +enable_service q-fwaas +enable_service neutron +enable_service tempest + +enable_plugin networking-odl http://git.openstack.org/openstack/networking-odl + +ENABLE_TENANT_TUNNELS=True + +HOST_NAME=$(hostname) +SERVICE_HOST_NAME=${HOST_NAME} +SERVICE_HOST=$HOST_NAME + +VNCSERVER_PROXYCLIENT_ADDRESS=$SERVICE_HOST +VNCSERVER_LISTEN=0.0.0.0 + +MYSQL_HOST=$SERVICE_HOST +RABBIT_HOST=$SERVICE_HOST +GLANCE_HOSTPORT=$SERVICE_HOST:9292 +KEYSTONE_AUTH_HOST=$SERVICE_HOST +KEYSTONE_SERVICE_HOST=$SERVICE_HOST + +MYSQL_PASSWORD=mysql +RABBIT_PASSWORD=rabbit +SERVICE_TOKEN=service +SERVICE_PASSWORD=admin +ADMIN_PASSWORD=admin + diff --git a/networking-odl/devstack/odl-releases/beryllium-0.4.0 b/networking-odl/devstack/odl-releases/beryllium-0.4.0 new file mode 100644 index 0000000..4ed5b73 --- /dev/null +++ b/networking-odl/devstack/odl-releases/beryllium-0.4.0 @@ -0,0 +1,4 @@ +export ODL_BUNDLEVERSION='0.4.0-Beryllium' + +# Java major version required to run OpenDaylight: 7, 8, ... +ODL_REQUIRED_JAVA_VERSION=${ODL_REQUIRED_JAVA_VERSION:-8} diff --git a/networking-odl/devstack/odl-releases/beryllium-0.4.1-SR1 b/networking-odl/devstack/odl-releases/beryllium-0.4.1-SR1 new file mode 100644 index 0000000..f659a38 --- /dev/null +++ b/networking-odl/devstack/odl-releases/beryllium-0.4.1-SR1 @@ -0,0 +1,4 @@ +export ODL_BUNDLEVERSION='0.4.1-Beryllium-SR1' + +# Java major version required to run OpenDaylight: 7, 8, ... +ODL_REQUIRED_JAVA_VERSION=${ODL_REQUIRED_JAVA_VERSION:-8} diff --git a/networking-odl/devstack/odl-releases/beryllium-0.4.2-SR2 b/networking-odl/devstack/odl-releases/beryllium-0.4.2-SR2 new file mode 100644 index 0000000..230682b --- /dev/null +++ b/networking-odl/devstack/odl-releases/beryllium-0.4.2-SR2 @@ -0,0 +1,4 @@ +export ODL_BUNDLEVERSION='0.4.2-Beryllium-SR2' + +# Java major version required to run OpenDaylight: 7, 8, ... +ODL_REQUIRED_JAVA_VERSION=${ODL_REQUIRED_JAVA_VERSION:-8} diff --git a/networking-odl/devstack/odl-releases/beryllium-0.4.3-SR3 b/networking-odl/devstack/odl-releases/beryllium-0.4.3-SR3 new file mode 100644 index 0000000..2edebc0 --- /dev/null +++ b/networking-odl/devstack/odl-releases/beryllium-0.4.3-SR3 @@ -0,0 +1,4 @@ +export ODL_BUNDLEVERSION='0.4.3-Beryllium-SR3' + +# Java major version required to run OpenDaylight: 7, 8, ... +ODL_REQUIRED_JAVA_VERSION=${ODL_REQUIRED_JAVA_VERSION:-8} diff --git a/networking-odl/devstack/odl-releases/beryllium-snapshot-0.4.3 b/networking-odl/devstack/odl-releases/beryllium-snapshot-0.4.3 new file mode 100644 index 0000000..a0d8ecc --- /dev/null +++ b/networking-odl/devstack/odl-releases/beryllium-snapshot-0.4.3 @@ -0,0 +1,5 @@ +ODL_BUNDLEVERSION='0.4.3-SNAPSHOT' +ODL_SNAPSHOT_VERSION=${ODL_SNAPSHOT_VERSION:-latest} + +# Java major version required to run OpenDaylight: 7, 8, ... +ODL_REQUIRED_JAVA_VERSION=${ODL_REQUIRED_JAVA_VERSION:-8} diff --git a/networking-odl/devstack/odl-releases/beryllium-snapshot-0.4.4 b/networking-odl/devstack/odl-releases/beryllium-snapshot-0.4.4 new file mode 100644 index 0000000..3ea7fac --- /dev/null +++ b/networking-odl/devstack/odl-releases/beryllium-snapshot-0.4.4 @@ -0,0 +1,5 @@ +ODL_BUNDLEVERSION='0.4.4-SNAPSHOT' +ODL_SNAPSHOT_VERSION=${ODL_SNAPSHOT_VERSION:-latest} + +# Java major version required to run OpenDaylight: 7, 8, ... +ODL_REQUIRED_JAVA_VERSION=${ODL_REQUIRED_JAVA_VERSION:-8} diff --git a/networking-odl/devstack/odl-releases/boron-snapshot-0.5.0 b/networking-odl/devstack/odl-releases/boron-snapshot-0.5.0 new file mode 100644 index 0000000..1afdb92 --- /dev/null +++ b/networking-odl/devstack/odl-releases/boron-snapshot-0.5.0 @@ -0,0 +1,5 @@ +ODL_BUNDLEVERSION='0.5.0-SNAPSHOT' +ODL_SNAPSHOT_VERSION=${ODL_SNAPSHOT_VERSION:-latest} + +# Java major version required to run OpenDaylight: 7, 8, ... +ODL_REQUIRED_JAVA_VERSION=${ODL_REQUIRED_JAVA_VERSION:-8} diff --git a/networking-odl/devstack/odl-releases/carbon-snapshot-0.6.0 b/networking-odl/devstack/odl-releases/carbon-snapshot-0.6.0 new file mode 100644 index 0000000..102de66 --- /dev/null +++ b/networking-odl/devstack/odl-releases/carbon-snapshot-0.6.0 @@ -0,0 +1,5 @@ +ODL_BUNDLEVERSION='0.6.0-SNAPSHOT' +ODL_SNAPSHOT_VERSION=${ODL_SNAPSHOT_VERSION:-latest} + +# Java major version required to run OpenDaylight: 7, 8, ... +ODL_REQUIRED_JAVA_VERSION=${ODL_REQUIRED_JAVA_VERSION:-8} diff --git a/networking-odl/devstack/odl-releases/common b/networking-odl/devstack/odl-releases/common new file mode 100644 index 0000000..ec57dd9 --- /dev/null +++ b/networking-odl/devstack/odl-releases/common @@ -0,0 +1,14 @@ +# karaf distribution name of ODL to download +export ODL_NAME=${ODL_NAME:-distribution-karaf-${ODL_BUNDLEVERSION}} + +# The network virtualization older feature name (ovsdb based) +export ODL_NETVIRT_KARAF_FEATURE_OVSDB=${ODL_NETVIRT_KARAF_FEATURE_OVSDB:-odl-ovsdb-openstack} + +# The network virtualization newer feature name (vpnservice based) +export ODL_NETVIRT_KARAF_FEATURE_VPNSERVICE=${ODL_NETVIRT_KARAF_FEATURE_VPNSERVICE:-odl-netvirt-openstack} + +# The network virtualization feature used by opendaylight loaded by Karaf +export ODL_NETVIRT_KARAF_FEATURE=${ODL_NETVIRT_KARAF_FEATURE:-odl-neutron-service,odl-restconf-all,odl-aaa-authn,odl-dlux-core,odl-mdsal-apidocs,$ODL_NETVIRT_KARAF_FEATURE_OVSDB} + +# The url that this version of ODL netvirt can use to know ODL is fully up +export ODL_BOOT_WAIT_URL=${ODL_BOOT_WAIT_URL:-restconf/operational/network-topology:network-topology/topology/netvirt:1} diff --git a/networking-odl/devstack/odl-releases/helium-0.2.3-SR3 b/networking-odl/devstack/odl-releases/helium-0.2.3-SR3 new file mode 100644 index 0000000..70149e9 --- /dev/null +++ b/networking-odl/devstack/odl-releases/helium-0.2.3-SR3 @@ -0,0 +1,17 @@ +# Short name of ODL package +export ODL_NAME=distribution-karaf-0.2.3-Helium-SR3 + +# Java major version required to run OpenDaylight: 7, 8, ... +ODL_REQUIRED_JAVA_VERSION=${ODL_REQUIRED_JAVA_VERSION:-7} + +# overwrite this function +function setup_opendaylight_package { + # The OpenDaylight URL + export ODL_URL=${ODL_URL_PREFIX}/content/repositories/public/org/opendaylight/integration/distribution-karaf/0.2.3-Helium-SR3 + + # The OpenDaylight Package + export ODL_PKG=distribution-karaf-0.2.3-Helium-SR3.zip +} + +# The network virtualization feature used by opendaylight loaded by Karaf +ODL_NETVIRT_KARAF_FEATURE=${ODL_NETVIRT_KARAF_FEATURE:-odl-base-all,odl-restconf-all,odl-aaa-authn,odl-dlux-core,odl-mdsal-apidocs,odl-adsal-northbound,odl-nsf-all,odl-ovsdb-northbound,odl-ovsdb-openstack} diff --git a/networking-odl/devstack/odl-releases/lithium-0.3.1-SR1 b/networking-odl/devstack/odl-releases/lithium-0.3.1-SR1 new file mode 100644 index 0000000..81283a7 --- /dev/null +++ b/networking-odl/devstack/odl-releases/lithium-0.3.1-SR1 @@ -0,0 +1,4 @@ +export ODL_BUNDLEVERSION='0.3.1-Lithium-SR1' + +# Java major version required to run OpenDaylight: 7, 8, ... +ODL_REQUIRED_JAVA_VERSION=${ODL_REQUIRED_JAVA_VERSION:-7} diff --git a/networking-odl/devstack/odl-releases/lithium-0.3.2-SR2 b/networking-odl/devstack/odl-releases/lithium-0.3.2-SR2 new file mode 100644 index 0000000..ff52cad --- /dev/null +++ b/networking-odl/devstack/odl-releases/lithium-0.3.2-SR2 @@ -0,0 +1,4 @@ +export ODL_BUNDLEVERSION='0.3.2-Lithium-SR2' + +# Java major version required to run OpenDaylight: 7, 8, ... +ODL_REQUIRED_JAVA_VERSION=${ODL_REQUIRED_JAVA_VERSION:-7} diff --git a/networking-odl/devstack/odl-releases/lithium-0.3.3-SR3 b/networking-odl/devstack/odl-releases/lithium-0.3.3-SR3 new file mode 100644 index 0000000..a1ff407 --- /dev/null +++ b/networking-odl/devstack/odl-releases/lithium-0.3.3-SR3 @@ -0,0 +1,4 @@ +export ODL_BUNDLEVERSION='0.3.3-Lithium-SR3' + +# Java major version required to run OpenDaylight: 7, 8, ... +ODL_REQUIRED_JAVA_VERSION=${ODL_REQUIRED_JAVA_VERSION:-7} diff --git a/networking-odl/devstack/odl-releases/lithium-0.3.4-SR4 b/networking-odl/devstack/odl-releases/lithium-0.3.4-SR4 new file mode 100644 index 0000000..da2f692 --- /dev/null +++ b/networking-odl/devstack/odl-releases/lithium-0.3.4-SR4 @@ -0,0 +1,4 @@ +export ODL_BUNDLEVERSION='0.3.4-Lithium-SR4' + +# Java major version required to run OpenDaylight: 7, 8, ... +ODL_REQUIRED_JAVA_VERSION=${ODL_REQUIRED_JAVA_VERSION:-7} diff --git a/networking-odl/devstack/override-defaults b/networking-odl/devstack/override-defaults new file mode 100644 index 0000000..399a528 --- /dev/null +++ b/networking-odl/devstack/override-defaults @@ -0,0 +1,37 @@ +# Override few things here as early as we can + +# We will enable the opendaylight ML2 MechanismDriver v1 version by default. +# Note we are also enabling the logger driver, which is helpful for +# debugging things on the Neutron side. +if [[ "$ODL_V2DRIVER" == "True" ]] +then + V2_POSTFIX="_v2" +else + V2_POSTFIX="" +fi + +Q_ML2_PLUGIN_MECHANISM_DRIVERS=${Q_ML2_PLUGIN_MECHANISM_DRIVERS:-"opendaylight${V2_POSTFIX},logger"} + +# This triggers the provisioning of L3 resources like routers and +# external network, if not overriden. +Q_L3_ENABLED=${Q_L3_ENABLED:-True} + +# We have to disable the neutron L2 agent. OpenDaylight does not use the +# L2 agent, it instead uses a combination of OpenFlow and OVSDB commands +# to program OVS on each compute and network node host. +disable_service q-agt + +# If ODL_L3 is enabled, then we don't need the L3 agent and OpenDaylight +# is going to act as the ML2's L3 service plugin. +# NETVIRT_VPNSERVICE feature enables ODL L3 by default, so ODL_L3 is disregarded. +if [[ ",$ODL_NETVIRT_KARAF_FEATURE," =~ ",$ODL_NETVIRT_KARAF_FEATURE_VPNSERVICE," ]] || [ "$ODL_L3" == "True" ]; +then + disable_service q-l3 + ML2_L3_PLUGIN="${ML2_L3_PLUGIN:-odl-router${V2_POSTFIX}}" +fi + +# [networking-feature-enabled] api-extensions +# api-extensions=all means any kind of extensions is enabled irrelevant of what plugin supports +# ML2 plugin with ODL driver supports only the following extensions, not all +# Those list must be maintained as ML2 plugin with ODL driver supports more extensions +NETWORK_API_EXTENSIONS=${NETWORK_API_EXTENSIONS:-"dns-integration,address-scope,ext-gw-mode,binding,agent,subnet_allocation,dhcp_agent_scheduler,external-net,flavors,net-mtu,quotas,provider,multi-provider,extraroute,vlan-transparent,router,extra_dhcp_opt,security-group,rbac-policies,port-security,allowed-address-pairs,dvr"} diff --git a/networking-odl/devstack/plugin.sh b/networking-odl/devstack/plugin.sh new file mode 100644 index 0000000..a65840d --- /dev/null +++ b/networking-odl/devstack/plugin.sh @@ -0,0 +1,151 @@ +#!/bin/bash +# +# devstack/plugin.sh +# Functions to control the configuration and operation of the opendaylight service + +# Save trace setting +_XTRACE_NETWORKING_ODL=$(set +o | grep xtrace) +set +o xtrace + +# OpenDaylight directories +NETWORKING_ODL_DIR=$DEST/networking-odl +ODL_DIR=$DEST/opendaylight + +# Make sure $ODL_DIR exists +mkdir -p $ODL_DIR + +# Import utility functions +source $TOP_DIR/functions +source $NETWORKING_ODL_DIR/devstack/functions + +# Import bridge data +source $TOP_DIR/lib/neutron_plugins/ovs_base + +# Import ODL settings +source $NETWORKING_ODL_DIR/devstack/settings.odl +source $NETWORKING_ODL_DIR/devstack/odl-releases/$ODL_RELEASE +source $NETWORKING_ODL_DIR/devstack/odl-releases/common + +# Utilities functions for setting up Java +source $NETWORKING_ODL_DIR/devstack/setup_java.sh + +# Import Entry Points +# ------------------- +source $NETWORKING_ODL_DIR/devstack/entry_points + +# Restore xtrace +$_XTRACE_NETWORKING_ODL + +if [[ "$ODL_USING_EXISTING_JAVA" == "True" ]] +then + echo 'Using installed java.' + java -version || exit 1 +fi + +# main loop +if is_service_enabled odl-server; then + if [[ "$1" == "stack" && "$2" == "install" ]]; then + setup_opendaylight_package + install_opendaylight + configure_opendaylight + init_opendaylight + elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then + configure_neutron_odl + # This has to start before Neutron + start_opendaylight + elif [[ "$1" == "stack" && "$2" == "post-extra" ]]; then + # no-op + : + fi + + if [[ "$1" == "unstack" ]]; then + stop_opendaylight + cleanup_opendaylight + fi + + if [[ "$1" == "clean" ]]; then + # no-op + : + fi +fi + +if is_service_enabled odl-compute; then + if [[ "$1" == "stack" && "$2" == "install" ]]; then + install_opendaylight_compute + elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then + if is_service_enabled nova; then + create_nova_conf_neutron + fi + bind_opendaylight_controller + wait_for_active_bridge $OVS_BR $ODL_RETRY_SLEEP_INTERVAL $ODL_BOOT_WAIT + + # L3 needs to be configured only for netvirt-ovsdb - in netvirt-vpnservice L3 is configured + # by provider_mappings, and the provider mappings are added to br-int by default + if [[ ",$ODL_NETVIRT_KARAF_FEATURE," =~ ",$ODL_NETVIRT_KARAF_FEATURE_OVSDB," ]] && [ "${ODL_L3}" == "True" ]; then + configure_opendaylight_l3 + fi + elif [[ "$1" == "stack" && "$2" == "extra" ]]; then + # no-op + : + elif [[ "$1" == "stack" && "$2" == "post-extra" ]]; then + # no-op + : + fi + + if [[ "$1" == "unstack" ]]; then + cleanup_opendaylight_compute + fi + + if [[ "$1" == "clean" ]]; then + # no-op + : + fi +fi + +if is_service_enabled odl-neutron; then + if [[ "$1" == "stack" && "$2" == "install" ]]; then + install_opendaylight_neutron_thin_ml2_driver + elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then + configure_neutron_odl + elif [[ "$1" == "stack" && "$2" == "post-extra" ]]; then + # no-op + : + fi + + if [[ "$1" == "unstack" ]]; then + # no-op + : + fi + + if [[ "$1" == "clean" ]]; then + # no-op + : + fi +fi + +if is_service_enabled odl-lightweight-testing; then + if [[ "$1" == "stack" && "$2" == "install" ]]; then + install_opendaylight_neutron_thin_ml2_driver + elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then + configure_neutron_odl + configure_neutron_odl_lightweight_testing + elif [[ "$1" == "stack" && "$2" == "post-extra" ]]; then + # no-op + : + fi + + if [[ "$1" == "unstack" ]]; then + # no-op + : + fi + + if [[ "$1" == "clean" ]]; then + # no-op + : + fi +fi + +# Tell emacs to use shell-script-mode +## Local variables: +## mode: shell-script +## End: diff --git a/networking-odl/devstack/post_test_hook.sh b/networking-odl/devstack/post_test_hook.sh new file mode 100644 index 0000000..64d291e --- /dev/null +++ b/networking-odl/devstack/post_test_hook.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +set -xe + +GATE_DEST=$BASE/new +DEVSTACK_PATH=$GATE_DEST/devstack + +source $DEVSTACK_PATH/functions +source $DEVSTACK_PATH/localrc + +TEMPEST_CODE_DIR="$BASE/new/tempest" +TEMPEST_DATA_DIR="$DATA_DIR/tempest" +NETWORKING_ODL_DIR="$BASE/new/networking-odl" + +IS_GATE=$(trueorfalse False IS_GATE) +if [[ "$IS_GATE" == "True" ]] +then + source $NETWORKING_ODL_DIR/devstack/devstackgaterc +fi + +owner=stack +sudo_env="TEMPEST_CONFIG_DIR=$TEMPEST_CODE_DIR/etc" + +cd $TEMPEST_CODE_DIR +sudo chown -R $owner:stack $TEMPEST_CODE_DIR +sudo mkdir -p "$TEMPEST_DATA_DIR" +sudo chown -R $owner:stack $TEMPEST_DATA_DIR +source $DEVSTACK_PATH/openrc admin admin + +echo "Some pre-process info" +neutron net-list +neutron port-list +neutron subnet-list +neutron router-list + +echo "Running networking-odl test suite" +sudo -H -u $owner $sudo_env tools/pretty_tox_serial.sh "$DEVSTACK_GATE_TEMPEST_REGEX" + +echo "Some post-process info" +neutron net-list +neutron port-list +neutron subnet-list +neutron router-list diff --git a/networking-odl/devstack/pre_test_hook.sh b/networking-odl/devstack/pre_test_hook.sh new file mode 100644 index 0000000..df11e2a --- /dev/null +++ b/networking-odl/devstack/pre_test_hook.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash + +set -xe + +# Drop a token that marks the build as coming from openstack infra +GATE_DEST=$BASE/new +DEVSTACK_PATH=$GATE_DEST/devstack + +case "$ODL_RELEASE_BASE" in + carbon-snapshot) + ODL_RELEASE=carbon-snapshot-0.6.0 + ;; + boron-snapshot) + ODL_RELEASE=boron-snapshot-0.5.0 + ;; + beryllium-snapshot) + ODL_RELEASE=beryllium-snapshot-0.4.4 + ;; + *) + echo "Unknown ODL release base: $ODL_RELEASE_BASE" + exit 1 + ;; +esac + +case "$ODL_GATE_V2DRIVER" in + v2driver) + ODL_V2DRIVER=True + ;; + v1driver|*) + ODL_V2DRIVER=False + ;; +esac + +case "$ODL_GATE_PORT_BINDING" in + pseudo-agentdb-binding) + ODL_PORT_BINDING_CONTROLLER=pseudo-agentdb-binding + ;; + legacy-port-binding) + ODL_PORT_BINDING_CONTROLLER=legacy-port-binding + ;; + network-topology|*) + ODL_PORT_BINDING_CONTROLLER=network-topology + ;; +esac + +case "$ODL_GATE_SERVICE_PROVIDER" in + vpnservice) + ODL_NETVIRT_KARAF_FEATURE=odl-neutron-service,odl-restconf-all,odl-aaa-authn,odl-dlux-core,odl-mdsal-apidocs,odl-netvirt-openstack + ;; + netvirt|*) + ODL_NETVIRT_KARAF_FEATURE=odl-neutron-service,odl-restconf-all,odl-aaa-authn,odl-dlux-core,odl-mdsal-apidocs,odl-ovsdb-openstack + ;; +esac + +cat <<EOF >> $DEVSTACK_PATH/localrc + +IS_GATE=True + +# Set here the ODL release to use for the Gate job +ODL_RELEASE=${ODL_RELEASE} + +# Set here which driver, v1 or v2 driver +ODL_V2DRIVER=${ODL_V2DRIVER} + +# Set here which port binding controller +ODL_PORT_BINDING_CONTROLLER=${ODL_PORT_BINDING_CONTROLLER} + +# Set here which ODL openstack service provider to use +ODL_NETVIRT_KARAF_FEATURE=${ODL_NETVIRT_KARAF_FEATURE} + +# Switch to using the ODL's L3 implementation +ODL_L3=True + +# Enable debug logs for odl ovsdb +ODL_NETVIRT_DEBUG_LOGS=True + +EOF diff --git a/networking-odl/devstack/settings b/networking-odl/devstack/settings new file mode 100644 index 0000000..0a924a2 --- /dev/null +++ b/networking-odl/devstack/settings @@ -0,0 +1,72 @@ +# Devstack settings + +# Each service you enable has the following meaning: +# odl-neutron - Add this config flag if Opendaylight controller and OpenStack +# Controller are on different nodes. +# odl-server - Add this config flag if Opendaylight controller and OpenStack +# Controller are on the same node. +# odl-compute - Add this config flag for OpenStack Compute. +# +# odl-lightweight-testing - Add this config flag for testing neutron ODL ML2 +# driver and networking-odl without a real running +# Opendaylight instance +# +# NOTE: odl-server includes odl-neutron. +# +# An example of enabling all-in-one ODL is below. +#enable_service odl-compute odl-server + +# This can be overridden in the localrc file +ODL_MODE=${ODL_MODE:-allinone} + +# ODL_MODE is used to configure how devstack works with OpenDaylight. You +# can configure this three ways: +# +# ODL_MODE=allinone +# Use this mode if you want to run ODL in this devstack instance. Useful +# for a single node deployment or on the control node of a multi-node +# devstack environment. +# +# ODL_MODE=compute +# Use this for the compute nodes of a multi-node devstack install. +# +# ODL_MODE=externalodl +# This installs the neutron code for ODL, but does not attempt to +# manage ODL in devstack. This is used for development environments +# similar to the allinone case except where you are using bleeding edge ODL +# which is not yet released, and thus don't want it managed by +# devstack. +# +# ODL_MODE=lightweight-testing +# Use this for testing neutron ML2 driver plus networking-odl without +# a running Opendaylight instance. +# +# ODL_MODE=manual +# You're on your own here, and are enabling services outside the scope of +# the ODL_MODE variable. + +case $ODL_MODE in + allinone) + enable_service odl-server odl-compute + ;; + externalodl) + enable_service odl-neutron odl-compute + ;; + compute) + enable_service odl-compute + ;; + lightweight-testing) + enable_service odl-lightweight-testing + ;; + manual) + echo "Manual mode: Enabling services explicitly." + ;; +esac + + +IS_GATE=$(trueorfalse False IS_GATE) +if [[ "$IS_GATE" == "True" ]] +then + NETWORKING_ODL_DIR=$DEST/networking-odl + source $NETWORKING_ODL_DIR/devstack/devstackgaterc +fi diff --git a/networking-odl/devstack/settings.odl b/networking-odl/devstack/settings.odl new file mode 100644 index 0000000..1ce23a4 --- /dev/null +++ b/networking-odl/devstack/settings.odl @@ -0,0 +1,116 @@ +# Add here any global default values that apply for any ODL release +# ----------------------------------------------------------------- + +# What release to use. Choices are: +# +# carbon-snapshot-0.6.0 (master) +# boron-snapshot-0.5.0 (stable/boron) +# beryllium-snapshot-0.4.4 (stable/beryllium) +# beryllium-snapshot-0.4.3 (stable/beryllium) +# beryllium-0.4.3-SR3 +# beryllium-0.4.2-SR2 +# beryllium-0.4.1-SR1 +# beryllium-0.4.0 +# lithium-0.3.4-SR4 (SR4) +# lithium-0.3.3-SR3 (SR3) +# lithium-0.3.2-SR2 (SR2) +# lithium-0.3.1-SR1 (SR1) +# helium-0.2.3-SR3 + +ODL_RELEASE=${ODL_RELEASE:-boron-snapshot-0.5.0} + +# The IP address of ODL. Set this in local.conf. +ODL_MGR_IP=${ODL_MGR_IP:-$SERVICE_HOST} + +# The list of IP addresses used as OVS manager, separated by a comma. +# In non-clustering cases, this is normally the same as ODL_MGR_IP. However, +# for HA deployments the southbound portion to ODL is expected to +# use the ip addresses of the ODL instances instead of a single vip. That +# enables OVS to simultaneouly connect to more than one ODL instance. +# Example of expected format: ODL_OVS_MANAGERS=1.1.1.1,2.2.2.2,3.3.3.3 +ODL_OVS_MANAGERS=${ODL_OVS_MANAGERS:-$ODL_MGR_IP} + +# The default ODL port for Tomcat to use +# NOTE: We make this configurable because by default, ODL uses port 8080 for +# Tomcat (Helium releases) or Jetty (Lithium and later releases), and this +# conflicts with swift which also uses port 8080. +ODL_PORT=${ODL_PORT:-8087} + +# The ODL endpoint URL +ODL_ENDPOINT=${ODL_ENDPOINT:-http://${ODL_MGR_IP}:${ODL_PORT}/controller/nb/v2/neutron} + +# The ODL username +ODL_USERNAME=${ODL_USERNAME:-admin} + +# The ODL password +ODL_PASSWORD=${ODL_PASSWORD:-admin} + +# use v2 type driver +# this requires post mitaka +ODL_V2DRIVER=${ODL_V2DRIVER:-False} + +# The OpenDaylight URL PREFIX +ODL_URL_PREFIX=${ODL_URL_PREFIX:-https://nexus.opendaylight.org} + +# OpenDaylight snapshot & release repositories paths +# Can be overidden in case you host proxy repositories which have a different diretory structure than OpenDaylight's +ODL_URL_SNAPSHOT_REPOSITORY_PATH=${ODL_URL_SNAPSHOT_REPOSITORY_PATH:-content/repositories/opendaylight.snapshot} +ODL_URL_RELEASE_REPOSITORY_PATH=${ODL_URL_RELEASE_REPOSITORY_PATH:-content/repositories/opendaylight.release} + +# How long (in seconds) to pause after ODL starts to let it complete booting +ODL_BOOT_WAIT=${ODL_BOOT_WAIT:-600} + +# Enable OpenDaylight l3 forwarding +ODL_L3=${ODL_L3:-False} + +# If you need to route the traffic out of the box, set +# ODL_PROVIDER_MAPPINGS to map br-ex as shown below. Note +# This used to be accomplished via PUBLIC_BRIDGE, but that +# is no longer necessary. +# +# The physical provider network to device mapping. Use this +# to instruct ODL to map ports into specific bridges +# Examples: +# ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS:-br-ex:eth2} +# ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS:-physnet1:eth1,br-ex:eth2} + +# MAC address for next hop gateway at external network +ODL_L3GW_MAC=${ODL_L3GW_MAC:-''} + +# Enable debug logs for odl ovsdb +ODL_NETVIRT_DEBUG_LOGS=${ODL_NETVIRT_DEBUG_LOGS:-False} + +# Karaf logfile information +ODL_KARAF_LOG_DATE=$(date +%Y-%m-%d-%H%M%S) +ODL_KARAF_LOG_BASE=${ODL_KARAF_LOG_BASE:-screen-karaf.log} +ODL_KARAF_LOG_NAME=$ODL_KARAF_LOG_BASE.$ODL_KARAF_LOG_DATE + +# The bridge to configure +OVS_BR=${OVS_BR:-br-int} + +# Use the existing ready java env +ODL_USING_EXISTING_JAVA=${ODL_USING_EXISTING_JAVA:-False} + +# Allow the min/max/perm Java memory to be configurable +ODL_JAVA_MIN_MEM=${ODL_JAVA_MIN_MEM:-256m} +ODL_JAVA_MAX_MEM=${ODL_JAVA_MAX_MEM:-512m} +ODL_JAVA_MAX_PERM_MEM=${ODL_JAVA_MAX_PERM_MEM:-512m} + +# Interval in test_with_retry calls +ODL_RETRY_SLEEP_INTERVAL=${ODL_RETRY_SLEEP_INTERVAL:-5} + +# Skip installation of distribution provided Open vSwitch +SKIP_OVS_INSTALL=$(trueorfalse False SKIP_OVS_INSTALL) + +# The ODL Restconf URL +# URI to hostconfigs: empty for default value +ODL_HOSTCONF_URI=${ODL_HOSTCONF_URI:-} + +# Port binding controller +ODL_PORT_BINDING_CONTROLLER=${ODL_PORT_BINDING_CONTROLLER:-network-topology} + +# Snapshot version - allows using a specific version e.g. 0.5.0-20160719.101233-3643 +# latest: check the latest snapshot +# specific version: the specific version of the snapshot +# "": odl release +ODL_SNAPSHOT_VERSION=${ODL_SNAPSHOT_VERSION:-} diff --git a/networking-odl/devstack/setup_java.sh b/networking-odl/devstack/setup_java.sh new file mode 100644 index 0000000..2b03cbc --- /dev/null +++ b/networking-odl/devstack/setup_java.sh @@ -0,0 +1,207 @@ +#!/bin/bash + +ORACLE_JAVA_URL="http://download.oracle.com/otn-pub/java/jdk" +ORACLE_JAVA7_URL="${ORACLE_JAVA7_URL:-$ORACLE_JAVA_URL/7u80-b15/jdk-7u80}" +ORACLE_JAVA7_NAME="jdk1.7.0_80" +ORACLE_JAVA8_URL="${ORACLE_JAVA8_URL:-$ORACLE_JAVA_URL/8u74-b02/jdk-8u74}" +ORACLE_JAVA8_NAME="jdk1.8.0_74" + +function setup_java { + # Java version 8 is the last stable one + local VERSION="${1:-8}" + + echo "Setup Java version: $VERSION" + if test_java_version "$VERSION" && setup_java_env; then + echo "Current Java version is already $VERSION." + elif select_java "$VERSION"; then + echo "Java version $VERSION has been selected." + elif install_openjdk "$VERSION" && select_java "$VERSION"; then + echo "OpenJDK version $VERSION has been installed and selected." + elif install_other_java "$VERSION" && select_java "$VERSION"; then + echo "Some Java version $VERSION has been installed and selected." + else + echo "ERROR: Unable to setup Java version $VERSION." + return 1 + fi + + return 0 +} + +function setup_java_env() { + local JAVA_COMMAND="${1:-${JAVA:-java}}" + + JAVA_LINK="$(which $JAVA_COMMAND)" + if [[ "$JAVA_LINK" == "" ]]; then + return 1 + fi + + export JAVA="$(readlink -f $JAVA_LINK)" + export JAVA_HOME=$(echo $JAVA | sed "s:/bin/java::" | sed "s:/jre::") + if [ "$JAVA" != "$(readlink -f $(which java))" ]; then + export PATH="$(dirname $JAVA):$PATH" + if [ "$JAVA" != "$(readlink -f $(which java))" ]; then + echo "Unable to set $JAVA as current." + return 1 + fi + fi + + echo "JAVA is: $JAVA" + echo "JAVA_HOME is: $JAVA_HOME" + echo "Java version is:" + $JAVA -version 2>&1 +} + +function select_java { + local VERSION="$1" + local COMMAND + + for COMMAND in $(list_java_commands); do + if test_java_version "$VERSION" "$COMMAND"; then + if setup_java_env "$COMMAND"; then + return 0 + fi + fi + done + + echo 'Required java version not found.' + return 1 +} + +function test_java_version { + local EXPECTED_VERSION="'"*' version "1.'$1'.'*'"'"'" + local COMMAND="${2:-${JAVA:-java}}" + local ACTUAL_VERSION="'"$($COMMAND -version 2>&1 | head -n 1)"'" + + if [[ $ACTUAL_VERSION == $EXPECTED_VERSION ]]; then + echo "Found matching java version: $ACTUAL_VERSION" + return 0 + else + return 1 + fi +} + +if is_ubuntu; then + # --- Ubuntu ------------------------------------------------------------- + + function list_java_commands { + update-alternatives --list java + } + + function install_openjdk { + local REQUIRED_VERSION="$1" + apt_get install "openjdk-$REQUIRED_VERSION-jre-headless" + } + + function install_other_java { + local VERSION="$1" + local PPA_REPOSITORY="ppa:webupd8team/java" + local JAVA_INSTALLER="oracle-java${VERSION}-installer" + local JAVA_SET_DEFAULT="oracle-java${VERSION}-set-default" + + # Accept installer license + echo "$JAVA_INSTALLER" shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections + + # Remove all existing set-default versions + apt_get remove oracle-java*-set-default + if apt_get install $JAVA_INSTALLER ; then + if apt_get install $JAVA_SET_DEFAULT ; then + return 0 # Some PPA was already providing desired packages + fi + fi + + # Add PPA only when package is not available + if apt_get install software-properties-common; then + # I pipe this after echo to emulate an user key-press + if echo | sudo -E add-apt-repository "$PPA_REPOSITORY"; then + if apt_get update; then + if apt_get install $JAVA_INSTALLER ; then + if apt_get install $JAVA_SET_DEFAULT ; then + return 0 + fi + fi + fi + fi + fi + + # Something has gone wrong! + return 1 + } + +else + # --- Red Hat ------------------------------------------------------------- + + function list_java_commands { + alternatives --display java 2>&1 | grep -v '^[[:space:]]' | awk '/[[:space:]]- priority[[:space:]]/{print $1}' + } + + function install_openjdk { + local VERSION="$1" + yum_install java-1.$VERSION.*-openjdk-headless + } + + function install_other_java { + local VERSION="$1" + + if [[ "$(uname -m)" == "x86_64" ]]; then + local ARCH=linux-x64 + else + local ARCH=linux-i586 + fi + + if [[ "$VERSION" == "7" ]]; then + ORIGIN=$ORACLE_JAVA7_URL + TARGET=$ORACLE_JAVA7_NAME + elif [[ "$VERSION" == "8" ]]; then + ORIGIN=$ORACLE_JAVA8_URL + TARGET=$ORACLE_JAVA8_NAME + else + echo "Unsupported Java version: $VERSION." + return 1 + fi + + local NEW_JAVA="/usr/java/$TARGET/jre/bin/java" + if test_java_version "$VERSION" "$NEW_JAVA"; then + if sudo alternatives --install /usr/bin/java java "$NEW_JAVA" 200000; then + return 0 + fi + fi + + local EXT + local WGET_OPTIONS="-c --no-check-certificate --no-cookies" + local HEADER="Cookie: oraclelicense=accept-securebackup-cookie" + + for EXT in "rpm" "tar.gz"; do + local URL="$ORIGIN-$ARCH.$EXT" + local PACKAGE="/tmp/$(basename $URL)" + + if wget $WGET_OPTIONS --header "$HEADER" "$URL" -O "$PACKAGE"; then + case "$EXT" in + "rpm") + sudo rpm -i "$PACKAGE" + ;; + "tar.gz") + sudo mkdir -p /usr/java && sudo tar -C /usr/java -xzf "$PACKAGE" + ;; + *) + echo "Unsupported extension: $EXT" + ;; + esac + + if test_java_version "$VERSION" "$NEW_JAVA"; then + if sudo alternatives --install /usr/bin/java java "$NEW_JAVA" 200000; then + return 0 + fi + fi + + echo "Unable to register installed java." + + else + echo "Unable to download java archive: $URL" + fi + + done + + return 1 + } + +fi |