Forum Discussion
Looking for guidance with the Python SDK
I've read the tutorial over a few times and I still find it very hard to figure out what syntax I need to use to do specific things.
For example: In the tutorial, it shows you can run commands via "mgmt.tm.util.bash.exec_cmd('run', utilCmdArgs='-c "tmsh show sys software"')"...so I go to the bigip.tm part of the "F5 SDK API docs" section and there's nothing there about what "bash.exec_cmd" or any other methods I can use with mgmt.tm.util. Is there something I am missing or what is the best way to figure out the complete power of this SDK?
Thank you advance!
- Stephane_Viau
Nimbostratus
Have you tried this documentation?
https://f5-sdk.readthedocs.io/en/latest/apidoc/f5.bigip.tm.util.html
- Malware_Mike_37
Altocumulus
So if I go to : https://f5-sdk.readthedocs.io/en/latest/apidoc/f5.bigip.tm.util.htmlmodule-f5.bigip.tm.util.qkview
It shows I can use bash with , but it says nothing about what options to use...but I just clicked on the source and it gives even more info.
Thank you
- Satoshi_Toyosa1Ret. Employee
F5 Python SDK is an assortment of convenient modules for Python users for accessing the iControl REST. And iControl REST is a wrapper for tmsh. So, for available options and usage, read the tmsh help.
For example, tm.util.qkview is for the /mgmt/tm/util/qkview iControl REST endpoint, and it is for tmsh run util qkview. You can find the list of options from tmsh help util qkview.
One of the options is -f for specifing the name of the qkview file. The following tmsh command creates a qkview file /var/tmp/sat1234
tmsh run util qkview -f sat1234
This iControl REST call (using curl) does the same:
curl -sku : https:///mgmt/tm/util/qkview \ -X POST -H "Content-type: application/json" \ -d '{"command":"run", "utilCmdArgs":"-f sat1234"}'
And finally, the equivalent python sdk code.
from f5.bigip import ManagementRoot mgmt = ManagementRoot('', '', '') bash = mgmt.tm.util.qkview.exec_cmd('run', utilCmdArgs='-f sat1234')
See the Commands section of iControl REST User Guide Version 13.1, pp. 57-65, for the tmsh commands that do not directly correspond to the HTTP methods (such as run).
To get a list of commands under tm.util (/mgmt/tm/util in iControl REST), type TAB in tmsh: e.g.,
root@(ltm1311)(cfg-sync Standalone)(Active)(/Common)(tmos) run util [TAB] Components: admdb fips-card-sync ping ssh-keyswap unix-ls bash fips-util ping6 ssldump unix-mv ccmode gencert platform_check sys-icheck unix-rm clientssl-ciphers get-ccn-dossier platform_diag tcpdump updatecheck diadb get-dossier qkview telnet vconsole dig ihealth racoonctl test-monitor verify-encryption dnat imish scp tracepath zebos domain-tool ipsecalgdb serverssl-ciphers tracepath6 establish-adfs-trust lsndb sftp traceroute finalize-custom-ami netstat sipdb traceroute6
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com