blob: 31b87d325cb5b3f3f0928c1043dbc227e6904e8c [file] [log] [blame]
Thomas Vachuska02aeb032015-01-06 22:36:30 -08001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Tool to manage ONOS applications using REST API.
4# -----------------------------------------------------------------------------
5
6node=${1:-$OCI}
7cmd=${2:-list}
8app=${3}
9
10export URL=http://$node:8181/onos/v1/applications
11export HDR="-HContent-Type:application/octet-stream"
12export curl="curl -sS"
13
14case $cmd in
15 list) $curl -X GET $URL;;
16 install) $curl -X POST $HDR $URL --data-binary @$app;;
Thomas Vachuska62ad95f2015-02-18 12:11:36 -080017 install!) $curl -X POST $HDR $URL?activate=true --data-binary @$app;;
Thomas Vachuska02aeb032015-01-06 22:36:30 -080018 uninstall) $curl -X DELETE $URL/$app;;
19 activate) $curl -X POST $URL/$app/active;;
20 deactivate) $curl -X DELETE $URL/$app/active;;
Thomas Vachuska62ad95f2015-02-18 12:11:36 -080021 *) echo "usage: onos-app {install|install!} <app-file>" >&2
22 echo " onos-app {activate|deactivate|uninstall} <app-name>" >&2
23 exit 1;;
Thomas Vachuska02aeb032015-01-06 22:36:30 -080024esac