[AIX 운영 체제와 장치 관리 10] AIX Runtime Expert (5) 카탈로그 요소 — Command·Argument·Stdin·Filter·Mask·SeedDef·Prereq·PrereqDef·Property·PropertyDef

핵심 정리

  • Command·Argument·Stdin은 펼쳐져 하나의 명령행이 되고(명령행 생성 절), Filter는 그 출력을 입력으로 받는 명령입니다. XML 안에서는 <, >, &를 &lt;, &gt;, &amp;로 바꾸거나 CDATA 구역을 씁니다.
  • Mask는 출력 줄마다 적용하는 정규식입니다. 속성이 없으면 맞는 마지막 줄의 일치 부분을, value=1이면 하위식 하나를, name과 value(1·2)면 줄마다 이름과 값을 뽑아 명령 하나로 여러 매개변수를 처리합니다(vmo -a 예가 가장 효율적). SeedDef의 Discover 아래에서는 catalog·name·target 하위식을 씁니다.
  • SeedDef는 get 때 Seed를 매개변수로 펼치는 발견 규칙이며, 출력 줄의 콜론 구분 카탈로그 목록 가운데 시스템에 있는 첫 카탈로그에 정의가 있을 때만 매개변수를 만듭니다.
  • Prereq는 Get·Set·Discover 전에 실행하는 조건 명령으로, 실패(0이 아닌 반환 코드)하면 그 매개변수를 무시하고 ErrMessage를 보여 줍니다. ParameterDef → CfgMethod의 같은 id → PrereqDef 순서로 찾으며, PrereqDef로 같은 명령을 쓰면 한 번만 실행됩니다.
  • Property는 매개변수에 붙는 키-값으로, artexget -r·-n이 가져와 프로파일에 저장하고 명령행에서 %p[이름]으로 씁니다. Property → CfgMethod → PropertyDef 순서로 찾으며, PropertyDef로 공유하면 uname 같은 명령을 한 번만 실행합니다.
항목 내용
버전 AIX 6.1 (5.3판에 없음)
원문 Operating system and device management — 5.3판에 없음, 6.1판 102~114쪽
파일 envParam.xml, vmoParam.xml, nfsParam.xml, devParam.*.xml
관련 명령어 cat, vmo -a, nfsd -getnodename(원문 nfds -getnode), uname -f, artexget -r·-n

<Command> 요소

<Command> 요소는 부모 요소가 정의한 작업을 하는 데 쓰는 기본 명령을 정의합니다.

구문 — 부모 요소: <Get>, <Set>, <Diff>, <Discover>, <PrereqDef>, <Prereq>, <PropertyDef>, <Property>

사용법 — <Command> 요소의 내용은 명령행 요소 펼치기 절에서 설명한 대로 펼쳐져 다른 명령행 요소와 합쳐져 완전한 명령행이 됩니다. 자세한 내용은 명령행 생성 절을 봅니다.

<, >, &처럼 셸 식에 자주 나오는 일부 문자는 XML 문서에 쓸 수 없습니다. 이 문자는 해당 XML 엔터티로 바꿔야 합니다.

표 38. XML 엔터티

문자 XML 엔터티
< &lt;
> &gt;
& &amp;

또는 식에 이런 문자가 많으면 CDATA 구역을 쓸 수 있습니다. CDATA 구역은 <![CDATA[로 시작해 ]]>로 끝납니다.

<Command> 요소는 각 매개변수의 지원 작업마다 <CfgMethod> 수준이나 <ParameterDef> 수준에 정의해야 합니다.

예 — envParam.xml 카탈로그는 /etc/profile 파일의 내용을 나타내는 profile이라는 매개변수를 정의합니다. 이 매개변수의 <Get> 요소는 cat 명령으로 /etc/profile 파일의 내용을 가져옵니다.

text
<ParameterDef name="profile">
  <Get type="current">
    <Command>/usr/bin/cat /etc/environment</Command>
  </Get>
</ParameterDef>

관련 정보:

  • 명령행 생성, 명령행 요소 펼치기

<Argument> 요소

구문 — 부모 요소: <Get>, <Set>, <Diff>, <PrereqDef>, <Prereq>, <PropertyDef>, <Property>

사용법 — <Argument> 요소의 내용은 명령행 요소 펼치기 절에서 설명한 대로 펼쳐져 <Command>나 <Stdin> 요소와 합쳐져 완전한 명령행이 됩니다. 자세한 내용은 명령행 생성 절을 봅니다.

셸 식에 자주 나오는 일부 문자는 XML 문서에 쓸 수 없으므로 해당 XML 엔터티로 바꿔야 합니다.

표 39. XML 엔터티

문자 XML 엔터티
< &lt;
> &gt;
& &amp;

또는 식에 이런 문자가 많으면 CDATA 구역을 쓸 수 있습니다. CDATA 구역은 <![CDATA[로 시작해 ]]>로 끝납니다.

예 — vmoParam.xml 카탈로그는 <Argument> 요소로 프로파일의 vmo 매개변수마다 vmo 명령에 인수를 더합니다.

text
<CfgMethod id="vmo">
  <Set type="permanent">
    <Command>/usr/sbin/vmo -p%a</Command>
    <Argument> -o %n=%v1</Argument>
  </Set>
</CfgMethod>

<Stdin> 요소

구문 — 부모 요소: <Get>, <Set>, <Diff>, <PrereqDef>, <Prereq>, <PropertyDef>, <Property>

사용법 — <Stdin> 요소의 내용은 명령행 요소 펼치기 절에서 설명한 대로 펼쳐지고, 그 결과 데이터는 부모 요소가 정의한 작업을 위해 만든 명령행의 표준 입력으로 쓰입니다.

예 — envParam.xml 카탈로그는 /etc/profile 파일의 내용을 나타내는 profile이라는 매개변수를 정의합니다. 이 매개변수의 set 작업은 매개변수 값을 cat 명령의 표준 입력으로 써서 /etc/profile 파일을 덮어씁니다.

