aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/datafilecollector-testharness/common
diff options
context:
space:
mode:
Diffstat (limited to 'test/mocks/datafilecollector-testharness/common')
-rw-r--r--test/mocks/datafilecollector-testharness/common/README.md12
-rw-r--r--test/mocks/datafilecollector-testharness/common/test_env.sh27
-rwxr-xr-xtest/mocks/datafilecollector-testharness/common/testcase_common.sh71
3 files changed, 75 insertions, 35 deletions
diff --git a/test/mocks/datafilecollector-testharness/common/README.md b/test/mocks/datafilecollector-testharness/common/README.md
index dc57e09df..736ed4819 100644
--- a/test/mocks/datafilecollector-testharness/common/README.md
+++ b/test/mocks/datafilecollector-testharness/common/README.md
@@ -63,14 +63,14 @@ Stop a FTPES container with the supplied instance id (0-5).
**start_ftpes \<ftpes-instance-id>**:
Start a previously stopped FTPES container with the supplied instance id (0-5).
-**kill_http \<http-instance-id>**:
-Stop and remove a HTTP container with the supplied instance id (0-5).
+**kill_http_https \<http-instance-id>**:
+Stop and remove a HTTP/HTTPS container with the supplied instance id (0-5).
-**stop_http \<http-instance-id>**:
-Stop a HTTP container with the supplied instance id (0-5).
+**stop_http_https \<http-instance-id>**:
+Stop a HTTP/HTTPS container with the supplied instance id (0-5).
-**start_http \<http-instance-id>**:
-Start a previously stopped HTTP container with the supplied instance id (0-5).
+**start_http_https \<http-instance-id>**:
+Start a previously stopped HTTP/HTTPS container with the supplied instance id (0-5).
**mr_print \<variable-name>**:
Print a variable value from the MR simulator.
diff --git a/test/mocks/datafilecollector-testharness/common/test_env.sh b/test/mocks/datafilecollector-testharness/common/test_env.sh
index a5ea8a17e..d565ea7ed 100644
--- a/test/mocks/datafilecollector-testharness/common/test_env.sh
+++ b/test/mocks/datafilecollector-testharness/common/test_env.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
+#
# This env variable is only needed if the auto test scripts tests are executed in a different folder than 'auto-test' in the integration repo
# Change '<local-path>' to your path to the integration repo. In addition to the auto-test, the 'common' dir is needed if not executed in the
@@ -36,11 +45,11 @@ DFC_MAX_NUM=5 #Max number of dfc containers to run in p
DFC_MAX_IDX=$(($DFC_MAX_NUM - 1)) #Max index of the dfc containers
SFTP_BASE="dfc_sftp-server" #Base name of the dfc_sftp-server containers. Instance 0 will be named dfc_sftp-server0, instance 1 will named dfc_sftp-server1 etc
FTPES_BASE="dfc_ftpes-server-vsftpd" #Base name of the dfc_ftpes-server-vsftpd containers. Instance 0 will be named dfc_ftpes-server-vsftpd0, instance 1 will named dfc_ftpes-server-vsftpd1 etc
-HTTP_BASE="dfc_http-server" #Base name of the dfc_http-server containers. Instance 0 will be named dfc_http-server0, instance 1 will named dfc_http-server1 etc
+HTTP_HTTPS_BASE="dfc_http-https-server" #Base name of the dfc_http-https-server containers. Instance 0 will be named dfc_http-https-server0, instance 1 will named dfc_http-https-server1 etc
FTP_MAX_NUM=5 #Max number of sftp and ftpes containers to run in paralell in auto test
-HTTP_MAX_NUM=5 #Max number of http containers to run in paralell in auto test
+HTTP_MAX_NUM=5 #Max number of http/https containers to run in paralell in auto test
FTP_MAX_IDX=$(($FTP_MAX_NUM - 1)) #Max index of sftp and ftpes containers
-HTTP_MAX_IDX=$(($HTTP_MAX_NUM - 1)) #Max index of http containers
+HTTP_MAX_IDX=$(($HTTP_MAX_NUM - 1)) #Max index of http/https containers
#List of sftp server name and port number, used by MR sim to produce file urls. Theses server names and ports are used when running dfc and the simulators in a private docker network
SFTP_SIMS_CONTAINER="sftp-server0:22,sftp-server1:22,sftp-server2:22,sftp-server3:22,sftp-server4:22"
@@ -48,8 +57,10 @@ SFTP_SIMS_CONTAINER="sftp-server0:22,sftp-server1:22,sftp-server2:22,sftp-server
#List of sftp server name and port number, used by MR sim to produce file urls. Theses server names and ports are used when running dfc and the simulators in a private docker network
FTPES_SIMS_CONTAINER="ftpes-server-vsftpd0:21,ftpes-server-vsftpd1:21,ftpes-server-vsftpd2:21,ftpes-server-vsftpd3:21,ftpes-server-vsftpd4:21"
-#List of http server name and port number, used by MR sim to produce file urls. Theses server names and ports are used when running dfc and the simulators in a private docker network
-HTTP_SIMS_CONTAINER="http-server0:80,http-server1:80,http-server2:80,http-server3:80,http-server4:80"
+#List of http/https/https with no authorization server name and port number, used by MR sim to produce file urls. Theses server names and ports are used when running dfc and the simulators in a private docker network
+HTTP_SIMS_CONTAINER="http-https-server0:80,http-https-server1:80,http-https-server2:80,http-https-server3:80,http-https-server4:80"
+HTTPS_SIMS_CONTAINER="http-https-server0:443,http-https-server1:443,http-https-server2:443,http-https-server3:443,http-https-server4:443"
+HTTPS_SIMS_NO_AUTH_CONTAINER="http-https-server0:8080,http-https-server1:8080,http-https-server2:8080,http-https-server3:8080,http-https-server4:8080"
#List of sftp server name and port number, used by MR sim to produce file urls. Theses server names and ports are used when running dfc as stand along app and the simulators in a private docker network
SFTP_SIMS_LOCALHOST="localhost:1022,localhost:1023,localhost:1024,localhost:1025,localhost:1026"
@@ -57,12 +68,16 @@ SFTP_SIMS_LOCALHOST="localhost:1022,localhost:1023,localhost:1024,localhost:1025
#List of ftpes server name and port number, used by MR sim to produce file urls. Theses server names and ports are used when running dfc as stand along app and the simulators in a private docker network
FTPES_SIMS_LOCALHOST="localhost:1032,localhost:1033,localhost:1034,localhost:1035,localhost:1036"
-#List of http server name and port number, used by MR sim to produce file urls. Theses server names and ports are used when running dfc as stand along app and the simulators in a private docker network
+#List of http/https/https with no authorization server name and port number, used by MR sim to produce file urls. Theses server names and ports are used when running dfc as stand along app and the simulators in a private docker network
HTTP_SIMS_LOCALHOST="localhost:81,localhost:82,localhost:83,localhost:84,localhost:85"
+HTTPS_SIMS_LOCALHOST="localhost:444,localhost:445,localhost:446,localhost:447,localhost:448"
+HTTPS_SIMS_NO_AUTH_LOCALHOST="localhost:8081,localhost:8082,localhost:8083,localhost:8084,localhost:8085"
export SFTP_SIMS=$SFTP_SIMS_CONTAINER #This env will be set to SFTP_SIMS_LOCALHOST if auto test is executed with 'manual-app'
export FTPES_SIMS=$FTPES_SIMS_CONTAINER #This env will be set to FTPES_SIMS_LOCALHOST if auto test is executed with 'manual-app'
export HTTP_SIMS=$HTTP_SIMS_CONTAINER #This env will be set to HTTP_SIMS_LOCALHOST if auto test is executed with 'manual-app'
+export HTTPS_SIMS=$HTTPS_SIMS_CONTAINER #This env will be set to HTTPS_SIMS_LOCALHOST if auto test is executed with 'manual-app'
+export HTTPS_SIMS_NO_AUTH=$HTTPS_SIMS_NO_AUTH_CONTAINER #This env will be set to HTTPS_SIMS_NO_AUTH_LOCALHOST if auto test is executed with 'manual-app'
#Host name of the DR redirect simulator
export DR_REDIR_SIM="drsim_redir" #This env will be set to 'localhost' if auto test is executed with arg 'manual-app'
diff --git a/test/mocks/datafilecollector-testharness/common/testcase_common.sh b/test/mocks/datafilecollector-testharness/common/testcase_common.sh
index 9f156a901..345752b47 100755
--- a/test/mocks/datafilecollector-testharness/common/testcase_common.sh
+++ b/test/mocks/datafilecollector-testharness/common/testcase_common.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
+#
. ../common/test_env.sh
@@ -161,20 +170,20 @@ docker build -t mrsim:latest . &> /dev/null
cd ../ftpes-sftp-server
docker build -t ftpes_vsftpd:latest -f Dockerfile-ftpes . &> /dev/null
cd ../http-https-server
-docker build -t http_httpd:latest -f Dockerfile-http . &> /dev/null
+docker build -t http_https_httpd:latest -f Dockerfile-http-https . &> /dev/null
cd $curdir
echo ""
echo "Local registry images for simulators:"
-echo "MR simulator " $(docker images | grep mrsim)
-echo "DR simulator: " $(docker images | grep drsim_common)
-echo "DR redir simulator: " $(docker images | grep drsim_common)
-echo "SFTP: " $(docker images | grep atmoz/sftp)
-echo "FTPES: " $(docker images | grep ftpes_vsftpd)
-echo "HTTP: " $(docker images | grep http_httpd)
-echo "Consul: " $(docker images | grep consul)
-echo "CBS: " $(docker images | grep platform.configbinding.app)
+echo "MR simulator " $(docker images | grep mrsim)
+echo "DR simulator: " $(docker images | grep drsim_common)
+echo "DR redir simulator: " $(docker images | grep drsim_common)
+echo "SFTP: " $(docker images | grep atmoz/sftp)
+echo "FTPES: " $(docker images | grep ftpes_vsftpd)
+echo "HTTP/HTTPS/HTTPS no auth: " $(docker images | grep http_https_httpd)
+echo "Consul: " $(docker images | grep consul)
+echo "CBS: " $(docker images | grep platform.configbinding.app)
echo ""
#Configure MR sim to use correct host:port for running dfc as an app or as a container
@@ -183,6 +192,8 @@ if [ $START_ARG == "manual-app" ]; then
export SFTP_SIMS=$SFTP_SIMS_LOCALHOST
export FTPES_SIMS=$FTPES_SIMS_LOCALHOST
export HTTP_SIMS=$HTTP_SIMS_LOCALHOST
+ export HTTPS_SIMS=$HTTPS_SIMS_LOCALHOST
+ export HTTPS_SIMS_NO_AUTH=HTTPS_SIMS_NO_AUTH_LOCALHOST
export DR_REDIR_SIM="localhost"
fi
#else
@@ -208,7 +219,7 @@ __do_curl() {
echo "<no-response-from-server>"
return 1
else
- if [ $http_code -lt 200 ] && [ $http_code -gt 299]; then
+ if [ $http_code -lt 200 ] && [ $http_code -gt 299 ]; then
echo "<not found, resp:${http_code}>"
return 1
fi
@@ -374,12 +385,22 @@ __start_dfc_image() {
localport=$(($DFC_PORT + $2))
localport_secure=$(($DFC_PORT_SECURE + $2))
- echo "Creating docker network $DOCKER_SIM_NWNAME, if needed"
+ echo "Creating docker network "$DOCKER_SIM_NWNAME", if needed"
- docker network ls| grep $DOCKER_SIM_NWNAME > /dev/null || docker network create $DOCKER_SIM_NWNAME
+ docker network ls| grep "$DOCKER_SIM_NWNAME" > /dev/null || docker network create "$DOCKER_SIM_NWNAME"
echo "Starting DFC: " $appname " with ports mapped to " $localport " and " $localport_secure " in docker network "$DOCKER_SIM_NWNAME
- docker run -d --volume $(pwd)/../simulator-group/tls/:/opt/app/datafile/etc/cert/ -p $localport":8100" -p $localport_secure":8433" --network=$DOCKER_SIM_NWNAME -e CONSUL_HOST=$CONSUL_HOST -e CONSUL_PORT=$CONSUL_PORT -e CONFIG_BINDING_SERVICE=$CONFIG_BINDING_SERVICE -e CONFIG_BINDING_SERVICE_SERVICE_PORT=$CONFIG_BINDING_SERVICE_SERVICE_PORT -e HOSTNAME=$appname --name $appname $DFC_IMAGE
+ if [ "$HTTP_TYPE" = "HTTPS" ]
+ then
+ mkdir "$SIM_GROUP"/tls/external
+ cp "$SIM_GROUP"/../certservice/generated-certs/dfc-p12/* "$SIM_GROUP"/tls/external/
+ docker run \
+ --name oom-certservice-post-processor \
+ --env-file "$SIM_GROUP"/../certservice/merger/merge-certs.env \
+ --mount type=bind,src="$SIM_GROUP"/tls,dst=/opt/app/datafile/etc/cert \
+ nexus3.onap.org:10001/onap/org.onap.oom.platform.cert-service.oom-certservice-post-processor:latest
+ fi
+ docker run -d --volume $(pwd)/../simulator-group/tls/:/opt/app/datafile/etc/cert/ -p $localport":8100" -p $localport_secure":8433" --network=$DOCKER_SIM_NWNAME -e CONSUL_HOST=$CONSUL_HOST -e CONSUL_PORT=$CONSUL_PORT -e CONFIG_BINDING_SERVICE=$CONFIG_BINDING_SERVICE -e CONFIG_BINDING_SERVICE_SERVICE_PORT=$CONFIG_BINDING_SERVICE_SERVICE_PORT -e HOSTNAME=$appname --name $appname $DFC_IMAGE
sleep 3
set +x
dfc_started=false
@@ -517,6 +538,8 @@ log_sim_settings() {
echo "SFTP_SIMS= "$SFTP_SIMS
echo "FTPES_SIMS= "$FTPES_SIMS
echo "HTTP_SIMS= "$HTTP_SIMS
+ echo "HTTPS_SIMS= "$HTTPS_SIMS
+ echo "HTTPS_SIMS_NO_AUTH= "$HTTPS_SIMS_NO_AUTH
echo ""
}
@@ -526,6 +549,7 @@ clean_containers() {
docker stop $(docker ps -q --filter name=dfc_) &> /dev/null
echo "Removing all containers, dfc app and simulators with name prefix 'dfc_'"
docker rm $(docker ps -a -q --filter name=dfc_) &> /dev/null
+ docker rm -f $(docker ps -a -q --filter name=oom-certservice-post-processor) &> /dev/null
echo "Removing unused docker networks with substring 'dfc' in network name"
docker network rm $(docker network ls -q --filter name=dfc)
echo ""
@@ -537,6 +561,7 @@ start_simulators() {
echo "Starting all simulators"
curdir=$PWD
cd $SIM_GROUP
+ export SIM_GROUP=$SIM_GROUP
$SIM_GROUP/simulators-start.sh
cd $curdir
echo ""
@@ -767,7 +792,7 @@ start_ftpes() {
}
# Stop and remove the HTTP container, arg: <http-instance-id>
-kill_http() {
+kill_http_https() {
if [ $# != 1 ]; then
__print_err "need one arg, <http-instance-id>"
@@ -778,16 +803,16 @@ kill_http() {
__print_err "arg should be 0.."$HTTP_MAX_IDX
exit 1
fi
- appname=$HTTP_BASE$1
+ appname=$HTTP_HTTPS_BASE$1
- echo "Killing HTTP, instance id: "$1
+ echo "Killing HTTP/HTTPS, instance id: "$1
__docker_stop $appname
__docker_rm $appname
}
# Stop HTTP container, arg: <http-instance-id>
-stop_http() {
+stop_http_https() {
if [ $# != 1 ]; then
__print_err "need one arg, <http-instance-id>"
@@ -798,15 +823,15 @@ stop_http() {
__print_err "arg should be 0.."$HTTP_MAX_IDX
exit 1
fi
- appname=$HTTP_BASE$1
+ appname=$HTTP_HTTPS_BASE$1
- echo "Stopping HTTP, instance id: "$1
+ echo "Stopping HTTP/HTTPS, instance id: "$1
__docker_stop $appname
}
# Starts a stopped HTTP container, arg: <http-instance-id>
-start_http() {
+start_http_https() {
if [ $# != 1 ]; then
__print_err "need one arg, <http-instance-id>"
@@ -817,9 +842,9 @@ start_http() {
__print_err "arg should be 0.."$HTTP_MAX_IDX
exit 1
fi
- appname=$HTTP_BASE$1
+ appname=$HTTP_HTTPS_BASE$1
- echo "Starting HTTP, instance id: "$1
+ echo "Starting HTTP/HTTPS, instance id: "$1
__docker_start $appname
}
@@ -1200,7 +1225,7 @@ store_logs() {
done
for (( i=0; i<=$HTTP_MAX_IDX; i++ )); do
- appname=$HTTP_BASE$i
+ appname=$HTTP_HTTPS_BASE$i
docker logs $appname > $TESTLOGS/$ATC/${1}_${appname}.log 2>&1
done