aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/mass-pnf-sim
diff options
context:
space:
mode:
Diffstat (limited to 'test/mocks/mass-pnf-sim')
-rw-r--r--test/mocks/mass-pnf-sim/README.md2
-rwxr-xr-xtest/mocks/mass-pnf-sim/mass-pnf-sim.py7
-rw-r--r--test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/config.yml3
-rwxr-xr-xtest/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh37
-rw-r--r--test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/PnfSimConfig.java16
-rw-r--r--test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/SimulatorFactory.java4
6 files changed, 38 insertions, 31 deletions
diff --git a/test/mocks/mass-pnf-sim/README.md b/test/mocks/mass-pnf-sim/README.md
index cbbf07574..07f74e2b7 100644
--- a/test/mocks/mass-pnf-sim/README.md
+++ b/test/mocks/mass-pnf-sim/README.md
@@ -15,7 +15,7 @@ The ipstart should align to a /28 Ip address range start (e.g. 10.11.0.16, 10.11
For debug purposes, you can use your own IP address as VES collector, use "ip" command to determine it.
Example:
-./mass-pnf-sim.py --bootstrap 2 --urlves http://10.148.95.??:10000/eventListener/v7 --ipfileserver 10.148.95.??? --ipstart 10.11.0.16
+./mass-pnf-sim.py --bootstrap 2 --urlves http://10.148.95.??:10000/eventListener/v7 --ipfileserver 10.148.95.??? --typefileserver sftp --ipstart 10.11.0.16
Note that the file creator is started at a time of the bootstrapping.
Stop/start will not re-launch it.
diff --git a/test/mocks/mass-pnf-sim/mass-pnf-sim.py b/test/mocks/mass-pnf-sim/mass-pnf-sim.py
index 773b97193..a02e3fdd2 100755
--- a/test/mocks/mass-pnf-sim/mass-pnf-sim.py
+++ b/test/mocks/mass-pnf-sim/mass-pnf-sim.py
@@ -40,6 +40,11 @@ parser.add_argument(
)
parser.add_argument(
+ '--typefileserver',
+ help='Type of the file server (SFTP/FTPS) to be included in the VES event',
+)
+
+parser.add_argument(
'--ipstart',
help='IP address range beginning',
)
@@ -87,6 +92,7 @@ if args.bootstrap and args.ipstart and args.urlves:
print("\tIp Pnf SIM:" + str(IpPnfSim))
IpFileServer = args.ipfileserver
+ TypeFileServer = args.typefileserver
PortSftp=start_port +1
@@ -114,6 +120,7 @@ if args.bootstrap and args.ipstart and args.urlves:
str(args.urlves) + " " + \
str(IpPnfSim) + " " + \
str(IpFileServer) + " " + \
+ str(TypeFileServer) + " " + \
str(PortSftp) + " " + \
str(PortFtps) + " " + \
str(UrlFtps) + " " + \
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/config.yml b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/config.yml
index 06c832099..f21329eff 100644
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/config.yml
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/config.yml
@@ -4,6 +4,5 @@ urlftps: ftps://onap:pano@10.11.0.67
urlsftp: sftp://onap:pano@10.11.0.68
#when run in simulator, it does not have own IP
ippnfsim: localhost
-defaultfileserver: sftp
-#defaultfileserver: ftps
+typefileserver: sftp
...
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 6507e056a..f4435aa18 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}" ;;
- #IPGW, #IPSUBNET, #I, #IPVES, #IPPNFSIM, #IPFILESERVER, #PORTSFTP, #PORTFTPS, #IPFTPS, #IPSFTP
+ compose $2 $3 $4 $5 $6 $7 $8 $9 "${10}" "${11}" "${12}" ;;
+ #IPGW, #IPSUBNET, #I, #URLVES, #IPPNFSIM, #IPFILESERVER, #TYPEFILESERVER, #PORTSFTP, #PORTFTPS, #IPFTPS, #IPSFTP
"build")
build_image;;
"start")
@@ -67,13 +67,14 @@ function compose(){
export IPGW=$1
export IPSUBNET=$2
export I=$3
- export IPVES=$4
+ export URLVES=$4
export IPPNFSIM=$5
export IPFILESERVER=$6
- export PORTSFTP=$7
- export PORTFTPS=$8
- export IPFTPS=$9
- export IPSFTP=${10}
+ export TYPEFILESERVER=$7
+ export PORTSFTP=$8
+ export PORTFTPS=$9
+ export IPFTPS=${10}
+ export IPSFTP=${11}
LOCALTIME=$(ls -l /etc/localtime)
export TIMEZONE=${LOCALTIME//*zoneinfo\/}
@@ -88,7 +89,7 @@ function compose(){
set_vsftpd_file_owner
- write_config $IPVES $IPFILESERVER $PORTSFTP $PORTFTPS $IPPNFSIM
+ write_config $URLVES $IPFILESERVER $TYPEFILESERVER $PORTSFTP $PORTFTPS $IPPNFSIM
}
@@ -109,10 +110,10 @@ function set_vsftpd_file_owner() {
function write_config(){
#building a YML file for usage in Java
echo "urlves: $1" > config/config.yml
- echo "urlsftp: sftp://onap:pano@$2:$3" >> config/config.yml
- echo "urlftps: ftps://onap:pano@$2:$4" >> config/config.yml
- echo "ippnfsim: $5" >> config/config.yml
- echo "defaultfileserver: sftp" >> config/config.yml
+ echo "urlsftp: sftp://onap:pano@$2:$4" >> config/config.yml
+ echo "urlftps: ftps://onap:pano@$2:$5" >> config/config.yml
+ echo "ippnfsim: $6" >> config/config.yml
+ echo "typefileserver: $3" >> config/config.yml
}
function start(){
@@ -203,12 +204,14 @@ clear-logs - deletes log folder
Starting simulation:
- Setup the instance of this simulator by:
- - ./simulator.sh compose IPGW IPSUBNET I IPVES IPPNFSIM IPFTPS IPSFTP
- where Gw and subnet will be used for docker network
+ - ./simulator.sh compose IPGW IPSUBNET I URLVES IPPNFSIM IPFILESERVER TYPEFILESERVER PORTSFTP PORTFTPS IPFTPS IPSFTP
+ where IPGW and IPSUBNET will be used for docker network
where I is the integer suffix to differentiate instances
- where IPVES is the address of the VES collector
- where IPPNFSIM, IPFTPS, IPSFTP are the addresses for containers
- e.g. ./simulator.sh compose 10.11.0.65 10.11.0.64 3 10.11.0.2 10.11.0.66 10.11.0.67 10.11.0.68
+ where URLVES is the URL of the VES collector
+ where IPPNFSIM, IPFILESERVER, IPFTPS, IPSFTP are the IP addresses for containers
+ where TYPEFILESERVER is the type of fileserver, i.e., FTPS or SFTP
+ where PORTSFTP, PORTFTPS are the SFTP and FTPS ports
+ e.g. ./simulator.sh compose 10.11.0.65 10.11.0.64 3 http://10.11.0.69:10000/eventListener/v7 10.11.0.2 10.11.0.66 ftps 2001 2002 10.11.0.67 10.11.0.68
- Setup environment with "./simulator.sh start". It will download required docker images from the internet and run them on docker machine
- To start the simulation use "./simulator.sh run-simulator", which will start sending PNF registration messages with parameters specified in config.json {TODO, might not be needed}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/PnfSimConfig.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/PnfSimConfig.java
index 89f59a391..3dd4aba1c 100644
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/PnfSimConfig.java
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/PnfSimConfig.java
@@ -5,14 +5,14 @@ public class PnfSimConfig {
private String urlftps;
private String urlsftp;
private String ippnfsim;
- private String defaultfileserver;
+ private String typefileserver;
- public String getDefaultfileserver() {
- return defaultfileserver;
+ public String getTypefileserver() {
+ return typefileserver;
}
- public void setDefaultfileserver(String defaultfileserver) {
- this.defaultfileserver = defaultfileserver;
+ public void setTypefileserver(String typefileserver) {
+ this.typefileserver = typefileserver;
}
@@ -50,10 +50,8 @@ public class PnfSimConfig {
@Override
public String toString() {
- return "PnfSimConfig [vesip=" + urlves + ", urlftps=" + urlftps + ", ippnfsim=" + ippnfsim + ", urlsftp="
- + urlsftp + "]";
+ return "PnfSimConfig [vesip=" + urlves + ", urlftps=" + urlftps + ", urlsftp=" + urlsftp + ", ippnfsim="
+ + ippnfsim + ", typefileserver=" + typefileserver + "]";
}
-
-
}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/SimulatorFactory.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/SimulatorFactory.java
index 21717d863..851e6ad1d 100644
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/SimulatorFactory.java
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/SimulatorFactory.java
@@ -36,9 +36,9 @@ public class SimulatorFactory {
PnfSimConfig configuration = ConfigurationProvider.getConfigInstance();
String xnfUrl = null;
- if (configuration.getDefaultfileserver().equals("sftp")) {
+ if (configuration.getTypefileserver().equals("sftp")) {
xnfUrl = configuration.getUrlsftp() + "/";
- } else if (configuration.getDefaultfileserver().equals("ftps")) {
+ } else if (configuration.getTypefileserver().equals("ftps")) {
xnfUrl = configuration.getUrlftps() + "/";
}