<response> - Returns information
<response> tag is used to return information from a task.
It is used in the inventory,
show_version tasks and within
This tag has the following attributes:
- line_nr (int) : Specifies the line to extract from. Count starts from 0.
- token_nr (int) : Specifies the token number on the line to extract. Count starts from 1.
- token_delimiter (str) : Specifies the delimiter used to separate tokens on a line. When not supplied the default is a single or a group of spaces.
- offset (int) : Specifies the number of characters on the line to skip before capturing the text. Used with the
lengthattribute. Count starts from 1.
- length (int) : Specifies the number of characters to capture, starting from
offset. Count starts from 1.
length can both be used together with
Example: Line and Token Number
If the command returns a predictable series of lines and words separated by spaces, then
word_nr can be used to extract the required information.
1 2 3 4 5
In this example the command run produces several lines of output.
The 15th line is selected and the first token on that line is extracted out and placed in the field
Example: Token Delimiter
Other delimiters can also be specified, for example:
1 2 3 4 5
In this example this device outputs a series of bits of information separated by colons, so the
token_delimiter attribute is used to set the delimiter to be a colon, then the first token is extracted which is the actual version string.
Example: Offset and Length
Data can also be extracted by position, specified by and offset and a length, for example:
1 2 3 4 5 6
There the hardware version of this devices is on line 2 (counting from 0), starting from the 11th character and is 24 characters long. Trailing spaces are automatically removed.