text
<ParameterDef name="profile">
  <Set type="permanent">
    <Command>/usr/bin/cat &gt; /etc/profile</Command>
     <Stdin>%v1</Stdin>
   </Set>
 </Get>

<Filter> 요소

구문 — 부모 요소: <Get>, <Diff>, <PropertyDef>, <Property>

사용법 — <Filter> 요소의 내용은 명령이며, 부모 요소가 정의한 작업을 위해 만든 명령행의 출력이 이 명령의 입력으로 넘어갑니다.

셸 식에 자주 나오는 일부 문자는 XML 문서에 쓸 수 없으므로 해당 XML 엔터티로 바꿔야 합니다.

표 40. XML 엔터티

문자 XML 엔터티
< &lt;
> &gt;
& &amp;

또는 식에 이런 문자가 많으면 CDATA 구역을 쓸 수 있습니다. CDATA 구역은 <![CDATA[로 시작해 ]]>로 끝납니다.

예 — nfsParam.xml 카탈로그는 v4_root_node 매개변수의 get 작업에 <Filter> 요소를 써서 nfsd 명령 출력에서 루트 노드를 뽑습니다(원문은 nfds -getnode).

text
<ParameterDef id="v4_root_node">
  <Get type="current">
    <Command>
       /usr/sbin/nfsd -getnodes
    </Command>
    <Filter>
       /usr/bin/awk -F: ’NR == 2 { printf("%s", $1) }’
    </Filter>
  </Get>
</ParameterDef>

<Mask> 요소

구문 — 부모 요소: <Get>, <Diff>, (<SeedDef> 아래에서만) <Discover>, <PropertyDef>, <Property>

<Get>이나 <Diff> 요소에서 쓸 때 다음 속성을 지원합니다.

표 41. 속성

속성 필수 형 설명
name 아니요 integer 매개변수 이름과 맞는 하위식의 번호. 올바른 값은 1과 2입니다.
value 아니요 integer 매개변수 값과 맞는 하위식의 번호. 올바른 값은 1과 2입니다.

<SeedDef> 요소의 <Discover> 하위 요소 아래에서 쓸 때 다음 속성을 지원합니다.

표 42. 속성

속성 필수 형 설명
catalog 예 integer 카탈로그 이름과 맞는 하위식의 번호. 올바른 값은 1, 2, 3입니다.
name 예 integer 매개변수 이름과 맞는 하위식의 번호. 올바른 값은 1, 2, 3입니다.
target 아니요 integer 매개변수의 대상과 맞는 하위식의 번호. 올바른 값은 1, 2, 3입니다.

<PropertyDef>나 <Property> 요소 아래에서 쓸 때 다음 속성을 지원합니다.

표 43. 속성

속성 필수 형 설명
value 아니요 integer 매개변수 이름(원문 그대로, property 값)과 맞는 하위식의 번호. 지정하면 1이어야 합니다.

사용법 — <Mask> 요소는 명령 출력의 각 줄에 적용해 그 줄에서 데이터를 뽑는 정규식을 정의합니다. 뽑는 데이터는 <Mask> 요소를 쓰는 곳에 따라 다릅니다.

속성을 지정하지 않으면 명령 출력에서 정규식과 맞는 마지막 줄로 데이터를 뽑습니다. 뽑는 데이터는 그 줄에서 정규식과 맞는 부분입니다.

<Get>이나 <Diff> 요소 아래에서 쓰면 뽑은 데이터를 매개변수 값으로 씁니다. <PropertyDef>나 <Property> 요소 아래에서 쓰면 뽑은 데이터를 property 값으로 씁니다.

value 속성만 지정하면 1로 설정해야 하고 정규식에는 하위식이 하나만 있어야 합니다. 명령 출력에서 정규식과 맞는 마지막 줄로 데이터를 뽑습니다. 뽑는 데이터는 그 줄에서 첫(이자 유일한) 하위식과 맞는 부분입니다. <Get>이나 <Diff> 요소 아래에서는 뽑은 데이터를 매개변수 값으로, <PropertyDef>나 <Property> 요소 아래에서는 property 값으로 씁니다.

name과 value 속성을 지정하면 하나는 1, 다른 하나는 2로 설정해야 하고 정규식에는 하위식이 둘 있어야 합니다. 명령 출력에서 정규식과 맞는 줄마다 이름과 값을 뽑습니다. <Get> 요소에서 쓰면 이름을 매개변수 이름으로, 값을 매개변수 값으로 씁니다. <Diff> 요소에서 쓰면 이름을 매개변수 이름으로, 값을 비교 결과로 씁니다. 이 기능으로 get 명령 하나로 여러 매개변수 값을 뽑고, diff 명령 하나로 여러 매개변수를 비교할 수 있습니다.

<SeedDef> 요소의 <Discover> 하위 요소에서 쓰면 catalog와 name 속성을 지정해야 합니다. 명령 출력에서 정규식과 맞는 줄마다 카탈로그 이름과 매개변수 이름을 뽑습니다. 시스템에 뽑은 카탈로그 이름과 맞는 카탈로그가 있고 그 안에 뽑은 매개변수 이름과 맞는 매개변수 정의가 있으면 프로파일에 매개변수를 넣습니다. 선택 target 인수를 더하면 발견한 매개변수마다 대상 정의를 뽑을 수 있습니다. 대상 정의는 class1=instance1;class2=instance2;...처럼 세미콜론으로 구분한 class=instance 쌍 목록 형식이어야 합니다.

예:

  1. vmoParam.xml 카탈로그는 name과 value 속성이 있는 <Mask> 요소로 vmo -a 명령 하나에서 모든 매개변수 값을 뽑습니다.
text
<CfgMethod id="vmo">
  <Get type="current">
    <Command>/usr/sbin/vmo -a</Command>
    <Mask name="1" value="2">[[:space:]]*(.*) = (.*)</Mask>
  </Get>
</CfgMethod>
  1. vmoParam.xml 카탈로그를 매개변수마다 따로 명령을 써서 값을 가져오도록 작성했다면, name 속성 없이 value 속성만 설정한 <Mask> 요소를 쓸 수 있었을 것입니다.
