Révision 9d02e9f8
Add variant array
spec/defines/simplerule_spec.rb | ||
---|---|---|
208 | 208 |
} |
209 | 209 |
end |
210 | 210 |
|
211 |
describe 'with an IPV4 array address as daddr' do |
|
212 |
let(:params) do |
|
213 |
{ |
|
214 |
daddr: ['172.16.1.5', '172.16.1.10', '172.16.1.15'], |
|
215 |
} |
|
216 |
end |
|
217 |
|
|
218 |
it { is_expected.to compile } |
|
219 |
|
|
220 |
it { |
|
221 |
expect(subject).to contain_nftables__rule('default_in-my_default_rule_name').with( |
|
222 |
content: 'ip daddr {172.16.1.5, 172.16.1.10, 172.16.1.15} accept' |
|
223 |
) |
|
224 |
} |
|
225 |
end |
|
226 |
|
|
211 | 227 |
describe 'with an IPv6 address as daddr' do |
212 | 228 |
let(:params) do |
213 | 229 |
{ |
... | ... | |
224 | 240 |
} |
225 | 241 |
end |
226 | 242 |
|
227 |
describe 'with an IPv6 address as saddr' do
|
|
243 |
describe 'with an IPV6 array address as daddr' do
|
|
228 | 244 |
let(:params) do |
229 | 245 |
{ |
230 |
saddr: '2001:1458:0000:0000:0000:0000:0000:0003',
|
|
246 |
daddr: ['2001:1458:0000:0000:0000:0000:0000:0003', '8896:d5d9:e6f4:dd8f:af69:f5c0:0131:264f'],
|
|
231 | 247 |
} |
232 | 248 |
end |
233 | 249 |
|
... | ... | |
235 | 251 |
|
236 | 252 |
it { |
237 | 253 |
expect(subject).to contain_nftables__rule('default_in-my_default_rule_name').with( |
238 |
content: 'ip6 saddr 2001:1458:0000:0000:0000:0000:0000:0003 accept' |
|
254 |
content: 'ip6 daddr {2001:1458:0000:0000:0000:0000:0000:0003, 8896:d5d9:e6f4:dd8f:af69:f5c0:0131:264f} accept' |
|
255 |
) |
|
256 |
} |
|
257 |
end |
|
258 |
|
|
259 |
describe 'with a @addr IPV4 set as daddr' do |
|
260 |
let(:params) do |
|
261 |
{ |
|
262 |
daddr: '@my4_set', |
|
263 |
set_type: 'ip', |
|
264 |
} |
|
265 |
end |
|
266 |
|
|
267 |
it { is_expected.to compile } |
|
268 |
|
|
269 |
it { |
|
270 |
expect(subject).to contain_nftables__rule('default_in-my_default_rule_name').with( |
|
271 |
content: 'ip daddr @my4_set accept' |
|
272 |
) |
|
273 |
} |
|
274 |
end |
|
275 |
|
|
276 |
describe 'with a @addr IPV4 array set as daddr' do |
|
277 |
let(:params) do |
|
278 |
{ |
|
279 |
daddr: ['@my4_1_set', '@my4_2_set'], |
|
280 |
set_type: 'ip', |
|
281 |
} |
|
282 |
end |
|
283 |
|
|
284 |
it { is_expected.to compile } |
|
285 |
|
|
286 |
it { |
|
287 |
expect(subject).to contain_nftables__rule('default_in-my_default_rule_name').with( |
|
288 |
content: 'ip daddr {@my4_1_set, @my4_2_set} accept' |
|
289 |
) |
|
290 |
} |
|
291 |
end |
|
292 |
|
|
293 |
describe 'with an @addr IPV6 set as daddr, default set_type' do |
|
294 |
let(:params) do |
|
295 |
{ |
|
296 |
daddr: '@my6_set', |
|
297 |
} |
|
298 |
end |
|
299 |
|
|
300 |
it { is_expected.to compile } |
|
301 |
|
|
302 |
it { |
|
303 |
expect(subject).to contain_nftables__rule('default_in-my_default_rule_name').with( |
|
304 |
content: 'ip6 daddr @my6_set accept' |
|
305 |
) |
|
306 |
} |
|
307 |
end |
|
308 |
|
|
309 |
describe 'with an @addr IPV6 array set as daddr, default set_type' do |
|
310 |
let(:params) do |
|
311 |
{ |
|
312 |
daddr: ['@my6_1_set', '@my6_2_set'], |
|
313 |
} |
|
314 |
end |
|
315 |
|
|
316 |
it { is_expected.to compile } |
|
317 |
|
|
318 |
it { |
|
319 |
expect(subject).to contain_nftables__rule('default_in-my_default_rule_name').with( |
|
320 |
content: 'ip6 daddr {@my6_1_set, @my6_2_set} accept' |
|
239 | 321 |
) |
240 | 322 |
} |
241 | 323 |
end |
... | ... | |
256 | 338 |
} |
257 | 339 |
end |
258 | 340 |
|
259 |
describe 'with an IPv6 set as daddr, default set_type' do
|
|
341 |
describe 'with an IPV4 array address as saddr' do
|
|
260 | 342 |
let(:params) do |
261 | 343 |
{ |
262 |
daddr: '@my6_set',
|
|
344 |
saddr: ['172.16.1.5', '172.16.1.10', '172.16.1.15'],
|
|
263 | 345 |
} |
264 | 346 |
end |
265 | 347 |
|
... | ... | |
267 | 349 |
|
268 | 350 |
it { |
269 | 351 |
expect(subject).to contain_nftables__rule('default_in-my_default_rule_name').with( |
270 |
content: 'ip6 daddr @my6_set accept'
|
|
352 |
content: 'ip saddr {172.16.1.5, 172.16.1.10, 172.16.1.15} accept'
|
|
271 | 353 |
) |
272 | 354 |
} |
273 | 355 |
end |
274 | 356 |
|
275 |
describe 'with a IPv4 set as daddr' do
|
|
357 |
describe 'with an IPv6 address as saddr' do
|
|
276 | 358 |
let(:params) do |
277 | 359 |
{ |
278 |
daddr: '@my4_set', |
|
360 |
saddr: '2001:1458:0000:0000:0000:0000:0000:0003', |
|
361 |
} |
|
362 |
end |
|
363 |
|
|
364 |
it { is_expected.to compile } |
|
365 |
|
|
366 |
it { |
|
367 |
expect(subject).to contain_nftables__rule('default_in-my_default_rule_name').with( |
|
368 |
content: 'ip6 saddr 2001:1458:0000:0000:0000:0000:0000:0003 accept' |
|
369 |
) |
|
370 |
} |
|
371 |
end |
|
372 |
|
|
373 |
describe 'with an IPV6 array address as saddr' do |
|
374 |
let(:params) do |
|
375 |
{ |
|
376 |
saddr: ['2001:1458:0000:0000:0000:0000:0000:0003', '8896:d5d9:e6f4:dd8f:af69:f5c0:0131:264f'], |
|
377 |
} |
|
378 |
end |
|
379 |
|
|
380 |
it { is_expected.to compile } |
|
381 |
|
|
382 |
it { |
|
383 |
expect(subject).to contain_nftables__rule('default_in-my_default_rule_name').with( |
|
384 |
content: 'ip6 saddr {2001:1458:0000:0000:0000:0000:0000:0003, 8896:d5d9:e6f4:dd8f:af69:f5c0:0131:264f} accept' |
|
385 |
) |
|
386 |
} |
|
387 |
end |
|
388 |
|
|
389 |
describe 'with a @addr IPV4 set as saddr' do |
|
390 |
let(:params) do |
|
391 |
{ |
|
392 |
saddr: '@my4_set', |
|
279 | 393 |
set_type: 'ip', |
280 | 394 |
} |
281 | 395 |
end |
... | ... | |
284 | 398 |
|
285 | 399 |
it { |
286 | 400 |
expect(subject).to contain_nftables__rule('default_in-my_default_rule_name').with( |
287 |
content: 'ip daddr @my4_set accept'
|
|
401 |
content: 'ip saddr @my4_set accept'
|
|
288 | 402 |
) |
289 | 403 |
} |
290 | 404 |
end |
291 | 405 |
|
292 |
describe 'with a IPv6 set as saddr' do |
|
406 |
describe 'with a @addr IPV4 array set as saddr' do |
|
407 |
let(:params) do |
|
408 |
{ |
|
409 |
saddr: ['@my4_1_set', '@my4_2_set'], |
|
410 |
set_type: 'ip', |
|
411 |
} |
|
412 |
end |
|
413 |
|
|
414 |
it { is_expected.to compile } |
|
415 |
|
|
416 |
it { |
|
417 |
expect(subject).to contain_nftables__rule('default_in-my_default_rule_name').with( |
|
418 |
content: 'ip saddr {@my4_1_set, @my4_2_set} accept' |
|
419 |
) |
|
420 |
} |
|
421 |
end |
|
422 |
|
|
423 |
describe 'with an @addr IPV6 set as saddr, default set_type' do |
|
293 | 424 |
let(:params) do |
294 | 425 |
{ |
295 | 426 |
saddr: '@my6_set', |
296 |
set_type: 'ip6', |
|
297 | 427 |
} |
298 | 428 |
end |
299 | 429 |
|
... | ... | |
306 | 436 |
} |
307 | 437 |
end |
308 | 438 |
|
439 |
describe 'with an @addr IPV6 array set as saddr, default set_type' do |
|
440 |
let(:params) do |
|
441 |
{ |
|
442 |
saddr: ['@my6_1_set', '@my6_2_set'], |
|
443 |
} |
|
444 |
end |
|
445 |
|
|
446 |
it { is_expected.to compile } |
|
447 |
|
|
448 |
it { |
|
449 |
expect(subject).to contain_nftables__rule('default_in-my_default_rule_name').with( |
|
450 |
content: 'ip6 saddr {@my6_1_set, @my6_2_set} accept' |
|
451 |
) |
|
452 |
} |
|
453 |
end |
|
454 |
|
|
309 | 455 |
describe 'with counter enabled' do |
310 | 456 |
let(:params) do |
311 | 457 |
{ |
Formats disponibles : Unified diff