summaryrefslogtreecommitdiffstats
path: root/tests/data_plane/vpp_lite_topo/odl_utils.sh
blob: 8a2b8bc817a62029bd33b046a27ca4c2533e87c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function post_curl {
  echo "Sending mapping from ${2} to ODL; operation: ${1}"
  until [ "`curl -X POST "http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:${1}" \
     -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}/${2}" \
     -u ${ODL_USER}:${ODL_PASSWD} -s -o /dev/null -w "%{http_code}"`" == "200" ]
  do
    echo "Updating failed; trying again.."
  done
}

function odl_clear_all {
  echo "Deleting all ODL mappings.."
  curl -X DELETE "http://${ODL_IP}:${ODL_PORT}/restconf/config/odl-mappingservice:mapping-database" \
       -u ${ODL_USER}:${ODL_PASSWD}
}