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
            </element>
        </optional>
150 151 152
       <optional>
         <ref name="bandwidth"/>
       </optional>
153

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

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

215
</grammar>