Working with F5 SOAP API: The bad, the bad, and the ugly...
In todays continuous delivery world we're lucky to have an API option to manage our F5 Load Balancers, unfortunately it's all SOAP. When we first started automating our deployments, load balancers were managed with SSH and manually in a web user interface. This option became less than optimal as things had to scale.
After searching and signing up at DevCentral, F5's development resource site, we found that F5 provided some libraries in different languages to interact with their API. Unfortunately, most of the libraries on DevCentral weren't well maintained and had very cryptic instructions. In the case of the Ruby Library, there were dependencies that only work with 1.8.7 and hadn't really been touched in years. After trying to work with these libraries, it became apparent we'd have to find a different way of interacting with our load balancers.
I've gathered a few tips to keep in mind when working with F5 SOAP APIs.
Tip #1 - Try to ignore everything Ruby you see on DevCentral.
The DevCentral information relating to Ruby and F5 APIs is sparse and vague. Most of the information I was able to grok was from the Perl and PHP libraries, which seemed to have gained a little more traction. After much searching and testing of bad libraries, I came to a solution that worked for us. One thing we found to be helpful on the DevCentral was the iControl API reference, which helped fill some gaps in the WSDL.
Tip #2 - Throw out the vendor libraries and start talking SOAP.
Savon is a gem I ran across when poking around on RailsCast. This SOAP gem is well-documented, and was very easy to integrate into our existing Ruby apps. After we started getting through the syntax, we were able to integrate adding, removing, checking status and dropping connections on members in load balancers using all API calls.
Tip #3 - If you're not after really complex interactions, write them yourself.
If you don't have to use every single piece of functionality in an F5, don't! We've been able to get away with only modeling a small subset of features that we use to automate deployments. Basic features like adding, removing and checking on status enable us to extend provisioning ability to developers and quality engineers which in turn will make everyone's lives a little easier. Here are some SOAP/XML examples with Savon to do some simple actions with F5 LTM Load Balancers. We used SOAPUI to make some working examples from the WSDL. WSDL files can be found on your F5 at the following path https://your.f5.ip.addr/iControl/iControlPortal.cgi which is protected with HTTP basic authentication.
Even if a vendor doesn't make a great API library, there's always a way of automating your procedures to mitigate human error. If you need to work with SOAP and Ruby, use Savon. When working with SOAP it's nice to have working examples in XML. Thanks Open Source!