summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases/listing/0010sets_0
blob: 855cceb85932be18d941a0dfa2018574620cefb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash

# listing all sets

EXPECTED="table ip nat {
	set ssh {
		type ipv4_addr
	}
}
table ip6 test {
	set testset {
		type ipv6_addr
	}
}
table arp test_arp {
	set test_set_arp00 {
		type inet_service
	}
	set test_set_arp01 {
		type inet_service
		flags constant
	}
}
table bridge test_bridge {
	set test_set_bridge {
		type inet_service
	}
}
table inet filter {
	set set0 {
		type inet_service
	}
	set set1 {
		type inet_service
		flags constant
	}
	set set2 {
		type icmpv6_type
	}
}"

set -e

$NFT add table ip nat
$NFT add set ip nat ssh { type ipv4_addr \; }
$NFT add table ip6 test
$NFT add set ip6 test testset { type ipv6_addr \; }
$NFT add table arp test_arp
$NFT add set arp test_arp test_set_arp00 { type inet_service \; }
$NFT add set arp test_arp test_set_arp01 { type inet_service \; flags constant \; }
$NFT add table bridge test_bridge
$NFT add set bridge test_bridge test_set_bridge { type inet_service \; }
$NFT add table inet filter
$NFT add set inet filter set0 { type inet_service \; }
$NFT add set inet filter set1 { type inet_service \; flags constant \; }
$NFT add set inet filter set2 { type icmpv6_type \; }

GET="$($NFT list sets)"
if [ "$EXPECTED" != "$GET" ] ; then
	DIFF="$(which diff)"
	[ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
	exit 1
fi