text
<CfgMethod id="vmo">
  <Get type="current">
    <Command>/usr/sbin/vmo -o %n</Command>
    <Mask value="1"> = (.*)</Mask>
  </Get>
</CfgMethod>
  1. 또는 값만 맞는 정규식을 쓸 수도 있습니다.
text
<CfgMethod id="vmo">
  <Get type="current">
    <Command>/usr/sbin/vmo -o %n</Command>
    <Mask>[^ ]*$</Mask>
  </Get>
</CfgMethod>

세 예 가운데 첫째가 가장 효율적입니다. vmo 명령의 모든 매개변수를 명령 하나로 가져오기 때문입니다. 예 2와 3은 <Command> 요소에 매개변수 이름을 쓰므로 vmo 명령 매개변수마다 명령을 따로 만듭니다. 4. 다음 <SeedDef> 요소는 모든 장치의 모든 속성을 발견하는 데 쓸 수 있는 seed를 정의합니다. 대상으로 그 속성이 동작하는 장치를 나타냅니다.

text
<SeedDef name="devAttr">
  <Discover>
    <Command>
      /usr/sbin/lsdev -F ’name class subclass type’ |
      while read DEV CLASS SUBCLASS TYPE
      do
        /usr/sbin/lsattr -F attribute -l $DEV |
        while read PAR
        do
          echo device=$DEV devParam.$CLASS.$SUBCLASS.$TYPE $PAR
        done
      done
    </Command>
    <Mask target="1" catalog="2" name="3">(.*) (.*) (.*) <Mark>
  </Discover>
</SeedDef>

발견 명령은 발견한 장치 속성을 다음 형식으로 한 줄에 하나씩 출력합니다.

text
device=DeviceName devParam.Class.Subclass.Type AttributeName

예:

text
device=en0 devParam.if.EN.en tcp_recvspace
device=en0 devParam.if.EN.en tcp_sendspace
device=ent0 devParam.adapter.vdevice.IBM,l-lan alt_addr
device=ent0 devParam.adapter.vdevice.IBM,l-lan chksum_offload

<SeedDef> 요소

<SeedDef> 요소는 프로파일에서 <Seed> 요소로 쓸 수 있는 seed를 정의합니다.

구문 — 부모 요소: <Catalog>. 다음 속성을 지원합니다.

표 44. 속성

속성 필수 형 설명
name 예 string seed의 이름. 이 이름은 카탈로그마다 고유해야 합니다.

다음 자식 요소를 지원합니다.

표 45. 자식 요소

자식 요소 필수 설명
<Discover> 예 매개변수를 발견하는 데 쓰는 명령을 지정합니다.

사용법 — seed는 get 작업 중에 매개변수를 동적으로 발견하는 데 씁니다.

artexget 명령을 실행하면 입력 프로파일의 각 <Seed> 요소가 카탈로그 파일의 맞는 <SeedDef> 요소에 정의한 규칙에 따라 <Parameter> 요소 하나 이상으로 펼쳐집니다. 이 과정을 매개변수 발견이라고 합니다. 그런 다음 artexget 명령은 펼친 프로파일로 평소대로 진행합니다.

<SeedDef> 요소에는 <Discover> 하위 요소만 들어 있으며, 이 요소는 실행할 명령과, 명령 출력에서 매개변수 이름, (.xml 확장자 없는 콜론 구분 목록인) 카탈로그 이름, 선택적으로 (class1=instance1;class2=instance2;... 형식의) 대상을 뽑는 마스크를 정의합니다. 출력의 줄마다 콜론 구분 목록에서 시스템에 있는 첫 카탈로그를 올립니다. 이 카탈로그에서 매개변수 정의를 찾으면, 그 줄에서 뽑은 대상을 가진 매개변수를 출력 프로파일에 만듭니다. 명령 출력의 줄 가운데 마스크와 맞지 않거나, 카탈로그 파일을 찾지 못하거나, 카탈로그 파일에 매개변수 정의가 없는 줄은 무시합니다.

예:

  1. 다음 카탈로그는 AIX Runtime Expert가 지원하는 제한되지 않은 모든 vmo 조정 값을 발견하는 vmoTunables라는 <SeedDef> 요소를 정의합니다.
text
<?xml version="1.0" encoding="UTF-8"?>
<Catalog id="vmoSeed">
  <SeedDef name="vmoTunables">
    <Discover>
      <Command>/usr/sbin/vmo -x | /usr/bin/awk -F, ’{ print "vmoParam:" $1 }’</Command>
      <Mask catalog="1" name="2">(.*):(.*)/Mask>
    </Discover>
  </SeedDef>
</Catalog>

발견 명령은 조정 값을 정의하는 카탈로그 이름을 앞에 붙여 조정 값을 한 줄에 하나씩 출력합니다.

text
...
vmoParam:enhanced_affinity_vmpool_limit
vmoParam:esid_allocator
vmoParam:force_relalias_lite
vmoParam:kernel_heap_psize
...

다음 프로파일은 vmo 조정 값 seed로 AIX Runtime Expert가 지원하는 제한되지 않은 모든 vmo 조정 값을 가져옵니다.

text
<?xml version="1.0" encoding="UTF-8"?>
<Profile>
  <Catalog id="vmoSeed">
    <Seed name="vmoTunables"/>
  </Catalog>
</Profile>

이 프로파일에 artexget -r 명령을 실행하면 다음 예와 비슷한 프로파일을 만듭니다.

text
<?xml version="1.0" encoding="UTF-8"?>
<Profile>
 <Catalog id="vmoParam">
  ...
  <Parameter name="enhanced_affinity_vmpool_limit" value="10"/>
  <Parameter name="esid_allocator" value="0"/>
  <Parameter name="force_relalias_lite" value="0"/>
  <Parameter name="kernel_heap_psize" value="65536" applyType="nextboot" reboot="true"/>
  ...
</Catalog>
</Profile>
  1. 다음 <SeedDef> 요소는 모든 장치의 모든 속성을 발견하는 데 쓰는 seed를 정의합니다. 대상 seed로 그 속성이 동작하는 장치를 나타냅니다.
text
<SeedDef name="devAttr">
  <Discover>
    <Command>
      /usr/sbin/lsdev -F ’name class subclass type’ |
      while read DEV CLASS SUBCLASS TYPE
      do
        /usr/sbin/lsattr -F attribute -l $DEV |
        while read PAR
        do
          echo device=$DEV devParam.$CLASS.$SUBCLASS.$TYPE:devParam.$CLASS
.$SUBCLASS:devParam.$CLASS $PAR
        done
      done
    </Command>
    <Mask target="1" catalog="2" name="3">(.*) (.*) (.*)</Mask>
  </Discover>
</SeedDef>

발견 명령은 발견한 장치 속성을 다음 형식으로 한 줄에 하나씩 출력합니다.

text
device=DeviceName devParam.Class.Subclass.Type:devParam.Class.Subclass:devParam.Class
AttributeName

예:

text
device=en0 devParam.if.EN.en:devParam.if.EN:devParam.if tcp_recvspace
device=en0 devParam.if.EN.en:devParam.if.EN:devParam.if tcp_sendspace
device=ent0 devParam.adapter.vdevice.IBM,l-lan:devParam.adapter.vdevice:devParam.adapter
alt_addr
device=ent0 devParam.adapter.vdevice.IBM,l-lan:devParam.adapter.vdevice:devParam.adapter
chksum_offload

<Prereq> 요소

<Prereq> 요소는 <Get>, <Set>, <Discover> 작업에 전제 조건을 할당합니다.

구문 — 부모 요소: <Get>, <Set>, <Discover>. 다음 속성을 지원합니다.

표 46. 속성

속성 필수 형 설명
id 아니요 string 고유 식별자

다음 자식 요소를 지원합니다.

표 47. 자식 요소

자식 요소 필수 설명
<Command> 아니요 명령
<Argument> 아니요 명령행 인수
<Stdin> 아니요 <Stdin> 요소가 지원하는 인수
<ErrMessage> 아니요 전제 조건이 실패하면 출력할 메시지

참고: <Command> 요소는 전제 조건마다 <ParameterDef> 수준, <CfgMethod> 수준, <PrereqDef> 요소 가운데 한 곳에 정의해야 합니다.

사용법 — prereq는 그 <Get>, <Set>, <Discover> 작업을 쓰는 매개변수에 대해 작업 처리 여부를 정하는 명령입니다. prereq 명령이 실패(0이 아닌 반환 코드)한 매개변수는 무시되고, 전제 조건에 정의한 오류 메시지가 나옵니다.

<Prereq> 요소는 부모 <Get>, <Set>, <Discover> 작업에 전제 조건을 할당합니다. 전제 조건은 <Prereq> 요소 아래에 로컬로 정의하거나, id 속성이 맞는 상위 수준의 <Prereq>나 <PrereqDef> 요소에서 상속합니다.

매개변수는 <ParameterDef> 요소 아래 로컬로 정의한 모든 전제 조건을 갖습니다. 또 구성 방법을 쓰면 매개변수의 구성 방법에 정의한 전제 조건도 갖습니다. 그래서 <CfgMethod> 요소에 전제 조건을 정의하면 그 구성 방법을 쓰는 모든 <ParameterDef> 요소가 자동으로 그 전제 조건을 갖습니다(그 가운데 일부는 전제 조건을 로컬로 다시 정의할 수 있습니다).

주어진 작업의 전제 조건을 정의하는 <Command>, <Argument>, <Stdin>, <ErrMessage> 요소는 다음 순서로 찾습니다.

  • <ParameterDef> 요소의 해당 작업 아래 <Prereq> 하위 요소
  • <ParameterDef> 요소에 cfgmethod 속성이 있으면, 구성 방법의 해당 작업 아래 id가 맞는 <Prereq> 하위 요소
  • 카탈로그에서 id가 맞는 <PrereqDef> 요소

예 — 다음 예는 netaddr와 netaddr6 매개변수를 가져온 시스템과 같은 시스템에 적용하는지 확인하는 전제 조건을 정의합니다.

text
<ParameterDef name="netaddr" type="string" targetClass="device" cfgmethod="attr">
  <Set type="permanent">
    <Prereq>
      <Command>[[ `/usr/bin/uname -f` = %p[nodeId] ]]</Command>
      <ErrMessage>Parameter cannot be applied to a different node</ErrMessage>
    </Prereq>
  </Set>
</ParameterDef>
<ParameterDef name="netaddr6" type="string" targetClass="device" cfgmethod="attr">
  <Set type="permanent">
    <Prereq>
      <Command>[[ `/usr/bin/uname -f` = %p[nodeId] ]]</Command>
      <ErrMessage>Parameter cannot be applied to a different node</ErrMessage>
    </Prereq>
  </Set>
</ParameterDef>

이 예에서 시험은 netaddr 매개변수에 한 번, netaddr6 매개변수에 한 번, 모두 두 번 실행됩니다. 매개변수마다 자기 <Command> 요소가 있는 전제 조건을 갖기 때문입니다. 시험을 한 번만 실행하는 예는 <PrereqDef> 요소를 봅니다.

<PrereqDef> 요소

<PrereqDef> 요소는 나중에 <Prereq> 요소에서 쓸 수 있는 전제 조건을 정의합니다.

구문 — 부모 요소: <Catalog>. 다음 속성을 지원합니다.

표 48. 속성

속성 필수 형 설명
name 예 string property의 이름(원문 그대로, 전제 조건의 id)

다음 자식 요소를 지원합니다.

표 49. 자식 요소

자식 요소 필수 설명
<Command> 아니요 명령
<Argument> 아니요 명령행 인수
<Stdin> 아니요 <Stdin> 요소가 지원하는 인수
<ErrMessage> 아니요 전제 조건이 실패하면 출력할 메시지

