Port/VLAN Configuration (IOS) - Command Templates
  • 18 Oct 2024
  • Dark
    Light
  • PDF

Port/VLAN Configuration (IOS) - Command Templates

  • Dark
    Light
  • PDF

Article summary

create_cmd_template_title

Command Templates allow users to apply CLI knowledge and skills as part of their automation strategy. Here we will build a simple template that will run the show interface command against our IOS device and confirm that the port is in an up state. Multiple steps in the Port Turn Up - IOS workflow are Command Templates, so this exercise will give you a better idea of how that workflow operates.

Command Template Video - Part 1

Step 1

From the Itential Automation Platform dashboard, click Automation Studio in the left navigation panel. 

Step 2

Click the + icon at the top of the left navigation panel.

Step 3

The Create window opens. Click the dropdown menu and select Command Template.

Step 4

Name the template IOS Template - XX, where XX represents your initials, and click CREATE.

Step 5

The Command Template window opens and we are ready to enter the first command.  Command Templates allow users to run commands on devices and then perform logic on the response from the device with rules. 

On the left side you will find the Commands section, which includes the area where you will enter the command. In the Command #1 box, enter show interface GigabitEthernet1

On the right side of the Command #1 box you will find the Rules section. Here the user can define the rule logic associated with the command they entered in the left box. We expect our command show interface GigabitEthernet1 to return GigabitEthernet1 is up so in this case, we will select contains in our Rules dropdown.

Step 6

In the Rules box, enter GigabitEthernet1 is up. Next, we will select a target device. In the device search box, enter IOS and press enter.  Select the IOS option that appears in blue directly below to select our target device for this Command Template.

Step 7

We are ready to test. Click TEST ALL COMMANDS.

Step 8

The results appear at the bottom. Notice our template passed and there is a green check mark next to the rule.

Command Template Video - Part 2

This first version of the template we built used a static value for the port. While this is great for testing a template as it is built, ideally we want the template to be more flexible when implemented as part of a workflow. To do this, we’ll introduce variables to our template.

Step 9

For Command #1 that we just created, we will modify the command slightly.  We will replace GigabitEthernet1 with <!Interface!>.  The <! !> denotes a new variable within a Command Template. In this case, we are variablizing the port name.

Step 10

Type <!interface!> is up in the Rule field in the Rules section. What we have now accomplished is that a user can enter any port name when executing the Command Template and the Command Template will verify that the port is up.

Click the TEST ALL COMMANDS button.

Step 11

An Enter Values prompt displays. Type GigabitEthernet1 in the interface field. Click the SUBMIT button.

Step 12

As expected, the Command Template passed.  The results of the command template can be seen directly below in the Test Results box.  Review the results box. 



Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.