]>
git.proxmox.com Git - pve-common.git/blob - test/etc_network_interfaces/t.create_network.pl
9bb26bd2fc04f904758c572678d4c17cda77c1b9
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
112 iface eth2 inet manual
114 iface eth3 inet manual
116 iface eth4 inet manual
118 iface eth5 inet manual
130 $config->{ifaces
}->{vxlan1
} = {
133 families
=> ['inet'],
135 'vxlan-svcnodeip' => $svcnodeip,
136 'vxlan-physdev' => $physdev,
140 $config->{ifaces
}->{vxlan2
} = {
143 families
=> ['inet'],
145 'vxlan-local-tunnelip' => $ip,
149 my $vxlan12_part = <<"PART";
151 iface vxlan1 inet manual
153 vxlan-svcnodeip $svcnodeip
154 vxlan-physdev $physdev
157 iface vxlan2 inet manual
159 vxlan-local-tunnelip $ip
163 expect load
('loopback') . <<"CHECK";
164 source-directory interfaces.d
166 iface eth0 inet manual
170 iface eth2 inet manual
172 iface eth3 inet manual
174 iface eth4 inet manual
176 iface eth5 inet manual
187 # Add vxlan3 and 3 bridges using vxlan1..3
190 $config->{ifaces
}->{vmbr1
} = {
194 families
=> ['inet'],
197 bridge_ports
=> 'vxlan1',
198 bridge_vlan_aware
=> 'yes',
202 $config->{ifaces
}->{vmbr2
} = {
205 families
=> ['inet'],
208 bridge_ports
=> 'vxlan2',
212 $config->{ifaces
}->{vmbr3
} = {
215 families
=> ['inet'],
218 bridge_ports
=> 'vxlan3',
219 bridge_vlan_aware
=> 'yes',
220 bridge_vids
=> '2-10',
224 my $vmbr123_part = <<"PART";
226 iface vmbr1 inet manual
230 bridge-vlan-aware yes
235 iface vmbr2 inet manual
241 iface vmbr3 inet manual
245 bridge-vlan-aware yes
250 $config->{ifaces
}->{vxlan3
} = {
253 families
=> ['inet'],
255 'vxlan-remoteip' => [$remoteip1, $remoteip2],
256 'bridge-access' => 3,
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
268 bridge-multicast-flood off
269 bridge-unicast-flood off
272 iface vxlan3 inet manual
274 vxlan-remoteip $remoteip1
275 vxlan-remoteip $remoteip2
278 chomp $vxlan123_part;
280 expect load
('loopback') . <<"CHECK";
281 source-directory interfaces.d
283 iface eth0 inet manual
287 iface eth2 inet manual
289 iface eth3 inet manual
291 iface eth4 inet manual
293 iface eth5 inet manual
306 # Now add vlans on all types of interfaces: vmbr1, bond0 and eth1
309 $config->{ifaces
}->{'vmbr1.100'} = {
313 families
=> ['inet'],
317 $config->{ifaces
}->{'bond0.100'} = {
321 families
=> ['inet'],
322 'vlan-protocol' => '802.1ad',
326 $config->{ifaces
}->{'bond0.100.10'} = {
330 families
=> ['inet'],
334 $config->{ifaces
}->{'eth1.100'} = {
338 families
=> ['inet'],
342 $config->{ifaces
}->{'vmbr4'} = {
346 families
=> ['inet'],
349 bridge_ports
=> 'bond0.100',
353 $config->{ifaces
}->{'vmbr5'} = {
357 families
=> ['inet'],
360 bridge_ports
=> 'vmbr4.99',
364 $config->{ifaces
}->{vmbr6
} = {
367 ovs_ports
=> 'bond1 ovsintvlan',
369 families
=> ['inet'],
373 $config->{ifaces
}->{bond1
} = {
376 ovs_bridge
=> 'vmbr6',
377 ovs_bonds
=> 'eth4 eth5',
378 ovs_options
=> 'bond_mode=active-backup',
380 families
=> ['inet'],
384 $config->{ifaces
}->{ovsintvlan
} = {
386 type
=> 'OVSIntPort',
387 ovs_bridge
=> 'vmbr6',
388 ovs_options
=> 'tag=14',
390 families
=> ['inet'],
394 expect load
('loopback') . <<"CHECK";
395 source-directory interfaces.d
397 iface eth0 inet manual
401 iface eth2 inet manual
403 iface eth3 inet manual
405 iface eth4 inet manual
407 iface eth5 inet manual
410 iface eth1.100 inet manual
413 allow-vmbr6 ovsintvlan
414 iface ovsintvlan inet manual
423 iface bond1 inet manual
428 ovs_options bond_mode=active-backup
431 iface bond0.100 inet manual
433 vlan-protocol 802.1ad
436 iface bond0.100.10 inet manual
444 iface vmbr4 inet manual
445 bridge-ports bond0.100
451 iface vmbr5 inet manual
452 bridge-ports vmbr4.99
458 iface vmbr6 inet manual
460 ovs_ports bond1 ovsintvlan
464 iface vmbr1.100 inet manual
472 # Now check the new config for idempotency:
480 # Check a brbase with an ipv6 address on eth1
489 $config->{ifaces
}->{eth1
} = {
495 families
=> ['inet6'],
499 expect load
('loopback') . <<"CHECK";
500 source-directory interfaces.d
502 iface eth0 inet manual
505 iface eth1 inet6 static
509 iface eth2 inet manual
511 iface eth3 inet manual
513 iface eth4 inet manual
515 iface eth5 inet manual
518 iface vmbr0 inet static