network.rng 8.1 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
                </choice>
              </attribute>
            </optional>
93 94 95 96 97 98
            <interleave>
              <zeroOrMore>
                <element name='interface'>
                  <attribute name='dev'>
                    <ref name='deviceName'/>
                  </attribute>
99 100 101 102 103
                  <optional>
                    <attribute name="connections">
                      <data type="unsignedInt"/>
                    </attribute>
                  </optional>
104 105 106 107 108 109 110 111 112 113
                </element>
              </zeroOrMore>
              <optional>
                <element name='pf'>
                  <attribute name='dev'>
                    <ref name='deviceName'/>
                  </attribute>
                </element>
              </optional>
            </interleave>
114
          </element>
115 116
        </optional>

117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
        <!-- <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>
            <optional>
              <ref name="virtualPortProfile"/>
            </optional>
          </element>
        </zeroOrMore>

142 143 144
        <!-- <domain> element -->
        <optional>
          <element name="domain">
145
            <attribute name="name"><ref name="dnsName"/></attribute>
146
          </element>
147 148
        </optional>

149 150 151 152 153 154
        <!-- Define the DNS related elements like TXT records
             and other features in the <dns> element -->
        <optional>
            <element name="dns">
              <zeroOrMore>
                <element name="txt">
155
                  <attribute name="name"><ref name="dnsName"/></attribute>
156 157 158
                  <attribute name="value"><text/></attribute>
                </element>
              </zeroOrMore>
159 160 161 162 163 164 165 166 167 168 169 170 171
              <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>
172 173
              <zeroOrMore>
                <element name="host">
174
                  <attribute name="ip"><ref name="ipv4Addr"/></attribute>
175
                  <oneOrMore>
176
                    <element name="hostname"><ref name="dnsName"/></element>
177 178 179
                  </oneOrMore>
                </element>
              </zeroOrMore>
180 181
            </element>
        </optional>
182 183 184
       <optional>
         <ref name="bandwidth"/>
       </optional>
185 186 187 188 189 190 191 192 193 194 195
       <optional>
         <element name="link">
           <attribute name="state">
             <choice>
               <value>up</value>
               <value>down</value>
             </choice>
           </attribute>
           <empty/>
         </element>
        </optional>
196

197
        <!-- <ip> element -->
198
        <zeroOrMore>
199 200 201 202
          <!-- The IP element sets up NAT'ing and an optional DHCP server
               local to the host. -->
          <element name="ip">
            <optional>
203
              <attribute name="address"><ref name="ipAddr"/></attribute>
204 205 206
            </optional>
            <optional>
              <choice>
207 208
                <attribute name="netmask"><ref name="ipv4Addr"/></attribute>
                <attribute name="prefix"><ref name="ipPrefix"/></attribute>
209
              </choice>
210 211
            </optional>
            <optional>
212
              <attribute name="family"><ref name="addr-family"/></attribute>
213
            </optional>
214
            <optional>
215 216 217
              <element name="tftp">
                <attribute name="root"><text/></attribute>
              </element>
218
            </optional>
219 220 221 222 223 224
            <optional>
              <!-- Define the range(s) of IP addresses that the DHCP
                   server should hand out -->
              <element name="dhcp">
                <zeroOrMore>
                  <element name="range">
225 226
                    <attribute name="start"><ref name="ipv4Addr"/></attribute>
                    <attribute name="end"><ref name="ipv4Addr"/></attribute>
227 228 229 230
                  </element>
                </zeroOrMore>
                <zeroOrMore>
                  <element name="host">
231
                    <attribute name="mac"><ref name="uniMacAddr"/></attribute>
232
                    <attribute name="name"><text/></attribute>
233
                    <attribute name="ip"><ref name="ipv4Addr"/></attribute>
234 235 236 237
                  </element>
                </zeroOrMore>
                <optional>
                  <element name="bootp">
238
                    <attribute name="file"><ref name="filePath"/></attribute>
239
                    <optional>
240
                      <attribute name="server"><ref name="dnsName"/></attribute>
241 242 243 244 245
                    </optional>
                  </element>
                </optional>
              </element>
            </optional>
246
          </element>
247
        </zeroOrMore>
248
      </interleave>
249
    </element>
250
  </define>
251
</grammar>