Forum Discussion

Jeffro21_47444's avatar
Jeffro21_47444
Icon for Nimbostratus rankNimbostratus
Feb 05, 2012

Setting the name of a node with iControl

Hello,

 

 

I am using the iControl JAVA API's and have been able to create a node and assign it into a pool by setting the IP address and port of the node, but I would like to be able to set the name of the node. I have tried searching all the API's and examples and have not found anything to do this.

 

 

 

Does anyone know how to do this?

 

9 Replies

  • Hello Jeffro21,

     

     

    I use the Perl iControl API.

     

    I've not used this 'Node' part of the API you speak of, but I did find:

     

     

    http://devcentral.f5.com/wiki/iControl.LocalLB__NodeAddressV2.ashx

     

     

    Seems this newer version of iControl:/LocalLB/NodeAddress class completely replaces the older version.

     

    It says its for F5 Big IP version 11.0.0 and higher.

     

     

    What version of F5 Big IP appliance(s) platform(s) are you targeting?

     

    Can you please indicate if this is indeed what you are using (i.e. iControl:/LocalLB/NodeAddress class) to create your 'Node'?

     

    Seems the newer version uses names to associated IP addresses and ports to, rather than just using IP addresses.

     

     

    ~ snovakov

     

  • Hey,

     

     

    I am using V10.2 and I am trying to create a node with the following snippet.

     

     

     

    publicvoid create() throws Exception

     

    {

     

    validate();

     

     

    String [] containingPoolList = {containingPool.getName()};

     

    iControl.CommonIPPortDefinition memDefinition = new iControl.CommonIPPortDefinition(ipAddress, portNumber);

     

    iControl.CommonIPPortDefinition [] memDefinitionArr = {memDefinition};

     

    iControl.CommonIPPortDefinition [][] memDefinition2DArr = {memDefinitionArr};

     

     

    iConInterfaces.getLocalLBPool().add_member(containingPoolList, memDefinition2DArr);

     

    }

     

     

  • What is this create() method? Is this your code (i.e. are you wrapping Java iControl code into your own 'create()' method)?

     

    What does 'validate()' do?

     

    Are the 'ipAddress' and 'portNumber' declared and initialized somewhere else?

     

    Have you tried discovering *where* in this create() method the code is either blowing-up or erroring-out?

     

    In Perl world, I find logging or print statements to the screen are easiest to use for debugging purposes.

     

     

    ~ snovakov

     

  • Yeah the above code actually works and is functional. I was wondering if there is a way to set the name of a node while setting the port and IP. So far I haven't found anything.
  • This may be a helpful thread:

     

     

    http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/51/aft/2156840/showtab/groupforums/Default.aspx

     

     

    Technically, when you use create(), it will create the node address object for you if it doesn't exist. Create in itself doesn't let you set a screen_name, description, etc. You'll have to use a different API call to do that from what I can tell...
  • I believe if you use http://devcentral.f5.com/wiki/iControl.LocalLB__NodeAddressV2__create.ashx to create the NodeAddress, you can specify a name. To be honest, it's probably better to leave the name as the IP address and just set a description using http://devcentral.f5.com/wiki/iControl.LocalLB__NodeAddressV2__set_description.ashx.

     

     

    Be aware that setting the port is something that occurs when you associate a node to a pool, not when you create a node.

     

     

    Also, keep in mind this is how V11 API works. Old behavior is to set a screen name.
  • like mhite indicated, pre-v11 you need to create the node first in the LocalLB::NodeAddress interface, then use the set_screen_name method and pass in the node and name as parameters.