network.rng 5.5 KB
Newer Older
1
<?xml version="1.0"?>
2
<!-- A Relax NG schema for the libvirt network XML format -->
3
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
4
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
5 6 7 8
  <start>
    <ref name="network"/>
  </start>

9 10
  <include href='basictypes.rng'/>

11
  <define name="network">
12

13 14
    <element name="network">
      <interleave>
C
Cole Robinson 已提交
15

16 17 18
        <!-- The name of the network, used to refer to it through the API
             and in virsh -->
        <element name="name">
C
Cole Robinson 已提交
19
          <text/>
20
        </element>
C
Cole Robinson 已提交
21

22 23
        <!-- <uuid> element -->
        <optional>
24
          <element name="uuid"><ref name="UUID"/></element>
25
        </optional>
C
Cole Robinson 已提交
26

27 28 29 30 31 32 33
        <!-- <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">
34
                <ref name="deviceName"/>
35 36
              </attribute>
            </optional>
C
Cole Robinson 已提交
37

38 39 40 41 42 43 44 45
            <optional>
              <attribute name="stp">
                <choice>
                  <value>on</value>
                  <value>off</value>
                </choice>
              </attribute>
            </optional>
C
Cole Robinson 已提交
46

47 48 49 50 51
            <optional>
              <attribute name="delay">
                <data type="integer"/>
              </attribute>
            </optional>
C
Cole Robinson 已提交
52

53 54
          </element>
        </optional>
C
Cole Robinson 已提交
55

56 57 58
        <!-- <mac> element -->
        <optional>
          <element name="mac">
59
            <attribute name="address"><ref name="macAddr"/></attribute>
60 61 62 63
            <empty/>
          </element>
        </optional>

64 65 66 67 68 69 70
        <!-- <forward> element -->
        <optional>
          <!-- The device through which the bridge is connected to the
               rest of the network -->
          <element name="forward">
            <optional>
              <attribute name="dev">
71
                <ref name="deviceName"/>
72 73
              </attribute>
            </optional>
C
Cole Robinson 已提交
74

75 76 77 78 79 80 81 82
            <optional>
              <attribute name="mode">
                <choice>
                  <value>nat</value>
                  <value>route</value>
                </choice>
              </attribute>
            </optional>
83
          </element>
84 85 86 87 88
        </optional>

        <!-- <domain> element -->
        <optional>
          <element name="domain">
89
            <attribute name="name"><ref name="dnsName"/></attribute>
90
          </element>
91 92
        </optional>

93 94 95 96 97 98
        <!-- Define the DNS related elements like TXT records
             and other features in the <dns> element -->
        <optional>
            <element name="dns">
              <zeroOrMore>
                <element name="txt">
99
                  <attribute name="name"><ref name="dnsName"/></attribute>
100 101 102
                  <attribute name="value"><text/></attribute>
                </element>
              </zeroOrMore>
103 104
              <zeroOrMore>
                <element name="host">
105
                  <attribute name="ip"><ref name="ipv4Addr"/></attribute>
106
                  <oneOrMore>
107
                    <element name="hostname"><ref name="dnsName"/></element>
108 109 110
                  </oneOrMore>
                </element>
              </zeroOrMore>
111 112 113
            </element>
        </optional>

114
        <!-- <ip> element -->
115
        <zeroOrMore>
116 117 118 119
          <!-- The IP element sets up NAT'ing and an optional DHCP server
               local to the host. -->
          <element name="ip">
            <optional>
120
              <attribute name="address"><ref name="ipAddr"/></attribute>
121 122 123
            </optional>
            <optional>
              <choice>
124 125
                <attribute name="netmask"><ref name="ipv4Addr"/></attribute>
                <attribute name="prefix"><ref name="ipPrefix"/></attribute>
126
              </choice>
127 128
            </optional>
            <optional>
129
              <attribute name="family"><ref name="addr-family"/></attribute>
130
            </optional>
131
            <optional>
132 133 134
              <element name="tftp">
                <attribute name="root"><text/></attribute>
              </element>
135
            </optional>
136 137 138 139 140 141
            <optional>
              <!-- Define the range(s) of IP addresses that the DHCP
                   server should hand out -->
              <element name="dhcp">
                <zeroOrMore>
                  <element name="range">
142 143
                    <attribute name="start"><ref name="ipv4Addr"/></attribute>
                    <attribute name="end"><ref name="ipv4Addr"/></attribute>
144 145 146 147
                  </element>
                </zeroOrMore>
                <zeroOrMore>
                  <element name="host">
148
                    <attribute name="mac"><ref name="macAddr"/></attribute>
149
                    <attribute name="name"><text/></attribute>
150
                    <attribute name="ip"><ref name="ipv4Addr"/></attribute>
151 152 153 154
                  </element>
                </zeroOrMore>
                <optional>
                  <element name="bootp">
155
                    <attribute name="file"><ref name="filePath"/></attribute>
156
                    <optional>
157
                      <attribute name="server"><ref name="dnsName"/></attribute>
158 159 160 161 162
                    </optional>
                  </element>
                </optional>
              </element>
            </optional>
163
          </element>
164
        </zeroOrMore>
165
      </interleave>
166
    </element>
167
  </define>
168

169 170 171 172 173 174
  <define name='addr-family'>
    <data type='string'>
      <param name="pattern">(ipv4)|(ipv6)</param>
    </data>
  </define>

175
</grammar>