]> git.proxmox.com Git - pve-common.git/blob - test/etc_network_interfaces/t.update_network.pl
cgroup: cpu quota: fix resetting period length for v1
[pve-common.git] / test / etc_network_interfaces / t.update_network.pl
1 save('proc_net_dev', <<'/proc/net/dev');
2 eth0:
3 eth1:
4 /proc/net/dev
5
6 my $ip = '192.168.0.2/24';
7 my $gw = '192.168.0.1';
8 my $ip6 = 'fc05::2/112';
9 my $gw6 = 'fc05::1';
10
11 # Load
12 r(load('brbase'));
13
14 # Create eth1
15 $config->{ifaces}->{eth1} = {
16 type => 'eth',
17 method => 'static',
18 address => $ip,
19 gateway => $gw,
20 families => ['inet'],
21 autostart => 1
22 };
23
24 # Check
25 expect load('loopback') . <<"CHECK";
26 source-directory interfaces.d
27
28 iface eth0 inet manual
29
30 auto eth1
31 iface eth1 inet static
32 address $ip
33 gateway $gw
34
35 auto vmbr0
36 iface vmbr0 inet static
37 address 10.0.0.2/24
38 gateway 10.0.0.1
39 bridge-ports eth0
40 bridge-stp off
41 bridge-fd 0
42
43 CHECK
44
45 # Reload then modify
46 save('ipv4', w());
47 r(load('ipv4'));
48 expect load('ipv4');
49
50 $config->{ifaces}->{eth1}->{$_->[0]} = $_->[1] foreach (
51 [ method6 => 'static' ],
52 [ address6 => $ip6 ],
53 [ netmask6 => $nm6 ],
54 [ gateway6 => $gw6 ],
55 [ families => ['inet', 'inet6'] ]
56 );
57
58 # Check
59 my $final = load('loopback') . <<"CHECK";
60 source-directory interfaces.d
61
62 iface eth0 inet manual
63
64 auto eth1
65 iface eth1 inet static
66 address $ip
67 gateway $gw
68
69 iface eth1 inet6 static
70 address $ip6
71 gateway $gw6
72
73 auto vmbr0
74 iface vmbr0 inet static
75 address 10.0.0.2/24
76 gateway 10.0.0.1
77 bridge-ports eth0
78 bridge-stp off
79 bridge-fd 0
80
81 CHECK
82 expect $final;
83
84 save('both', w());
85 r(load('both'));
86 expect load('both');
87
88 # Reload ipv4 and replace instead of modifying
89 r(load('ipv4'));
90
91 $config->{ifaces}->{eth1} = {
92 type => 'eth',
93 method => 'static',
94 address => $ip,
95 netmask => $nm,
96 gateway => $gw,
97 method6 => 'static',
98 address6 => $ip6,
99 netmask6 => $nm6,
100 gateway6 => $gw6,
101 families => ['inet', 'inet6'],
102 autostart => 1
103 };
104 expect $final;
105 r(w());
106 expect $final;
107
108 1;