X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=functest%2Fci%2Fcheck_os.sh;h=7b66f3da6b2b1e652d82d6cfef358ef898af4f0d;hb=16a0d65806ca7bdb166e3d8535185a82b45ae7ff;hp=2c5c021c7671988000e956dbec42e6d6405d1984;hpb=4e0ebc01f1fa41d1b15f7d135c3769a051b1667c;p=functest.git diff --git a/functest/ci/check_os.sh b/functest/ci/check_os.sh index 2c5c021c7..7b66f3da6 100755 --- a/functest/ci/check_os.sh +++ b/functest/ci/check_os.sh @@ -6,12 +6,18 @@ # jose.lausuch@ericsson.com # +if [[ ${OS_INSECURE,,} == "true" ]]; then + options='--insecure' +else + options='' +fi + declare -A service_cmd_array -service_cmd_array['nova']='openstack server list' -service_cmd_array['neutron']='openstack network list' -service_cmd_array['keystone']='openstack endpoint list' -service_cmd_array['cinder']='openstack volume list' -service_cmd_array['glance']='openstack image list' +service_cmd_array['nova']="openstack $options server list" +service_cmd_array['neutron']="openstack $options network list" +service_cmd_array['keystone']="openstack $options endpoint list" +service_cmd_array['cinder']="openstack $options volume list" +service_cmd_array['glance']="openstack $options image list" MANDATORY_SERVICES='nova neutron keystone glance' OPTIONAL_SERVICES='cinder' @@ -26,6 +32,11 @@ verify_connectivity() { return 1 } +verify_SSL_connectivity() { + openssl s_client -connect $1:$2 &>/dev/null + return $? +} + check_service() { local service cmd service=$1 @@ -36,7 +47,7 @@ check_service() { required=$2 fi echo ">>Checking ${service} service..." - if ! openstack service list | grep -i ${service} > /dev/null; then + if ! openstack $options service list | grep -i ${service} > /dev/null; then if [ "$required" == 'false' ]; then echo "WARN: Optional Service ${service} is not enabled!" return @@ -62,11 +73,17 @@ fi echo "Checking OpenStack endpoints:" -publicURL=$(openstack catalog show identity |awk '/public/ {print $4}') -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 +publicURL=$(openstack $options catalog show identity |awk '/public/ {print $4}') +publicIP=$(echo $publicURL|sed 's/^.*http.*\:\/\///'|sed 's/.[^:]*$//') +publicPort=$(echo $publicURL|grep -Po '(?<=:)\d+') +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 ." @@ -75,24 +92,6 @@ if [ $RETVAL -ne 0 ]; then fi echo " ...OK" -adminURL=$(openstack catalog show identity |awk '/admin/ {print $4}') -if [ -z ${adminURL} ]; then - echo "ERROR: Cannot determine the admin URL." - openstack catalog show identity - exit 1 -fi -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 -RETVAL=$? -if [ $RETVAL -ne 0 ]; then - echo "ERROR: Cannot talk to the admin endpoint $adminIP:$adminPort ." - echo "$adminURL" - exit 1 -fi -echo " ...OK" - echo "Checking Required OpenStack services:" for service in $MANDATORY_SERVICES; do @@ -106,11 +105,11 @@ for service in $OPTIONAL_SERVICES; do done echo "Checking External network..." -networks=($(neutron net-list -F id | tail -n +4 | head -n -1 | awk '{print $2}')) +networks=($(neutron $options net-list -F id | tail -n +4 | head -n -1 | awk '{print $2}')) is_external=False for net in "${networks[@]}" do - is_external=$(neutron net-show $net|grep "router:external"|awk '{print $4}') + is_external=$(neutron $options net-show $net|grep "router:external"|awk '{print $4}') if [ $is_external == "True" ]; then echo "External network found: $net" break