<Seed> element
The <Seed> element defines a seed that is expanded into one or more <ParameterDef> elements during the <Get> operation.
Syntax
Parent element: <Catalog>The following attribute is supported:
Attribute | Required | Type | Description |
---|---|---|---|
name | yes | string | Specifies the name of the seed element that matches a SeedDef element in the catalog file. |
The following child elements are supported:
Child element | Required | Number | Description |
---|---|---|---|
<Parameter> | no | 0 – any | Filters discovered parameters based on the names of the parameters. |
<Target> | no | 0 – any | Filters discovered parameters based on their targets. |
Usage
The <Seed> element discovers parameters dynamically during a <Get> operation.
When the artexget command is issued, each <Seed> element in the input profile is expanded into one or more <Parameter> elements. The profiles are expanded based on the rules defined in the matching <SeedDef> element of the catalog file. This process is called parameter discovery. After the parameter discovery process is completed, the artexget command proceeds as usual with the expanded profile.
The optional <Parameter> and <Target> child elements are used to filter the discovered parameters. Discovered parameters that do not match the criteria defined in the <Parameter> subelement, are discarded. Also, those parameters that apply to targets that do not match the criteria defined in the <Target> subelement, are discarded.
Examples
This example uses the devSeed catalog to define a seed that can be used to discover all attributes of all devices:
<?xml version="1.0" encoding="UTF-8"?>
<Catalog id="devSeed" version="3.0">
<SeedDef name="devAttr">
<Discover>
<Command>
/usr/sbin/lsdev -F 'name class subclass type' |
while read DEV CLASS SUBCLASS TYPE
do
CAT=devParam.$CLASS.$SUBCLASS.$TYPE
/usr/sbin/lsattr -F attribute -l $DEV |
while read PAR
do
echo "device=$DEV $CAT $PAR"
done
done
</Command>
Mask target="1" catalog="2" name="3">(.*) (.*) (.*)</Mask>
</Discover>
</SeedDef>
</Catalog>
<?xml version="1.0" encoding="UTF-8"?>
<Profile>
<Catalog id="devSeed" version="3.0">
<Seed name="devAttr"/>
</Catalog>
</Profile>
<?xml version="1.0" encoding="UTF-8"?>
<Profile>
<Catalog id="devSeed" version="3.0">
<Seed name="devAttr">
<Target class="device" match="^en[0-9]+$"/>
</Seed>
</Catalog>
</Profile>
3. A <Parameter> filter can be added to capture only the netaddr, netaddr6, alias, and alias6 attributes of all Ethernet adapters:
<?xml version="1.0" encoding="UTF-8"?>
<Profile>
<Catalog id="devSeed" version="3.0">
<Seed name="devattr">
<Parameter match="^(netaddr|alias)6?$"/>
<Target class="device" match="^en[0-9]+$"/>
</Seed>
</Catalog>
</Profile>