]> git.proxmox.com Git - pve-common.git/blob - test/etc_network_interfaces/t.create_network.pl
Inotify : add check vlan
[pve-common.git] / test / etc_network_interfaces / t.create_network.pl
1 save('proc_net_dev', <<'/proc/net/dev');
2 eth0:
3 eth1:
4 /proc/net/dev
5
6 r(load('brbase'));
7
8 my $ip = '192.168.0.2';
9 my $nm = '255.255.255.0';
10 my $gw = '192.168.0.1';
11 my $svcnodeip = '239.192.105.237';
12 my $physdev = 'eth0';
13 my $remoteip1 = '192.168.0.3';
14 my $remoteip2 = '192.168.0.4';
15
16
17 $config->{ifaces}->{eth1} = {
18 type => 'eth',
19 method => 'static',
20 address => $ip,
21 netmask => $nm,
22 gateway => $gw,
23 families => ['inet'],
24 autostart => 1
25 };
26
27 $config->{ifaces}->{eth2} = {
28 type => 'eth',
29 method => 'manual',
30 families => ['inet'],
31 autostart => 1
32 };
33
34 $config->{ifaces}->{eth3} = {
35 type => 'eth',
36 method => 'manual',
37 families => ['inet'],
38 autostart => 1
39 };
40
41 $config->{ifaces}->{bond0} = {
42 type => 'bond',
43 slaves => 'eth2 eth3',
44 bond_mode => '802.3ad',
45 bond_xmit_hash_policy => 'layer3+4',
46 bond_miimon => 100,
47 method => 'manual',
48 families => ['inet'],
49 autostart => 1
50 };
51
52 $config->{ifaces}->{vmbr1} = {
53 type => 'bridge',
54 method => 'manual',
55 families => ['inet'],
56 bridge_stp => off,
57 bridge_fd => 0,
58 bridge_ports => vxlan1,
59 bridge_vlan_aware => yes,
60 autostart => 1
61 };
62
63 $config->{ifaces}->{vmbr2} = {
64 type => 'bridge',
65 method => 'manual',
66 families => ['inet'],
67 bridge_stp => off,
68 bridge_fd => 0,
69 bridge_ports => vxlan2,
70 autostart => 1
71 };
72
73 $config->{ifaces}->{vmbr3} = {
74 type => 'bridge',
75 method => 'manual',
76 families => ['inet'],
77 bridge_stp => off,
78 bridge_fd => 0,
79 bridge_ports => vxlan3,
80 bridge_vlan_aware => yes,
81 bridge_vids => '2-10',
82 autostart => 1
83 };
84
85 $config->{ifaces}->{vxlan1} = {
86 type => 'vxlan',
87 method => 'manual',
88 families => ['inet'],
89 'vxlan-id' => 1,
90 'vxlan-svcnodeip' => $svcnodeip,
91 'vxlan-physdev' => $physdev,
92 autostart => 1
93 };
94
95 $config->{ifaces}->{vxlan2} = {
96 type => 'vxlan',
97 method => 'manual',
98 families => ['inet'],
99 'vxlan-id' => 2,
100 'vxlan-local-tunnelip' => $ip,
101 'bridge-learning' => 'off',
102 'bridge-arp-nd-suppress' => 'on',
103 'bridge-unicast-flood' => 'off',
104 'bridge-multicast-flood' => 'off',
105 autostart => 1
106 };
107
108 $config->{ifaces}->{vxlan3} = {
109 type => 'vxlan',
110 method => 'manual',
111 families => ['inet'],
112 'vxlan-id' => 3,
113 'vxlan-remoteip' => [$remoteip1, $remoteip2],
114 'bridge-access' => 3,
115 autostart => 1
116 };
117
118 $config->{ifaces}->{'vmbr1.100'} = {
119 type => 'vlan',
120 method => 'manual',
121 families => ['inet'],
122 autostart => 1
123 };
124
125 $config->{ifaces}->{'bond0.100'} = {
126 type => 'vlan',
127 method => 'manual',
128 families => ['inet'],
129 autostart => 1
130 };
131
132 $config->{ifaces}->{'eth1.100'} = {
133 type => 'vlan',
134 method => 'manual',
135 families => ['inet'],
136 autostart => 1
137 };
138
139 expect load('loopback') . <<"CHECK";
140 source-directory interfaces.d
141
142 iface eth0 inet manual
143
144 auto eth1
145 iface eth1 inet static
146 address $ip
147 netmask $nm
148 gateway $gw
149
150 auto eth2
151 iface eth2 inet manual
152
153 auto eth3
154 iface eth3 inet manual
155
156 auto eth1.100
157 iface eth1.100 inet manual
158
159 auto bond0
160 iface bond0 inet manual
161 bond-slaves eth2 eth3
162 bond-miimon 100
163 bond-mode 802.3ad
164 bond-xmit-hash-policy layer3+4
165
166 auto bond0.100
167 iface bond0.100 inet manual
168
169 auto vmbr0
170 iface vmbr0 inet static
171 address 10.0.0.2
172 netmask 255.255.255.0
173 gateway 10.0.0.1
174 bridge-ports eth0
175 bridge-stp off
176 bridge-fd 0
177
178 auto vmbr1
179 iface vmbr1 inet manual
180 bridge-ports vxlan1
181 bridge-stp off
182 bridge-fd 0
183 bridge-vlan-aware yes
184 bridge-vids 2-4094
185
186 auto vmbr2
187 iface vmbr2 inet manual
188 bridge-ports vxlan2
189 bridge-stp off
190 bridge-fd 0
191
192 auto vmbr3
193 iface vmbr3 inet manual
194 bridge-ports vxlan3
195 bridge-stp off
196 bridge-fd 0
197 bridge-vlan-aware yes
198 bridge-vids 2-10
199
200 auto vmbr1.100
201 iface vmbr1.100 inet manual
202
203 auto vxlan1
204 iface vxlan1 inet manual
205 vxlan-id 1
206 vxlan-svcnodeip $svcnodeip
207 vxlan-physdev $physdev
208
209 auto vxlan2
210 iface vxlan2 inet manual
211 vxlan-id 2
212 vxlan-local-tunnelip $ip
213 bridge-arp-nd-suppress on
214 bridge-learning off
215 bridge-multicast-flood off
216 bridge-unicast-flood off
217
218 auto vxlan3
219 iface vxlan3 inet manual
220 vxlan-id 3
221 vxlan-remoteip $remoteip1
222 vxlan-remoteip $remoteip2
223 bridge-access 3
224
225 CHECK
226
227 save('if', w());
228 r(load('if'));
229 expect load('if');
230
231 r(load('brbase'));
232
233 my $ip = 'fc05::2';
234 my $nm = '112';
235 my $gw = 'fc05::1';
236
237 $config->{ifaces}->{eth1} = {
238 type => 'eth',
239 method6 => 'static',
240 address6 => $ip,
241 netmask6 => $nm,
242 gateway6 => $gw,
243 families => ['inet6'],
244 autostart => 1
245 };
246
247
248 expect load('loopback') . <<"CHECK";
249 source-directory interfaces.d
250
251 iface eth0 inet manual
252
253 auto eth1
254 iface eth1 inet6 static
255 address $ip
256 netmask $nm
257 gateway $gw
258
259 auto vmbr0
260 iface vmbr0 inet static
261 address 10.0.0.2
262 netmask 255.255.255.0
263 gateway 10.0.0.1
264 bridge-ports eth0
265 bridge-stp off
266 bridge-fd 0
267
268 CHECK
269
270 save('if', w());
271 r(load('if'));
272 expect load('if');
273
274 1;