Files
group-based-policy/devstack/lib/gbp
Igor Duarte Cardoso 5b463f4cfa Migrate DevStack support to a DevStack plugin
This change adds a DevStack plugin for Group-Based Policy.

A new top-level directory, devstack, has been created to fulfill
the contract of the DevStack plugin mechanism [1].

Documentation on how to enable the plugin has been added to
doc/source/installation.rst.

[1] http://docs.openstack.org/developer/devstack/plugins.html

Change-Id: I7e6c95408fbb132e33823d803a44f2867541a922
Closes-Bug: #1564893
2016-04-14 11:44:59 +01:00

109 lines
3.5 KiB
Plaintext
Executable File

# lib/gbp
# functions - functions specific to group-based-policy
# Dependencies:
# ``functions`` file
# ``DEST`` must be defined
# ``STACK_USER`` must be defined
# ``stack.sh`` calls the entry points in this order:
#
# - install_gbp
# - install_gbpclient
# - init_gbp
#
# ``unstack.sh`` calls the entry points in this order:
# Set up default directories
GBPSERVICE_DIR=$DEST/gbp
GBPCLIENT_DIR=$DEST/python-gbpclient
GBPHEAT_DIR=$DEST/gbpautomation
GBPUI_DIR=$DEST/gbpui
NEUTRON_CONF_DIR=/etc/neutron
NEUTRON_CONF=$NEUTRON_CONF_DIR/neutron.conf
GBP_CONF_DIR=/etc/gbp
AIM_REPO=http://github.com/noironetworks/aci-integration-module.git
AIM_DIR=$DEST/aim
APICML2_REPO=http://github.com/noironetworks/apic-ml2-driver.git
APICML2_DIR=$DEST/apic_ml2
# Save trace setting
XTRACE=$(set +o | grep xtrace)
set +o xtrace
# Functions
# ---------
# init_gbpservice() - Initialize databases, etc.
function init_gbpservice {
# Run GBP db migrations
gbp-db-manage --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE upgrade head
iniset $NEUTRON_CONF DEFAULT policy_dirs $GBP_CONF_DIR
}
# install_gbpservice() - Collect source and prepare
function install_gbpservice {
git_clone $GBPSERVICE_REPO $GBPSERVICE_DIR $GBPSERVICE_BRANCH
mv $GBPSERVICE_DIR/test-requirements.txt $GBPSERVICE_DIR/_test-requirements.txt
setup_develop $GBPSERVICE_DIR
mv -f $NEUTRON_CONF_DIR/policy.json $NEUTRON_CONF_DIR/policy.json.original 2>/dev/null; true
cp -f $GBPSERVICE_DIR/etc/policy.json $NEUTRON_CONF_DIR/policy.json
mv $GBPSERVICE_DIR/_test-requirements.txt $GBPSERVICE_DIR/test-requirements.txt
}
# install_gbpclient() - Collect source and prepare
function install_gbpclient {
git_clone $GBPCLIENT_REPO $GBPCLIENT_DIR $GBPCLIENT_BRANCH
mv $GBPCLIENT_DIR/test-requirements.txt $GBPCLIENT_DIR/_test-requirements.txt
setup_develop $GBPCLIENT_DIR
sudo install -D -m 0644 -o $STACK_USER {$GBPCLIENT_DIR/tools/,/etc/bash_completion.d/}gbp.bash_completion
mv $GBPCLIENT_DIR/_test-requirements.txt $GBPCLIENT_DIR/test-requirements.txt
}
# install_gbpclient() - Collect source and prepare
function install_gbpheat {
git_clone $GBPHEAT_REPO $GBPHEAT_DIR $GBPHEAT_BRANCH
mv $GBPHEAT_DIR/test-requirements.txt $GBPHEAT_DIR/_test-requirements.txt
setup_develop $GBPHEAT_DIR
mv $GBPHEAT_DIR/_test-requirements.txt $GBPHEAT_DIR/test-requirements.txt
}
# install_gbpui() - Collect source and prepare
function install_gbpui {
git_clone $GBPUI_REPO $GBPUI_DIR $GBPUI_BRANCH
mv $GBPUI_DIR/test-requirements.txt $GBPUI_DIR/_test-requirements.txt
setup_develop $GBPUI_DIR
ln -sf $GBPUI_DIR/gbpui/_*project*.py $HORIZON_DIR/openstack_dashboard/enabled
cd $GBPUI_DIR
python $HORIZON_DIR/manage.py collectstatic --noinput
mv $GBPUI_DIR/_test-requirements.txt $GBPUI_DIR/test-requirements.txt
}
function install_aim {
git_clone $AIM_REPO $AIM_DIR $AIM_BRANCH
mv $AIM_DIR/test-requirements.txt $AIM_DIR/_test-requirements.txt
setup_develop $AIM_DIR
mv $AIM_DIR/_test-requirements.txt $AIM_DIR/test-requirements.txt
}
function init_aim {
aim -c $NEUTRON_CONF db-migration upgrade
}
function install_apic_ml2 {
git_clone $APICML2_REPO $APICML2_DIR $APICML2_BRANCH
mv $APICML2_DIR/test-requirements.txt $APICML2_DIR/_test-requirements.txt
setup_develop $APICML2_DIR
mv $APICML2_DIR/_test-requirements.txt $APICML2_DIR/test-requirements.txt
}
# Restore xtrace
$XTRACE
# Tell emacs to use shell-script-mode
## Local variables:
## mode: shell-script
## End: