diff options
author | Phil Sutter <phil@nwl.cc> | 2024-09-28 00:55:34 +0200 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2024-11-06 11:00:21 +0100 |
commit | bb6312484af93a83a9ec8716f3887a43566a775a (patch) | |
tree | 9e4a151a53d0ef3011a8e9bf1a0048b85da4f512 /tests/shell/testcases/packetpath | |
parent | 193faa5475a5df7d9ac0b1a8fe647196de3e5688 (diff) |
json: Support typeof in set and map types
Implement this as a special "type" property value which is an object
with sole property "typeof". The latter's value is the JSON
representation of the expression in set->key, so for concatenated
typeofs it is a concat expression.
All this is a bit clumsy right now but it works and it should be
possible to tear it down a bit for more user-friendliness in a
compatible way by either replacing the concat expression by the array it
contains or even the whole "typeof" object - the parser would just
assume any object (or objects in an array) in the "type" property value
are expressions to extract a type from.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'tests/shell/testcases/packetpath')
-rw-r--r-- | tests/shell/testcases/packetpath/dumps/set_lookups.json-nft | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/tests/shell/testcases/packetpath/dumps/set_lookups.json-nft b/tests/shell/testcases/packetpath/dumps/set_lookups.json-nft index 24363f90..bcf6914e 100644 --- a/tests/shell/testcases/packetpath/dumps/set_lookups.json-nft +++ b/tests/shell/testcases/packetpath/dumps/set_lookups.json-nft @@ -60,10 +60,23 @@ "family": "ip", "name": "s2", "table": "t", - "type": [ - "ipv4_addr", - "iface_index" - ], + "type": { + "typeof": { + "concat": [ + { + "payload": { + "protocol": "ip", + "field": "saddr" + } + }, + { + "meta": { + "key": "iif" + } + } + ] + } + }, "handle": 0, "elem": [ { @@ -113,10 +126,23 @@ "family": "ip", "name": "nomatch", "table": "t", - "type": [ - "ipv4_addr", - "iface_index" - ], + "type": { + "typeof": { + "concat": [ + { + "payload": { + "protocol": "ip", + "field": "saddr" + } + }, + { + "meta": { + "key": "iif" + } + } + ] + } + }, "handle": 0, "elem": [ { |