F5 Friday: Python SDK for BIG-IP
We know programmability is important. Whether we’re talking about networking and SDN, or DevOps and APIs and templates, the most impactful technologies and trends today are those involving pro...
Published Mar 11, 2016
Version 1.0Lori_MacVittie
Employee
Joined October 17, 2006
Lori_MacVittie
Employee
Joined October 17, 2006
Eric_Chen
Aug 19, 2016Employee
Updated example. Previous example from the article reflects an earlier release of the F5 Python SDK:
from f5.bigip import ManagementRoot
Connect to the BigIP
mgmt = ManagementRoot("bigip.example.com", "admin", "somepassword")
Get a list of all pools on the BigIP and print their names and their
members' names
pools = mgmt.tm.ltm.pools.get_collection()
for pool in pools:
print pool.name
for member in pool.members_s.get_collection():
print member.name
Create a new pool on the BIG-IP
mypool = mgmt.tm.ltm.pools.pool.create(name='mypool', partition='Common')
Load an existing pool and update its description
pool_a = mgmt.tm.ltm.pools.pool.load(name='mypool', partition='Common')
pool_a.description = "New description"
pool_a.update()
Delete a pool if it exists
if mgmt.tm.ltm.pools.pool.exists(name='mypool', partition='Common'):
pool_b = mgmt.tm.ltm.pools.pool.load(name='mypool', partition='Common')
pool_b.delete()