Document toolboxDocument toolbox

Python Scripting in NetMRI

Note

The Infoblox 1102-A and NT-4000 platforms support Python scripting, as do all legacy appliances with 8 GB of RAM. Python scripting is not available on other legacy platforms. The virtual machine version of NetMRI also supports Python scripting and the Sandbox virtual environment. On platforms where Python scripting is not available, all related features are hidden and/or disabled via the GUI and administrative shell. To achieve optimum performance on legacy NetMRI platforms, a BIOS change is necessary. If you have one of these platforms and the BIOS change has not been made, a message to that effect appears when attempting to save a Python script. Contact Infoblox technical support to obtain the document describing the BIOS change process for these platforms.

Security and risk management are common concerns with Python scripting, and precautions should be taken to ensure that a complex Python script doesn’t cause issues in the appliance. Risk levels, tied to CLI credentials, can be applied to scripts in NetMRI. This enables more granular permissions to be applied to specific scripts. A NetMRI user will need to provide a different set of end-user permissions to run specific jobs.

Other features in Python support include the following:

  • Access to the Python exit function from within a script. If the Python script exits with a zero exit code, the script ceases operation and NetMRI sets the job status to OK. If the Python script exits with a non-zero exit code it causes the script to cease operation and NetMRI sets the job status to Error.
  • Ability to mark problem commands and perform try/catch exception handling.
  • A logging function, available in the infoblox_job.pl file.
  • A Libraries page (see Using Perl or Python Libraries for more information) containing blocks of Python code to be referenced by other Python scripts. The Libraries page supports creation, editing, deletion, and import and export of snippets of Python code.
  • Refer to lists of data to fill variables and find matches during job batch processing, extract information and parse the returned data (see the section Defining Lists for ACM, Perl, Python, and CCS Script Reference for more information).
  • Use of standard NetMRI variables and data model objects in scripting logic. NetMRI automatically associates variables with target devices during runtime. Users can define input and internal variables that can be mapped to the NetMRI data model. The data model also provides access to device and interface attributes.
  • Users can open multiple, simultaneous, device connections from within scripts, enabling change coordination between multiple devices in sequence or in parallel, based on common elements such as VLAN membership or neighbor topology. The feature is helpful in advanced use cases: for example, a script opens a connection to a network device, encounters a configuration element, and opens new connections to other, similar devices for comparison and determines the action to take on the current device.
  • Regular expression processing, without restrictions on data structure types where regular expressions can be used, including script input variables, device output, data from external files, lists and NetMRI data model information.