Add devstack plugin to install networking_baremetal

To enable networking-baremetal in devstack installation
add the following to local.conf

enable_plugin networking-baremetal git://git.openstack.org/openstack/networking-baremetal.git

Change-Id: I605853a1decee6292ed9469be2f35b572049d919
changes/57/448157/13
Vasyl Saienko 2017-03-21 17:25:16 +02:00 committed by Vladyslav Drok
parent 5c4f279702
commit 14891cc28c
6 changed files with 101 additions and 1 deletions

45
devstack/plugin.sh Normal file
View File

@ -0,0 +1,45 @@
#!/usr/bin/env bash
# plugin.sh - DevStack plugin.sh dispatch script template
NETWORKING_BAREMETAL_DIR=${NETWORKING_BAREMETAL_DIR:-$DEST/networking-baremetal}
NETWORKING_BAREMETAL_DATA_DIR=""$DATA_DIR/networking-baremetal""
function install_networking_baremetal {
setup_develop $NETWORKING_BAREMETAL_DIR
}
function configure_networking_baremetal {
if [[ -z "$Q_ML2_PLUGIN_MECHANISM_DRIVERS" ]]; then
Q_ML2_PLUGIN_MECHANISM_DRIVERS='baremetal'
else
if [[ ! $Q_ML2_PLUGIN_MECHANISM_DRIVERS =~ $(echo '\<baremetal\>') ]]; then
Q_ML2_PLUGIN_MECHANISM_DRIVERS+=',baremetal'
fi
fi
populate_ml2_config /$Q_PLUGIN_CONF_FILE ml2 mechanism_drivers=$Q_ML2_PLUGIN_MECHANISM_DRIVERS
}
function cleanup_networking_baremetal {
rm -rf $NETWORKING_BAREMETAL_DATA_DIR
}
# check for service enabled
if is_service_enabled networking_baremetal; then
if [[ "$1" == "stack" && "$2" == "install" ]]; then
# Perform installation of service source
echo_summary "Installing Networking Baremetal ML2"
install_networking_baremetal
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
# Configure after the other layer 1 and 2 services have been configured
echo_summary "Configuring Networking Baremetal Ml2"
configure_networking_baremetal
fi
if [[ "$1" == "unstack" ]]; then
echo_summary "Cleaning Networking Baremetal Ml2"
cleanup_networking_baremetal
fi
fi

2
devstack/settings Normal file
View File

@ -0,0 +1,2 @@
# settings file for networking_baremetal
enable_service networking_baremetal

View File

@ -2,6 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
bashate>=0.2 # Apache-2.0
hacking>=0.12.0,!=0.13.0,<0.14 # Apache-2.0
coverage>=4.0 # Apache-2.0
oslotest>=1.10.0 # Apache-2.0

20
tools/flake8wrap.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
#
# A simple wrapper around flake8 which makes it possible
# to ask it to only verify files changed in the current
# git HEAD patch.
#
# Intended to be invoked via tox:
#
# tox -epep8 -- -HEAD
#
if test "x$1" = "x-HEAD" ; then
shift
files=$(git diff --name-only HEAD~1 | tr '\n' ' ')
echo "Running flake8 on ${files}"
diff -u --from-file /dev/null ${files} | flake8 --diff "$@"
else
echo "Running flake8 on all files"
exec flake8 "$@"
fi

27
tools/run_bashate.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
#
# 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.
find "$@" -not \( -type d -name .?\* -prune \) \
-type f \
-not -name \*.swp \
-not -name \*~ \
-not -name \*.xml \
-not -name \*.template \
-not -name \*.py \
\( \
-name \*.sh -or \
-wholename \*/lib/\* -or \
-wholename \*/tools/\* \
\) \
-print0 | xargs -0 bashate -v -iE006 -eE005,E042

View File

@ -13,7 +13,12 @@ deps = -r{toxinidir}/test-requirements.txt
commands = ostestr {posargs}
[testenv:pep8]
commands = flake8 {posargs}
whitelist_externals = bash
commands =
bash tools/flake8wrap.sh {posargs}
# Run bashate during pep8 runs to ensure violations are caught by
# the check and gate queues.
{toxinidir}/tools/run_bashate.sh {toxinidir}/devstack
[testenv:venv]
commands = {posargs}