summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases/optionals/delete_object_handles_0
diff options
context:
space:
mode:
authorHarsha Sharma <harshasharmaiitr@gmail.com>2018-03-09 19:52:28 +0530
committerPablo Neira Ayuso <pablo@netfilter.org>2018-03-09 18:29:04 +0100
commite0a9aad02480986e823e7936031c693ea11aba9b (patch)
treee566d59fe176d1b24a348233f46dbe230a37d0de /tests/shell/testcases/optionals/delete_object_handles_0
parent606f07eec7cf15e52a9630d53dd0154639b27590 (diff)
tests: shell: fix tests for deletion via handle attribute
Fetch object, chain and set handles and with '-a' option and then delete them. Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/shell/testcases/optionals/delete_object_handles_0')
-rwxr-xr-xtests/shell/testcases/optionals/delete_object_handles_039
1 files changed, 21 insertions, 18 deletions
diff --git a/tests/shell/testcases/optionals/delete_object_handles_0 b/tests/shell/testcases/optionals/delete_object_handles_0
index 355de5f1..d5d96547 100755
--- a/tests/shell/testcases/optionals/delete_object_handles_0
+++ b/tests/shell/testcases/optionals/delete_object_handles_0
@@ -2,36 +2,39 @@
set -e
$NFT add table test-ip
-$NFT add counter test-ip https-traffic # should have handle 1
-$NFT add quota test-ip https-quota 25 mbytes # should have handle 2
-$NFT add map test-ip ports { type inet_service : quota \; } # should have handle 3
+$NFT add counter test-ip https-traffic
+$NFT add quota test-ip https-quota 25 mbytes
+$NFT add map test-ip ports { type inet_service : quota \; }
$NFT add table ip6 test-ip6
-$NFT add quota ip6 test-ip6 http-quota over 25 mbytes # should have handle 1
-$NFT add counter ip6 test-ip6 http-traffic # should have handle 2
-$NFT add quota ip6 test-ip6 ssh-quota 10 mbytes # should have handle 3
-$NFT delete counter test-ip handle 1
-$NFT delete quota ip6 test-ip6 handle 3
+$NFT add quota ip6 test-ip6 http-quota over 25 mbytes
+$NFT add counter ip6 test-ip6 http-traffic
+$NFT add quota ip6 test-ip6 ssh-quota 10 mbytes
+
+counter_handle=$($NFT list ruleset -a | awk '/https-traffic/{print $NF}')
+quota_handle=$($NFT list ruleset -a | awk '/ssh-quota/{print $NF}')
+$NFT delete counter test-ip handle $counter_handle
+$NFT delete quota ip6 test-ip6 handle $quota_handle
EXPECTED="table ip test-ip {
quota https-quota {
- 25 mbytes used 2 bytes
- } # handle 2
+ 25 mbytes
+ }
map ports {
type inet_service : quota
- } # handle 3
-} # handle 1
+ }
+}
table ip6 test-ip6 {
quota http-quota {
- over 25 mbytes used 1 bytes
- } # handle 1
+ over 25 mbytes
+ }
counter http-traffic {
- packets 0 bytes 2
- } # handle 2
-} # handle 2"
+ packets 0 bytes 0
+ }
+}"
-GET="$($NFT list ruleset -a)"
+GET="$($NFT list ruleset)"
if [ "$EXPECTED" != "$GET" ] ; then
DIFF="$(which diff)"