aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/datafilecollector-testharness/simulator-group/simulators-start.sh
blob: cc5ce32ec950e7b0112cd00aad7d64437157f17e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash


# Starts all simulators with the test settings
# Intended for CSIT test. For manual start, use the docker-compose-setup.sh

docker-compose -f docker-compose-template.yml config > docker-compose.yml

docker-compose up -d

DR_SIM="$(docker ps -q --filter='name=dfc_dr-sim')"
DR_RD_SIM="$(docker ps -q --filter='name=dfc_dr-redir-sim')"
MR_SIM="$(docker ps -q --filter='name=dfc_mr-sim')"
SFTP_SIM="$(docker ps -q --filter='name=dfc_sftp-server')"
FTPS_SIM="$(docker ps -q --filter='name=dfc_ftpes-server-vsftpd')"

#Wait for initialization of docker containers for all simulators
for i in {1..10}; do
if [ $(docker inspect --format '{{ .State.Running }}' $DR_SIM) ] && \
[ $(docker inspect --format '{{ .State.Running }}' $DR_RD_SIM) ] && \
[ $(docker inspect --format '{{ .State.Running }}' $MR_SIM) ] && \
[ $(docker inspect --format '{{ .State.Running }}' $SFTP_SIM) ] && \
[ $(docker inspect --format '{{ .State.Running }}' $FTPS_SIM) ]
 then
   echo "All simulators Running"
   break
 else
   echo sleep $i
   sleep $i
 fi 
done

#Populate the ftp server with files
if [ -z "$NUM_FTPFILES" ]
 then
 NUM_FTPFILES=200
fi
if [ -z "$NUM_PNFS" ]
 then
 NUM_PNFS=1
fi
if [ -z "$FILE_SIZE" ]
 then
 FILE_SIZE="ALL"
fi
if [ -z "$FTP_TYPE" ]
 then
 FTP_TYPE="ALL"
fi

if [ $FTP_TYPE = "ALL" ] || [ $FTP_TYPE = "SFTP" ]; then
	echo "Creating files for SFTP server, may take time...."
	docker cp setup-ftp-files-for-image.sh $SFTP_SIM:/tmp/
	docker exec -w /home/onap/ $SFTP_SIM /tmp/setup-ftp-files-for-image.sh $NUM_FTPFILES $NUM_PNFS $FILE_SIZE #>/dev/null 2>&1
fi
if [ $FTP_TYPE = "ALL" ] || [ $FTP_TYPE = "FTPS" ]; then
	echo "Creating files for FTPS server, may take time...."
	docker cp setup-ftp-files-for-image.sh $FTPS_SIM:/tmp/setup-ftp-files-for-image.sh
	docker exec -w /srv $FTPS_SIM /tmp/setup-ftp-files-for-image.sh $NUM_FTPFILES $NUM_PNFS $FILE_SIZE #>/dev/null 2>&1
fi
echo "Done: All simulators started and configured"