23-Mar-2011 21:39
In short, I'm issuing the following API command using pycontrol:
c.set_address_class_member_data_value([dealloc_address_class], [["pending"]])
where c is a BIG-IP class object.
dealloc_address_class contains:
(LocalLB.Class.AddressClass){
name = "dev_staging_allocation"
members[] =
(LocalLB.Class.AddressEntry){
address = "5.5.5.7"
netmask = "255.255.255.255"
},
}
"dev_staging_allocation" is a class/data-group on the BIG-IP that contains a list of "unallocated" IP addresses.
I am trying to update the associated value -- which is currently the string "unallocated" -- and want to change it to "pending." The API call succeeds with no error but the value is not updated on the BIG-IP. I see the following in the icontrol debug logs:
Mar 23 16:08:06 local/s0-bigip-lb2 debug iControlPortal.cgi[16402]: LocalLB:-------------------------------------
Mar 23 16:08:06 local/s0-bigip-lb2 debug iControlPortal.cgi[16402]: Portal:User/Partition map:
Mar 23 16:08:06 local/s0-bigip-lb2 debug iControlPortal.cgi[16402]: Portal: User: admin, Partition: Common
Mar 23 16:08:07 local/s0-bigip-lb2 debug iControlPortal.cgi[16402]: LocalLB:+++++++++++++++++++++++++++++++++++++
Mar 23 16:08:07 local/s0-bigip-lb2 debug iControlPortal.cgi[16402]: LocalLB:Class::set_address_class_member_data_value ( ) called by user "admin"
Mar 23 16:08:07 local/s0-bigip-lb2 debug iControlPortal.cgi[16402]: LocalLB: Class name: dev_staging_allocation
Mar 23 16:08:07 local/s0-bigip-lb2 debug iControlPortal.cgi[16402]: LocalLB: Value class members:
Mar 23 16:08:07 local/s0-bigip-lb2 debug iControlPortal.cgi[16402]: LocalLB: [0] 5.5.5.7/255.255.255.255 -> p[<)(0[?[HdHdhV`:`:[ar 23 16:08:07 local/s0-bigip-lb2 debug iControlPortal.cgi[16402]: LocalLB:---------------------------------
The garbage characters in the last log line are obviously concerning. Any idea what's going on?
24-Mar-2011 04:39
-Matt
24-Mar-2011 11:37
-M
24-Mar-2011
13:22
- last edited on
31-May-2023
15:35
by
JimmyPackets
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.
24-Mar-2011 13:40
-M
01-Apr-2011 05:13
-Matt
01-Apr-2011 09:58