Files
2aae15c93f4383c0a38dff276700c762e56a7134
devstack /tools /verify-ipv6-only-deployments.sh

96 lines
4.5 KiB
Bash
Raw Normal View History

#
#
# NOTE(gmann): This script is used in 'devstack-tempest-ipv6' zuul job to verify that
# services are deployed on IPv6 properly or not. This will capture if any devstck or devstack
# plugins are missing the required setting to listen on IPv6 address. This is run as part of
# run phase of zuul job and before test run. Child job of 'devstack-tempest-ipv6'
# can expand the IPv6 verification specific to project by defining the new post-run script which
# will run along with this base script.
# If there are more common verification for IPv6 then we can always extent this script.
# Keep track of the DevStack directory
TOP_DIR=$(cd $(dirname "0ドル")/../../devstack && pwd)
source $TOP_DIR/stackrc
source $TOP_DIR/openrc admin admin
function verify_devstack_ipv6_setting {
local _service_host=''
_service_host=$(echo $SERVICE_HOST | tr -d [])
local _host_ipv6=''
_host_ipv6=$(echo $HOST_IPV6 | tr -d [])
local _service_listen_address=''
_service_listen_address=$(echo $SERVICE_LISTEN_ADDRESS | tr -d [])
local _service_local_host=''
_service_local_host=$(echo $SERVICE_LOCAL_HOST | tr -d [])
_tunnel_endpoint_ip=$(echo $TUNNEL_ENDPOINT_IP | tr -d [])
echo $SERVICE_IP_VERSION "SERVICE_IP_VERSION is not set to 6 which is must for devstack to deploy services with IPv6 address."
exit 1
fi
echo $TUNNEL_IP_VERSION "TUNNEL_IP_VERSION is not set to 6 so TUNNEL_ENDPOINT_IP cannot be an IPv6 address."
exit 1
fi
fi
fi
fi
exit 1
fi
fi
echo "Devstack is properly configured with IPv6"
function sanity_check_system_ipv6_enabled {
if [ ! -f "/proc/sys/net/ipv6/conf/default/disable_ipv6" ] || [ "$(cat /proc/sys/net/ipv6/conf/default/disable_ipv6)" -ne "0" ]; then
exit 1
fi
echo "IPv6 is enabled in system"
}
function verify_service_listen_address_is_ipv6 {
local endpoints_verified=False
local all_ipv6=True
endpoints=$(openstack endpoint list -f value -c URL)
for endpoint in ${endpoints}; do
local endpoint_address=''
endpoint_address=$(echo "$endpoint" | awk -F/ '{print 3ドル}' | awk -F] '{print 1ドル}')
if ! python3 ${TOP_DIR}/tools/verify-ipv6-address.py "$endpoint_address"; then
fi
endpoints_verified=True
done
if [[ "$all_ipv6" == "False" ]] || [[ "$endpoints_verified" == "False" ]]; then
exit 1
fi
}
#First thing to verify if system has IPv6 enabled or not
sanity_check_system_ipv6_enabled
#Verify whether devstack is configured properly with IPv6 setting
verify_devstack_ipv6_setting
#Get all registrfed endpoints by devstack in keystone and verify that each endpoints address is IPv6.
verify_service_listen_address_is_ipv6