Debian Codegraph @

tests/shell/testcases/optionals/delete_object_handles_0

raw
1 #!/bin/bash
2
3 set -e
4 $NFT add table test-ip
5 $NFT add counter test-ip https-traffic
6 $NFT add quota test-ip https-quota 25 mbytes
7 $NFT add map test-ip ports { type inet_service : quota \; }
8 $NFT add table ip6 test-ip6
9 $NFT add quota ip6 test-ip6 http-quota over 25 mbytes
10 $NFT add counter ip6 test-ip6 http-traffic
11 $NFT add quota ip6 test-ip6 ssh-quota 10 mbytes
12
13 counter_handle=$($NFT -a list ruleset | awk '/https-traffic/{print $NF}')
14 quota_handle=$($NFT -a list ruleset | awk '/ssh-quota/{print $NF}')
15 $NFT delete counter test-ip handle $counter_handle
16 $NFT delete quota ip6 test-ip6 handle $quota_handle
17
18 EXPECTED="table ip test-ip {
19 quota https-quota {
20 25 mbytes
21 }
22
23 map ports {
24 type inet_service : quota
25 }
26 }
27 table ip6 test-ip6 {
28 quota http-quota {
29 over 25 mbytes
30 }
31
32 counter http-traffic {
33 packets 0 bytes 0
34 }
35 }"
36
37 GET="$($NFT list ruleset)"
38
39 if [ "$EXPECTED" != "$GET" ] ; then
40 $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
41 exit 1
42 fi