Declare Variables
Variable is the most fundamental element of Visual Parser, the value of which is Visual Parser aiming to parse.
The following table introduces the available data types of Parser variables and their formats. The general format is $variable_type:variable_name (exception: Enumeration).
Variable Type | Description | Variable Format |
String | Match any single word. Note: Space characters cannot be applied to a string-type variable. | $string:var1 or $var1 |
Multi-string | Match one or multiple words. Note: A multi-string variable cannot be followed by another multi-string variable. | $mstring:var2 |
Integer | Match any whole number. | $int:var3 |
Float/Double | Match any double-precision IEEE 64-bit (8-byte) floating-point number. | $float:var4 or $double:var4 |
Boolean | A variable with possible value options “true”, “false”, 1 or 0. Note: Both "true" and "false" are case-insensitive. | $bool:var5 |
Enumeration | Match one of the listed options of a variable. Note: Only the listed values can be successfully parsed. | $var6(value1|value2) |
Dummy | A placeholder for an uninterested variable that will not be parsed. | $type:_dummy |
![]() |
Note: A variable name can only contain letters, numbers, and underlines, and can only start with a letter or underline. |
![]() |
Note: The variable types (Multi-string and Enumeration) are variants of string-type variables and will be treated as a string in further automation. |
![]() |
Tip: NetBrain provides built-in functions to support the definition of compound variables. Refer to the Appendix for more details. |
Enumeration Variable
Enumeration is a user-defined data type where you can specify a set of values for a variable, and the variable can only take one out of the set of possible values. When there are no constant keywords before or after a target variable, but the values of the variable are predictably controlled, you can use Enumeration to define the variable.All the possible values must be included in a pair of parentheses after the variable name, and a vertical line (|) can be used to separate two possible values, e.g., $var1(value1|value2|value3). Note that even if there is only one possible value, the vertical line (|) must be added, e.g., $var1(value1|).
You can use Enumeration to parse all variable types, such as:
- $var1(value1|value2) indicates to parse the value of a string-type variable.
Note: Space is allowed in the value of a string, e.g., $duplex(Full Duplex|Auto Duplex). - $int:var1(value1|value2) indicates to parse the value of an integer-type variable.
- $float:var1(value1|value2) indicates to parse the value of a float-type variable.
For example, to parse enumeration-type variables like $duplex and $speed, you can use “$duplex(Full-duplex|Half-duplex|Auto-duplex)” and “$speed(Auto-speed|100Mb/s)” in the variable line pattern.
![]() |
Note: Only the values listed in the line pattern can be successfully extracted. |
![]() |
Note: Possible values cannot contain special characters | and right bracket ). |
Dummy Variable
A Dummy variable is a virtual variable in the shape of $type:_dummy in a line pattern and will not be extracted as a Parser variable.
Use a dummy variable to skip a specific type of variable you are not interested in, like a placeholder. For example:
- $mstring:_dummy indicates skipping multiple lines of string.
- $string:_dummy($_dummy) indicates to skip a string.
- $int:_dummy indicates to skip an integer.
- $float:_dummy indicates to skip a float.
Take the EIGRP neighbor as an example: if you want to parse its output interface, the previous string starting with “via” must be skipped.