diff options
author | TamasBakai <tamas.bakai@est.tech> | 2019-07-11 11:26:20 +0000 |
---|---|---|
committer | TamasBakai <tamas.bakai@est.tech> | 2019-07-11 11:26:20 +0000 |
commit | e781c7c4e4e385f504254d0fd32f534d559af3c2 (patch) | |
tree | d60321ac80db4f9513a5096d7055866bbe1dab03 | |
parent | e21a3c642c913a777c45b1e2c80d9cf8d32ec0c2 (diff) |
Mass PNF-sim unique VSFTPD PASV ports
Issue-ID: DCAEGEN2-1660
Change-Id: Ib742755f6a924ee9c5babe8e411311e7fe0e6802
Signed-off-by: TamasBakai <tamas.bakai@est.tech>
-rwxr-xr-x | test/mocks/mass-pnf-sim/mass-pnf-sim.py | 12 | ||||
-rw-r--r-- | test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/vsftpd_ssl-TEMPLATE.conf (renamed from test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/vsftpd_ssl.conf) | 6 | ||||
-rw-r--r-- | test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml | 7 | ||||
-rwxr-xr-x | test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh | 16 |
4 files changed, 30 insertions, 11 deletions
diff --git a/test/mocks/mass-pnf-sim/mass-pnf-sim.py b/test/mocks/mass-pnf-sim/mass-pnf-sim.py index a02e3fdd2..c3a17b0b1 100755 --- a/test/mocks/mass-pnf-sim/mass-pnf-sim.py +++ b/test/mocks/mass-pnf-sim/mass-pnf-sim.py @@ -76,6 +76,11 @@ if args.bootstrap and args.ipstart and args.urlves: print("Bootstrap:") start_port=2000 + ftps_pasv_port_start=8000 + ftps_pasv_port_num_of_ports=10 + + ftps_pasv_port_end=ftps_pasv_port_start + ftps_pasv_port_num_of_ports + for i in range(int(args.bootstrap)): print("PNF simulator instance: " + str(i) + ".") @@ -124,7 +129,9 @@ if args.bootstrap and args.ipstart and args.urlves: str(PortSftp) + " " + \ str(PortFtps) + " " + \ str(UrlFtps) + " " + \ - str(UrlSftp) + str(UrlSftp) + " " + \ + str(ftps_pasv_port_start) + " " + \ + str(ftps_pasv_port_end) completed = subprocess.run( 'set -x; cd ' + @@ -133,6 +140,9 @@ if args.bootstrap and args.ipstart and args.urlves: composercmd, shell=True) print('Cloning:', completed.stdout) + + ftps_pasv_port_start += ftps_pasv_port_num_of_ports + 1 + ftps_pasv_port_end += ftps_pasv_port_num_of_ports +1 completed = subprocess.run('set -x; cd pnf-sim-lightweight; ./simulator.sh build ', shell=True) print("Build docker image: ", completed.stdout) diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/vsftpd_ssl.conf b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/vsftpd_ssl-TEMPLATE.conf index 99d64dca0..75bb974a3 100644 --- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/vsftpd_ssl.conf +++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/vsftpd_ssl-TEMPLATE.conf @@ -34,8 +34,8 @@ hide_ids=YES connect_from_port_20=NO listen=YES tcp_wrappers=YES -pasv_min_port=8001 -pasv_max_port=8010 +pasv_min_port=${FTPS_PASV_MIN} +pasv_max_port=${FTPS_PASV_MAX} # SSL ssl_enable=Yes @@ -55,3 +55,5 @@ require_cert=YES ssl_request_cert=YES ca_certs_file=/etc/ssl/private/dfc.crt +write_enable=YES +pasv_address=${IPFILESERVER} diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml index 2c9226a87..d2c529033 100644 --- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml +++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml @@ -45,13 +45,14 @@ services: front-${I}: ipv4_address: "${IPFTPS}" ports: - - "${PORTFTPS}:21" + - "${PORTFTPS}:21" + - "${FTPS_PASV_MIN}-${FTPS_PASV_MAX}:${FTPS_PASV_MIN}-${FTPS_PASV_MAX}" environment: FTP_USER: onap FTP_PASSWORD: pano PASV_ADDRESS: localhost - PASV_MIN_PORT: 8001 - PASV_MAX_PORT: 8010 + PASV_MIN_PORT: ${FTPS_PASV_MIN} + PASV_MAX_PORT: ${FTPS_PASV_MAX} volumes: - ./tls/ftp.crt:/etc/ssl/private/ftp.crt:ro - ./tls/ftp.key:/etc/ssl/private/ftp.key:ro diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh index f4435aa18..3de96dafe 100755 --- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh +++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh @@ -20,8 +20,8 @@ function main(){ case $COMMAND in "compose") - compose $2 $3 $4 $5 $6 $7 $8 $9 "${10}" "${11}" "${12}" ;; - #IPGW, #IPSUBNET, #I, #URLVES, #IPPNFSIM, #IPFILESERVER, #TYPEFILESERVER, #PORTSFTP, #PORTFTPS, #IPFTPS, #IPSFTP + compose $2 $3 $4 $5 $6 $7 $8 $9 "${10}" "${11}" "${12}" "${13}" "${14}" ;; + #IPGW, #IPSUBNET, #I, #URLVES, #IPPNFSIM, #IPFILESERVER, #TYPEFILESERVER, #PORTSFTP, #PORTFTPS, #IPFTPS, #IPSFTP, #FTPS_PASV_MIN, #FTPS_PAST_MAX "build") build_image;; "start") @@ -63,7 +63,7 @@ function get_pnfsim_ip() { function compose(){ #creating custom docker-compose based on IP arguments #creting config.json by injecting the same IP - + export IPGW=$1 export IPSUBNET=$2 export I=$3 @@ -75,6 +75,8 @@ function compose(){ export PORTFTPS=$9 export IPFTPS=${10} export IPSFTP=${11} + export FTPS_PASV_MIN=${12} + export FTPS_PASV_MAX=${13} LOCALTIME=$(ls -l /etc/localtime) export TIMEZONE=${LOCALTIME//*zoneinfo\/} @@ -87,10 +89,14 @@ function compose(){ ./ROP_file_creator.sh $I & - set_vsftpd_file_owner - write_config $URLVES $IPFILESERVER $TYPEFILESERVER $PORTSFTP $PORTFTPS $IPPNFSIM + cd config + envsubst < vsftpd_ssl-TEMPLATE.conf > vsftpd_ssl.conf + cd - + + set_vsftpd_file_owner + } function build_image(){ |