blob: 31b87d325cb5b3f3f0928c1043dbc227e6904e8c [file] [log] [blame]
#!/bin/bash
# -----------------------------------------------------------------------------
# Tool to manage ONOS applications using REST API.
# -----------------------------------------------------------------------------
node=${1:-$OCI}
cmd=${2:-list}
app=${3}
export URL=http://$node:8181/onos/v1/applications
export HDR="-HContent-Type:application/octet-stream"
export curl="curl -sS"
case $cmd in
list) $curl -X GET $URL;;
install) $curl -X POST $HDR $URL --data-binary @$app;;
install!) $curl -X POST $HDR $URL?activate=true --data-binary @$app;;
uninstall) $curl -X DELETE $URL/$app;;
activate) $curl -X POST $URL/$app/active;;
deactivate) $curl -X DELETE $URL/$app/active;;
*) echo "usage: onos-app {install|install!} <app-file>" >&2
echo " onos-app {activate|deactivate|uninstall} <app-name>" >&2
exit 1;;
esac