Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / tests / test_ntp.aug
1 module Test_ntp =
2
3    let conf = "#
4 # Fichier genere par puppet
5 # Environnement: development
6
7 server dns01.echo-net.net version 3
8 server dns02.echo-net.net version 4
9
10 driftfile /var/lib/ntp/ntp.drift
11
12 restrict default ignore
13
14 #server dns01.echo-net.net
15 restrict 192.168.0.150 nomodify
16
17 # allow everything from localhost
18 restrict 127.0.0.1
19
20 logfile /var/log/ntpd
21 statsdir /var/log/ntpstats/
22 ntpsigndsocket /var/lib/samba/ntp_signd
23
24 statistics loopstats peerstats clockstats
25 filegen loopstats file loopstats type day enable link
26 filegen peerstats file peerstats type day disable
27 filegen clockstats file clockstats type day enable nolink
28
29 interface ignore wildcard
30 interface listen 127.0.0.1
31 "
32
33    test Ntp.lns get conf =
34       { "#comment" = "" }
35       { "#comment" = "Fichier genere par puppet" }
36       { "#comment" = "Environnement: development" }
37       {}
38       { "server" = "dns01.echo-net.net"
39          { "version"  = "3" } }
40       { "server" = "dns02.echo-net.net"
41          { "version"  = "4" } }
42       {}
43       { "driftfile" = "/var/lib/ntp/ntp.drift" }
44       {}
45       { "restrict"  = "default"
46          { "action" = "ignore" } }
47       {}
48       { "#comment" = "server dns01.echo-net.net" }
49       { "restrict"  = "192.168.0.150"
50          { "action" = "nomodify" } }
51       {}
52       { "#comment" = "allow everything from localhost" }
53       { "restrict" = "127.0.0.1" }
54       {}
55       { "logfile"  = "/var/log/ntpd" }
56       { "statsdir" = "/var/log/ntpstats/" }
57       { "ntpsigndsocket" = "/var/lib/samba/ntp_signd" }
58       {}
59       { "statistics"
60          { "loopstats" }
61          { "peerstats" }
62          { "clockstats" } }
63       { "filegen" = "loopstats"
64          { "file" = "loopstats" }
65          { "type" = "day" }
66          { "enable" = "enable" }
67          { "link" = "link" } }
68       { "filegen" = "peerstats"
69          { "file" = "peerstats" }
70          { "type" = "day" }
71          { "enable" = "disable" } }
72       { "filegen" = "clockstats"
73          { "file" = "clockstats" }
74          { "type" = "day" }
75          { "enable" = "enable" }
76          { "link" = "nolink" } }
77    { }
78    { "interface"
79          { "action" = "ignore" }
80          { "addresses" = "wildcard" } }
81    { "interface"
82          { "action" = "listen" }
83          { "addresses" = "127.0.0.1" } }
84
85   (* Some things needed to process the default ntp.conf on Fedora *)
86   test Ntp.lns get
87     "server 66.187.233.4  # added by /sbin/dhclient-script\n" =
88     { "server" = "66.187.233.4"
89       { "#comment" = "# added by /sbin/dhclient-script" } }
90
91   test Ntp.lns get
92     "server 0.fedora.pool.ntp.org iburst dynamic\n" =
93     { "server" = "0.fedora.pool.ntp.org" { "iburst" } { "dynamic" } }
94
95   test Ntp.lns get
96     "restrict 127.0.0.1 \n" =
97     { "restrict" = "127.0.0.1" }
98
99   test Ntp.lns get
100     "restrict default kod nomodify notrap nopeer noquery\n" =
101     { "restrict" = "default"
102       { "action" = "kod" }
103       { "action" = "nomodify" }
104       { "action" = "notrap" }
105       { "action" = "nopeer" }
106       { "action" = "noquery" } }
107
108   test Ntp.lns put
109     "restrict default kod nomodify notrap nopeer noquery\n"
110   after
111     insb "ipv6" "restrict/action[1]" =
112     "restrict -6 default kod nomodify notrap nopeer noquery\n"
113
114   test Ntp.lns get
115     "restrict -6 default kod nomodify notrap nopeer noquery\n" =
116     { "restrict" = "default"
117       { "ipv6" }
118       { "action" = "kod" }
119       { "action" = "nomodify" }
120       { "action" = "notrap" }
121       { "action" = "nopeer" }
122       { "action" = "noquery" } }
123
124   test Ntp.lns put
125     "restrict default kod nomodify notrap nopeer noquery\n"
126   after
127     insb "ipv4" "restrict/action[1]" =
128     "restrict -4 default kod nomodify notrap nopeer noquery\n"
129
130   test Ntp.lns get
131     "restrict -4 default notrap nomodify nopeer noquery\n" =
132     { "restrict" = "default"
133       { "ipv4" }
134       { "action" = "notrap" }
135       { "action" = "nomodify" }
136       { "action" = "nopeer" }
137       { "action" = "noquery" } }
138
139   test Ntp.lns get
140     "includefile /etc/ntp/crypto/pw\n" =
141     { "includefile" = "/etc/ntp/crypto/pw" }
142
143   test Ntp.lns get "fudge  127.127.1.0 stratum 10\n" =
144     { "fudge" = "127.127.1.0" { "stratum" = "10" } }
145
146   test Ntp.lns get "broadcast 192.168.1.255 key 42\n" =
147     { "broadcast" = "192.168.1.255" { "key" = "42" } }
148
149
150   test Ntp.lns get "multicastclient 224.0.1.1\n" =
151      { "multicastclient" = "224.0.1.1" }
152
153   test Ntp.lns put "broadcastclient\tnovolley # broadcast\n"
154      after rm "/*/novolley" = "broadcastclient # broadcast\n"
155
156   test Ntp.auth_command get "trustedkey 4 8 42\n" =
157      { "trustedkey"
158          { "key" = "4" }
159          { "key" = "8" }
160          { "key" = "42" } }
161
162   test Ntp.auth_command get "trustedkey 42\n" =
163      { "trustedkey" { "key" = "42" } }
164
165   test Ntp.lns get "broadcastdelay 0.008\n" =
166      { "broadcastdelay" = "0.008" }
167
168   test Ntp.lns get "enable auth calibrate\ndisable kernel stats\n" =
169      { "enable"
170          { "flag" = "auth" }
171          { "flag" = "calibrate" } }
172      { "disable"
173          { "flag" = "kernel" }
174          { "flag" = "stats" } }
175
176 (* Bug #103: tinker directive *)
177 test Ntp.tinker get "tinker panic 0 huffpuff 3.14\n" =
178   { "tinker"
179     { "panic" = "0" }
180     { "huffpuff" = "3.14" } }
181
182 (* Bug #297: tos directive *)
183 test Ntp.tos get "tos maxdist 16\n" =
184   { "tos"
185     { "maxdist" = "16" } }