]> git.proxmox.com Git - pve-common.git/blob - test/etc_network_interfaces/t.create_network.pl
use better regex for remote ip check
[pve-common.git] / test / etc_network_interfaces / t.create_network.pl
1 save('proc_net_dev', <<'/proc/net/dev');
2 eth0:
3 eth1:
4 /proc/net/dev
5
6 r(load('brbase'));
7
8 my $ip = '192.168.0.2';
9 my $nm = '255.255.255.0';
10 my $gw = '192.168.0.1';
11
12 $config->{ifaces}->{eth1} = {
13 type => 'eth',
14 method => 'static',
15 address => $ip,
16 netmask => $nm,
17 gateway => $gw,
18 families => ['inet'],
19 autostart => 1
20 };
21
22 expect load('loopback') . <<"CHECK";
23 source-directory interfaces.d
24
25 iface eth0 inet manual
26
27 auto eth1
28 iface eth1 inet static
29 address $ip
30 netmask $nm
31 gateway $gw
32
33 auto vmbr0
34 iface vmbr0 inet static
35 address 10.0.0.2
36 netmask 255.255.255.0
37 gateway 10.0.0.1
38 bridge_ports eth0
39 bridge_stp off
40 bridge_fd 0
41
42 CHECK
43
44 save('if', w());
45 r(load('if'));
46 expect load('if');
47
48 r(load('brbase'));
49
50 my $ip = 'fc05::2';
51 my $nm = '112';
52 my $gw = 'fc05::1';
53
54 $config->{ifaces}->{eth1} = {
55 type => 'eth',
56 method6 => 'static',
57 address6 => $ip,
58 netmask6 => $nm,
59 gateway6 => $gw,
60 families => ['inet6'],
61 autostart => 1
62 };
63
64
65 expect load('loopback') . <<"CHECK";
66 source-directory interfaces.d
67
68 iface eth0 inet manual
69
70 auto eth1
71 iface eth1 inet6 static
72 address $ip
73 netmask $nm
74 gateway $gw
75
76 auto vmbr0
77 iface vmbr0 inet static
78 address 10.0.0.2
79 netmask 255.255.255.0
80 gateway 10.0.0.1
81 bridge_ports eth0
82 bridge_stp off
83 bridge_fd 0
84
85 CHECK
86
87 save('if', w());
88 r(load('if'));
89 expect load('if');
90
91 1;