]>
Commit | Line | Data |
---|---|---|
c7c4208a WB |
1 | save('proc_net_dev', <<'/proc/net/dev'); |
2 | eth0: | |
3 | eth1: | |
ec0f5151 WB |
4 | eth2: |
5 | eth3: | |
36bbe29d AD |
6 | eth4: |
7 | eth5: | |
c7c4208a WB |
8 | /proc/net/dev |
9 | ||
10 | r(load('brbase')); | |
11 | ||
ec0f5151 WB |
12 | # |
13 | # Variables used for the various interfaces: | |
14 | # | |
15 | ||
378c6656 | 16 | my $ip = '192.168.0.2/24'; |
c7c4208a | 17 | my $gw = '192.168.0.1'; |
95aa8788 AD |
18 | my $svcnodeip = '239.192.105.237'; |
19 | my $physdev = 'eth0'; | |
20 | my $remoteip1 = '192.168.0.3'; | |
21 | my $remoteip2 = '192.168.0.4'; | |
22 | ||
ec0f5151 WB |
23 | # |
24 | # Hunk for the default bridge of the 'brbase' configuration | |
25 | # | |
26 | ||
27 | my $vmbr0_part = <<"PART"; | |
28 | auto vmbr0 | |
29 | iface vmbr0 inet static | |
beedabb4 AD |
30 | address 10.0.0.2/24 |
31 | gateway 10.0.0.1 | |
ec0f5151 WB |
32 | bridge-ports eth0 |
33 | bridge-stp off | |
34 | bridge-fd 0 | |
35 | PART | |
36 | chomp $vmbr0_part; | |
37 | ||
38 | # | |
39 | # Configure eth1 statically, store its expected interfaces hunk in $eth1_part | |
40 | # and test! | |
41 | # | |
c7c4208a WB |
42 | |
43 | $config->{ifaces}->{eth1} = { | |
44 | type => 'eth', | |
45 | method => 'static', | |
46 | address => $ip, | |
c7c4208a WB |
47 | gateway => $gw, |
48 | families => ['inet'], | |
49 | autostart => 1 | |
50 | }; | |
51 | ||
ec0f5151 WB |
52 | my $eth1_part = <<"PART"; |
53 | auto eth1 | |
54 | iface eth1 inet static | |
beedabb4 AD |
55 | address $ip |
56 | gateway $gw | |
ec0f5151 WB |
57 | PART |
58 | chomp $eth1_part; | |
59 | ||
60 | expect load('loopback') . <<"CHECK"; | |
61 | source-directory interfaces.d | |
62 | ||
63 | iface eth0 inet manual | |
64 | ||
65 | $eth1_part | |
66 | ||
67 | iface eth2 inet manual | |
68 | ||
69 | iface eth3 inet manual | |
70 | ||
36bbe29d AD |
71 | iface eth4 inet manual |
72 | ||
73 | iface eth5 inet manual | |
74 | ||
ec0f5151 WB |
75 | $vmbr0_part |
76 | ||
77 | CHECK | |
78 | ||
79 | # | |
80 | # Add a bond for eth2 & 3 and check the new output | |
81 | # | |
82 | ||
83 | $config->{ifaces}->{bond0} = { | |
84 | type => 'bond', | |
85 | mtu => 1400, | |
86 | slaves => 'eth2 eth3', | |
87 | bond_mode => '802.3ad', | |
88 | bond_xmit_hash_policy => 'layer3+4', | |
89 | bond_miimon => 100, | |
0115696f AD |
90 | method => 'manual', |
91 | families => ['inet'], | |
92 | autostart => 1 | |
93 | }; | |
ec0f5151 WB |
94 | my $bond0_part = <<"PART"; |
95 | auto bond0 | |
96 | iface bond0 inet manual | |
97 | bond-slaves eth2 eth3 | |
98 | bond-miimon 100 | |
99 | bond-mode 802.3ad | |
100 | bond-xmit-hash-policy layer3+4 | |
101 | mtu 1400 | |
102 | PART | |
103 | chomp $bond0_part; | |
0115696f | 104 | |
ec0f5151 WB |
105 | expect load('loopback') . <<"CHECK"; |
106 | source-directory interfaces.d | |
107 | ||
108 | iface eth0 inet manual | |
109 | ||
110 | $eth1_part | |
111 | ||
112 | iface eth2 inet manual | |
113 | ||
114 | iface eth3 inet manual | |
115 | ||
36bbe29d AD |
116 | iface eth4 inet manual |
117 | ||
118 | iface eth5 inet manual | |
119 | ||
ec0f5151 WB |
120 | $bond0_part |
121 | ||
122 | $vmbr0_part | |
123 | ||
124 | CHECK | |
125 | ||
126 | # | |
127 | # Add vxlan1 and 2 | |
128 | # | |
129 | ||
130 | $config->{ifaces}->{vxlan1} = { | |
131 | type => 'vxlan', | |
0115696f AD |
132 | method => 'manual', |
133 | families => ['inet'], | |
ec0f5151 WB |
134 | 'vxlan-id' => 1, |
135 | 'vxlan-svcnodeip' => $svcnodeip, | |
136 | 'vxlan-physdev' => $physdev, | |
0115696f AD |
137 | autostart => 1 |
138 | }; | |
139 | ||
ec0f5151 WB |
140 | $config->{ifaces}->{vxlan2} = { |
141 | type => 'vxlan', | |
0115696f AD |
142 | method => 'manual', |
143 | families => ['inet'], | |
ec0f5151 WB |
144 | 'vxlan-id' => 2, |
145 | 'vxlan-local-tunnelip' => $ip, | |
0115696f AD |
146 | autostart => 1 |
147 | }; | |
148 | ||
ec0f5151 WB |
149 | my $vxlan12_part = <<"PART"; |
150 | auto vxlan1 | |
151 | iface vxlan1 inet manual | |
152 | vxlan-id 1 | |
153 | vxlan-svcnodeip $svcnodeip | |
154 | vxlan-physdev $physdev | |
155 | ||
156 | auto vxlan2 | |
157 | iface vxlan2 inet manual | |
158 | vxlan-id 2 | |
159 | vxlan-local-tunnelip $ip | |
160 | PART | |
161 | chomp $vxlan12_part; | |
162 | ||
163 | expect load('loopback') . <<"CHECK"; | |
164 | source-directory interfaces.d | |
165 | ||
166 | iface eth0 inet manual | |
167 | ||
168 | $eth1_part | |
169 | ||
170 | iface eth2 inet manual | |
171 | ||
172 | iface eth3 inet manual | |
173 | ||
36bbe29d AD |
174 | iface eth4 inet manual |
175 | ||
176 | iface eth5 inet manual | |
177 | ||
ec0f5151 WB |
178 | $bond0_part |
179 | ||
180 | $vmbr0_part | |
181 | ||
182 | $vxlan12_part | |
183 | ||
184 | CHECK | |
185 | ||
186 | # | |
187 | # Add vxlan3 and 3 bridges using vxlan1..3 | |
188 | # | |
189 | ||
9a052564 | 190 | $config->{ifaces}->{vmbr1} = { |
9b053d70 | 191 | mtu => 1400, |
9a052564 AD |
192 | type => 'bridge', |
193 | method => 'manual', | |
194 | families => ['inet'], | |
ec0f5151 | 195 | bridge_stp => 'off', |
9a052564 | 196 | bridge_fd => 0, |
ec0f5151 WB |
197 | bridge_ports => 'vxlan1', |
198 | bridge_vlan_aware => 'yes', | |
9a052564 AD |
199 | autostart => 1 |
200 | }; | |
201 | ||
9a052564 AD |
202 | $config->{ifaces}->{vmbr2} = { |
203 | type => 'bridge', | |
204 | method => 'manual', | |
205 | families => ['inet'], | |
ec0f5151 | 206 | bridge_stp => 'off', |
9a052564 | 207 | bridge_fd => 0, |
ec0f5151 | 208 | bridge_ports => 'vxlan2', |
9a052564 AD |
209 | autostart => 1 |
210 | }; | |
211 | ||
212 | $config->{ifaces}->{vmbr3} = { | |
213 | type => 'bridge', | |
214 | method => 'manual', | |
215 | families => ['inet'], | |
ec0f5151 | 216 | bridge_stp => 'off', |
9a052564 | 217 | bridge_fd => 0, |
a70e9925 | 218 | bridge_ports => 'vxlan3', |
ec0f5151 | 219 | bridge_vlan_aware => 'yes', |
9a052564 AD |
220 | bridge_vids => '2-10', |
221 | autostart => 1 | |
222 | }; | |
223 | ||
ec0f5151 WB |
224 | my $vmbr123_part = <<"PART"; |
225 | auto vmbr1 | |
226 | iface vmbr1 inet manual | |
227 | bridge-ports vxlan1 | |
228 | bridge-stp off | |
229 | bridge-fd 0 | |
230 | bridge-vlan-aware yes | |
231 | bridge-vids 2-4094 | |
232 | mtu 1400 | |
95aa8788 | 233 | |
ec0f5151 WB |
234 | auto vmbr2 |
235 | iface vmbr2 inet manual | |
236 | bridge-ports vxlan2 | |
237 | bridge-stp off | |
238 | bridge-fd 0 | |
239 | ||
240 | auto vmbr3 | |
241 | iface vmbr3 inet manual | |
a70e9925 | 242 | bridge-ports vxlan3 |
ec0f5151 WB |
243 | bridge-stp off |
244 | bridge-fd 0 | |
245 | bridge-vlan-aware yes | |
246 | bridge-vids 2-10 | |
247 | PART | |
248 | chomp $vmbr123_part; | |
95aa8788 AD |
249 | |
250 | $config->{ifaces}->{vxlan3} = { | |
251 | type => 'vxlan', | |
252 | method => 'manual', | |
253 | families => ['inet'], | |
254 | 'vxlan-id' => 3, | |
255 | 'vxlan-remoteip' => [$remoteip1, $remoteip2], | |
9a052564 | 256 | 'bridge-access' => 3, |
95aa8788 AD |
257 | autostart => 1 |
258 | }; | |
259 | ||
ec0f5151 WB |
260 | my $vx = $config->{ifaces}->{vxlan2}; |
261 | $vx->{'bridge-learning'} = 'off'; | |
262 | $vx->{'bridge-arp-nd-suppress'} = 'on'; | |
263 | $vx->{'bridge-unicast-flood'} = 'off'; | |
264 | $vx->{'bridge-multicast-flood'} = 'off'; | |
265 | my $vxlan123_part = $vxlan12_part ."\n" . <<"PART"; | |
266 | bridge-arp-nd-suppress on | |
267 | bridge-learning off | |
268 | bridge-multicast-flood off | |
269 | bridge-unicast-flood off | |
270 | ||
271 | auto vxlan3 | |
272 | iface vxlan3 inet manual | |
273 | vxlan-id 3 | |
274 | vxlan-remoteip $remoteip1 | |
275 | vxlan-remoteip $remoteip2 | |
276 | bridge-access 3 | |
277 | PART | |
278 | chomp $vxlan123_part; | |
279 | ||
280 | expect load('loopback') . <<"CHECK"; | |
281 | source-directory interfaces.d | |
282 | ||
283 | iface eth0 inet manual | |
284 | ||
285 | $eth1_part | |
286 | ||
287 | iface eth2 inet manual | |
288 | ||
289 | iface eth3 inet manual | |
290 | ||
36bbe29d AD |
291 | iface eth4 inet manual |
292 | ||
293 | iface eth5 inet manual | |
294 | ||
ec0f5151 WB |
295 | $bond0_part |
296 | ||
297 | $vmbr0_part | |
298 | ||
299 | $vmbr123_part | |
300 | ||
301 | $vxlan123_part | |
302 | ||
303 | CHECK | |
304 | ||
305 | # | |
306 | # Now add vlans on all types of interfaces: vmbr1, bond0 and eth1 | |
307 | # | |
308 | ||
c4e56470 AD |
309 | $config->{ifaces}->{'vmbr1.100'} = { |
310 | type => 'vlan', | |
9b053d70 | 311 | mtu => 1300, |
c4e56470 AD |
312 | method => 'manual', |
313 | families => ['inet'], | |
314 | autostart => 1 | |
315 | }; | |
316 | ||
317 | $config->{ifaces}->{'bond0.100'} = { | |
8f5d56bf AD |
318 | type => 'vlan', |
319 | mtu => 1300, | |
320 | method => 'manual', | |
321 | families => ['inet'], | |
322 | 'vlan-protocol' => '802.1ad', | |
323 | autostart => 1 | |
324 | }; | |
325 | ||
326 | $config->{ifaces}->{'bond0.100.10'} = { | |
c4e56470 | 327 | type => 'vlan', |
9b053d70 | 328 | mtu => 1300, |
c4e56470 AD |
329 | method => 'manual', |
330 | families => ['inet'], | |
331 | autostart => 1 | |
332 | }; | |
333 | ||
334 | $config->{ifaces}->{'eth1.100'} = { | |
335 | type => 'vlan', | |
9b053d70 | 336 | mtu => 1400, |
c4e56470 AD |
337 | method => 'manual', |
338 | families => ['inet'], | |
339 | autostart => 1 | |
340 | }; | |
95aa8788 | 341 | |
968c90f1 AD |
342 | $config->{ifaces}->{'vmbr4'} = { |
343 | mtu => 1200, | |
344 | type => 'bridge', | |
345 | method => 'manual', | |
346 | families => ['inet'], | |
347 | bridge_stp => 'off', | |
348 | bridge_fd => 0, | |
349 | bridge_ports => 'bond0.100', | |
350 | autostart => 1 | |
351 | }; | |
352 | ||
a70e9925 AD |
353 | $config->{ifaces}->{'vmbr5'} = { |
354 | mtu => 1100, | |
355 | type => 'bridge', | |
356 | method => 'manual', | |
357 | families => ['inet'], | |
358 | bridge_stp => 'off', | |
359 | bridge_fd => 0, | |
360 | bridge_ports => 'vmbr4.99', | |
361 | autostart => 1 | |
362 | }; | |
363 | ||
36bbe29d AD |
364 | $config->{ifaces}->{vmbr6} = { |
365 | ovs_mtu => 1400, | |
366 | type => 'OVSBridge', | |
367 | ovs_ports => 'bond1 ovsintvlan', | |
368 | method => 'manual', | |
369 | families => ['inet'], | |
370 | autostart => 1 | |
371 | }; | |
372 | ||
373 | $config->{ifaces}->{bond1} = { | |
374 | ovs_mtu => 1300, | |
375 | type => 'OVSBond', | |
376 | ovs_bridge => 'vmbr6', | |
377 | ovs_bonds => 'eth4 eth5', | |
378 | ovs_options => 'bond_mode=active-backup', | |
379 | method => 'manual', | |
380 | families => ['inet'], | |
381 | autostart => 1 | |
382 | }; | |
383 | ||
384 | $config->{ifaces}->{ovsintvlan} = { | |
385 | ovs_mtu => 1300, | |
386 | type => 'OVSIntPort', | |
387 | ovs_bridge => 'vmbr6', | |
388 | ovs_options => 'tag=14', | |
389 | method => 'manual', | |
390 | families => ['inet'], | |
391 | autostart => 1 | |
392 | }; | |
393 | ||
c7c4208a WB |
394 | expect load('loopback') . <<"CHECK"; |
395 | source-directory interfaces.d | |
396 | ||
397 | iface eth0 inet manual | |
398 | ||
ec0f5151 | 399 | $eth1_part |
c7c4208a | 400 | |
0115696f AD |
401 | iface eth2 inet manual |
402 | ||
0115696f AD |
403 | iface eth3 inet manual |
404 | ||
36bbe29d AD |
405 | iface eth4 inet manual |
406 | ||
407 | iface eth5 inet manual | |
408 | ||
c4e56470 AD |
409 | auto eth1.100 |
410 | iface eth1.100 inet manual | |
9b053d70 | 411 | mtu 1400 |
c4e56470 | 412 | |
36bbe29d AD |
413 | allow-vmbr6 ovsintvlan |
414 | iface ovsintvlan inet manual | |
415 | ovs_type OVSIntPort | |
416 | ovs_bridge vmbr6 | |
417 | ovs_mtu 1300 | |
418 | ovs_options tag=14 | |
419 | ||
ec0f5151 | 420 | $bond0_part |
0115696f | 421 | |
36bbe29d AD |
422 | allow-vmbr6 bond1 |
423 | iface bond1 inet manual | |
424 | ovs_bonds eth4 eth5 | |
425 | ovs_type OVSBond | |
426 | ovs_bridge vmbr6 | |
427 | ovs_mtu 1300 | |
428 | ovs_options bond_mode=active-backup | |
429 | ||
c4e56470 AD |
430 | auto bond0.100 |
431 | iface bond0.100 inet manual | |
9b053d70 | 432 | mtu 1300 |
8f5d56bf AD |
433 | vlan-protocol 802.1ad |
434 | ||
435 | auto bond0.100.10 | |
436 | iface bond0.100.10 inet manual | |
437 | mtu 1300 | |
c4e56470 | 438 | |
ec0f5151 | 439 | $vmbr0_part |
9a052564 | 440 | |
ec0f5151 | 441 | $vmbr123_part |
9a052564 | 442 | |
968c90f1 AD |
443 | auto vmbr4 |
444 | iface vmbr4 inet manual | |
445 | bridge-ports bond0.100 | |
446 | bridge-stp off | |
447 | bridge-fd 0 | |
448 | mtu 1200 | |
449 | ||
a70e9925 AD |
450 | auto vmbr5 |
451 | iface vmbr5 inet manual | |
452 | bridge-ports vmbr4.99 | |
453 | bridge-stp off | |
454 | bridge-fd 0 | |
455 | mtu 1100 | |
456 | ||
36bbe29d AD |
457 | allow-ovs vmbr6 |
458 | iface vmbr6 inet manual | |
459 | ovs_type OVSBridge | |
460 | ovs_ports bond1 ovsintvlan | |
461 | ovs_mtu 1400 | |
462 | ||
c4e56470 AD |
463 | auto vmbr1.100 |
464 | iface vmbr1.100 inet manual | |
9b053d70 | 465 | mtu 1300 |
c4e56470 | 466 | |
ec0f5151 | 467 | $vxlan123_part |
95aa8788 | 468 | |
c7c4208a WB |
469 | CHECK |
470 | ||
ec0f5151 WB |
471 | # |
472 | # Now check the new config for idempotency: | |
473 | # | |
474 | ||
c7c4208a WB |
475 | save('if', w()); |
476 | r(load('if')); | |
477 | expect load('if'); | |
478 | ||
ec0f5151 WB |
479 | # |
480 | # Check a brbase with an ipv6 address on eth1 | |
481 | # | |
482 | ||
c7c4208a WB |
483 | r(load('brbase')); |
484 | ||
485 | my $ip = 'fc05::2'; | |
486 | my $nm = '112'; | |
487 | my $gw = 'fc05::1'; | |
488 | ||
489 | $config->{ifaces}->{eth1} = { | |
490 | type => 'eth', | |
491 | method6 => 'static', | |
492 | address6 => $ip, | |
493 | netmask6 => $nm, | |
494 | gateway6 => $gw, | |
495 | families => ['inet6'], | |
496 | autostart => 1 | |
497 | }; | |
498 | ||
c7c4208a WB |
499 | expect load('loopback') . <<"CHECK"; |
500 | source-directory interfaces.d | |
501 | ||
502 | iface eth0 inet manual | |
503 | ||
504 | auto eth1 | |
505 | iface eth1 inet6 static | |
f6c9d9a4 | 506 | address $ip/$nm |
beedabb4 | 507 | gateway $gw |
c7c4208a | 508 | |
ec0f5151 WB |
509 | iface eth2 inet manual |
510 | ||
511 | iface eth3 inet manual | |
512 | ||
36bbe29d AD |
513 | iface eth4 inet manual |
514 | ||
515 | iface eth5 inet manual | |
516 | ||
c7c4208a WB |
517 | auto vmbr0 |
518 | iface vmbr0 inet static | |
beedabb4 AD |
519 | address 10.0.0.2/24 |
520 | gateway 10.0.0.1 | |
1accc6da AD |
521 | bridge-ports eth0 |
522 | bridge-stp off | |
523 | bridge-fd 0 | |
c7c4208a WB |
524 | |
525 | CHECK | |
526 | ||
527 | save('if', w()); | |
528 | r(load('if')); | |
529 | expect load('if'); | |
530 | ||
531 | 1; |