blob: 9bfbb28890f42df3c205c6b97341de2d9eab39a6 [file] [log] [blame]
Boyuan Yan1c27bc72019-02-15 19:22:19 +00001#!/bin/bash
2
Boyuan Yan36231d22019-04-09 18:38:23 +00003if [[ "$1" == "-h" ]];then
4 echo "Usage for script $0:"
5 echo " - $0. The command without parameter means that config jsons are generated by modifying testing configuration of odtn app"
6 echo " - $0 {dev-abs-path} {link-abs-path} {net-summary}. The command means use specified device config and link config directly."
7fi
8
9if [[ $# == 0 ]];then
10 # Get first IPv4 Address on local machine, even the machine has lots of NICs.
11 localIP=`ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:" | head -n1`
12 mkdir /tmp/odtn
13 # Replace IP address in openconfig json files with real ones.
14 cat ${ONOS_ROOT}/apps/odtn/api/src/test/resources/openconfig-devices.json | sed "s/127.0.0.1/${localIP}/g" > /tmp/odtn/openconfig-devices.json
15 cat ${ONOS_ROOT}/apps/odtn/api/src/test/resources/openconfig-device-link.json | sed "s/127.0.0.1/${localIP}/g" > /tmp/odtn/openconfig-device-link.json
16 cp ${HOME}/emulator/net-summary.json /tmp/odtn/net-summary.json
17 sleep 30
18elif [[ $# == 3 ]];then
19 mkdir /tmp/odtn
20 cp $1 /tmp/odtn/openconfig-devices.json
21 cp $2 /tmp/odtn/openconfig-device-link.json
22 cp $3 /tmp/odtn/net-summary.json
23fi