Submit a ticketCall us

Don’t fall victim to a ransomware attack
Backups are helpful, but sometimes that’s not enough to protect your business against ransomware. At our live webcast we will discuss how to protect against ransomware attacks with SolarWinds® Patch Manager and how to leverage log data to detect ransomware. Register now for our live webcast.

Home > Success Center > Network Configuration Manager (NCM) > NCM 7.6 Administrator Guide > Config change template details > Basic commands

Basic commands

Created by Caroline Juszczak, last modified by Anthony.Rinaldi_ret on Oct 03, 2016

Views: 15 Votes: 0 Revisions: 5

There are two commands in a config change template: script and CLI.

Script Command

The script{} command declares the input type of every variable that the template uses. The script command declares the input type for every variable introduced in setting up the template parameters. The form of the script command is:

script script_name (
	data_type @variable
       data_type @variable
       data_type @variable	)

The data_type can be swis.entity (for example, NCM.Nodes), int (integer). or string.

Cisco Example

script ConfigureVLANmembershipCiscoIOS??(
	NCM.Nodes @ContextNode,
	NCM.Interfaces[] @TargetPorts,
	NCM.VLANs[] @VlansToRemove,
	NCM.VLANs[] @VlanToAssign	)

 

Four variables are introduced in the parameter section of the template with an instance of PARAMETER_LABEL given a specific SolarWinds Information Service entity data type:

  • @ContextNode is determined with data from the NCM.Nodes entity in the database.
  • @TargetPorts is determined with data from the NCM.Interfaces entity.
  • @VlansToRemove and @VlansToAssign are determined with data from the NCM.VLANs entity.

Any variable that references an NCM object that NCM knows through device inventory must take a SolarWinds Information Service entity as its data type. In this case, the four variables work with data that NCM captured and stored in the database through the device inventory process. If you attempt to assign a string instead of a SWIS entity in such cases, NCM will fail to correctly parse your script.

CLI command

CLI{ } defines a specific CLI command that NCM issues on a target device when the config change template is executed by a user.Script command. Its purpose is to create a command line statement that NCM can execute directly on the command line of NCM nodes targeted for the template's config change(s).

The config change template creator creates a CLI command by including its arguments wrapped by curly brackets { }. At run time, NCM parses any variables contained within CLI { }. Often a CLI command is as simple as the command you would type directly on the command line of an NCM device.

Cisco Example

To enter config mode on Cisco IOS devices, type configure terminal. In your config change template script, add the command as follows:

CLI
{
 configure terminal
}

NCM parses the argument of the CLI { } command by passing through the string itself (configure terminal) as a command to execute against each targeted NCM node at template run time:

Cisco Example with Variables

script ConfigureVLANmembershipCiscoIOS??(
	NCM.Nodes @ContextNode,
	NCM.Interfaces[] @TargetPorts,
	NCM.VLANs[] @VlansToRemove,
	NCM.VLANs[] @VlanToAssign	)
{
	CLI
	{
	 vlan database vlan @vlaniddescription @vlandesc exit
	}
}

This example shows a CLI statement with variables to specify VLAN properties while using the vlan database command line editor. For purposes of demonstration, we assume that:

  • @vlanid = 1
  • @vlandesc = Local-Office

At run time, NCM parses the CLI{ } command as:

vlan database vlan 1 description Local-Office exit

If this were all that is included in the Change VLAN Membership on Ports Cisco IOS template, then the config change result would be to set the description of vlan 1 to Local-Office on all NCM nodes selected as targets.

This config change template, however, actually changes the VLANs associated with targeted NCM node ports. For that we need to introduce advanced CLI{ } command logic.

 

Last modified
14:08, 3 Oct 2016

Tags

Classifications

Public