[python]Working with F5 iControl API on listing the virtual servers and pools

I am extending my demo script to demonstrate the viability to use iControl with our orchestrator for automatic F5 load balancer server provisioning.

I need to write a function to enumerate the pools and virtual servers, and here is how it is done. See the basic concept of F5 SDK here: https://f5-sdk.readthedocs.io/en/latest/userguide/basics.html

The collection has a method call get_collection() using this can easily enumerate existing pools and virtual server names.

Here’s the sample code:

from f5.bigip import ManagementRoot

    ltm = ManagementRoot("", "admin", "121278").tm.ltm
except Exception as e:

# Collect the names of available pools and virtual servers.
pools = ltm.pools.get_collection()
vses = ltm.virtuals.get_collection()

# list the collections
for pool in pools:

for vs in vses:
This entry was posted in F5, Python, Scripting and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s