I have a feeling I know what is going on. The issue is that the ‘members’ keyword actually needs a ‘sequencesequence’, which you’ve tried to represent by a nested list:
members=[[PMD]]
This is very reasonable and a natural way to try to do this. But unfortunately the issue is that Suds can’t extrapolate what kind of object you’re really trying to pass, so it’s not able to create the XML tree to represent it. What you need to do is coerce Suds into making the correct object structure. Here’s how.
Printing out the params attribute for the create() or add_member() methods, you can see this:
In [6]: b.GlobalLB.Pool.add_member.params
Out[6]:
[(pool_names, u’Common.StringSequence’),
(members, u’GlobalLB.Pool.PoolMemberDefinitionSequenceSequence’)]
So here is what to do: Create the sequence type, add your pool member definition, then put the sequence object inside a list.
In [14]: seq = b.GlobalLB.Pool.typefactory.create('GlobalLB.Pool.PoolMemberDefinitionSequence')
In [14]: seq.items = [] Make an attribute called ‘items’ that is a list object.
Then:
seq.items.append(PMD) add the PMD to this list object.
Then call it like this:
b.GlobalLB.Pool.add_member(pool_names=[Wide_Ip_Pool_Name], members=[seq])
So the pool member definition sequence is now a real object, wrapped in a list (a sequencesequence!).
At some point I want to look at writing some helpers for this type of use case. IMO the iControl API is complicated with this stuff because it allows users to create multiple objects. So a PoolMemberDefinitionSequence translates to: a list of pool members. A 'GlobalLB.Pool.PoolMemberDefinitionSequenceSequence’ is a list of pool member sequences, which have pool member objects inside of them.
I know it‚Äôs confusing ‚Äì it is for me too. Sorry for that. One day I‚Äôll try and create a wrapper for it and simplify things via a ‚Äòshortcuts‚Äô api or some such thing. But I need to think carefully about it because it‚Äôs easy to make bad assumptions and break stuff. If any of you have ideas on a non-brittle way to do this please let me know; I’d love the input.
HTH,
-Matt