]> git.proxmox.com Git - pve-common.git/blob - test/etc_network_interfaces/t.create_network.pl
8f4974acc1d7555f3ce056383ec136b09a3d1be9
[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 my $svcnodeip = '239.192.105.237';
12 my $physdev = 'eth0';
13 my $remoteip1 = '192.168.0.3';
14 my $remoteip2 = '192.168.0.4';
15
16
17 $config->{ifaces}->{eth1} = {
18 type => 'eth',
19 method => 'static',
20 address => $ip,
21 netmask => $nm,
22 gateway => $gw,
23 families => ['inet'],
24 autostart => 1
25 };
26
27 $config->{ifaces}->{eth2} = {
28 type => 'eth',
29 method => 'manual',
30 families => ['inet'],
31 autostart => 1
32 };
33
34 $config->{ifaces}->{eth3} = {
35 type => 'eth',
36 method => 'manual',
37 families => ['inet'],
38 autostart => 1
39 };
40
41 $config->{ifaces}->{bond0} = {
42 type => 'bond',
43 mtu => 1400,
44 slaves => 'eth2 eth3',
45 bond_mode => '802.3ad',
46 bond_xmit_hash_policy => 'layer3+4',
47 bond_miimon => 100,
48 method => 'manual',
49 families => ['inet'],
50 autostart => 1
51 };
52
53 $config->{ifaces}->{vmbr1} = {
54 mtu => 1400,
55 type => 'bridge',
56 method => 'manual',
57 families => ['inet'],
58 bridge_stp => off,
59 bridge_fd => 0,
60 bridge_ports => vxlan1,
61 bridge_vlan_aware => yes,
62 autostart => 1
63 };
64
65 $config->{ifaces}->{vmbr2} = {
66 type => 'bridge',
67 method => 'manual',
68 families => ['inet'],
69 bridge_stp => off,
70 bridge_fd => 0,
71 bridge_ports => vxlan2,
72 autostart => 1
73 };
74
75 $config->{ifaces}->{vmbr3} = {
76 type => 'bridge',
77 method => 'manual',
78 families => ['inet'],
79 bridge_stp => off,
80 bridge_fd => 0,
81 bridge_ports => vxlan3,
82 bridge_vlan_aware => yes,
83 bridge_vids => '2-10',
84 autostart => 1
85 };
86
87 $config->{ifaces}->{vxlan1} = {
88 type => 'vxlan',
89 method => 'manual',
90 families => ['inet'],
91 'vxlan-id' => 1,
92 'vxlan-svcnodeip' => $svcnodeip,
93 'vxlan-physdev' => $physdev,
94 autostart => 1
95 };
96
97 $config->{ifaces}->{vxlan2} = {
98 type => 'vxlan',
99 method => 'manual',
100 families => ['inet'],
101 'vxlan-id' => 2,
102 'vxlan-local-tunnelip' => $ip,
103 'bridge-learning' => 'off',
104 'bridge-arp-nd-suppress' => 'on',
105 'bridge-unicast-flood' => 'off',
106 'bridge-multicast-flood' => 'off',
107 autostart => 1
108 };
109
110 $config->{ifaces}->{vxlan3} = {
111 type => 'vxlan',
112 method => 'manual',
113 families => ['inet'],
114 'vxlan-id' => 3,
115 'vxlan-remoteip' => [$remoteip1, $remoteip2],
116 'bridge-access' => 3,
117 autostart => 1
118 };
119
120 $config->{ifaces}->{'vmbr1.100'} = {
121 type => 'vlan',
122 mtu => 1300,
123 method => 'manual',
124 families => ['inet'],
125 autostart => 1
126 };
127
128 $config->{ifaces}->{'bond0.100'} = {
129 type => 'vlan',
130 mtu => 1300,
131 method => 'manual',
132 families => ['inet'],
133 autostart => 1
134 };
135
136 $config->{ifaces}->{'eth1.100'} = {
137 type => 'vlan',
138 mtu => 1400,
139 method => 'manual',
140 families => ['inet'],
141 autostart => 1
142 };
143
144 expect load('loopback') . <<"CHECK";
145 source-directory interfaces.d
146
147 iface eth0 inet manual
148
149 auto eth1
150 iface eth1 inet static
151 address $ip
152 netmask $nm
153 gateway $gw
154
155 auto eth2
156 iface eth2 inet manual
157
158 auto eth3
159 iface eth3 inet manual
160
161 auto eth1.100
162 iface eth1.100 inet manual
163 mtu 1400
164
165 auto bond0
166 iface bond0 inet manual
167 bond-slaves eth2 eth3
168 bond-miimon 100
169 bond-mode 802.3ad
170 bond-xmit-hash-policy layer3+4
171 mtu 1400
172
173 auto bond0.100
174 iface bond0.100 inet manual
175 mtu 1300
176
177 auto vmbr0
178 iface vmbr0 inet static
179 address 10.0.0.2
180 netmask 255.255.255.0
181 gateway 10.0.0.1
182 bridge-ports eth0
183 bridge-stp off
184 bridge-fd 0
185
186 auto vmbr1
187 iface vmbr1 inet manual
188 bridge-ports vxlan1
189 bridge-stp off
190 bridge-fd 0
191 bridge-vlan-aware yes
192 bridge-vids 2-4094
193 mtu 1400
194
195 auto vmbr2
196 iface vmbr2 inet manual
197 bridge-ports vxlan2
198 bridge-stp off
199 bridge-fd 0
200
201 auto vmbr3
202 iface vmbr3 inet manual
203 bridge-ports vxlan3
204 bridge-stp off
205 bridge-fd 0
206 bridge-vlan-aware yes
207 bridge-vids 2-10
208
209 auto vmbr1.100
210 iface vmbr1.100 inet manual
211 mtu 1300
212
213 auto vxlan1
214 iface vxlan1 inet manual
215 vxlan-id 1
216 vxlan-svcnodeip $svcnodeip
217 vxlan-physdev $physdev
218
219 auto vxlan2
220 iface vxlan2 inet manual
221 vxlan-id 2
222 vxlan-local-tunnelip $ip
223 bridge-arp-nd-suppress on
224 bridge-learning off
225 bridge-multicast-flood off
226 bridge-unicast-flood off
227
228 auto vxlan3
229 iface vxlan3 inet manual
230 vxlan-id 3
231 vxlan-remoteip $remoteip1
232 vxlan-remoteip $remoteip2
233 bridge-access 3
234
235 CHECK
236
237 save('if', w());
238 r(load('if'));
239 expect load('if');
240
241 r(load('brbase'));
242
243 my $ip = 'fc05::2';
244 my $nm = '112';
245 my $gw = 'fc05::1';
246
247 $config->{ifaces}->{eth1} = {
248 type => 'eth',
249 method6 => 'static',
250 address6 => $ip,
251 netmask6 => $nm,
252 gateway6 => $gw,
253 families => ['inet6'],
254 autostart => 1
255 };
256
257
258 expect load('loopback') . <<"CHECK";
259 source-directory interfaces.d
260
261 iface eth0 inet manual
262
263 auto eth1
264 iface eth1 inet6 static
265 address $ip
266 netmask $nm
267 gateway $gw
268
269 auto vmbr0
270 iface vmbr0 inet static
271 address 10.0.0.2
272 netmask 255.255.255.0
273 gateway 10.0.0.1
274 bridge-ports eth0
275 bridge-stp off
276 bridge-fd 0
277
278 CHECK
279
280 save('if', w());
281 r(load('if'));
282 expect load('if');
283
284 1;