]>
git.proxmox.com Git - pve-common.git/blob - test/etc_network_interfaces/t.create_network.pl
1 save
('proc_net_dev', <<'/proc/net/dev');
13 # Variables used for the various interfaces:
16 my $ip = '192.168.0.2/24';
17 my $gw = '192.168.0.1';
18 my $svcnodeip = '239.192.105.237';
20 my $remoteip1 = '192.168.0.3';
21 my $remoteip2 = '192.168.0.4';
24 # Hunk for the default bridge of the 'brbase' configuration
27 my $vmbr0_part = <<"PART";
29 iface vmbr0 inet static
39 # Configure eth1 statically, store its expected interfaces hunk in $eth1_part
43 $config->{ifaces
}->{eth1
} = {
52 my $eth1_part = <<"PART";
54 iface eth1 inet static
60 expect load
('loopback') . <<"CHECK";
61 source-directory interfaces.d
63 iface eth0 inet manual
67 iface eth2 inet manual
69 iface eth3 inet manual
71 iface eth4 inet manual
73 iface eth5 inet manual
80 # Add a bond for eth2 & 3 and check the new output
83 $config->{ifaces
}->{bond0
} = {
86 slaves
=> 'eth2 eth3',
87 bond_mode
=> '802.3ad',
88 bond_xmit_hash_policy
=> 'layer3+4',
94 my $bond0_part = <<"PART";
96 iface bond0 inet manual
100 bond-xmit-hash-policy layer3+4
105 expect load
('loopback') . <<"CHECK";
106 source-directory interfaces.d
108 iface eth0 inet manual
113 iface eth2 inet manual
116 iface eth3 inet manual
118 iface eth4 inet manual
120 iface eth5 inet manual
132 $config->{ifaces
}->{vxlan1
} = {
135 families
=> ['inet'],
137 'vxlan-svcnodeip' => $svcnodeip,
138 'vxlan-physdev' => $physdev,
142 $config->{ifaces
}->{vxlan2
} = {
145 families
=> ['inet'],
147 'vxlan-local-tunnelip' => $ip,
151 my $vxlan12_part = <<"PART";
153 iface vxlan1 inet manual
155 vxlan-svcnodeip $svcnodeip
156 vxlan-physdev $physdev
159 iface vxlan2 inet manual
161 vxlan-local-tunnelip $ip
165 expect load
('loopback') . <<"CHECK";
166 source-directory interfaces.d
168 iface eth0 inet manual
173 iface eth2 inet manual
176 iface eth3 inet manual
178 iface eth4 inet manual
180 iface eth5 inet manual
191 # Add vxlan3 and 3 bridges using vxlan1..3
194 $config->{ifaces
}->{vmbr1
} = {
198 families
=> ['inet'],
201 bridge_ports
=> 'vxlan1',
202 bridge_vlan_aware
=> 'yes',
206 $config->{ifaces
}->{vmbr2
} = {
209 families
=> ['inet'],
212 bridge_ports
=> 'vxlan2',
216 $config->{ifaces
}->{vmbr3
} = {
219 families
=> ['inet'],
222 bridge_ports
=> 'vxlan3',
223 bridge_vlan_aware
=> 'yes',
224 bridge_vids
=> '2-10',
228 my $vmbr123_part = <<"PART";
230 iface vmbr1 inet manual
234 bridge-vlan-aware yes
239 iface vmbr2 inet manual
245 iface vmbr3 inet manual
249 bridge-vlan-aware yes
254 $config->{ifaces
}->{vxlan3
} = {
257 families
=> ['inet'],
259 'vxlan-remoteip' => [$remoteip1, $remoteip2],
260 'bridge-access' => 3,
264 my $vx = $config->{ifaces
}->{vxlan2
};
265 $vx->{'bridge-learning'} = 'off';
266 $vx->{'bridge-arp-nd-suppress'} = 'on';
267 $vx->{'bridge-unicast-flood'} = 'off';
268 $vx->{'bridge-multicast-flood'} = 'off';
269 my $vxlan123_part = $vxlan12_part ."\n" . <<"PART";
270 bridge-arp-nd-suppress on
272 bridge-multicast-flood off
273 bridge-unicast-flood off
276 iface vxlan3 inet manual
278 vxlan-remoteip $remoteip1
279 vxlan-remoteip $remoteip2
282 chomp $vxlan123_part;
284 expect load
('loopback') . <<"CHECK";
285 source-directory interfaces.d
287 iface eth0 inet manual
292 iface eth2 inet manual
295 iface eth3 inet manual
297 iface eth4 inet manual
299 iface eth5 inet manual
312 # Now add vlans on all types of interfaces: vmbr1, bond0 and eth1
315 $config->{ifaces
}->{'vmbr1.100'} = {
319 families
=> ['inet'],
323 $config->{ifaces
}->{'bond0.100'} = {
327 families
=> ['inet'],
328 'vlan-protocol' => '802.1ad',
332 $config->{ifaces
}->{'bond0.100.10'} = {
336 families
=> ['inet'],
340 $config->{ifaces
}->{'eth1.100'} = {
344 families
=> ['inet'],
348 $config->{ifaces
}->{'vmbr4'} = {
352 families
=> ['inet'],
355 bridge_ports
=> 'bond0.100',
359 $config->{ifaces
}->{'vmbr5'} = {
363 families
=> ['inet'],
366 bridge_ports
=> 'vmbr4.99',
370 $config->{ifaces
}->{vmbr6
} = {
373 ovs_ports
=> 'bond1 ovsintvlan',
375 families
=> ['inet'],
379 $config->{ifaces
}->{bond1
} = {
382 ovs_bridge
=> 'vmbr6',
383 ovs_bonds
=> 'eth4 eth5',
384 ovs_options
=> 'bond_mode=active-backup',
386 families
=> ['inet'],
390 $config->{ifaces
}->{ovsintvlan
} = {
392 type
=> 'OVSIntPort',
393 ovs_bridge
=> 'vmbr6',
394 ovs_options
=> 'tag=14',
396 families
=> ['inet'],
400 expect load
('loopback') . <<"CHECK";
401 source-directory interfaces.d
403 iface eth0 inet manual
408 iface eth2 inet manual
411 iface eth3 inet manual
414 iface eth4 inet manual
417 iface eth5 inet manual
420 iface eth1.100 inet manual
423 allow-vmbr6 ovsintvlan
424 iface ovsintvlan inet manual
433 iface bond1 inet manual
438 ovs_options bond_mode=active-backup
441 iface bond0.100 inet manual
443 vlan-protocol 802.1ad
446 iface bond0.100.10 inet manual
454 iface vmbr4 inet manual
455 bridge-ports bond0.100
461 iface vmbr5 inet manual
462 bridge-ports vmbr4.99
468 iface vmbr6 inet manual
470 ovs_ports bond1 ovsintvlan
474 iface vmbr1.100 inet manual
482 # Now check the new config for idempotency:
490 # Check a brbase with an ipv6 address on eth1
499 $config->{ifaces
}->{eth1
} = {
505 families
=> ['inet6'],
509 expect load
('loopback') . <<"CHECK";
510 source-directory interfaces.d
512 iface eth0 inet manual
515 iface eth1 inet6 static
519 iface eth2 inet manual
521 iface eth3 inet manual
523 iface eth4 inet manual
525 iface eth5 inet manual
528 iface vmbr0 inet static