Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Job scripting is a key capability for NetMRI and for the Automation Change Manager system. Job scripting allows use of two linguistic approaches to script job-based automation: a proprietary language, called CCS (Change Control Scripting), a standard-language Perl API, and a standard-language Python API. This chapter focuses on Perl/Python scripting.

...

Create and manage scripts at Configuration Management –> > Job Management tab –> > Scripts tab.

The following table describes user privileges required for scripts.

...

Note: Well-known variables for Perl and CCS scripting are listed in the topic Scripting Well-Known Variables (Perl, Python, and CCS) bookmark654 bookmark654.

...


Perl scripts use a script header similar to a CCS script, contained within a well-known comment block. The script header block influences a number of runtime behaviors, including:

...

Perl scripts run inside the sandbox, using the Perl 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 Perl scripts. Before commands can be sent to a network device, a Perl 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). The majority of the time, a Perl 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, Infoblox_Job.pm, a pre-installed Perl library, is provided in the appliance (see Configuration Management –> > Job Management –> > Library –> > Infoblox_Job).

Anchor
About NetMRI_Easy.pm
About NetMRI_Easy.pm
Anchor
bookmark636
bookmark636
About NetMRI_Easy.pm

...

Note: Well-known variables for Python scripting are listed in the topic Scripting Well-Known Variables (Perl, Python, and CCS) bookmark654 bookmark654.

...

Python scripts use a script header similar to a CCS script, contained within a well-known comment block.

...

Python scripts run inside the sandbox, using the Pyrthon 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. 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). 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 Configuration Management –> > Job Management –> > Library –> > netmri_easy).

About netmri_easy.py

...

Platforms supporting a local sandbox automatically perform the necessary setup and configuration steps; platforms that need a remote sandbox require a manual setup and configuration process. The topic Setting up a Remote Sandbox #bookmark649 describes remote sandbox setup and configuration.

...

Note: The instructions in this section are for the VMware VSphere® platform. For the OpenStack platform, refer to the Infoblox Deployment Guide for NetMRI and Operations Center.

...

To configure the Remote Sandbox, do the following:

  1. Open the administrative shell.
  2. Download the Sandbox VM file from Infoblox using any scp program (such as WinSCP).
    If you chose the OVF file type, the downloaded file contains an OVF file, a VMDK file, an MF file, a README file and a LICENSE file. The OVF file is what you will need to import into your VMware hypervisor. The MF file contains checksums of the OVF and VMDK files to verify that the exported files are correct before importing. The README file contains detailed instructions for deployment of the remote sandbox.
    The standard VMX and VMDK files along with a README file and a LICENSE file, may also be deployed into VMware Workstation. You import the VMX file into the VMware hypervisor. The README file contains detailed instructions for deployment of the remote sandbox.
  3. Load the files into the hypervisor.
    For example, In VSphere, choose File –> > Deploy OVF Template and select the file from the correct folder.
    After the file loads, give the virtual machine a new name, choose where the VM is deployed, and choose its datastore.

...

  1. Start VMware Workstation.
  2. Choose File –> > Import or Export... The Import Virtual Appliance Wizard appears.
  3. Click Next and then click Next again in the wizard.
  4. Choose Virtual Appliance from the dropdown and click Next.
  5. Click on the File System radio button and click 'Browse...'.
  6. Select the .vmx file that was previously unpacked from the exported ZIP file, and click Open.
  7. Click Next and then click Next again in the wizard.
  8. Choose Other Virtual Machine and click Next.
  9. Enter a name and location for the Virtual Machine and click Next.
  10. Click Next.
  11. Click Next again (the network must be bridged for the VM-based NetMRI Sandbox).
  12. Click Next.
  13. Verify that your settings are correct and click Finish.
    After 20-30 minutes (depending on your hardware and network speed), the NetMRI Sandbox Virtual Appliance will complete import to the VMware host.
  14. Select the NetMRI Sandbox Virtual Appliance you imported and instruct it to Power On.
  15. Open the console for the Sandbox VM.
  16. Enter the following in the Sandbox command line:

...

Anchor
Setting Job Execution Credentials
Setting Job Execution Credentials
Anchor
bookmark653
bookmark653
Setting Job Execution Credentials

NetMRI admins can determine whether creators of configuration management jobs can self-approve their Perl/CCS script jobs, or require a NetMRI super admin to approve jobs execution. For a quick refresher on administrator accounts and the Roles they inhabit, see Understanding Users and Roles, as user accounts have a close relationship to job execution.
You can define the minimum script run level at which the appliance requires user-provided CLI credentials when scheduling or running a job.

...

NetMRI provides Configuration Management settings (under Settings icon –> > General Settings –> > Advanced Settings) to enforce organization policies for securely executing script jobs:

...

To set job approval settings for all NetMRI admin accounts, do the following:

  1. On the Settings icon –> > General Settings –> > Advanced Settings page, under the Configuration Management category, click the Edit icon for Job Self Approval.
  2. To allow all user accounts to self-approve running automated jobs that use CCS and Perl scripts, choose True. Otherwise, choose False.
  3. Click OK to commit the setting.

To require NetMRI admin accounts to use CLI credentials when executing scripts of a specific risk level, do the following:

1. On the Settings icon –> > General Settings –> > Advanced Settings page, under the Configuration Management category, click the Edit icon for Job Requires User Credentials.

...