whitebox-neutron-tempest-pl.../devstack/plugin.sh
Roman Safronov 679acc0f77 Add MTU tests
The tests moved from downstream plugin with necessary adjustments.
Note: the tests currently can not be run on upstream gates due to [1].

[1] https://bugs.launchpad.net/neutron/+bug/2060828

Change-Id: If532aab2cd4fa599b8dd14045d7671a281213763
2024-04-10 18:48:52 +03:00

63 lines
2.9 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
# Decrease external network MTU to allow tests from test_mtu.py to run
# (rsafrono) tests from test_mtu.py can not be run due to
# https://bugs.launchpad.net/neutron/+bug/2060828
# The line should be uncommented once the issue is fixed
# openstack network set --mtu 1330 $PUBLIC_NETWORK_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