Merge "Updated the Version of Stating Dockers"
[integration.git] / test / mocks / pnfsimulator / simulator.sh
index cf16e24..6b61e6b 100755 (executable)
@@ -3,7 +3,6 @@
 set -euo pipefail
 
 COMPOSE_FILE_NAME=docker-compose.yml
-DEV_COMPOSE_FILE_NAME=docker-compose.dev.yml
 NETOPEER_CONTAINER_NAME=netopeer
 SIMULATOR_CONTAINER_NAME=pnf-simulator
 SIMULATOR_PORT=5000
@@ -22,9 +21,7 @@ function main(){
         "start")
             start $COMPOSE_FILE_NAME;;
         "start-dev")
-            start $DEV_COMPOSE_FILE_NAME;;
-        "start-debug")
-            start_netconf_server $DEV_COMPOSE_FILE_NAME;;
+            start_netconf_server $COMPOSE_FILE_NAME;;
         "stop")
             stop;;
         "run-simulator")
@@ -42,14 +39,19 @@ function main(){
 
 function build_image(){
     if [ -f pom.xml ]; then
-        mvn clean package 
+        mvn clean package docker:build
     else
         echo "pom.xml file not found"
         exit 1
     fi
 }
 
+function set_vsftpd_file_owner() {
+    sudo chown root ./ftpes/vsftpd/configuration/vsftpd_ssl.conf
+}
+
 function start_netconf_server() {
+    set_vsftpd_file_owner
     docker-compose -f $1 up -d $NETOPEER_CONTAINER_NAME
     echo
     echo "NETCONF server container's logs:"
@@ -65,7 +67,7 @@ function start(){
         echo "Simulator containers are already up"
     else
         echo "Starting simulator containers using netconf model specified in config/netconf.env"
-
+        set_vsftpd_file_owner
         archive_logs
         start_netconf_server $1
         docker-compose -f $1 up -d $SIMULATOR_CONTAINER_NAME
@@ -74,7 +76,7 @@ function start(){
 }
 
 function running_containers(){
-   docker-compose -f $COMPOSE_FILE_NAME ps -q && docker-compose -f $DEV_COMPOSE_FILE_NAME ps -q
+   docker-compose -f $COMPOSE_FILE_NAME ps -q
 }
 
 function stop(){
@@ -89,14 +91,14 @@ function stop(){
 function run_simulator(){
 cat << EndOfMessage
 Simulator response:
-$(curl -s -X POST -H "Content-Type: application/json" -d @config/config.json $SIMULATOR_START_URL | json_pp)
+$(curl -s -X POST -H "Content-Type: application/json" -H "X-ONAP-RequestID: 123" -H "X-InvocationID: 456" -d @config/config.json $SIMULATOR_START_URL)
 EndOfMessage
 }
 
 function stop_simulator(){
 cat << EndOfMessage
 Simulator response:
-$(curl -s -X POST $SIMULATOR_STOP_URL | json_pp)
+$(curl -s -X POST $SIMULATOR_STOP_URL)
 EndOfMessage
 }
 
@@ -114,7 +116,7 @@ cat << EndOfMessage
 $(docker-compose -f $RUNNING_COMPOSE_CONFIG ps)
 
 Simulator response:
-$(curl -s -X GET $SIMULATOR_STATUS_URL | json_pp)
+$(curl -s -X GET $SIMULATOR_STATUS_URL)
 EndOfMessage
 }
 
@@ -123,8 +125,7 @@ cat << EndOfMessage
 Available options:
 build - locally builds simulator image from existing code
 start - starts simulator and netopeer2 containers using remote simulator image and specified model name
-start-dev - starts simulator and netopeer2 containers using remote simulator image
-start-debug - starts only  netopeer2 container
+start-dev - starts only  netopeer2 container
 run-simulator - starts sending PNF registration messages with parameters specified in config.json
 stop-simulator - stop sending PNF registration messages
 stop - stops both containers