Forum Discussion

dani_martinez_2's avatar
dani_martinez_2
Icon for Nimbostratus rankNimbostratus
May 13, 2018

Assign an Existing Node to Pool in F5 BIG IP through F5-SDK

Is there any way to assign a node that already exists in the Common partition to a pool that also already exists? For example:

 

Call pool and node
pool = bigip.tm.ltm.pools.pool.load(name="mypool", partition='Common')
node = bigip.tm.ltm.nodes.node.load(name="mynode", partition='Common')
First Option
pool.members_s.members.create(name=node.name, partition="Common")
pool.update()
Second Option
pool.members_s.members[0] = node    

I don't know if the code is exactly correct, thanks in advance

 

2 Replies

  • You almost had it!

    pool = mgmt.tm.ltm.pools.pool.load(partition='Common', name='mypool')
    pool.members_s.members.create(partition='Common', name='mynodename:80')
    

    The secret sauce is in the overloaded

    name
    argument - it is really "node_name:service_port".

    The above adds an existing node called "mynodename" to the pool and sets its service port to 80.