aboutsummaryrefslogtreecommitdiff
blob: 937e1808ee074c2a55363c32800e89c4206311ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<?xml version="1.0"?>
<!-- A Relax NG schema for the libvirt network XML format -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <start>
    <ref name="network"/>
  </start>

  <include href='basictypes.rng'/>
  <include href='networkcommon.rng'/>

  <define name="network">

    <element name="network">
      <interleave>

        <!-- The name of the network, used to refer to it through the API
             and in virsh -->
        <element name="name">
          <text/>
        </element>

        <!-- <uuid> element -->
        <optional>
          <element name="uuid"><ref name="UUID"/></element>
        </optional>

        <!-- <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">
                <ref name="deviceName"/>
              </attribute>
            </optional>

            <optional>
              <attribute name="stp">
                <choice>
                  <value>on</value>
                  <value>off</value>
                </choice>
              </attribute>
            </optional>

            <optional>
              <attribute name="delay">
                <data type="integer"/>
              </attribute>
            </optional>

          </element>
        </optional>

        <!-- <mac> element -->
        <optional>
          <element name="mac">
            <attribute name="address"><ref name="macAddr"/></attribute>
            <empty/>
          </element>
        </optional>

        <!-- <forward> element -->
        <optional>
          <!-- The device through which the bridge is connected to the
               rest of the network -->
          <element name="forward">
            <optional>
              <attribute name="dev">
                <ref name="deviceName"/>
              </attribute>
            </optional>

            <optional>
              <attribute name="mode">
                <choice>
                  <value>nat</value>
                  <value>route</value>
                  <value>bridge</value>
                  <value>passthrough</value>
                  <value>private</value>
                  <value>vepa</value>
                </choice>
              </attribute>
            </optional>
            <zeroOrMore>
              <element name='interface'>
                <attribute name='dev'>
                  <ref name='deviceName'/>
                </attribute>
              </element>
            </zeroOrMore>
          </element>
        </optional>

        <!-- <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>

        <!-- <domain> element -->
        <optional>
          <element name="domain">
            <attribute name="name"><ref name="dnsName"/></attribute>
          </element>
        </optional>

        <!-- Define the DNS related elements like TXT records
             and other features in the <dns> element -->
        <optional>
            <element name="dns">
              <zeroOrMore>
                <element name="txt">
                  <attribute name="name"><ref name="dnsName"/></attribute>
                  <attribute name="value"><text/></attribute>
                </element>
              </zeroOrMore>
              <zeroOrMore>
                <element name="host">
                  <attribute name="ip"><ref name="ipv4Addr"/></attribute>
                  <oneOrMore>
                    <element name="hostname"><ref name="dnsName"/></element>
                  </oneOrMore>
                </element>
              </zeroOrMore>
            </element>
        </optional>
       <optional>
         <ref name="bandwidth"/>
       </optional>
       <optional>
         <element name="link">
           <attribute name="state">
             <choice>
               <value>up</value>
               <value>down</value>
             </choice>
           </attribute>
           <empty/>
         </element>
        </optional>

        <!-- <ip> element -->
        <zeroOrMore>
          <!-- The IP element sets up NAT'ing and an optional DHCP server
               local to the host. -->
          <element name="ip">
            <optional>
              <attribute name="address"><ref name="ipAddr"/></attribute>
            </optional>
            <optional>
              <choice>
                <attribute name="netmask"><ref name="ipv4Addr"/></attribute>
                <attribute name="prefix"><ref name="ipPrefix"/></attribute>
              </choice>
            </optional>
            <optional>
              <attribute name="family"><ref name="addr-family"/></attribute>
            </optional>
            <optional>
              <element name="tftp">
                <attribute name="root"><text/></attribute>
              </element>
            </optional>
            <optional>
              <!-- Define the range(s) of IP addresses that the DHCP
                   server should hand out -->
              <element name="dhcp">
                <zeroOrMore>
                  <element name="range">
                    <attribute name="start"><ref name="ipv4Addr"/></attribute>
                    <attribute name="end"><ref name="ipv4Addr"/></attribute>
                  </element>
                </zeroOrMore>
                <zeroOrMore>
                  <element name="host">
                    <attribute name="mac"><ref name="macAddr"/></attribute>
                    <attribute name="name"><text/></attribute>
                    <attribute name="ip"><ref name="ipv4Addr"/></attribute>
                  </element>
                </zeroOrMore>
                <optional>
                  <element name="bootp">
                    <attribute name="file"><ref name="filePath"/></attribute>
                    <optional>
                      <attribute name="server"><ref name="dnsName"/></attribute>
                    </optional>
                  </element>
                </optional>
              </element>
            </optional>
          </element>
        </zeroOrMore>
      </interleave>
    </element>
  </define>

  <define name='addr-family'>
    <data type='string'>
      <param name="pattern">(ipv4)|(ipv6)</param>
    </data>
  </define>

</grammar>