]> git.proxmox.com Git - pve-common.git/blame - 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
CommitLineData
c7c4208a
WB
1save('proc_net_dev', <<'/proc/net/dev');
2eth0:
3eth1:
4/proc/net/dev
5
378c6656 6my $ip = '192.168.0.2/24';
c7c4208a 7my $gw = '192.168.0.1';
378c6656 8my $ip6 = 'fc05::2/112';
c7c4208a
WB
9my $gw6 = 'fc05::1';
10
11# Load
12r(load('brbase'));
13
14# Create eth1
15$config->{ifaces}->{eth1} = {
16 type => 'eth',
17 method => 'static',
18 address => $ip,
c7c4208a
WB
19 gateway => $gw,
20 families => ['inet'],
21 autostart => 1
22};
23
24# Check
25expect load('loopback') . <<"CHECK";
26source-directory interfaces.d
27
28iface eth0 inet manual
29
30auto eth1
31iface eth1 inet static
beedabb4
AD
32 address $ip
33 gateway $gw
c7c4208a
WB
34
35auto vmbr0
36iface vmbr0 inet static
beedabb4
AD
37 address 10.0.0.2/24
38 gateway 10.0.0.1
1accc6da
AD
39 bridge-ports eth0
40 bridge-stp off
41 bridge-fd 0
c7c4208a
WB
42
43CHECK
44
45# Reload then modify
46save('ipv4', w());
47r(load('ipv4'));
48expect 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
59my $final = load('loopback') . <<"CHECK";
60source-directory interfaces.d
61
62iface eth0 inet manual
63
64auto eth1
65iface eth1 inet static
beedabb4
AD
66 address $ip
67 gateway $gw
c7c4208a
WB
68
69iface eth1 inet6 static
beedabb4
AD
70 address $ip6
71 gateway $gw6
c7c4208a
WB
72
73auto vmbr0
74iface vmbr0 inet static
beedabb4
AD
75 address 10.0.0.2/24
76 gateway 10.0.0.1
1accc6da
AD
77 bridge-ports eth0
78 bridge-stp off
79 bridge-fd 0
c7c4208a
WB
80
81CHECK
82expect $final;
83
84save('both', w());
85r(load('both'));
86expect load('both');
87
88# Reload ipv4 and replace instead of modifying
89r(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};
104expect $final;
105r(w());
106expect $final;
107
1081;