-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(stmt): add serialization test for flow, flowtable
- Loading branch information
Showing
3 changed files
with
184 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"nftables": [ | ||
{ | ||
"metainfo": { | ||
"version": "1.0.9", | ||
"release_name": "Old Doc Yak #3", | ||
"json_schema_version": 1 | ||
} | ||
}, | ||
{ | ||
"table": { | ||
"family": "inet", | ||
"name": "named_counter_demo", | ||
"handle": 3 | ||
} | ||
}, | ||
{ | ||
"flowtable": { | ||
"family": "inet", | ||
"name": "flowed", | ||
"table": "named_counter_demo", | ||
"handle": 2, | ||
"hook": "ingress", | ||
"prio": 0, | ||
"dev": "lo" | ||
} | ||
}, | ||
{ | ||
"chain": { | ||
"family": "inet", | ||
"table": "named_counter_demo", | ||
"name": "forward", | ||
"handle": 1, | ||
"type": "filter", | ||
"hook": "forward", | ||
"prio": 0, | ||
"policy": "accept" | ||
} | ||
}, | ||
{ | ||
"rule": { | ||
"family": "inet", | ||
"table": "named_counter_demo", | ||
"chain": "forward", | ||
"handle": 3, | ||
"expr": [ | ||
{ | ||
"match": { | ||
"op": "in", | ||
"left": { | ||
"ct": { | ||
"key": "state" | ||
} | ||
}, | ||
"right": "established" | ||
} | ||
}, | ||
{ | ||
"flow": { | ||
"op": "add", | ||
"flowtable": "@flowed" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/sbin/nft -f | ||
|
||
flush ruleset | ||
|
||
table inet named_counter_demo { | ||
flowtable flowed { | ||
hook ingress priority filter | ||
devices = { lo } | ||
} | ||
|
||
chain forward { | ||
type filter hook forward priority filter; policy accept; | ||
ct state established flow add @flowed | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters