tripleo-quickstart-extras/roles/validate-tempest/templates/configure-tempest.sh.j2

94 lines
3.8 KiB
Django/Jinja

#
# configure-tempest
#
{% if tempest_overcloud %}
source {{ working_dir }}/overcloudrc
# Clean up from any previous tempest run.
rm -rf {{ working_dir }}/tempest
# clean up network if it exists from previous run
for i in $(neutron router-list -c id -f value); do neutron router-gateway-clear $i; done
for r in $(neutron router-list -c id -f value); do
for p in $(neutron router-port-list $r -c id -f value); do
neutron router-interface-delete $r port=$p || true
done
done
for i in $(neutron router-list -c id -f value); do neutron router-delete $i; done
for i in $(neutron port-list -c id -f value); do neutron port-delete $i; done
for i in $(neutron net-list -c id -f value); do neutron net-delete $i; done
neutron net-create {{ public_net_name }} --router:external=True \
--provider:network_type {{ public_network_type }} \
{% if public_segmentation_id != '' %}
--provider:segmentation_id {{ public_segmentation_id }} \
{% endif %}
--provider:physical_network {{ public_physical_network }}
public_net_id=$(neutron net-show {{ public_net_name }} -f value -c id)
neutron subnet-create --name ext-subnet \
--allocation-pool \
start={{ public_net_pool_start }},end={{ public_net_pool_end }} \
--disable-dhcp \
--gateway {{ public_net_gateway }} \
{{ public_net_name }} {{ floating_ip_cidr }}
{% else %}
source {{ working_dir }}/stackrc
public_net_id=$(neutron net-show {{ undercloud_public_net_name }} -f value -c id)
{% endif %}
# Generate a tempest configuration.
sudo yum install -y libffi-devel openssl-devel python-virtualenv
{% if tempest_source == "rdo" %}
{% if tempest_format == "packages" %}
mkdir {{ working_dir }}/tempest
cd {{ working_dir }}/tempest
/usr/share/openstack-tempest-*/tools/configure-tempest-directory
{% elif tempest_format == "venv" %}
git clone https://github.com/redhat-openstack/tempest {{ working_dir }}/tempest
cd {{ working_dir }}/tempest
virtualenv --no-site-packages .venv
./tools/with_venv.sh pip install -U pip setuptools
./tools/with_venv.sh pip install junitxml httplib2 -r test-requirements.txt -r requirements.txt
{% endif %}
{% elif tempest_source == "upstream" %}
git clone https://github.com/openstack/tempest {{ working_dir }}/tempest
cd {{ working_dir }}/tempest
virtualenv --no-site-packages .venv
./tools/with_venv.sh pip install -U pip setuptools
./tools/with_venv.sh pip install junitxml httplib2 -r test-requirements.txt -r requirements.txt
cp /usr/share/openstack-tempest-*/tools/config_tempest.py ./tools/
cp /usr/share/openstack-tempest-*/tools/run-tests.sh ./tools/
cp /usr/share/openstack-tempest-*/tools/tests2skip.py ./tools/
cp /usr/share/openstack-tempest-*/tempest/common/api_discovery.py ./tempest/common/
cp /usr/share/openstack-tempest-*/etc/default-overrides.conf ./etc/
{% endif %}
{% if tempest_undercloud %}
# config_tempest assumes that Cinder is installed and accessible. Cinder is
# not installed on the undercloud. Remove unneeded lines to prevent the tool
# from bawking upon execution
sed --in-place "/'volume'\: 'cinder',/d" tools/config_tempest.py
sed --in-place "/'volume'\: \['v1', 'v2'\]/d" tools/config_tempest.py
{% endif %}
{% if tempest_format == "venv" %}./tools/with_venv.sh {% endif %}./tools/config_tempest.py --out etc/tempest.conf \
--network-id $public_net_id \
--deployer-input ~/{{ tempest_deployer_input_file }} \
--debug --create \
identity.uri $OS_AUTH_URL \
identity.admin_password $OS_PASSWORD \
network.tenant_network_cidr {{ tenant_network_cidr }} \
object-storage.operator_role swiftoperator \
compute.allow_tenant_isolation true \
compute.build_timeout 500 \
compute.image_ssh_user cirros \
compute.ssh_user cirros \
network.build_timeout 500 \
volume.build_timeout 500 \
scenario.ssh_user cirros \
orchestration.stack_owner_role heat_stack_owner