EasyManua.ls Logo

HP HPE VAN SDN Controller 2.7 - Page 205

HP HPE VAN SDN Controller 2.7
231 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
\"domain\": \"$domain\",
\"user\": \"$user\",
\"password\": \"$pass\"
}
}"
# Attempt to authenticate and extract token if successful.
auth=$(curl --noproxy $nodeIP -X POST --fail -ksSfL --url "$url" \
-H "Content-Type: application/json" --data-binary "$login" 2>&1)
if [ $? -ne 0 ]; then
teamBackup_log "Unable to authenticate as user $user in $domain domain."
exitBackup 1
fi
authToken='extractJSONString "$auth" "token" | sed '/^$/d''
if [ $restore_mode -ne 1 ] && [ "$authToken" == "" ]; then
teamBackup_log "Failed to get the authentication token."
exitBackup 1
fi
echo $authToken
}
#==============================================================================
# M A I N
#==============================================================================
restore_mode=0
# Check for zip package.
command -v zip &> /dev/null
if [ $? -ne 0 ]; then
echo "The zip package must be installed to use this script."
exit 1
fi
# Check the user specified script parameters.
if [ $# -lt 2 ]; then
echo "Usage : backupTeam <user> <domain> [<user@ip:path>]"
echo " <user> - user name to access the controller"
echo " <domain> - domain of the controller"
echo " [<user@ip:path>] - remote location to store backup file"
echo " user - the login name for the system"
echo " ip - the ip address of the system"
echo " path - where to copy the file to on the remote system"
exit 1
fi
validateTeamBackupStatus
user="$1"
echo -n "Enter Controller Password: "
read -s pass
echo
domain="$2"
remotePath=$3
errorCode=0
# Get the authentication token for the local controller.
leaderAuth='getAuthToken localhost'
# Get the system Information for the local controller.
getSysInfo $leaderAuth
# Get the set of team IPs and their associated team roles.
extractRole_NodeIP $sysInfo
(validateTeamLead)
# Initiate a backup on each node.
for (( i=0; i<$numNodes; i++ )); do
nodeAuth[$i]='getAuthToken ${ipArr[$i]}'
uuidURL="https://${ipArr[$i]}:8443/sdn/v2.0/systems"
nodeUUID[$i]='get ${ipArr[$i]} ${nodeAuth[$i]} "$uuidURL?ip=${ipArr[$i]}"'
nodeUUID[$i]='extractJSONString "${nodeUUID[$i]}" "uid" | sed '/^$/d''
if [ "${ipArr[$i]}" == "$leaderIp" ]; then
# Skip the leader backup backup, since it will be done last.
leaderIndex=$i
continue
fi
backupNode $i
teamBackup_log "Started backup on ${ipArr[$i]}."
done
# Verify the status of the backup on each node.
backup_complete=$numNodes
waitTime=$(($BACKUP_WAIT_COUNT*10/60))
for (( k=0; k<$BACKUP_WAIT_COUNT; k++ )); do
if [ $backup_complete -le 1 ]; then
teamBackup_log "Backup on all member nodes completed successfully."
break
fi
sleep 10
for (( i=0; i<$numNodes; i++ )); do
# Skip the leader node check, since it will be done last.
[ "${ipArr[$i]}" == "$leaderIp" ] && continue
# Backup already completed for this node, so continue.
[ "${backupStatus[$i]}" == "SUCCESS" ] && continue
verifyBackupStatus $i
done
done
if [ $backup_complete -gt 1 ]; then
teamBackup_log "Backup of all member nodes took longer than $waitTime min. Aborting backup..."
teamBackup_log "To increase backup wait time, change BACKUP_WAIT_COUNT in the script."
Backing up a controller team 205

Table of Contents

Related product manuals