David K. Bainbridge | 7ae4f19 | 2016-09-29 09:01:38 -0700 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | #D provides access to the CORD POD fabric configuration generation |
| 3 | |
| 4 | PROG=$(echo $(basename $0) | sed -e 's/^cord-/cord /g') |
| 5 | |
| 6 | usage() { |
| 7 | echo "usage: $PROG [options]" |
| 8 | echo " -hc|--host-count number of hosts to expect to find in ONOS" |
| 9 | echo " -sc|--switch-count number of switches to expect to find in ONOS" |
| 10 | echo " -o|--onos ONOS to which to connect to get host / switch information" |
| 11 | echo " -u|--user ONOS user (not currently used)" |
| 12 | echo " -p|--passwd ONOS password (not currently used)" |
| 13 | echo " -h|--help this message" |
| 14 | } |
| 15 | |
| 16 | HOST_COUNT=0 |
| 17 | SWITCH_COUNT=0 |
| 18 | ONOS_USER="karaf" |
| 19 | ONOS_PASSWORD="karaf" |
| 20 | ONOS_HOST="onos-fabric" |
| 21 | |
| 22 | if [ $# -eq 0 ]; then |
| 23 | usage |
| 24 | exit 0 |
| 25 | fi |
| 26 | |
| 27 | while [ $# -gt 0 ]; do |
| 28 | case $1 in |
| 29 | -hc|--host-count) |
| 30 | shift |
| 31 | HOST_COUNT=$1 |
| 32 | ;; |
| 33 | -sc|--switch-count) |
| 34 | shift |
| 35 | SWITCH_COUNT=$1 |
| 36 | ;; |
| 37 | -o|--onos) |
| 38 | shift |
| 39 | ;; |
| 40 | -p|--passwd) |
| 41 | shift |
| 42 | ;; |
| 43 | -u|--user) |
| 44 | shift |
| 45 | ;; |
| 46 | -h|--help) |
| 47 | usage |
| 48 | exit 0 |
| 49 | ;; |
| 50 | esac |
| 51 | shift |
| 52 | done |
| 53 | |
| 54 | curl --fail -sSL -XPOST http://$CORD_HEAD_NODE:4245/config/ -d "{\"hostcount\":$HOST_COUNT,\"switchcount\":$SWITCH_COUNT,\"onosip\":\"$ONOS_HOST\"}" |
| 55 | |
| 56 | echo $? |