- 18 Oct 2024
-
DarkLight
-
PDF
Port/VLAN Configuration (EOS) - Command Templates
- Updated on 18 Oct 2024
-
DarkLight
-
PDF
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 the EOS device and confirm that the port is in an up/up state. Multiple steps in the Port Turn Up - EOS workflow are Command Templates, so this exercise will give you a better idea of how that workflow operates.
Command Template Video
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 in the What would you like to create field.
Step 4
Name the template EOS 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. On the left-hand side you will find the Command box. In the Command #1 box, enter show interface Ethernet1.
On the right-hand side of the Command #1 box, you will find the Rules sections. Here the user can define the rule logic associated with the command they have entered in the left-hand box. We expect our command show interface Ethernet1 to return "Ethernet 1 is up", so in this case, we will select contains in our rules dropdown, and enter Ethernet1 is up in the text field next to the rule dropdown.
Step 6
Next, we will select a target device. In the device search box, enter EOS and press enter. Select the EOS 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 Templates with Variables
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 Ethernet1 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 Ethernet1 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.