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=$(openstack catalog show identity |awk '/public/ {print $4}')
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 |awk '/admin/ {print $4}')
41 if [ -z ${adminURL} ]; then
42 echo "ERROR: Cannot determine the admin URL."
43 openstack catalog show identity
46 adminIP=$(echo $adminURL|sed 's/^.*http\:\/\///'|sed 's/.[^:]*$//')
47 adminPort=$(echo $adminURL|sed 's/^.*://'|sed 's/.[^\/]*$//')
48 echo ">>Verifying connectivity to the admin endpoint $adminIP:$adminPort..."
49 verify_connectivity $adminIP $adminPort
51 if [ $RETVAL -ne 0 ]; then
52 echo "ERROR: Cannot talk to the admin endpoint $adminIP:$adminPort ."
59 echo "Checking OpenStack basic services:"
60 commands=('openstack endpoint list' 'nova list' 'neutron net-list' \
61 'glance image-list' 'cinder list')
62 for cmd in "${commands[@]}"
64 service=$(echo $cmd | awk '{print $1}')
65 echo ">>Checking $service service..."
70 echo "ERROR: Failed execution $cmd. The $service does not seem to be working."
77 echo "OpenStack services are OK."
79 echo "Checking External network..."
80 networks=($(neutron net-list -F id | tail -n +4 | head -n -1 | awk '{print $2}'))
82 for net in "${networks[@]}"
84 is_external=$(neutron net-show $net|grep "router:external"|awk '{print $4}')
85 if [ $is_external == "True" ]; then
86 echo "External network found: $net"
90 if [ $is_external == "False" ]; then
91 echo "ERROR: There are no external networks in the deployment."