]> git.proxmox.com Git - pve-common.git/blame - test/etc_network_interfaces/t.ovs_bridge_allow.pl
bump version to 8.2.1
[pve-common.git] / test / etc_network_interfaces / t.ovs_bridge_allow.pl
CommitLineData
936218b8
WB
1use strict;
2
378c6656 3my $ip = '192.168.0.100/24';
936218b8
WB
4my $gw = '192.168.0.1';
5
6# replace proc_net_dev with one with a bunch of interfaces
7save('proc_net_dev', <<'/proc/net/dev');
8eth0:
9eth1:
10eth2:
11eth3:
12/proc/net/dev
13
14r('');
15
16new_iface('vmbr0', 'OVSBridge',
17 [ { family => 'inet',
18 address => $ip,
936218b8
WB
19 gateway => $gw } ],
20 autostart => 1);
21
22update_iface('eth0', [], autostart => 1);
23update_iface('eth1', [], autostart => 1);
24update_iface('eth2', [], autostart => 1);
25#update_iface('eth3', [], autostart => 1);
26
27# Check the bridge and eth interfaces
28expect load('loopback') . <<"/etc/network/interfaces";
29auto eth0
30iface eth0 inet manual
31
32auto eth1
33iface eth1 inet manual
34
35auto eth2
36iface eth2 inet manual
37
38iface eth3 inet manual
39
e8c1bbfc 40auto vmbr0
936218b8 41iface vmbr0 inet static
beedabb4
AD
42 address $ip
43 gateway $gw
936218b8
WB
44 ovs_type OVSBridge
45
46/etc/network/interfaces
47
21d32c95
WB
48# Adding an interface to the bridge needs to add allow- lines and remove
49# its autostart property.
936218b8
WB
50update_iface('vmbr0', [], ovs_ports => 'eth1 eth2');
51expect load('loopback') . <<"/etc/network/interfaces";
52auto eth0
53iface eth0 inet manual
54
e8c1bbfc 55auto eth1
936218b8
WB
56iface eth1 inet manual
57 ovs_type OVSPort
58 ovs_bridge vmbr0
59
e8c1bbfc 60auto eth2
936218b8
WB
61iface eth2 inet manual
62 ovs_type OVSPort
63 ovs_bridge vmbr0
64
65iface eth3 inet manual
66
e8c1bbfc 67auto vmbr0
936218b8 68iface vmbr0 inet static
beedabb4
AD
69 address $ip
70 gateway $gw
936218b8
WB
71 ovs_type OVSBridge
72 ovs_ports eth1 eth2
73
74/etc/network/interfaces
75
76# Idempotency - make sure "allow-$BRIDGE $IFACE" don't get duplicated
77# they're stripped from $config->{options} at load-time since they're
78# auto-generated when writing OVSPorts.
79save('idem', w());
80r(load('idem'));
81expect load('idem');
82
83# Removing an ovs_port also has to remove the corresponding allow- line!
84# Also remember that adding interfaces to the ovs bridge removed their
85# autostart property, so eth2 is now without an autostart!
86update_iface('vmbr0', [], ovs_ports => 'eth1');
87# eth2 is now autoremoved and thus loses its priority, so it appears after eth3
88expect load('loopback') . <<"/etc/network/interfaces";
89auto eth0
90iface eth0 inet manual
91
e8c1bbfc 92auto eth1
936218b8
WB
93iface eth1 inet manual
94 ovs_type OVSPort
95 ovs_bridge vmbr0
96
97iface eth3 inet manual
98
99iface eth2 inet manual
100
e8c1bbfc 101auto vmbr0
936218b8 102iface vmbr0 inet static
beedabb4
AD
103 address $ip
104 gateway $gw
936218b8
WB
105 ovs_type OVSBridge
106 ovs_ports eth1
107
108/etc/network/interfaces
109
1101;