Skip to content

Tag: <task> - Version Command Task

Definition

When Osirium PAM provisions a device, a connection is made to the device to check that the version of the device is supported by the template. This check is done by the <versions> tag, the <version> tag and most importantly the <line> tag.

More info on this here: :ref:tag-line.

The value that the <line> tag is actually checking comes from the output of a special system task known as the version_command task.

This task runs a command on the device, uses a regular expression capture group to extract the version details and then returns this value back to Osirium PAM.

Example using Regular Expression

Here`s an example:

1
2
3
4
5
   <task name=`version_command` type=`status`>
      <commands>
         <command format=`output_text` regex_capture=`.*Version\s+(\d+)\.`>tmsh show sys version</command>
      </commands>
   </task>

Here`s how it works:

  • The task MUST be called version_command.
  • The task type MUST be status.
  • The command format MUST be output_text.
  • If using a regex_capture regular expression, it MUST only contain one capture group.
  • The output text will be the contents of the capture group and therefore only one line.

There are other attributes and techniques that can be used in the <command> tag to extract the version information, and example of this is below.

On this particular device (and F5 LTM) the output from the device when asked for its version looks like::

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
   [admin@f5-ltm-ve:Active] ~ # tmsh show sys version

   Sys::Version
   Main Package
     Product  BIG-IP
     Version  10.1.0
     Build    3341.1084
     Edition  Final
     Date     Sat Feb  6 01:05:54 PST 2010

   [admin@f5-ltm-ve:Active] ~ #

The regular expression in the <command> tag pulls out just the major version number, i.e. 10 from the Version line. The value 10 is what is then passed to the <line> tag (under the <versions> and <version> tags) to check for device support by this template.

For more info on the use of Regular Expressions and in particular the example above, see Regular expressions.

Example using Line and Token References

Here`s an example that uses line and token numbers rather than a regular expression:

1
2
3
4
5
6
7
   <task name=`version_command` type=`status`>
      <commands>
         <command format=`output_text`>tmsh show sys version</command>
            <response line_nr='4' token_nr='1'/>
         </command>
      </commands>
   </task>

Here`s how it works:

  • The task MUST be called version_command
  • The task type MUST be status
  • The command format MUST be output_text
  • The output text will be the contents of the capture group and therefore only one line

There are other attributes and techniques that can be used in the <command> tag to extract the version information, and example of this is below.

On this particular device (and F5 LTM) the output from the device when asked for its version looks like::

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
   [admin@f5-ltm-ve:Active] ~ # tmsh show sys version

   Sys::Version
   Main Package
     Product  BIG-IP
     Version  10.1.0
     Build    3341.1084
     Edition  Final
     Date     Sat Feb  6 01:05:54 PST 2010

   [admin@f5-ltm-ve:Active] ~ #

The regular expression in the <command> tag pulls out just the major version number, i.e. 10 from the Version line. The value 10 is what is then passed to the <line> tag (under the <versions> and <version> tags) to check for device support by this template.

For more info on the use of Regular Expressions and in particular the example above, see Regular expressions.

Parent Tags

Child Tags