blob: e70d3f62f2a43983c7b0afb56d53c5347dd9b732 [file] [log] [blame]
David K. Bainbridge7ae4f192016-09-29 09:01:38 -07001#!/bin/bash
2#D provides access to the CORD POD fabric configuration generation
3
4PROG=$(echo $(basename $0) | sed -e 's/^cord-/cord /g')
5
6usage() {
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
16HOST_COUNT=0
17SWITCH_COUNT=0
18ONOS_USER="karaf"
19ONOS_PASSWORD="karaf"
20ONOS_HOST="onos-fabric"
21
22if [ $# -eq 0 ]; then
23 usage
24 exit 0
25fi
26
27while [ $# -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
52done
53
54curl --fail -sSL -XPOST http://$CORD_HEAD_NODE:4245/config/ -d "{\"hostcount\":$HOST_COUNT,\"switchcount\":$SWITCH_COUNT,\"onosip\":\"$ONOS_HOST\"}"
55
56echo $?