network.rng 6.6 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 15
    <element name="network">
      <interleave>
C
Cole Robinson 已提交
16

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

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

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

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

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

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

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

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

76 77 78 79 80
            <optional>
              <attribute name="mode">
                <choice>
                  <value>nat</value>
                  <value>route</value>
81 82 83 84
                  <value>bridge</value>
                  <value>passthrough</value>
                  <value>private</value>
                  <value>vepa</value>
85 86 87
                </choice>
              </attribute>
            </optional>
88 89 90 91 92 93 94
            <zeroOrMore>
              <element name='interface'>
                <attribute name='dev'>
                  <ref name='deviceName'/>
                </attribute>
              </element>
            </zeroOrMore>
95
          </element>
96 97
        </optional>

98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
        <!-- <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>

123 124 125
        <!-- <domain> element -->
        <optional>
          <element name="domain">
126
            <attribute name="name"><ref name="dnsName"/></attribute>
127
          </element>
128 129
        </optional>

130 131 132 133 134 135
        <!-- Define the DNS related elements like TXT records
             and other features in the <dns> element -->
        <optional>
            <element name="dns">
              <zeroOrMore>
                <element name="txt">
136
                  <attribute name="name"><ref name="dnsName"/></attribute>
137 138 139
                  <attribute name="value"><text/></attribute>
                </element>
              </zeroOrMore>
140 141
              <zeroOrMore>
                <element name="host">
142
                  <attribute name="ip"><ref name="ipv4Addr"/></attribute>
143
                  <oneOrMore>
144
                    <element name="hostname"><ref name="dnsName"/></element>
145 146 147
                  </oneOrMore>
                </element>
              </zeroOrMore>
148 149 150
            </element>
        </optional>

151
        <!-- <ip> element -->
152
        <zeroOrMore>
153 154 155 156
          <!-- The IP element sets up NAT'ing and an optional DHCP server
               local to the host. -->
          <element name="ip">
            <optional>
157
              <attribute name="address"><ref name="ipAddr"/></attribute>
158 159 160
            </optional>
            <optional>
              <choice>
161 162
                <attribute name="netmask"><ref name="ipv4Addr"/></attribute>
                <attribute name="prefix"><ref name="ipPrefix"/></attribute>
163
              </choice>
164 165
            </optional>
            <optional>
166
              <attribute name="family"><ref name="addr-family"/></attribute>
167
            </optional>
168
            <optional>
169 170 171
              <element name="tftp">
                <attribute name="root"><text/></attribute>
              </element>
172
            </optional>
173 174 175 176 177 178
            <optional>
              <!-- Define the range(s) of IP addresses that the DHCP
                   server should hand out -->
              <element name="dhcp">
                <zeroOrMore>
                  <element name="range">
179 180
                    <attribute name="start"><ref name="ipv4Addr"/></attribute>
                    <attribute name="end"><ref name="ipv4Addr"/></attribute>
181 182 183 184
                  </element>
                </zeroOrMore>
                <zeroOrMore>
                  <element name="host">
185
                    <attribute name="mac"><ref name="macAddr"/></attribute>
186
                    <attribute name="name"><text/></attribute>
187
                    <attribute name="ip"><ref name="ipv4Addr"/></attribute>
188 189 190 191
                  </element>
                </zeroOrMore>
                <optional>
                  <element name="bootp">
192
                    <attribute name="file"><ref name="filePath"/></attribute>
193
                    <optional>
194
                      <attribute name="server"><ref name="dnsName"/></attribute>
195 196 197 198 199
                    </optional>
                  </element>
                </optional>
              </element>
            </optional>
200
          </element>
201
        </zeroOrMore>
202
      </interleave>
203
    </element>
204
  </define>
205

206 207 208 209 210 211
  <define name='addr-family'>
    <data type='string'>
      <param name="pattern">(ipv4)|(ipv6)</param>
    </data>
  </define>

212
</grammar>