Python BigREST ucs save and download
Problem this snippet solves:
This uses BIGREST SDK API to save/download the ucs file.
Adding it here since I couldn't find a similar one,
How to use this snippet:
Based on Python3 and BigREST (https://bigrest.readthedocs.io)
Code :
#Import needed libraries from bigrest.bigip import BIGIP import getpass #Replace the host name as needed host="xx.xx.xx.xx" user=input('Username') pw= getpass.getpass(prompt='Password:') #Declare the ucs filename, if needed ucsfile="test.ucs" #Connect to device device = BIGIP(host, user, pw) data = {} data["command"] = "save" data["name"] = ucsfile #You may get timeout exception below even if the file has been created task = device.task_start("/mgmt/tm/sys/ucs", data) device.task_wait(task) if device.task_completed(task): device.task_result(task) print("Backup has been completed.") else: raise Exception() #The below will download the file to the same folder as the script device.download("/mgmt/shared/file-transfer/ucs-downloads/", ucsfile)
Tested this on version:
13.1Published Jun 01, 2021
Version 1.0Sreejith
Fog
Joined June 01, 2021
Sreejith
Fog
Joined June 01, 2021
No CommentsBe the first to comment