aboutsummaryrefslogtreecommitdiffstats
path: root/functest/ci/check_os.sh
diff options
context:
space:
mode:
authorhelenyao <yaohelan@huawei.com>2017-03-10 20:23:42 +0800
committerhelenyao <yaohelan@huawei.com>2017-03-13 14:31:23 +0800
commit4a989722feca53e1baa6f64985841bd6a244d627 (patch)
treecc5cef9d7cb84bbb271548cf453316f0bf5e38b9 /functest/ci/check_os.sh
parent68dbfb326dbfa6086ebfd36736250021b20ed5f7 (diff)
Support running on openstack which enabled https
JIRA: FUNCTEST-757 Change-Id: Ic87bee3020b9714bcd83105127440a9c1a7ff2ad Signed-off-by: helenyao <yaohelan@huawei.com>
Diffstat (limited to 'functest/ci/check_os.sh')
-rwxr-xr-xfunctest/ci/check_os.sh29
1 files changed, 23 insertions, 6 deletions
diff --git a/functest/ci/check_os.sh b/functest/ci/check_os.sh
index 2c5c021c7..3920b7ac6 100755
--- a/functest/ci/check_os.sh
+++ b/functest/ci/check_os.sh
@@ -26,6 +26,11 @@ verify_connectivity() {
return 1
}
+verify_SSL_connectivity() {
+ openssl s_client -connect $1:$2 &>/dev/null
+ return $?
+}
+
check_service() {
local service cmd
service=$1
@@ -63,10 +68,16 @@ fi
echo "Checking OpenStack endpoints:"
publicURL=$(openstack catalog show identity |awk '/public/ {print $4}')
-publicIP=$(echo $publicURL|sed 's/^.*http\:\/\///'|sed 's/.[^:]*$//')
+publicIP=$(echo $publicURL|sed 's/^.*http.*\:\/\///'|sed 's/.[^:]*$//')
publicPort=$(echo $publicURL|sed 's/^.*://'|sed 's/\/.*$//')
-echo ">>Verifying connectivity to the public endpoint $publicIP:$publicPort..."
-verify_connectivity $publicIP $publicPort
+https_enabled=$(echo $publicURL | grep 'https')
+if [[ -n $https_enabled ]]; then
+ echo ">>Verifying SSL connectivity to the public endpoint $publicIP:$publicPort..."
+ verify_SSL_connectivity $publicIP $publicPort
+else
+ echo ">>Verifying connectivity to the public endpoint $publicIP:$publicPort..."
+ verify_connectivity $publicIP $publicPort
+fi
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
echo "ERROR: Cannot talk to the public endpoint $publicIP:$publicPort ."
@@ -81,10 +92,16 @@ if [ -z ${adminURL} ]; then
openstack catalog show identity
exit 1
fi
-adminIP=$(echo $adminURL|sed 's/^.*http\:\/\///'|sed 's/.[^:]*$//')
+adminIP=$(echo $adminURL|sed 's/^.*http.*\:\/\///'|sed 's/.[^:]*$//')
adminPort=$(echo $adminURL|sed 's/^.*://'|sed 's/.[^\/]*$//')
-echo ">>Verifying connectivity to the admin endpoint $adminIP:$adminPort..."
-verify_connectivity $adminIP $adminPort
+https_enabled=$(echo $adminURL | grep 'https')
+if [[ -n $https_enabled ]]; then
+ echo ">>Verifying SSL connectivity to the admin endpoint $adminIP:$adminPort..."
+ verify_SSL_connectivity $adminIP $adminPort
+else
+ echo ">>Verifying connectivity to the admin endpoint $adminIP:$adminPort..."
+ verify_connectivity $adminIP $adminPort
+fi
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
echo "ERROR: Cannot talk to the admin endpoint $adminIP:$adminPort ."