network.rng 9.3 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
  <include href='basictypes.rng'/>
10
  <include href='networkcommon.rng'/>
11

12
  <define name="network">
13

14
    <element name="network">
15 16 17 18 19
      <optional>
        <attribute name="connections">
          <data type="unsignedInt"/>
        </attribute>
      </optional>
20
      <interleave>
C
Cole Robinson 已提交
21

22 23 24
        <!-- The name of the network, used to refer to it through the API
             and in virsh -->
        <element name="name">
C
Cole Robinson 已提交
25
          <text/>
26
        </element>
C
Cole Robinson 已提交
27

28 29
        <!-- <uuid> element -->
        <optional>
30
          <element name="uuid"><ref name="UUID"/></element>
31
        </optional>
C
Cole Robinson 已提交
32

33 34 35 36 37 38 39
        <!-- <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">
40
                <ref name="deviceName"/>
41 42
              </attribute>
            </optional>
C
Cole Robinson 已提交
43

44 45 46 47 48 49 50 51
            <optional>
              <attribute name="stp">
                <choice>
                  <value>on</value>
                  <value>off</value>
                </choice>
              </attribute>
            </optional>
C
Cole Robinson 已提交
52

53 54 55 56 57
            <optional>
              <attribute name="delay">
                <data type="integer"/>
              </attribute>
            </optional>
C
Cole Robinson 已提交
58

59 60
          </element>
        </optional>
C
Cole Robinson 已提交
61

62 63 64
        <!-- <mac> element -->
        <optional>
          <element name="mac">
65
            <attribute name="address"><ref name="uniMacAddr"/></attribute>
66 67 68 69
            <empty/>
          </element>
        </optional>

70 71 72 73 74 75 76
        <!-- <forward> element -->
        <optional>
          <!-- The device through which the bridge is connected to the
               rest of the network -->
          <element name="forward">
            <optional>
              <attribute name="dev">
77
                <ref name="deviceName"/>
78 79
              </attribute>
            </optional>
C
Cole Robinson 已提交
80

81 82 83 84 85
            <optional>
              <attribute name="mode">
                <choice>
                  <value>nat</value>
                  <value>route</value>
86 87 88 89
                  <value>bridge</value>
                  <value>passthrough</value>
                  <value>private</value>
                  <value>vepa</value>
90 91 92 93 94 95 96 97 98 99
                  <value>hostdev</value>
                </choice>
              </attribute>
            </optional>

            <optional>
              <attribute name="managed">
                <choice>
                  <value>yes</value>
                  <value>no</value>
100 101 102
                </choice>
              </attribute>
            </optional>
103
            <interleave>
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
              <choice>
                <group>
                  <zeroOrMore>
                    <element name='interface'>
                      <attribute name='dev'>
                        <ref name='deviceName'/>
                      </attribute>
                      <optional>
                        <attribute name="connections">
                          <data type="unsignedInt"/>
                        </attribute>
                      </optional>
                    </element>
                  </zeroOrMore>
                </group>
                <group>
                  <zeroOrMore>
                    <element name='address'>
                      <attribute name='type'>
                        <value>pci</value>
                      </attribute>
                      <ref name="pciaddress"/>
                      <optional>
                        <attribute name="connections">
                          <data type="unsignedInt"/>
                        </attribute>
                      </optional>
                    </element>
                  </zeroOrMore>
                </group>
              </choice>
135 136 137 138 139 140 141 142
              <optional>
                <element name='pf'>
                  <attribute name='dev'>
                    <ref name='deviceName'/>
                  </attribute>
                </element>
              </optional>
            </interleave>
143
          </element>
144 145
        </optional>

146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
        <!-- <virtualport> element -->
        <optional>
          <ref name="virtualPortProfile"/>
        </optional>

        <!-- <portgroup> elements -->
        <zeroOrMore>
          <element name="portgroup">
            <attribute name="name">
              <ref name="deviceName"/>
            </attribute>
            <optional>
              <attribute name="default">
                <choice>
                  <value>yes</value>
                  <value>no</value>
                </choice>
              </attribute>
            </optional>
165 166 167 168 169 170 171
            <interleave>
              <optional>
                <ref name="virtualPortProfile"/>
              </optional>
              <optional>
                <ref name="bandwidth"/>
              </optional>
