network.rng 8.2 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
        <!-- <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>
136 137 138 139 140 141 142 143
            <interleave>
              <optional>
                <ref name="virtualPortProfile"/>
              </optional>
              <optional>
                <ref name="bandwidth"/>
              </optional>
            </interleave>
144 145 146
          </element>
        </zeroOrMore>

147 148 149
        <!-- <domain> element -->
        <optional>
          <element name="domain">
150
            <attribute name="name"><ref name="dnsName"/></attribute>
151
          </element>
152 153
        </optional>

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

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