Forum Discussion
mhite_60883
Cirrocumulus
Mar 24, 2011set_address_class_member_data_value method help
Hello! I'm having no luck getting the set_address_class_member_data_value method to work.
In short, I'm issuing the following API command using pycontrol:
c.set_address_class_memb...
L4L7_53191
Nimbostratus
Mar 24, 2011Ok. First off, let me give you a heads up in advance: this one is odd, and it's definitely one of the outliers I've seen in the API. So typically we do a SequenceSequence object like this to represent the items:
seq_seq.items = ['you_stuff_here']
So far so good. But in this case, the actual XML that the call requires looks different. In other words, it seems (to me, at least) like there's an inconsistency in the API. For data group values (in the classes WSDL), you need to actually do this to get suds to setup the correct XML to work:
Setup a sequence via the type factory, then:
seq.values = ['YOUR_NEW_VALUE']
Now set your seq_seq up like this:
seq_seq.items = [values]
And make the call like this!
c.set_address_class_member_data_value(class_members = [cl_member],values= [seq_seq])
See that last structure, the [seq_seq] part? That's the departure from the norm, as is the 'values' attribute we have to set against the inner sequence object. Anyhow, here's a working sample, I hope it helps.
c = b.LocalLB.Class
Setup our types.
add_entry = c.typefactory.create('LocalLB.Class.AddressEntry')
cl_member = c.typefactory.create('LocalLB.Class.AddressClass')
seq = c.typefactory.create('Common.StringSequence')
seq_seq = c.typefactory.create('Common.StringSequenceSequence')
Set our attributes.
add_entry.address='192.168.1.100'
add_entry.netmask='255.255.255.255'
cl_member.name = 'dc-post'
cl_member.members = [add_entry]
Ok, now for the wierd part.
seq.values = ['MY_NEW_VALUE']
seq_seq.items = [seq.values]
orig_val = c.get_address_class_member_data_value(class_members = [cl_member])
print "Here is the original value: ", orig_val
print "Setting new value..."
c.set_address_class_member_data_value(class_members = [cl_member],values= [seq_seq])
new_val = c.get_address_class_member_data_value(class_members = [cl_member])
print "Getting new value...", new_val
Let me know if this works for you.
-Matt
P.S.: thanks to one of our customers, D. Whitt for some absolutely excellent analysis of this.
P.S.S: this should also work for string data groups as well.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects