- 15 Mar 2023
Port/VLAN Configuration (EOS) - Command Templates
- Updated on 15 Mar 2023
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.
The use cases outlined within this section are intended to be completed on Itential's Trial infrastructure and lab. For more details about accessing this infrastructure and lab, please visit www.itential.com/get-started
From the Itential Automation Platform dashboard, click Automation Studio in the left navigation panel.
Click the + icon at the top of the left navigation panel.
The Create window opens. Click the dropdown menu and select Command Template in the What would you like to create field.
Name the template EOS Template - XX , where XX represents your initials, and click CREATE.
The Command Template window opens and we are ready to enter the first command. On the right-hand side of the Command #1 box you’ll find the rules section. Here the user can define the rule logic associated with the command they’ve entered in the left-hand box. We expect our command show interface Ethernet1 to return Ethernet1 is up so in this case, we will select contains in our rules dropdown and enter Ethernet is up in the text field next to the rule dropdown.
In the Command #1 box, enter show interface Ethernet1.
In the Rules box, enter Ethernet1 is up. 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.
We are ready to test. Click TEST ALL COMMANDS.
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.
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.
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.
An Enter Values prompt displays. Type Ethernet1 in the interface field. Click the SUBMIT button.
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.