HP VAN SDN Controller Administrator Guide v3

B Scripts
B.1 Configuring a Controller Team
This script configures a team composed of three controllers.
NOTE: Because the scripts in this appendix cross page boundaries, be careful to avoid including
the page number when copying a script. Copying a script one page at a time can prevent inclusion
of page numbers.
========== ===== ===================================================
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright 2013 Hewlett Packard Co., All Rights Reserved.
#-------------------------------------------------------------------------------
#
# Script to configuring a team (ie, create a team).
#
#
#
#-------------------------------------------------------------------------------
tok="/tmp/tok.txt"
token="$([ -f $tok ] && cat $tok)"
#echo $token
url="https://127.0.0.1:8443/sdn/v2.0/team"
#echo $url
createTeam="{
\"team\":
{ \"name\": \"TestCluster\",
\"ip\": \"10.143.0.100\",
\"systems\":[
{
\"name\": \"member1\",
\"ip\": \"10.143.0.10\"
},
{
\"name\": \"member2\",
\"ip\": \"10.143.0.11\"
},
{
\"name\": \"member3\",
\"ip\": \"10.143.0.12\"
}
]
}
}"
#echo $createTeam
# Attempt to create team
postResp=`curl --noproxy ${SCA:-localhost} --header "X-Auth-Token:$token" \
--fail -ksSfL --request POST --url "$url" \
-H "Content-Type: application/json" --data-binary "$createTeam
" ` errorCode=$?
echo $errorCode
echo $postResp
echo "exiting script"
exit 0
B.2 Back Up a Controller Team
NOTE: Because the scripts in this appendix cross page boundaries, be careful to avoid including
the page number when copying a script. Copying a script one page at a time can prevent inclusion
of page numbers.
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright 2013 Hewlett Packard Co., All Rights Reserved.
#-------------------------------------------------------------------------------
B.1 Configuring a Controller Team 121