Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / tests / test_interfaces.aug
1 module Test_interfaces =
2
3     let conf ="# This file describes the network interfaces available on your system
4 # and how to activate them. For more information, see interfaces(5).
5 # The loopback network interface
6
7 source /etc/network/interfaces.d/*.conf
8
9 auto lo eth0 #foo
10 allow-hotplug eth1
11
12 iface lo inet \
13  loopback
14
15 mapping eth0
16         script /usr/local/sbin/map-scheme
17 map HOME eth0-home
18      map \
19  WORK eth0-work
20
21 iface eth0-home inet static
22
23 address 192.168.1.1
24      netmask 255.255.255.0
25      bridge_maxwait 0
26 #        up flush-mail
27     down Mambo #5
28
29   iface eth0-work inet dhcp
30
31 allow-auto eth1
32 iface eth1 inet dhcp
33
34 iface tap0 inet static
35   vde2-switch -
36
37 mapping eth1
38         # I like mapping ...
39         # ... and I like comments
40
41         script\
42  /usr/local/sbin/map-scheme
43
44 iface bond0 inet dhcp
45   bridge-ports eth2 eth3 eth4
46
47 iface br0 inet static
48   bond-slaves eth5 eth6
49   address 10.0.0.1
50   netmask 255.0.0.0
51
52 source /etc/network.d/*.net.conf
53 "
54
55     test Interfaces.lns get conf =
56         { "#comment" = "This file describes the network interfaces available on your system"}
57         { "#comment" = "and how to activate them. For more information, see interfaces(5)." }
58         { "#comment" = "The loopback network interface" }
59         {}
60         {"source" = "/etc/network/interfaces.d/*.conf"}
61         {}
62         { "auto"
63             { "1" = "lo" }
64             { "2" = "eth0" }
65             { "3" = "#foo" } }
66         { "allow-hotplug" { "1" = "eth1" } }
67         { }
68         { "iface" = "lo"
69             { "family" = "inet"}
70             { "method" = "loopback"} {} }
71         { "mapping" = "eth0"
72             { "script" = "/usr/local/sbin/map-scheme"}
73             { "map" = "HOME eth0-home"}
74             { "map" = "WORK eth0-work"}
75             {} }
76         { "iface" = "eth0-home"
77             { "family" = "inet"}
78             { "method" = "static"}
79             {}
80             { "address" = "192.168.1.1" }
81             { "netmask" = "255.255.255.0" }
82             { "bridge_maxwait" = "0" }
83             { "#comment" = "up flush-mail" }
84             { "down" = "Mambo #5" }
85             {} }
86         { "iface" = "eth0-work"
87             { "family" = "inet"}
88             { "method" = "dhcp"}
89             {} }
90         { "auto"
91             { "1" = "eth1" } }
92         { "iface" = "eth1"
93             { "family" = "inet"}
94             { "method" = "dhcp"}
95             {} }
96         { "iface" = "tap0"
97           { "family" = "inet" }
98           { "method" = "static" }
99           { "vde2-switch" = "-" }
100         {} }
101         { "mapping" = "eth1"
102             { "#comment" = "I like mapping ..." }
103             { "#comment" = "... and I like comments" }
104             {}
105             { "script" = "/usr/local/sbin/map-scheme"}
106         {} }
107         { "iface" = "bond0"
108             { "family" = "inet" }
109             { "method" = "dhcp" }
110             { "bridge-ports"
111                 { "1" = "eth2" }
112                 { "2" = "eth3" }
113                 { "3" = "eth4" }
114             }
115         {} }
116         { "iface" = "br0"
117             { "family" = "inet" }
118             { "method" = "static" }
119             { "bond-slaves"
120                 { "1" = "eth5" }
121                 { "2" = "eth6" }
122             }
123             { "address" = "10.0.0.1" }
124             { "netmask" = "255.0.0.0" }
125         {} }
126         {"source" = "/etc/network.d/*.net.conf"}
127
128 test Interfaces.lns put "" after
129         set "/iface[1]" "eth0";
130         set "/iface[1]/family" "inet";
131         set "/iface[1]/method" "dhcp"
132 = "iface eth0 inet dhcp\n"
133
134 test Interfaces.lns put "" after
135     set "/source[0]" "/etc/network/conf.d/*.conf"
136 = "source /etc/network/conf.d/*.conf\n"
137
138 (* Test: Interfaces.lns
139      source-directory (Issue #306) *)
140 test Interfaces.lns get "source-directory interfaces.d\n" =
141   { "source-directory" = "interfaces.d" }