Honeynode test tool
[transportpce.git] / tests / honeynode / minimal-distribution-core / src / main / resources / honeycomb-minimal-resources / honeycomb-tpce
1 #!/bin/sh -
2 STATUS=100
3
4 if [ "$#" -eq 2 ]
5 then
6     PORT=$1
7     CONFIG=$2
8     if [ -e $CONFIG ]
9     then
10         rm -rf $(dirname $0)/persist
11         cp $CONFIG $(dirname $0)/config/device/
12         filename=$(basename -- "$CONFIG")
13         echo "changing netconf port with $PORT in netconf.json file ..."
14         sed -i "/netconf-ssh-binding-port/c\  \"netconf-ssh-binding-port\" : "$PORT"," $(dirname $0)/config/netconf.json
15         echo "changing context and config path in honeycomb.json file ..."
16         sed -i "/persisted-context-path/c\  \"persisted-context-path\" : \"./persist/"$PORT"/context/data.json\"," $(dirname $0)/config/honeycomb.json
17         sed -i "/persisted-config-path/c\  \"persisted-config-path\" : \"./persist/"$PORT"/config/data.json\"," $(dirname $0)/config/honeycomb.json
18         echo "changing netconf-initial-config-xml location with $CONFIG in honeycomb.json file ..."
19         sed -i "/netconf-initial-config-xml/c\  \"netconf-initial-config-xml\" : \"device/$filename\"" $(dirname $0)/config/honeycomb.json
20         while [ $STATUS -eq 100 ]
21         do
22           java -Xms32m -Xmn90m -Xmx128m -XX:MetaspaceSize=32m -XX:MaxMetaspaceSize=128m -jar $(dirname $0)/honeynode-distribution-1.18.01.jar
23           STATUS=$?
24           echo "Honeycomb exited with status: $STATUS"
25           if [ $STATUS -eq 100 ]
26           then
27             echo "Restarting..."
28           fi
29         done
30     else
31         echo "initial config file doesn't exist !"
32     fi
33 else 
34     echo "honeycomb-tpce port initial-config-xml "
35     echo "Eg : honeycomb-tpce 17830 sample-config-ROADM.xml"
36 fi