Forum Discussion

Patrick_Chang_7's avatar
Historic F5 Account
Sep 22, 2011

pycontrol pool.add_member problem

I have a customer who is trying pycontrol and got the following:



>>> b = pc.BIGIP(


... hostname = LTM,


... username = USER,


... password = PASS,


... wsdls = [WSDLS],


... fromurl=True


... )


>>> p = b.LocalLB.Pool


>>> p.add_member(


... pool_names = ["new_pool"],


... members = [[ {'address': '', 'port': 80 } ]]


... )


Traceback (most recent call last):


File "", line 3, in


File "/usr/lib/python2.7/site-packages/suds/", line 539, in __call__


return client.invoke(args, kwargs)


File "/usr/lib/python2.7/site-packages/suds/", line 598, in invoke


result = self.send(msg)


File "/usr/lib/python2.7/site-packages/suds/", line 633, in send


result = self.failed(binding, e)


File "/usr/lib/python2.7/site-packages/suds/", line 684, in failed


r, p = binding.get_fault(reply)


File "/usr/lib/python2.7/site-packages/suds/bindings/", line 238, in get_fault


raise WebFault(p, faultroot)


suds.WebFault: Server raised fault: 'Could not find element by name: address'




I cannot figure out for the life of me why address is not showing up as an element in members. Has anyone seen this before? Is it an indication that pycontrol was not set up properly? If so, what part? Thanks.


4 Replies

  • Patrick_Chang_7's avatar
    Historic F5 Account
    After further experimentation, it would appear that somehow the 'address' is not being parsed in my call and the error message is referring to the fact that it can't find the element named address in my list. I also realized that I was using a 64bit version of Python 2.7.2 and that all the examples were done with Python 2.6.4. Is there are a syntax difference between the 2 versions?
  • Patrick_Chang_7's avatar
    Historic F5 Account
    Turns out that the pool member had to be created with the correct structure. The devcentral examples are not quite right.





    >>> member_seq = s.LocalLB.Pool.typefactory.create('Common.IPPortDefinitionSequenceSequence')


    >>> member_seq.items = []


    >>> new_member = s.LocalLB.Pool.typefactory.create('Common.IPPortDefinition')


    >>> new_member.address=''


    >>> new_member.port='80'


    >>> member_seq.items.append(new_member)


    >>> s.LocalLB.Pool.get_list()




    >>> s.LocalLB.Pool.add_member(pool_names=["pool1"], members=[member_seq])


    >>> s.LocalLB.Pool.get_member(pool_names=["pool1"])




    address = ""


    port = 80






  • hey Pat, which examples are not correct? There are changes from v1 to v2 in pycontrol that make them incompatible. v2 is a little more strict with formats but Mr L4L7 swears this is a good thing!