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\":

{

\"ip\": \"10.143.0.100\", \"members\":[

{

\"ip\": \"10.143.0.10\" },

{

\"ip\": \"10.143.0.11\" },

{

\"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 Backing 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.

#-------------------------------------------------------------------------------

#

# Backup a Team

B.1 Configuring a controller team 121