[nft PATCH 5/5] tests: monitor: Extend testcases a bit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Try to cover for reduced table and chain deletion notifications by
creating them with data which is omitted by the kernel during deletion.

Also try to expose the difference in reported flowtable hook deletion
vs. flowtable deletion.

Signed-off-by: Phil Sutter <phil@xxxxxx>
---
 tests/monitor/testcases/chain.t            | 41 ++++++++++++++++++++++
 tests/monitor/testcases/flowtable-simple.t | 12 +++++++
 tests/monitor/testcases/table.t            | 15 ++++++++
 3 files changed, 68 insertions(+)
 create mode 100644 tests/monitor/testcases/chain.t
 create mode 100644 tests/monitor/testcases/table.t

diff --git a/tests/monitor/testcases/chain.t b/tests/monitor/testcases/chain.t
new file mode 100644
index 0000000000000..975ccf1d33919
--- /dev/null
+++ b/tests/monitor/testcases/chain.t
@@ -0,0 +1,41 @@
+I add table inet t
+O -
+J {"add": {"table": {"family": "inet", "name": "t", "handle": 0}}}
+
+I add chain inet t c
+O -
+J {"add": {"chain": {"family": "inet", "table": "t", "name": "c", "handle": 0}}}
+
+I delete chain inet t c
+O -
+J {"delete": {"chain": {"family": "inet", "table": "t", "name": "c", "handle": 0}}}
+
+I add chain inet t c { type filter hook input priority filter; }
+O add chain inet t c { type filter hook input priority 0; policy accept; }
+J {"add": {"chain": {"family": "inet", "table": "t", "name": "c", "handle": 0, "type": "filter", "hook": "input", "prio": 0, "policy": "accept"}}}
+
+I delete chain inet t c
+O -
+J {"delete": {"chain": {"family": "inet", "table": "t", "name": "c", "handle": 0}}}
+
+I add chain inet t c { type filter hook ingress priority filter; devices = { "lo" }; }
+O add chain inet t c { type filter hook ingress devices = { "lo" } priority 0; policy accept; }
+J {"add": {"chain": {"family": "inet", "table": "t", "name": "c", "handle": 0, "dev": "lo", "type": "filter", "hook": "ingress", "prio": 0, "policy": "accept"}}}
+
+I delete chain inet t c
+O -
+J {"delete": {"chain": {"family": "inet", "table": "t", "name": "c", "handle": 0}}}
+
+I add chain inet t c { type filter hook ingress priority filter; devices = { "eth1", "lo" }; }
+O add chain inet t c { type filter hook ingress devices = { "eth1", "lo" } priority 0; policy accept; }
+J {"add": {"chain": {"family": "inet", "table": "t", "name": "c", "handle": 0, "dev": ["eth1", "lo"], "type": "filter", "hook": "ingress", "prio": 0, "policy": "accept"}}}
+
+I delete chain inet t c { type filter hook ingress priority filter; devices = { "eth1" }; }
+O delete chain inet t c { type filter hook ingress devices = { "eth1" } priority 0; policy accept; }
+J {"delete": {"chain": {"family": "inet", "table": "t", "name": "c", "handle": 0, "dev": "eth1", "type": "filter", "hook": "ingress", "prio": 0, "policy": "accept"}}}
+
+I delete chain inet t c
+O -
+J {"delete": {"chain": {"family": "inet", "table": "t", "name": "c", "handle": 0}}}
+
+
diff --git a/tests/monitor/testcases/flowtable-simple.t b/tests/monitor/testcases/flowtable-simple.t
index 11254c51fcab7..e1889ae5d0076 100644
--- a/tests/monitor/testcases/flowtable-simple.t
+++ b/tests/monitor/testcases/flowtable-simple.t
@@ -8,3 +8,15 @@ J {"add": {"flowtable": {"family": "ip", "name": "ft", "table": "t", "handle": 0
 I delete flowtable ip t ft
 O -
 J {"delete": {"flowtable": {"family": "ip", "name": "ft", "table": "t", "handle": 0}}}
+
+I add flowtable ip t ft { hook ingress priority 0; devices = { "eth1", "lo" }; }
+O -
+J {"add": {"flowtable": {"family": "ip", "name": "ft", "table": "t", "handle": 0, "hook": "ingress", "prio": 0, "dev": ["eth1", "lo"]}}}
+
+I delete flowtable ip t ft { hook ingress priority 0; devices = { "eth1" }; }
+O -
+J {"delete": {"flowtable": {"family": "ip", "name": "ft", "table": "t", "handle": 0, "hook": "ingress", "prio": 0, "dev": "eth1"}}}
+
+I delete flowtable ip t ft
+O -
+J {"delete": {"flowtable": {"family": "ip", "name": "ft", "table": "t", "handle": 0}}}
diff --git a/tests/monitor/testcases/table.t b/tests/monitor/testcases/table.t
new file mode 100644
index 0000000000000..35a0f510436dc
--- /dev/null
+++ b/tests/monitor/testcases/table.t
@@ -0,0 +1,15 @@
+I add table ip t
+O -
+J {"add": {"table": {"family": "ip", "name": "t", "handle": 0}}}
+
+I delete table ip t
+O -
+J {"delete": {"table": {"family": "ip", "name": "t", "handle": 0}}}
+
+I add table ip t { comment "foo bar"; flags dormant; }
+O add table ip t { flags dormant; }
+J {"add": {"table": {"family": "ip", "name": "t", "handle": 0, "flags": ["dormant"], "comment": "foo bar"}}}
+
+I delete table ip t
+O -
+J {"delete": {"table": {"family": "ip", "name": "t", "handle": 0}}}
-- 
2.51.0





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux