5 CONTAINER_NAME=pnf-simulator
6 CONFIG_FILE_PATH=/config/body.json
7 SIMULATOR_DOCKER_HUB=nexus3.onap.org:10003/onap
18 start_simulator $2 $CONFIG_FILE_PATH $SIMULATOR_DOCKER_HUB/pnf-simulator:$SIMULATOR_TAG;;
20 start_simulator $2 $CONFIG_FILE_PATH pnf-simulator:$SIMULATOR_TAG;;
34 function build_image(){
35 if [ -f pom.xml ]; then
38 echo "pom.xml file not found"
43 function start_simulator(){
45 stop_and_remove_container || true
47 if [ $(docker run -d --name $CONTAINER_NAME -v $(pwd):/config -e VES_ADDRESS=$1 -e CONFIG_FILE_PATH=$2 $3) > /dev/null ]; then
48 echo "Simulator started"
50 echo "Failed to start simulator"
54 function stop_and_remove_container(){
55 docker rm -f $CONTAINER_NAME 1> /dev/null
58 function stop_simulator(){
59 if [ $(docker kill $CONTAINER_NAME) > /dev/null ]; then
60 echo "Simulator stopped"
62 echo "Failed to stop simulator"
67 function print_status(){
70 Simulator container status:
72 $(docker ps -a -f name=$CONTAINER_NAME)
77 function print_help(){
81 build - locally builds simulator image from existing code
82 start <ves-url> - starts simulator using remote docker image and connects to given VES server
83 start-dev <ves-url> - starts simulator using local docker image and connects to given VES server
84 stop - stops simulator
85 status - prints container status
87 help - prints this message
90 Use "./simulator.sh start". It will download required docker image from the internet and start simulator using body.json file
92 To stop simulation use "./simulator.sh stop" command. To check simulator's status use "./simulator.sh status".
93 If you want to change message parameters simply edit body.json file then run simulator again.
96 1. Build local simulator image using "./simulator.sh build"
97 2. Run simulation with "./simulator.sh start-dev"
99 If you change the source code you have to rebuild image with "./simulator.sh build" and run "./simulator.sh start-dev" again
105 docker logs --tail all $CONTAINER_NAME