Created
June 10, 2015 15:32
-
-
Save anonymous/5075b59e9ddfc9a3a6ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
export ODL_IP='192.168.50.1' | |
export ODL_PORT='8080' | |
export ODL="http://${ODL_IP}:${ODL_PORT}/controller/nb/v2/neutron" | |
export DEBUG=0 | |
function do_get { | |
url="${ODL}/$1" | |
headers=('-H "Authorization: Basic YWRtaW46YWRtaW4="' '-H "Accept: application/json"' '-H "Content-Type: application/json"' '-H "Cache-Control: no-cache"') | |
if [ $DEBUG -gt 0 ]; then | |
cmd="curl -X GET ${headers[*]} -o /dev/null -sL -w \"%{http_code}\" $url" | |
echo "do_get ${cmd}" | |
fi | |
# rc=$(curl -X GET ${headers[*]} -o /dev/null -sL -w "%{http_code}" $url)) | |
rc=$(curl -X GET -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Accept: application/json" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -o /dev/null -sL -w "%{http_code}" $url) | |
if [ "$rc" != "200" ]; then | |
echo "unexpected rc $rc from get $1" | |
exit $rc | |
fi | |
} | |
do_get networks/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment