]>
git.proxmox.com Git - pve-common.git/blob - test/etc_network_interfaces/t.create_network.pl
1 save
('proc_net_dev', <<'/proc/net/dev');
11 # Variables used for the various interfaces:
14 my $ip = '192.168.0.2';
15 my $nm = '255.255.255.0';
16 my $gw = '192.168.0.1';
17 my $svcnodeip = '239.192.105.237';
19 my $remoteip1 = '192.168.0.3';
20 my $remoteip2 = '192.168.0.4';
23 # Hunk for the default bridge of the 'brbase' configuration
26 my $vmbr0_part = <<"PART";
28 iface vmbr0 inet static
39 # Configure eth1 statically, store its expected interfaces hunk in $eth1_part
43 $config->{ifaces
}->{eth1
} = {
53 my $eth1_part = <<"PART";
55 iface eth1 inet static
62 expect load
('loopback') . <<"CHECK";
63 source-directory interfaces.d
65 iface eth0 inet manual
69 iface eth2 inet manual
71 iface eth3 inet manual
78 # Add a bond for eth2 & 3 and check the new output
81 $config->{ifaces
}->{bond0
} = {
84 slaves
=> 'eth2 eth3',
85 bond_mode
=> '802.3ad',
86 bond_xmit_hash_policy
=> 'layer3+4',
92 my $bond0_part = <<"PART";
94 iface bond0 inet manual
98 bond-xmit-hash-policy layer3+4
103 expect load
('loopback') . <<"CHECK";
104 source-directory interfaces.d
106 iface eth0 inet manual
110 iface eth2 inet manual
112 iface eth3 inet manual
124 $config->{ifaces
}->{vxlan1
} = {
127 families
=> ['inet'],
129 'vxlan-svcnodeip' => $svcnodeip,
130 'vxlan-physdev' => $physdev,
134 $config->{ifaces
}->{vxlan2
} = {
137 families
=> ['inet'],
139 'vxlan-local-tunnelip' => $ip,
143 my $vxlan12_part = <<"PART";
145 iface vxlan1 inet manual
147 vxlan-svcnodeip $svcnodeip
148 vxlan-physdev $physdev
151 iface vxlan2 inet manual
153 vxlan-local-tunnelip $ip
157 expect load
('loopback') . <<"CHECK";
158 source-directory interfaces.d
160 iface eth0 inet manual
164 iface eth2 inet manual
166 iface eth3 inet manual
177 # Add vxlan3 and 3 bridges using vxlan1..3
180 $config->{ifaces
}->{vmbr1
} = {
184 families
=> ['inet'],
187 bridge_ports
=> 'vxlan1',
188 bridge_vlan_aware
=> 'yes',
192 $config->{ifaces
}->{vmbr2
} = {
195 families
=> ['inet'],
198 bridge_ports
=> 'vxlan2',
202 $config->{ifaces
}->{vmbr3
} = {
205 families
=> ['inet'],
208 bridge_ports
=> 'vxlan3.50',
209 bridge_vlan_aware
=> 'yes',
210 bridge_vids
=> '2-10',
214 my $vmbr123_part = <<"PART";
216 iface vmbr1 inet manual
220 bridge-vlan-aware yes
225 iface vmbr2 inet manual
231 iface vmbr3 inet manual
232 bridge-ports vxlan3.50
235 bridge-vlan-aware yes
240 $config->{ifaces
}->{vxlan3
} = {
243 families
=> ['inet'],
245 'vxlan-remoteip' => [$remoteip1, $remoteip2],
246 'bridge-access' => 3,
250 my $vx = $config->{ifaces
}->{vxlan2
};
251 $vx->{'bridge-learning'} = 'off';
252 $vx->{'bridge-arp-nd-suppress'} = 'on';
253 $vx->{'bridge-unicast-flood'} = 'off';
254 $vx->{'bridge-multicast-flood'} = 'off';
255 my $vxlan123_part = $vxlan12_part ."\n" . <<"PART";
256 bridge-arp-nd-suppress on
258 bridge-multicast-flood off
259 bridge-unicast-flood off
262 iface vxlan3 inet manual
264 vxlan-remoteip $remoteip1
265 vxlan-remoteip $remoteip2
268 chomp $vxlan123_part;
270 expect load
('loopback') . <<"CHECK";
271 source-directory interfaces.d
273 iface eth0 inet manual
277 iface eth2 inet manual
279 iface eth3 inet manual
292 # Now add vlans on all types of interfaces: vmbr1, bond0 and eth1
295 $config->{ifaces
}->{'vmbr1.100'} = {
299 families
=> ['inet'],
303 $config->{ifaces
}->{'bond0.100'} = {
307 families
=> ['inet'],
308 'vlan-protocol' => '802.1ad',
312 $config->{ifaces
}->{'bond0.100.10'} = {
316 families
=> ['inet'],
320 $config->{ifaces
}->{'eth1.100'} = {
324 families
=> ['inet'],
328 expect load
('loopback') . <<"CHECK";
329 source-directory interfaces.d
331 iface eth0 inet manual
335 iface eth2 inet manual
337 iface eth3 inet manual
340 iface eth1.100 inet manual
346 iface bond0.100 inet manual
348 vlan-protocol 802.1ad
351 iface bond0.100.10 inet manual
359 iface vmbr1.100 inet manual
367 # Now check the new config for idempotency:
375 # Check a brbase with an ipv6 address on eth1
384 $config->{ifaces
}->{eth1
} = {
390 families
=> ['inet6'],
394 expect load
('loopback') . <<"CHECK";
395 source-directory interfaces.d
397 iface eth0 inet manual
400 iface eth1 inet6 static
405 iface eth2 inet manual
407 iface eth3 inet manual
410 iface vmbr0 inet static
412 netmask 255.255.255.0