Forum Discussion
Carl_Rosevear_1
Nimbostratus
May 18, 2009Help with PyControl Accessing Enumerations
So, I'm new to iControl. I'm new to SOAP. I'm pretty Python-savvy and network-savvy but I need some help. I have already re-written some of my old SSH modules to make use of iControl instead of SSH...
L4L7_53191
Nimbostratus
May 19, 2009Carl: 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
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
