Files
whitebox-neutron-tempest-pl…/devstack/plugin.sh
Roman Safronov cc3958263c Make external network shared and dhcp enabled
Some tests are skipped because the public network is not shared.
Enabling 'shared' option for the network will allow the tests to run.

Enabled dhcp on the public subnet to allow VMs connected to it
obtain ip addresses successfully.

Both changes above are applied only for ovn jobs since for ovs jobs
additionally require some additionall settings, e.g. to ensure that
only a single dhcp server exist on external network. This can be done
in a separate patch if needed.

Adjusted bw_limit external network qos test to use a separate VM on
external network instead of sending traffic from the test container
in order to not depend on specifics on different environments.

Change-Id: I2e6cf51a4dab7eb593362d482e2587d54e4a12d6
2024-04-01 11:24:01 +03:00

57 lines
2.5 KiB
Bash

customize_advanced_image(){
# Here we customize an advanced image to make it suitable for the plugin tests.
# Note: the advanced image was downloaded and set by neutron_tempest_plugin.
# However we can't rely on neutron_tempest_plugin capabilities for customizing
# the image since it expects a debian/ubuntu based image which does not fit well
# to this plugin tests.
# This code modifies the downloaded image by adding packages required by this
# plugin, uploads the image to glance and if all passed successfully it updates
# tempest.conf with the new image reference instead of the original one.
install_package guestfs-tools
for image_url in ${IMAGE_URLS//,/ }; do
if [[ $image_url =~ $ADVANCED_IMAGE_NAME ]]; then
image_file=$(basename $image_url)
break
fi
done
if [ -n "$image_file" ] && [ -s "$TOP_DIR/files/$image_file" ]; then
cp -f $TOP_DIR/files/$image_file /tmp
image_file_custom=/tmp/$image_file
timeout 150 sudo virt-customize -a $image_file_custom --install nmap,python3,keepalived,iperf3 --selinux-relabel
if [ "$?" == "0" ]; then
source $TOP_DIR/openrc admin
old_image_id=$(openstack image show $ADVANCED_IMAGE_NAME -c id -f value)
new_image_id=$(openstack image create --disk-format qcow2 --container-format bare --public $ADVANCED_IMAGE_NAME --file $image_file_custom -c id -f value)
if [ -n "$new_image_id" ]; then
iniset $TEMPEST_CONFIG neutron_plugin_options advanced_image_ref $new_image_id
openstack image delete $old_image_id
fi
fi
fi
}
customize_public_network_and_subnet(){
if [[ $Q_AGENT == "ovn" ]]; then
# Make external network shared with dhcp enabled to allow tests with VMs
# on external network to run. Note, we still keep these settings disabled
# for OVS jobs since they can require additional settings, like ensuring
# that only a single DHCP server is available on the external network.
openstack network set --share $PUBLIC_NETWORK_NAME
openstack subnet set --dhcp $PUBLIC_SUBNET_NAME
fi
}
if [[ "$1" == "stack" ]]; then
case "$2" in
install)
if [[ "$INSTALL_TEMPEST" == "True" ]]; then
echo "tempest ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/99_tempest
fi
;;
test-config)
customize_advanced_image
customize_public_network_and_subnet
;;
esac
fi