참고: <Command> 요소는 전제 조건마다 <ParameterDef> 수준, <CfgMethod> 수준, <PrereqDef> 요소 가운데 한 곳에 정의해야 합니다.

사용법 — prereq는 그 <Get>, <Set>, <Discover> 작업을 쓰는 매개변수에 대해 작업 실행 여부를 정하는 명령입니다. prereq 명령이 실패(0이 아닌 반환 코드)한 매개변수는 무시되고, 전제 조건에 정의한 오류 메시지가 나옵니다.

<PrereqDef> 요소는 전제 조건을 정의합니다. 이 전제 조건은 나중에 id 속성이 같은 <Prereq> 요소로 매개변수나 구성 방법의 작업과 연결할 수 있습니다.

예 — 다음 예는 nodeId 전제 조건을 정의해 netaddr와 netaddr6 매개변수에 할당합니다.

text
<PrereqDef id="nodeId">
  <Command>[[ `/usr/bin/uname -f` = %p[nodeId] ]]</Command>
  <ErrMessage>Parameter cannot be applied to a different node</ErrMessage>
</PrereqDef>
<ParameterDef name="netaddr" type="string" targetClass="device" cfgmethod="attr">
  <Set type="permanent">
    <Prereq id="nodeId"/>
  </Set>
  <Property name="nodeId"/>
</ParameterDef>
<ParameterDef name="netaddr6" type="string" targetClass="device" cfgmethod="attr">
  <Set type="permanent">
    <Prereq id="nodeId"/>
  </Set>
  <Property name="nodeId"/>
</ParameterDef>

이 예에서 두 매개변수가 전제 조건에 같은 <Command> 요소를 쓰고 만들어지는 명령행도 두 매개변수에서 같으므로 시험은 한 번만 실행됩니다.

<Property> 요소

<Property> 요소는 매개변수나 구성 방법에 property를 할당합니다.

구문 — 부모 요소: <CfgMethod>, <ParameterDef>. 다음 속성을 지원합니다.

표 50. 속성

속성 필수 형 설명
name 예 string property의 이름

다음 자식 요소를 지원합니다.

표 51. 자식 요소

자식 요소 필수 설명
<Command> 아니요 명령
<Argument> 아니요 명령행 인수
<Stdin> 아니요 <Stdin> 요소가 지원하는 인수
<Filter> 아니요 필터
<Mask> 아니요 출력 캡처 마스크

참고: <Command> 요소는 property마다 <ParameterDef> 수준, <CfgMethod> 수준, <PropertyDef> 요소 가운데 한 곳에 정의해야 합니다.

사용법 — property는 매개변수에 연결된 키-값 쌍입니다. 키-값 쌍의 값은 artexget -r과 artexget -n 명령이 가져와 출력 프로파일에 저장합니다. 프로파일에 저장한 property 값은 %p[property_name] 시퀀스로 명령행에 넣을 수 있습니다.

<Property> 요소는 매개변수나 구성 방법에 property를 할당합니다. property는 <Property> 요소 아래에 로컬로 정의하거나, name 속성이 맞는 상위 수준의 <Property>나 <PropertyDef> 요소에서 상속합니다.

매개변수는 <ParameterDef> 요소 아래 로컬로 정의한 모든 property를 갖습니다. 또 구성 방법을 쓰면 매개변수의 구성 방법 아래 정의한 모든 property도 갖습니다. 그래서 <CfgMethod> 요소 아래 property를 정의하면 그 구성 방법을 쓰는 모든 <ParameterDef> 요소가 자동으로 그 property를 갖습니다(그 가운데 일부는 property를 로컬로 다시 정의할 수 있습니다).

property 값은 명령행 출력에서 뽑습니다. 명령행은 명령행 생성 절에서 설명한 대로 <Command>, <Argument>, <Stdin>, <Filter> 요소를 합쳐 만듭니다. property 값으로는 명령행의 원래 출력이나, <Mask> 요소를 지정했다면 출력에서 마스크와 맞는 부분 가운데 하나를 씁니다.

property를 정의하는 <Command>, <Argument>, <Stdin>, <Filter>, <Mask> 요소는 다음 순서로 찾습니다.

  • <ParameterDef> 수준의 <Property> 요소 아래
  • <ParameterDef> 요소에 cfgmethod 속성이 있으면, 구성 방법에서 name 속성이 맞는 <Property> 요소 아래
  • 카탈로그에서 name 속성이 맞는 <PropertyDef> 요소 아래

예 — 다음 예는 netaddr와 netaddr6 매개변수에 nodeId property를 할당합니다.

text
<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>

이 예에서 마스크는 줄 전체와 맞으며, 명령 출력 끝의 줄 바꿈 문자를 빼는 데만 씁니다.

이 예에서 uname 명령은 netaddr 매개변수에 한 번, netaddr6 매개변수에 한 번, 모두 두 번 실행됩니다. 매개변수마다 자기 <Command> 요소가 있는 property를 갖기 때문입니다. uname 명령을 한 번만 실행하는 예는 <PropertyDef> 요소를 봅니다.

<PropertyDef> 요소

<PropertyDef> 요소는 <Property> 요소에서 쓸 수 있는 property를 정의합니다.

구문 — 부모 요소: <Catalog>. 다음 속성을 지원합니다.

표 52. 속성

속성 필수 형 설명
name 예 string property의 이름

다음 자식 요소를 지원합니다.

표 53. 자식 요소

자식 요소 필수 설명
<Command> 아니요 명령
<Argument> 아니요 명령행 인수
<Stdin> 아니요 <Stdin> 요소가 지원하는 인수
<Filter> 아니요 필터
<Mask> 아니요 출력 캡처 마스크

참고: <Command> 요소는 property마다 <ParameterDef> 수준, <CfgMethod> 수준, <PropertyDef> 요소 가운데 한 곳에 정의해야 합니다.

사용법 — property는 매개변수에 연결된 키-값 쌍입니다. 키-값 쌍의 값은 artexget -r과 artexget -n 명령이 가져와 출력 프로파일에 저장합니다. 프로파일에 저장한 property 값은 %p[property_name] 시퀀스로 명령행에 넣을 수 있습니다.

