Files
group-based-policy/devstack/lib/gbp
Sumit Naiksatam cd10b7de0e [aim] Fix aim gate job
This patch fixes the gate-group-based-policy-dsvm-aim-ubuntu-xenial-nv
integration job that exercises the aim_mapping policy driver and
the ml2plus plugin with the apic_mapping mechanism driver.

Other GBP integration jobs patch a devstack installation to run GBP, however
this patch configures the aforementioned job to use the in-tree GBP devstack
plugin. Based on the validation from this patch, the same approach can now be
extended to the other jobs as well and has the advantage of providing the
developer the ability to recreate the devstack setup used in the gate job.

Some variations do exist in the devstack setup on account of the environment
available in the gate job versus that in a developer's setup (for example, the
source repo is already cloned in the gate job and needs to be used), and in
such cases the ENABLE_APIC_AIM_GATE devstack env variable is used to
special case appropriately. Anyone wanting to replicate the exact devstack
gate configuration should set this variable to true in their local.conf
instead of the ENABLE_APIC_AIM variable referred to in the devref document
and which adds more configuration and starts neutron agents. Over time, the
ENABLE_APIC_AIM_GATE configuration will converge with that of the
ENABLE_APIC_AIM and the ENABLE_APIC_AIM_GATE variable will be eliminated.

The eventual goal of this job is to be able to test as much of the GBP/Neutron
workflowsi, and resulting AIM and system configuration, as possible (in spite
of the absence of the backend components). The first step towards that end
is to test the CRUD operations. This is achieved by running a basic GBP exercise
script that is a variant of the one run in the
gate-group-based-policy-dsvm-functional-ubuntu-xenial-nv job (it does not launch
the VMs since it will fail on account of the expected port binding failure).

The gbpfunctest functional test suite that is run against the
gate-group-based-policy-dsvm-functional-ubuntu-xenial-nv is also run in this
job with some minor adjustments to the test suite. The adjustments are mainly
to account for the variation in sharing semantics between the aim_mapping and
resource_mapping drivers (the former has more flexibility that the latter), and
the lack of support for hierarchical PRS in the aim_mapping driver.

All neutron agents are being disabled in this iteration to avoid logs being
inundated with port binding failure messages. A number of options are up for
consideration in terms of how to get the port binding to succeed, and will
be evaluated over time. The appropriate agents will be enabled accordingly.

Change-Id: I528b7fd2e66a0f7ef1bb00c887e5fbf2434cf966
2017-02-08 09:49:44 -08:00

113 lines
3.8 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
OPFLEX_REPO=http://github.com/noironetworks/python-opflex-agent.git
OPFLEX_DIR=$DEST/opflexagent
APICAPI_REPO=http://github.com/noironetworks/apicapi.git
APICAPI_DIR=$DEST/apicapi
# 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 {
if [[ $ENABLE_APIC_AIM_GATE = False ]]; then
git_clone $GBPSERVICE_REPO $GBPSERVICE_DIR $GBPSERVICE_BRANCH
fi
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 $Q_POLICY_FILE
sed -i 's/"context_is_admin": "role:admin"/"context_is_admin": "role:admin or user_name:neutron"/g' $Q_POLICY_FILE
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_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
}
function install_apicapi {
git_clone $APICAPI_REPO $APICAPI_DIR $APICAPI_BRANCH
mv $APICAPI_DIR/test-requirements.txt $APICAPI_DIR/_test-requirements.txt
touch $APICAPI_DIR/setup.cfg
setup_develop $APICAPI_DIR
mv $APICAPI_DIR/_test-requirements.txt $APICAPI_DIR/test-requirements.txt
}
# Restore xtrace
$XTRACE
# Tell emacs to use shell-script-mode
## Local variables:
## mode: shell-script
## End: