diff mbox series

[nft,2/2] test: shell: Test cases for standard prios for flowtables

Message ID 20180824154715.31008-2-ecklm94@gmail.com
State Accepted
Delegated to: Pablo Neira
Headers show
Series [nft,1/2] test: shell: Test cases for standard chain prios | expand

Commit Message

Máté Eckl Aug. 24, 2018, 3:47 p.m. UTC
Signed-off-by: Máté Eckl <ecklm94@gmail.com>
---
 tests/shell/testcases/flowtable/0007prio_0 | 24 ++++++++++++++++++++++
 tests/shell/testcases/flowtable/0008prio_1 | 14 +++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100755 tests/shell/testcases/flowtable/0007prio_0
 create mode 100755 tests/shell/testcases/flowtable/0008prio_1

Comments

Pablo Neira Ayuso Aug. 30, 2018, 10:11 a.m. UTC | #1
Applied, thanks.
diff mbox series

Patch

diff --git a/tests/shell/testcases/flowtable/0007prio_0 b/tests/shell/testcases/flowtable/0007prio_0
new file mode 100755
index 0000000..49bbcac
--- /dev/null
+++ b/tests/shell/testcases/flowtable/0007prio_0
@@ -0,0 +1,24 @@ 
+#!/bin/bash
+
+set -e
+
+format_offset () {
+	i=$1
+	if ((i == 0))
+	then
+		echo ""
+	elif ((i > 0))
+	then
+		echo "+$i"
+	else
+		echo "$i"
+	fi
+}
+
+$NFT add table t
+for offset in -11 -10 0 10 11
+do
+	$NFT add flowtable t f "{ hook ingress priority filter `format_offset $offset`; devices = { lo }; }"
+	$NFT delete flowtable t f
+done
+
diff --git a/tests/shell/testcases/flowtable/0008prio_1 b/tests/shell/testcases/flowtable/0008prio_1
new file mode 100755
index 0000000..87084b9
--- /dev/null
+++ b/tests/shell/testcases/flowtable/0008prio_1
@@ -0,0 +1,14 @@ 
+#!/bin/bash
+
+$NFT add table t
+for prioname in raw mangle dstnar security srcnat out dummy
+do
+	$NFT add flowtable t f { hook ingress priority $prioname \; devices = { lo }\; }
+	if (($? == 0))
+	then
+		echo "E: $prioname should not be a valid priority name for flowtables" >&2
+		exit 0
+	fi
+done
+
+exit 1