<PropertyDef> 요소는 property를 정의합니다. 이 property는 나중에 name 속성이 같은 <Property> 요소로 매개변수나 구성 방법과 연결할 수 있습니다.

예 — 다음 예는 netaddr와 netaddr6 매개변수에 nodeId property를 할당합니다.

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

이 예에서 두 매개변수가 property에 같은 <Command> 요소를 쓰고 만들어지는 명령행도 두 매개변수에서 같으므로 uname 명령은 한 번만 실행됩니다.

영어 원문

<Command> element

The <Command> element defines the base command used to perform the operation defined by the parent element.

Syntax

Parent element: <Get>, <Set>, <Diff>, <Discover>, <PrereqDef>, <Prereq>, <PropertyDef>, <Property>,

<Command>

Usage

The content of the <Command> element is expanded as described in section Expansion of command line elements and combined with the other command line elements to form a complete command line. See section Command line generation for more details.

Some characters often found in shell expressions, such as <, > and & are not allowed in XML documents. These characters must be replaced by the corresponding XML entity:

Table 38. XML entities

  • < — <
  • > — >
  • & — &

Alternatively, a CDATA section can be used if the expression contains many of such characters. The CDATA sections start with <![CDATA[ and ends with ]]>.

The <Command> element must be defined for each supported operation of each parameter, either at the <CfgMethod> level or at the <ParameterDef> level.

Example

The envParam.xml catalog defines a parameter called profile that represents the contents of the /etc/profile file. For this parameter, the <Get> element uses the cat command to capture the content of the /etc/profile file:

text
<ParameterDef name="profile">
  <Get type="current">
    <Command>/usr/bin/cat /etc/environment</Command>
  </Get>
</ParameterDef>

Related information

Command line generation

Expansion of command line elements

<Argument> element:

Syntax

Parent element: <Get>, <Set>, <Diff>, <PrereqDef>, <Prereq>, <PropertyDef>, <Property>

Usage

The content of the <Argument> element is expanded as described in section Expansion of command line elements and combined with the <Command> and or the <Stdin> elements to form a complete command line. See section Command line generation for more details.

Some characters often found in shell expressions, such as <, > and & are not allowed in XML documents. These characters must be replaced by the corresponding XML entity:

Table 39. XML entities

  • < — <
  • > — >
  • & — &

Alternatively, a CDATA section can be used if the expression contains many of such characters. CDATA sections start with <![CDATA[ and ends with ]]>.

Example

The vmoParam.xml catalog uses the <Argument> element to add an argument to the vmo command for each vmo parameter in the profile:

text
<CfgMethod id="vmo">
  <Set type="permanent">
    <Command>/usr/sbin/vmo -p%a</Command>
    <Argument> -o %n=%v1</Argument>
  </Set>
</CfgMethod>

Related information

Command line generation

Expansion of command line elements

<Stdin> element:

Syntax

Parent element: <Get>, <Set>, <Diff>, <PrereqDef>, <Prereq>, <PropertyDef>, <Property>

Usage

The content of the <Stdin> element is expanded as described in section Expansion of command line elements and the resulting data is written to the standard input of the command line generated for the operation defined in the parent element.

Example

The envParam.xml catalog defines a parameter called profile that represents the content of the /etc/profile file. For this parameter, the set operation writes the value of the parameter to the standard input of the cat command to overwrite the /etc/profile file:

text
<ParameterDef name="profile">
  <Set type="permanent">
    <Command>/usr/bin/cat &gt; /etc/profile</Command>
     <Stdin>%v1</Stdin>
   </Set>
 </Get>

Related information

Command line generation

Expansion of command line elements

<Filter> element:

Syntax

Parent element: <Get>, <Diff>, <PropertyDef>, <Property>

Usage

The content of the <Filter> element is a command to which the output of the command line generated for the operation defined in the parent element is passed as input.

Some characters often found in shell expressions, such as <, > and & are not allowed in XML documents. These characters will need to be replaced by the corresponding XML entity:

Table 40. XML entities

  • < — <
  • > — >
  • & — &

Alternatively, a CDATA section can be used if the expression contains many of such characters. The CDATA sections start with <![CDATA[ and ends with ]]>.

Example

The nfsParam.xml catalog uses the <Filter> element for the get operation of parameter v4_root_node to extract the root node from the output of the nfds –getnode command:

text
<ParameterDef id="v4_root_node">
  <Get type="current">
    <Command>
       /usr/sbin/nfsd -getnodes
    </Command>
    <Filter>
       /usr/bin/awk -F: ’NR == 2 { printf("%s", $1) }’
    </Filter>
  </Get>
</ParameterDef>

Related information

Command line generation

<Mask> element:

Syntax

Parent element: <Get>, <Diff>, <Discover> (only under a <SeedDef>),<PropertyDef>, <Property>

The following attributes are supported when used in a <Get> or <Diff> element:

Table 41. Attributes

Attribute Required Type Description
name no integer Specifies the index of the subexpression that matches the name of the parameter. Valid values are 1 and 2.
value no integer Specifies the index of the subexpression that matches the value of the parameter. Valid values are 1 and 2.

The following attributes are supported when used under the <Discover> subelement of a <SeedDef> element:

Table 42. Attributes

Attribute Required Type Description
catalog yes integer Specifies the index of the subexpression that matches the name of the catalog. Valid values are 1, 2, and 3.
name yes integer Specifies the index of the subexpression that matches the name of the parameter. Valid values are 1, 2, and 3.
target no integer Specifies the index of the subexpression that matches the target of the parameter. Valid values are 1, 2, and 3.

The following attribute is supported when used under the <PropertyDef> or <Property> element:

Table 43. Attribute

Attribute Required Type Description
value no integer Specifies the index of the subexpression that matches the name of the parameter. Must be set to “1” if specified.

Usage

The <Mask> element defines a regular expression that is applied on each line of command output to extract data from those lines. The data that is extracted depends on where the <Mask> element is used.

