diff options
author | jose.lausuch <jose.lausuch@ericsson.com> | 2015-12-21 15:34:26 +0100 |
---|---|---|
committer | jose.lausuch <jose.lausuch@ericsson.com> | 2015-12-21 20:16:25 +0100 |
commit | b965f0c5115467e3bd863d61f91246b62b36803e (patch) | |
tree | a3d6ba00b46942ab4ecf9d2f5b45efca9325e35d /testcases/VIM/OpenStack | |
parent | b560a6f4aa55ab796ae93287f842a267f847e4a0 (diff) |
Script to check the basic OpenStack services
JIRA: FUNCTEST-118
Change-Id: I92372bc098c48e406e69a91c4d754e8c1e4388a6
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'testcases/VIM/OpenStack')
-rwxr-xr-x | testcases/VIM/OpenStack/CI/libraries/check_os.sh | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/testcases/VIM/OpenStack/CI/libraries/check_os.sh b/testcases/VIM/OpenStack/CI/libraries/check_os.sh new file mode 100755 index 000000000..09d983434 --- /dev/null +++ b/testcases/VIM/OpenStack/CI/libraries/check_os.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# +# Simple script to check the basic OpenStack clients +# +# Author: +# jose.lausuch@ericsson.com +# + +if [ -z $OS_AUTH_URL ];then + echo "ERROR: OS_AUTH_URL environment variable missing... Have you sourced the OpenStack credentials?" + exit 1 +fi + +echo "Checking OpenStack basic services:" + +ip=$(echo $OS_AUTH_URL|sed 's/^.*http\:\/\///'|sed 's/.[^:]*$//') +ip='192.168.123.123' +echo ">>Pinging public keystone endpoint $ip..." +timeout=5 +for i in `seq 1 $timeout`; do + ping -q -c 1 $ip &>/dev/null + RETVAL=$? + if [ $RETVAL -eq 0 ]; then + break + fi +done +if [ $i -eq $timeout ]; then + echo "ERROR: Cannot ping the endpoint $ip defined as env variable OS_AUTH_URL." + echo "OS_AUTH_URL=$OS_AUTH_URL" + exit 1 +fi +echo " ...OK" + +commands=('keystone endpoint-list' 'nova list' 'neutron net-list' \ + 'glance image-list' 'cinder list') +for cmd in "${commands[@]}" +do + service=$(echo $cmd | awk '{print $1}') + echo ">>Checking $service service..." + $cmd &>/dev/null + result=$? + if [ $result -ne 0 ]; + then + + echo "ERROR: Failed execution $cmd. The $service does not seem to be working." + exit 1 + else + echo " ...OK" + fi +done + +echo "OpenStack services are OK." +exit 0 |