Skip to content
Jonathan Stout edited this page Jul 26, 2018 · 9 revisions

Command builder

Command String

Define a command string. These are commands that may be run by the user. Commands with a role of interface will be placed on the interfaces tab. Commands with a role of vlan will be place on the vlan tab. Commands with a role of switch will be placed on the switch tab.

Special variables

Each tab on the commands page have special variables available to your command string.

The interfaces tab may use:

  • interface: show interface {{ interface }} >> show interface et-2/0/0

The vlans tab may use:

  • tag: show vlan {{tag}} >> show vlan 300

The special variable ? can be used for any command string. This variable will allow the user to select from all the aguments listed as if TAB had be sent on the command line.

  • ? show vlan {{ ? }} >> show vlan {{ ['brief', 'list', ...] }}

Custom variables

If a command requires an additional argument. A parameter may be defined. A parameter may be one of two types, input or option. To define a parameter you must provide.

- name: This is the variable to use in a command string
  type: The input's type, input or option

input

An input parameter will take text from the user and be inserted into the command.

Command parameters of type input should use a regex similar to the example below:

- command: `conf t; interface {{ interface }}; tagged {{ tag }}`
  parameters:
  - name: tag
    type: input
    regex: ^(40[0-9][0-5]|[1-3][0-9][0-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9]|[1-9])$
    placeholder: 1-4095
    error: Please input a valid VLAN

option

An option parameter will present the user with a drop down of selectable options (again at run time) and insert the selection into the command.

Command parameters of type option should use a regex similar to the example below:

- command: `conf t; interface {{ interface }} {{ switch }}`
  parameters:
  - name: switch
    type: option
    default: enabled
    options: ['enabled', 'disabled']
Clone this wiki locally