Forum Discussion
mhite_60883
Jan 22, 2012Cirrocumulus
Test API version to implement backward compatibility
Hello,
What is the recommended best practice for determining API version via iControl? I have a mixed 10.x and 11.x environment, and I would like to create versions of various scripts that can work with both API versions (when possible). Ideally, the various scripts will test the API version of the device before sending various API-version specific calls.
Thanks for any pointers -- much appreciated!
-M
- Mark_Worrell_98Historic F5 AccountHi -
- mhite_60883CirrocumulusAh, so I suppose if I want a version independent way of doing this, I need to just pick an API endpoint that is supported in V9 and above, ie.
- Another option is to use the System.SystemInfo.get_system_information() method.
- mhite_60883CirrocumulusThis is what I ended up doing. Alternatively I could have had the WSDL locally stored and not performed the 2nd connection.
WSDLS_PRE = ['Management.Partition', 'LocalLB.Pool', 'LocalLB.NodeAddress', 'LocalLB.PoolMember'] WSDLS_V11 = ['LocalLB.Pool', 'LocalLB.NodeAddressV2', 'LocalLB.Pool', 'System.Session'] Create F5 object print "Connecting to iControl API on LTM %s..." % ltm try: b = f5_build_bigip_object(ltm, user, pw, ['System.SystemInfo'], soap_debug=SOAP_DEBUG) except Exception, detail: print "=== Exception Details ===\n%s\n=========================" % detail fatals += 1 continue try next ltm in loop else: print "Connection successfully established." Check API version print "Determining iControl API version supported on LTM %s..." % ltm try: major, minor, patch = f5_get_api_version(b) except Exception, detail: print "=== Exception Details ===\n%s\n=========================" % detail fatals += 1 continue try next ltm in loop else: print "API version is %d.%d.%d." % (major, minor, patch) if major >= 11: wsdls = WSDLS_V11 else: wsdls = WSDLS_PRE Callback and create f5 object using version dependent wsdls print "Reconnecting to iControl API to request v%s specific WSDLs..." % major try: b = f5_build_bigip_object(ltm, user, pw, wsdls, soap_debug=SOAP_DEBUG) except Exception, detail: print "=== Exception Details ===\n%s\n=========================" % detail fatals += 1 continue try next ltm in loop else: print "Connection successfully established."
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