If no attributes are specified, the last line in the command output that matches the regular expression is used to extract the data. The extracted data is the part of the line that matches the regular expression.

When used under a <Get> or <Diff> element, the extracted data is used as the parameter value. When used under a <PropertyDef> or <Property> element, the extracted data is used as the property value.

If only the value attribute is specified, it must be set to 1, and the regular expression must contain only one subexpression. The last line in the command output that matches the regular expression is used to extract the data. The extracted data is the part of the line that matches the first (and only) subexpression. When used under a <Get> or <Diff> element, the extracted data is used as the parameter value. When used under a <PropertyDef> or <Property> element, the extracted data is used as the property value.

If the name and value attributes are specified, one of those attributes must be set to 1 and the other must be set to 2, and the regular expression must contain two subexpressions. A name and a value are extracted from each line of the command output that matches the regular expression. When used in a <Get> element, the name is used as the parameter name and the value as the parameter value. When used in a <Diff>element, the name is used as the parameter name and the value is used as the comparison result. Using this function, the values of several parameters can be extracted by using a single get command, and several parameters can be compared by using a single diff command.

When used in the <Discover> subelement of a <SeedDef> element, the catalog and name attributes must be specified. A catalog name and a parameter name are extracted from each line of the command output that matches the regular expression. If a catalog that matches the extracted catalog name is found on the system, and if it contains a definition for a parameter that matches the extracted parameter name, a parameter is inserted into the profile. The optional target argument can be added to extract a target definition for each discovered parameter. The target definition must follow the semicolon-separated list of ⌂class=instance⌂pairs format, such as class1=instance1;class2=instance2;... format.

Examples

  1. The vmoParam.xml catalog uses the <Mask> element with the name and value attributes to extract all parameter values from a single vmo –a command:
text
<CfgMethod id="vmo">
  <Get type="current">
    <Command>/usr/sbin/vmo -a</Command>
    <Mask name="1" value="2">[[:space:]]*(.*) = (.*)</Mask>
  </Get>
</CfgMethod>
  1. Had the vmoParam.xml catalog been written in a way that one separate command was used to capture the value of each parameter, then the <Mask> element could have been used with just the value attribute set and no name attribute:
text
<CfgMethod id="vmo">
  <Get type="current">
    <Command>/usr/sbin/vmo -o %n</Command>
    <Mask value="1"> = (.*)</Mask>
  </Get>
</CfgMethod>
  1. Or, by using a regular expression that matches only the value:
text
<CfgMethod id="vmo">
  <Get type="current">
    <Command>/usr/sbin/vmo -o %n</Command>
    <Mask>[^ ]*$</Mask>
  </Get>
</CfgMethod>

From the three examples above, the first is the most efficient, since it requires only a single command to capture all the vmo command parameters. Examples 2 and 3 would generate a separate command for each vmo command parameter, since the parameter name is used in the <Command> element.

  1. The following <SeedDef> element defines a seed that can be used to discover all attributes of all devices. It uses a target to designate the device they operate on:

(16줄짜리 예는 위 한글 본문에 그대로 실었습니다.)

The discovery command prints each discovered device attribute on a separate line, by using the following format:

text
device=DeviceName devParam.Class.Subclass.Type AttributeName

For example,

text
device=en0 devParam.if.EN.en tcp_recvspace
device=en0 devParam.if.EN.en tcp_sendspace
device=ent0 devParam.adapter.vdevice.IBM,l-lan alt_addr
device=ent0 devParam.adapter.vdevice.IBM,l-lan chksum_offload

Related information

Command line generation

<SeedDef> element:

The <SeedDef> element defines a seed that can be used in a profile by using a <Seed> element.

Syntax

Parent element: <Catalog>

The following attribute is supported:

Table 44. Attribute

Attribute Required Type Description
name yes string Specifies the name of the seed. This name must be unique for each catalog.

The following child element is supported:

Table 45. Child element

Child element Required Description
<Discover> yes Specifies the command that is used to discover parameters.

Usage

Seeds are used to discover 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, based on the rules defined in the matching <SeedDef> element of the catalog file. This process is called parameter discovery. The artexget command then proceeds as usual with the expanded profile.

The <SeedDef> element contains only a <Discover> subelement, that defines a command to run, and a mask to extract parameter names, catalog names (as colon-separated lists, without the .xml extension), and optionally targets from the output of the command (by using the class1=instance1;class2=instance2;... format). For each line of the output, the first catalog from the colon-separated list that is found on the system is loaded. If a parameter definition is found in this catalog, then a parameter is created in the output profile that has the targets that were extracted from the line. Lines from the command output that do not match the mask, or for which no catalog file is found, or that have no parameter definition if found in the catalog file, are ignored.

Examples

  1. The following catalog defines a <SeedDef> element called vmoTunables that discovers all the nonrestricted vmo tunables seed supported by AIX Runtime Expert:
text
<?xml version="1.0" encoding="UTF-8"?>
<Catalog id="vmoSeed">
  <SeedDef name="vmoTunables">
    <Discover>
      <Command>/usr/sbin/vmo -x | /usr/bin/awk -F, ’{ print "vmoParam:" $1 }’</Command>
      <Mask catalog="1" name="2">(.*):(.*)/Mask>
    </Discover>
  </SeedDef>
</Catalog>

The discovery command prints each tunable on a separate line, preceded by the name of the catalog that defines the tunables:

text
...
vmoParam:enhanced_affinity_vmpool_limit
vmoParam:esid_allocator
vmoParam:force_relalias_lite
vmoParam:kernel_heap_psize
...

The following profile uses the vmo tunables seed to capture all the nonrestricted vmo tunables seed supported by AIX Runtime Expert:

text
<?xml version="1.0" encoding="UTF-8"?>
<Profile>
  <Catalog id="vmoSeed">
    <Seed name="vmoTunables"/>
  </Catalog>
</Profile>

When the artexget –r command is run on the profile, the command generates a profile similar to the following example:

