Forum Discussion
mhite_60883
Cirrocumulus
Mar 21, 2011LocalLB::Class::set_address_class_member_data_value Problems
Hello F5 friends,
I'm building out some automagic cloud automation. I've got a data group address list called "dev_staging_allocation" defined on an LTM that is supposed to hold a list of all unallocated virtual server IP addresses that are available for provisioning. This data group/class looks like:
[(LocalLB.Class.AddressClass){
name = "dev_staging_allocation"
members[] =
(LocalLB.Class.AddressEntry){
address = "1.1.1.1"
netmask = "255.255.255.255"
},
(LocalLB.Class.AddressEntry){
address = "1.1.1.2"
netmask = "255.255.255.255"
},
(LocalLB.Class.AddressEntry){
address = "1.1.1.3"
netmask = "255.255.255.255"
},
(LocalLB.Class.AddressEntry){
address = "1.1.1.4"
netmask = "255.255.255.255"
},
(LocalLB.Class.AddressEntry){
address = "1.1.1.1.5"
netmask = "255.255.255.255"
},
...
Each of the entries are assigned values: either "allocated", "unallocated", or "pending."
I'm attempting to use pycontrol to look for an unallocated address and mark it as "pending." I've been able to grab the first available "unallocated" address fine. It's when I go to update the member data value list that it all falls apart with a mysterious error:
>>> lb_provision.get_unallocated_address(c, unallocated_identifier)
Traceback (most recent call last):
File "", line 1, in
File "lb_provision.py", line 409, in get_unallocated_address
c.set_address_class_member_data_value(unallocated_identifier_class, [unallocated_identifier_class_member_data_value])
File "/Library/Python/2.6/site-packages/suds/client.py", line 539, in __call__
return client.invoke(args, kwargs)
File "/Library/Python/2.6/site-packages/suds/client.py", line 598, in invoke
result = self.send(msg)
File "/Library/Python/2.6/site-packages/suds/client.py", line 633, in send
result = self.failed(binding, e)
File "/Library/Python/2.6/site-packages/suds/client.py", line 684, in failed
r, p = binding.get_fault(reply)
File "/Library/Python/2.6/site-packages/suds/bindings/binding.py", line 238, in get_fault
raise WebFault(p, faultroot)
WebFault: Server raised fault: 'Error de-serializing array. Too many values in array. Array specified 1, found 127.'
Here's a code snippet:
def build_class_object(ltm, user, pw):
b = pc.BIGIP(hostname=ltm, username=user, password=pw,
wsdls=['LocalLB.Class'], fromurl=True)
c = b.LocalLB.Class
return c
def get_unallocated_address(c, unallocated_identifier):
address_class_list = c.get_address_class_list()
make sure unallocated data group exists
if address_class_list.count(unallocated_identifier) == 1:
unallocated_identifier_class = c.get_address_class([unallocated_identifier])
unallocated_identifier_class_member_data_value = c.get_address_class_member_data_value([unallocated_identifier_class])
find 1st available address
class_length = len(unallocated_identifier_class_member_data_value[0])
if class_length > 0:
for i in range(0, class_length):
if unallocated_identifier_class_member_data_value[0] == "unallocated":
mark it as pending allocation
unallocated_identifier_class_member_data_value[0] = "pending"
c.set_address_class_member_data_value(unallocated_identifier_class, [unallocated_identifier_class_member_data_value])
ip_addr = str(unallocated_identifier_class[0][1][0])
netmask = str(unallocated_identifier_class[0][1][1])
break
else:
print "Error: no unallocated address available"
else:
print "Error: data group is empty"
else:
print "Error: unallocated IP data group %s does not exist" % unallocated_identifier
return ip_addr, netmask
Any ideas of what I'm doing wrong?
It's too bad you can't update the values of individual data group items. Right now -- at least from what I can tell -- you have to replaster the entire value list if you want to update it.1 Reply
- James_Tan_40083
Nimbostratus
HeyWSDL = ['GlobalLB.WideIP'] WIDE_IP_NAME = 'www.foo.com' b = pycontrol.pycontrol.BIGIP(hostname=HOST1, username=USER, password=PASS, fromurl=True, wsdls=WSDL) b.GlobalLB.WideIP.add_alias( wide_ips = [WIDE_IP_NAME], aliases = [['ww1.foo.net', 'ww2.foo.net', 'ww1.foo.com']] )
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