Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

The table contains the NetMRI_Easy amethods and their descriptions.

MethodNotes

$easy->set_variable( $variable_name, $value )

Set a server-side variable. This is useful when retrieving a template via get_template and the template contains variables that are not defined by the Script-Variables for the current job. This is because template merging (i.e. variable substitution) is performed on the server-side.

Example: $easy->set_variable(Username => $some_username);

This method requires a CLI connection to the device. NetMRI must have credentials for the device against which the NetMRI_Easy script is running.

$easy->send_command( $command )

Send a command to the target device.

Example: my $output = $easy->send_command("show version");

This method requires a CLI connection to the device. NetMRI must have credentials for the device against which the NetMRI_Easy script is running.

$easy->send_command( $command, $new_prompt)

Send a command to the target device. You can use the new_prompt parameter to override the device prompt when the command executed in the $command parameter to change the prompt on the device.

Example: my $output = $easy->send_command("conf t", "mydevice(config-if)#");

This method requires a CLI connection to the device. NetMRI must have credentials for the device against which the NetMRI_Easy script is running.

$easy->get_template( $template_name )

Retrieve a template. For the given template, retrieve the content and perform any necessary variable substitutions.

Example: my $contents = $easy->get_template("Cisco Router");

This method requires a CLI connection to the device. NetMRI must have credentials for the device against which the NetMRI_Easy script is running.

$easy->get_list_value( $list_name, $key_column, $value_column, $default )

Generate an issue. For the given issue type id, generate an issue of the given severity using the name/value pairs defined in the given parameters as the issue details.
$issue_type_id

String issue type id

$severity

severity is one of "error", "warning" or "info"

%parameters

hash reference containing the issue details.

Example:

my $issue_id = $easy->generate_issue("Invalid Accounts", "warning", "IP Address" => '1.2.3.4',
"Username"=> 'admin',
);

$easy->log_message($severity, $message)

Log a message of the given severity (one of 'debug', 'error', 'warning' or 'info'). The message is written to the custom.log file.
This method requires a CLI connection to the device and that NetMRI have credentials for the device against which the NetMRI_Easy script is running.

$easy->broker->broker_name

Get the broker object of the corresponding API controller. Similar to device or cli_connection. Broker objects can be used to query and modify objects on the NetMRI appliance.

$easy->device_session( $device_id )

Create an instance of NetMRI_Easy associated with this job, but with a different device. Enables sending of commands to an additional device.

Example:

my $easy2 = $easy->device_session( 25 );
my $command_out = $easy2->send_command('show version');
$easy2->log_message('info', 'send command show version');

This method may be called to create as many device sessions as needed.

$easy->write_payload( @list )

Encode a message in JSON format in the status log; the message can be retrieved using the read_payload method on NetMRI::API::Remote::Job once the job has completed.

$easy->nios_session

Open a session with NIOS. You must pass nios_api => 1 into the constructor to NetMRI_Easy to use this method, the Infoblox Perl API must be loaded before the Perl API.
  • No labels