]>
git.proxmox.com Git - pve-common.git/blob - test/etc_network_interfaces/t.create_network.pl
e446f536b56001d9c801ce5be8b9b2024dbbea6d
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'],
311 $config->{ifaces
}->{'eth1.100'} = {
315 families
=> ['inet'],
319 expect load
('loopback') . <<"CHECK";
320 source-directory interfaces.d
322 iface eth0 inet manual
326 iface eth2 inet manual
328 iface eth3 inet manual
331 iface eth1.100 inet manual
337 iface bond0.100 inet manual
345 iface vmbr1.100 inet manual
353 # Now check the new config for idempotency:
361 # Check a brbase with an ipv6 address on eth1
370 $config->{ifaces
}->{eth1
} = {
376 families
=> ['inet6'],
380 expect load
('loopback') . <<"CHECK";
381 source-directory interfaces.d
383 iface eth0 inet manual
386 iface eth1 inet6 static
391 iface eth2 inet manual
393 iface eth3 inet manual
396 iface vmbr0 inet static
398 netmask 255.255.255.0