172 173 174
            <optional>
              <ref name="vlan"/>
            </optional>
175
            </interleave>
176 177 178
          </element>
        </zeroOrMore>

179 180 181
        <!-- <domain> element -->
        <optional>
          <element name="domain">
182
            <attribute name="name"><ref name="dnsName"/></attribute>
183
          </element>
184 185
        </optional>

186 187 188 189 190 191
        <!-- Define the DNS related elements like TXT records
             and other features in the <dns> element -->
        <optional>
            <element name="dns">
              <zeroOrMore>
                <element name="txt">
192
                  <attribute name="name"><ref name="dnsName"/></attribute>
193 194 195
                  <attribute name="value"><text/></attribute>
                </element>
              </zeroOrMore>
196 197 198 199 200 201 202 203 204 205 206 207 208
              <zeroOrMore>
                <element name="srv">
                  <attribute name="service"><text/></attribute>
                  <attribute name="protocol"><ref name="protocol"/></attribute>
                  <optional>
                    <attribute name="domain"><ref name="dnsName"/></attribute>
                    <attribute name="target"><text/></attribute>
                    <attribute name="port"><ref name="unsignedShort"/></attribute>
                    <attribute name="priority"><ref name="unsignedShort"/></attribute>
                    <attribute name="weight"><ref name="unsignedShort"/></attribute>
                  </optional>
                </element>
              </zeroOrMore>
209 210
              <zeroOrMore>
                <element name="host">
211
                  <attribute name="ip"><ref name="ipv4Addr"/></attribute>
212
                  <oneOrMore>
213
                    <element name="hostname"><ref name="dnsName"/></element>
214 215 216
                  </oneOrMore>
                </element>
              </zeroOrMore>
217 218
            </element>
        </optional>
219 220 221
       <optional>
         <ref name="bandwidth"/>
       </optional>
222 223 224
       <optional>
         <ref name="vlan"/>
       </optional>
225 226 227 228 229 230 231 232 233 234 235
       <optional>
         <element name="link">
           <attribute name="state">
             <choice>
               <value>up</value>
               <value>down</value>
             </choice>
           </attribute>
           <empty/>
         </element>
        </optional>
236

237
        <!-- <ip> element -->
238
        <zeroOrMore>
239 240 241 242
          <!-- The IP element sets up NAT'ing and an optional DHCP server
               local to the host. -->
          <element name="ip">
            <optional>
243
              <attribute name="address"><ref name="ipAddr"/></attribute>
244 245 246
            </optional>
            <optional>
              <choice>
247 248
                <attribute name="netmask"><ref name="ipv4Addr"/></attribute>
                <attribute name="prefix"><ref name="ipPrefix"/></attribute>
249
              </choice>
250 251
            </optional>
            <optional>
252
              <attribute name="family"><ref name="addr-family"/></attribute>
253
            </optional>
254
            <optional>
255 256 257
              <element name="tftp">
                <attribute name="root"><text/></attribute>
              </element>
258
            </optional>
259 260 261 262 263 264
            <optional>
              <!-- Define the range(s) of IP addresses that the DHCP
                   server should hand out -->
              <element name="dhcp">
                <zeroOrMore>
                  <element name="range">
265 266
                    <attribute name="start"><ref name="ipv4Addr"/></attribute>
                    <attribute name="end"><ref name="ipv4Addr"/></attribute>
267 268 269 270
                  </element>
                </zeroOrMore>
                <zeroOrMore>
                  <element name="host">
271
                    <attribute name="mac"><ref name="uniMacAddr"/></attribute>
272
                    <attribute name="name"><text/></attribute>
273
                    <attribute name="ip"><ref name="ipv4Addr"/></attribute>
274 275 276 277
                  </element>
                </zeroOrMore>
                <optional>
                  <element name="bootp">
278
                    <attribute name="file"><ref name="filePath"/></attribute>
279
                    <optional>
280
                      <attribute name="server"><ref name="dnsName"/></attribute>
281 282 283 284 285
                    </optional>
                  </element>
                </optional>
              </element>
            </optional>
286
          </element>
287
        </zeroOrMore>
288
      </interleave>
289
    </element>
290
  </define>
291
</grammar>