Forum Discussion

spirrello_22970's avatar
spirrello_22970
Icon for Nimbostratus rankNimbostratus
Nov 09, 2015

Add Server to F5 Load Balancer

Hi,

 

I'm trying to develop a python script to add to our server building process to automatically add servers to the F5. When I run the following code I keep getting an output of "None". Can someone please shed some light?

 

def add_node_v10(lb_ip,node_name,node_ip): TEST VARs lb_ip = '10.151.70.6' node_ip = '192.168.100.101' node_name = 'TEST-SVR'

 

lb_obj = pc.BIGIP(
hostname = lb_ip,
username = 'admin',
password = acct,
fromurl = True,
wsdls = ['LocalLB.NodeAddress'])

print lb_obj.LocalLB.NodeAddress.create('192.168.100.100', 0)

add_node_v10('10.151.70.6','TEST-SVR','192.168.100.100')

 

2 Replies

  • Hello Spirello,

     

    I assume if you named your function add_node_v10 it's because you're running 10.x LTM and you have install bigsuds.

     

    As I'm running 11.x LTM instance I can not test the following code, but,

     

    I think you have to pass list as parameters to the create function,

     

    as said in the documentation (https://devcentral.f5.com/wiki/iControl.LocalLB__NodeAddress__create.ashx)

     

    the prototype is:

     

      create(
        in String [] node_addresses,
        in long [] limits
      );
    

    Syntax "String [] node_addresses" mean "list of String", where "String" is a node_address

     

    With your sample you should send

     

    lb_obj.LocalLB.NodeAddress.create(['192.168.100.100'], [0])
    

    By the way, as the return type of create function is "void", so you will not print anything 😉