Forum Discussion

jross_47179's avatar
jross_47179
Icon for Nimbostratus rankNimbostratus
Dec 15, 2010

LocalLB::Class::set_string_class_member_data_value does not work

The LocalLB::Class::set_string_class_member_data_value API does not appear to save values as expected.

 

 

First, a call to add_string_class_member() on an existing data group is immediately followed by a call to set_string_class_member_data_value() on the newly added member; the member itself is saved (i.e., the first call) yet the value (i.e., the second call) is not saved.

 

 

The API is being invoked using python via the PyControl_v2 Library.

 

 

There are no apparent errors in the LB log file, /var/log/ltm and even when enabling debugging, the output shows good SOAP responses. Below is an example script and the output that demonstrates the above-described behavior - I'm wondering if I'm missing a step or doing something wrong.

 

 

Any thoughts, recommendations, etc. would be most welcome. Thanks in advance!

 

 

~~~~~~~~~~

 

 

import pycontrol.pycontrol as pc

 

 

connect to LB

 

lb = pc.BIGIP(hostname = "x.x.x.x", username = "user", password = "password", fromurl = True, wsdls = ['System.SystemInfo', 'LocalLB.Class'])

 

 

si = lb.System.SystemInfo

 

print "Connected to F5 %s, version %s\n" % (si.get_marketing_name(), si.get_version())

 

 

c = lb.LocalLB.Class

 

 

create the class

 

c.create_string_class(classes = [{'name': "theClass", 'members': []}])

 

 

print "Contents BEFORE (should be empty):"

 

print c.get_string_class(["theClass"])

 

print c.get_string_class_member_data_value(c.get_string_class(["theClass"]))

 

print "\n"

 

 

add some members with values

 

c.add_string_class_member(class_members = [{'name': "theClass", 'members': ["theFirstMember"]}])

 

c.set_string_class_member_data_value(class_members = [{'name': "theClass", 'members': ["theFirstMember"]}] , values = [["theFirstValue"]])

 

 

c.add_string_class_member(class_members = [{'name': "theClass", 'members': ["theSecondMember"]}])

 

c.set_string_class_member_data_value(class_members = [{'name': "theClass", 'members': ["theSecondMember"]}] , values = [["theSecondValue"]])

 

 

print "Contents AFTER (should have two members with two values):"

 

print c.get_string_class(["theClass"])

 

print c.get_string_class_member_data_value(c.get_string_class(["theClass"]))

 

print "\n"

 

 

cleanup to allow rerun

 

c.delete_class(classes = ["theClass"]) print "done.\n"

 

  • This is working for me in Ruby on Version 11 api:

    
    !/usr/bin/env ruby
    
    require 'rubygems'
    require 'f5-icontrol'
    require 'json'
    require 'socket'
    
    bigip = F5::IControl.new(
    'host',
    'user',
    'pass',
    [
    'Management.Partition',
    'LocalLB.Class'
    ]
    ).get_interfaces
    env = ARGV.shift
    nodes = ARGV
    
    begin
    bigip["LocalLB.Class"].create_string_class([
    {
    "name" => "test-auto",
    "members" => [
    "test1",
    "test2"
    ]
    }
    ])
    
    bigip["LocalLB.Class"].set_string_class_member_data_value(
    [
    {
    'name' => "test-auto",
    'members' => [
    "test1",
    "test2"
    ]
    }
    ],
    [
    [
    "hi",
    "meow"
    ]
    ]
    )