CI: Test floating ip allocation and connectivity to the instance

Inspired by pending work of mnasiadka [1] and mgoddard [2].

[1] https://review.opendev.org/708250
[2] https://review.opendev.org/707604

Depends-on: https://review.opendev.org/709362
Depends-on: https://review.opendev.org/709671
Depends-on: https://review.opendev.org/709830
Change-Id: Ifd7bde60881a4b644fc3f18dd9fcb7f8b02d3a00
This commit is contained in:
Radosław Piliszek 2020-02-23 18:29:16 +01:00
parent eb0a0ff8d7
commit 1f0070db6c
2 changed files with 49 additions and 0 deletions

View File

@ -38,6 +38,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"