Trigger-Variables
Used In: Trigger sections
Status: Optional
Use the Trigger-Prompt
attribute to override the device prompt when the command(s) executed in the Trigger-Commands
attribute change the prompt on the device.
Note: The default CCS scripting engine works for many of the cases.
Example
Trigger: acl test3
Trigger-Template:
ip access-list extended test2
Trigger-Prompt: /(DEVrtr01(config-ext-nacl)#)|(DEVrtr01(config)#)|(DEVrtr01#)/
Trigger-Commands:
conf t
ip access-list extended test3
exit
Trigger-Variables
Used In: Trigger sections
Status: Optional
CCS scripts use the Trigger-Variables
attribute to define "patterns of interest" found within the output generated by CLI commands. Trigger-Variables
are used in Trigger-Templates
to extract certain values from command output to be used in determining if certain conditions exist on the device. The format of Trigger-Variables
is as follows:
<variableName> <extractPattern> <evalType>
<VariableName>
can be any name (without blanks) that starts with $. Variable names are case-insensitive and can be accessed anywhere in the script.
<ExtractPattern>
can be specified using any of the keywords listed below, or specified as a regular expression.
extractPattern | Corresponding Regular Expression |
---|---|
String | /[^\r\n]+/ |
Word or Id | /\w+/ |
Int or Integer | /\d+/ |
Double or Float | /\d+\.\d+/ |
Datetime | /\d{2,4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2}/ |
Phoneno | /\(?\d{3}\)?[ -]?\d{3}-\d{4}/ |
Zipcode | /\d{5}(-\d{4})/ |
/[\w\.-]+@[\w\.-]+/ | |
Ipaddress | /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/ |
Regular expression | Any valid Perl 5 regular expression/ |
<evalType>
specifies how the variable value should be evaluated when used in a logical filter expression, as a string (this is the default if nothing is specified), a number, or an ipaddr.
For example, to look for interfaces where $ifIndex < 10
, specify int
as the <evalType>
for the $ifIndex
variable. By default, all variables are evaluated as strings in filter expressions.
Example
Trigger-Variables:
$ifName String
$ifIndex /\(?\d{3}\)?[ -]?\d{3}-\d{4}/ string
$phoneno Word
Example
Trigger-Variables:
$ifName /FastEthernet.*/
Trigger-Template:
interface [[$ifName]]