Python Scripts: Difference between revisions
Content added Content deleted
Line 394: | Line 394: | ||
import subprocess as sub |
import subprocess as sub |
||
import time |
import time |
||
# Netscaler Parameters |
|||
host = "10.107.88.78" |
|||
username = "nsroot" |
|||
passwd = "pwd@123" |
|||
⚫ | |||
boolean = "true" |
|||
# Nitro API calls using Curl |
# Nitro API calls using Curl |
||
Line 437: | Line 429: | ||
username = "nsroot" |
username = "nsroot" |
||
passwd = "pwd@123" |
passwd = "pwd@123" |
||
⚫ | |||
# Boolean true means Warm reboot; false means full reboot |
|||
boolean = "true" |
boolean = "true" |
||
# Nitro API calls using Curl |
# Nitro API calls using Curl |
||
uptimeapi = "curl -s -k -X GET -H 'Content-Type:application/json' --basic --user %s:%s http://%s/nitro/v1/stat/system?attrs=starttime" %(username, passwd, host) |
uptimeapi = "curl -s -k -X GET -H 'Content-Type:application/json' --basic --user %s:%s http://%s/nitro/v1/stat/system?attrs=starttime" %(username, passwd, host) |
||
rebootapi = "curl -s -k -X POST -H 'Content-Type:application/vnd.com.citrix.netscaler.reboot+json' --basic --user %s:%s -d '{'reboot':{'warm': |
rebootapi = "curl -s -k -X POST -H 'Content-Type:application/vnd.com.citrix.netscaler.reboot+json' --basic --user %s:%s -d '{'reboot':{'warm':boolean}}' http://%s/nitro/v1/config/reboot" %(username,passwd,boolean,host) |
||
print uptimeapi |
print uptimeapi |
||
Line 453: | Line 444: | ||
sub.Popen(rebootapi.split(), stdout=sub.PIPE) |
sub.Popen(rebootapi.split(), stdout=sub.PIPE) |
||
time.sleep( |
time.sleep(50) |
||
uptime2 = sub.Popen(uptimeapi.split(), stdout=sub.PIPE) |
uptime2 = sub.Popen(uptimeapi.split(), stdout=sub.PIPE) |