echo ""
-echo "Building images for the simulators if needed, MR, DR, DR Redir and FTPS simulators"
+echo "Building images for the simulators if needed, MR, DR, DR Redir, FTPES and HTTP simulators"
curdir=$PWD
cd $SIM_GROUP
cd ../dr-sim
docker build -t drsim_common:latest . &> /dev/null
cd ../mr-sim
docker build -t mrsim:latest . &> /dev/null
-cd ../ftps-sftp-server
-docker build -t ftps_vsftpd:latest -f Dockerfile-ftps . &> /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
cd $curdir
echo ""
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 "FTPS: " $(docker images | grep ftps_vsftpd)
+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 ""
#Configure DR sim with correct address for DR redirect simulator
if [ $START_ARG == "manual-app" ]; then
export SFTP_SIMS=$SFTP_SIMS_LOCALHOST
- export FTPS_SIMS=$FTPS_SIMS_LOCALHOST
+ export FTPES_SIMS=$FTPES_SIMS_LOCALHOST
+ export HTTP_SIMS=$HTTP_SIMS_LOCALHOST
export DR_REDIR_SIM="localhost"
fi
#else
# export SFTP_SIMS=$SFTP_SIMS_CONTAINER
-# export FTPS_SIMS=$FTPS_SIMS_CONTAINER
+# export FTPES_SIMS=$FTPES_SIMS_CONTAINER
# export DR_REDIR_SIM="drsim_redir"
#fi
}
__start_dfc_image() {
-
+ set -x
if [ $# != 2 ]; then
__print_err "need tow args, <dfc-instance-name> 0.."$$DFC_MAX_IDX
exit 1
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 -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 HOSTNAME=$appname --name $appname $DFC_IMAGE > /dev/null
-
+ 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
for i in {1..10}; do
- if [ $(docker inspect --format '{{ .State.Running }}' $appname) ]
- then
- echo " Image: $(docker inspect --format '{{ .Config.Image }}' ${appname})"
- echo "DFC container ${appname} running"
- dfc_started=true
- break
- else
- sleep $i
- fi
+ if [ $(docker inspect --format '{{ .State.Running }}' $appname) ]
+ then
+ echo " Image: $(docker inspect --format '{{ .Config.Image }}' ${appname})"
+ echo "DFC container ${appname} running"
+ dfc_started=true
+ break
+ else
+ sleep $i
+ fi
done
if ! [ $dfc_started ]; then
echo "DFC container ${appname} could not be started"
fi
done
- if ! [ $dfc_hb ]; then
+ if [ "$dfc_hb" = "false" ]; then
echo "DFC ${appname} did not respond to heartbeat"
+ exit 1
fi
}
echo "DR_REDIR_FEEDS= "$DR_REDIR_FEEDS
echo "NUM_FTPFILES= "$NUM_FTPFILES
+ echo "NUM_HTTPFILES= "$NUM_HTTPFILES
echo "NUM_PNFS= "$NUM_PNFS
echo "FILE_SIZE= "$FILE_SIZE
echo "FTP_TYPE= "$FTP_TYPE
+ echo "HTTP_TYPE= "$HTTP_TYPE
echo "FTP_FILE_PREFIXES= "$FTP_FILE_PREFIXES
+ echo "HTTP_FILE_PREFIXES= "$HTTP_FILE_PREFIXES
echo "NUM_FTP_SERVERS= "$NUM_FTP_SERVERS
+ echo "NUM_HTTP_SERVERS= "$NUM_HTTP_SERVERS
echo "SFTP_SIMS= "$SFTP_SIMS
- echo "FTPS_SIMS= "$FTPS_SIMS
+ echo "FTPES_SIMS= "$FTPES_SIMS
+ echo "HTTP_SIMS= "$HTTP_SIMS
echo ""
}
fi
}
-# Configure consul with dfc config, args <app|dmaap> <dfc-instance-id> <json-file-path>
+# Configure consul with dfc config, args <dfc-instance-id> <json-file-path>
# Not intended to be called directly by test scripts.
__consul_config() {
- if [ $# != 3 ]; then
- __print_err "need three args, <app|dmaap> <dfc-instance-id> <json-file-path>"
+ if [ $# != 2 ]; then
+ __print_err "need two args, <dfc-instance-id> <json-file-path>"
exit 1
fi
- if [ $2 -lt 0 ] || [ $2 -gt $DFC_MAX_IDX ]; then
+ if [ $1 -lt 0 ] || [ $1 -gt $DFC_MAX_IDX ]; then
__print_err "dfc-instance-id should be 0.."$DFC_MAX_IDX
exit 1
fi
- if ! [ -f $3 ]; then
- __print_err "json file does not extis: "$3
+ if ! [ -f $2 ]; then
+ __print_err "json file does not extis: "$2
exit 1
fi
- if [ $1 == "app" ]; then
- appname=$DFC_APP_BASE$2
- elif [ $1 == "dmaap" ]; then
- appname=$DFC_APP_BASE$2":dmaap"
- else
- __print_err "config type should be 'app' or 'dmaap'"
- exit 1
- fi
+ appname=$DFC_APP_BASE$1
- echo "Configuring consul for " $appname " from " $3
- curl -s http://127.0.0.1:${CONSUL_PORT}/v1/kv/${appname}?dc=dc1 -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data-binary "@"$3 >/dev/null
+ echo "Configuring consul for " $appname " from " $2
+ curl -s http://127.0.0.1:${CONSUL_PORT}/v1/kv/${appname}?dc=dc1 -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data-binary "@"$2 >/dev/null
}
# Configure consul with dfc app config, args <dfc-instance-id> <json-file-path>
if [ $START_ARG == "manual-app" ]; then
echo "Replacing 'mrsim' with 'localhost' in json app config for consul"
sed 's/mrsim/localhost/g' $2 > .tmp_app.json
- __consul_config app $1 .tmp_app.json
- else
- __consul_config app $1 $2
- fi
-}
-
-# Configure consul with dfc dmaap config, args <dfc-instance-id> <json-file-path>
-consul_config_dmaap() {
- if [ $START_ARG == "manual-app" ]; then
echo "Replacing 'drsim' with 'localhost' in json dmaap config for consul"
- sed 's/drsim/localhost/g' $2 > .tmp_dmaap.json
- __consul_config dmaap $1 .tmp_dmaap.json
+ sed 's/drsim/localhost/g' .tmp_app.json > .app.json
+ __consul_config $1 .app.json
else
- __consul_config dmaap $1 $2
+ __consul_config $1 $2
fi
}
__docker_start $appname
}
-# Stop and remove the FTPS container, arg: <ftps-instance-id>
-kill_ftps() {
+# Stop and remove the FTPES container, arg: <ftpes-instance-id>
+kill_ftpes() {
if [ $# != 1 ]; then
- __print_err "need one arg, <ftpS-instance-id>"
+ __print_err "need one arg, <ftpes-instance-id>"
exit 1
fi
__print_err "arg should be 0.."$FTP_MAX_IDX
exit 1
fi
- appname=$FTPS_BASE$1
+ appname=$FTPES_BASE$1
- echo "Killing FTPS, instance id: "$1
+ echo "Killing FTPES, instance id: "$1
__docker_stop $appname
__docker_rm $appname
}
-# Stop FTPS container, arg: <ftps-instance-id>
-stop_ftps() {
+# Stop FTPES container, arg: <ftpes-instance-id>
+stop_ftpes() {
if [ $# != 1 ]; then
- __print_err "need one arg, <ftps-instance-id>"
+ __print_err "need one arg, <ftpes-instance-id>"
exit 1
fi
__print_err "arg should be 0.."$FTP_MAX_IDX
exit 1
fi
- appname=$FTPS_BASE$1
+ appname=$FTPES_BASE$1
- echo "Stopping FTPS, instance id: "$1
+ echo "Stopping FTPES, instance id: "$1
__docker_stop $appname
}
-# Starts a stopped FTPS container, arg: <ftps-instance-id>
-start_ftps() {
+# Starts a stopped FTPES container, arg: <ftpes-instance-id>
+start_ftpes() {
if [ $# != 1 ]; then
- __print_err "need one arg, <ftps-instance-id>"
+ __print_err "need one arg, <ftpes-instance-id>"
exit 1
fi
__print_err "arg should be 0.."$FTP_MAX_IDX
exit 1
fi
- appname=$FTPS_BASE$1
+ appname=$FTPES_BASE$1
- echo "Starting FTPS, instance id: "$1
+ echo "Starting FTPES, instance id: "$1
+
+ __docker_start $appname
+}
+
+# Stop and remove the HTTP container, arg: <http-instance-id>
+kill_http() {
+
+ if [ $# != 1 ]; then
+ __print_err "need one arg, <http-instance-id>"
+ exit 1
+ fi
+
+ if [ $1 -lt 0 ] || [ $1 -gt $HTTP_MAX_IDX ]; then
+ __print_err "arg should be 0.."$HTTP_MAX_IDX
+ exit 1
+ fi
+ appname=$HTTP_BASE$1
+
+ echo "Killing HTTP, instance id: "$1
+
+ __docker_stop $appname
+ __docker_rm $appname
+}
+
+# Stop HTTP container, arg: <http-instance-id>
+stop_http() {
+
+ if [ $# != 1 ]; then
+ __print_err "need one arg, <http-instance-id>"
+ exit 1
+ fi
+
+ if [ $1 -lt 0 ] || [ $1 -gt $HTTP_MAX_IDX ]; then
+ __print_err "arg should be 0.."$HTTP_MAX_IDX
+ exit 1
+ fi
+ appname=$HTTP_BASE$1
+
+ echo "Stopping HTTP, instance id: "$1
+
+ __docker_stop $appname
+}
+
+# Starts a stopped HTTP container, arg: <http-instance-id>
+start_http() {
+
+ if [ $# != 1 ]; then
+ __print_err "need one arg, <http-instance-id>"
+ exit 1
+ fi
+
+ if [ $1 -lt 0 ] || [ $1 -gt $HTTP_MAX_IDX ]; then
+ __print_err "arg should be 0.."$HTTP_MAX_IDX
+ exit 1
+ fi
+ appname=$HTTP_BASE$1
+
+ echo "Starting HTTP, instance id: "$1
__docker_start $appname
}
for (( i=0; i<=$FTP_MAX_IDX; i++ )); do
appname=$SFTP_BASE$i
docker logs $appname > $TESTLOGS/$ATC/${1}_${appname}.log 2>&1
- appname=$FTPS_BASE$i
+ appname=$FTPES_BASE$i
+ docker logs $appname > $TESTLOGS/$ATC/${1}_${appname}.log 2>&1
+ done
+
+ for (( i=0; i<=$HTTP_MAX_IDX; i++ )); do
+ appname=$HTTP_BASE$i
docker logs $appname > $TESTLOGS/$ATC/${1}_${appname}.log 2>&1
done