text
<?xml version="1.0" encoding="UTF-8"?>
<Profile>
 <Catalog id="vmoParam">
  ...
  <Parameter name="enhanced_affinity_vmpool_limit" value="10"/>
  <Parameter name="esid_allocator" value="0"/>
  <Parameter name="force_relalias_lite" value="0"/>
  <Parameter name="kernel_heap_psize" value="65536" applyType="nextboot" reboot="true"/>
  ...
</Catalog>
</Profile>
  1. The following <SeedDef> element defines a seed that is used to discover all attributes of all devices. The element uses a target seed to designate the device they operate on:

(17줄짜리 예는 위 한글 본문에 그대로 실었습니다.)

The discovery command prints each discovered device attribute on a separate line, by using the following format:

text
device=DeviceName devParam.Class.Subclass.Type:devParam.Class.Subclass:devParam.Class
AttributeName

For example:

text
device=en0 devParam.if.EN.en:devParam.if.EN:devParam.if tcp_recvspace
device=en0 devParam.if.EN.en:devParam.if.EN:devParam.if tcp_sendspace
device=ent0 devParam.adapter.vdevice.IBM,l-lan:devParam.adapter.vdevice:devParam.adapter
alt_addr
device=ent0 devParam.adapter.vdevice.IBM,l-lan:devParam.adapter.vdevice:devParam.adapter
chksum_offload

<Prereq> element:

The <Prereq> element assigns a prerequisite to <Get>, <Set>, and <Discover> operations.

Syntax

Parent element: <Get>, <Set>, and <Discover>

The following attribute is supported:

Table 46. Attribute

Attribute Required Type Description
id no string Specifies an unique identifier

The following child elements are supported:

Table 47. Child elements

Child element Required Description
<Command> no Command
<Argument> no Command-line arguments
<Stdin> no Arguments supported by the <Stdin> element
<ErrMessage> no Message to print if prerequisites fail

Note: The <Command> element must be defined for each prerequisite: at the <ParameterDef> level, at the <CfgMethod> level, or in a <PrereqDef> element.

Usage

Prereqs are commands that condition the processing of a <Get>, <Set>, and <Discover> operation for parameters that use this <Get>, <Set>, and <Discover> operations. Parameters for which a prereq command fails (nonzero return code) are ignored, and the error message defined in the prerequisite is displayed.

The <Prereq> element assigns a prerequisite to the parent <Get>, <Set>, or <Discover> operation. The prerequisite is either defined locally under the <Prereq> element, or inherited from a higher-level <Prereq> or <PrereqDef> element that has a matching id attribute.

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

The <Command>, <Argument>, <Stdin>, and <ErrMessage> elements that define a prerequisite for a given operation are searched in this order:

  • Under the <Prereq> subelement of the relevant operation of the <ParameterDef> element.

  • If the <ParameterDef> element has a cfgmethod attribute, under the <Prereq> subelement that has a matching id of the relevant operation of the configuration method.

  • Under the <PrereqDef> element of the catalog that has a matching id.

Example

The following example defines a prerequisite that checks that the netaddr and netaddr6 parameters are applied on the same system on which they were captured:

(16줄짜리 예는 위 한글 본문에 그대로 실었습니다.)

In this example, the test is run twice: once for the netaddr parameter, and once for the netaddr6 parameter. This dual processing is because each parameter has its own prerequisite with its own <Command> element. See , <PrereqDef> element for an example that requires only one run of the test.

Related Information

  • Command-line generation

  • <PrereqDef> element

<PrereqDef> element:

The <PrereqDef> element that can later be used in a <Prereq> element.

Syntax

Parent element: <Catalog>

The following attribute is supported:

Table 48. Attribute

Attribute Required Type Description
name yes string Specifies the name of the property.

The following child elements are supported:

Table 49. Child elements

Child element Required Description
<Command> no Command
<Argument> no Command-line arguments
<Stdin> no Arguments that are supported by the <Stdin> element
<ErrMessage> no Message to print if prerequisite fails

Note: The <Command> element must be defined for each prerequisite: at the <ParameterDef> level, at the <CfgMethod> level, or in a <PrereqDef> element.

Usage

Prereq are commands that condition the run of the <Get>, <Set>, and <Discover> operations for parameters that use the <Get>, <Set>, or <Discover> operation. Parameters for which a prereq command fails (nonzero return code) are ignored, and the error message defined in the prerequisite is displayed.

The <PrereqDef> element defines a prerequisite. This prerequisites can later be associated with an operation of a parameter or a configuration method by using a <Prereq> element that has the same id attribute.

Example

The following example defines the nodeId prerequisite and assigns it to the netaddr and netaddr6 parameters:

(16줄짜리 예는 위 한글 본문에 그대로 실었습니다.)

In this example, the test is executed only once, because the two parameters use the same <Command> element for their prerequisites, and the generated command line is the same for the two parameters.

Related Information

  • Command-line generation

  • <Prereq> element

<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 50. Attribute

Attribute Required Type Description
name yes string Specifies the name of the property.

The following child elements are supported:

Table 51. 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:

text
<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 “<PropertyDef> element,” for an example that requires only one run of the uname command.

Related Information

  • Command-line generation

  • Expansion of command line elements

  • “<PropertyDef> element”

<PropertyDef> element:

The <PropertyDef> element defines a property that can be used in a <Property> element.

Syntax

Parent element: <Catalog>

The following attribute is supported:

Table 52. Attribute

Attribute Required Type Description
name yes string Specifies the name of the property.

The following child elements are supported:

Table 53. Child element

Child element Required Description
<Command> no Command
<Argument> no Command-line arguments
<Stdin> no Arguments supported by the <Stdin> elements
<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 associated with a parameter. The value of the key-value pairs are 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 <PropertyDef> element defines a property. This property can later be associated to a parameter or configuration method by using a <Property> element that has the same name attribute.

Example

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

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

In this example, the uname command is run only once, because the two parameters use the same <Command> element for their property, and the generated command line is the same for the two parameters.

Related Information

  • Command-line generation

  • Expansion of command line elements

  • <Property> element