summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2018-07-26 12:38:34 +0300
committerDavid S. Miller <davem@davemloft.net>2018-07-26 19:35:32 +0300
commit5a967512bb812d7a4b7e9f3930f49d6d88533dc3 (patch)
tree8d12f14ae50405100c1c6fdaac3be937d9e1a88f /tools/testing
parentdc66fe43b7ebdb53628dcbc1f8f15de3e000aacf (diff)
downloadlinux-5a967512bb812d7a4b7e9f3930f49d6d88533dc3.tar.xz
selftests: forwarding: add tests for TC chain get and dump operations
Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing')
-rwxr-xr-xtools/testing/selftests/net/forwarding/tc_chains.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/forwarding/tc_chains.sh b/tools/testing/selftests/net/forwarding/tc_chains.sh
index 031e322e28b3..2934fb5ed2a2 100755
--- a/tools/testing/selftests/net/forwarding/tc_chains.sh
+++ b/tools/testing/selftests/net/forwarding/tc_chains.sh
@@ -88,9 +88,30 @@ create_destroy_chain()
tc chain add dev $h2 ingress
check_err $? "Failed to create default chain"
+ output="$(tc -j chain get dev $h2 ingress)"
+ check_err $? "Failed to get default chain"
+
+ echo $output | jq -e ".[] | select(.chain == 0)" &> /dev/null
+ check_err $? "Unexpected output for default chain"
+
tc chain add dev $h2 ingress chain 1
check_err $? "Failed to create chain 1"
+ output="$(tc -j chain get dev $h2 ingress chain 1)"
+ check_err $? "Failed to get chain 1"
+
+ echo $output | jq -e ".[] | select(.chain == 1)" &> /dev/null
+ check_err $? "Unexpected output for chain 1"
+
+ output="$(tc -j chain show dev $h2 ingress)"
+ check_err $? "Failed to dump chains"
+
+ echo $output | jq -e ".[] | select(.chain == 0)" &> /dev/null
+ check_err $? "Can't find default chain in dump"
+
+ echo $output | jq -e ".[] | select(.chain == 1)" &> /dev/null
+ check_err $? "Can't find chain 1 in dump"
+
tc chain del dev $h2 ingress
check_err $? "Failed to destroy default chain"