Creating AE Template File

You can find information related to the virtual image template that is the input to the AE script.

The virtual image template file is the input provided to the Activation Engine script. It is an XML file, with a specific structure that must be followed for the Activation Engine to work accurately. Each template file consists of two major portions, template settings and template data.

Schema

This following is an XML schema that is used to validate the Activation Engine template files:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="template">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="settings">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="logDirectory" type="xs:string" minOccurs="0"/>
              <xs:element name="scriptsDirectory" type="xs:string"/>
              <xs:element name="extensions" minOccurs="0">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="extendedTemplate" maxOccurs="unbounded"/>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="rules">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="section" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="ruleSet" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:any minOccurs="0" processContents="lax" maxOccurs="unbounded"/>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="name" type="xs:string" use="required"/>
                  <xs:attribute name="script" type="xs:string" use="required"/>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
</xs:schema>
The schema can be used to validate the custom made virtual image template files. To validate, type:
/usr/sbin/ae
with -check flag and pass the template parameter.

Document Type Description

The DTD, as a schema, can be used to ensure validity of virtual image template files. The DTD to validate Activation Engine templates is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT template (settings, rules)>
<!ATTLIST template
          name CDATA #REQUIRED>
<!ELEMENT settings (logDirectory?, scriptsDirectory, extensions?)>
<!ELEMENT logDirectory EMPTY>
<!ELEMENT scriptsDirectory EMPTY>
<!ELEMENT extensions (extendedTemplate+)>
<!ELEMENT extendedTemplate EMPTY>
<!ELEMENT rules (section+)>
<!ELEMENT section (ruleSet+)>
<!ATTLIST section
          name CDATA #REQUIRED
          script CDATA #REQUIRED>
<!ELEMENT ruleSet ANY>

Example

An example for ae_template.xml file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<template name="Default Activation Engine template">
	<settings>
		<!-- created automatically if it doesn't exist -->
		<logDirectory>/var/adm/ras/nim/ae/</logDirectory>
		<!-- / is assumed to be / of optical media -->
		<scriptsDirectory>/ae/scripts/</scriptsDirectory>
		<extensions>
			<extendedTemplate>/ae/user_template1.xml</extendedTemplate>
			<extendedTemplate>/ae/user_template2.xml</extendedTemplate>
		</extensions>
	</settings>
	<rules>
		<section name="network" script="ae_network.sh">
			<ruleSet>
				<address>9.3.148.163</address>
				<mask>255.255.254.0</mask>
				<gateway>9.3.148.0</gateway>
				<routes>default:0:9.3.149.1</routes>
			</ruleSet>
		</section>
		<section name="accounts" script="ae_accounts.sh">
			<ruleSet>
				<username>scott</username>
				<groups>admin,sys,system</groups>
				<admin>true</admin>
				<home>/home/bear</home>
			</ruleSet>
			<ruleSet>
				<username>eric</username>
				<groups>cron,security</groups>
				<rlogin>true</rlogin>
				<home>/home/misty</home>	
			</ruleSet>
		</section>
		<section name="filesystems" script="ae_filesystems.sh">
			<ruleSet>
				<mountpoint>/usr/blah</mountpoint>
				<type>jfs2</type>
				<size>3834383</size>
				<efs>yes</efs>
				<vix>no</vix>
			</ruleSet>
			<ruleSet>
				<mountpoint>/usr/bleh</mountpoint>
				<type>jfs</type>
				<size>9595999</size>
				<efs>no</efs>
				<volume_id>Bleh</volume_id> 
			</ruleSet>
		</section>
	</rules>
</template>

Template settings

The template settings are rules-specific to a particular template file that includes the following:
  • logDirectory: Is a directory with the script logs. Each script has a separate log file. For example, if a script was called ae_network_extension.sh then its log file is ae_network_extension.log and is placed in the directory specified by logDirectory rule. If the logDirectory does not exist when Activation Engine starts execution, run the mkdir command to create the directory.
  • scriptsDirectory: Is a directory that defines the location of the scripts. The script contains information about how each rule in the template must be linked to a particular script, and the script must be run to apply the rule. The default scripts provided are ae_network.sh, ae_accounts.sh and ae_filesystems.sh. These scripts contains basic functionality and must be extended for more advanced uses. The root of the path specified in scriptsDirectory element is assumed to be the root of the mounted optical media containing the template.
  • extensions: Is a list of all user created virtual image templates that must be processed by the Activation Engine. Specify the templates that must be processed in order and with full file path. This list is not required if there are no user extensions to the process.
Note: The parameters of the template settings are not customizable because it is interpreted by the Activation Engine.

Sections and rulesets

The rules of a virtual image template file are an important part where all system customization parameters exist. It is subdivided into sections which are categories of rules. For example, there is a separate section for network, user accounts, and file systems. Sections are abstract separators for various groupings of system parameters. They link scripts to RuleSets. Each section has a script field where the code for customizing configuration is defined and has the rules provided in the section RuleSets.

RuleSets are subdivisions of sections. It contains a group of parameters that must be passed for a single execution of the Section script. Each RuleSet implies another different execution of the script that is linked. In one section if you want to execute the script more than once, we must have more than one RuleSet in the file system section.