usr/src/cmd/ai-webserver/criteria_schema.rng
author Sue Sohn <Susan.Sohn@Oracle.COM>
Fri, 20 Aug 2010 11:31:18 -0600
changeset 862 e9f31f2f2f2d
parent 523 9abfbbe9b302
child 1160 6f7e708c38ec
permissions -rw-r--r--
16423 Updates to AI schema should be made 15449 installadm add validates combined manifest against image-specific schema as well as schema in /usr/share/auto_install/ 6975043 separate criteria and ai manifest 6975686 installadm list shows value rather than range if lower bound is 0

<!--
CDDL HEADER START

The contents of this file are subject to the terms of the
Common Development and Distribution License (the "License").
You may not use this file except in compliance with the License.

You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
or http://www.opensolaris.org/os/licensing.
See the License for the specific language governing permissions
and limitations under the License.

When distributing Covered Code, include this CDDL HEADER in each
file and include the License file at usr/src/OPENSOLARIS.LICENSE.
If applicable, add the following below this CDDL HEADER, with the
fields enclosed by brackets "[]" replaced with your own identifying
information: Portions Copyright [yyyy] [name of copyright owner]

CDDL HEADER END

Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
-->

<!--
================================================================================
RelaxNG schema for Automatic Installer criteria manifest specification.

Contains schema rules and content specification for AI manifest.

================================================================================
-->


<grammar
    xmlns="http://relaxng.org/ns/structure/1.0"
    datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
	<start>
		<element name="ai_criteria_manifest">
			<!--
			    The manifest may or may not
			    have criteria in it.
			-->
			<zeroOrMore>
				<ref name="nm_auto_install_criteria"/>
			</zeroOrMore>
		</element>
	</start>

	<!--
	=======================================================================
	Parameters used for Automatic Installation criteria
	=======================================================================
	-->
	<define name="nm_auto_install_criteria">
		<element name="ai_criteria">
			<attribute name="name">
				<text/>
			</attribute>
			<choice>
				<!-- Criteria can be range or single value -->
				<element name="value">
					<data type="string"/>
				</element>
				<element name="range">
					<ref name="nm_range_criteria"/>
				</element>
			</choice>
		</element>
	</define>

	<define name="nm_range_criteria">
		<!--
		    Note how ranges are specified:
		    - a range with upper and lower bounds: min followed by max
		    - a range with an unbounded min: "unbounded" followed by max
		    - a range with an unbounded max: min followed by "unbounded"
		    Note: single values are specified by a value, not a range

		    It is important to NOT create a list element for a pair of
		    strings.  If this would be done, then any bogus values
		    validated by a more-restrictive pattern would not match
		    that pattern but would match the string and errantly pass
		    validation.
		-->
		<choice>
			<!--
			    This type for two numeric entries (i.e. memory
			    size) both specified as a min/max pair)
			-->
			<list>
				<data type="long"/>
				<data type="long"/>
			</list>
			<!--
			    This type for a string and one numeric entry
			    (i.e. memory size) as a unbounded/max pair
			-->
			<list>
				<data type="string"/>
				<data type="long"/>
			</list>
			<!--
			    This type for a string and one numeric entry
			    (i.e. memory size) as a min/unbounded pair
			-->
			<list>
				<data type="long"/>
				<data type="string"/>
			</list>
			<!--
			    This type for an unbounded/max IPv4 range.
			-->
			<list>
				<data type="string"/>
				<ref name="nm_ipv4_pattern"/>
			</list>
			<!--
			    This type for an min/unbounded IPv4 range.
			-->
			<list>
				<ref name="nm_ipv4_pattern"/>
				<data type="string"/>
			</list>
			<!--
			    This type for a min/max pair of IPv4 entries.
			-->
			<list>
				<ref name="nm_ipv4_pattern"/>
				<ref name="nm_ipv4_pattern"/>
			</list>
			<!--
			    This type for an unbounded/max MAC addr range.
			-->
			<list>
				<data type="string"/>
				<ref name="nm_mac_pattern"/>
			</list>
			<!--
			    This type for an min/unbounded MAC addr range.
			-->
			<list>
				<ref name="nm_mac_pattern"/>
				<data type="string"/>
			</list>
			<!--
			    This type for two MAC addresses as a min/max pair.
			-->
			<list>
				<ref name="nm_mac_pattern"/>
				<ref name="nm_mac_pattern"/>
			</list>
		</choice>
	</define>

	<define name="nm_ipv4_pattern">
 		<data type="token">
			<param name="pattern">((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])</param>
		</data>
	</define>

	<define name="nm_mac_pattern">
 		<data type="token">
			<param name="pattern">(([0-9A-Fa-f]?[0-9A-Fa-f]:){5}([0-9A-Fa-f]?[0-9A-Fa-f]))</param>
		</data>
	</define>
</grammar>