4 [ -n "$JAVA_HOME" ] && JAVA_CMD="$JAVA_HOME/bin/java"
5 JAVA_VER=$("$JAVA_CMD" -version 2>&1 | sed -n ';s/.* version "\(.*\)\.\(.*\)\..*".*$/\1\2/p;')
7 [ "$JAVA_VER" -ge 110 ] && echo "ok, java is 11 or newer" || { echo "it's too old..."; exit 1; }
8 if [ -d $(dirname $0)/config/yang/common ]; then
9 mv $(dirname $0)/config/yang/common/* $(dirname $0)/config/yang/.
10 rm -rf $(dirname $0)/config/yang/common
12 if [ -d $(dirname $0)/config/yang/devices ]; then
13 mv $(dirname $0)/config/yang/devices/* $(dirname $0)/config/yang/.
14 rm -rf $(dirname $0)/config/yang/devices
16 if [ -d $(dirname $0)/config/yang/openconfig ]; then
17 mv $(dirname $0)/config/yang/openconfig/* $(dirname $0)/config/yang/.
18 rm -rf $(dirname $0)/config/yang/openconfig
27 mkdir -p $(dirname $0)/persist
28 mkdir -p $(dirname $0)/logs
29 REST_HTTP=$(echo 81`echo $PORT | tail -c 3`)
30 REST_WEBSOCKET=$(echo 77`echo $PORT | tail -c 3`)
31 cp $CONFIG $(dirname $0)/config/device/
32 filename=$(basename -- "$CONFIG")
33 device=$(basename "$CONFIG" .xml)
34 echo "changing netconf port with $PORT in netconf.json file ..."
35 sed -i' ' "s/\"netconf-ssh-binding-port\".*,/\"netconf-ssh-binding-port\" : "$PORT",/g" $(dirname $0)/config/netconf.json
36 echo "changing restconf http port with $REST_HTTP in restconf.json file ..."
37 sed -i' ' "s/\"restconf-port\".*,/\"restconf-port\" : "$REST_HTTP",/g" $(dirname $0)/config/restconf.json
38 echo "changing restconf websocket with $REST_WEBSOCKET in restconf.json file ..."
39 sed -i' ' "s/\"restconf-websocket-port\".*,/\"restconf-websocket-port\" : "$REST_WEBSOCKET",/g" $(dirname $0)/config/restconf.json
40 echo "changing restconf-https-enabled to false in restconf.json file ..."
41 sed -i' ' "s/\"restconf-https-enabled\".*,/\"restconf-https-enabled\" : \"false\",/g" $(dirname $0)/config/restconf.json
42 echo "changing persist-context and persist-config to false in honeycomb.json file ..."
43 sed -i' ' "s/\"persist-context\".*,/\"persist-context\" : \"false\",/g" $(dirname $0)/config/honeycomb.json
44 sed -i' ' "s/\"persist-config\".*,/\"persist-config\" : \"false\",/g" $(dirname $0)/config/honeycomb.json
45 echo "changing netconf-initial-config-xml location with $CONFIG in honeycomb.json file ..."
46 sed -i' ' "s@\"netconf-initial-config-xml\".*,@\"netconf-initial-config-xml\" : \"device/$filename\",@g" $(dirname $0)/config/honeycomb.json
47 while [ $STATUS -eq 100 ]
49 . $(dirname $0)/../../../../../../reflectwarn.sh
50 # needed to remove JDK11 reflective access warning
51 "$JAVA_CMD" -DDEVICE=${device} -Dlogback.logs.directory=$(dirname $0)/logs -Xms512m -Xmn512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -jar $(dirname $0)/honeynode-distribution-1.19.04.jar
53 echo "Honeycomb exited with status: $STATUS"
54 if [ $STATUS -eq 100 ]
60 echo "initial config file doesn't exist !"
63 echo "honeycomb-tpce port initial-config-xml"
64 echo "Eg : honeycomb-tpce 17832 sample-config-ROADM.xml (rest-http port will be 81 + netconf-port last two digits : 8132)"