3 # Simple script to check the basic OpenStack clients
6 # jose.lausuch@ericsson.com
9 verify_connectivity() {
10 for i in $(seq 0 10); do
11 if echo "test" | nc -v $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..."
66 echo "ERROR: Failed execution $cmd. The $service does not seem to be working."
73 echo "OpenStack services are OK."
75 echo "Checking External network..."
76 networks=($(neutron net-list | tail -n +4 | head -n -1 | awk '{print $2}'))
78 for net in "${networks[@]}"
80 is_external=$(neutron net-show $net|grep "router:external"|awk '{print $4}')
81 if [ $is_external == "True" ]; then
82 echo "External network found: $net"
86 if [ $is_external == "False" ]; then
87 echo "ERROR: There are no external networks in the deployment."
92 # Temporary output information
93 # To see the initial OpenStack defaults
94 # in case we delete something later on.
95 # This is to be removed for the release
100 echo "nova floating-ip-list:"
101 nova floating-ip-list
102 echo "neutron net-list:"
104 echo "neutron router-list:"
106 echo "neutron security-group-list:"
107 neutron security-group-list
108 echo "openstack project list:"
109 openstack project list
110 echo "openstack user list:"