Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I call iControlREST to save and load configurations from UCS?

Brandon_12856
Nimbostratus
Nimbostratus

I'm working on automating my development process so I want to be able to save/load a known state in my lab.

 

Essentially I want to be able to RESTfully call these commands: * tmsh save sys ucs Snapshot.ucs * tmsh load sys ucs Snapshot.ucs no-license

 

9 REPLIES 9

Arnaud_Lemaire
F5 Employee
F5 Employee

Hi Brandon,

 

please have look to the following path with your rest client : /mgmt/tm/shared/sys/backup/example

 

/mgmt/tm/shared/sys/backup is the uri to play with. to restore a config : POST /mgmt/tm/shared/sys/backup {"file":"backup_bigip15.ucs","action":"RESTORE","generation":0,"lastUpdateMicros":0}

 

to backup a config : POST /mgmt/tm/shared/sys/backup {"file":"backup_bigip15bis.ucs","action":"BACKUP","generation":0,"lastUpdateMicros":0}

 

Arnaud_Lemaire
F5 Employee
F5 Employee

Correct, these urls seem to be available only when you install rest package from management platform Big-IQ. i'm currently looking at the following but without success so far POST /mgmt/tm/sys/ucs { "command":"save", "options":[ { "test.ucs":"" } ] }

 

Arnaud_Lemaire
F5 Employee
F5 Employee

Hi Brandon, we have been working on it internally and it seems that we do suffer from a bug on that subject. bug id is 449989. correct request should be : curl -v -sk -u admin:admin https://localhost/mgmt/tm/sys/ucs -H 'Content-Type: application/json' -X POST -d '{"command":"save","name":"test1.ucs"}' curl -v -sk -u admin:admin https://localhost/mgmt/tm/sys/ucs -H 'Content-Type: application/json' -X POST -d '{"command":"load","name":"test.ucs"}'

 

i advise you to open a case with this bugid to have correction in your existing release.

 

Riley_Schuit_82
Historic F5 Account

As of 10/3/2014 there is bug ID 474895. Looks like it will be fixed in 11.6.0

 

Arnaud_F_
Nimbostratus
Nimbostratus

Hi, do you know if the bug is fixed ? I didn't find it in Release Notes of the 11.6 version.

 

Arnaud_Lemaire
F5 Employee
F5 Employee

Bonjour Arnaud,

 

From the 11.6 and 11.52 release note you have : ID 449989 Can now save UCS when using iControl REST.

 

this synthax is working in 11.6 :

 

POST /mgmt/tm/sys { "command":"save", "options":[{"ucs":"test6.ucs"}]}

 

While the ucs is generated, there could be some timeout error or wrong feedback from the api.

 

Loading the ucs seems to be another story ...

 

Arnaud_F_
Nimbostratus
Nimbostratus

Hi Arnaud,

 

Thanks for the reply.

 

My tests confirm that the issue is fixed in 11.5.3 release.

 

Saving and loading ucs are working even if there is timeout error or wrong feedback from the api.

 

You will bellow an extract of python code :

 

bigip_url_base = 'https://%s/mgmt/tm' % bigip_address
bigip = requests.session()
bigip.auth = (bigip_user, bigip_pass)
bigip.verify = False
bigip.headers.update({'Content-Type' : 'application/json'})
payload = {}

 Load 

payload['command'] = 'load'
payload['options'] = [{ 'ucs' : 'my-backup.ucs' },{ 'passphrase' : 'my-archive-password' }, { 'no-license' : '' }]
result = bigip.post('%s/sys' % bigip_url_base, data=json.dumps(payload))

 Save 

payload = {}
payload['command'] = 'save'
payload['options'] = [{ 'ucs' : 'my-backup.ucs' },{ 'passphrase' : 'my-archive-password' }]
result = bigip.post('%s/sys' % bigip_url_base, data=json.dumps(payload))

Qu__Xiangdong_9
Nimbostratus
Nimbostratus

Tested in V11.5.3

 

curl -v -sk -u admin:admin https://10.10.10.10/mgmt/tm/sys/ucs -H "Content-Type: application/json" -X POST -d '{"command":"save","name":"test.ucs"}'

 

curl -sk -u admin:admin https://10.10.10.10/mgmt/tm/sys/ucs/ -H "Content-Type: application/json" -X POST -d '{"command":"save","options":[{"test01":""}]}' | python -m json.tool

 

iamczar_12961
Cirrus
Cirrus

See Creating and deleting a UCS archive https://support.f5.com/csp/article/K13225405ucs