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 for manipulating BigIP LTM configs. However, I need to write some web interfaces and I want to retrieve the value set from within an enumeration in the WSDL, say for example LocalLB... LBMethods. Not exactly sure how to reference these enumerations within the pycontrol setup that's for sure. So what am I missing? How can I retrieve these values to use for the options in a drop-down list box on a web interface, basically... Thanks.
--Carl
- L4L7_53191
Nimbostratus
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']}
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')
- Carl_Rosevear_1
Nimbostratus
Matt... thanks for your help! No, that's not exactly what I'm trying to do. Perhaps my code snippet was misleading... - Carl_Rosevear_1
Nimbostratus
In this case, progress is limited by the knowledge of the guy trying to make said progress. Okay, so I'm used to passing around literal values in Python and some objects here and there but I really don't know where to go from here. If you'd teach me how to fish here, I hopefully won't be asking for fish anymore. I get:In [14]: b.LocalLB_Pool._service._wsdl.types.items() Out[14]: [(u'urn:iControl',
- L4L7_53191
Nimbostratus
Ok, I finally got to the LB methods. Thanks a ton for the question, as this was pretty useful from a ZSI internals perspective. You totally nailed it with the 'facets':In [258]: for f in res.facets: .....: print f.getAttributeDictionary()['value'] .....: .....: LB_METHOD_ROUND_ROBIN LB_METHOD_RATIO_MEMBER LB_METHOD_LEAST_CONNECTION_MEMBER LB_METHOD_OBSERVED_MEMBER LB_METHOD_PREDICTIVE_MEMBER LB_METHOD_RATIO_NODE_ADDRESS LB_METHOD_LEAST_CONNECTION_NODE_ADDRESS LB_METHOD_FASTEST_NODE_ADDRESS LB_METHOD_OBSERVED_NODE_ADDRESS LB_METHOD_PREDICTIVE_NODE_ADDRESS LB_METHOD_DYNAMIC_RATIO LB_METHOD_FASTEST_APP_RESPONSE LB_METHOD_LEAST_SESSIONS LB_METHOD_DYNAMIC_RATIO_MEMBER LB_METHOD_L3_ADDR
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