3 # Simple script to check the basic OpenStack clients
6 # jose.lausuch@ericsson.com
9 verify_connectivity() {
10 for i in $(seq 0 9); do
11 if echo "test" | nc -v -w 10 $1 $2 &>/dev/null; then
20 if [ -z $OS_AUTH_URL ];then
21 echo "ERROR: OS_AUTH_URL environment variable missing... Have you sourced the OpenStack credentials?"
26 echo "Checking OpenStack endpoints:"
27 publicURL=$OS_AUTH_URL
28 publicIP=$(echo $publicURL|sed 's/^.*http\:\/\///'|sed 's/.[^:]*$//')
29 publicPort=$(echo $publicURL|sed 's/^.*://'|sed 's/\/.*$//')
30 echo ">>Verifying connectivity to the public endpoint $publicIP:$publicPort..."
31 verify_connectivity $publicIP $publicPort
33 if [ $RETVAL -ne 0 ]; then
34 echo "ERROR: Cannot talk to the public endpoint $publicIP:$publicPort ."
35 echo "OS_AUTH_URL=$OS_AUTH_URL"
40 adminURL=$(openstack catalog show identity |grep adminURL|awk '{print $4}')
41 adminIP=$(echo $adminURL|sed 's/^.*http\:\/\///'|sed 's/.[^:]*$//')
42 adminPort=$(echo $adminURL|sed 's/^.*://'|sed 's/.[^\/]*$//')
43 echo ">>Verifying connectivity to the admin endpoint $adminIP:$adminPort..."
44 verify_connectivity $adminIP $adminPort
46 if [ $RETVAL -ne 0 ]; then
47 echo "ERROR: Cannot talk to the admin endpoint $adminIP:$adminPort ."
54 echo "Checking OpenStack basic services:"
55 commands=('openstack endpoint list' 'nova list' 'neutron net-list' \
56 'glance image-list' 'cinder list')
57 for cmd in "${commands[@]}"
59 service=$(echo $cmd | awk '{print $1}')
60 echo ">>Checking $service service..."
65 echo "ERROR: Failed execution $cmd. The $service does not seem to be working."
72 echo "OpenStack services are OK."
74 echo "Checking External network..."
75 networks=($(neutron net-list -F id | tail -n +4 | head -n -1 | awk '{print $2}'))
77 for net in "${networks[@]}"
79 is_external=$(neutron net-show $net|grep "router:external"|awk '{print $4}')
80 if [ $is_external == "True" ]; then
81 echo "External network found: $net"
85 if [ $is_external == "False" ]; then
86 echo "ERROR: There are no external networks in the deployment."