diff options
author | Krzysztof Gajewski <krzysztof.gajewski@nokia.com> | 2021-02-01 17:46:51 +0100 |
---|---|---|
committer | Krzysztof Gajewski <krzysztof.gajewski@nokia.com> | 2021-02-11 18:12:27 +0100 |
commit | c746882a07952a0cd460e6fa8bcac246289db6b9 (patch) | |
tree | f1398e07e0916d19860f52e48191597d0ff5e9b0 /test/mocks/datafilecollector-testharness/simulator-group/simulators-start.sh | |
parent | ae43fa6fee1bb5b8cb68e21f50b477c084ef21eb (diff) |
Add HTTPS to DFC tests
- testing environment preparation for DFC with HTTPS client
(expand existing http server)
- add suitable TCs for CSIT tests
Issue-ID: DCAEGEN2-2528
Signed-off-by: Krzysztof Gajewski <krzysztof.gajewski@nokia.com>
Change-Id: Ifa8abb827e269d76144fc74c65031dd387fe5fe7
Diffstat (limited to 'test/mocks/datafilecollector-testharness/simulator-group/simulators-start.sh')
-rwxr-xr-x | test/mocks/datafilecollector-testharness/simulator-group/simulators-start.sh | 75 |
1 files changed, 58 insertions, 17 deletions
diff --git a/test/mocks/datafilecollector-testharness/simulator-group/simulators-start.sh b/test/mocks/datafilecollector-testharness/simulator-group/simulators-start.sh index 895949caa..f39f052a0 100755 --- a/test/mocks/datafilecollector-testharness/simulator-group/simulators-start.sh +++ b/test/mocks/datafilecollector-testharness/simulator-group/simulators-start.sh @@ -1,4 +1,13 @@ #!/bin/bash +# +# Modifications copyright (C) 2021 Nokia. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# set -x server_check() { for i in {1..10}; do @@ -12,16 +21,28 @@ server_check() { echo "Simulator " $1 " on localhost:$2$3 - no response" } -basic_auth_server_check() { +http_https_basic_server_check() { for i in {1..10}; do - res=$(curl -s -o /dev/null -w "%{http_code}" http://$BASIC_AUTH_LOGIN:$BASIC_AUTH_PASSWORD@localhost:$2$3) + res=$(curl $4 -s -o /dev/null -w "%{http_code}" "$3"://"$BASIC_AUTH_LOGIN":"$BASIC_AUTH_PASSWORD"@localhost:"$2") if [ $res -gt 199 ] && [ $res -lt 300 ]; then - echo "Simulator " $1 " on localhost:$2$3 responded ok" + echo "Simulator " "$1" " on localhost: ""$2"" responded ok" return fi sleep 1 done - echo "Simulator " $1 " on localhost:$2$3 - no response" + echo "Simulator " "$1" " on localhost:""$2"" - no response" +} + +http_https_server_check() { + for i in {1..10}; do + res=$(curl $4 -s -o /dev/null -w "%{http_code}" $3://localhost:$2) + if [ $res -gt 199 ] && [ $res -lt 300 ]; then + echo "Simulator " $1 " on localhost:$2 responded ok" + return + fi + sleep 1 + done + echo "Simulator " $1 " on localhost:$2 - no response" } server_check_https() { @@ -38,7 +59,7 @@ server_check_https() { ftpes_server_check() { for i in {1..10}; do - res=$(curl --silent --max-time 3 localhost:$2 2>&1 | grep vsFTPd) + res=$(curl --silent --max-time 3 ftp://localhost:$2 --ftp-ssl -v -k 2>&1 | grep vsFTPd) if ! [ -z "$res" ]; then echo "Simulator " $1 " on localhost:$2 responded ok" return @@ -50,7 +71,7 @@ ftpes_server_check() { sftp_server_check() { for i in {1..10}; do - res=$(curl --silent --max-time 3 localhost:$2 2>&1 | grep OpenSSH) + res=$(curl --silent --max-time 3 sftp://localhost:$2 -v -k 2>&1 | grep Connected) if ! [ -z "$res" ]; then echo "Simulator " $1 " on localhost:"$2" responded ok" return @@ -67,6 +88,11 @@ DOCKER_SIM_NWNAME="dfcnet" echo "Creating docker network $DOCKER_SIM_NWNAME, if needed" docker network ls| grep $DOCKER_SIM_NWNAME > /dev/null || docker network create $DOCKER_SIM_NWNAME +if [ -z "$SIM_GROUP" ] + then + export SIM_GROUP="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +fi + if [ -z "$NUM_FTP_SERVERS" ] then export NUM_FTP_SERVERS=1 @@ -101,11 +127,11 @@ FTPES_SIM[1]="$(docker ps -q --filter='name=dfc_ftpes-server-vsftpd1')" FTPES_SIM[2]="$(docker ps -q --filter='name=dfc_ftpes-server-vsftpd2')" FTPES_SIM[3]="$(docker ps -q --filter='name=dfc_ftpes-server-vsftpd3')" FTPES_SIM[4]="$(docker ps -q --filter='name=dfc_ftpes-server-vsftpd4')" -HTTP_SIM[0]="$(docker ps -q --filter='name=dfc_http-server0')" -HTTP_SIM[1]="$(docker ps -q --filter='name=dfc_http-server1')" -HTTP_SIM[2]="$(docker ps -q --filter='name=dfc_http-server2')" -HTTP_SIM[3]="$(docker ps -q --filter='name=dfc_http-server3')" -HTTP_SIM[4]="$(docker ps -q --filter='name=dfc_http-server4')" +HTTP_SIM[0]="$(docker ps -q --filter='name=dfc_http-https-server0')" +HTTP_SIM[1]="$(docker ps -q --filter='name=dfc_http-https-server1')" +HTTP_SIM[2]="$(docker ps -q --filter='name=dfc_http-https-server2')" +HTTP_SIM[3]="$(docker ps -q --filter='name=dfc_http-https-server3')" +HTTP_SIM[4]="$(docker ps -q --filter='name=dfc_http-https-server4')" CBS_SIM="$(docker ps -q --filter='name=dfc_cbs')" CONSUL_SIM="$(docker ps -q --filter='name=dfc_consul')" @@ -168,11 +194,26 @@ sftp_server_check "SFTP server 1" 1023 sftp_server_check "SFTP server 2" 1024 sftp_server_check "SFTP server 3" 1025 sftp_server_check "SFTP server 4" 1026 -basic_auth_server_check "HTTP server 0" 81 -basic_auth_server_check "HTTP server 1" 82 -basic_auth_server_check "HTTP server 2" 83 -basic_auth_server_check "HTTP server 3" 84 -basic_auth_server_check "HTTP server 4" 85 +http_https_basic_server_check "HTTP basic auth server 0" 81 http +http_https_basic_server_check "HTTP basic auth server 1" 82 http +http_https_basic_server_check "HTTP basic auth server 2" 83 http +http_https_basic_server_check "HTTP basic auth server 3" 84 http +http_https_basic_server_check "HTTP basic auth server 4" 85 http +http_https_basic_server_check "HTTPS basic auth server 0" 444 https -k +http_https_basic_server_check "HTTPS basic auth server 1" 445 https -k +http_https_basic_server_check "HTTPS basic auth server 2" 446 https -k +http_https_basic_server_check "HTTPS basic auth server 3" 447 https -k +http_https_basic_server_check "HTTPS basic auth server 4" 448 https -k +http_https_server_check "HTTPS client certificate authentication server 0" 444 https "-k --cert ../certservice/generated-certs/apache-pem/keystore.pem --key ../certservice/generated-certs/apache-pem/key.pem" +http_https_server_check "HTTPS client certificate authentication server 1" 445 https "-k --cert ../certservice/generated-certs/apache-pem/keystore.pem --key ../certservice/generated-certs/apache-pem/key.pem" +http_https_server_check "HTTPS client certificate authentication server 2" 446 https "-k --cert ../certservice/generated-certs/apache-pem/keystore.pem --key ../certservice/generated-certs/apache-pem/key.pem" +http_https_server_check "HTTPS client certificate authentication server 3" 447 https "-k --cert ../certservice/generated-certs/apache-pem/keystore.pem --key ../certservice/generated-certs/apache-pem/key.pem" +http_https_server_check "HTTPS client certificate authentication server 4" 448 https "-k --cert ../certservice/generated-certs/apache-pem/keystore.pem --key ../certservice/generated-certs/apache-pem/key.pem" +http_https_server_check "HTTPS no auth server 0" 8081 https -k +http_https_server_check "HTTPS no auth server 1" 8082 https -k +http_https_server_check "HTTPS no auth server 2" 8083 https -k +http_https_server_check "HTTPS no auth server 3" 8084 https -k +http_https_server_check "HTTPS no auth server 4" 8085 https -k echo "" @@ -235,7 +276,7 @@ if [ -z "$HTTP_FILE_PREFIXES" ] HTTP_FILE_PREFIXES="A" fi -if [ $HTTP_TYPE = "ALL" ] || [ $HTTP_TYPE = "HTTP" ]; then +if [ $HTTP_TYPE = "ALL" ] || [ $HTTP_TYPE = "HTTP" ] || [ $HTTP_TYPE = "HTTPS" ]; then echo "Creating files for HTTP server, may take time...." p=0 while [ $p -lt $NUM_HTTP_SERVERS ]; do |