Forum Discussion
Python SDK create FQDN nodes and add to Pool
Hi,
Does anyone know how to create an FQDN node using Python SDK?
Adding a stock standard node seems to be really straight forward but can't figure out the syntax needed for adding FQDN nodes. Here is a snippet of the code that worked for creating a standard node.
if v_method == 'addnodes': mynode = bigip.ltm.nodes.node.create(name=v_nodesFQDN, address=v_nodeaddress, partition=v_ltmPartition, description=v_description)
Hoping, once FQDN node has been created then adding it to a pool should be same code used as if adding a standard node. Snippet of Code for adding node to pool.
if v_method == 'addmembers':
if bigip.ltm.pools.pool.exists(name=v_poolName, partition=v_ltmPartition):
mypool = bigip.ltm.pools.pool.load(name=v_poolName, partition=v_ltmPartition)
mymembers = mypool.members_s.members.create(partition=v_ltmPartition, name="%s:%s" % (v_nodesFQDN, v_nodePort))
the iControl_REST_API_Reference manual provides little explanation for this one. FQDN falls under the category of Associated Arrays and Lists.
1 Reply
- Oxenburger_1420
Nimbostratus
This link below answered my question - nodes/fqdn defined under a structure, so wrapping parenthesis around the name and string did the trick.
https://clouddocs.f5.com/api/icontrol-rest/APIRef_tm_ltm_node.html
Here is the piece of code that made it work.
if v_method == 'addnodesfqdn': mynode = bigip.ltm.nodes.node.create(name=v_nodesFQDN, address=v_nodeaddress, partition=v_ltmPartition, description=v_description, fqdn={'name':"%s" % (v_nodesFQDN)})
The part that seems most relevant is : fqdn={"name":"%s" % (v_nodesFQDN)})
Without the variable names it would look something like this:
if v_method == 'addnodesfqdn': mynode = bigip.ltm.nodes.node.create(name='server1.test.com', address='any6', partition='Test', description='test node', fqdn={"name":"server1.test.com"})
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