<Property> element

The <Property > element assigns a property to a parameter or a configuration method.

Syntax

Parent element: <CfgMethod>, <ParameterDef>

The following attribute is supported:
Table 1. Attribute
Attribute Required Type Description
name yes string Specifies the name of the property.
The following child elements are supported:
Table 2. Child element
Child element Required Description
<Command> no Command
<Argument> no Command-line arguments
<Stdin> no Arguments supported by the <Stdin> element
<Filter> no Filter
<Mask> no Output capturing mask
Note: The <Command> element must be defined for each property: at the <ParameterDef> level, at the <CfgMethod> level, or in a <PropertyDef> element.

Usage

Properties are key-value pairs that are associated with a parameter. The value of the key-value pairs is retrieved by the artexget –r and artexget –n commands and saved in the output profile. Property values saved in a profile can be inserted into a command line by using the %p[property_name] sequence.

The <Property> element assigns a property to a parameter or to a configuration method. The property is either defined locally under the <Property> element, or inherited from a higher-level <Property> or <PropertyDef> element that has a matching name attribute.

A parameter has all the properties defined locally under the <ParameterDef> element. Also, the parameter has all the properties defined under the parameters configuration method, if a configuration method is used. The consequence is that if a property is defined under a <CfgMethod> element, all the <ParameterDef> elements that use the configuration method will automatically have that property (although some of them might redefine the property locally).

Property values are extracted from the output of a command line. The command line is built by combining the <Command>, <Argument>, <Stdin>, and <Filter> elements as described in the Command line generation section. You must use one of the following property values: the raw output of the command line or the portion of the output that matches the mask, if a <Mask> element is specified.

The <Command>, <Argument>, <Stdin>, <Filter>, and <Mask> elements that define a property are searched in this order:
  • Under the <Property> element at the <ParameterDef> level.
  • If the <ParameterDef> element has a cfgmethod attribute, under the configuration method of the <Property> element that has a matching name attribute.
  • Under the <PropertyDef> element of the catalog that has a matching name attribute.

Example

The following example assigns a nodeId property to the netaddr and netaddr6 parameters:

<ParameterDef name="netaddr" type="string" targetClass="device" cfgmethod="attr">
  <Property name="nodeId">
    <Command>/usr/bin/uname -f/<Command>
    <Mask>.*/<Mask>
  </Property>
</ParameterDef>

<ParameterDef name="netaddr6" type="string" targetClass="device" cfgmethod="attr">
  <Property name="nodeId">
    <Command>/usr/bin/uname -f</Command>
    <Mask>.*</Mask>
  </Property>
</ParameterDef>

In this example, the mask matches the whole line and is only used to exclude the newline character at the end of the command output.

In this example, the uname command is run twice: once for the netaddr parameter, and once for the netaddr6 parameter. The command is run twice because each parameter has its own property with its own <Command> element. See artex_catalog_elem_PropertyDef.html, for an example that requires only one run of the uname command.

Related Information