blob: 6f490521c8e92e51fb2edae7289325cbda2e972f [file] [log] [blame]
Thomas Vachuska1627dc82015-11-13 12:22:14 -08001#!/bin/bash
2# -----------------------------------------------------------------------------
3# ONOS network configuration uploader.
4# -----------------------------------------------------------------------------
5
6[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7. $ONOS_ROOT/tools/build/envDefaults
Jonathan Hartc86b00e2016-02-17 22:31:50 -08008. $ONOS_ROOT/tools/test/bin/find-node.sh
Thomas Vachuska1627dc82015-11-13 12:22:14 -08009
Jonathan Hartc86b00e2016-02-17 22:31:50 -080010fail="--fail"
11[ "$1" == "-v" ] && shift && fail=""
12
13node=$(find_node $1)
Thomas Vachuska1627dc82015-11-13 12:22:14 -080014file="${2:-$ONOS_ROOT/tools/test/topos/oe-linear-3.json}"
15url="${3}"
16
Jonathan Hartc86b00e2016-02-17 22:31:50 -080017method="POST"
18[ $file == "delete" ] && method="DELETE"
19
20curl $fail -sSL --user $ONOS_WEB_USER:$ONOS_WEB_PASS \
21 -X $method -H 'Content-Type:application/json' \
Thomas Vachuska1627dc82015-11-13 12:22:14 -080022 http://$node:8181/onos/v1/network/configuration/${url} -d@$file