aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/datafilecollector-testharness/simulator-group/setup-ftp-files-for-image.sh
diff options
context:
space:
mode:
authorBjornMagnussonXA <bjorn.magnusson@est.tech>2019-04-10 13:04:08 +0000
committerBjornMagnussonXA <bjorn.magnusson@est.tech>2019-04-10 13:04:08 +0000
commitf4e1836eab2cff83bc2542383ed7f97d98a7b68c (patch)
tree5c3efb2db7bddb5213fa60ba15dc1643a835c653 /test/mocks/datafilecollector-testharness/simulator-group/setup-ftp-files-for-image.sh
parentefbb5adf8bd45c606565dd1fea1f71f930d3e5dc (diff)
Enhancements of simulators for DFC
New test cases for MR and DR simulators Added simulator monitor server for simulator supervision Update - Adapted simulators to changed naming of ftp files Update2 - Added some more test behaviour to simulators. Issue-ID: DCAEGEN2-1313 Change-Id: I90a346d44ab4e7c9f5a65f599b64f1907525dd51 Signed-off-by: BjornMagnussonXA <bjorn.magnusson@est.tech>
Diffstat (limited to 'test/mocks/datafilecollector-testharness/simulator-group/setup-ftp-files-for-image.sh')
-rwxr-xr-xtest/mocks/datafilecollector-testharness/simulator-group/setup-ftp-files-for-image.sh43
1 files changed, 31 insertions, 12 deletions
diff --git a/test/mocks/datafilecollector-testharness/simulator-group/setup-ftp-files-for-image.sh b/test/mocks/datafilecollector-testharness/simulator-group/setup-ftp-files-for-image.sh
index d8e57a3d8..6c2b4f29f 100755
--- a/test/mocks/datafilecollector-testharness/simulator-group/setup-ftp-files-for-image.sh
+++ b/test/mocks/datafilecollector-testharness/simulator-group/setup-ftp-files-for-image.sh
@@ -1,28 +1,47 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Script to create files for the FTP server to return upon request.
# The file names matches the files names in the events polled from the MR simulator.
# Intended for execution in the running ftp containers in the ftp-root dir.
-echo "Running ftp file creations"
-
NUM=200 #Default number of files
+PNFS=1 #Default number of PNFs
+FSIZE="ALL"
if [ $# -eq 1 ]; then
NUM=$1
+elif [ $# -eq 2 ]; then
+ NUM=$1
+ PNFS=$2
+elif [ $# -eq 3 ]; then
+ NUM=$1
+ PNFS=$2
+ FSIZE=$3
+ if [ $3 != "1KB" ] && [ $3 != "1MB" ] && [ $3 != "5MB" ] && [ $3 != "50MB" ] && [ $3 != "ALL" ]; then
+ echo "File size shall be 1KB|1MB|5MB|50MB|ALL"
+ exit
+ fi
+else
+ echo "Wrong args, usage: setup-ftp-files-for-image.sh [ <num-files> [ <num-PNFs> [ 1KB|1MB|5MB|50MB ] ] ]"
+ exit
fi
+echo "Running ftp file creations. " $PNFS " PNFs and " $NUM " files for each PNF with file size(s) "$FSIZE
+
+truncate -s 1KB 1KB.tar.gz
truncate -s 1MB 1MB.tar.gz
truncate -s 5MB 5MB.tar.gz
truncate -s 50MB 50MB.tar.gz
-
-i=0
-while [ $i -lt $NUM ]; do #Problem with for loop and var substituion in curly bracket....so used good old style loop
- ln -s 1MB.tar.gz 1MB_$i.tar.gz
- ln -s 5MB.tar.gz 5MB_$i.tar.gz
- let i=i+1
+p=0
+while [ $p -lt $PNFS ]; do
+ i=0
+ while [ $i -lt $NUM ]; do #Problem with for loop and var substituion in curly bracket....so used good old style loop
+ if [ $FSIZE = "ALL" ] || [ $FSIZE = "1KB" ]; then ln -s 1KB.tar.gz 'A20000626.2315+0200-2330+0200_PNF'$p'-'$i'-1KB.tar.gz'; fi
+ if [ $FSIZE = "ALL" ] || [ $FSIZE = "1MB" ]; then ln -s 1MB.tar.gz 'A20000626.2315+0200-2330+0200_PNF'$p'-'$i'-1MB.tar.gz'; fi
+ if [ $FSIZE = "ALL" ] || [ $FSIZE = "5MB" ]; then ln -s 5MB.tar.gz 'A20000626.2315+0200-2330+0200_PNF'$p'-'$i'-5MB.tar.gz'; fi
+ if [ $FSIZE = "ALL" ] || [ $FSIZE = "50MB" ]; then ln -s 50MB.tar.gz 'A20000626.2315+0200-2330+0200_PNF'$p'-'$i'-50MB.tar.gz'; fi
+ let i=i+1
+ done
+ let p=p+1
done
-
-
-ln -s 50MB.tar.gz 50MB_0.tar.gz #Large file, only for single file test