From 7b4d5778c13818b871a5fe5aaf249480981ac15d Mon Sep 17 00:00:00 2001 From: Remigiusz Janeczek Date: Mon, 27 Jul 2020 13:42:09 +0200 Subject: Adjust DFC test files to use FTPES instead of FTPS DFC doesn't support FTPS protocol. FTPS is treated exactly like FTPES and soon DFC won't accept file locations starting with "ftps://". Fix mr-sim.py lint issues Issue-ID: DCAEGEN2-2367 Signed-off-by: Remigiusz Janeczek Change-Id: Idab56aab3bdb6734a04bfc9c9212f2ea800d0d74 --- .../auto-test/25h_backlog_1MB_FTPS.sh | 6 +- .../auto-test/FTC11.sh | 6 +- .../auto-test/FTC13.sh | 6 +- .../auto-test/FTC15.sh | 6 +- .../auto-test/FTC21.sh | 6 +- .../auto-test/FTC33.sh | 4 +- .../auto-test/FTC4.sh | 6 +- .../auto-test/FTC5.sh | 6 +- .../auto-test/FTC6.sh | 6 +- .../auto-test/FTC61.sh | 10 +- .../auto-test/MaxFiles1MB_FTPS_24h.sh | 6 +- .../auto-test/Stability1MB_FTPS_72h.sh | 6 +- .../datafilecollector-testharness/common/README.md | 12 +- .../common/test_env.sh | 14 +- .../common/testcase_common.sh | 46 +- .../ftpes-sftp-server/.gitignore | 1 + .../ftpes-sftp-server/Dockerfile-ftpes | 5 + .../ftpes-sftp-server/README.md | 37 + .../configuration/vsftpd_ssl.conf | 57 + .../ftpes-sftp-server/docker-compose.yml | 35 + .../ftpes-sftp-server/prepare.sh | 50 + .../ftpes-sftp-server/test_cases.yml | 16 + .../ftpes-sftp-server/tls/README.md | 4 + .../ftpes-sftp-server/tls/dfc.crt | 19 + .../ftpes-sftp-server/tls/ftp.crt | 19 + .../ftpes-sftp-server/tls/ftp.key | 27 + .../ftps-sftp-server/.gitignore | 1 - .../ftps-sftp-server/Dockerfile-ftps | 5 - .../ftps-sftp-server/README.md | 37 - .../ftps-sftp-server/configuration/vsftpd_ssl.conf | 57 - .../ftps-sftp-server/docker-compose.yml | 35 - .../ftps-sftp-server/prepare.sh | 50 - .../ftps-sftp-server/test_cases.yml | 16 - .../ftps-sftp-server/tls/README.md | 4 - .../ftps-sftp-server/tls/dfc.crt | 19 - .../ftps-sftp-server/tls/ftp.crt | 19 - .../ftps-sftp-server/tls/ftp.key | 27 - .../datafilecollector-testharness/mr-sim/README.md | 12 +- .../datafilecollector-testharness/mr-sim/mr-sim.py | 1362 ++++++++++---------- .../simulator-group/README.md | 16 +- .../simulator-group/docker-compose-setup.sh | 4 +- .../simulator-group/docker-compose-template.yml | 12 +- .../simulator-group/prepare-images.sh | 6 +- .../simulator-group/simulators-start.sh | 42 +- 44 files changed, 1086 insertions(+), 1054 deletions(-) create mode 100644 test/mocks/datafilecollector-testharness/ftpes-sftp-server/.gitignore create mode 100644 test/mocks/datafilecollector-testharness/ftpes-sftp-server/Dockerfile-ftpes create mode 100644 test/mocks/datafilecollector-testharness/ftpes-sftp-server/README.md create mode 100644 test/mocks/datafilecollector-testharness/ftpes-sftp-server/configuration/vsftpd_ssl.conf create mode 100644 test/mocks/datafilecollector-testharness/ftpes-sftp-server/docker-compose.yml create mode 100755 test/mocks/datafilecollector-testharness/ftpes-sftp-server/prepare.sh create mode 100644 test/mocks/datafilecollector-testharness/ftpes-sftp-server/test_cases.yml create mode 100644 test/mocks/datafilecollector-testharness/ftpes-sftp-server/tls/README.md create mode 100644 test/mocks/datafilecollector-testharness/ftpes-sftp-server/tls/dfc.crt create mode 100644 test/mocks/datafilecollector-testharness/ftpes-sftp-server/tls/ftp.crt create mode 100644 test/mocks/datafilecollector-testharness/ftpes-sftp-server/tls/ftp.key delete mode 100644 test/mocks/datafilecollector-testharness/ftps-sftp-server/.gitignore delete mode 100644 test/mocks/datafilecollector-testharness/ftps-sftp-server/Dockerfile-ftps delete mode 100644 test/mocks/datafilecollector-testharness/ftps-sftp-server/README.md delete mode 100644 test/mocks/datafilecollector-testharness/ftps-sftp-server/configuration/vsftpd_ssl.conf delete mode 100644 test/mocks/datafilecollector-testharness/ftps-sftp-server/docker-compose.yml delete mode 100755 test/mocks/datafilecollector-testharness/ftps-sftp-server/prepare.sh delete mode 100644 test/mocks/datafilecollector-testharness/ftps-sftp-server/test_cases.yml delete mode 100644 test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/README.md delete mode 100644 test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/dfc.crt delete mode 100644 test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/ftp.crt delete mode 100644 test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/ftp.key (limited to 'test/mocks') diff --git a/test/mocks/datafilecollector-testharness/auto-test/25h_backlog_1MB_FTPS.sh b/test/mocks/datafilecollector-testharness/auto-test/25h_backlog_1MB_FTPS.sh index dd1daea54..01b65ce71 100755 --- a/test/mocks/datafilecollector-testharness/auto-test/25h_backlog_1MB_FTPS.sh +++ b/test/mocks/datafilecollector-testharness/auto-test/25h_backlog_1MB_FTPS.sh @@ -1,6 +1,6 @@ #!/bin/bash -TC_ONELINE_DESCR="Simulating a 25h backlog of events for 700 PNF with decreasing number of missing files, then continues with 15 min events from all PNFs using FTPS." +TC_ONELINE_DESCR="Simulating a 25h backlog of events for 700 PNF with decreasing number of missing files, then continues with 15 min events from all PNFs using FTPES." . ../common/testcase_common.sh $1 $2 @@ -21,7 +21,7 @@ export DR_REDIR_FEEDS="2:A" export NUM_FTPFILES="300" export NUM_PNFS="700" export FILE_SIZE="1MB" -export FTP_TYPE="FTPS" +export FTP_TYPE="FTPES" export FTP_FILE_PREFIXES="A" export NUM_FTP_SERVERS=5 @@ -61,4 +61,4 @@ check_dfc_logs store_logs END -print_result \ No newline at end of file +print_result diff --git a/test/mocks/datafilecollector-testharness/auto-test/FTC11.sh b/test/mocks/datafilecollector-testharness/auto-test/FTC11.sh index 18db3b288..3ecfc7729 100755 --- a/test/mocks/datafilecollector-testharness/auto-test/FTC11.sh +++ b/test/mocks/datafilecollector-testharness/auto-test/FTC11.sh @@ -1,6 +1,6 @@ #!/bin/bash -TC_ONELINE_DESCR="3500 1MB files from 700 PNFs in 3500 events in 5 polls using FTPS, from poll to publish." +TC_ONELINE_DESCR="3500 1MB files from 700 PNFs in 3500 events in 5 polls using FTPES, from poll to publish." . ../common/testcase_common.sh $1 $2 @@ -21,7 +21,7 @@ export DR_REDIR_FEEDS="2:A" export NUM_FTPFILES="5" export NUM_PNFS="700" export FILE_SIZE="1MB" -export FTP_TYPE="FTPS" +export FTP_TYPE="FTPES" export FTP_FILE_PREFIXES="A" export NUM_FTP_SERVERS=5 @@ -75,4 +75,4 @@ check_dfc_logs store_logs END -print_result \ No newline at end of file +print_result diff --git a/test/mocks/datafilecollector-testharness/auto-test/FTC13.sh b/test/mocks/datafilecollector-testharness/auto-test/FTC13.sh index 93e348e12..79c1003d3 100755 --- a/test/mocks/datafilecollector-testharness/auto-test/FTC13.sh +++ b/test/mocks/datafilecollector-testharness/auto-test/FTC13.sh @@ -1,6 +1,6 @@ #!/bin/bash -TC_ONELINE_DESCR="3500 1KB files from 700 PNFs in 3500 events in 5 polls using FTPS, from poll to publish." +TC_ONELINE_DESCR="3500 1KB files from 700 PNFs in 3500 events in 5 polls using FTPES, from poll to publish." . ../common/testcase_common.sh $1 $2 @@ -21,7 +21,7 @@ export DR_REDIR_FEEDS="2:A" export NUM_FTPFILES="5" export NUM_PNFS="700" export FILE_SIZE="1KB" -export FTP_TYPE="FTPS" +export FTP_TYPE="FTPES" export FTP_FILE_PREFIXES="A" export NUM_FTP_SERVERS=5 @@ -75,4 +75,4 @@ check_dfc_logs store_logs END -print_result \ No newline at end of file +print_result diff --git a/test/mocks/datafilecollector-testharness/auto-test/FTC15.sh b/test/mocks/datafilecollector-testharness/auto-test/FTC15.sh index 44238c31d..96c4844db 100755 --- a/test/mocks/datafilecollector-testharness/auto-test/FTC15.sh +++ b/test/mocks/datafilecollector-testharness/auto-test/FTC15.sh @@ -1,6 +1,6 @@ #!/bin/bash -TC_ONELINE_DESCR="3500 50MB files from 700 PNFs in 3500 events in 5 polls using FTPS, from poll to publish." +TC_ONELINE_DESCR="3500 50MB files from 700 PNFs in 3500 events in 5 polls using FTPES, from poll to publish." . ../common/testcase_common.sh $1 $2 @@ -21,7 +21,7 @@ export DR_REDIR_FEEDS="2:A" export NUM_FTPFILES="5" export NUM_PNFS="700" export FILE_SIZE="50MB" -export FTP_TYPE="FTPS" +export FTP_TYPE="FTPES" export FTP_FILE_PREFIXES="A" export NUM_FTP_SERVERS=5 @@ -75,4 +75,4 @@ check_dfc_logs store_logs END -print_result \ No newline at end of file +print_result diff --git a/test/mocks/datafilecollector-testharness/auto-test/FTC21.sh b/test/mocks/datafilecollector-testharness/auto-test/FTC21.sh index df9b57d3f..b136eece9 100755 --- a/test/mocks/datafilecollector-testharness/auto-test/FTC21.sh +++ b/test/mocks/datafilecollector-testharness/auto-test/FTC21.sh @@ -1,6 +1,6 @@ #!/bin/bash -TC_ONELINE_DESCR="72800 1MB files from 700 PNFs in 3500 events in 100 polls (35 PNFs each 100 files per poll) using FTPS, from poll to publish." +TC_ONELINE_DESCR="72800 1MB files from 700 PNFs in 3500 events in 100 polls (35 PNFs each 100 files per poll) using FTPES, from poll to publish." . ../common/testcase_common.sh $1 $2 @@ -21,7 +21,7 @@ export DR_REDIR_FEEDS="2:A" export NUM_FTPFILES="105" export NUM_PNFS="700" export FILE_SIZE="1MB" -export FTP_TYPE="FTPS" +export FTP_TYPE="FTPES" export FTP_FILE_PREFIXES="A" export NUM_FTP_SERVERS=5 @@ -75,4 +75,4 @@ check_dfc_logs store_logs END -print_result \ No newline at end of file +print_result diff --git a/test/mocks/datafilecollector-testharness/auto-test/FTC33.sh b/test/mocks/datafilecollector-testharness/auto-test/FTC33.sh index 338a20da0..0ad2a1252 100755 --- a/test/mocks/datafilecollector-testharness/auto-test/FTC33.sh +++ b/test/mocks/datafilecollector-testharness/auto-test/FTC33.sh @@ -1,6 +1,6 @@ #!/bin/bash -TC_ONELINE_DESCR="DFC file retention (files with SFTP and then same files over FTPS). 1MB, 5MB and 50MB using first SFTP and thenSFTP with restart of MR between each file." +TC_ONELINE_DESCR="DFC file retention (files with SFTP and then same files over FTPES). 1MB, 5MB and 50MB using first SFTP and thenSFTP with restart of MR between each file." . ../common/testcase_common.sh $1 $2 @@ -116,4 +116,4 @@ check_dfc_logs store_logs END -print_result \ No newline at end of file +print_result diff --git a/test/mocks/datafilecollector-testharness/auto-test/FTC4.sh b/test/mocks/datafilecollector-testharness/auto-test/FTC4.sh index 93dd69c0c..be614f2b9 100755 --- a/test/mocks/datafilecollector-testharness/auto-test/FTC4.sh +++ b/test/mocks/datafilecollector-testharness/auto-test/FTC4.sh @@ -1,6 +1,6 @@ #!/bin/bash -TC_ONELINE_DESCR="One 1MB file from one PNF in one event using FTPS, from poll to publish" +TC_ONELINE_DESCR="One 1MB file from one PNF in one event using FTPES, from poll to publish" . ../common/testcase_common.sh $1 $2 @@ -21,7 +21,7 @@ export DR_REDIR_FEEDS="1:A" export NUM_FTPFILES="10" export NUM_PNFS="1" export FILE_SIZE="1MB" -export FTP_TYPE="FTPS" +export FTP_TYPE="FTPES" export FTP_FILE_PREFIXES="A" export NUM_FTP_SERVERS=1 @@ -75,4 +75,4 @@ check_dfc_logs store_logs END -print_result \ No newline at end of file +print_result diff --git a/test/mocks/datafilecollector-testharness/auto-test/FTC5.sh b/test/mocks/datafilecollector-testharness/auto-test/FTC5.sh index 3de577eee..489cd1ee8 100755 --- a/test/mocks/datafilecollector-testharness/auto-test/FTC5.sh +++ b/test/mocks/datafilecollector-testharness/auto-test/FTC5.sh @@ -1,6 +1,6 @@ #!/bin/bash -TC_ONELINE_DESCR="One 5MB file from one PNF in one event using FTPS, from poll to publish" +TC_ONELINE_DESCR="One 5MB file from one PNF in one event using FTPES, from poll to publish" . ../common/testcase_common.sh $1 $2 @@ -21,7 +21,7 @@ export DR_REDIR_FEEDS="1:A" export NUM_FTPFILES="10" export NUM_PNFS="1" export FILE_SIZE="5MB" -export FTP_TYPE="FTPS" +export FTP_TYPE="FTPES" export FTP_FILE_PREFIXES="A" export NUM_FTP_SERVERS=1 @@ -75,4 +75,4 @@ check_dfc_logs store_logs END -print_result \ No newline at end of file +print_result diff --git a/test/mocks/datafilecollector-testharness/auto-test/FTC6.sh b/test/mocks/datafilecollector-testharness/auto-test/FTC6.sh index fd3977348..4349cb4fa 100755 --- a/test/mocks/datafilecollector-testharness/auto-test/FTC6.sh +++ b/test/mocks/datafilecollector-testharness/auto-test/FTC6.sh @@ -1,6 +1,6 @@ #!/bin/bash -TC_ONELINE_DESCR="One 50MB file from one PNF in one event using FTPS, from poll to publish" +TC_ONELINE_DESCR="One 50MB file from one PNF in one event using FTPES, from poll to publish" . ../common/testcase_common.sh $1 $2 @@ -21,7 +21,7 @@ export DR_REDIR_FEEDS="1:A" export NUM_FTPFILES="10" export NUM_PNFS="1" export FILE_SIZE="50MB" -export FTP_TYPE="FTPS" +export FTP_TYPE="FTPES" export FTP_FILE_PREFIXES="A" export NUM_FTP_SERVERS=1 @@ -75,4 +75,4 @@ check_dfc_logs store_logs END -print_result \ No newline at end of file +print_result diff --git a/test/mocks/datafilecollector-testharness/auto-test/FTC61.sh b/test/mocks/datafilecollector-testharness/auto-test/FTC61.sh index f16c442f2..c4458a8a7 100755 --- a/test/mocks/datafilecollector-testharness/auto-test/FTC61.sh +++ b/test/mocks/datafilecollector-testharness/auto-test/FTC61.sh @@ -1,6 +1,6 @@ #!/bin/bash -TC_ONELINE_DESCR="Kill FTPS sever for 10+ sec during download" +TC_ONELINE_DESCR="Kill FTPES sever for 10+ sec during download" . ../common/testcase_common.sh $1 $2 @@ -21,7 +21,7 @@ export DR_REDIR_FEEDS="2:A" export NUM_FTPFILES="2" export NUM_PNFS="700" export FILE_SIZE="1MB" -export FTP_TYPE="FTPS" +export FTP_TYPE="FTPES" export FTP_FILE_PREFIXES="A" export NUM_FTP_SERVERS=1 @@ -42,9 +42,9 @@ start_dfc 0 dr_greater ctr_published_files 100 200 -stop_ftps 0 +stop_ftpes 0 sleep_wait 30 -start_ftps 0 +start_ftpes 0 dr_equal ctr_published_files 1400 400 @@ -81,4 +81,4 @@ check_dfc_logs store_logs END -print_result \ No newline at end of file +print_result diff --git a/test/mocks/datafilecollector-testharness/auto-test/MaxFiles1MB_FTPS_24h.sh b/test/mocks/datafilecollector-testharness/auto-test/MaxFiles1MB_FTPS_24h.sh index 08d4d9ea2..ad2073b06 100755 --- a/test/mocks/datafilecollector-testharness/auto-test/MaxFiles1MB_FTPS_24h.sh +++ b/test/mocks/datafilecollector-testharness/auto-test/MaxFiles1MB_FTPS_24h.sh @@ -1,6 +1,6 @@ #!/bin/bash -TC_ONELINE_DESCR="Maximum number of 1MB FTPS files during 24h, 700 PNFs. 100 new files per event." +TC_ONELINE_DESCR="Maximum number of 1MB FTPES files during 24h, 700 PNFs. 100 new files per event." . ../common/testcase_common.sh $1 $2 @@ -21,7 +21,7 @@ export DR_REDIR_FEEDS="2:A" export NUM_FTPFILES="4000" export NUM_PNFS="700" export FILE_SIZE="1MB" -export FTP_TYPE="FTPS" +export FTP_TYPE="FTPES" export FTP_FILE_PREFIXES="A" export NUM_FTP_SERVERS=5 @@ -102,4 +102,4 @@ check_dfc_logs store_logs END -print_result \ No newline at end of file +print_result diff --git a/test/mocks/datafilecollector-testharness/auto-test/Stability1MB_FTPS_72h.sh b/test/mocks/datafilecollector-testharness/auto-test/Stability1MB_FTPS_72h.sh index 6e3368518..431985320 100755 --- a/test/mocks/datafilecollector-testharness/auto-test/Stability1MB_FTPS_72h.sh +++ b/test/mocks/datafilecollector-testharness/auto-test/Stability1MB_FTPS_72h.sh @@ -1,6 +1,6 @@ #!/bin/bash -TC_ONELINE_DESCR="Stabilty over 72hours, 700 PNFs over FTPS. All new files (100) in first event from PNF, then one new 1 new file per event." +TC_ONELINE_DESCR="Stabilty over 72hours, 700 PNFs over FTPES. All new files (100) in first event from PNF, then one new 1 new file per event." . ../common/testcase_common.sh $1 $2 @@ -21,7 +21,7 @@ export DR_REDIR_FEEDS="2:A" export NUM_FTPFILES="1000" export NUM_PNFS="700" export FILE_SIZE="1MB" -export FTP_TYPE="FTPS" +export FTP_TYPE="FTPES" export FTP_FILE_PREFIXES="A" export NUM_FTP_SERVERS=5 @@ -106,4 +106,4 @@ check_dfc_logs store_logs END -print_result \ No newline at end of file +print_result diff --git a/test/mocks/datafilecollector-testharness/common/README.md b/test/mocks/datafilecollector-testharness/common/README.md index 31f40ef10..f0e3eec79 100644 --- a/test/mocks/datafilecollector-testharness/common/README.md +++ b/test/mocks/datafilecollector-testharness/common/README.md @@ -52,14 +52,14 @@ Stop a SFTP container with the supplied instance id (0-5). **start_sftp **
Start a previously stopped SFTP container with the supplied instance id (0-5). -**kill_ftps **
-Stop and remove a FTPS container with the supplied instance id (0-5). +**kill_ftpes **
+Stop and remove a FTPES container with the supplied instance id (0-5). -**stop_ftps **
-Stop a FTPS container with the supplied instance id (0-5). +**stop_ftpes **
+Stop a FTPES container with the supplied instance id (0-5). -**start_ftps **
-Start a previously stopped FTPS container with the supplied instance id (0-5). +**start_ftpes **
+Start a previously stopped FTPES container with the supplied instance id (0-5). **mr_print **
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 1a97ffc73..63c0f2ecf 100644 --- a/test/mocks/datafilecollector-testharness/common/test_env.sh +++ b/test/mocks/datafilecollector-testharness/common/test_env.sh @@ -34,24 +34,24 @@ DFC_APP_BASE="dfc_app" #Base name of the dfc containers. Instanc DFC_MAX_NUM=5 #Max number of dfc containers to run in paralell in auto test 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 -FTPS_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 -FTP_MAX_NUM=5 #Max number of sftp and ftps containers to run in paralell in auto test -FTP_MAX_IDX=$(($FTP_MAX_NUM - 1)) #Max index of sftp and ftps containers +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 +FTP_MAX_NUM=5 #Max number of sftp and ftpes containers to run in paralell in auto test +FTP_MAX_IDX=$(($FTP_MAX_NUM - 1)) #Max index of sftp and ftpes 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" #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 -FTPS_SIMS_CONTAINER="ftpes-server-vsftpd0:21,ftpes-server-vsftpd1:21,ftpes-server-vsftpd2:21,ftpes-server-vsftpd3:21,ftpes-server-vsftpd4:21" +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 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" -#List of ftps 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 -FTPS_SIMS_LOCALHOST="localhost:1032,localhost:1033,localhost:1034,localhost:1035,localhost:1036" +#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" export SFTP_SIMS=$SFTP_SIMS_CONTAINER #This env will be set to SFTP_SIMS_LOCALHOST if auto test is executed with 'manual-app' -export FTPS_SIMS=$FTPS_SIMS_CONTAINER #This env will be set to FTPS_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' #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 a1e092157..d2072c141 100755 --- a/test/mocks/datafilecollector-testharness/common/testcase_common.sh +++ b/test/mocks/datafilecollector-testharness/common/testcase_common.sh @@ -151,15 +151,15 @@ fi 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 and FTPES 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 $curdir echo "" @@ -169,7 +169,7 @@ 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 "FTPS: " $(docker images | grep ftps_vsftpd) +echo "FTPES: " $(docker images | grep ftpes_vsftpd) echo "Consul: " $(docker images | grep consul) echo "CBS: " $(docker images | grep platform.configbinding.app) echo "" @@ -178,12 +178,12 @@ 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 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 @@ -507,7 +507,7 @@ log_sim_settings() { echo "FTP_FILE_PREFIXES= "$FTP_FILE_PREFIXES echo "NUM_FTP_SERVERS= "$NUM_FTP_SERVERS echo "SFTP_SIMS= "$SFTP_SIMS - echo "FTPS_SIMS= "$FTPS_SIMS + echo "FTPES_SIMS= "$FTPES_SIMS echo "" } @@ -699,11 +699,11 @@ start_sftp() { __docker_start $appname } -# Stop and remove the FTPS container, arg: -kill_ftps() { +# Stop and remove the FTPES container, arg: +kill_ftpes() { if [ $# != 1 ]; then - __print_err "need one arg, " + __print_err "need one arg, " exit 1 fi @@ -711,19 +711,19 @@ kill_ftps() { __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: -stop_ftps() { +# Stop FTPES container, arg: +stop_ftpes() { if [ $# != 1 ]; then - __print_err "need one arg, " + __print_err "need one arg, " exit 1 fi @@ -731,18 +731,18 @@ stop_ftps() { __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: -start_ftps() { +# Starts a stopped FTPES container, arg: +start_ftpes() { if [ $# != 1 ]; then - __print_err "need one arg, " + __print_err "need one arg, " exit 1 fi @@ -750,9 +750,9 @@ start_ftps() { __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 } @@ -1128,7 +1128,7 @@ store_logs() { 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 diff --git a/test/mocks/datafilecollector-testharness/ftpes-sftp-server/.gitignore b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/.gitignore new file mode 100644 index 000000000..bd6c5bed8 --- /dev/null +++ b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/.gitignore @@ -0,0 +1 @@ +files/onap/* diff --git a/test/mocks/datafilecollector-testharness/ftpes-sftp-server/Dockerfile-ftpes b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/Dockerfile-ftpes new file mode 100644 index 000000000..a0d6cfafc --- /dev/null +++ b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/Dockerfile-ftpes @@ -0,0 +1,5 @@ +FROM docker.io/panubo/vsftpd + +COPY configuration/vsftpd_ssl.conf /etc/vsftpd_ssl.conf +RUN chmod 644 /etc/vsftpd_ssl.conf +RUN chown root:root /etc/vsftpd_ssl.conf \ No newline at end of file diff --git a/test/mocks/datafilecollector-testharness/ftpes-sftp-server/README.md b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/README.md new file mode 100644 index 000000000..44d329e76 --- /dev/null +++ b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/README.md @@ -0,0 +1,37 @@ +# Deployment of certificates: (in case of update) + +This folder is prepared with a set of keys matching DfC for test purposes. + +Copy from datafile-app-server/config/keys to the ./tls/ the following files: + +- dfc.crt +- ftp.crt +- ftp.key + +# Docker preparations + +Source: + +`sudo usermod -aG docker $USER` + +then logout-login to activate it. + +# Prepare files for the simulator + +Run `prepare.sh` with an argument found in `test_cases.yml` (or add a new tc in that file) to create files (1MB, 5MB and 50MB files) and a large number of +symbolic links to these files to simulate PM files. The files names maches the files in +the events produced by the MR simulator. The dirs with the files will be mounted +by the ftp containers, defined in the docker-compse file, when started + +# Starting/stopping the FTPES/SFTP server(s) + +Start: `docker-compose up` + +Stop: Ctrl +C, then `docker-compose down` or `docker-compose down --remove-orphans` + +If you experience issues (or port collision), check the currently running other containers +by using 'docker ps' and stop them if necessary. + +# Cleaning docker structure + +Deep cleaning: `docker system prune` diff --git a/test/mocks/datafilecollector-testharness/ftpes-sftp-server/configuration/vsftpd_ssl.conf b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/configuration/vsftpd_ssl.conf new file mode 100644 index 000000000..0a24e38a8 --- /dev/null +++ b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/configuration/vsftpd_ssl.conf @@ -0,0 +1,57 @@ +# Server Config +anonymous_enable=NO +local_enable=YES +write_enable=YES +local_umask=022 +dirmessage_enable=YES + +# Security and User auth +chroot_local_user=YES +pam_service_name=vsftpd_virtual +virtual_use_local_privs=YES +chmod_enable=NO +user_config_dir=/etc/vsftpd/user_conf +user_sub_token=$USER +#local_root=/srv/$USER +local_root=/srv/ +userlist_enable=NO +allow_writeable_chroot=YES + +# Logging +log_ftp_protocol=YES +xferlog_enable=YES +xferlog_std_format=YES +#xferlog_file=/dev/stdout +syslog_enable=NO +dual_log_enable=YES + +# Remap all login users to this username +guest_enable=YES +guest_username=ftp +hide_ids=YES + +# Networking +connect_from_port_20=NO +listen=YES +tcp_wrappers=YES +#pasv_min_port=8001 +#pasv_max_port=8010 + +# SSL +ssl_enable=Yes +require_ssl_reuse=NO +force_local_data_ssl=YES +force_local_logins_ssl=YES +ssl_ciphers=HIGH +allow_anon_ssl=NO + +ssl_tlsv1=YES +ssl_sslv2=YES +ssl_sslv3=YES +rsa_cert_file=/etc/ssl/private/cert.pem +rsa_private_key_file=/etc/ssl/private/key.pem + +require_cert=YES +ssl_request_cert=YES +ca_certs_file=/etc/ssl/private/cacert.pem + diff --git a/test/mocks/datafilecollector-testharness/ftpes-sftp-server/docker-compose.yml b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/docker-compose.yml new file mode 100644 index 000000000..5bc91efa1 --- /dev/null +++ b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/docker-compose.yml @@ -0,0 +1,35 @@ +version: '3' + +services: + + sftp-server1: + container_name: sftp-server1 + image: atmoz/sftp:alpine + ports: + - "1022:22" + volumes: + - ./files/onap/sftp/:/home/onap/ + restart: on-failure + command: onap:pano:1001 + + ftpes-server-vsftpd: + container_name: ftpes-server-vsftpd + image: docker.io/panubo/vsftpd + ports: + - "21:21" + - "8001-8010:8001-8010" + environment: + FTP_USER: onap + FTP_PASSWORD: pano + PASV_ADDRESS: localhost + PASV_MIN_PORT: 8001 + PASV_MAX_PORT: 8010 + volumes: + - ./tls/ftp.crt:/etc/ssl/private/ftp.crt:ro + - ./tls/ftp.key:/etc/ssl/private/ftp.key:ro + - ./tls/dfc.crt:/etc/ssl/private/dfc.crt:ro + - ./configuration/vsftpd_ssl.conf:/etc/vsftpd_ssl.conf:ro + + - ./files/onap/ftpes/:/srv/ + restart: on-failure + command: vsftpd /etc/vsftpd_ssl.conf diff --git a/test/mocks/datafilecollector-testharness/ftpes-sftp-server/prepare.sh b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/prepare.sh new file mode 100755 index 000000000..086d43a49 --- /dev/null +++ b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/prepare.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# EXAMPLE: Run test case TC2 using the command "./prepare.sh TC2" +MAIN_DIRECTORY=./files/onap +TEST_FILE=./test_cases.yml +TEST=$1 +echo "Generating files for test case:" "$TEST" + +sf=$(sed -n '/'$TEST'/,$p' $TEST_FILE | grep -m 1 'size_files') +sf=${sf//*size_files: /} +sf_array=($sf) +echo "size_files=""$sf" + +nf=$(sed -n '/'$TEST'/,$p' $TEST_FILE | grep -m 1 'number_files') +nf=${nf//*number_files: /} +nf_array=($nf) +echo "number_files=""$nf" + +df=$(sed -n '/'$TEST'/,$p' $TEST_FILE | grep -m 1 'directory_files') +df=${df//*directory_files: /} +df_array=($df) +echo "directory_files=""$df" + +rm -rf $MAIN_DIRECTORY/* +if [ "${#sf_array[@]}" = "${#nf_array[@]}" ] && [ "${#nf_array[@]}" = "${#df_array[@]}" ]; +then + N_ELEMENTS=${#df_array[@]} + for ((n=0;n<$N_ELEMENTS;n++)) + do + # Create directory + DIRECTORY=$MAIN_DIRECTORY/${df_array[$n]} + mkdir -p "$DIRECTORY" + + # Create original file + FILE_SIZE=${sf_array[$n]} + FILE_NAME=$FILE_SIZE"MB.tar.gz" + dd if=/dev/urandom of=$DIRECTORY/$FILE_NAME bs=1k count=$(echo $FILE_SIZE*1000/1 | bc) + + # Create symlinks + N_SYMLINKS=${nf_array[$n]}-1 + for ((l=0;l<=$N_SYMLINKS;l++)) + do + SYMLINK_NAME=$FILE_SIZE"MB_"$l".tar.gz" + ln -s ./$FILE_NAME $DIRECTORY/$SYMLINK_NAME + done + done +else +echo "ERROR: The number of parameters in size_files, number_files, and directory_files must be equal!" +fi + +sudo chown root:root ./configuration/vsftpd_ssl.conf diff --git a/test/mocks/datafilecollector-testharness/ftpes-sftp-server/test_cases.yml b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/test_cases.yml new file mode 100644 index 000000000..e07e3a0c6 --- /dev/null +++ b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/test_cases.yml @@ -0,0 +1,16 @@ +# EXAMPLE: TC1 generates (i) 10 files of 1 MB in ftpes directory, +# (ii) 30 files of 5 MB in sftp directory, and (iii) 10 files of 10 MB in sftp directory +TC1: + size_files: 1 5 10 + number_files: 10 30 10 + directory_files: ftpes sftp sftp + +TC2: + size_files: 0.5 1 5 + number_files: 2 3 1 + directory_files: ftpes ftpes sftp + +TC_10000: + size_files: 1 1 5 5 50 50 + number_files: 10000 10000 10000 10000 1 1 + directory_files: ftpes sftp ftpes sftp ftpes sftp diff --git a/test/mocks/datafilecollector-testharness/ftpes-sftp-server/tls/README.md b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/tls/README.md new file mode 100644 index 000000000..5edfeddec --- /dev/null +++ b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/tls/README.md @@ -0,0 +1,4 @@ +# To verify the certificate expiration dates: + +openssl x509 -enddate -noout -in dfc.crt +openssl x509 -enddate -noout -in ftp.crt diff --git a/test/mocks/datafilecollector-testharness/ftpes-sftp-server/tls/dfc.crt b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/tls/dfc.crt new file mode 100644 index 000000000..f747f20bb --- /dev/null +++ b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/tls/dfc.crt @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDFjCCAf4CCQCqH10CLXcbUDANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQGEwJT +RTEKMAgGA1UECAwBMDEKMAgGA1UEBwwBMDEKMAgGA1UECgwBMDEMMAoGA1UECwwD +RVNUMQwwCgYDVQQDDANFU1QwHhcNMTkwNDA0MDgwMjQwWhcNMjAwNDAzMDgwMjQw +WjBNMQswCQYDVQQGEwJTRTEKMAgGA1UECAwBMDEKMAgGA1UEBwwBMDEKMAgGA1UE +CgwBMDEMMAoGA1UECwwDRVNUMQwwCgYDVQQDDANFU1QwggEiMA0GCSqGSIb3DQEB +AQUAA4IBDwAwggEKAoIBAQDAY7wM9khd7OIaZsfZv8EzWUnLTepzSx6hlAvjSbU/ +ZBpq94QOJWt22hQQSHA+Vdl8184PoyOKX+qRfbKJCtyArbv0DoWjlv16WNs938A/ +0TGFh+6xA464/GQmP/AXEuI0tSa2GEgXkhZ0uy6Pmdq+8sD6YcRyVCeqLTq8bqSq +YbpPrKnbZsd3l7PzpYCZgZLfWoENQ7nuT+C7j4pGGnPKpGn4ubiscV3nTI6nwU19 +ANexToikIL1v18z+gJdva8QtKih5dt9+2QJuJ6lPcwTa7xVkMmuVyr5FXwL11yII +gKRtknWObU7BjcKkQOG3xnWXZTNzLV/th8GCCWJuRFPbAgMBAAEwDQYJKoZIhvcN +AQELBQADggEBAGZa23j04vghZY+/81FyRsoeJs8o9aDeK5KLT9JUpRaZlu4AEXSN +I3oEhencocc07DTndfxw7eSALnTD9ibGUxnRyEvgtW595ajb7A3TtEKGsFzXFvar +y9RdVm6RRA4Bty8UyLW75ZpAlfc3twCmsRwKjShXeN90Yn3sjpcEU83q8fZBU35C +xrgrW34gphPtuzZ7kvCJGjhYIfIsTcWObvDGUROtlRhb8w2v1K4G3UcfwDTBixK/ +e61mMUbhoqVyoMYgSuU4idY+n4Evjs5IwalXM1daUZmCGGZoreD/9aSpDEeUWnQy +vqYC0YY0VJkOe+WI6JZ2r49BtRtl/jxWDUI= +-----END CERTIFICATE----- diff --git a/test/mocks/datafilecollector-testharness/ftpes-sftp-server/tls/ftp.crt b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/tls/ftp.crt new file mode 100644 index 000000000..f412d013c --- /dev/null +++ b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/tls/ftp.crt @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDFjCCAf4CCQDaiGveWOXqNjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQGEwJT +RTEKMAgGA1UECAwBMDEKMAgGA1UEBwwBMDEKMAgGA1UECgwBMDEMMAoGA1UECwwD +RVNUMQwwCgYDVQQDDANFU1QwHhcNMTkwNDA0MDgwMjQwWhcNMjAwNDAzMDgwMjQw +WjBNMQswCQYDVQQGEwJTRTEKMAgGA1UECAwBMDEKMAgGA1UEBwwBMDEKMAgGA1UE +CgwBMDEMMAoGA1UECwwDRVNUMQwwCgYDVQQDDANFU1QwggEiMA0GCSqGSIb3DQEB +AQUAA4IBDwAwggEKAoIBAQDSsF7lN/gXpevQpGj8W/3g3h9AVOE83Z49yJAdyIHF +PQz6PI+bKutYdORCUZkzsl2fegLzkXl4CmoVIkJRBL1SZkzQXKe+fjfuRr9PQKCC +lp/LA161Qak+9pz2Oc1lfLbgEdv22RLji3akCQso3G9vlx+rLHPRgbew0iiTViJP +v3CHwiY89t1ai149OEywhjsJBJjBoj6fvxfvv46QmK7FuV5Tz0vTL/eB/Z9P7jm+ +twHRz9Ae4s97c6UhbFKafHLrwdMK+yz7qe55tpgthCgoedeSB0gXWIiS7RY18dEN +JUB/FAt64LfOiKBl0aUbcQOgUinorhCN8gcNTn7Hrn+1AgMBAAEwDQYJKoZIhvcN +AQELBQADggEBAKVGHkTLe5R/fG/C7prxiknD+QXo9WACcZNVKMuKhpJwQh1iwc4h +4tq9lj//giyRrt+yPVQF8pRTiIdeewLVyf5O1ugxzb68UtHzVJWD6ooFqGmyPFkm +WOdLvtgbasGPZvO6y8HZA3kxKgONbYcL0sdtRWpp5b+KTEyvN/50jAtvkB/wlaee +emgdRdsSVZqg1p8dUfF6j3Alzsuff7YzEZEZPoJKYdb1vikvj21+LdzTDSj5WRno +PWXQhdTTqN5/TNMZRHJp/UZY6hVmQL+ILqVYGiOPotfxGNUyo+WsKJwZfZnq4adh +BzdSIIsDCZB34Njz/qjIXh307/seNWWhNFw= +-----END CERTIFICATE----- diff --git a/test/mocks/datafilecollector-testharness/ftpes-sftp-server/tls/ftp.key b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/tls/ftp.key new file mode 100644 index 000000000..f90c781d3 --- /dev/null +++ b/test/mocks/datafilecollector-testharness/ftpes-sftp-server/tls/ftp.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEA0rBe5Tf4F6Xr0KRo/Fv94N4fQFThPN2ePciQHciBxT0M+jyP +myrrWHTkQlGZM7Jdn3oC85F5eApqFSJCUQS9UmZM0Fynvn437ka/T0CggpafywNe +tUGpPvac9jnNZXy24BHb9tkS44t2pAkLKNxvb5cfqyxz0YG3sNIok1YiT79wh8Im +PPbdWotePThMsIY7CQSYwaI+n78X77+OkJiuxbleU89L0y/3gf2fT+45vrcB0c/Q +HuLPe3OlIWxSmnxy68HTCvss+6nuebaYLYQoKHnXkgdIF1iIku0WNfHRDSVAfxQL +euC3zoigZdGlG3EDoFIp6K4QjfIHDU5+x65/tQIDAQABAoIBAEs+G5XG6D4hzlbD +8I53l/JvwT9rUMk46GNuNjG8wsOa6wCPEkY7DLOZg08/7vOsdo0WuOkdggDhz0Le +6koe5DICQNqEzI9WakkZUQdPsEMS4dxRxsf6vCO1VRcGS5k78d+R4TmGCp3i16r7 +Y9Xi65UxpmiuRmqC5gQq+bysnTJXKUhK/3NCPa7Bwo7hgASJcI55Nk58KHokIv84 +7dweKuIIxeKAR4/094q243lTu1n273J+ckjVMWWZROIIn2E+CrjAVh59DaC7QX6d +kWdPwvjYiwH2LBqzJ3dKvLmk6XZZ5bcjmBYXSiS1ahjQ8zhDdLoHBt/gDXcmtOVw +gZPjgn0CgYEA6nJGMig2SRB25CqtA/gwLbQV54th0Vxj1SapoO+W4jIUEPBRJN1t +0JkM9mTMWWBiEzZi4ICpJpgT/+iGXx6q6WZZqOvbWWS4yjuC+wLCttt2yriFkmlA +eylz0rYTGm5gQ3wpAUuf0wOfqVICfQ2KnASY0p8g2fSjOI0/pULpX18CgYEA5g72 +UVspmBLqaA/PGYip/7neh00sGs95b9Wh1UqvcrstxkgR4LyMOReTBNwL+39kyZPv +LNsfMtaiezIfSF+o77RiXnBsYQ/ZnKBNZ7cTRr76f5fKStzRSzHoQrf+98YkSfg3 +sI1vYH/hnfbd/6ti8Wiloc7O28IHCwG4vGXWPWsCgYEA4Oqaj1nmonfKJ6ENdSZw +Shhff1BHmovxNrctuzi/Xue+OnXi0uQfiySZu/P926zMyjO97jVgkacKYNMZvj10 +qA/J6nXDbOJlKZaoVNlUJgsrztXxRwH0m3OsKzUD5LKJZZTC3fxIKy9pyA3mV0Rb +eswqNL32zUKWKBXSPmCP9S8CgYEAoJIk3dfRCjF5pjQSinHWpYRniuwUMopI6gOj +tqkwF9YJNvGqeL9g56BKnwOu4VSjVgaI0zgFaIhiU7ZCG1OZJ+UxG1VAb+aOLkG8 +hP1E2QYG9PNO4D2LXv5wa9DchrenMHGs/O9ao3HeWVCq1f4bSv+NS4h63Otp2wbS +l7xEcg0CgYBcrapVzHfGn73Z9tgs7GOVEmoXKoT6Q8yrdwwhVrcWdDHHtLFPso21 +eA9dhbbawaEmIReWtNKvo+Q2kxn+WcLIL6jWaASsJH4cnnRl58IYcUv8cb6o6G34 +nTkWuhXm5XBUupacr8lqz5bXtoRBU7BcSnqXd20dTR5QEHU5Rrg/uw== +-----END RSA PRIVATE KEY----- diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/.gitignore b/test/mocks/datafilecollector-testharness/ftps-sftp-server/.gitignore deleted file mode 100644 index bd6c5bed8..000000000 --- a/test/mocks/datafilecollector-testharness/ftps-sftp-server/.gitignore +++ /dev/null @@ -1 +0,0 @@ -files/onap/* diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/Dockerfile-ftps b/test/mocks/datafilecollector-testharness/ftps-sftp-server/Dockerfile-ftps deleted file mode 100644 index a0d6cfafc..000000000 --- a/test/mocks/datafilecollector-testharness/ftps-sftp-server/Dockerfile-ftps +++ /dev/null @@ -1,5 +0,0 @@ -FROM docker.io/panubo/vsftpd - -COPY configuration/vsftpd_ssl.conf /etc/vsftpd_ssl.conf -RUN chmod 644 /etc/vsftpd_ssl.conf -RUN chown root:root /etc/vsftpd_ssl.conf \ No newline at end of file diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/README.md b/test/mocks/datafilecollector-testharness/ftps-sftp-server/README.md deleted file mode 100644 index f20b29698..000000000 --- a/test/mocks/datafilecollector-testharness/ftps-sftp-server/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# Deployment of certificates: (in case of update) - -This folder is prepared with a set of keys matching DfC for test purposes. - -Copy from datafile-app-server/config/keys to the ./tls/ the following files: - -- dfc.crt -- ftp.crt -- ftp.key - -# Docker preparations - -Source: - -`sudo usermod -aG docker $USER` - -then logout-login to activate it. - -# Prepare files for the simulator - -Run `prepare.sh` with an argument found in `test_cases.yml` (or add a new tc in that file) to create files (1MB, 5MB and 50MB files) and a large number of -symbolic links to these files to simulate PM files. The files names maches the files in -the events produced by the MR simulator. The dirs with the files will be mounted -by the ftp containers, defined in the docker-compse file, when started - -# Starting/stopping the FTPS/SFTP server(s) - -Start: `docker-compose up` - -Stop: Ctrl +C, then `docker-compose down` or `docker-compose down --remove-orphans` - -If you experience issues (or port collision), check the currently running other containers -by using 'docker ps' and stop them if necessary. - -# Cleaning docker structure - -Deep cleaning: `docker system prune` diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/configuration/vsftpd_ssl.conf b/test/mocks/datafilecollector-testharness/ftps-sftp-server/configuration/vsftpd_ssl.conf deleted file mode 100644 index 0a24e38a8..000000000 --- a/test/mocks/datafilecollector-testharness/ftps-sftp-server/configuration/vsftpd_ssl.conf +++ /dev/null @@ -1,57 +0,0 @@ -# Server Config -anonymous_enable=NO -local_enable=YES -write_enable=YES -local_umask=022 -dirmessage_enable=YES - -# Security and User auth -chroot_local_user=YES -pam_service_name=vsftpd_virtual -virtual_use_local_privs=YES -chmod_enable=NO -user_config_dir=/etc/vsftpd/user_conf -user_sub_token=$USER -#local_root=/srv/$USER -local_root=/srv/ -userlist_enable=NO -allow_writeable_chroot=YES - -# Logging -log_ftp_protocol=YES -xferlog_enable=YES -xferlog_std_format=YES -#xferlog_file=/dev/stdout -syslog_enable=NO -dual_log_enable=YES - -# Remap all login users to this username -guest_enable=YES -guest_username=ftp -hide_ids=YES - -# Networking -connect_from_port_20=NO -listen=YES -tcp_wrappers=YES -#pasv_min_port=8001 -#pasv_max_port=8010 - -# SSL -ssl_enable=Yes -require_ssl_reuse=NO -force_local_data_ssl=YES -force_local_logins_ssl=YES -ssl_ciphers=HIGH -allow_anon_ssl=NO - -ssl_tlsv1=YES -ssl_sslv2=YES -ssl_sslv3=YES -rsa_cert_file=/etc/ssl/private/cert.pem -rsa_private_key_file=/etc/ssl/private/key.pem - -require_cert=YES -ssl_request_cert=YES -ca_certs_file=/etc/ssl/private/cacert.pem - diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/docker-compose.yml b/test/mocks/datafilecollector-testharness/ftps-sftp-server/docker-compose.yml deleted file mode 100644 index cdee4d56c..000000000 --- a/test/mocks/datafilecollector-testharness/ftps-sftp-server/docker-compose.yml +++ /dev/null @@ -1,35 +0,0 @@ -version: '3' - -services: - - sftp-server1: - container_name: sftp-server1 - image: atmoz/sftp:alpine - ports: - - "1022:22" - volumes: - - ./files/onap/sftp/:/home/onap/ - restart: on-failure - command: onap:pano:1001 - - ftpes-server-vsftpd: - container_name: ftpes-server-vsftpd - image: docker.io/panubo/vsftpd - ports: - - "21:21" - - "8001-8010:8001-8010" - environment: - FTP_USER: onap - FTP_PASSWORD: pano - PASV_ADDRESS: localhost - PASV_MIN_PORT: 8001 - PASV_MAX_PORT: 8010 - volumes: - - ./tls/ftp.crt:/etc/ssl/private/ftp.crt:ro - - ./tls/ftp.key:/etc/ssl/private/ftp.key:ro - - ./tls/dfc.crt:/etc/ssl/private/dfc.crt:ro - - ./configuration/vsftpd_ssl.conf:/etc/vsftpd_ssl.conf:ro - - - ./files/onap/ftps/:/srv/ - restart: on-failure - command: vsftpd /etc/vsftpd_ssl.conf diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/prepare.sh b/test/mocks/datafilecollector-testharness/ftps-sftp-server/prepare.sh deleted file mode 100755 index 086d43a49..000000000 --- a/test/mocks/datafilecollector-testharness/ftps-sftp-server/prepare.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# EXAMPLE: Run test case TC2 using the command "./prepare.sh TC2" -MAIN_DIRECTORY=./files/onap -TEST_FILE=./test_cases.yml -TEST=$1 -echo "Generating files for test case:" "$TEST" - -sf=$(sed -n '/'$TEST'/,$p' $TEST_FILE | grep -m 1 'size_files') -sf=${sf//*size_files: /} -sf_array=($sf) -echo "size_files=""$sf" - -nf=$(sed -n '/'$TEST'/,$p' $TEST_FILE | grep -m 1 'number_files') -nf=${nf//*number_files: /} -nf_array=($nf) -echo "number_files=""$nf" - -df=$(sed -n '/'$TEST'/,$p' $TEST_FILE | grep -m 1 'directory_files') -df=${df//*directory_files: /} -df_array=($df) -echo "directory_files=""$df" - -rm -rf $MAIN_DIRECTORY/* -if [ "${#sf_array[@]}" = "${#nf_array[@]}" ] && [ "${#nf_array[@]}" = "${#df_array[@]}" ]; -then - N_ELEMENTS=${#df_array[@]} - for ((n=0;n<$N_ELEMENTS;n++)) - do - # Create directory - DIRECTORY=$MAIN_DIRECTORY/${df_array[$n]} - mkdir -p "$DIRECTORY" - - # Create original file - FILE_SIZE=${sf_array[$n]} - FILE_NAME=$FILE_SIZE"MB.tar.gz" - dd if=/dev/urandom of=$DIRECTORY/$FILE_NAME bs=1k count=$(echo $FILE_SIZE*1000/1 | bc) - - # Create symlinks - N_SYMLINKS=${nf_array[$n]}-1 - for ((l=0;l<=$N_SYMLINKS;l++)) - do - SYMLINK_NAME=$FILE_SIZE"MB_"$l".tar.gz" - ln -s ./$FILE_NAME $DIRECTORY/$SYMLINK_NAME - done - done -else -echo "ERROR: The number of parameters in size_files, number_files, and directory_files must be equal!" -fi - -sudo chown root:root ./configuration/vsftpd_ssl.conf diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/test_cases.yml b/test/mocks/datafilecollector-testharness/ftps-sftp-server/test_cases.yml deleted file mode 100644 index ce68be40c..000000000 --- a/test/mocks/datafilecollector-testharness/ftps-sftp-server/test_cases.yml +++ /dev/null @@ -1,16 +0,0 @@ -# EXAMPLE: TC1 generates (i) 10 files of 1 MB in ftps directory, -# (ii) 30 files of 5 MB in sftp directory, and (iii) 10 files of 10 MB in sftp directory -TC1: - size_files: 1 5 10 - number_files: 10 30 10 - directory_files: ftps sftp sftp - -TC2: - size_files: 0.5 1 5 - number_files: 2 3 1 - directory_files: ftps ftps sftp - -TC_10000: - size_files: 1 1 5 5 50 50 - number_files: 10000 10000 10000 10000 1 1 - directory_files: ftps sftp ftps sftp ftps sftp diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/README.md b/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/README.md deleted file mode 100644 index 5edfeddec..000000000 --- a/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# To verify the certificate expiration dates: - -openssl x509 -enddate -noout -in dfc.crt -openssl x509 -enddate -noout -in ftp.crt diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/dfc.crt b/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/dfc.crt deleted file mode 100644 index f747f20bb..000000000 --- a/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/dfc.crt +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDFjCCAf4CCQCqH10CLXcbUDANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQGEwJT -RTEKMAgGA1UECAwBMDEKMAgGA1UEBwwBMDEKMAgGA1UECgwBMDEMMAoGA1UECwwD -RVNUMQwwCgYDVQQDDANFU1QwHhcNMTkwNDA0MDgwMjQwWhcNMjAwNDAzMDgwMjQw -WjBNMQswCQYDVQQGEwJTRTEKMAgGA1UECAwBMDEKMAgGA1UEBwwBMDEKMAgGA1UE -CgwBMDEMMAoGA1UECwwDRVNUMQwwCgYDVQQDDANFU1QwggEiMA0GCSqGSIb3DQEB -AQUAA4IBDwAwggEKAoIBAQDAY7wM9khd7OIaZsfZv8EzWUnLTepzSx6hlAvjSbU/ -ZBpq94QOJWt22hQQSHA+Vdl8184PoyOKX+qRfbKJCtyArbv0DoWjlv16WNs938A/ -0TGFh+6xA464/GQmP/AXEuI0tSa2GEgXkhZ0uy6Pmdq+8sD6YcRyVCeqLTq8bqSq -YbpPrKnbZsd3l7PzpYCZgZLfWoENQ7nuT+C7j4pGGnPKpGn4ubiscV3nTI6nwU19 -ANexToikIL1v18z+gJdva8QtKih5dt9+2QJuJ6lPcwTa7xVkMmuVyr5FXwL11yII -gKRtknWObU7BjcKkQOG3xnWXZTNzLV/th8GCCWJuRFPbAgMBAAEwDQYJKoZIhvcN -AQELBQADggEBAGZa23j04vghZY+/81FyRsoeJs8o9aDeK5KLT9JUpRaZlu4AEXSN -I3oEhencocc07DTndfxw7eSALnTD9ibGUxnRyEvgtW595ajb7A3TtEKGsFzXFvar -y9RdVm6RRA4Bty8UyLW75ZpAlfc3twCmsRwKjShXeN90Yn3sjpcEU83q8fZBU35C -xrgrW34gphPtuzZ7kvCJGjhYIfIsTcWObvDGUROtlRhb8w2v1K4G3UcfwDTBixK/ -e61mMUbhoqVyoMYgSuU4idY+n4Evjs5IwalXM1daUZmCGGZoreD/9aSpDEeUWnQy -vqYC0YY0VJkOe+WI6JZ2r49BtRtl/jxWDUI= ------END CERTIFICATE----- diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/ftp.crt b/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/ftp.crt deleted file mode 100644 index f412d013c..000000000 --- a/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/ftp.crt +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDFjCCAf4CCQDaiGveWOXqNjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQGEwJT -RTEKMAgGA1UECAwBMDEKMAgGA1UEBwwBMDEKMAgGA1UECgwBMDEMMAoGA1UECwwD -RVNUMQwwCgYDVQQDDANFU1QwHhcNMTkwNDA0MDgwMjQwWhcNMjAwNDAzMDgwMjQw -WjBNMQswCQYDVQQGEwJTRTEKMAgGA1UECAwBMDEKMAgGA1UEBwwBMDEKMAgGA1UE -CgwBMDEMMAoGA1UECwwDRVNUMQwwCgYDVQQDDANFU1QwggEiMA0GCSqGSIb3DQEB -AQUAA4IBDwAwggEKAoIBAQDSsF7lN/gXpevQpGj8W/3g3h9AVOE83Z49yJAdyIHF -PQz6PI+bKutYdORCUZkzsl2fegLzkXl4CmoVIkJRBL1SZkzQXKe+fjfuRr9PQKCC -lp/LA161Qak+9pz2Oc1lfLbgEdv22RLji3akCQso3G9vlx+rLHPRgbew0iiTViJP -v3CHwiY89t1ai149OEywhjsJBJjBoj6fvxfvv46QmK7FuV5Tz0vTL/eB/Z9P7jm+ -twHRz9Ae4s97c6UhbFKafHLrwdMK+yz7qe55tpgthCgoedeSB0gXWIiS7RY18dEN -JUB/FAt64LfOiKBl0aUbcQOgUinorhCN8gcNTn7Hrn+1AgMBAAEwDQYJKoZIhvcN -AQELBQADggEBAKVGHkTLe5R/fG/C7prxiknD+QXo9WACcZNVKMuKhpJwQh1iwc4h -4tq9lj//giyRrt+yPVQF8pRTiIdeewLVyf5O1ugxzb68UtHzVJWD6ooFqGmyPFkm -WOdLvtgbasGPZvO6y8HZA3kxKgONbYcL0sdtRWpp5b+KTEyvN/50jAtvkB/wlaee -emgdRdsSVZqg1p8dUfF6j3Alzsuff7YzEZEZPoJKYdb1vikvj21+LdzTDSj5WRno -PWXQhdTTqN5/TNMZRHJp/UZY6hVmQL+ILqVYGiOPotfxGNUyo+WsKJwZfZnq4adh -BzdSIIsDCZB34Njz/qjIXh307/seNWWhNFw= ------END CERTIFICATE----- diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/ftp.key b/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/ftp.key deleted file mode 100644 index f90c781d3..000000000 --- a/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/ftp.key +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEA0rBe5Tf4F6Xr0KRo/Fv94N4fQFThPN2ePciQHciBxT0M+jyP -myrrWHTkQlGZM7Jdn3oC85F5eApqFSJCUQS9UmZM0Fynvn437ka/T0CggpafywNe -tUGpPvac9jnNZXy24BHb9tkS44t2pAkLKNxvb5cfqyxz0YG3sNIok1YiT79wh8Im -PPbdWotePThMsIY7CQSYwaI+n78X77+OkJiuxbleU89L0y/3gf2fT+45vrcB0c/Q -HuLPe3OlIWxSmnxy68HTCvss+6nuebaYLYQoKHnXkgdIF1iIku0WNfHRDSVAfxQL -euC3zoigZdGlG3EDoFIp6K4QjfIHDU5+x65/tQIDAQABAoIBAEs+G5XG6D4hzlbD -8I53l/JvwT9rUMk46GNuNjG8wsOa6wCPEkY7DLOZg08/7vOsdo0WuOkdggDhz0Le -6koe5DICQNqEzI9WakkZUQdPsEMS4dxRxsf6vCO1VRcGS5k78d+R4TmGCp3i16r7 -Y9Xi65UxpmiuRmqC5gQq+bysnTJXKUhK/3NCPa7Bwo7hgASJcI55Nk58KHokIv84 -7dweKuIIxeKAR4/094q243lTu1n273J+ckjVMWWZROIIn2E+CrjAVh59DaC7QX6d -kWdPwvjYiwH2LBqzJ3dKvLmk6XZZ5bcjmBYXSiS1ahjQ8zhDdLoHBt/gDXcmtOVw -gZPjgn0CgYEA6nJGMig2SRB25CqtA/gwLbQV54th0Vxj1SapoO+W4jIUEPBRJN1t -0JkM9mTMWWBiEzZi4ICpJpgT/+iGXx6q6WZZqOvbWWS4yjuC+wLCttt2yriFkmlA -eylz0rYTGm5gQ3wpAUuf0wOfqVICfQ2KnASY0p8g2fSjOI0/pULpX18CgYEA5g72 -UVspmBLqaA/PGYip/7neh00sGs95b9Wh1UqvcrstxkgR4LyMOReTBNwL+39kyZPv -LNsfMtaiezIfSF+o77RiXnBsYQ/ZnKBNZ7cTRr76f5fKStzRSzHoQrf+98YkSfg3 -sI1vYH/hnfbd/6ti8Wiloc7O28IHCwG4vGXWPWsCgYEA4Oqaj1nmonfKJ6ENdSZw -Shhff1BHmovxNrctuzi/Xue+OnXi0uQfiySZu/P926zMyjO97jVgkacKYNMZvj10 -qA/J6nXDbOJlKZaoVNlUJgsrztXxRwH0m3OsKzUD5LKJZZTC3fxIKy9pyA3mV0Rb -eswqNL32zUKWKBXSPmCP9S8CgYEAoJIk3dfRCjF5pjQSinHWpYRniuwUMopI6gOj -tqkwF9YJNvGqeL9g56BKnwOu4VSjVgaI0zgFaIhiU7ZCG1OZJ+UxG1VAb+aOLkG8 -hP1E2QYG9PNO4D2LXv5wa9DchrenMHGs/O9ao3HeWVCq1f4bSv+NS4h63Otp2wbS -l7xEcg0CgYBcrapVzHfGn73Z9tgs7GOVEmoXKoT6Q8yrdwwhVrcWdDHHtLFPso21 -eA9dhbbawaEmIReWtNKvo+Q2kxn+WcLIL6jWaASsJH4cnnRl58IYcUv8cb6o6G34 -nTkWuhXm5XBUupacr8lqz5bXtoRBU7BcSnqXd20dTR5QEHU5Rrg/uw== ------END RSA PRIVATE KEY----- diff --git a/test/mocks/datafilecollector-testharness/mr-sim/README.md b/test/mocks/datafilecollector-testharness/mr-sim/README.md index 653b47e8f..056136f94 100644 --- a/test/mocks/datafilecollector-testharness/mr-sim/README.md +++ b/test/mocks/datafilecollector-testharness/mr-sim/README.md @@ -30,7 +30,7 @@ The simulator listens to port 2222. The following envrionment vaiables are used: -- **FTPS_SIMS** - A comma-separated list of hostname:port for the FTP servers to generate ftps file urls for. If not set MR sim will assume 'localhost:21'. Minimum 1 and maximum 5 host-port pairs can be given. +- **FTPES_SIMS** - A comma-separated list of hostname:port for the FTP servers to generate ftpes file urls for. If not set MR sim will assume 'localhost:21'. Minimum 1 and maximum 5 host-port pairs can be given. - **SFTP_SIMS** - A comma-separated list of hostname:port for the FTP servers to generate sftp file urls for. If not set MR sim will assume 'localhost:1022'. Minimum 1 and maximum 5 host-port pairs can be given. - **NUM_FTP_SERVERS** - Number of FTP servers to use out of those specified in the envrioment variables above. The number shall be in the range 1-5. - **MR_GROUPS** - A comma-separated list of consummer-group:changeId[:changeId]\*. Defines which change identifier that should be used for each consumer gropu. If not set the MR-sim will assume 'OpenDcae-c12:PM_MEAS_FILES'. @@ -175,15 +175,15 @@ TC1302 - 700 ME, SFTP, 50MB files, 100 files per event, endless number of events TC1500 - 700 ME, SFTP, 1MB files, 100 files per event, 35 events per poll, simulating 25h backlog of decreasing number of outdated files and then 20 event polls every 15min for 1h -Changing the first digit in tc number will change the test case to run FTPS instead. Eg. TC201 is FTPS version of TC101. +Changing the first digit in tc number will change the test case to run FTPES instead. Eg. TC201 is FTPES version of TC101. -TC2XX is same as TC1XX but with FTPS +TC2XX is same as TC1XX but with FTPES -TC6XX is same as TC5XX but with FTPS +TC6XX is same as TC5XX but with FTPES -TC8XX is same as TC7XX but with FTPS +TC8XX is same as TC7XX but with FTPES -TC2XXX is same as TC1XXX but with FTPS +TC2XXX is same as TC1XXX but with FTPES ## Developer workflow diff --git a/test/mocks/datafilecollector-testharness/mr-sim/mr-sim.py b/test/mocks/datafilecollector-testharness/mr-sim/mr-sim.py index 6345ab69f..f2b781bd9 100644 --- a/test/mocks/datafilecollector-testharness/mr-sim/mr-sim.py +++ b/test/mocks/datafilecollector-testharness/mr-sim/mr-sim.py @@ -1,229 +1,249 @@ import argparse -import json import os import sys import time from time import sleep -from flask import Flask, render_template, request -from werkzeug import secure_filename +from flask import Flask app = Flask(__name__) -#Server info +# Server info HOST_IP = "0.0.0.0" HOST_PORT = 2222 HOST_PORT_TLS = 2223 -sftp_hosts=[] -sftp_ports=[] -ftps_hosts=[] -ftps_ports=[] -num_ftp_servers=1 +sftp_hosts = [] +sftp_ports = [] +ftpes_hosts = [] +ftpes_ports = [] +num_ftp_servers = 1 + def sumList(ctrArray): - tmp=0 + tmp = 0 for i in range(len(ctrArray)): - tmp=tmp+ctrArray[i]; + tmp = tmp + ctrArray[i] + + return str(tmp) - return str(tmp); def sumListLength(ctrArray): - tmp=0 + tmp = 0 for i in range(len(ctrArray)): - tmp=tmp+len(ctrArray[i]); + tmp = tmp + len(ctrArray[i]) - return str(tmp); + return str(tmp) -#Test function to check server running + +# Test function to check server running @app.route('/', - methods=['GET']) + methods=['GET']) def index(): return 'Hello world' -#Returns the list of configured groups + +# Returns the list of configured groups @app.route('/groups', - methods=['GET']) + methods=['GET']) def group_ids(): global configuredGroups return configuredGroups -#Returns the list of configured changeids + +# Returns the list of configured changeids @app.route('/changeids', - methods=['GET']) + methods=['GET']) def change_ids(): global configuredChangeIds return configuredChangeIds -#Returns the list of configured fileprefixes + +# Returns the list of configured fileprefixes @app.route('/fileprefixes', - methods=['GET']) + methods=['GET']) def fileprefixes(): global configuredPrefixes return configuredPrefixes -#Returns number of polls +# Returns number of polls @app.route('/ctr_requests', - methods=['GET']) + methods=['GET']) def counter_requests(): global ctr_requests return sumList(ctr_requests) -#Returns number of polls for all groups + +# Returns number of polls for all groups @app.route('/groups/ctr_requests', - methods=['GET']) + methods=['GET']) def group_counter_requests(): global ctr_requests global groupNames - tmp='' + tmp = '' for i in range(len(groupNames)): if (i > 0): - tmp=tmp+',' - tmp=tmp+str(ctr_requests[i]) + tmp = tmp + ',' + tmp = tmp + str(ctr_requests[i]) return tmp -#Returns the total number of polls for a group + +# Returns the total number of polls for a group @app.route('/ctr_requests/', - methods=['GET']) + methods=['GET']) def counter_requests_group(groupId): global ctr_requests global groupNameIndexes return str(ctr_requests[groupNameIndexes[groupId]]) -#Returns number of poll replies + +# Returns number of poll replies @app.route('/ctr_responses', - methods=['GET']) + methods=['GET']) def counter_responses(): global ctr_responses return sumList(ctr_responses) -#Returns number of poll replies for all groups + +# Returns number of poll replies for all groups @app.route('/groups/ctr_responses', - methods=['GET']) + methods=['GET']) def group_counter_responses(): global ctr_responses global groupNames - tmp='' + tmp = '' for i in range(len(groupNames)): if (i > 0): - tmp=tmp+',' - tmp=tmp+str(ctr_responses[i]) + tmp = tmp + ',' + tmp = tmp + str(ctr_responses[i]) return tmp -#Returns the total number of poll replies for a group + +# Returns the total number of poll replies for a group @app.route('/ctr_responses/', - methods=['GET']) + methods=['GET']) def counter_responses_group(groupId): global ctr_responses global groupNameIndexes return str(ctr_responses[groupNameIndexes[groupId]]) -#Returns the total number of files + +# Returns the total number of files @app.route('/ctr_files', - methods=['GET']) + methods=['GET']) def counter_files(): global ctr_files return sumList(ctr_files) -#Returns the total number of file for all groups + +# Returns the total number of file for all groups @app.route('/groups/ctr_files', - methods=['GET']) + methods=['GET']) def group_counter_files(): global ctr_files global groupNames - tmp='' + tmp = '' for i in range(len(groupNames)): if (i > 0): - tmp=tmp+',' - tmp=tmp+str(ctr_files[i]) + tmp = tmp + ',' + tmp = tmp + str(ctr_files[i]) return tmp -#Returns the total number of files for a group + +# Returns the total number of files for a group @app.route('/ctr_files/', - methods=['GET']) + methods=['GET']) def counter_files_group(groupId): global ctr_files global groupNameIndexes return str(ctr_files[groupNameIndexes[groupId]]) -#Returns number of unique files +# Returns number of unique files @app.route('/ctr_unique_files', - methods=['GET']) + methods=['GET']) def counter_uniquefiles(): global fileMap return sumListLength(fileMap) -#Returns number of unique files for all groups + +# Returns number of unique files for all groups @app.route('/groups/ctr_unique_files', - methods=['GET']) + methods=['GET']) def group_counter_uniquefiles(): global fileMap global groupNames - tmp='' + tmp = '' for i in range(len(groupNames)): if (i > 0): - tmp=tmp+',' - tmp=tmp+str(len(fileMap[i])) + tmp = tmp + ',' + tmp = tmp + str(len(fileMap[i])) return tmp -#Returns the total number of unique files for a group + +# Returns the total number of unique files for a group @app.route('/ctr_unique_files/', - methods=['GET']) + methods=['GET']) def counter_uniquefiles_group(groupId): global fileMap global groupNameIndexes return str(len(fileMap[groupNameIndexes[groupId]])) -#Returns tc info + +# Returns tc info @app.route('/tc_info', - methods=['GET']) + methods=['GET']) def testcase_info(): global tc_num return tc_num -#Returns number of events + +# Returns number of events @app.route('/ctr_events', - methods=['GET']) + methods=['GET']) def counter_events(): global ctr_events return sumList(ctr_events) -#Returns number of events for all groups + +# Returns number of events for all groups @app.route('/groups/ctr_events', - methods=['GET']) + methods=['GET']) def group_counter_events(): global ctr_events global groupNames - tmp='' + tmp = '' for i in range(len(groupNames)): if (i > 0): - tmp=tmp+',' - tmp=tmp+str(ctr_events[i]) + tmp = tmp + ',' + tmp = tmp + str(ctr_events[i]) return tmp -#Returns the total number of events for a group + +# Returns the total number of events for a group @app.route('/ctr_events/', - methods=['GET']) + methods=['GET']) def counter_events_group(groupId): global ctr_events global groupNameIndexes return str(ctr_events[groupNameIndexes[groupId]]) -#Returns execution time in mm:ss + +# Returns execution time in mm:ss @app.route('/execution_time', - methods=['GET']) + methods=['GET']) def exe_time(): global startTime stopTime = time.time() - minutes, seconds = divmod(stopTime-startTime, 60) - return "{:0>2}:{:0>2}".format(int(minutes),int(seconds)) + minutes, seconds = divmod(stopTime - startTime, 60) + return "{:0>2}:{:0>2}".format(int(minutes), int(seconds)) -#Returns the timestamp for first poll + +# Returns the timestamp for first poll @app.route('/exe_time_first_poll', - methods=['GET']) + methods=['GET']) def exe_time_first_poll(): global firstPollTime @@ -234,92 +254,100 @@ def exe_time_first_poll(): if (tmp == 0): return "--:--" - minutes, seconds = divmod(time.time()-tmp, 60) - return "{:0>2}:{:0>2}".format(int(minutes),int(seconds)) + minutes, seconds = divmod(time.time() - tmp, 60) + return "{:0>2}:{:0>2}".format(int(minutes), int(seconds)) -#Returns the timestamp for first poll for all groups + +# Returns the timestamp for first poll for all groups @app.route('/groups/exe_time_first_poll', - methods=['GET']) + methods=['GET']) def group_exe_time_first_poll(): global firstPollTime global groupNames - tmp='' + tmp = '' for i in range(len(groupNames)): if (i > 0): - tmp=tmp+',' + tmp = tmp + ',' if (firstPollTime[i] == 0): - tmp=tmp+ "--:--" + tmp = tmp + "--:--" else: - minutes, seconds = divmod(time.time()-firstPollTime[i], 60) - tmp=tmp+"{:0>2}:{:0>2}".format(int(minutes),int(seconds)) + minutes, seconds = divmod(time.time() - firstPollTime[i], 60) + tmp = tmp + "{:0>2}:{:0>2}".format(int(minutes), int(seconds)) return tmp -#Returns the timestamp for first poll for a group + +# Returns the timestamp for first poll for a group @app.route('/exe_time_first_poll/', - methods=['GET']) + methods=['GET']) def exe_time_first_poll_group(groupId): global ctr_requests global groupNameIndexes if (firstPollTime[groupNameIndexes[groupId]] == 0): return "--:--" - minutes, seconds = divmod(time.time()-firstPollTime[groupNameIndexes[groupId]], 60) - return "{:0>2}:{:0>2}".format(int(minutes),int(seconds)) + minutes, seconds = divmod(time.time() - firstPollTime[groupNameIndexes[groupId]], 60) + return "{:0>2}:{:0>2}".format(int(minutes), int(seconds)) -#Starts event delivery + +# Starts event delivery @app.route('/start', - methods=['GET']) + methods=['GET']) def start(): global runningState - runningState="Started" + runningState = "Started" return runningState -#Stops event delivery + +# Stops event delivery @app.route('/stop', - methods=['GET']) + methods=['GET']) def stop(): global runningState - runningState="Stopped" + runningState = "Stopped" return runningState -#Returns the running state + +# Returns the running state @app.route('/status', - methods=['GET']) + methods=['GET']) def status(): global runningState return runningState -#Returns number of unique PNFs + +# Returns number of unique PNFs @app.route('/ctr_unique_PNFs', - methods=['GET']) + methods=['GET']) def counter_uniquePNFs(): global pnfMap return sumListLength(pnfMap) -#Returns number of unique PNFs for all groups + +# Returns number of unique PNFs for all groups @app.route('/groups/ctr_unique_PNFs', - methods=['GET']) + methods=['GET']) def group_counter_uniquePNFs(): global pnfMap global groupNames - tmp='' + tmp = '' for i in range(len(groupNames)): if (i > 0): - tmp=tmp+',' - tmp=tmp+str(len(pnfMap[i])) + tmp = tmp + ',' + tmp = tmp + str(len(pnfMap[i])) return tmp -#Returns the unique PNFs for a group + +# Returns the unique PNFs for a group @app.route('/ctr_unique_PNFs/', - methods=['GET']) + methods=['GET']) def counter_uniquePNFs_group(groupId): global pnfMap global groupNameIndexes return str(len(pnfMap[groupNameIndexes[groupId]])) -#Messages polling function +# Messages polling function @app.route( "/events/unauthenticated.VES_NOTIFICATION_OUTPUT//", methods=['GET']) @@ -332,12 +360,14 @@ def MR_reply(consumerGroup, consumerId): global groupNameIndexes global changeIds global filePrefixes + print("Received request at /events/unauthenticated.VES_NOTIFICATION_OUTPUT/ for consumerGroup: " + consumerGroup + + " with consumerId: " + consumerId) groupIndex = groupNameIndexes[consumerGroup] print("Setting groupIndex: " + str(groupIndex)) reqCtr = ctr_requests[groupIndex] - changeId = changeIds[groupIndex][reqCtr%len(changeIds[groupIndex])] + changeId = changeIds[groupIndex][reqCtr % len(changeIds[groupIndex])] print("Setting changeid: " + changeId) filePrefix = filePrefixes[changeId] print("Setting file name prefix: " + filePrefix) @@ -352,165 +382,164 @@ def MR_reply(consumerGroup, consumerId): ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 return buildOkResponse("[]") - - if args.tc100: - return tc100(groupIndex, changeId, filePrefix, "sftp", "1MB") + return tc100(groupIndex, changeId, filePrefix, "sftp", "1MB") elif args.tc101: - return tc100(groupIndex, changeId, filePrefix, "sftp", "5MB") + return tc100(groupIndex, changeId, filePrefix, "sftp", "5MB") elif args.tc102: - return tc100(groupIndex, changeId, filePrefix, "sftp", "50MB") + return tc100(groupIndex, changeId, filePrefix, "sftp", "50MB") elif args.tc110: - return tc110(groupIndex, changeId, filePrefix, "sftp") + return tc110(groupIndex, changeId, filePrefix, "sftp") elif args.tc111: - return tc111(groupIndex, changeId, filePrefix, "sftp") + return tc111(groupIndex, changeId, filePrefix, "sftp") elif args.tc112: - return tc112(groupIndex, changeId, filePrefix, "sftp") + return tc112(groupIndex, changeId, filePrefix, "sftp") elif args.tc113: - return tc113(groupIndex, changeId, filePrefix, "sftp") + return tc113(groupIndex, changeId, filePrefix, "sftp") elif args.tc120: - return tc120(groupIndex, changeId, filePrefix, "sftp") + return tc120(groupIndex, changeId, filePrefix, "sftp") elif args.tc121: - return tc121(groupIndex, changeId, filePrefix, "sftp") + return tc121(groupIndex, changeId, filePrefix, "sftp") elif args.tc122: - return tc122(groupIndex, changeId, filePrefix, "sftp") + return tc122(groupIndex, changeId, filePrefix, "sftp") elif args.tc1000: - return tc1000(groupIndex, changeId, filePrefix, "sftp") + return tc1000(groupIndex, changeId, filePrefix, "sftp") elif args.tc1001: - return tc1001(groupIndex, changeId, filePrefix, "sftp") + return tc1001(groupIndex, changeId, filePrefix, "sftp") elif args.tc1100: - return tc1100(groupIndex, changeId, filePrefix, "sftp","1MB") + return tc1100(groupIndex, changeId, filePrefix, "sftp", "1MB") elif args.tc1101: - return tc1100(groupIndex, changeId, filePrefix, "sftp","50MB") + return tc1100(groupIndex, changeId, filePrefix, "sftp", "50MB") elif args.tc1102: - return tc1100(groupIndex, changeId, filePrefix, "sftp","50MB") + return tc1100(groupIndex, changeId, filePrefix, "sftp", "50MB") elif args.tc1200: - return tc1200(groupIndex, changeId, filePrefix, "sftp","1MB") + return tc1200(groupIndex, changeId, filePrefix, "sftp", "1MB") elif args.tc1201: - return tc1200(groupIndex, changeId, filePrefix, "sftp","5MB") + return tc1200(groupIndex, changeId, filePrefix, "sftp", "5MB") elif args.tc1202: - return tc1200(groupIndex, changeId, filePrefix, "sftp","50MB") + return tc1200(groupIndex, changeId, filePrefix, "sftp", "50MB") elif args.tc1300: - return tc1300(groupIndex, changeId, filePrefix, "sftp","1MB") + return tc1300(groupIndex, changeId, filePrefix, "sftp", "1MB") elif args.tc1301: - return tc1300(groupIndex, changeId, filePrefix, "sftp","5MB") + return tc1300(groupIndex, changeId, filePrefix, "sftp", "5MB") elif args.tc1302: - return tc1300(groupIndex, changeId, filePrefix, "sftp","50MB") + return tc1300(groupIndex, changeId, filePrefix, "sftp", "50MB") elif args.tc1500: - return tc1500(groupIndex, changeId, filePrefix, "sftp","1MB") + return tc1500(groupIndex, changeId, filePrefix, "sftp", "1MB") elif args.tc500: - return tc500(groupIndex, changeId, filePrefix, "sftp","1MB") + return tc500(groupIndex, changeId, filePrefix, "sftp", "1MB") elif args.tc501: - return tc500(groupIndex, changeId, filePrefix, "sftp","5MB") + return tc500(groupIndex, changeId, filePrefix, "sftp", "5MB") elif args.tc502: - return tc500(groupIndex, changeId, filePrefix, "sftp","50MB") + return tc500(groupIndex, changeId, filePrefix, "sftp", "50MB") elif args.tc510: - return tc510(groupIndex, changeId, filePrefix, "sftp", "1MB") + return tc510(groupIndex, changeId, filePrefix, "sftp", "1MB") elif args.tc511: - return tc511(groupIndex, changeId, filePrefix, "sftp", "1KB") + return tc511(groupIndex, changeId, filePrefix, "sftp", "1KB") elif args.tc550: - return tc510(groupIndex, changeId, filePrefix, "sftp", "50MB") + return tc510(groupIndex, changeId, filePrefix, "sftp", "50MB") elif args.tc710: - return tc710(groupIndex, changeId, filePrefix, "sftp") + return tc710(groupIndex, changeId, filePrefix, "sftp") elif args.tc200: - return tc100(groupIndex, changeId, filePrefix, "ftps", "1MB") + return tc100(groupIndex, changeId, filePrefix, "ftpes", "1MB") elif args.tc201: - return tc100(groupIndex, changeId, filePrefix, "ftps", "5MB") + return tc100(groupIndex, changeId, filePrefix, "ftpes", "5MB") elif args.tc202: - return tc100(groupIndex, changeId, filePrefix, "ftps", "50MB") + return tc100(groupIndex, changeId, filePrefix, "ftpes", "50MB") elif args.tc210: - return tc110(groupIndex, changeId, filePrefix, "ftps") + return tc110(groupIndex, changeId, filePrefix, "ftpes") elif args.tc211: - return tc111(groupIndex, changeId, filePrefix, "ftps") + return tc111(groupIndex, changeId, filePrefix, "ftpes") elif args.tc212: - return tc112(groupIndex, changeId, filePrefix, "ftps") + return tc112(groupIndex, changeId, filePrefix, "ftpes") elif args.tc213: - return tc113(groupIndex, changeId, filePrefix, "ftps") + return tc113(groupIndex, changeId, filePrefix, "ftpes") elif args.tc220: - return tc120(groupIndex, changeId, filePrefix, "ftps") + return tc120(groupIndex, changeId, filePrefix, "ftpes") elif args.tc221: - return tc121(groupIndex, changeId, filePrefix, "ftps") + return tc121(groupIndex, changeId, filePrefix, "ftpes") elif args.tc222: - return tc122(groupIndex, changeId, filePrefix, "ftps") + return tc122(groupIndex, changeId, filePrefix, "ftpes") elif args.tc2000: - return tc1000(groupIndex, changeId, filePrefix, "ftps") + return tc1000(groupIndex, changeId, filePrefix, "ftpes") elif args.tc2001: - return tc1001(groupIndex, changeId, filePrefix, "ftps") + return tc1001(groupIndex, changeId, filePrefix, "ftpes") elif args.tc2100: - return tc1100(groupIndex, changeId, filePrefix, "ftps","1MB") + return tc1100(groupIndex, changeId, filePrefix, "ftpes", "1MB") elif args.tc2101: - return tc1100(groupIndex, changeId, filePrefix, "ftps","50MB") + return tc1100(groupIndex, changeId, filePrefix, "ftpes", "50MB") elif args.tc2102: - return tc1100(groupIndex, changeId, filePrefix, "ftps","50MB") + return tc1100(groupIndex, changeId, filePrefix, "ftpes", "50MB") elif args.tc2200: - return tc1200(groupIndex, changeId, filePrefix, "ftps","1MB") + return tc1200(groupIndex, changeId, filePrefix, "ftpes", "1MB") elif args.tc2201: - return tc1200(groupIndex, changeId, filePrefix, "ftps","5MB") + return tc1200(groupIndex, changeId, filePrefix, "ftpes", "5MB") elif args.tc2202: - return tc1200(groupIndex, changeId, filePrefix, "ftps","50MB") + return tc1200(groupIndex, changeId, filePrefix, "ftpes", "50MB") elif args.tc2300: - return tc1300(groupIndex, changeId, filePrefix, "ftps","1MB") + return tc1300(groupIndex, changeId, filePrefix, "ftpes", "1MB") elif args.tc2301: - return tc1300(groupIndex, changeId, filePrefix, "ftps","5MB") + return tc1300(groupIndex, changeId, filePrefix, "ftpes", "5MB") elif args.tc2302: - return tc1300(groupIndex, changeId, filePrefix, "ftps","50MB") + return tc1300(groupIndex, changeId, filePrefix, "ftpes", "50MB") elif args.tc2500: - return tc1500(groupIndex, changeId, filePrefix, "ftps","1MB") + return tc1500(groupIndex, changeId, filePrefix, "ftpes", "1MB") elif args.tc600: - return tc500(groupIndex, changeId, filePrefix, "ftps","1MB") + return tc500(groupIndex, changeId, filePrefix, "ftpes", "1MB") elif args.tc601: - return tc500(groupIndex, changeId, filePrefix, "ftps","5MB") + return tc500(groupIndex, changeId, filePrefix, "ftpes", "5MB") elif args.tc602: - return tc500(groupIndex, changeId, filePrefix, "ftps","50MB") + return tc500(groupIndex, changeId, filePrefix, "ftpes", "50MB") elif args.tc610: - return tc510(groupIndex, changeId, filePrefix, "ftps", "1MB") + return tc510(groupIndex, changeId, filePrefix, "ftpes", "1MB") elif args.tc611: - return tc511(groupIndex, changeId, filePrefix, "ftps", "1KB") + return tc511(groupIndex, changeId, filePrefix, "ftpes", "1KB") elif args.tc650: - return tc510(groupIndex, changeId, filePrefix, "ftps", "50MB") + return tc510(groupIndex, changeId, filePrefix, "ftpes", "50MB") elif args.tc810: - return tc710(groupIndex, changeId, filePrefix, "ftps") + return tc710(groupIndex, changeId, filePrefix, "ftpes") #### Test case functions def tc100(groupIndex, changeId, filePrefix, ftpType, fileSize): - global ctr_responses - global ctr_events + global ctr_responses + global ctr_events + ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 - ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 + if (ctr_responses[groupIndex] > 1): + return buildOkResponse("[]") - if (ctr_responses[groupIndex] > 1): - return buildOkResponse("[]") + seqNr = (ctr_responses[groupIndex] - 1) + nodeIndex = 0 + nodeName = createNodeName(nodeIndex) + fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, fileSize) + msg = getEventHead(groupIndex, changeId, nodeName) + getEventName(fileName, ftpType, "onap", "pano", + nodeIndex) + getEventEnd() + fileMap[groupIndex][seqNr * hash(filePrefix)] = seqNr + ctr_events[groupIndex] = ctr_events[groupIndex] + 1 + return buildOkResponse("[" + msg + "]") - seqNr = (ctr_responses[groupIndex]-1) - nodeIndex=0 - nodeName = createNodeName(nodeIndex) - fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, fileSize) - msg = getEventHead(groupIndex, changeId, nodeName) + getEventName(fileName,ftpType,"onap","pano",nodeIndex) + getEventEnd() - fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr - ctr_events[groupIndex] = ctr_events[groupIndex]+1 - return buildOkResponse("["+msg+"]") -#def tc101(groupIndex, ftpType): +# def tc101(groupIndex, ftpType): # global ctr_responses # global ctr_events # @@ -527,7 +556,7 @@ def tc100(groupIndex, changeId, filePrefix, ftpType, fileSize): # ctr_events[groupIndex] = ctr_events[groupIndex]+1 # return buildOkResponse("["+msg+"]") # -#def tc102(groupIndex, ftpType): +# def tc102(groupIndex, ftpType): # global ctr_responses # global ctr_events # @@ -545,582 +574,579 @@ def tc100(groupIndex, changeId, filePrefix, ftpType, fileSize): # return buildOkResponse("["+msg+"]") def tc110(groupIndex, changeId, filePrefix, ftpType): - global ctr_responses - global ctr_events + global ctr_responses + global ctr_events + ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 - ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 + if (ctr_responses[groupIndex] > 100): + return buildOkResponse("[]") - if (ctr_responses[groupIndex] > 100): - return buildOkResponse("[]") + seqNr = (ctr_responses[groupIndex] - 1) + nodeIndex = 0 + nodeName = createNodeName(nodeIndex) + fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") + msg = getEventHead(groupIndex, changeId, nodeName) + getEventName(fileName, ftpType, "onap", "pano", + nodeIndex) + getEventEnd() + fileMap[groupIndex][seqNr * hash(filePrefix)] = seqNr + ctr_events[groupIndex] = ctr_events[groupIndex] + 1 + return buildOkResponse("[" + msg + "]") - seqNr = (ctr_responses[groupIndex]-1) - nodeIndex=0 - nodeName = createNodeName(nodeIndex) - fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") - msg = getEventHead(groupIndex, changeId, nodeName) + getEventName(fileName,ftpType,"onap","pano",nodeIndex) + getEventEnd() - fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr - ctr_events[groupIndex] = ctr_events[groupIndex]+1 - return buildOkResponse("["+msg+"]") def tc111(groupIndex, changeId, filePrefix, ftpType): - global ctr_responses - global ctr_events + global ctr_responses + global ctr_events + ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 - ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 + if (ctr_responses[groupIndex] > 100): + return buildOkResponse("[]") - if (ctr_responses[groupIndex] > 100): - return buildOkResponse("[]") + nodeIndex = 0 + nodeName = createNodeName(nodeIndex) + msg = getEventHead(groupIndex, changeId, nodeName) - nodeIndex=0 - nodeName = createNodeName(nodeIndex) - msg = getEventHead(groupIndex, changeId, nodeName) + for i in range(100): + seqNr = i + (ctr_responses[groupIndex] - 1) + if i != 0: msg = msg + "," + fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") + msg = msg + getEventName(fileName, ftpType, "onap", "pano", nodeIndex) + fileMap[groupIndex][seqNr * hash(filePrefix)] = seqNr - for i in range(100): - seqNr = i+(ctr_responses[groupIndex]-1) - if i != 0: msg = msg + "," - fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") - msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) - fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr + msg = msg + getEventEnd() + ctr_events[groupIndex] = ctr_events[groupIndex] + 1 - msg = msg + getEventEnd() - ctr_events[groupIndex] = ctr_events[groupIndex]+1 + return buildOkResponse("[" + msg + "]") - return buildOkResponse("["+msg+"]") def tc112(groupIndex, changeId, filePrefix, ftpType): - global ctr_responses - global ctr_events + global ctr_responses + global ctr_events + ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 - ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 + if (ctr_responses[groupIndex] > 100): + return buildOkResponse("[]") - if (ctr_responses[groupIndex] > 100): - return buildOkResponse("[]") + nodeIndex = 0 + nodeName = createNodeName(nodeIndex) + msg = getEventHead(groupIndex, changeId, nodeName) - nodeIndex=0 - nodeName = createNodeName(nodeIndex) - msg = getEventHead(groupIndex, changeId, nodeName) + for i in range(100): + seqNr = i + (ctr_responses[groupIndex] - 1) + if i != 0: msg = msg + "," + fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "5MB") + msg = msg + getEventName(fileName, ftpType, "onap", "pano", nodeIndex) + fileMap[groupIndex][seqNr * hash(filePrefix)] = seqNr - for i in range(100): - seqNr = i+(ctr_responses[groupIndex]-1) - if i != 0: msg = msg + "," - fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "5MB") - msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) - fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr + msg = msg + getEventEnd() + ctr_events[groupIndex] = ctr_events[groupIndex] + 1 - msg = msg + getEventEnd() - ctr_events[groupIndex] = ctr_events[groupIndex]+1 + return buildOkResponse("[" + msg + "]") - return buildOkResponse("["+msg+"]") def tc113(groupIndex, changeId, filePrefix, ftpType): - global ctr_responses - global ctr_events - + global ctr_responses + global ctr_events - ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 + ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 - if (ctr_responses[groupIndex] > 1): - return buildOkResponse("[]") + if (ctr_responses[groupIndex] > 1): + return buildOkResponse("[]") - nodeIndex=0 - nodeName = createNodeName(nodeIndex) - msg = "" + nodeIndex = 0 + nodeName = createNodeName(nodeIndex) + msg = "" - for evts in range(100): # build 100 evts - if (evts > 0): - msg = msg + "," - msg = msg + getEventHead(groupIndex, changeId, nodeName) - for i in range(100): # build 100 files - seqNr = i+evts+100*(ctr_responses[groupIndex]-1) - if i != 0: msg = msg + "," - fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") - msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) - fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr + for evts in range(100): # build 100 evts + if (evts > 0): + msg = msg + "," + msg = msg + getEventHead(groupIndex, changeId, nodeName) + for i in range(100): # build 100 files + seqNr = i + evts + 100 * (ctr_responses[groupIndex] - 1) + if i != 0: msg = msg + "," + fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") + msg = msg + getEventName(fileName, ftpType, "onap", "pano", nodeIndex) + fileMap[groupIndex][seqNr * hash(filePrefix)] = seqNr - msg = msg + getEventEnd() - ctr_events[groupIndex] = ctr_events[groupIndex]+1 + msg = msg + getEventEnd() + ctr_events[groupIndex] = ctr_events[groupIndex] + 1 - return buildOkResponse("["+msg+"]") + return buildOkResponse("[" + msg + "]") def tc120(groupIndex, changeId, filePrefix, ftpType): - global ctr_responses - global ctr_events - + global ctr_responses + global ctr_events - ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 + ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 - nodeIndex=0 - nodeName = createNodeName(nodeIndex) + nodeIndex = 0 + nodeName = createNodeName(nodeIndex) - if (ctr_responses[groupIndex] > 100): - return buildOkResponse("[]") + if (ctr_responses[groupIndex] > 100): + return buildOkResponse("[]") - if (ctr_responses[groupIndex] % 10 == 2): - return # Return nothing + if (ctr_responses[groupIndex] % 10 == 2): + return # Return nothing - if (ctr_responses[groupIndex] % 10 == 3): - return buildOkResponse("") # Return empty message + if (ctr_responses[groupIndex] % 10 == 3): + return buildOkResponse("") # Return empty message - if (ctr_responses[groupIndex] % 10 == 4): - return buildOkResponse(getEventHead(groupIndex, changeId, nodeName)) # Return part of a json event + if (ctr_responses[groupIndex] % 10 == 4): + return buildOkResponse(getEventHead(groupIndex, changeId, nodeName)) # Return part of a json event - if (ctr_responses[groupIndex] % 10 == 5): - return buildEmptyResponse(404) # Return empty message with status code + if (ctr_responses[groupIndex] % 10 == 5): + return buildEmptyResponse(404) # Return empty message with status code - if (ctr_responses[groupIndex] % 10 == 6): - sleep(60) + if (ctr_responses[groupIndex] % 10 == 6): + sleep(60) + msg = getEventHead(groupIndex, changeId, nodeName) - msg = getEventHead(groupIndex, changeId, nodeName) + for i in range(100): + seqNr = i + (ctr_responses[groupIndex] - 1) + if i != 0: msg = msg + "," + fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") + msg = msg + getEventName(fileName, ftpType, "onap", "pano", nodeIndex) + fileMap[groupIndex][seqNr * hash(filePrefix)] = seqNr - for i in range(100): - seqNr = i+(ctr_responses[groupIndex]-1) - if i != 0: msg = msg + "," - fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") - msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) - fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr + msg = msg + getEventEnd() + ctr_events[groupIndex] = ctr_events[groupIndex] + 1 - msg = msg + getEventEnd() - ctr_events[groupIndex] = ctr_events[groupIndex]+1 + return buildOkResponse("[" + msg + "]") - return buildOkResponse("["+msg+"]") def tc121(groupIndex, changeId, filePrefix, ftpType): - global ctr_responses - global ctr_events + global ctr_responses + global ctr_events + ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 - ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 + if (ctr_responses[groupIndex] > 100): + return buildOkResponse("[]") - if (ctr_responses[groupIndex] > 100): - return buildOkResponse("[]") + nodeIndex = 0 + nodeName = createNodeName(nodeIndex) + msg = getEventHead(groupIndex, changeId, nodeName) - nodeIndex=0 - nodeName = createNodeName(nodeIndex) - msg = getEventHead(groupIndex, changeId, nodeName) + fileName = "" + for i in range(100): + seqNr = i + (ctr_responses[groupIndex] - 1) + if (seqNr % 10 == 0): # Every 10th file is "missing" + fileName = createMissingFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") + else: + fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") + fileMap[groupIndex][seqNr * hash(filePrefix)] = seqNr - fileName = "" - for i in range(100): - seqNr = i+(ctr_responses[groupIndex]-1) - if (seqNr%10 == 0): # Every 10th file is "missing" - fileName = createMissingFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") - else: - fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") - fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr + if i != 0: msg = msg + "," + msg = msg + getEventName(fileName, ftpType, "onap", "pano", nodeIndex) - if i != 0: msg = msg + "," - msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) + msg = msg + getEventEnd() + ctr_events[groupIndex] = ctr_events[groupIndex] + 1 - msg = msg + getEventEnd() - ctr_events[groupIndex] = ctr_events[groupIndex]+1 + return buildOkResponse("[" + msg + "]") - return buildOkResponse("["+msg+"]") def tc122(groupIndex, changeId, filePrefix, ftpType): - global ctr_responses - global ctr_events - + global ctr_responses + global ctr_events - ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 + ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 - if (ctr_responses[groupIndex] > 100): - return buildOkResponse("[]") + if (ctr_responses[groupIndex] > 100): + return buildOkResponse("[]") - nodeIndex=0 - nodeName = createNodeName(nodeIndex) - msg = getEventHead(groupIndex, changeId, nodeName) + nodeIndex = 0 + nodeName = createNodeName(nodeIndex) + msg = getEventHead(groupIndex, changeId, nodeName) - for i in range(100): - fileName = createFileName(groupIndex, filePrefix, nodeName, 0, "1MB") # All files identical names - if i != 0: msg = msg + "," - msg = msg + getEventName(fileName,ftpType,"onap","pano", nodeIndex) + for i in range(100): + fileName = createFileName(groupIndex, filePrefix, nodeName, 0, "1MB") # All files identical names + if i != 0: msg = msg + "," + msg = msg + getEventName(fileName, ftpType, "onap", "pano", nodeIndex) - fileMap[groupIndex][0] = 0 - msg = msg + getEventEnd() - ctr_events[groupIndex] = ctr_events[groupIndex]+1 + fileMap[groupIndex][0] = 0 + msg = msg + getEventEnd() + ctr_events[groupIndex] = ctr_events[groupIndex] + 1 - return buildOkResponse("["+msg+"]") + return buildOkResponse("[" + msg + "]") def tc1000(groupIndex, changeId, filePrefix, ftpType): - global ctr_responses - global ctr_events + global ctr_responses + global ctr_events + ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 - ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 + nodeIndex = 0 + nodeName = createNodeName(nodeIndex) + msg = getEventHead(groupIndex, changeId, nodeName) - nodeIndex=0 - nodeName = createNodeName(nodeIndex) - msg = getEventHead(groupIndex, changeId, nodeName) + for i in range(100): + seqNr = i + (ctr_responses[groupIndex] - 1) + if i != 0: msg = msg + "," + fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") + msg = msg + getEventName(fileName, ftpType, "onap", "pano", nodeIndex) + fileMap[groupIndex][seqNr * hash(filePrefix)] = seqNr - for i in range(100): - seqNr = i+(ctr_responses[groupIndex]-1) - if i != 0: msg = msg + "," - fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") - msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) - fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr + msg = msg + getEventEnd() + ctr_events[groupIndex] = ctr_events[groupIndex] + 1 - msg = msg + getEventEnd() - ctr_events[groupIndex] = ctr_events[groupIndex]+1 + return buildOkResponse("[" + msg + "]") - return buildOkResponse("["+msg+"]") def tc1001(groupIndex, changeId, filePrefix, ftpType): - global ctr_responses - global ctr_events - + global ctr_responses + global ctr_events - ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 + ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 - nodeIndex=0 - nodeName = createNodeName(nodeIndex) - msg = getEventHead(groupIndex, changeId, nodeName) + nodeIndex = 0 + nodeName = createNodeName(nodeIndex) + msg = getEventHead(groupIndex, changeId, nodeName) - for i in range(100): - seqNr = i+(ctr_responses[groupIndex]-1) - if i != 0: msg = msg + "," - fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "5MB") - msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) - fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr + for i in range(100): + seqNr = i + (ctr_responses[groupIndex] - 1) + if i != 0: msg = msg + "," + fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "5MB") + msg = msg + getEventName(fileName, ftpType, "onap", "pano", nodeIndex) + fileMap[groupIndex][seqNr * hash(filePrefix)] = seqNr - msg = msg + getEventEnd() - ctr_events[groupIndex] = ctr_events[groupIndex]+1 + msg = msg + getEventEnd() + ctr_events[groupIndex] = ctr_events[groupIndex] + 1 - return buildOkResponse("["+msg+"]") + return buildOkResponse("[" + msg + "]") def tc1100(groupIndex, changeId, filePrefix, ftpType, filesize): - global ctr_responses - global ctr_events + global ctr_responses + global ctr_events + ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 - ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 + msg = "" - msg = "" + batch = (ctr_responses[groupIndex] - 1) % 20 - batch = (ctr_responses[groupIndex]-1)%20; + for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700 + if (pnfs > 0): + msg = msg + "," + nodeIndex = pnfs + batch * 35 + nodeName = createNodeName(nodeIndex) + msg = msg + getEventHead(groupIndex, changeId, nodeName) - for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700 - if (pnfs > 0): - msg = msg + "," - nodeIndex=pnfs + batch*35 - nodeName = createNodeName(nodeIndex) - msg = msg + getEventHead(groupIndex, changeId, nodeName) + for i in range(100): # 100 files per event + seqNr = i + int((ctr_responses[groupIndex] - 1) / 20) + if i != 0: msg = msg + "," + fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, filesize) + msg = msg + getEventName(fileName, ftpType, "onap", "pano", nodeIndex) + seqNr = seqNr + (pnfs + batch * 35) * 1000000 # Create unique id for this node and file + fileMap[groupIndex][seqNr * hash(filePrefix)] = seqNr - for i in range(100): # 100 files per event - seqNr = i + int((ctr_responses[groupIndex]-1)/20); - if i != 0: msg = msg + "," - fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, filesize) - msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) - seqNr = seqNr + (pnfs+batch*35)*1000000 #Create unique id for this node and file - fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr + msg = msg + getEventEnd() + ctr_events[groupIndex] = ctr_events[groupIndex] + 1 - msg = msg + getEventEnd() - ctr_events[groupIndex] = ctr_events[groupIndex]+1 + return buildOkResponse("[" + msg + "]") - return buildOkResponse("["+msg+"]") def tc1200(groupIndex, changeId, filePrefix, ftpType, filesize): - global ctr_responses - global ctr_events - + global ctr_responses + global ctr_events - ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 + ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 - msg = "" + msg = "" - batch = (ctr_responses[groupIndex]-1)%20; + batch = (ctr_responses[groupIndex] - 1) % 20 - for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700 - if (pnfs > 0): - msg = msg + "," - nodeIndex=pnfs + batch*35 - nodeName = createNodeName(nodeIndex) - msg = msg + getEventHead(groupIndex, changeId, nodeName) + for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700 + if (pnfs > 0): + msg = msg + "," + nodeIndex = pnfs + batch * 35 + nodeName = createNodeName(nodeIndex) + msg = msg + getEventHead(groupIndex, changeId, nodeName) - for i in range(100): # 100 files per event, all new files - seqNr = i+100 * int((ctr_responses[groupIndex]-1)/20); - if i != 0: msg = msg + "," - fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, filesize) - msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) - seqNr = seqNr + (pnfs+batch*35)*1000000 #Create unique id for this node and file - fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr + for i in range(100): # 100 files per event, all new files + seqNr = i + 100 * int((ctr_responses[groupIndex] - 1) / 20) + if i != 0: msg = msg + "," + fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, filesize) + msg = msg + getEventName(fileName, ftpType, "onap", "pano", nodeIndex) + seqNr = seqNr + (pnfs + batch * 35) * 1000000 # Create unique id for this node and file + fileMap[groupIndex][seqNr * hash(filePrefix)] = seqNr - msg = msg + getEventEnd() - ctr_events[groupIndex] = ctr_events[groupIndex]+1 + msg = msg + getEventEnd() + ctr_events[groupIndex] = ctr_events[groupIndex] + 1 - return buildOkResponse("["+msg+"]") + return buildOkResponse("[" + msg + "]") def tc1300(groupIndex, changeId, filePrefix, ftpType, filesize): - global ctr_responses - global ctr_events - global rop_counter - global rop_timestamp + global ctr_responses + global ctr_events + global rop_counter + global rop_timestamp - if (rop_counter == 0): - rop_timestamp = time.time() + if (rop_counter == 0): + rop_timestamp = time.time() - ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 + ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 - #Start a event deliver for all 700 nodes every 15min - rop = time.time()-rop_timestamp - if ((rop < 900) & (rop_counter%20 == 0) & (rop_counter != 0)): - return buildOkResponse("[]") - else: - if (rop_counter%20 == 0) & (rop_counter > 0): - rop_timestamp = rop_timestamp+900 + # Start a event deliver for all 700 nodes every 15min + rop = time.time() - rop_timestamp + if ((rop < 900) & (rop_counter % 20 == 0) & (rop_counter != 0)): + return buildOkResponse("[]") + else: + if (rop_counter % 20 == 0) & (rop_counter > 0): + rop_timestamp = rop_timestamp + 900 - rop_counter = rop_counter+1 + rop_counter = rop_counter + 1 - msg = "" + msg = "" - batch = (rop_counter-1)%20; + batch = (rop_counter - 1) % 20 - for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700 - if (pnfs > 0): - msg = msg + "," - nodeIndex=pnfs + batch*35 - nodeName = createNodeName(nodeIndex) - msg = msg + getEventHead(groupIndex, changeId, nodeName) + for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700 + if (pnfs > 0): + msg = msg + "," + nodeIndex = pnfs + batch * 35 + nodeName = createNodeName(nodeIndex) + msg = msg + getEventHead(groupIndex, changeId, nodeName) - for i in range(100): # 100 files per event - seqNr = i + int((rop_counter-1)/20); - if i != 0: msg = msg + "," - fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, filesize) - msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) - seqNr = seqNr + (pnfs+batch*35)*1000000 #Create unique id for this node and file - fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr + for i in range(100): # 100 files per event + seqNr = i + int((rop_counter - 1) / 20) + if i != 0: msg = msg + "," + fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, filesize) + msg = msg + getEventName(fileName, ftpType, "onap", "pano", nodeIndex) + seqNr = seqNr + (pnfs + batch * 35) * 1000000 # Create unique id for this node and file + fileMap[groupIndex][seqNr * hash(filePrefix)] = seqNr - msg = msg + getEventEnd() - ctr_events[groupIndex] = ctr_events[groupIndex]+1 + msg = msg + getEventEnd() + ctr_events[groupIndex] = ctr_events[groupIndex] + 1 + + return buildOkResponse("[" + msg + "]") - return buildOkResponse("["+msg+"]") def tc1500(groupIndex, changeId, filePrefix, ftpType, filesize): - global ctr_responses - global ctr_events - global rop_counter - global rop_timestamp + global ctr_responses + global ctr_events + global rop_counter + global rop_timestamp - if (rop_counter == 0): - rop_timestamp = time.time() + if (rop_counter == 0): + rop_timestamp = time.time() - ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 + ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 - if (ctr_responses[groupIndex] <= 2000 ): #first 25h of event doess not care of 15min rop timer + if (ctr_responses[groupIndex] <= 2000): # first 25h of event doess not care of 15min rop timer - msg = "" + msg = "" - batch = (ctr_responses[groupIndex]-1)%20; + batch = (ctr_responses[groupIndex] - 1) % 20 - for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700 - if (pnfs > 0): - msg = msg + "," + for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700 + if (pnfs > 0): + msg = msg + "," - nodeIndex=pnfs + batch*35 - nodeName = createNodeName(nodeIndex) - msg = msg + getEventHead(groupIndex, changeId, nodeName) + nodeIndex = pnfs + batch * 35 + nodeName = createNodeName(nodeIndex) + msg = msg + getEventHead(groupIndex, changeId, nodeName) - for i in range(100): # 100 files per event - seqNr = i + int((ctr_responses[groupIndex]-1)/20); - if i != 0: msg = msg + "," - if (seqNr < 100): - fileName = createMissingFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") - else: - fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") - seqNr = seqNr + (pnfs+batch*35)*1000000 #Create unique id for this node and file - fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr - msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) + for i in range(100): # 100 files per event + seqNr = i + int((ctr_responses[groupIndex] - 1) / 20) + if i != 0: msg = msg + "," + if (seqNr < 100): + fileName = createMissingFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") + else: + fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") + seqNr = seqNr + (pnfs + batch * 35) * 1000000 # Create unique id for this node and file + fileMap[groupIndex][seqNr * hash(filePrefix)] = seqNr + msg = msg + getEventName(fileName, ftpType, "onap", "pano", nodeIndex) + msg = msg + getEventEnd() + ctr_events[groupIndex] = ctr_events[groupIndex] + 1 - msg = msg + getEventEnd() - ctr_events[groupIndex] = ctr_events[groupIndex]+1 + rop_counter = rop_counter + 1 + return buildOkResponse("[" + msg + "]") - rop_counter = rop_counter+1 - return buildOkResponse("["+msg+"]") + # Start an event delivery for all 700 nodes every 15min + rop = time.time() - rop_timestamp + if ((rop < 900) & (rop_counter % 20 == 0) & (rop_counter != 0)): + return buildOkResponse("[]") + else: + if (rop_counter % 20 == 0): + rop_timestamp = time.time() - #Start an event delivery for all 700 nodes every 15min - rop = time.time()-rop_timestamp - if ((rop < 900) & (rop_counter%20 == 0) & (rop_counter != 0)): - return buildOkResponse("[]") - else: - if (rop_counter%20 == 0): - rop_timestamp = time.time() + rop_counter = rop_counter + 1 - rop_counter = rop_counter+1 + msg = "" - msg = "" + batch = (rop_counter - 1) % 20 - batch = (rop_counter-1)%20; + for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700 + if (pnfs > 0): + msg = msg + "," + nodeIndex = pnfs + batch * 35 + nodeName = createNodeName(nodeIndex) + msg = msg + getEventHead(groupIndex, changeId, nodeName) - for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700 - if (pnfs > 0): - msg = msg + "," - nodeIndex=pnfs + batch*35 - nodeName = createNodeName(nodeIndex) - msg = msg + getEventHead(groupIndex, changeId, nodeName) + for i in range(100): # 100 files per event + seqNr = i + int((rop_counter - 1) / 20) + if i != 0: msg = msg + "," + fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, filesize) + msg = msg + getEventName(fileName, ftpType, "onap", "pano", nodeIndex) + seqNr = seqNr + (pnfs + batch * 35) * 1000000 # Create unique id for this node and file + fileMap[groupIndex][seqNr * hash(filePrefix)] = seqNr - for i in range(100): # 100 files per event - seqNr = i + int((rop_counter-1)/20); - if i != 0: msg = msg + "," - fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, filesize) - msg = msg + getEventName(fileName,ftpType,"onap","pano", nodeIndex) - seqNr = seqNr + (pnfs+batch*35)*1000000 #Create unique id for this node and file - fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr + msg = msg + getEventEnd() + ctr_events[groupIndex] = ctr_events[groupIndex] + 1 - msg = msg + getEventEnd() - ctr_events[groupIndex] = ctr_events[groupIndex]+1 + return buildOkResponse("[" + msg + "]") - return buildOkResponse("["+msg+"]") def tc500(groupIndex, changeId, filePrefix, ftpType, filesize): - global ctr_responses - global ctr_events - + global ctr_responses + global ctr_events - ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 + ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 - if (ctr_responses[groupIndex] > 1): - return buildOkResponse("[]") + if (ctr_responses[groupIndex] > 1): + return buildOkResponse("[]") - msg = "" + msg = "" + for pnfs in range(700): + if (pnfs > 0): + msg = msg + "," + nodeName = createNodeName(pnfs) + msg = msg + getEventHead(groupIndex, changeId, nodeName) - for pnfs in range(700): - if (pnfs > 0): - msg = msg + "," - nodeName = createNodeName(pnfs) - msg = msg + getEventHead(groupIndex, changeId, nodeName) + for i in range(2): + seqNr = i + if i != 0: msg = msg + "," + fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, filesize) + msg = msg + getEventName(fileName, ftpType, "onap", "pano", pnfs) + seqNr = seqNr + pnfs * 1000000 # Create unique id for this node and file + fileMap[groupIndex][seqNr * hash(filePrefix)] = seqNr - for i in range(2): - seqNr = i; - if i != 0: msg = msg + "," - fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, filesize) - msg = msg + getEventName(fileName,ftpType,"onap","pano",pnfs) - seqNr = seqNr + pnfs*1000000 #Create unique id for this node and file - fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr + msg = msg + getEventEnd() + ctr_events[groupIndex] = ctr_events[groupIndex] + 1 - msg = msg + getEventEnd() - ctr_events[groupIndex] = ctr_events[groupIndex]+1 + return buildOkResponse("[" + msg + "]") - return buildOkResponse("["+msg+"]") def tc510(groupIndex, changeId, filePrefix, ftpType, fileSize): - global ctr_responses - global ctr_events + global ctr_responses + global ctr_events + ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 - ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 + if (ctr_responses[groupIndex] > 5): + return buildOkResponse("[]") - if (ctr_responses[groupIndex] > 5): - return buildOkResponse("[]") + msg = "" - msg = "" + for pnfs in range(700): # build events for 700 MEs + if (pnfs > 0): + msg = msg + "," + nodeName = createNodeName(pnfs) + msg = msg + getEventHead(groupIndex, changeId, nodeName) + seqNr = (ctr_responses[groupIndex] - 1) + fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, fileSize) + msg = msg + getEventName(fileName, ftpType, "onap", "pano", pnfs) + seqNr = seqNr + pnfs * 1000000 # Create unique id for this node and file + fileMap[groupIndex][seqNr * hash(filePrefix)] = seqNr + msg = msg + getEventEnd() + ctr_events[groupIndex] = ctr_events[groupIndex] + 1 - for pnfs in range(700): # build events for 700 MEs - if (pnfs > 0): - msg = msg + "," - nodeName = createNodeName(pnfs) - msg = msg + getEventHead(groupIndex, changeId, nodeName) - seqNr = (ctr_responses[groupIndex]-1) - fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, fileSize) - msg = msg + getEventName(fileName,ftpType,"onap","pano",pnfs) - seqNr = seqNr + pnfs*1000000 #Create unique id for this node and file - fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr - msg = msg + getEventEnd() - ctr_events[groupIndex] = ctr_events[groupIndex]+1 + return buildOkResponse("[" + msg + "]") - return buildOkResponse("["+msg+"]") def tc511(groupIndex, changeId, filePrefix, ftpType, fileSize): - global ctr_responses - global ctr_events + global ctr_responses + global ctr_events + ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 - ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 + if (ctr_responses[groupIndex] > 5): + return buildOkResponse("[]") - if (ctr_responses[groupIndex] > 5): - return buildOkResponse("[]") + msg = "" - msg = "" + for pnfs in range(700): # build events for 700 MEs + if (pnfs > 0): + msg = msg + "," + nodeName = createNodeName(pnfs) + msg = msg + getEventHead(groupIndex, changeId, nodeName) + seqNr = (ctr_responses[groupIndex] - 1) + fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, fileSize) + msg = msg + getEventName(fileName, ftpType, "onap", "pano", pnfs) + seqNr = seqNr + pnfs * 1000000 # Create unique id for this node and file + fileMap[groupIndex][seqNr * hash(filePrefix)] = seqNr + msg = msg + getEventEnd() + ctr_events[groupIndex] = ctr_events[groupIndex] + 1 - for pnfs in range(700): # build events for 700 MEs - if (pnfs > 0): - msg = msg + "," - nodeName = createNodeName(pnfs) - msg = msg + getEventHead(groupIndex, changeId, nodeName) - seqNr = (ctr_responses[groupIndex]-1) - fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, fileSize) - msg = msg + getEventName(fileName,ftpType,"onap","pano",pnfs) - seqNr = seqNr + pnfs*1000000 #Create unique id for this node and file - fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr - msg = msg + getEventEnd() - ctr_events[groupIndex] = ctr_events[groupIndex]+1 + return buildOkResponse("[" + msg + "]") - return buildOkResponse("["+msg+"]") def tc710(groupIndex, changeId, filePrefix, ftpType): - global ctr_responses - global ctr_events - + global ctr_responses + global ctr_events - ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 + ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 - if (ctr_responses[groupIndex] > 100): - return buildOkResponse("[]") + if (ctr_responses[groupIndex] > 100): + return buildOkResponse("[]") - msg = "" + msg = "" - batch = (ctr_responses[groupIndex]-1)%20; + batch = (ctr_responses[groupIndex] - 1) % 20 - for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700 - if (pnfs > 0): - msg = msg + "," - nodeIndex=pnfs + batch*35 - nodeName = createNodeName(nodeIndex) - msg = msg + getEventHead(groupIndex, changeId, nodeName) + for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700 + if (pnfs > 0): + msg = msg + "," + nodeIndex = pnfs + batch * 35 + nodeName = createNodeName(nodeIndex) + msg = msg + getEventHead(groupIndex, changeId, nodeName) - for i in range(100): # 100 files per event - seqNr = i + int((ctr_responses[groupIndex]-1)/20); - if i != 0: msg = msg + "," - fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") - msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) - seqNr = seqNr + (pnfs+batch*35)*1000000 #Create unique id for this node and file - fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr + for i in range(100): # 100 files per event + seqNr = i + int((ctr_responses[groupIndex] - 1) / 20) + if i != 0: msg = msg + "," + fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") + msg = msg + getEventName(fileName, ftpType, "onap", "pano", nodeIndex) + seqNr = seqNr + (pnfs + batch * 35) * 1000000 # Create unique id for this node and file + fileMap[groupIndex][seqNr * hash(filePrefix)] = seqNr - msg = msg + getEventEnd() - ctr_events[groupIndex] = ctr_events[groupIndex]+1 + msg = msg + getEventEnd() + ctr_events[groupIndex] = ctr_events[groupIndex] + 1 - return buildOkResponse("["+msg+"]") + return buildOkResponse("[" + msg + "]") #### Functions to build json messages and respones #### def createNodeName(index): - return "PNF"+str(index); + return "PNF" + str(index) + def createFileName(groupIndex, filePrefix, nodeName, index, size): global ctr_files ctr_files[groupIndex] = ctr_files[groupIndex] + 1 - return filePrefix+"20000626.2315+0200-2330+0200_" + nodeName + "-" + str(index) + "-" +size + ".tar.gz"; + return filePrefix + "20000626.2315+0200-2330+0200_" + nodeName + "-" + str(index) + "-" + size + ".tar.gz" + def createMissingFileName(groupIndex, filePrefix, nodeName, index, size): global ctr_files ctr_files[groupIndex] = ctr_files[groupIndex] + 1 - return filePrefix+"MissingFile_" + nodeName + "-" + str(index) + "-" +size + ".tar.gz"; + return filePrefix + "MissingFile_" + nodeName + "-" + str(index) + "-" + size + ".tar.gz" # Function to build fixed beginning of an event def getEventHead(groupIndex, changeId, nodename): - global pnfMap - pnfMap[groupIndex].add(nodename) - headStr = """ + global pnfMap + pnfMap[groupIndex].add(nodename) + headStr = """ { "event": { "commonEventHeader": { @@ -1146,31 +1172,34 @@ def getEventHead(groupIndex, changeId, nodename): "changeIdentifier": \"""" + changeId + """", "arrayOfNamedHashMap": [ """ - return headStr + return headStr + # Function to build the variable part of an event -def getEventName(fn,type,user,passwd, nodeIndex): - nodeIndex=nodeIndex%num_ftp_servers +def getEventName(fn, type, user, passwd, nodeIndex): + nodeIndex = nodeIndex % num_ftp_servers port = sftp_ports[nodeIndex] ip = sftp_hosts[nodeIndex] - if (type == "ftps"): - port = ftps_ports[nodeIndex] - ip = ftps_hosts[nodeIndex] + if (type == "ftpes"): + port = ftpes_ports[nodeIndex] + ip = ftpes_hosts[nodeIndex] - nameStr = """{ + nameStr = """{ "name": \"""" + fn + """", "hashMap": { "fileFormatType": "org.3GPP.32.435#measCollec", - "location": \"""" + type + """://""" + user + """:""" + passwd + """@""" + ip + """:""" + str(port) + """/""" + fn + """", + "location": \"""" + type + """://""" + user + """:""" + passwd + """@""" + ip + """:""" + str( + port) + """/""" + fn + """", "fileFormatVersion": "V10", "compression": "gzip" } } """ return nameStr + # Function to build fixed end of an event def getEventEnd(): - endStr = """ + endStr = """ ] } } @@ -1178,100 +1207,102 @@ def getEventEnd(): """ return endStr + # Function to build an OK reponse from a message string def buildOkResponse(msg): - response = app.response_class( - response=str.encode(msg), - status=200, - mimetype='application/json') - return response + response = app.response_class( + response=str.encode(msg), + status=200, + mimetype='application/json') + return response + # Function to build an empty message with status def buildEmptyResponse(status_code): - response = app.response_class( - response=str.encode(""), - status=status_code, - mimetype='application/json') - return response + response = app.response_class( + response=str.encode(""), + status=status_code, + mimetype='application/json') + return response if __name__ == "__main__": # IP addresses to use for ftp servers, using localhost if not env var is set sftp_sims = os.environ.get('SFTP_SIMS', 'localhost:1022') - ftps_sims = os.environ.get('FTPS_SIMS', 'localhost:21') + ftpes_sims = os.environ.get('FTPES_SIMS', 'localhost:21') num_ftp_servers = int(os.environ.get('NUM_FTP_SERVERS', 1)) print("Configured sftp sims: " + sftp_sims) - print("Configured ftps sims: " + ftps_sims) + print("Configured ftpes sims: " + ftpes_sims) print("Configured number of ftp servers: " + str(num_ftp_servers)) - tmp=sftp_sims.split(',') + tmp = sftp_sims.split(',') for i in range(len(tmp)): - hp=tmp[i].split(':') + hp = tmp[i].split(':') sftp_hosts.append(hp[0]) sftp_ports.append(hp[1]) - tmp=ftps_sims.split(',') + tmp = ftpes_sims.split(',') for i in range(len(tmp)): - hp=tmp[i].split(':') - ftps_hosts.append(hp[0]) - ftps_ports.append(hp[1]) + hp = tmp[i].split(':') + ftpes_hosts.append(hp[0]) + ftpes_ports.append(hp[1]) groups = os.environ.get('MR_GROUPS', 'OpenDcae-c12:PM_MEAS_FILES') - print("Groups detected: " + groups ) + print("Groups detected: " + groups) configuredPrefixes = os.environ.get('MR_FILE_PREFIX_MAPPING', 'PM_MEAS_FILES:A') - if (len(groups) == 0 ): - groups='OpenDcae-c12:PM_MEAS_FILES' + if not groups: + groups = 'OpenDcae-c12:PM_MEAS_FILES' print("Using default group: " + groups) else: print("Configured groups: " + groups) - if (len(configuredPrefixes) == 0 ): - configuredPrefixes='PM_MEAS_FILES:A' + if not configuredPrefixes: + configuredPrefixes = 'PM_MEAS_FILES:A' print("Using default changeid to file prefix mapping: " + configuredPrefixes) else: print("Configured changeid to file prefix mapping: " + configuredPrefixes) - #Counters + # Counters ctr_responses = [] ctr_requests = [] - ctr_files=[] + ctr_files = [] ctr_events = [] startTime = time.time() firstPollTime = [] runningState = "Started" - #Keeps all responded file names + # Keeps all responded file names fileMap = [] - #Keeps all responded PNF names + # Keeps all responded PNF names pnfMap = [] - #Handles rop periods for tests that deliveres events every 15 min + # Handles rop periods for tests that deliveres events every 15 min rop_counter = 0 rop_timestamp = time.time() - #List of configured group names + # List of configured group names groupNames = [] - #Mapping between group name and index in groupNames + # Mapping between group name and index in groupNames groupNameIndexes = {} - #String of configured groups + # String of configured groups configuredGroups = "" - #String of configured change identifiers + # String of configured change identifiers configuredChangeIds = "" - #List of changed identifiers + # List of changed identifiers changeIds = [] - #List of filePrefixes + # List of filePrefixes filePrefixes = {} - tmp=groups.split(',') + tmp = groups.split(',') for i in range(len(tmp)): - g=tmp[i].split(':') + g = tmp[i].split(':') for j in range(len(g)): g[j] = g[j].strip() if (j == 0): - if (len(configuredGroups) > 0): - configuredGroups=configuredGroups+"," - configuredGroups=configuredGroups+g[0] + if configuredGroups: + configuredGroups = configuredGroups + "," + configuredGroups = configuredGroups + g[0] groupNames.append(g[0]) groupNameIndexes[g[0]] = i changeIds.append({}) @@ -1282,18 +1313,18 @@ if __name__ == "__main__": firstPollTime.append(0) pnfMap.append(set()) fileMap.append({}) - if (len(configuredChangeIds) > 0): - configuredChangeIds=configuredChangeIds+"," + if configuredGroups: + configuredChangeIds = configuredChangeIds + "," else: - changeIds[i][j-1]=g[j] + changeIds[i][j - 1] = g[j] if (j > 1): - configuredChangeIds=configuredChangeIds+":" - configuredChangeIds=configuredChangeIds+g[j] + configuredChangeIds = configuredChangeIds + ":" + configuredChangeIds = configuredChangeIds + g[j] # Create a map between changeid and file name prefix - tmp=configuredPrefixes.split(',') + tmp = configuredPrefixes.split(',') for i in range(len(tmp)): - p=tmp[i].split(':') + p = tmp[i].split(':') filePrefixes[p[0]] = p[1] tc_num = "Not set" @@ -1301,7 +1332,7 @@ if __name__ == "__main__": parser = argparse.ArgumentParser() -#SFTP TCs with single ME + # SFTP TCs with single ME parser.add_argument( '--tc100', action='store_true', @@ -1354,7 +1385,7 @@ if __name__ == "__main__": action='store_true', help='TC1001 - One ME, SFTP, 5MB files, 100 files per event, endless number of events, 1 event per poll') -# SFTP TCs with multiple MEs + # SFTP TCs with multiple MEs parser.add_argument( '--tc500', action='store_true', @@ -1434,143 +1465,140 @@ if __name__ == "__main__": action='store_true', help='TC1500 - 700 ME, SFTP, 1MB files, 100 files per event, 35 events per poll, simulating 25h backlog of decreasing number of outdated files and then 20 event polls every 15min for 1h') -# FTPS TCs with single ME + # FTPES TCs with single ME parser.add_argument( '--tc200', action='store_true', - help='TC200 - One ME, FTPS, 1 1MB file, 1 event') + help='TC200 - One ME, FTPES, 1 1MB file, 1 event') parser.add_argument( '--tc201', action='store_true', - help='TC201 - One ME, FTPS, 1 5MB file, 1 event') + help='TC201 - One ME, FTPES, 1 5MB file, 1 event') parser.add_argument( '--tc202', action='store_true', - help='TC202 - One ME, FTPS, 1 50MB file, 1 event') + help='TC202 - One ME, FTPES, 1 50MB file, 1 event') parser.add_argument( '--tc210', action='store_true', - help='TC210 - One ME, FTPS, 1MB files, 1 file per event, 100 events, 1 event per poll.') + help='TC210 - One ME, FTPES, 1MB files, 1 file per event, 100 events, 1 event per poll.') parser.add_argument( '--tc211', action='store_true', - help='TC211 - One ME, FTPS, 1MB files, 100 files per event, 100 events, 1 event per poll.') + help='TC211 - One ME, FTPES, 1MB files, 100 files per event, 100 events, 1 event per poll.') parser.add_argument( '--tc212', action='store_true', - help='TC212 - One ME, FTPS, 5MB files, 100 files per event, 100 events, 1 event per poll.') + help='TC212 - One ME, FTPES, 5MB files, 100 files per event, 100 events, 1 event per poll.') parser.add_argument( '--tc213', action='store_true', - help='TC213 - One ME, FTPS, 1MB files, 100 files per event, 100 events. All events in one poll.') + help='TC213 - One ME, FTPES, 1MB files, 100 files per event, 100 events. All events in one poll.') parser.add_argument( '--tc220', action='store_true', - help='TC220 - One ME, FTPS, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% of replies each: no response, empty message, slow response, 404-error, malformed json') + help='TC220 - One ME, FTPES, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% of replies each: no response, empty message, slow response, 404-error, malformed json') parser.add_argument( '--tc221', action='store_true', - help='TC221 - One ME, FTPS, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% missing files') + help='TC221 - One ME, FTPES, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% missing files') parser.add_argument( '--tc222', action='store_true', - help='TC222 - One ME, FTPS, 1MB files, 100 files per event, 100 events. 1 event per poll. All files with identical name. ') + help='TC222 - One ME, FTPES, 1MB files, 100 files per event, 100 events. 1 event per poll. All files with identical name. ') parser.add_argument( '--tc2000', action='store_true', - help='TC2000 - One ME, FTPS, 1MB files, 100 files per event, endless number of events, 1 event per poll') + help='TC2000 - One ME, FTPES, 1MB files, 100 files per event, endless number of events, 1 event per poll') parser.add_argument( '--tc2001', action='store_true', - help='TC2001 - One ME, FTPS, 5MB files, 100 files per event, endless number of events, 1 event per poll') - + help='TC2001 - One ME, FTPES, 5MB files, 100 files per event, endless number of events, 1 event per poll') parser.add_argument( '--tc2100', action='store_true', - help='TC2100 - 700 ME, FTPS, 1MB files, 100 files per event, endless number of events, 35 event per poll') + help='TC2100 - 700 ME, FTPES, 1MB files, 100 files per event, endless number of events, 35 event per poll') parser.add_argument( '--tc2101', action='store_true', - help='TC2101 - 700 ME, FTPS, 5MB files, 100 files per event, endless number of events, 35 event per poll') + help='TC2101 - 700 ME, FTPES, 5MB files, 100 files per event, endless number of events, 35 event per poll') parser.add_argument( '--tc2102', action='store_true', - help='TC2102 - 700 ME, FTPS, 50MB files, 100 files per event, endless number of events, 35 event per poll') + help='TC2102 - 700 ME, FTPES, 50MB files, 100 files per event, endless number of events, 35 event per poll') parser.add_argument( '--tc2200', action='store_true', - help='TC2200 - 700 ME, FTPS, 1MB files, 100 new files per event, endless number of events, 35 event per poll') + help='TC2200 - 700 ME, FTPES, 1MB files, 100 new files per event, endless number of events, 35 event per poll') parser.add_argument( '--tc2201', action='store_true', - help='TC2201 - 700 ME, FTPS, 5MB files, 100 new files per event, endless number of events, 35 event per poll') + help='TC2201 - 700 ME, FTPES, 5MB files, 100 new files per event, endless number of events, 35 event per poll') parser.add_argument( '--tc2202', action='store_true', - help='TC2202 - 700 ME, FTPS, 50MB files, 100 new files per event, endless number of events, 35 event per poll') + help='TC2202 - 700 ME, FTPES, 50MB files, 100 new files per event, endless number of events, 35 event per poll') parser.add_argument( '--tc2300', action='store_true', - help='TC2300 - 700 ME, FTPS, 1MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min') + help='TC2300 - 700 ME, FTPES, 1MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min') parser.add_argument( '--tc2301', action='store_true', - help='TC2301 - 700 ME, FTPS, 5MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min') + help='TC2301 - 700 ME, FTPES, 5MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min') parser.add_argument( '--tc2302', action='store_true', - help='TC2302 - 700 ME, FTPS, 50MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min') + help='TC2302 - 700 ME, FTPES, 50MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min') parser.add_argument( '--tc2500', action='store_true', - help='TC2500 - 700 ME, FTPS, 1MB files, 100 files per event, 35 events per poll, simulating 25h backlog of decreasing number of outdated files and then 20 event polls every 15min for 1h') + help='TC2500 - 700 ME, FTPES, 1MB files, 100 files per event, 35 events per poll, simulating 25h backlog of decreasing number of outdated files and then 20 event polls every 15min for 1h') parser.add_argument( '--tc600', action='store_true', - help='TC600 - 700 MEs, FTPS, 1MB files, 2 new files per event, 700 events, all event in one poll.') + help='TC600 - 700 MEs, FTPES, 1MB files, 2 new files per event, 700 events, all event in one poll.') parser.add_argument( '--tc601', action='store_true', - help='TC601 - 700 MEs, FTPS, 5MB files, 2 new files per event, 700 events, all event in one poll.') + help='TC601 - 700 MEs, FTPES, 5MB files, 2 new files per event, 700 events, all event in one poll.') parser.add_argument( '--tc602', action='store_true', - help='TC602 - 700 MEs, FTPS, 50MB files, 2 new files per event, 700 events, all event in one poll.') + help='TC602 - 700 MEs, FTPES, 50MB files, 2 new files per event, 700 events, all event in one poll.') parser.add_argument( '--tc610', action='store_true', - help='TC610 - 700 MEs, FTPS, 1MB files, 1 file per event, 3500 events, 700 event per poll.') + help='TC610 - 700 MEs, FTPES, 1MB files, 1 file per event, 3500 events, 700 event per poll.') parser.add_argument( '--tc611', action='store_true', - help='TC611 - 700 MEs, FTPS, 1KB files, 1 file per event, 3500 events, 700 event per poll.') + help='TC611 - 700 MEs, FTPES, 1KB files, 1 file per event, 3500 events, 700 event per poll.') parser.add_argument( '--tc650', action='store_true', - help='TC610 - 700 MEs, FTPS, 50MB files, 1 file per event, 3500 events, 700 event per poll.') + help='TC610 - 700 MEs, FTPES, 50MB files, 1 file per event, 3500 events, 700 event per poll.') parser.add_argument( '--tc810', action='store_true', - help='TC810 - 700 MEs, FTPS, 1MB files, 100 files per event, 3500 events, 35 event per poll.') + help='TC810 - 700 MEs, FTPES, 1MB files, 100 files per event, 3500 events, 35 event per poll.') args = parser.parse_args() - - if args.tc100: tc_num = "TC# 100" elif args.tc101: @@ -1711,23 +1739,27 @@ if __name__ == "__main__": print("TC num: " + tc_num) for i in range(len(sftp_hosts)): - print("Using " + str(sftp_hosts[i]) + ":" + str(sftp_ports[i]) + " for sftp server with index " + str(i) + " for sftp server address and port in file urls.") + print("Using " + str(sftp_hosts[i]) + ":" + str(sftp_ports[i]) + " for sftp server with index " + str( + i) + " for sftp server address and port in file urls.") - for i in range(len(ftps_hosts)): - print("Using " + str(ftps_hosts[i]) + ":" + str(ftps_ports[i]) + " for ftps server with index " + str(i) + " for ftps server address and port in file urls.") + for i in range(len(ftpes_hosts)): + print("Using " + str(ftpes_hosts[i]) + ":" + str(ftpes_ports[i]) + " for ftpes server with index " + str( + i) + " for ftpes server address and port in file urls.") print("Using up to " + str(num_ftp_servers) + " ftp servers, for each protocol for PNFs.") + def https_app(**kwargs): import ssl context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) context.load_cert_chain('cert/cert.pem', 'cert/key.pem') app.run(ssl_context=context, **kwargs) + from multiprocessing import Process kwargs = dict(host=HOST_IP) Process(target=https_app, kwargs=dict(kwargs, port=HOST_PORT_TLS), daemon=True).start() - app.run(port=HOST_PORT, host=HOST_IP) \ No newline at end of file + app.run(port=HOST_PORT, host=HOST_IP) diff --git a/test/mocks/datafilecollector-testharness/simulator-group/README.md b/test/mocks/datafilecollector-testharness/simulator-group/README.md index 1af9e3e80..a37c2fb8d 100644 --- a/test/mocks/datafilecollector-testharness/simulator-group/README.md +++ b/test/mocks/datafilecollector-testharness/simulator-group/README.md @@ -33,11 +33,11 @@ There are 5 different types of simulators. For futher details, see the README.md 4. The SFTP simulator(s) handles the ftp download requests. 5 of these simulators are always started and in the MR sim it is possible to configure the distrubution of files over these 5 servers (from 1 up to 5 severs). At start of the server, the server is populated with files to download. -5. The FTPS simulator(s) is the same as the SFTP except that it using the FTPS protocol. +5. The FTPES simulator(s) is the same as the SFTP except that it using the FTPES protocol. # Build the simulator images -Run the script `prepare-images.sh` to build the docker images for MR, DR and FTPS servers. +Run the script `prepare-images.sh` to build the docker images for MR, DR and FTPES servers. # Edit simulator env variables @@ -63,9 +63,9 @@ Do the manual steps to prepare the simulator images: - Run the docker build command to build the image for the MR simulator: 'docker build -t mrsim:latest .' - cd ../dr-sim - Run the docker build command to build the image for the DR simulators: \`docker build -t drsim_common:latest .' -- cd ../ftps-sftp-server -- Check the README.md in ftps-sftp-server dir in case the cert need to be updated. -- Run the docker build command to build the image for the DR simulators: \`docker build -t ftps_vsftpd:latest -f Dockerfile-ftps .' +- cd ../ftpes-sftp-server +- Check the README.md in ftpes-sftp-server dir in case the cert need to be updated. +- Run the docker build command to build the image for the DR simulators: \`docker build -t ftpes_vsftpd:latest -f Dockerfile-ftpes .' ## Execution @@ -91,16 +91,16 @@ NUM_PNFS="2" #Two PNFs To minimize the number of ftp file creation, the following two variables can be configured in the same file. FILE_SIZE="1MB" #File size for FTP file (1KB, 1MB, 5MB, 50MB or ALL) -FTP_TYPE="SFTP" #Type of FTP files to generate (SFTP, FTPS or ALL) +FTP_TYPE="SFTP" #Type of FTP files to generate (SFTP, FTPES or ALL) -If `FTP_TYPE` is set to `ALL`, both ftp servers will be populated with the same files. If set to `SFTP` or `FTPS` then only the server serving that protocol will be populated with files. +If `FTP_TYPE` is set to `ALL`, both ftp servers will be populated with the same files. If set to `SFTP` or `FTPES` then only the server serving that protocol will be populated with files. Run the script `docker-compose-setup.sh`to create a docker-compose with the desired settings. The desired setting in the script need to be manually adapted to for each specific simulator behavior according to the above. Check each simulator for available parameters. All simulators will be started with the generated docker-compose.yml file -To generate ftp url with IP different from localhost, set SFTP_SIM_IP and/or FTPS_SIM_IP env variables to the addreses of the ftp servers before starting. +To generate ftp url with IP different from localhost, set SFTP_SIM_IP and/or FTPES_SIM_IP env variables to the addreses of the ftp servers before starting. So farm, this only works when the simulator python script is started from the command line. Kill all the containers with `simulators-kill.se` diff --git a/test/mocks/datafilecollector-testharness/simulator-group/docker-compose-setup.sh b/test/mocks/datafilecollector-testharness/simulator-group/docker-compose-setup.sh index b212fc26c..e6df022ce 100755 --- a/test/mocks/datafilecollector-testharness/simulator-group/docker-compose-setup.sh +++ b/test/mocks/datafilecollector-testharness/simulator-group/docker-compose-setup.sh @@ -16,12 +16,12 @@ export DR_REDIR_FEEDS="1:A,2:B,3:C,4:D" # Comma-separated of &1 | grep vsFTPd) if ! [ -z "$res" ]; then @@ -63,7 +63,7 @@ sudo chown $(id -u):$(id -g) consul sudo chown $(id -u):$(id -g) consul/consul/ declare -a SFTP_SIM -declare -a FTPS_SIM +declare -a FTPES_SIM DR_SIM="$(docker ps -q --filter='name=dfc_dr-sim')" DR_RD_SIM="$(docker ps -q --filter='name=dfc_dr-redir-sim')" @@ -73,11 +73,11 @@ SFTP_SIM[1]="$(docker ps -q --filter='name=dfc_sftp-server1')" SFTP_SIM[2]="$(docker ps -q --filter='name=dfc_sftp-server2')" SFTP_SIM[3]="$(docker ps -q --filter='name=dfc_sftp-server3')" SFTP_SIM[4]="$(docker ps -q --filter='name=dfc_sftp-server4')" -FTPS_SIM[0]="$(docker ps -q --filter='name=dfc_ftpes-server-vsftpd0')" -FTPS_SIM[1]="$(docker ps -q --filter='name=dfc_ftpes-server-vsftpd1')" -FTPS_SIM[2]="$(docker ps -q --filter='name=dfc_ftpes-server-vsftpd2')" -FTPS_SIM[3]="$(docker ps -q --filter='name=dfc_ftpes-server-vsftpd3')" -FTPS_SIM[4]="$(docker ps -q --filter='name=dfc_ftpes-server-vsftpd4')" +FTPES_SIM[0]="$(docker ps -q --filter='name=dfc_ftpes-server-vsftpd0')" +FTPES_SIM[1]="$(docker ps -q --filter='name=dfc_ftpes-server-vsftpd1')" +FTPES_SIM[2]="$(docker ps -q --filter='name=dfc_ftpes-server-vsftpd2')" +FTPES_SIM[3]="$(docker ps -q --filter='name=dfc_ftpes-server-vsftpd3')" +FTPES_SIM[4]="$(docker ps -q --filter='name=dfc_ftpes-server-vsftpd4')" CBS_SIM="$(docker ps -q --filter='name=dfc_cbs')" CONSUL_SIM="$(docker ps -q --filter='name=dfc_consul')" @@ -91,11 +91,11 @@ if [ $(docker inspect --format '{{ .State.Running }}' $DR_SIM) ] && \ [ $(docker inspect --format '{{ .State.Running }}' ${SFTP_SIM[2]}) ] && \ [ $(docker inspect --format '{{ .State.Running }}' ${SFTP_SIM[3]}) ] && \ [ $(docker inspect --format '{{ .State.Running }}' ${SFTP_SIM[4]}) ] && \ -[ $(docker inspect --format '{{ .State.Running }}' ${FTPS_SIM[0]}) ] && \ -[ $(docker inspect --format '{{ .State.Running }}' ${FTPS_SIM[1]}) ] && \ -[ $(docker inspect --format '{{ .State.Running }}' ${FTPS_SIM[2]}) ] && \ -[ $(docker inspect --format '{{ .State.Running }}' ${FTPS_SIM[3]}) ] && \ -[ $(docker inspect --format '{{ .State.Running }}' ${FTPS_SIM[4]}) ] && \ +[ $(docker inspect --format '{{ .State.Running }}' ${FTPES_SIM[0]}) ] && \ +[ $(docker inspect --format '{{ .State.Running }}' ${FTPES_SIM[1]}) ] && \ +[ $(docker inspect --format '{{ .State.Running }}' ${FTPES_SIM[2]}) ] && \ +[ $(docker inspect --format '{{ .State.Running }}' ${FTPES_SIM[3]}) ] && \ +[ $(docker inspect --format '{{ .State.Running }}' ${FTPES_SIM[4]}) ] && \ [ $(docker inspect --format '{{ .State.Running }}' $CBS_SIM) ] && \ [ $(docker inspect --format '{{ .State.Running }}' $CONSUL_SIM) ] then @@ -115,11 +115,11 @@ server_check "MR sim " 2222 "/" server_check_https "DR sim https " 3907 "/" server_check_https "DR redir sim https" 3909 "/" server_check_https "MR sim https " 2223 "/" -ftps_server_check "FTPS server 0" 1032 -ftps_server_check "FTPS server 1" 1033 -ftps_server_check "FTPS server 2" 1034 -ftps_server_check "FTPS server 3" 1035 -ftps_server_check "FTPS server 4" 1036 +ftpes_server_check "FTPES server 0" 1032 +ftpes_server_check "FTPES server 1" 1033 +ftpes_server_check "FTPES server 2" 1034 +ftpes_server_check "FTPES server 3" 1035 +ftpes_server_check "FTPES server 4" 1036 sftp_server_check "SFTP server 0" 1022 sftp_server_check "SFTP server 1" 1023 sftp_server_check "SFTP server 2" 1024 @@ -166,13 +166,13 @@ if [ $FTP_TYPE = "ALL" ] || [ $FTP_TYPE = "SFTP" ]; then let p=p+1 done fi -if [ $FTP_TYPE = "ALL" ] || [ $FTP_TYPE = "FTPS" ]; then - echo "Creating files for FTPS server, may take time...." +if [ $FTP_TYPE = "ALL" ] || [ $FTP_TYPE = "FTPES" ]; then + echo "Creating files for FTPES server, may take time...." p=0 while [ $p -lt $NUM_FTP_SERVERS ]; do - docker cp setup-ftp-files-for-image.sh ${FTPS_SIM[$p]}:/tmp/setup-ftp-files-for-image.sh + docker cp setup-ftp-files-for-image.sh ${FTPES_SIM[$p]}:/tmp/setup-ftp-files-for-image.sh #Double slash needed for docker on win... - docker exec -w //srv ${FTPS_SIM[$p]} //tmp/setup-ftp-files-for-image.sh $NUM_FTPFILES $NUM_PNFS $FILE_SIZE $FTP_FILE_PREFIXES $NUM_FTP_SERVERS $p #>/dev/null 2>&1 + docker exec -w //srv ${FTPES_SIM[$p]} //tmp/setup-ftp-files-for-image.sh $NUM_FTPFILES $NUM_PNFS $FILE_SIZE $FTP_FILE_PREFIXES $NUM_FTP_SERVERS $p #>/dev/null 2>&1 let p=p+1 done fi -- cgit 1.2.3-korg