2007-07-24 13:19:40 +04:00
<!-- A Relax NG schema for the libvirt network XML format -->
2010-11-11 22:48:51 +03:00
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
2007-07-24 13:19:40 +04:00
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
2010-11-11 22:48:51 +03:00
<start>
<ref name="network"/>
</start>
2010-11-11 23:17:34 +03:00
<define name="network">
2010-11-11 22:48:51 +03:00
2010-11-11 23:17:34 +03:00
<element name="network">
<interleave>
2009-10-09 16:48:22 +04:00
2010-11-11 23:17:34 +03:00
<!-- The name of the network, used to refer to it through the API
and in virsh -->
<element name="name">
2009-10-09 16:48:22 +04:00
<text/>
2010-11-11 23:17:34 +03:00
</element>
2009-10-09 16:48:22 +04:00
2010-11-11 23:17:34 +03:00
<!-- <uuid> element -->
<optional>
<element name="uuid"><text/></element>
</optional>
2009-10-09 16:48:22 +04:00
2010-11-11 23:17:34 +03:00
<!-- <bridge> element -->
<optional>
<!-- The name of the network to be set up; this will back
the network on the host -->
<element name="bridge">
<optional>
<attribute name="name">
<text/>
</attribute>
</optional>
2009-10-09 16:48:22 +04:00
2010-11-11 23:17:34 +03:00
<optional>
<attribute name="stp">
<choice>
<value>on</value>
<value>off</value>
</choice>
</attribute>
</optional>
2009-10-09 16:48:22 +04:00
2010-11-11 23:17:34 +03:00
<optional>
<attribute name="delay">
<data type="integer"/>
</attribute>
</optional>
2009-10-09 16:48:22 +04:00
2010-11-11 23:17:34 +03:00
</element>
</optional>
2009-10-09 16:48:22 +04:00
2010-11-11 23:17:34 +03:00
<!-- <forward> element -->
<optional>
<!-- The device through which the bridge is connected to the
rest of the network -->
<element name="forward">
<optional>
<attribute name="dev">
<text/>
</attribute>
</optional>
2009-10-09 16:48:22 +04:00
2010-11-11 23:17:34 +03:00
<optional>
<attribute name="mode">
<choice>
<value>nat</value>
<value>route</value>
</choice>
</attribute>
</optional>
2007-07-24 13:19:40 +04:00
</element>
2010-11-11 23:17:34 +03:00
</optional>
<!-- <domain> element -->
<optional>
<element name="domain">
2009-07-02 18:02:18 +04:00
<attribute name="name"><text/></attribute>
</element>
2010-11-11 23:17:34 +03:00
</optional>
<!-- <ip> element -->
2010-03-01 22:09:26 +03:00
<optional>
2010-11-11 23:17:34 +03:00
<!-- The IP element sets up NAT'ing and an optional DHCP server
local to the host. -->
<element name="ip">
<optional>
2010-11-11 23:29:01 +03:00
<attribute name="address"><ref name="ipv4-addr"/></attribute>
2010-11-11 23:17:34 +03:00
</optional>
<optional>
2010-11-11 23:29:01 +03:00
<attribute name="netmask"><ref name="ipv4-addr"/></attribute>
2010-11-11 23:17:34 +03:00
</optional>
2009-10-28 17:57:49 +03:00
<optional>
2010-11-11 23:17:34 +03:00
<element name="tftp">
<attribute name="root"><text/></attribute>
</element>
2009-10-28 17:57:49 +03:00
</optional>
2010-12-16 20:36:19 +03:00
<optional>
<!-- Define the range(s) of IP addresses that the DHCP
server should hand out -->
<element name="dhcp">
<zeroOrMore>
<element name="range">
<attribute name="start"><ref name="ipv4-addr"/></attribute>
<attribute name="end"><ref name="ipv4-addr"/></attribute>
</element>
</zeroOrMore>
<zeroOrMore>
<element name="host">
<attribute name="mac"><ref name="mac-addr"/></attribute>
<attribute name="name"><text/></attribute>
<attribute name="ip"><ref name="ipv4-addr"/></attribute>
</element>
</zeroOrMore>
<optional>
<element name="bootp">
<attribute name="file"><text/></attribute>
<optional>
<attribute name="server"><text/></attribute>
</optional>
</element>
</optional>
</element>
</optional>
2010-03-01 22:09:26 +03:00
</element>
</optional>
2010-11-11 23:17:34 +03:00
</interleave>
2007-07-24 13:19:40 +04:00
</element>
2010-11-11 23:17:34 +03:00
</define>
2010-11-11 23:29:01 +03:00
<!-- An ipv4 "dotted quad" address -->
<define name='ipv4-addr'>
<data type='string'>
<param name="pattern">(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))</param>
</data>
</define>
<!-- a 6 byte MAC address in ASCII-hex format, eg "12:34:56:78:9A:BC" -->
<define name='mac-addr'>
<data type='string'>
<param name="pattern">([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}</param>
</data>
</define>
2010-11-11 22:48:51 +03:00
</grammar>