odl_utils.sh revision 4543d282
1
2function post_curl {
3  echo "Sending mapping from ${2} to ODL; operation: ${1}"
4  until [ "`curl -X POST "http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:${1}" \
5     -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}/${2}" \
6     -u ${ODL_USER}:${ODL_PASSWD} -s -o /dev/null -w "%{http_code}"`" == "200" ]
7  do
8    echo "Updating failed; trying again.."
9  done
10}
11
12function odl_clear_all {
13  echo "Deleting all ODL mappings.."
14  curl -X DELETE "http://${ODL_IP}:${ODL_PORT}/restconf/config/odl-mappingservice:mapping-database" \
15       -u ${ODL_USER}:${ODL_PASSWD}
16}
17
18function check_odl_running {
19  if [ -z  "`netstat -tunlp | grep 8181`" ] ; then
20  echo "ODL is not running!"
21    exit 1
22  fi
23}
24