From b81ebeb917a33afcaa2e8147a2fb2b6e01f49330 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Mon, 22 Jan 2018 19:54:36 +0100 Subject: tests: shell: add flowtable tests Add basic flowtable tests. Signed-off-by: Pablo Neira Ayuso --- tests/shell/testcases/flowtable/0001flowtable_0 | 33 +++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 tests/shell/testcases/flowtable/0001flowtable_0 (limited to 'tests/shell/testcases/flowtable/0001flowtable_0') diff --git a/tests/shell/testcases/flowtable/0001flowtable_0 b/tests/shell/testcases/flowtable/0001flowtable_0 new file mode 100755 index 00000000..307f06f6 --- /dev/null +++ b/tests/shell/testcases/flowtable/0001flowtable_0 @@ -0,0 +1,33 @@ +#!/bin/bash + +tmpfile=$(mktemp) +if [ ! -w $tmpfile ] ; then + echo "Failed to create tmp file" >&2 + exit 0 +fi + +trap "rm -rf $tmpfile" EXIT # cleanup if aborted + + +EXPECTED='table inet t { + flowtable f { + hook ingress priority 10 + devices = { eth0, wlan0 } + } + + chain c { + flow offload @f + } +}' + +echo "$EXPECTED" > $tmpfile +set -e +$NFT -f $tmpfile + +GET="$($NFT list ruleset)" + +if [ "$EXPECTED" != "$GET" ] ; then + DIFF="$(which diff)" + [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET") + exit 1 +fi -- cgit v1.2.3