aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtest/mocks/mass-pnf-sim/ROP_file_creator.sh69
-rwxr-xr-xtest/mocks/mass-pnf-sim/mass-pnf-sim.py2
-rwxr-xr-xtest/mocks/mass-pnf-sim/pnf-sim-lightweight/ROP_file_creator.sh57
-rw-r--r--test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml5
-rwxr-xr-xtest/mocks/mass-pnf-sim/pnf-sim-lightweight/files/prepare-ROP-files.sh10
-rwxr-xr-xtest/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh8
-rw-r--r--test/mocks/mass-pnf-sim/pnf-sim-lightweight/templates/file_template.xml.gz (renamed from test/mocks/mass-pnf-sim/templates/file_template.xml.gz)bin188545 -> 188545 bytes
7 files changed, 63 insertions, 88 deletions
diff --git a/test/mocks/mass-pnf-sim/ROP_file_creator.sh b/test/mocks/mass-pnf-sim/ROP_file_creator.sh
deleted file mode 100755
index 1451658ed..000000000
--- a/test/mocks/mass-pnf-sim/ROP_file_creator.sh
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/bash
-MAIN_DIRECTORY=./files/onap
-FILE_TEMPLATE=./templates/file_template.xml.gz
-UPDATE_MINS=15
-NUM_NODES=20
-NUM_FILES=10
-
-rm -rf $MAIN_DIRECTORY/*
-for ((m=1;m<=$NUM_NODES;m++))
-do
- DIRECTORY=$MAIN_DIRECTORY/"node"$m
- mkdir -p "$DIRECTORY"
-done
-
-for ((n=0;n<$NUM_FILES;n++))
-do
- if [[ "$OSTYPE" == "linux-gnu" ]]; then # Linux OS
- DATE=$(date -d $(($UPDATE_MINS*$n))" minutes ago" +"%Y%m%d")
- TIME_START=$(date -d $(($UPDATE_MINS*($n+1)-1))" minutes ago" +"%H%M")
- TIME_END=$(date -d $(($UPDATE_MINS*$n))" minutes ago" +"%H%M")
- elif [[ "$OSTYPE" == "darwin"* ]]; then # Mac OS
- DATE=$(date -v "-"$(($UPDATE_MINS*$n))"M" +"%Y%m%d")
- TIME_START=$(date -v "-"$(($UPDATE_MINS*($n+1)-1))"M" +"%H%M")
- TIME_END=$(date -v "-"$(($UPDATE_MINS*$n))"M" +"%H%M")
- else
- echo "ERROR: OS not supported"
- exit 1
- fi
-
- FILE_NAME_TIMESTAMP="A"$DATE"."$TIME_START"-"$TIME_END
- TIMESTAMP_ARRAY[$n]=$FILE_NAME_TIMESTAMP
-
- for ((m=1;m<=$NUM_NODES;m++))
- do
- DIRECTORY=$MAIN_DIRECTORY/"node"$m
- FILE_NAME=$FILE_NAME_TIMESTAMP"_node"$m".xml.gz"
- cp $FILE_TEMPLATE $DIRECTORY/$FILE_NAME
- done
-done
-
-while true
-do
- sleep $(($UPDATE_MINS*60))
- OLD_TIMESTAMP=${TIMESTAMP_ARRAY[$NUM_FILES-1]}
- unset TIMESTAMP_ARRAY[$NUM_FILES-1]
-
- DATE=$(date +"%Y%m%d")
- TIME_END=$(date +"%H%M")
- if [[ "$OSTYPE" == "linux-gnu" ]]; then # Linux OS
- TIME_START=$(date -d $(($UPDATE_MINS-1))" minutes ago" +"%H%M")
- elif [[ "$OSTYPE" == "darwin"* ]]; then # Mac OS
- TIME_START=$(date -v "-"$(($UPDATE_MINS-1))"M" +"%H%M")
- else
- echo "ERROR: OS not supported"
- exit 1
- fi
-
- NEW_TIMESTAMP="A"$DATE"."$TIME_START"-"$TIME_END
- TIMESTAMP_ARRAY=("$NEW_TIMESTAMP" "${TIMESTAMP_ARRAY[@]}")
-
- for ((m=1;m<=$NUM_NODES;m++))
- do
- DIRECTORY=$MAIN_DIRECTORY/"node"$m
- OLD_FILE_NAME=$OLD_TIMESTAMP"_node"$m".xml.gz"
- NEW_FILE_NAME=$NEW_TIMESTAMP"_node"$m".xml.gz"
- mv $DIRECTORY/$OLD_FILE_NAME $DIRECTORY/$NEW_FILE_NAME
- echo "Renamed OLD file: "$OLD_FILE_NAME" to NEW file: "$NEW_FILE_NAME
- done
-done
diff --git a/test/mocks/mass-pnf-sim/mass-pnf-sim.py b/test/mocks/mass-pnf-sim/mass-pnf-sim.py
index 9ec8c00af..ba0598671 100755
--- a/test/mocks/mass-pnf-sim/mass-pnf-sim.py
+++ b/test/mocks/mass-pnf-sim/mass-pnf-sim.py
@@ -135,7 +135,7 @@ if args.stop:
completed = subprocess.run(
'cd ' +
foldername +
- "; ./simulator.sh stop",
+ "; ./simulator.sh stop " + str(i),
shell=True)
print('Stopping:', completed.stdout)
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/ROP_file_creator.sh b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/ROP_file_creator.sh
new file mode 100755
index 000000000..39d8498f1
--- /dev/null
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/ROP_file_creator.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+MAIN_DIRECTORY=${PWD##*/}
+FILE_DIRECTORY=./files/onap
+FILE_TEMPLATE=./templates/file_template.xml.gz
+UPDATE_MINS=15
+NUM_FILES=96
+
+rm -rf $FILE_DIRECTORY
+mkdir -p "$FILE_DIRECTORY"
+
+for ((n=0;n<$NUM_FILES;n++))
+do
+ if [[ "$OSTYPE" == "linux-gnu" ]]; then # Linux OS
+ DATE=$(date -d $(($UPDATE_MINS*$n))" minutes ago" +"%Y%m%d")
+ TIME_START=$(date -d $(($UPDATE_MINS*($n+1)-1))" minutes ago" +"%H%M%z")
+ TIME_END=$(date -d $(($UPDATE_MINS*$n))" minutes ago" +"%H%M%z")
+ elif [[ "$OSTYPE" == "darwin"* ]]; then # Mac OS
+ DATE=$(date -v "-"$(($UPDATE_MINS*$n))"M" +"%Y%m%d")
+ TIME_START=$(date -v "-"$(($UPDATE_MINS*($n+1)-1))"M" +"%H%M%z")
+ TIME_END=$(date -v "-"$(($UPDATE_MINS*$n))"M" +"%H%M%z")
+ else
+ echo "ERROR: OS not supported"
+ exit 1
+ fi
+
+ FILE_NAME_TIMESTAMP="A"$DATE"."$TIME_START"-"$TIME_END
+ FILE_NAME=$FILE_NAME_TIMESTAMP"_"$HOSTNAME"-"$MAIN_DIRECTORY".xml.gz"
+ cp $FILE_TEMPLATE $FILE_DIRECTORY/$FILE_NAME
+
+ TIMESTAMP_ARRAY[$n]=$FILE_NAME_TIMESTAMP
+done
+
+while true
+do
+ sleep $(($UPDATE_MINS*60))
+ OLD_TIMESTAMP=${TIMESTAMP_ARRAY[$NUM_FILES-1]}
+ unset TIMESTAMP_ARRAY[$NUM_FILES-1]
+
+ DATE=$(date +"%Y%m%d")
+ TIME_END=$(date +"%H%M%z")
+ if [[ "$OSTYPE" == "linux-gnu" ]]; then # Linux OS
+ TIME_START=$(date -d $(($UPDATE_MINS-1))" minutes ago" +"%H%M%z")
+ elif [[ "$OSTYPE" == "darwin"* ]]; then # Mac OS
+ TIME_START=$(date -v "-"$(($UPDATE_MINS-1))"M" +"%H%M%z")
+ else
+ echo "ERROR: OS not supported"
+ exit 1
+ fi
+
+ NEW_TIMESTAMP="A"$DATE"."$TIME_START"-"$TIME_END
+ OLD_FILE_NAME=$OLD_TIMESTAMP"_"$HOSTNAME"-"$MAIN_DIRECTORY".xml.gz"
+ NEW_FILE_NAME=$NEW_TIMESTAMP"_"$HOSTNAME"-"$MAIN_DIRECTORY".xml.gz"
+ mv $FILE_DIRECTORY/$OLD_FILE_NAME $FILE_DIRECTORY/$NEW_FILE_NAME
+ #echo "Renamed OLD file: "$OLD_FILE_NAME" to NEW file: "$NEW_FILE_NAME # uncomment for debugging
+
+ TIMESTAMP_ARRAY=("$NEW_TIMESTAMP" "${TIMESTAMP_ARRAY[@]}")
+done
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml
index 6500fbbfa..f53226867 100644
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml
@@ -51,10 +51,7 @@ services:
- ./tls/ftp.key:/etc/ssl/private/ftp.key:ro
- ./tls/dfc.crt:/etc/ssl/private/dfc.crt:ro
- ./config/vsftpd_ssl.conf:/etc/vsftpd_ssl.conf:ro
- - ./files/onap/0.5MB.tar.gz:/srv/0.5MB.tar.gz:ro
- - ./files/onap/1MB.tar.gz:/srv/1MB.tar.gz:ro
- - ./files/onap/5MB.tar.gz:/srv/5MB.tar.gz:ro
- - ./files/onap/10MB.tar.gz:/srv/10MB.tar.gz:ro
+ - ./files/onap/:/srv/
restart: on-failure
command: vsftpd /etc/vsftpd_ssl.conf
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/files/prepare-ROP-files.sh b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/files/prepare-ROP-files.sh
deleted file mode 100755
index 4c7c5060e..000000000
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/files/prepare-ROP-files.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-echo "Creating ROP files"
-set -x
-mkdir -p onap
-
-dd if=/dev/urandom of=./onap/0.5MB.tar.gz bs=1k count=512
-dd if=/dev/urandom of=./onap/1MB.tar.gz bs=1M count=1
-dd if=/dev/urandom of=./onap/5MB.tar.gz bs=1M count=5
-dd if=/dev/urandom of=./onap/10MB.tar.gz bs=1M count=10 \ No newline at end of file
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh
index 4fb725f66..bed64b0b7 100755
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh
@@ -27,7 +27,7 @@ function main(){
"start")
start $COMPOSE_FILE_NAME;;
"stop")
- stop;;
+ stop $2;;
"run-simulator")
run_simulator;;
"trigger-simulator")
@@ -74,9 +74,7 @@ function compose(){
docker-compose -f docker-compose-temporary.yml config > docker-compose.yml
rm docker-compose-temporary.yml
- cd files
- ./prepare-ROP-files.sh
- cd -
+ ./ROP_file_creator.sh $I &
set_vsftpd_file_owner
@@ -126,6 +124,8 @@ function running_containers(){
function stop(){
get_pnfsim_ip
+ kill $(ps -a | grep "[.]/ROP_file_creator.sh $1" | awk '{print $1}')
+
if [[ $(running_containers) ]]; then
docker-compose -f $RUNNING_COMPOSE_CONFIG down
docker-compose -f $RUNNING_COMPOSE_CONFIG rm
diff --git a/test/mocks/mass-pnf-sim/templates/file_template.xml.gz b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/templates/file_template.xml.gz
index 0e6624a09..0e6624a09 100644
--- a/test/mocks/mass-pnf-sim/templates/file_template.xml.gz
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/templates/file_template.xml.gz
Binary files differ