add endpointcost-northbound-route
[alto.git] / test / scripts / northbound / nbr-endpointcost-create
1 #!/bin/bash
2
3 ENDPOINTCOST_PATH=$1
4 RESOURCE_ID=$2
5 if [ $3 ]; then
6         CONTEXT_ID=$3
7 else
8         CONTEXT_ID="00000000-0000-0000-0000-000000000000"
9 fi
10
11 DATA=$(cat ./template/nbr-record-endpointcost \
12                 | sed 's/\$1/'$ENDPOINTCOST_PATH'/g' \
13                 | sed 's/\$2/'$CONTEXT_ID'/g' \
14                 | sed 's/\$3/'$RESOURCE_ID'/g')
15
16 # echo $DATA | python -m json.tool
17
18 curl -X PUT -u admin:admin -H "Content-Type: application/json" \
19         -d "$DATA" \
20         http://localhost:8181/restconf/config/alto-nbr-endpointcost:records/record/$ENDPOINTCOST_PATH