From e7069f617fb70dccb52f3de1beab7851a08eade9 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Fri, 16 Aug 2019 14:22:01 +0200 Subject: tests: add typeof test cases Add sets using unspecific string/integer types, one with osf name, other with vlan id. Neither type can be used directly, as they lack the type size information. Signed-off-by: Florian Westphal --- tests/shell/testcases/maps/dumps/typeof_maps_0.nft | 16 +++++++++++++ tests/shell/testcases/maps/typeof_maps_0 | 27 ++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 tests/shell/testcases/maps/dumps/typeof_maps_0.nft create mode 100755 tests/shell/testcases/maps/typeof_maps_0 (limited to 'tests/shell/testcases/maps') diff --git a/tests/shell/testcases/maps/dumps/typeof_maps_0.nft b/tests/shell/testcases/maps/dumps/typeof_maps_0.nft new file mode 100644 index 00000000..4361ca3d --- /dev/null +++ b/tests/shell/testcases/maps/dumps/typeof_maps_0.nft @@ -0,0 +1,16 @@ +table inet t { + map m1 { + typeof osf name : ct mark + elements = { "Linux" : 0x00000001 } + } + + map m2 { + typeof vlan id : meta mark + elements = { 1 : 0x00000001, 4095 : 0x00004095 } + } + + chain c { + ct mark set osf name map @m1 + meta mark set vlan id map @m2 + } +} diff --git a/tests/shell/testcases/maps/typeof_maps_0 b/tests/shell/testcases/maps/typeof_maps_0 new file mode 100755 index 00000000..950bbf1c --- /dev/null +++ b/tests/shell/testcases/maps/typeof_maps_0 @@ -0,0 +1,27 @@ +#!/bin/bash + +# support for strings and integers in named maps. +# without typeof, this is 'type string' and 'type integer', +# but neither could be used because it lacks size information. + +EXPECTED="table inet t { + map m1 { + typeof osf name : ct mark + elements = { "Linux" : 0x00000001 } + } + + map m2 { + typeof vlan id : mark + elements = { 1 : 0x1, + 4095 : 0x4095 } + } + + chain c { + ct mark set osf name map @m1 + ether type vlan meta mark set vlan id map @m2 + } +}" + +set -e +$NFT -f - <<< $EXPECTED + -- cgit v1.2.3