-> Used to retrieve large datasets in chunks. Returns data or False
-> returns data or False
-> returns data or False
-> returns True or False
-> file is a local file eg /var/tmp/test.txt, returns True or False
-> files are located in /shared/images, returns True or False
-> files is an array containing paths to cert and key. Returns name of cert or False
-> name is the name of a policy. Returns an array of IDs or False
-> name is the name of the partition and policy. eg /Common/test_policy. This reduces the need to retrieve an array of hashes from the BIG-IP. Returns a string.
-> this retrieves a BIG-IP token based on the username and password and sets it as the token in use. Returns the token ID or False
-> This deletes the object token from the BIG-IP and from the object
create_transaction() -> creates a transaction and returns the transaction number ID as a string, or False. Subsequent requests will be added to the transaction until commit_transaction is called. Transaction ID is stored in object.transaction
commit_transaction() -> Commits the transaction stored in object.transaction. Returns True or False
command(args,[cmd]) -> Runs a command using the arguments string args. Returns the returned output or True on success or False on failure.
Note: Be sure to double-escape single quotes eg \\' and single escape double quotes eg \"
cmd options are ping/save/load/restart/reboot
icr_session - the link to the requests session
raw - the raw returned JSON
code - the returned HTTP Status Code eg 200
error - in the case of error, the exception error string
headers - the response headers
icontrol_version - set this to specify a specific version of iControl
debug - boolean True or False to set debugging on or off
port - set the port ( 443 by default )
folder - set this to create in a specific partition
token - use this to set a specific token. If this is set, it will be used instead of basic auth
select - use this with get to select the returned data
top - use this with get to return a set number of records
skip - use this to skip to a specific record number
transaction - stores the Transaction ID
How to use this snippet:
Setup a REST connection to a device
from iCR import iCR
bigip = iCR("172.24.9.132","admin","admin",timeout=10)
Developed on Python 2.7 but works with v3. Works on TMOS 11.6 onwards though some features may not be implemented, such as tokens.
If you use this and have found bugs, would like to discuss it or suggest features then please PM me on DevCentral.