Merge "CI: Test floating ip allocation and connectivity to the instance"

This commit is contained in:
Zuul 2020-02-28 20:06:48 +00:00 committed by Gerrit Code Review
commit 438a611375
2 changed files with 49 additions and 0 deletions

View File

@ -40,6 +40,30 @@
- "kolla"
- "ansible"
# NOTE(yoctozepto): let's observe forwarding behavior
- name: iptables - LOG FORWARD
become: true
iptables:
state: present
action: append
chain: FORWARD
jump: LOG
log_prefix: 'iptables FORWARD: '
# NOTE(yoctozepto): This is to undo Docker's default policy of DROP which
# breaks l3 forwarding and also linuxbridge deploys due to bridge-nf-call-iptables.
# FIXME(yoctozepto): really handle this for users - somehow my local multinode
# deploy fixed it for itself by setting it to ACCEPT on network nodes without
# my intervention but so far we have no idea what did that. It certainly does
# not happen in CI where all nodes are aio.
- name: iptables - ACCEPT FORWARD
become: True
iptables:
state: present
action: append
chain: FORWARD
jump: ACCEPT
- name: set new hostname based on ansible inventory file
hostname:
name: "{{ inventory_hostname }}"

View File

@ -70,6 +70,31 @@ function test_instance_boot {
echo "SUCCESS: Cinder volume attachment"
fi
echo "TESTING: Floating ip allocation"
fip_addr=$(openstack floating ip create public1 -f value -c floating_ip_address)
openstack server add floating ip kolla_boot_test ${fip_addr}
echo "SUCCESS: Floating ip allocation"
echo "TESTING: PING&SSH to floating ip"
attempts=6
for i in $(seq 1 ${attempts}); do
if ping -c1 -W1 ${fip_addr} && ssh -v -o BatchMode=yes -o StrictHostKeyChecking=no cirros@${fip_addr} hostname; then
break
elif [[ $i -eq ${attempts} ]]; then
echo "Failed to access server via SSH after ${attempts} attempts"
return 1
else
echo "Cannot access server - retrying"
fi
sleep 10
done
echo "SUCCESS: PING&SSH to floating ip"
echo "TESTING: Floating ip deallocation"
openstack server remove floating ip kolla_boot_test ${fip_addr}
openstack floating ip delete ${fip_addr}
echo "SUCCESS: Floating ip deallocation"
echo "TESTING: Server deletion"
openstack server delete --wait kolla_boot_test
echo "SUCCESS: Server deletion"