Configlets in Network Configuration Manager (NCM)
A configlet is a configuration template that is transformed to a CLI configuration string and applied to devices. You can use variables to define dynamic elements, allowing them to act as input variables and take values based on the execution context for simplifying network automation.
Use Case
Often, there is a need to make changes to the running configuration of devices, and in most cases, the same set of changes needs to be applied to multiple devices. While network administrators can manually edit the configuration, the task can be challenging due to the volume of changes and the repetitive nature of the work. Site24x7's Network Configuration Manager (NCM) provides a simple solution through configlets.
You can create a configlet according to the changes that needs to be applied with the required input variables. When the configlet needs to be executed, you can provide the values and select the required devices where it should be executed.
Adding a configlet
- Log in to your Site24x7 account.
- Navigate to Network > NCM > Configlets.
- Click Add Configlet on the top right of the screen.
- Enter the values for the following fields:
- Display Name: Provide a unique name to identify the configlet.
- Description: Provide an appropriate description for the configlet.
- Execution Mode: Select an Execution Mode from the drop down menu:
- File Transfer Mode: To upload a fragment configuration change through TFTP.
- Script Execution Mode: To execute a single command on the CLI console.
- Advanced Script Execution Mode: To execute a sequence of commands on the CLI console based on prompt action and by adding conditions (if needed).
- Vendor: Select a device vendor to ensure that the configlet can be executed on devices provided by this vendor.
- Command: The form changes based on the Execution Mode selected in step 4.
- If you have selected File Transfer Mode or Script Execution Mode: Only the Command field is displayed. You can add multiple commands by clicking the plus + icon beside the field.
- Advanced Script Execution Mode: Add Command according to the Sequence in which it must be executed. Provide values for Prompt, Timeout, Suffix, Delay, and click the pencil icon beside Conditional Action to add Condition, Value (which is a regular expression corresponding to the desired pattern), and the step to be executed on Success or Failure, which can be a step number or end of execution. For more information, refer to the section More on Advanced Script Execution Mode.
Viewing configlets
- Navigate to Network > NCM > Configlets.
- View details like Name, Execution Mode, Vendor, and Description.
- In the Action column, select:
- Pencil icon to edit a configlet.
- Trash icon to delete a configlet.
- Play icon to execute a configlet.
Editing a configlet
- Navigate to Network > NCM > Configlets.
- Click the pencil icon beside the configlet that you wish to edit.
- Make the necessary changes, then click Save.
Deleting a configlet
- Navigate to Network > NCM > Configlets.
- Click the delete icon beside the configlet that you wish to delete.
- In the Delete Configlet pop-up, click Delete.
Executing a configlet
- Navigate to Network > NCM > Configlets.
- Click the play icon beside the configlet that you wish to execute.
- In the Execute Configlet screen, provide input values for Configlet Variable(s) (if any). Then select the Device(s) on which the configlet must be executed.
Figure 1. Executing a configlet.
Execution History
- Navigate to Network > NCM > Configlets > Execution History.
- View details like Configlet Name, the Device Name where it was executed, Invoked Time, Invoked By, Execution Time, and Status.
More on Advanced Script Execution Mode
The Advanced Script Execution Mode allows users to execute a series of commands on a device through the command line. To do this, you must provide the commands that need to be executed in a specific format, as shown in the examples below.
Purpose | Example 1 | Example 2 |
---|---|---|
Executing the first command |
<command>show version</command> |
<command>show ip route</command> |
Command to be executed after a prompt |
<command prompt='#'>reload</command> |
<command prompt='[confirm]'>delete vlan 10</command> |
Command to be executed after a timeout | <command timeout='60'>show interfaces</command> |
<command timeout='45'>show spanning-tree</command> |
Command with suffix to avoid pressing Enter | <command suffix='$NO_ENTER'>yes</command> |
<command suffix='$NO_ENTER'>enable</command> |
Command which displays a prompt after execution | <command prompt='Are you sure?'>write memory</command> |
<command prompt='Proceed?' timeout='10'>copy running-config startup-config</command> |
Command with no expected response after execution | <command prompt='$NO_RESPONSE' timeout='5'>clear counters</command> |
<command prompt='$NO_RESPONSE' timeout='5'>clear logging</command> |
Command with placeholder for hostname and timestamp | <command prompt='#'>copy running-config tftp:</command> <command prompt='Destination IP:'>$TFTP_IP</command> <command>$Hostname_$Timestamp_config_backup</command> |
<command prompt='Destination IP:'>backup config tftp</command> <command prompt='Save as:'>$Hostname_$Timestamp_config_backup</command> <command>show interfaces status</command> |
Command with delay before next command execution | <command delay='20'>reload</command> |
<command delay='15'>write erase</command> |