BIGREST - A Python SDK for F5 iControl REST API
This article is written by, and published on behalf of, DevCentral MVP Leonardo Souza.
---
Hello all, this is going to be my shortest article so far.
As you probably know already both BIG-IP and BIG-IQ have an iControl REST API. However, if you play with that very often, you will find yourself creating some scripts to perform some common tasks. If you put those scripts together, you kind of have an SDK that other people can use to simplify the use of the API.
Almost all vendors these days have an SDK for their products, and the language of choice is mainly Python because of the language simplicity.
As the article title says, I wrote BIGREST that is a Python SDK to work with iControl REST API. The SDK fully supports both BIG-IP and BIG-IQ. I wanted to advance my Python and iControl REST knowledge, so this was a useful way of doing that.
You may be wondering "Isn't there already a Python SDK for iControl REST?", so let me explain that part.
I have used the existing SDK many times in the past, and it was very helpful. The existing Python SDK, the F5-SDK (https://github.com/F5Networks/f5-common-python) is limited, as it mainly supports BIG-IP, and the only supported BIG-IQ functionality is license pools. I wanted to help with the F5-SDK and extend it for BIG-IQ so I looked into the code but I decided the changes I wanted to make made more sense to start from scratch.
Some details about these differences are here
HTTP paths
HTTP paths can be seen as just a tmsh command. In the following examples, HTTP path is “/mgmt/tm/ltm/pool”.
F5-SDK | mgmt.tm.ltm.pools.pool.create(name='mypool', partition='Common') | Python code for every HTTP path; requires more code. |
BIGREST | device.create("/mgmt/tm/ltm/pool", {"name": “mypool”, “partition”: “Common”}) |
The user tells the HTTP path they want to use. all current HTTP paths and new HTTP paths are automatically supported. |
BIG-IQ and Python Support
F5-SDK | created to support BIG-IP REST API supports Python 2 and Python 3 | Python 2 was discontinued in 2020 |
BIGREST | created to support BIG-IP and BIG-IQ. supports only Python 3 | The code can use new Python 3 functionalities to make it simpler to write and read. |
Method Names
F5-SDK |
uses some names of the REST API like collection. | |
BIGREST |
tries to use only tmsh names. |
In this case, you load the objects to memory, and if you want you save them after. Similar to load the configuration from the disk using tmsh, and saving it to the disk after. |
I wrote a very extensive documentation explaining how the SDK works, so you will find all the details there.
For more information, including the link for the code and documentation, go to the code share: https://devcentral.f5.com/s/articles/BIGREST
- JRahmAdmin
Nice work, !! Forked it for any future work I might contribute and for local sandboxing.