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-SDKmgmt.tm.ltm.pools.pool.create(name='mypool', partition='Common')Python code for every HTTP path;

requires more code.
BIGRESTdevice.create("/mgmt/tm/ltm/pool", {"name": “mypool”, “partition”: “Common”})

The user tells the HTTP path they want to use.

less code to write and support

all current HTTP paths and new HTTP paths are automatically supported.

    BIG-IQ and Python Support

    F5-SDKcreated to support BIG-IP REST API

    supports Python 2 and Python 3
    Python 2 was discontinued in 2020
    BIGRESTcreated 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.

    Example: mgmt.tm.ltm.pools.get_collection()

     
    BIGREST

    tries to use only tmsh names.

    Example: device.load("/mgmt/tm/ltm/pool")

    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

    Published Jun 23, 2020
    Version 1.0

    Was this article helpful?