Forum Discussion
Use F5 Python SDK to Create Node with Pool in Separate Partition
This code will add a node to the Common Partition. Once the node is added in common it needs to be added to two different Partitions. For example below adding it to one different Partition. I have read this before but when running "update" the old information is removed and the new is added. How can I append the new to the old using the SDK?
Get Started
from import ManagementRoot
Connect to the BigIP and configure the basic objects
mgmt = ManagementRoot("bigip.example.com", "admin", "somepassword")
Add New Node
mynode = mgmt.tm.ltm.nodes.node.create(name='10.5.183.191', address='10.5.183.191', description='12345avc', partition='Common')
Now figure out how to add this node in different pools Load an existing pool using "load" command "CL-COM_SELFSERV" is Partition, "pool1" is existing pool
pool_a = mgmt.tm.ltm.pools.pool.load(name='pool1', partition='CL-COM_SELFSERV')
Members (.191 was in pool already and want to add .192 and it removed .191. I need both to stay.
pool_a.members = '10.5.183.192:8080'
Complete update to pool (When using "update" It removes everything and then adds in new member.
pool_a.update()
So when adding new member to a pool it wipes out the existing members. I then tried
pool_a.members.append('10.5.183.192:8080')
but received error:
Traceback (most recent call last): File "", line 1, in pool_a.members.append('10.5.183.192:8080') File "C:\Python27\lib\site-packages\f5\bigip\mixins.py", line 125, in getattr raise AttributeError(error_message) AttributeError: 'f5.bigip.tm.ltm.pool.Pool'>' object has no attribute 'members'
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