From 624b034b83a66ec2263314db9dc62ac06b1ae7e7 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 8 Feb 2024 14:30:17 +0100 Subject: tests: shell: Pretty-print all *.json-nft dumps The problem with single line output as produced by 'nft -j list ruleset' is its incompatibility to unified diff format as any change in this single line will produce a diff which contains the old and new lines in total. This is not just unreadable but will blow up patches which may exceed mailinglists' mail size limits. Convert them all at once by feeding their contents to tests/shell/helpers/json-pretty.sh. Signed-off-by: Phil Sutter --- .../testcases/chains/dumps/0002jumps_1.json-nft | 384 ++++++++++++++++++++- 1 file changed, 383 insertions(+), 1 deletion(-) (limited to 'tests/shell/testcases/chains/dumps/0002jumps_1.json-nft') diff --git a/tests/shell/testcases/chains/dumps/0002jumps_1.json-nft b/tests/shell/testcases/chains/dumps/0002jumps_1.json-nft index 5ac08d73..66f921a0 100644 --- a/tests/shell/testcases/chains/dumps/0002jumps_1.json-nft +++ b/tests/shell/testcases/chains/dumps/0002jumps_1.json-nft @@ -1 +1,383 @@ -{"nftables": [{"metainfo": {"version": "VERSION", "release_name": "RELEASE_NAME", "json_schema_version": 1}}, {"table": {"family": "ip", "name": "t", "handle": 0}}, {"chain": {"family": "ip", "table": "t", "name": "c1", "handle": 0, "type": "filter", "hook": "input", "prio": 0, "policy": "accept"}}, {"chain": {"family": "ip", "table": "t", "name": "c2", "handle": 0}}, {"chain": {"family": "ip", "table": "t", "name": "c3", "handle": 0}}, {"chain": {"family": "ip", "table": "t", "name": "c4", "handle": 0}}, {"chain": {"family": "ip", "table": "t", "name": "c5", "handle": 0}}, {"chain": {"family": "ip", "table": "t", "name": "c6", "handle": 0}}, {"chain": {"family": "ip", "table": "t", "name": "c7", "handle": 0}}, {"chain": {"family": "ip", "table": "t", "name": "c8", "handle": 0}}, {"chain": {"family": "ip", "table": "t", "name": "c9", "handle": 0}}, {"chain": {"family": "ip", "table": "t", "name": "c10", "handle": 0}}, {"chain": {"family": "ip", "table": "t", "name": "c11", "handle": 0}}, {"chain": {"family": "ip", "table": "t", "name": "c12", "handle": 0}}, {"chain": {"family": "ip", "table": "t", "name": "c13", "handle": 0}}, {"chain": {"family": "ip", "table": "t", "name": "c14", "handle": 0}}, {"chain": {"family": "ip", "table": "t", "name": "c15", "handle": 0}}, {"chain": {"family": "ip", "table": "t", "name": "c16", "handle": 0}}, {"chain": {"family": "ip", "table": "t", "name": "c17", "handle": 0}}, {"rule": {"family": "ip", "table": "t", "chain": "c1", "handle": 0, "expr": [{"jump": {"target": "c2"}}]}}, {"rule": {"family": "ip", "table": "t", "chain": "c2", "handle": 0, "expr": [{"jump": {"target": "c3"}}]}}, {"rule": {"family": "ip", "table": "t", "chain": "c3", "handle": 0, "expr": [{"jump": {"target": "c4"}}]}}, {"rule": {"family": "ip", "table": "t", "chain": "c4", "handle": 0, "expr": [{"jump": {"target": "c5"}}]}}, {"rule": {"family": "ip", "table": "t", "chain": "c5", "handle": 0, "expr": [{"jump": {"target": "c6"}}]}}, {"rule": {"family": "ip", "table": "t", "chain": "c6", "handle": 0, "expr": [{"jump": {"target": "c7"}}]}}, {"rule": {"family": "ip", "table": "t", "chain": "c7", "handle": 0, "expr": [{"jump": {"target": "c8"}}]}}, {"rule": {"family": "ip", "table": "t", "chain": "c8", "handle": 0, "expr": [{"jump": {"target": "c9"}}]}}, {"rule": {"family": "ip", "table": "t", "chain": "c9", "handle": 0, "expr": [{"jump": {"target": "c10"}}]}}, {"rule": {"family": "ip", "table": "t", "chain": "c10", "handle": 0, "expr": [{"jump": {"target": "c11"}}]}}, {"rule": {"family": "ip", "table": "t", "chain": "c11", "handle": 0, "expr": [{"jump": {"target": "c12"}}]}}, {"rule": {"family": "ip", "table": "t", "chain": "c12", "handle": 0, "expr": [{"jump": {"target": "c13"}}]}}, {"rule": {"family": "ip", "table": "t", "chain": "c13", "handle": 0, "expr": [{"jump": {"target": "c14"}}]}}, {"rule": {"family": "ip", "table": "t", "chain": "c14", "handle": 0, "expr": [{"jump": {"target": "c15"}}]}}, {"rule": {"family": "ip", "table": "t", "chain": "c15", "handle": 0, "expr": [{"jump": {"target": "c16"}}]}}]} +{ + "nftables": [ + { + "metainfo": { + "version": "VERSION", + "release_name": "RELEASE_NAME", + "json_schema_version": 1 + } + }, + { + "table": { + "family": "ip", + "name": "t", + "handle": 0 + } + }, + { + "chain": { + "family": "ip", + "table": "t", + "name": "c1", + "handle": 0, + "type": "filter", + "hook": "input", + "prio": 0, + "policy": "accept" + } + }, + { + "chain": { + "family": "ip", + "table": "t", + "name": "c2", + "handle": 0 + } + }, + { + "chain": { + "family": "ip", + "table": "t", + "name": "c3", + "handle": 0 + } + }, + { + "chain": { + "family": "ip", + "table": "t", + "name": "c4", + "handle": 0 + } + }, + { + "chain": { + "family": "ip", + "table": "t", + "name": "c5", + "handle": 0 + } + }, + { + "chain": { + "family": "ip", + "table": "t", + "name": "c6", + "handle": 0 + } + }, + { + "chain": { + "family": "ip", + "table": "t", + "name": "c7", + "handle": 0 + } + }, + { + "chain": { + "family": "ip", + "table": "t", + "name": "c8", + "handle": 0 + } + }, + { + "chain": { + "family": "ip", + "table": "t", + "name": "c9", + "handle": 0 + } + }, + { + "chain": { + "family": "ip", + "table": "t", + "name": "c10", + "handle": 0 + } + }, + { + "chain": { + "family": "ip", + "table": "t", + "name": "c11", + "handle": 0 + } + }, + { + "chain": { + "family": "ip", + "table": "t", + "name": "c12", + "handle": 0 + } + }, + { + "chain": { + "family": "ip", + "table": "t", + "name": "c13", + "handle": 0 + } + }, + { + "chain": { + "family": "ip", + "table": "t", + "name": "c14", + "handle": 0 + } + }, + { + "chain": { + "family": "ip", + "table": "t", + "name": "c15", + "handle": 0 + } + }, + { + "chain": { + "family": "ip", + "table": "t", + "name": "c16", + "handle": 0 + } + }, + { + "chain": { + "family": "ip", + "table": "t", + "name": "c17", + "handle": 0 + } + }, + { + "rule": { + "family": "ip", + "table": "t", + "chain": "c1", + "handle": 0, + "expr": [ + { + "jump": { + "target": "c2" + } + } + ] + } + }, + { + "rule": { + "family": "ip", + "table": "t", + "chain": "c2", + "handle": 0, + "expr": [ + { + "jump": { + "target": "c3" + } + } + ] + } + }, + { + "rule": { + "family": "ip", + "table": "t", + "chain": "c3", + "handle": 0, + "expr": [ + { + "jump": { + "target": "c4" + } + } + ] + } + }, + { + "rule": { + "family": "ip", + "table": "t", + "chain": "c4", + "handle": 0, + "expr": [ + { + "jump": { + "target": "c5" + } + } + ] + } + }, + { + "rule": { + "family": "ip", + "table": "t", + "chain": "c5", + "handle": 0, + "expr": [ + { + "jump": { + "target": "c6" + } + } + ] + } + }, + { + "rule": { + "family": "ip", + "table": "t", + "chain": "c6", + "handle": 0, + "expr": [ + { + "jump": { + "target": "c7" + } + } + ] + } + }, + { + "rule": { + "family": "ip", + "table": "t", + "chain": "c7", + "handle": 0, + "expr": [ + { + "jump": { + "target": "c8" + } + } + ] + } + }, + { + "rule": { + "family": "ip", + "table": "t", + "chain": "c8", + "handle": 0, + "expr": [ + { + "jump": { + "target": "c9" + } + } + ] + } + }, + { + "rule": { + "family": "ip", + "table": "t", + "chain": "c9", + "handle": 0, + "expr": [ + { + "jump": { + "target": "c10" + } + } + ] + } + }, + { + "rule": { + "family": "ip", + "table": "t", + "chain": "c10", + "handle": 0, + "expr": [ + { + "jump": { + "target": "c11" + } + } + ] + } + }, + { + "rule": { + "family": "ip", + "table": "t", + "chain": "c11", + "handle": 0, + "expr": [ + { + "jump": { + "target": "c12" + } + } + ] + } + }, + { + "rule": { + "family": "ip", + "table": "t", + "chain": "c12", + "handle": 0, + "expr": [ + { + "jump": { + "target": "c13" + } + } + ] + } + }, + { + "rule": { + "family": "ip", + "table": "t", + "chain": "c13", + "handle": 0, + "expr": [ + { + "jump": { + "target": "c14" + } + } + ] + } + }, + { + "rule": { + "family": "ip", + "table": "t", + "chain": "c14", + "handle": 0, + "expr": [ + { + "jump": { + "target": "c15" + } + } + ] + } + }, + { + "rule": { + "family": "ip", + "table": "t", + "chain": "c15", + "handle": 0, + "expr": [ + { + "jump": { + "target": "c16" + } + } + ] + } + } + ] +} -- cgit v1.2.3