{"id":1375,"date":"2019-03-08T21:34:32","date_gmt":"2019-03-08T21:34:32","guid":{"rendered":"https:\/\/live-infoblox-blog.pantheonsite.io\/?p=1375"},"modified":"2022-10-20T14:41:10","modified_gmt":"2022-10-20T21:41:10","slug":"5-python-scripts-to-get-you-started-in-netmri","status":"publish","type":"post","link":"https:\/\/www.infoblox.com\/blog\/community\/5-python-scripts-to-get-you-started-in-netmri\/","title":{"rendered":"5 Python Scripts to get you started in NetMRI"},"content":{"rendered":"<p>If you are like me at some point you got psyched that Python was coming to NetMRI. \u00a0This article will get you started with Python in NetMRI from the basics \u201crun this command\u201d on my devices to advance \u201cgrab some data via an API call\u201d and trigger an action within\u00a0<a href=\"https:\/\/www.infoblox.com\/products\/netmri\/?utm_source=blox-community&amp;utm_campaign=community-q2&amp;utm_medium=blox-community\" target=\"_self\" rel=\"nofollow noopener noreferrer\">NetMRI<\/a>.<\/p>\n<h2><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1377\" src=\"https:\/\/live-infoblox-blog.pantheonsite.io\/wp-content\/uploads\/470779813-660x454.jpg\" alt=\"5 Python Scripts to get you started in NetMRI\" width=\"660\" height=\"454\" srcset=\"https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/470779813-660x454.jpg 660w, https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/470779813-660x454-300x206.jpg 300w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/h2>\n<h2 id=\"toc-hId--1333164205\">Before you get started\u2026Need to Know about Python Scripts<\/h2>\n<hr \/>\n<p>Note: Well-known variables for Python scripting are listed in the topic Scripting Well-Known Variables (Perl, Python, and CCS).<\/p>\n<hr \/>\n<p>Python scripts use a script header similar to a CCS script, contained within a well-known comment block.<\/p>\n<p>The script header block influences a number of runtime behaviors, including:<\/p>\n<h3 id=\"toc-hId-2041852309\">Script-Timeout<\/h3>\n<p>Specifies the per-command timeout for the entire script in seconds.<\/p>\n<ul>\n<li>Type: Integer<\/li>\n<li>Required: No<\/li>\n<li>Default if not specified: 60<\/li>\n<\/ul>\n<h3 id=\"toc-hId--1365611306\">Script-Login<\/h3>\n<p>Specifies whether the job engine should automatically establish a connection with the target device.<\/p>\n<ul>\n<li>Type: Boolean<\/li>\n<li>Required: No<\/li>\n<li>Default if not specified: true<\/li>\n<\/ul>\n<h3 id=\"toc-hId-409396056\">Script-Variables<\/h3>\n<ul>\n<li>Specifies inputs needed by the script.<\/li>\n<li>Type: Tuple (ordered list of elements)<\/li>\n<li>Required: No<\/li>\n<li>Default if not specified: None<\/li>\n<\/ul>\n<h3 id=\"toc-hId-1296899737\">Script-Filter<\/h3>\n<p>Specifies the device types processed by the script.<\/p>\n<ul>\n<li>Type: String<\/li>\n<li>Required: Yes<\/li>\n<\/ul>\n<p>A Python Script header block must be defined inside of comments within a &#8220;well known&#8221; comment section (between # BEGIN-SCRIPT-BLOCK and a # END-SCRIPT-BLOCK). The following example demonstrates the difference between a CCS and Python Script header block that specifies a Script-Filter that applies to all Cisco IOS devices.<\/p>\n<p>As a comparison, a CCS implementation is straightforward:<\/p>\n<p>Script-Filter: $Vendor == &#8220;Cisco&#8221; and $sysDesc like \/IOS\/<\/p>\n<p>You can filter by the network view:<\/p>\n<p>Script-Filter: $network == &#8220;blue&#8221;<\/p>\n<p>A comparable Python implementation is as follows:<\/p>\n<p># BEGIN-SCRIPT-BLOCK<\/p>\n<p># Script-Filter: $Vendor == &#8220;Cisco&#8221; and $sysDesc like \/IOS\/<\/p>\n<p># END-SCRIPT-BLOCK<\/p>\n<h3 id=\"toc-hId--2110563878\">Working Environment<\/h3>\n<ul>\n<li>NetMRI System version 7.2(Python was added as a scripting option in NetMRI)<\/li>\n<li>Sandbox System<\/li>\n<li>Python scripts run inside the sandbox, using the Python API to communicate with the Device Interaction Server (DIS) on NetMRI. The DIS proxies CLI requests\/responses to\/from network devices on behalf of the Python scripts.<\/li>\n<\/ul>\n<p>Before commands can be sent to a network device, a Python script must first establish a DIS session (see v2 API object DisSession). After a session has been established, a CLI connection with the target device must be established for the given session (see v2 API object CliConnection).<\/p>\n<p>The majority of the time, a Python script will follow this same initialization sequence. First, establish the API session, establish the DIS session, then establish a CLI connection with the target device. For this reason, netmri_easy.py, a pre-installed Python library, is provided in the appliance (see\u00a0<strong>Configuration Management \u2013&gt; Job Management \u2013&gt; Library \u2013&gt; netmri_easy<\/strong>).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1380\" src=\"https:\/\/live-infoblox-blog.pantheonsite.io\/wp-content\/uploads\/python1.png\" alt=\"Infoblox Python script\" width=\"600\" height=\"410\" srcset=\"https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/python1.png 600w, https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/python1-300x205.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<h2 id=\"toc-hId-584394266\">Practical Examples<\/h2>\n<h3 id=\"toc-hId--335556516\">Script 1 &#8211; Sending a basic command<\/h3>\n<p><strong><em>Goal: Run a simple command via scripting. Understand and see the impact of DEBUG option.<\/em><\/strong><\/p>\n<p>This will show you the example of sending \u201cshow version\u201d on a device. \u00a0The second command is to show you that we can use the CCS DEBUG option which will not run \u201cshow version\u201d on the device but show you that we would have if you remove the DEBUG.<\/p>\n<hr \/>\n<p># BEGIN-SCRIPT-BLOCK<\/p>\n<p>#<\/p>\n<p># Script-Filter:<\/p>\n<p># \u00a0\u00a0\u00a0\u00a0true<\/p>\n<p>#<\/p>\n<p># END-SCRIPT-BLOCK<\/p>\n<p>&nbsp;<\/p>\n<p>from infoblox_netmri.easy import NetMRIEasy<\/p>\n<p># This values will be provided by NetMRI before execution<\/p>\n<p>defaults = {<\/p>\n<p>&#8220;api_url&#8221;: api_url,<\/p>\n<p>&#8220;http_username&#8221;: http_username,<\/p>\n<p>&#8220;http_password&#8221;: http_password,<\/p>\n<p>&#8220;job_id&#8221;: job_id,<\/p>\n<p>&#8220;device_id&#8221;: device_id,<\/p>\n<p>&#8220;batch_id&#8221;: batch_id<\/p>\n<p>}<\/p>\n<p># Create NetMRI context manager. It will close session after execution<\/p>\n<p>with NetMRIEasy(**defaults) as easy:<\/p>\n<p>easy.send_command(&#8216;show version&#8217;)<\/p>\n<p>easy.send_command(&#8216;DEBUG:show version&#8217;)<\/p>\n<hr \/>\n<h3 id=\"toc-hId-551947165\"><\/h3>\n<h3 id=\"toc-hId-1416381127\">Script 2 &#8211; Using Script Variables<\/h3>\n<p><em><strong>Goal: Use Scripting to change the password on a device.<\/strong><\/em><\/p>\n<p>Just like using Script Variables in CCS and PERL we can do the same in Python, the only difference is that we can NOT use \u201c<a href=\"https:\/\/docs.infoblox.com\/display\/NAG7\/Job+Scripting#JobScripting-bookmark654\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">Well Known Variables<\/a>.\u201d \u00a0<em><strong>\u00a0<\/strong><\/em><\/p>\n<p>This example script will first prompt for a new password ($new_password), and then NetMRI uses that variable to change the password on our target devices.<\/p>\n<hr \/>\n<p># BEGIN-SCRIPT-BLOCK<\/p>\n<p>#<\/p>\n<p># Script-Filter: true<\/p>\n<p>#<\/p>\n<p># Script-Variables:<\/p>\n<p># \u00a0\u00a0\u00a0\u00a0$new_password password &#8220;password&#8221;<\/p>\n<p>#<\/p>\n<p># END-SCRIPT-BLOCK<\/p>\n<p>&nbsp;<\/p>\n<p>from infoblox_netmri.easy import NetMRIEasy<\/p>\n<p># This values will be provided by NetMRI before execution<\/p>\n<p>defaults = {<\/p>\n<p>&#8220;api_url&#8221;: api_url,<\/p>\n<p>&#8220;http_username&#8221;: http_username,<\/p>\n<p>&#8220;http_password&#8221;: http_password,<\/p>\n<p>&#8220;job_id&#8221;: job_id,<\/p>\n<p>&#8220;device_id&#8221;: device_id,<\/p>\n<p>&#8220;batch_id&#8221;: batch_id<\/p>\n<p>}<\/p>\n<p># Create NetMRI context manager. It will close session after execution<\/p>\n<p>with NetMRIEasy(**defaults) as easy:<\/p>\n<p>easy.send_command(&#8216;config t&#8217;)<\/p>\n<p>easy.send_command(&#8220;username name secret 0 {}&#8221;.format(new_password))<\/p>\n<p>easy.send_command(&#8216;end&#8217;)<\/p>\n<p>easy.send_command(&#8216;wr mem&#8217;)<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<h3 id=\"toc-hId--1991082488\">Script 3 &#8211; Generate a Custom Issue<\/h3>\n<p><strong><em>Goal: Create a\u00a0<\/em><\/strong>custom<strong><em>\u00a0issue to drive additional responses from NetMRI, based on the script output.<\/em><\/strong><\/p>\n<p>This will run \u201cshow vtp status\u201d on a switch, parse each line of the output looking for \u201cVTP Operating Mode\u201d where, if the devices we select are configured as Server, we will generate an issue.<\/p>\n<hr \/>\n<p># BEGIN-SCRIPT-BLOCK<\/p>\n<p>#<\/p>\n<p># Script-Filter:<\/p>\n<p># \u00a0\u00a0\u00a0\u00a0true<\/p>\n<p>#<\/p>\n<p># END-SCRIPT-BLOCK<\/p>\n<p>&nbsp;<\/p>\n<p>import requests, json, re<\/p>\n<p>from infoblox_netmri.easy import NetMRIEasy<\/p>\n<p>&nbsp;<\/p>\n<p># This values will be provided by NetMRI before execution<\/p>\n<p>defaults = {<\/p>\n<p>&#8220;api_url&#8221;: api_url,<\/p>\n<p>&#8220;http_username&#8221;: http_username,<\/p>\n<p>&#8220;http_password&#8221;: http_password,<\/p>\n<p>&#8220;job_id&#8221;: job_id,<\/p>\n<p>&#8220;device_id&#8221;: device_id,<\/p>\n<p>&#8220;batch_id&#8221;: batch_id<\/p>\n<p>}<\/p>\n<p># Create NetMRI context manager. It will close session after execution<\/p>\n<p>with NetMRIEasy(**defaults) as easy:<\/p>\n<p>vtpstatus = easy.send_command(&#8216;show vtp status&#8217;)<\/p>\n<p>regexp = re.compile(r&#8221;VTP Operating Mode\\s*: (.*)&#8221;)<\/p>\n<p>if regexp.search(vtpstatus):<\/p>\n<p>#print (&#8216;matched&#8217;)<\/p>\n<p>status = re.search(&#8216;(?&lt;=VTP Operating Mode\\s.)(.*)&#8217;, vtpstatus, re.MULTILINE).group()<\/p>\n<p>if re.search(r&#8217;Server&#8217;, status):<\/p>\n<p>issue_id = easy.generate_issue(&#8220;info&#8221;, &#8220;siftest&#8221;,**{<\/p>\n<p>&#8220;Host&#8221;:device_devicename,<\/p>\n<p>&#8220;IPAddress&#8221;:device_deviceipdotted,<\/p>\n<p>&#8220;noclue1&#8221;:&#8217;test1&#8242;,<\/p>\n<p>&#8220;noclue2&#8221;:&#8217;test2&#8242;,<\/p>\n<p>&#8220;device_id&#8221;: device_id,<\/p>\n<p>&#8220;batch_id&#8221;: batch_id<\/p>\n<p>})<\/p>\n<p>else:<\/p>\n<p>print (&#8216;no match&#8217;)<\/p>\n<hr \/>\n<h3 id=\"toc-hId--1103578807\"><\/h3>\n<h3 id=\"toc-hId--216075126\">Script 4 &#8211; Adding data to Custom Fields<\/h3>\n<p><em><strong>Goal: Parse needed information out of a show command, and then populate into a custom field.<\/strong><\/em><\/p>\n<p>Wrote this one for a customer because SNMP did not have the correct Serial number for Cisco ASAs, We will run \u201cshow inventory\u201d and parse the output looking for the System Serial number and update our Custom field named \u201cSif Test2.\u201d<\/p>\n<p>&nbsp;<\/p>\n<hr \/>\n<p># BEGIN-SCRIPT-BLOCK<\/p>\n<p>#<\/p>\n<p># Script-Filter:<\/p>\n<p># \u00a0\u00a0\u00a0\u00a0$vendor eq &#8220;Cisco&#8221; and $type eq \u201cFirewall\u201d<\/p>\n<p>#<\/p>\n<p># END-SCRIPT-BLOCK<\/p>\n<p>&nbsp;<\/p>\n<p>from infoblox_netmri.easy import NetMRIEasy<\/p>\n<p>import re<\/p>\n<p>&nbsp;<\/p>\n<p># This values will be provided by NetMRI before execution<\/p>\n<p>defaults = {<\/p>\n<p>&#8220;api_url&#8221;: api_url,<\/p>\n<p>&#8220;http_username&#8221;: http_username,<\/p>\n<p>&#8220;http_password&#8221;: http_password,<\/p>\n<p>&#8220;job_id&#8221;: job_id,<\/p>\n<p>&#8220;device_id&#8221;: device_id,<\/p>\n<p>&#8220;batch_id&#8221;: batch_id<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p># Create NetMRI context manager. It will close the session after execution<\/p>\n<p>with NetMRIEasy(**defaults) as easy:<\/p>\n<p># Everything has to be indented under the context manager if we are sending commands to NetMRI<\/p>\n<p>#<\/p>\n<p># This is how you will create a custom field name, we are using &#8220;Sif Test2&#8221;<\/p>\n<p>#<\/p>\n<p>broker = easy.client.get_broker(&#8216;CustomFields&#8217;)<\/p>\n<p>broker.create_field(<\/p>\n<p>model=&#8217;Device&#8217;,<\/p>\n<p>name=&#8217;Sif Test2&#8242;,<\/p>\n<p>type=&#8217;string&#8217;<\/p>\n<p>)<\/p>\n<p>&nbsp;<\/p>\n<p># get device<\/p>\n<p>device = easy.get_device()<\/p>\n<p>#<\/p>\n<p># The method for retrieving the serial number via the<\/p>\n<p># CLI depends on the type of device.<\/p>\n<p>#<\/p>\n<p># This portion of the code will run if the Device is a Router<\/p>\n<p># For the gather the serial number we are using RegEx &#8211; check out FB\/ArtOfRegex<\/p>\n<p>#<\/p>\n<p>if device.DeviceType == &#8216;Router&#8217;:<\/p>\n<p>inventory = easy.send_command(&#8216;show inventory&#8217;)<\/p>\n<p>serial = re.search(&#8216;(?&lt;=SN: ).*$&#8217;, inventory).group()<\/p>\n<p>#<\/p>\n<p># This portion of the code will run if the Device is anything but a Router<\/p>\n<p># For the gather the serial number we are using RegEx &#8211; check out FB\/ArtOfRegex<\/p>\n<p>#<\/p>\n<p>else:<\/p>\n<p>info = easy.send_command(&#8216;show version | inc System serial&#8217;)<\/p>\n<p>serial = re.search(&#8216;(?&lt;=System serial number: ).*$&#8217;, info).group()<\/p>\n<p>&nbsp;<\/p>\n<p># Custom field &#8220;sif_test&#8221; update<\/p>\n<p># all custom fields should start with &#8216;custom_&#8217;<\/p>\n<p>device_broker = easy.client.get_broker(&#8216;Device&#8217;)<\/p>\n<p>field_name = &#8220;custom_{}&#8221;.format(&#8216;sif_test2&#8217;)<\/p>\n<p>params = {<\/p>\n<p>&#8216;DeviceID&#8217;: device.DeviceID,<\/p>\n<p>field_name: serial<\/p>\n<p>}<\/p>\n<p>result = device_broker.update(**params)<\/p>\n<p>print(result)<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<h3 id=\"toc-hId-671428555\">Script 5 &#8211; Grab Networks from DDI<\/h3>\n<p><em><strong>Goal: Automate the addition of a new network in DDI into the NetMRI scanners.<\/strong><\/em><\/p>\n<p>Automation does not have to be complex in order to be useful. In a use case where you want to automatically keep the NetMRI scanning system in sync with the Infoblox grid, this simple check can accomplish it with minimal hassle.<\/p>\n<p>In order to enable this functionality, we will first create an Extensible Attribute (EA) associated with network objects in the NIOS IPAM system.<\/p>\n<p>This script will grab data from NIOS where EA:NetMRI equal to \u201cAdd\u201d, we will take the networks from NIOS and add it to NetMRI discovery then update the EA:NetMRI to \u201cDone\u201d<\/p>\n<p>&nbsp;<\/p>\n<hr \/>\n<p># BEGIN-SCRIPT-BLOCK<\/p>\n<p>#<\/p>\n<p># Script-Filter:<\/p>\n<p># \u00a0\u00a0\u00a0\u00a0true<\/p>\n<p>#<\/p>\n<p># Script-Variables:<\/p>\n<p># \u00a0\u00a0\u00a0\u00a0$gmuser string &#8220;Grid Master Username&#8221;<\/p>\n<p># \u00a0\u00a0\u00a0\u00a0$gmpassword password &#8220;Grid Master Password&#8221;<\/p>\n<p># \u00a0\u00a0\u00a0\u00a0$gmipaddress string &#8220;192.168.1.2&#8221;<\/p>\n<p>#<\/p>\n<p># END-SCRIPT-BLOCK<\/p>\n<p>import requests<\/p>\n<p>import json, re<\/p>\n<p># This will not error when you are not verifying Certs for https<\/p>\n<p>#<\/p>\n<p>requests.packages.urllib3.disable_warnings()<\/p>\n<p>#<\/p>\n<p># gmip is a variable we asked for the Grid Master IP\/FQDN<\/p>\n<p>gmip = &#8220;https:\/\/{}\/wapi\/&#8221;.format(gmipaddress)<\/p>\n<p>#<\/p>\n<p># The version of WAPI you are using<\/p>\n<p>wapi = &#8220;v2.5&#8221;<\/p>\n<p>#<\/p>\n<p># The WPI call that we are going to use<\/p>\n<p>call = &#8220;\/network?*NetMRI%3A=Yes&amp;_return_fields%2B=extattrs&#8221;<\/p>\n<p>#<\/p>\n<p># Now we combine all the above to equal &#8220;url&#8221;<\/p>\n<p>#\u00a0<a href=\"https:\/\/192.168.1.2\/wapi\/v2.5\/network?network=10.10.10.0\/24\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">https:\/\/192.168.1.2\/wapi\/v2.5\/network?network=10.10.10.0\/24<\/a><\/p>\n<p>url = gmip + wapi + call<\/p>\n<p>&nbsp;<\/p>\n<p>r = requests.get(url, auth=(gmuser, gmpassword), verify=False)<\/p>\n<p>&nbsp;<\/p>\n<p>json_input = r.text<\/p>\n<p>&nbsp;<\/p>\n<p>decoded = json.loads(json_input)<\/p>\n<p>#print (decoded[&#8216;network&#8217;])<\/p>\n<p>&nbsp;<\/p>\n<p>for j in decoded:<\/p>\n<p>print (j[&#8216;network&#8217;], j[&#8216;network_view&#8217;],j[&#8216;_ref&#8217;])<\/p>\n<p>url1 = &#8220;{}\/api\/3.2\/discovery_settings\/create?range_value=&#8221;.format(api_url)<\/p>\n<p>url2 = j[&#8216;network&#8217;]<\/p>\n<p>url3 = &#8220;&amp;range_type=CIDR&amp;discovery_status=INCLUDE&#8221;<\/p>\n<p>url4 = url1 + url2 + url3<\/p>\n<p>add_net = requests.get(url4, auth=(gmuser, gmpassword), verify=False)<\/p>\n<p>print (&#8220;Added&#8221;)<\/p>\n<p>call2 = j[&#8216;_ref&#8217;]<\/p>\n<p>url_update = gmip + wapi + &#8220;\/&#8221; + call2<\/p>\n<p>payload = &#8220;{\\n\\t\\&#8221;extattrs\\&#8221;: {\\n\\t\\t\\&#8221;NetMRI\\&#8221;: {\\n\\t\\t\\t\\&#8221;value\\&#8221;: \\&#8221;Done\\&#8221;\\n\\t\\t}\\n\\t}\\n}&#8221;<\/p>\n<p>response = requests.request(&#8220;PUT&#8221;, url_update,auth=(gmuser, gmpassword), data=payload, verify=False)<\/p>\n<p>print(&#8220;Updated NIOS EA&#8221;)<\/p>\n<hr \/>\n<h2 id=\"toc-hId-1755445741\">Conclusion<\/h2>\n<p><a href=\"https:\/\/www.infoblox.com\/products\/netmri\/?utm_source=blox-community&amp;utm_campaign=community-q2&amp;utm_medium=blox-community\" target=\"_self\" rel=\"nofollow noopener noreferrer\">NetMRI<\/a>\u00a0gives you a framework to focus your automation tasks around. By providing a common interface to numerous APIs and CLIs, you are already embracing the paradigm shift towards\u00a0<em><strong>automate\/virtualize\/cloud\/software defined everything<\/strong><\/em>\u00a0that has become the latest solution to deal with scaling up into large network infrastructures.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are like me at some point you got psyched that Python was coming to NetMRI. \u00a0This article will get you started with Python in NetMRI from the basics \u201crun this command\u201d on my devices to advance \u201cgrab some data via an API call\u201d and trigger an action within\u00a0NetMRI. Before you get started\u2026Need to [&hellip;]<\/p>\n","protected":false},"author":260,"featured_media":1377,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[3],"tags":[16],"class_list":{"0":"post-1375","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-community","8":"tag-infoblox","9":"entry"},"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>5 Python Scripts to get you started in NetMRI<\/title>\n<meta name=\"description\" content=\"Python is coming to NetMRI and many people will not know how to use it. Learn about five python scripts that you can use in order to get started with NetMRI.\" \/>\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.infoblox.com\/blog\/community\/5-python-scripts-to-get-you-started-in-netmri\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"5 Python Scripts to get you started in NetMRI\" \/>\n<meta property=\"og:description\" content=\"Python is coming to NetMRI and many people will not know how to use it. Learn about five python scripts that you can use in order to get started with NetMRI.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.infoblox.com\/blog\/community\/5-python-scripts-to-get-you-started-in-netmri\/\" \/>\n<meta property=\"og:site_name\" content=\"Infoblox Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-03-08T21:34:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-10-20T21:41:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/470779813-660x454.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"660\" \/>\n\t<meta property=\"og:image:height\" content=\"454\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sif Baksh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sif Baksh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/5-python-scripts-to-get-you-started-in-netmri\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/5-python-scripts-to-get-you-started-in-netmri\\\/\"},\"author\":{\"name\":\"Sif Baksh\",\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/#\\\/schema\\\/person\\\/d78ba19c60e3345e0b057ecb0f990108\"},\"headline\":\"5 Python Scripts to get you started in NetMRI\",\"datePublished\":\"2019-03-08T21:34:32+00:00\",\"dateModified\":\"2022-10-20T21:41:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/5-python-scripts-to-get-you-started-in-netmri\\\/\"},\"wordCount\":1660,\"publisher\":{\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/5-python-scripts-to-get-you-started-in-netmri\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/wp-content\\\/uploads\\\/470779813-660x454.jpg\",\"keywords\":[\"Infoblox\"],\"articleSection\":[\"Community\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/5-python-scripts-to-get-you-started-in-netmri\\\/\",\"url\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/5-python-scripts-to-get-you-started-in-netmri\\\/\",\"name\":\"5 Python Scripts to get you started in NetMRI\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/5-python-scripts-to-get-you-started-in-netmri\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/5-python-scripts-to-get-you-started-in-netmri\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/wp-content\\\/uploads\\\/470779813-660x454.jpg\",\"datePublished\":\"2019-03-08T21:34:32+00:00\",\"dateModified\":\"2022-10-20T21:41:10+00:00\",\"description\":\"Python is coming to NetMRI and many people will not know how to use it. Learn about five python scripts that you can use in order to get started with NetMRI.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/5-python-scripts-to-get-you-started-in-netmri\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/5-python-scripts-to-get-you-started-in-netmri\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/5-python-scripts-to-get-you-started-in-netmri\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/wp-content\\\/uploads\\\/470779813-660x454.jpg\",\"contentUrl\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/wp-content\\\/uploads\\\/470779813-660x454.jpg\",\"width\":660,\"height\":454,\"caption\":\"5 Python Scripts to get you started in NetMRI\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/5-python-scripts-to-get-you-started-in-netmri\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Community\",\"item\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/category\\\/community\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"5 Python Scripts to get you started in NetMRI\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/\",\"name\":\"infoblox.com\\\/blog\\\/\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/#organization\",\"name\":\"Infoblox\",\"url\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/wp-content\\\/uploads\\\/infoblox-logo-2.svg\",\"contentUrl\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/wp-content\\\/uploads\\\/infoblox-logo-2.svg\",\"width\":137,\"height\":30,\"caption\":\"Infoblox\"},\"image\":{\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/#\\\/schema\\\/person\\\/d78ba19c60e3345e0b057ecb0f990108\",\"name\":\"Sif Baksh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/blogs.infoblox.com\\\/wp-content\\\/uploads\\\/avatar_user_260_1582930725-96x96.jpg\",\"url\":\"https:\\\/\\\/blogs.infoblox.com\\\/wp-content\\\/uploads\\\/avatar_user_260_1582930725-96x96.jpg\",\"contentUrl\":\"https:\\\/\\\/blogs.infoblox.com\\\/wp-content\\\/uploads\\\/avatar_user_260_1582930725-96x96.jpg\",\"caption\":\"Sif Baksh\"},\"description\":\"Sif is a Principal Sales Engineer at Infoblox where he provides technical expertise regarding Infoblox solutions with a focus on Network Automation and Cybersecurity. He has been with Infoblox for over 7 years, starting in the Professional Services org where he performed NetMRI deployments at many of the largest companies in the world. Outside of work, Sif can be found at the local hackerspace where he volunteers as a leading cybersecurity educator. Online he can be found @sifbaksh running the regex daily channel.\",\"sameAs\":[\"https:\\\/\\\/sifbaksh.com\\\/\"],\"url\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/author\\\/sif-baksh\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"5 Python Scripts to get you started in NetMRI","description":"Python is coming to NetMRI and many people will not know how to use it. Learn about five python scripts that you can use in order to get started with NetMRI.","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.infoblox.com\/blog\/community\/5-python-scripts-to-get-you-started-in-netmri\/","og_locale":"en_US","og_type":"article","og_title":"5 Python Scripts to get you started in NetMRI","og_description":"Python is coming to NetMRI and many people will not know how to use it. Learn about five python scripts that you can use in order to get started with NetMRI.","og_url":"https:\/\/www.infoblox.com\/blog\/community\/5-python-scripts-to-get-you-started-in-netmri\/","og_site_name":"Infoblox Blog","article_published_time":"2019-03-08T21:34:32+00:00","article_modified_time":"2022-10-20T21:41:10+00:00","og_image":[{"width":660,"height":454,"url":"https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/470779813-660x454.jpg","type":"image\/jpeg"}],"author":"Sif Baksh","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Sif Baksh","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.infoblox.com\/blog\/community\/5-python-scripts-to-get-you-started-in-netmri\/#article","isPartOf":{"@id":"https:\/\/www.infoblox.com\/blog\/community\/5-python-scripts-to-get-you-started-in-netmri\/"},"author":{"name":"Sif Baksh","@id":"https:\/\/www.infoblox.com\/blog\/#\/schema\/person\/d78ba19c60e3345e0b057ecb0f990108"},"headline":"5 Python Scripts to get you started in NetMRI","datePublished":"2019-03-08T21:34:32+00:00","dateModified":"2022-10-20T21:41:10+00:00","mainEntityOfPage":{"@id":"https:\/\/www.infoblox.com\/blog\/community\/5-python-scripts-to-get-you-started-in-netmri\/"},"wordCount":1660,"publisher":{"@id":"https:\/\/www.infoblox.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.infoblox.com\/blog\/community\/5-python-scripts-to-get-you-started-in-netmri\/#primaryimage"},"thumbnailUrl":"https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/470779813-660x454.jpg","keywords":["Infoblox"],"articleSection":["Community"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.infoblox.com\/blog\/community\/5-python-scripts-to-get-you-started-in-netmri\/","url":"https:\/\/www.infoblox.com\/blog\/community\/5-python-scripts-to-get-you-started-in-netmri\/","name":"5 Python Scripts to get you started in NetMRI","isPartOf":{"@id":"https:\/\/www.infoblox.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.infoblox.com\/blog\/community\/5-python-scripts-to-get-you-started-in-netmri\/#primaryimage"},"image":{"@id":"https:\/\/www.infoblox.com\/blog\/community\/5-python-scripts-to-get-you-started-in-netmri\/#primaryimage"},"thumbnailUrl":"https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/470779813-660x454.jpg","datePublished":"2019-03-08T21:34:32+00:00","dateModified":"2022-10-20T21:41:10+00:00","description":"Python is coming to NetMRI and many people will not know how to use it. Learn about five python scripts that you can use in order to get started with NetMRI.","breadcrumb":{"@id":"https:\/\/www.infoblox.com\/blog\/community\/5-python-scripts-to-get-you-started-in-netmri\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.infoblox.com\/blog\/community\/5-python-scripts-to-get-you-started-in-netmri\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.infoblox.com\/blog\/community\/5-python-scripts-to-get-you-started-in-netmri\/#primaryimage","url":"https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/470779813-660x454.jpg","contentUrl":"https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/470779813-660x454.jpg","width":660,"height":454,"caption":"5 Python Scripts to get you started in NetMRI"},{"@type":"BreadcrumbList","@id":"https:\/\/www.infoblox.com\/blog\/community\/5-python-scripts-to-get-you-started-in-netmri\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.infoblox.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Community","item":"https:\/\/www.infoblox.com\/blog\/category\/community\/"},{"@type":"ListItem","position":3,"name":"5 Python Scripts to get you started in NetMRI"}]},{"@type":"WebSite","@id":"https:\/\/www.infoblox.com\/blog\/#website","url":"https:\/\/www.infoblox.com\/blog\/","name":"infoblox.com\/blog\/","description":"","publisher":{"@id":"https:\/\/www.infoblox.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.infoblox.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.infoblox.com\/blog\/#organization","name":"Infoblox","url":"https:\/\/www.infoblox.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.infoblox.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/infoblox-logo-2.svg","contentUrl":"https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/infoblox-logo-2.svg","width":137,"height":30,"caption":"Infoblox"},"image":{"@id":"https:\/\/www.infoblox.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.infoblox.com\/blog\/#\/schema\/person\/d78ba19c60e3345e0b057ecb0f990108","name":"Sif Baksh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blogs.infoblox.com\/wp-content\/uploads\/avatar_user_260_1582930725-96x96.jpg","url":"https:\/\/blogs.infoblox.com\/wp-content\/uploads\/avatar_user_260_1582930725-96x96.jpg","contentUrl":"https:\/\/blogs.infoblox.com\/wp-content\/uploads\/avatar_user_260_1582930725-96x96.jpg","caption":"Sif Baksh"},"description":"Sif is a Principal Sales Engineer at Infoblox where he provides technical expertise regarding Infoblox solutions with a focus on Network Automation and Cybersecurity. He has been with Infoblox for over 7 years, starting in the Professional Services org where he performed NetMRI deployments at many of the largest companies in the world. Outside of work, Sif can be found at the local hackerspace where he volunteers as a leading cybersecurity educator. Online he can be found @sifbaksh running the regex daily channel.","sameAs":["https:\/\/sifbaksh.com\/"],"url":"https:\/\/www.infoblox.com\/blog\/author\/sif-baksh\/"}]}},"_links":{"self":[{"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/posts\/1375","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/users\/260"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/comments?post=1375"}],"version-history":[{"count":5,"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/posts\/1375\/revisions"}],"predecessor-version":[{"id":8175,"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/posts\/1375\/revisions\/8175"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/media\/1377"}],"wp:attachment":[{"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/media?parent=1375"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/categories?post=1375"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/tags?post=1375"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}