{"id":945,"date":"2015-10-20T11:54:13","date_gmt":"2015-10-20T11:54:13","guid":{"rendered":"https:\/\/fir3netwp.gmsrrpobkbd.com\/2015\/10\/20\/f5-python-bigsuds-a-look-at-the-get-instance-method\/"},"modified":"2023-02-24T12:59:54","modified_gmt":"2023-02-24T12:59:54","slug":"f5-python-bigsuds-a-look-at-the-get-instance-method","status":"publish","type":"post","link":"https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html","title":{"rendered":"F5 Interacting with iControl’s get_instance method via BigSuds"},"content":{"rendered":"

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<\/a> via a set of Python classes.<\/p>\n

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. \u00a0This is were the get_instance<\/span><\/a> method comes into play. get_instance<\/span> allows you to return the configuration as a string.<\/p>\n

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.<\/p>\n

Import\/Build Connection<\/h2>\n

First of all we import the bigsuds module and also build a connection to our F5.<\/p>\n

>>> import bigsuds\r\n>>> import pprint\r\n>>> b = bigsuds.BIGIP(hostname = '10.1.1.10',username = \"admin\", password = \"#####\")<\/pre>\n

Classes<\/h2>\n

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.<\/p>\n

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

Instances<\/h2>\n

Once we have our class we next to obtain the instances for the class.<\/p>\n

>>> b.Management.ChangeControl.get_instance_info(classes=[{\"name\":\"System \/ failover\",\"transact\r\nion_id\":0}])\r\n[[{'name': 'System \/ failover \/ failover', 'transaction_id': 55485}]]<\/pre>\n

Get Config<\/h2>\n

Now that we have our instance. We can pass this to the F5 so that the configuration is returned.<\/p>\n

>>> b.Management.ChangeControl.get_instance(instance_names=[\"System \/ failover \/ failover\"],ins\r\ntance_format=\"FORMAT_SHELL\")\r\n[{'info': {'name': 'System \/ failover \/ failover', 'transaction_id': 55485}, 'data': 'failover \r\n{\\n   network failover enable\\n   peer mgmt addr 8.8.8.8\\n   redundant enable\\n   standby link \r\ndown time 0\\n   unit 2\\n   unicast peer FAILOVER {\\n         dest addr 8.8.8.8\\n         port 1\r\n026\\n         source addr 8.8.8.7\\n      }\\n}', 'format': 'FORMAT_SHELL'}]<\/pre>\n
<\/div>\n","protected":false},"excerpt":{"rendered":"

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 … Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"yoast_head":"\nF5 Interacting with iControl's get_instance method via BigSuds<\/title>\n<meta name=\"description\" content=\"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\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"F5 Interacting with iControl's get_instance method via BigSuds\" \/>\n<meta property=\"og:description\" content=\"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\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html\" \/>\n<meta property=\"og:site_name\" content=\"Fir3net\" \/>\n<meta property=\"article:published_time\" content=\"2015-10-20T11:54:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-24T12:59:54+00:00\" \/>\n<meta name=\"author\" content=\"Rick Donato\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rick Donato\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html\"},\"author\":{\"name\":\"Rick Donato\",\"@id\":\"https:\/\/www.fir3net.com\/#\/schema\/person\/ab35009601b7687ee1c5310be6038037\"},\"headline\":\"F5 Interacting with iControl’s get_instance method via BigSuds\",\"datePublished\":\"2015-10-20T11:54:13+00:00\",\"dateModified\":\"2023-02-24T12:59:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html\"},\"wordCount\":219,\"publisher\":{\"@id\":\"https:\/\/www.fir3net.com\/#organization\"},\"articleSection\":[\"F5 Loadbalancers\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html\",\"url\":\"https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html\",\"name\":\"F5 Interacting with iControl's get_instance method via BigSuds\",\"isPartOf\":{\"@id\":\"https:\/\/www.fir3net.com\/#website\"},\"datePublished\":\"2015-10-20T11:54:13+00:00\",\"dateModified\":\"2023-02-24T12:59:54+00:00\",\"description\":\"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\",\"breadcrumb\":{\"@id\":\"https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.fir3net.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Networking\",\"item\":\"https:\/\/www.fir3net.com\/networking\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Loadbalancers\",\"item\":\"https:\/\/www.fir3net.com\/networking\/loadbalancers\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"F5 Loadbalancers\",\"item\":\"https:\/\/www.fir3net.com\/networking\/loadbalancers\/f5-big-ip\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"F5 Interacting with iControl’s get_instance method via BigSuds\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.fir3net.com\/#website\",\"url\":\"https:\/\/www.fir3net.com\/\",\"name\":\"Fir3net\",\"description\":\"Keeping you in the know\",\"publisher\":{\"@id\":\"https:\/\/www.fir3net.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.fir3net.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.fir3net.com\/#organization\",\"name\":\"Fir3net\",\"url\":\"https:\/\/www.fir3net.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.fir3net.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.fir3net.com\/wp-content\/uploads\/Fir3net-Background-Logo-compressed.png\",\"contentUrl\":\"https:\/\/www.fir3net.com\/wp-content\/uploads\/Fir3net-Background-Logo-compressed.png\",\"width\":390,\"height\":88,\"caption\":\"Fir3net\"},\"image\":{\"@id\":\"https:\/\/www.fir3net.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.fir3net.com\/#\/schema\/person\/ab35009601b7687ee1c5310be6038037\",\"name\":\"Rick Donato\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.fir3net.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d75d69a54c0ca3b32c24c3a9703b623c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d75d69a54c0ca3b32c24c3a9703b623c?s=96&d=mm&r=g\",\"caption\":\"Rick Donato\"},\"description\":\"Rick Donato is a Network Automation Architect\/Evangelist and the founder of Packet Coders.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"F5 Interacting with iControl's get_instance method via BigSuds","description":"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","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html","og_locale":"en_US","og_type":"article","og_title":"F5 Interacting with iControl's get_instance method via BigSuds","og_description":"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","og_url":"https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html","og_site_name":"Fir3net","article_published_time":"2015-10-20T11:54:13+00:00","article_modified_time":"2023-02-24T12:59:54+00:00","author":"Rick Donato","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Rick Donato","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html#article","isPartOf":{"@id":"https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html"},"author":{"name":"Rick Donato","@id":"https:\/\/www.fir3net.com\/#\/schema\/person\/ab35009601b7687ee1c5310be6038037"},"headline":"F5 Interacting with iControl’s get_instance method via BigSuds","datePublished":"2015-10-20T11:54:13+00:00","dateModified":"2023-02-24T12:59:54+00:00","mainEntityOfPage":{"@id":"https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html"},"wordCount":219,"publisher":{"@id":"https:\/\/www.fir3net.com\/#organization"},"articleSection":["F5 Loadbalancers"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html","url":"https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html","name":"F5 Interacting with iControl's get_instance method via BigSuds","isPartOf":{"@id":"https:\/\/www.fir3net.com\/#website"},"datePublished":"2015-10-20T11:54:13+00:00","dateModified":"2023-02-24T12:59:54+00:00","description":"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","breadcrumb":{"@id":"https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.fir3net.com\/Loadbalancers\/F5-BIG-IP\/f5-python-bigsuds-a-look-at-the-get-instance-method.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.fir3net.com\/"},{"@type":"ListItem","position":2,"name":"Networking","item":"https:\/\/www.fir3net.com\/networking"},{"@type":"ListItem","position":3,"name":"Loadbalancers","item":"https:\/\/www.fir3net.com\/networking\/loadbalancers"},{"@type":"ListItem","position":4,"name":"F5 Loadbalancers","item":"https:\/\/www.fir3net.com\/networking\/loadbalancers\/f5-big-ip"},{"@type":"ListItem","position":5,"name":"F5 Interacting with iControl’s get_instance method via BigSuds"}]},{"@type":"WebSite","@id":"https:\/\/www.fir3net.com\/#website","url":"https:\/\/www.fir3net.com\/","name":"Fir3net","description":"Keeping you in the know","publisher":{"@id":"https:\/\/www.fir3net.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.fir3net.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.fir3net.com\/#organization","name":"Fir3net","url":"https:\/\/www.fir3net.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.fir3net.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.fir3net.com\/wp-content\/uploads\/Fir3net-Background-Logo-compressed.png","contentUrl":"https:\/\/www.fir3net.com\/wp-content\/uploads\/Fir3net-Background-Logo-compressed.png","width":390,"height":88,"caption":"Fir3net"},"image":{"@id":"https:\/\/www.fir3net.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.fir3net.com\/#\/schema\/person\/ab35009601b7687ee1c5310be6038037","name":"Rick Donato","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.fir3net.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d75d69a54c0ca3b32c24c3a9703b623c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d75d69a54c0ca3b32c24c3a9703b623c?s=96&d=mm&r=g","caption":"Rick Donato"},"description":"Rick Donato is a Network Automation Architect\/Evangelist and the founder of Packet Coders."}]}},"_links":{"self":[{"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/posts\/945"}],"collection":[{"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/comments?post=945"}],"version-history":[{"count":2,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/posts\/945\/revisions"}],"predecessor-version":[{"id":3410,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/posts\/945\/revisions\/3410"}],"wp:attachment":[{"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/media?parent=945"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/categories?post=945"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/tags?post=945"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}