Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / tests / test_dns_zone.aug
1 module Test_Dns_Zone =
2
3 let lns = Dns_Zone.lns
4
5 (* RFC 1034 §6 *)
6 test lns get "
7 EDU.  IN SOA SRI-NIC.ARPA. HOSTMASTER.SRI-NIC.ARPA. (
8                         870729 ;serial
9                         1800 ;refresh every 30 minutes
10                         300 ;retry every 5 minutes
11                         604800 ;expire after a week
12                         86400 ;minimum of a day
13                         )
14                 NS SRI-NIC.ARPA.
15                 NS C.ISI.EDU.
16
17 UCI 172800 NS ICS.UCI
18                 172800 NS ROME.UCI
19 ICS.UCI 172800 A 192.5.19.1
20 ROME.UCI 172800 A 192.5.19.31
21
22 ISI 172800 NS VAXA.ISI
23                 172800 NS A.ISI
24                 172800 NS VENERA.ISI.EDU.
25 VAXA.ISI 172800 A 10.2.0.27
26                 172800 A 128.9.0.33
27 VENERA.ISI.EDU. 172800 A 10.1.0.52
28                 172800 A 128.9.0.32
29 A.ISI 172800 A 26.3.0.103
30
31 UDEL.EDU.  172800 NS LOUIE.UDEL.EDU.
32                 172800 NS UMN-REI-UC.ARPA.
33 LOUIE.UDEL.EDU. 172800 A 10.0.0.96
34                 172800 A 192.5.39.3
35
36 YALE.EDU.  172800 NS YALE.ARPA.
37 YALE.EDU.  172800 NS YALE-BULLDOG.ARPA.
38
39 MIT.EDU.  43200 NS XX.LCS.MIT.EDU.
40                   43200 NS ACHILLES.MIT.EDU.
41 XX.LCS.MIT.EDU.  43200 A 10.0.0.44
42 ACHILLES.MIT.EDU. 43200 A 18.72.0.8
43 " =
44   { "EDU."
45     { "1"
46       { "class" = "IN" }
47       { "type" = "SOA" }
48       { "mname" = "SRI-NIC.ARPA." }
49       { "rname" = "HOSTMASTER.SRI-NIC.ARPA." }
50       { "serial" = "870729" }
51       { "refresh" = "1800" }
52       { "retry" = "300" }
53       { "expiry" = "604800" }
54       { "minimum" = "86400" }
55     }
56     { "2" { "type" = "NS" } { "rdata" = "SRI-NIC.ARPA." } }
57     { "3" { "type" = "NS" } { "rdata" = "C.ISI.EDU." } }
58   }
59   { "UCI"
60     { "1" { "ttl" = "172800" } { "type" = "NS" } { "rdata" = "ICS.UCI" } }
61     { "2" { "ttl" = "172800" } { "type" = "NS" } { "rdata" = "ROME.UCI" } }
62   }
63   { "ICS.UCI"
64     { "1" { "ttl" = "172800" } { "type" = "A" } { "rdata" = "192.5.19.1" } }
65   }
66   { "ROME.UCI"
67     { "1" { "ttl" = "172800" } { "type" = "A" } { "rdata" = "192.5.19.31" } }
68   }
69   { "ISI"
70     { "1" { "ttl" = "172800" } { "type" = "NS" } { "rdata" = "VAXA.ISI" } }
71     { "2" { "ttl" = "172800" } { "type" = "NS" } { "rdata" = "A.ISI" } }
72     { "3"
73       { "ttl" = "172800" } { "type" = "NS" } { "rdata" = "VENERA.ISI.EDU." }
74     }
75   }
76   { "VAXA.ISI"
77     { "1" { "ttl" = "172800" } { "type" = "A" } { "rdata" = "10.2.0.27" } }
78     { "2" { "ttl" = "172800" } { "type" = "A" } { "rdata" = "128.9.0.33" } }
79   }
80   { "VENERA.ISI.EDU."
81     { "1" { "ttl" = "172800" } { "type" = "A" } { "rdata" = "10.1.0.52" } }
82     { "2" { "ttl" = "172800" } { "type" = "A" } { "rdata" = "128.9.0.32" } }
83   }
84   { "A.ISI"
85     { "1" { "ttl" = "172800" } { "type" = "A" } { "rdata" = "26.3.0.103" } }
86   }
87   { "UDEL.EDU."
88     { "1"
89       { "ttl" = "172800" } { "type" = "NS" } { "rdata" = "LOUIE.UDEL.EDU." }
90     }
91     { "2"
92       { "ttl" = "172800" } { "type" = "NS" } { "rdata" = "UMN-REI-UC.ARPA." }
93     }
94   }
95   { "LOUIE.UDEL.EDU."
96     { "1" { "ttl" = "172800" } { "type" = "A" } { "rdata" = "10.0.0.96" } }
97     { "2" { "ttl" = "172800" } { "type" = "A" } { "rdata" = "192.5.39.3" } }
98   }
99   { "YALE.EDU."
100     { "1" { "ttl" = "172800" } { "type" = "NS" } { "rdata" = "YALE.ARPA." } }
101   }
102   { "YALE.EDU."
103     { "1"
104       { "ttl" = "172800" } { "type" = "NS" } { "rdata" = "YALE-BULLDOG.ARPA." }
105     }
106   }
107   { "MIT.EDU."
108     { "1"
109       { "ttl" = "43200" } { "type" = "NS" } { "rdata" = "XX.LCS.MIT.EDU." }
110     }
111     { "2"
112       { "ttl" = "43200" } { "type" = "NS" } { "rdata" = "ACHILLES.MIT.EDU." }
113     }
114   }
115   { "XX.LCS.MIT.EDU."
116     { "1" { "ttl" = "43200" } { "type" = "A" } { "rdata" = "10.0.0.44" } }
117   }
118   { "ACHILLES.MIT.EDU."
119     { "1" { "ttl" = "43200" } { "type" = "A" } { "rdata" = "18.72.0.8" } }
120   }
121
122
123 (* RFC 1035 §5.3 *)
124 test lns get "
125 @   IN  SOA     VENERA      Action\.domains (
126                                  20     ; SERIAL
127                                  7200   ; REFRESH
128                                  600    ; RETRY
129                                  3600000; EXPIRE
130                                  60)    ; MINIMUM
131
132         NS      A.ISI.EDU.
133         NS      VENERA
134         NS      VAXA
135         MX      10      VENERA
136         MX      20      VAXA
137
138 A       A       26.3.0.103
139
140 VENERA  A       10.1.0.52
141         A       128.9.0.32
142
143 VAXA    A       10.2.0.27
144         A       128.9.0.33
145 " =
146   { "@"
147     { "1"
148       { "class" = "IN" }
149       { "type" = "SOA" }
150       { "mname" = "VENERA" }
151       { "rname" = "Action\\.domains" }
152       { "serial" = "20" }
153       { "refresh" = "7200" }
154       { "retry" = "600" }
155       { "expiry" = "3600000" }
156       { "minimum" = "60" }
157     }
158     { "2" { "type" = "NS" } { "rdata" = "A.ISI.EDU." } }
159     { "3" { "type" = "NS" } { "rdata" = "VENERA" } }
160     { "4" { "type" = "NS" } { "rdata" = "VAXA" } }
161     { "5" { "type" = "MX" } { "priority" = "10" } { "exchange" = "VENERA" } }
162     { "6" { "type" = "MX" } { "priority" = "20" } { "exchange" = "VAXA" } }
163   }
164   { "A" { "1" { "type" = "A" } { "rdata" = "26.3.0.103" } } }
165   { "VENERA"
166     { "1" { "type" = "A" } { "rdata" = "10.1.0.52" } }
167     { "2" { "type" = "A" } { "rdata" = "128.9.0.32" } }
168   }
169   { "VAXA"
170     { "1" { "type" = "A" } { "rdata" = "10.2.0.27" } }
171     { "2" { "type" = "A" } { "rdata" = "128.9.0.33" } }
172   }
173
174
175 (* RFC 2782 *)
176 test lns get "
177 $ORIGIN example.com.
178 @               SOA server.example.com. root.example.com. (
179                     1995032001 3600 3600 604800 86400 )
180                 NS  server.example.com.
181                 NS  ns1.ip-provider.net.
182                 NS  ns2.ip-provider.net.
183 ; foobar - use old-slow-box or new-fast-box if either is
184 ; available, make three quarters of the logins go to
185 ; new-fast-box.
186 _foobar._tcp    SRV 0 1 9 old-slow-box.example.com.
187                  SRV 0 3 9 new-fast-box.example.com.
188 ; if neither old-slow-box or new-fast-box is up, switch to
189 ; using the sysdmin's box and the server
190                  SRV 1 0 9 sysadmins-box.example.com.
191                  SRV 1 0 9 server.example.com.
192 server           A   172.30.79.10
193 old-slow-box     A   172.30.79.11
194 sysadmins-box    A   172.30.79.12
195 new-fast-box     A   172.30.79.13
196 ; NO other services are supported
197 *._tcp          SRV  0 0 0 .
198 *._udp          SRV  0 0 0 .
199 " =
200   { "$ORIGIN" = "example.com." }
201   { "@"
202     { "1"
203       { "type" = "SOA" }
204       { "mname" = "server.example.com." }
205       { "rname" = "root.example.com." }
206       { "serial" = "1995032001" }
207       { "refresh" = "3600" }
208       { "retry" = "3600" }
209       { "expiry" = "604800" }
210       { "minimum" = "86400" }
211     }
212     { "2" { "type" = "NS" } { "rdata" = "server.example.com." } }
213     { "3" { "type" = "NS" } { "rdata" = "ns1.ip-provider.net." } }
214     { "4" { "type" = "NS" } { "rdata" = "ns2.ip-provider.net." } }
215   }
216   { "_foobar._tcp"
217     { "1"
218       { "type" = "SRV" }
219       { "priority" = "0" }
220       { "weight" = "1" }
221       { "port" = "9" }
222       { "target" = "old-slow-box.example.com." }
223     }
224     { "2"
225       { "type" = "SRV" }
226       { "priority" = "0" }
227       { "weight" = "3" }
228       { "port" = "9" }
229       { "target" = "new-fast-box.example.com." }
230     }
231     { "3"
232       { "type" = "SRV" }
233       { "priority" = "1" }
234       { "weight" = "0" }
235       { "port" = "9" }
236       { "target" = "sysadmins-box.example.com." }
237     }
238     { "4"
239       { "type" = "SRV" }
240       { "priority" = "1" }
241       { "weight" = "0" }
242       { "port" = "9" }
243       { "target" = "server.example.com." }
244     }
245   }
246   { "server" { "1" { "type" = "A" } { "rdata" = "172.30.79.10" } } }
247   { "old-slow-box" { "1" { "type" = "A" } { "rdata" = "172.30.79.11" } } }
248   { "sysadmins-box" { "1" { "type" = "A" } { "rdata" = "172.30.79.12" } } }
249   { "new-fast-box" { "1" { "type" = "A" } { "rdata" = "172.30.79.13" } } }
250   { "*._tcp"
251     { "1"
252       { "type" = "SRV" }
253       { "priority" = "0" }
254       { "weight" = "0" }
255       { "port" = "0" }
256       { "target" = "." }
257     }
258   }
259   { "*._udp"
260     { "1"
261       { "type" = "SRV" }
262       { "priority" = "0" }
263       { "weight" = "0" }
264       { "port" = "0" }
265       { "target" = "." }
266     }
267   }
268
269
270 (* RFC 3403 §6.2 *)
271 test lns get "
272 $ORIGIN 2.1.2.1.5.5.5.0.7.7.1.e164.arpa.
273  IN NAPTR 100 10 \"u\" \"sip+E2U\"  \"!^.*$!sip:information@foo.se!i\"     .
274  IN NAPTR 102 10 \"u\" \"smtp+E2U\" \"!^.*$!mailto:information@foo.se!i\"  .
275 " =
276   { "$ORIGIN" = "2.1.2.1.5.5.5.0.7.7.1.e164.arpa." }
277   { "@"
278     { "1"
279       { "class" = "IN" }
280       { "type" = "NAPTR" }
281       { "order" = "100" }
282       { "preference" = "10" }
283       { "flags" = "\"u\"" }
284       { "service" = "\"sip+E2U\"" }
285       { "regexp" = "\"!^.*$!sip:information@foo.se!i\"" }
286       { "replacement" = "." }
287     }
288     { "2"
289       { "class" = "IN" }
290       { "type" = "NAPTR" }
291       { "order" = "102" }
292       { "preference" = "10" }
293       { "flags" = "\"u\"" }
294       { "service" = "\"smtp+E2U\"" }
295       { "regexp" = "\"!^.*$!mailto:information@foo.se!i\"" }
296       { "replacement" = "." }
297     }
298   }
299
300
301 (* SOA record on a single line *)
302 test lns get "
303 $ORIGIN example.com.
304 @ IN SOA ns root.example.com. (1 2 3 4 5)
305 " =
306   { "$ORIGIN" = "example.com." }
307   { "@"
308     { "1"
309       { "class" = "IN" }
310       { "type" = "SOA" }
311       { "mname" = "ns" }
312       { "rname" = "root.example.com." }
313       { "serial" = "1" }
314       { "refresh" = "2" }
315       { "retry" = "3" }
316       { "expiry" = "4" }
317       { "minimum" = "5" }
318     }
319   }
320
321
322 (* Different ordering of TTL and class *)
323 test lns get "
324 $ORIGIN example.com.
325 foo 1D IN A 10.1.2.3
326 bar IN 2W A 10.4.5.6
327 " =
328   { "$ORIGIN" = "example.com." }
329   { "foo"
330     { "1"
331       { "ttl" = "1D" }
332       { "class" = "IN" }
333       { "type" = "A" }
334       { "rdata" = "10.1.2.3" }
335     }
336   }
337   { "bar"
338     { "1"
339       { "class" = "IN" }
340       { "ttl" = "2W" }
341       { "type" = "A" }
342       { "rdata" = "10.4.5.6" }
343     }
344   }
345
346
347 (* Escaping *)
348 test lns get "
349 $ORIGIN example.com.
350 foo TXT abc\\\\def\\\"ghi
351 bar TXT \"ab cd\\\\ef\\\"gh\"
352 " =
353   { "$ORIGIN" = "example.com." }
354   { "foo" { "1" { "type" = "TXT" } { "rdata" = "abc\\\\def\\\"ghi" } } }
355   { "bar" { "1" { "type" = "TXT" } { "rdata" = "\"ab cd\\\\ef\\\"gh\"" } } }
356
357
358 (* Whitespace at the end of the line *)
359 test lns get "
360 $ORIGIN example.com. \n@ IN SOA ns root.example.com. (1 2 3 4 5) \t
361 foo 1D IN A 10.1.2.3\t
362 " =
363   { "$ORIGIN" = "example.com." }
364   { "@"
365     { "1"
366       { "class" = "IN" }
367       { "type" = "SOA" }
368       { "mname" = "ns" }
369       { "rname" = "root.example.com." }
370       { "serial" = "1" }
371       { "refresh" = "2" }
372       { "retry" = "3" }
373       { "expiry" = "4" }
374       { "minimum" = "5" }
375     }
376   }
377   { "foo"
378     { "1"
379       { "ttl" = "1D" }
380       { "class" = "IN" }
381       { "type" = "A" }
382       { "rdata" = "10.1.2.3" }
383     }
384   }