diff options
Diffstat (limited to 'tests/shell/testcases/sets/set_stmt')
-rwxr-xr-x | tests/shell/testcases/sets/set_stmt | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/shell/testcases/sets/set_stmt b/tests/shell/testcases/sets/set_stmt new file mode 100755 index 00000000..0433b676 --- /dev/null +++ b/tests/shell/testcases/sets/set_stmt @@ -0,0 +1,48 @@ +#!/bin/bash + +test_set_stmt() { + local i=$1 + local stmt1=$2 + local stmt2=$3 + + RULESET="table x { + set y$i { + type ipv4_addr + $stmt1 + elements = { 5.5.5.$i $stmt1, + 6.6.6.$i $stmt2 } + } + chain y$i { + ip daddr @y$i + } +}" + + $NFT -f - <<< $RULESET + # should work + if [ $? -ne 0 ] + then + exit 1 + fi + + # should work + $NFT add element x y$i { 2.2.2.$i $stmt2 } + if [ $? -ne 0 ] + then + exit 1 + fi + + # should work + $NFT add element x y$i { 3.3.3.$i } + if [ $? -ne 0 ] + then + exit 1 + fi +} + +test_set_stmt "0" "counter packets 1 bytes 2" "counter packets 3 bytes 4" +test_set_stmt "1" "limit rate 1/second" "limit rate 5/second" +test_set_stmt "2" "ct count over 2" "ct count over 5" +test_set_stmt "3" "last" "last" +test_set_stmt "4" "quota over 1000 bytes" "quota over 30000 bytes used 1000 bytes" + +exit 0 |