Pass typefileserver as parameter in mass-pnf-sim

Change-Id: I1168a5f10cce9b7d17324504a57d90dd9ee7790d
Issue-ID: DCAEGEN2-1434
Signed-off-by: RehanRaza <muhammad.rehan.raza@est.tech>
diff --git a/test/mocks/mass-pnf-sim/README.md b/test/mocks/mass-pnf-sim/README.md
index cbbf075..07f74e2 100644
--- a/test/mocks/mass-pnf-sim/README.md
+++ b/test/mocks/mass-pnf-sim/README.md
@@ -15,7 +15,7 @@
 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 773b971..a02e3fd 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(
+    '--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 @@
         print("\tIp Pnf SIM:" + str(IpPnfSim))
 
         IpFileServer = args.ipfileserver
+        TypeFileServer = args.typefileserver
 
         
         PortSftp=start_port +1
@@ -114,6 +120,7 @@
             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 06c8320..f21329e 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 @@
 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 6507e05..f4435aa 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 @@
 
     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 @@
 	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 @@
 
 	set_vsftpd_file_owner
 
-	write_config $IPVES $IPFILESERVER $PORTSFTP $PORTFTPS $IPPNFSIM
+	write_config $URLVES $IPFILESERVER $TYPEFILESERVER $PORTSFTP $PORTFTPS $IPPNFSIM
 
 }
 
@@ -109,10 +110,10 @@
 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 @@
 
 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 89f59a3..3dd4aba 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 @@
     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 @@
 
     @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 21717d8..851e6ad 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 @@
         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() + "/";
         }