]>
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/24';
15 my $gw = '192.168.0.1';
16 my $svcnodeip = '239.192.105.237';
18 my $remoteip1 = '192.168.0.3';
19 my $remoteip2 = '192.168.0.4';
22 # Hunk for the default bridge of the 'brbase' configuration
25 my $vmbr0_part = <<"PART";
27 iface vmbr0 inet static
37 # Configure eth1 statically, store its expected interfaces hunk in $eth1_part
41 $config->{ifaces
}->{eth1
} = {
50 my $eth1_part = <<"PART";
52 iface eth1 inet static
58 expect load
('loopback') . <<"CHECK";
59 source-directory interfaces.d
61 iface eth0 inet manual
65 iface eth2 inet manual
67 iface eth3 inet manual
74 # Add a bond for eth2 & 3 and check the new output
77 $config->{ifaces
}->{bond0
} = {
80 slaves
=> 'eth2 eth3',
81 bond_mode
=> '802.3ad',
82 bond_xmit_hash_policy
=> 'layer3+4',
88 my $bond0_part = <<"PART";
90 iface bond0 inet manual
94 bond-xmit-hash-policy layer3+4
99 expect load
('loopback') . <<"CHECK";
100 source-directory interfaces.d
102 iface eth0 inet manual
106 iface eth2 inet manual
108 iface eth3 inet manual
120 $config->{ifaces
}->{vxlan1
} = {
123 families
=> ['inet'],
125 'vxlan-svcnodeip' => $svcnodeip,
126 'vxlan-physdev' => $physdev,
130 $config->{ifaces
}->{vxlan2
} = {
133 families
=> ['inet'],
135 'vxlan-local-tunnelip' => $ip,
139 my $vxlan12_part = <<"PART";
141 iface vxlan1 inet manual
143 vxlan-svcnodeip $svcnodeip
144 vxlan-physdev $physdev
147 iface vxlan2 inet manual
149 vxlan-local-tunnelip $ip
153 expect load
('loopback') . <<"CHECK";
154 source-directory interfaces.d
156 iface eth0 inet manual
160 iface eth2 inet manual
162 iface eth3 inet manual
173 # Add vxlan3 and 3 bridges using vxlan1..3
176 $config->{ifaces
}->{vmbr1
} = {
180 families
=> ['inet'],
183 bridge_ports
=> 'vxlan1',
184 bridge_vlan_aware
=> 'yes',
188 $config->{ifaces
}->{vmbr2
} = {
191 families
=> ['inet'],
194 bridge_ports
=> 'vxlan2',
198 $config->{ifaces
}->{vmbr3
} = {
201 families
=> ['inet'],
204 bridge_ports
=> 'vxlan3',
205 bridge_vlan_aware
=> 'yes',
206 bridge_vids
=> '2-10',
210 my $vmbr123_part = <<"PART";
212 iface vmbr1 inet manual
216 bridge-vlan-aware yes
221 iface vmbr2 inet manual
227 iface vmbr3 inet manual
231 bridge-vlan-aware yes
236 $config->{ifaces
}->{vxlan3
} = {
239 families
=> ['inet'],
241 'vxlan-remoteip' => [$remoteip1, $remoteip2],
242 'bridge-access' => 3,
246 my $vx = $config->{ifaces
}->{vxlan2
};
247 $vx->{'bridge-learning'} = 'off';
248 $vx->{'bridge-arp-nd-suppress'} = 'on';
249 $vx->{'bridge-unicast-flood'} = 'off';
250 $vx->{'bridge-multicast-flood'} = 'off';
251 my $vxlan123_part = $vxlan12_part ."\n" . <<"PART";
252 bridge-arp-nd-suppress on
254 bridge-multicast-flood off
255 bridge-unicast-flood off
258 iface vxlan3 inet manual
260 vxlan-remoteip $remoteip1
261 vxlan-remoteip $remoteip2
264 chomp $vxlan123_part;
266 expect load
('loopback') . <<"CHECK";
267 source-directory interfaces.d
269 iface eth0 inet manual
273 iface eth2 inet manual
275 iface eth3 inet manual
288 # Now add vlans on all types of interfaces: vmbr1, bond0 and eth1
291 $config->{ifaces
}->{'vmbr1.100'} = {
295 families
=> ['inet'],
299 $config->{ifaces
}->{'bond0.100'} = {
303 families
=> ['inet'],
304 'vlan-protocol' => '802.1ad',
308 $config->{ifaces
}->{'bond0.100.10'} = {
312 families
=> ['inet'],
316 $config->{ifaces
}->{'eth1.100'} = {
320 families
=> ['inet'],
324 $config->{ifaces
}->{'vmbr4'} = {
328 families
=> ['inet'],
331 bridge_ports
=> 'bond0.100',
335 $config->{ifaces
}->{'vmbr5'} = {
339 families
=> ['inet'],
342 bridge_ports
=> 'vmbr4.99',
346 expect load
('loopback') . <<"CHECK";
347 source-directory interfaces.d
349 iface eth0 inet manual
353 iface eth2 inet manual
355 iface eth3 inet manual
358 iface eth1.100 inet manual
364 iface bond0.100 inet manual
366 vlan-protocol 802.1ad
369 iface bond0.100.10 inet manual
377 iface vmbr4 inet manual
378 bridge-ports bond0.100
384 iface vmbr5 inet manual
385 bridge-ports vmbr4.99
391 iface vmbr1.100 inet manual
399 # Now check the new config for idempotency:
407 # Check a brbase with an ipv6 address on eth1
416 $config->{ifaces
}->{eth1
} = {
422 families
=> ['inet6'],
426 expect load
('loopback') . <<"CHECK";
427 source-directory interfaces.d
429 iface eth0 inet manual
432 iface eth1 inet6 static
436 iface eth2 inet manual
438 iface eth3 inet manual
441 iface vmbr0 inet static