F5 Interacting with iControl’s get_instance method via BigSuds

In order to interact with the F5 via Python the best option available is bigsuds. This is a Python module that allows you to interact with the F5 API iControl via a set of Python classes.

Typically you will normally find all the methods you need to interact with your F5 without issues. However, there are times that you may be unable to find the required method in order to obtain the information you require.  This is were the get_instance method comes into play. get_instance allows you to return the configuration as a string.

Within this article we will provide the steps to obtain the network failover configuration as there is no direct method for obtaining this configuration via iControl in v10.2.4.

Import/Build Connection

First of all we import the bigsuds module and also build a connection to our F5.

>>> import bigsuds
>>> import pprint
>>> b = bigsuds.BIGIP(hostname = '',username = "admin", password = "#####")


We next perform a look up through our classes to confirm the class we are interested in. Add the nessacary strings to the filter key to filter the results.

>>> pprint.pprint([x['name'] for x in b.Management.ChangeControl.get_class_info(filter="")])
['Local Traffic / Profiles / profile_mblb',
'Local Traffic / Profiles / profile_ntlm',
'System / dns',
'System / httpd',
'System / logrotate',
'System / ntp',
'System / password_policy',
'System / sshd',
'System / remote_users',
'System / syslog',
'System / ltm', 


Once we have our class we next to obtain the instances for the class.

>>> b.Management.ChangeControl.get_instance_info(classes=[{"name":"System / failover","transact
[[{'name': 'System / failover / failover', 'transaction_id': 55485}]]

Get Config

Now that we have our instance. We can pass this to the F5 so that the configuration is returned.

>>> b.Management.ChangeControl.get_instance(instance_names=["System / failover / failover"],ins
[{'info': {'name': 'System / failover / failover', 'transaction_id': 55485}, 'data': 'failover 
{\n   network failover enable\n   peer mgmt addr\n   redundant enable\n   standby link 
down time 0\n   unit 2\n   unicast peer FAILOVER {\n         dest addr\n         port 1
026\n         source addr\n      }\n}', 'format': 'FORMAT_SHELL'}]
Rick Donato

Want to become an F5 Loadbalancers expert?

Here is our hand-picked selection of the best courses you can find online:
F5 BIG-IP 101 Certification Exam – Complete Course
F5 BIG-IP 201 Certification Exam – Complete Course
and our recommended certification practice exams:
AlphaPrep Practice Tests - Free Trial