Forum Discussion
L4L7_53191
May 19, 2009Nimbostratus
Carl: I'm not 100% clear on what you're trying to accomplish, but perhaps something like this would work?
In [14]: pools = b.LocalLB_Pool.get_list()['return']
In [15]: b.LocalLB_Pool.get_lb_method(pool_names = pools)
Out[15]:
{'return': ['LB_METHOD_ROUND_ROBIN',
'LB_METHOD_ROUND_ROBIN',
'LB_METHOD_ROUND_ROBIN',
'LB_METHOD_OBSERVED_MEMBER',
'LB_METHOD_ROUND_ROBIN',
'LB_METHOD_ROUND_ROBIN',
'LB_METHOD_ROUND_ROBIN',
'LB_METHOD_ROUND_ROBIN',
'LB_METHOD_ROUND_ROBIN',
'LB_METHOD_ROUND_ROBIN',
'LB_METHOD_ROUND_ROBIN',
'LB_METHOD_ROUND_ROBIN',
'LB_METHOD_ROUND_ROBIN']}
Where you could then convert into a dict, tuple, etc...the return list from get_lb_methods() should be in order of your pool list argument, so you can create pretty much whatever data structures you want. I've done stuff like this in the past:
In[17]: pools = b.LocalLB_Pool.get_list()['return']
In [18]: methods = b.LocalLB_Pool.get_lb_method(pool_names = pools)['return']
In [19]: combined = zip(pools, methods)
In [21]: combined[10]
Out[21]: ('pycontrol2-test', 'LB_METHOD_ROUND_ROBIN')
I hope this helps. If not, please post back.
-Matt