summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases/maps
diff options
context:
space:
mode:
Diffstat (limited to 'tests/shell/testcases/maps')
-rwxr-xr-xtests/shell/testcases/maps/0005interval_map_add_many_elements_015
-rwxr-xr-xtests/shell/testcases/maps/0006interval_map_overlap_014
-rwxr-xr-xtests/shell/testcases/maps/0007named_ifname_dtype_07
-rw-r--r--tests/shell/testcases/maps/dumps/0005interval_map_add_many_elements_0.nft8
-rw-r--r--tests/shell/testcases/maps/dumps/0006interval_map_overlap_0.nft7
-rw-r--r--tests/shell/testcases/maps/dumps/0007named_ifname_dtype_0.nft11
-rw-r--r--tests/shell/testcases/maps/dumps/anonymous_snat_map_0.nft5
-rw-r--r--tests/shell/testcases/maps/dumps/map_with_flags_0.nft6
-rw-r--r--tests/shell/testcases/maps/dumps/named_snat_map_0.nft10
-rwxr-xr-xtests/shell/testcases/maps/map_with_flags_015
10 files changed, 47 insertions, 51 deletions
diff --git a/tests/shell/testcases/maps/0005interval_map_add_many_elements_0 b/tests/shell/testcases/maps/0005interval_map_add_many_elements_0
index 55f90555..0714963d 100755
--- a/tests/shell/testcases/maps/0005interval_map_add_many_elements_0
+++ b/tests/shell/testcases/maps/0005interval_map_add_many_elements_0
@@ -56,18 +56,3 @@ n=$HOWMANY
echo "add element x y { 10.${n}.${n}.0/24 : 10.0.${n}.${n} }" > $tmpfile
$NFT -f $tmpfile
-
-EXPECTED="table ip x {
- map y {
- type ipv4_addr : ipv4_addr
- flags interval
- elements = { "$(generate_test)" }
- }
-}"
-GET=$($NFT list ruleset)
-if [ "$EXPECTED" != "$GET" ] ; then
- DIFF="$(which diff)"
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
- exit 1
-fi
-
diff --git a/tests/shell/testcases/maps/0006interval_map_overlap_0 b/tests/shell/testcases/maps/0006interval_map_overlap_0
index 8597639e..682ac65b 100755
--- a/tests/shell/testcases/maps/0006interval_map_overlap_0
+++ b/tests/shell/testcases/maps/0006interval_map_overlap_0
@@ -25,17 +25,3 @@ echo "add element x y { 10.0.${n}.0/24 : 10.0.0.${n} }" > $tmpfile
$NFT -f $tmpfile
-EXPECTED="table ip x {
- map y {
- type ipv4_addr : ipv4_addr
- flags interval
- elements = { 10.0.1.0/24 : 10.0.0.1, 10.0.2.0/24 : 10.0.0.2 }
- }
-}"
-GET=$($NFT list ruleset)
-if [ "$EXPECTED" != "$GET" ] ; then
- DIFF="$(which diff)"
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
- exit 1
-fi
-
diff --git a/tests/shell/testcases/maps/0007named_ifname_dtype_0 b/tests/shell/testcases/maps/0007named_ifname_dtype_0
index dcbcf2f0..5e51a605 100755
--- a/tests/shell/testcases/maps/0007named_ifname_dtype_0
+++ b/tests/shell/testcases/maps/0007named_ifname_dtype_0
@@ -26,10 +26,3 @@ set -e
echo "$EXPECTED" > $tmpfile
$NFT -f $tmpfile
-GET="$($NFT list ruleset)"
-if [ "$EXPECTED" != "$GET" ] ; then
- DIFF="$(which diff)"
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
- exit 1
-fi
-
diff --git a/tests/shell/testcases/maps/dumps/0005interval_map_add_many_elements_0.nft b/tests/shell/testcases/maps/dumps/0005interval_map_add_many_elements_0.nft
new file mode 100644
index 00000000..ab992c4a
--- /dev/null
+++ b/tests/shell/testcases/maps/dumps/0005interval_map_add_many_elements_0.nft
@@ -0,0 +1,8 @@
+table ip x {
+ map y {
+ type ipv4_addr : ipv4_addr
+ flags interval
+ elements = { 10.1.1.0/24 : 10.0.1.1, 10.1.2.0/24 : 10.0.1.2,
+ 10.2.1.0/24 : 10.0.2.1, 10.2.2.0/24 : 10.0.2.2 }
+ }
+}
diff --git a/tests/shell/testcases/maps/dumps/0006interval_map_overlap_0.nft b/tests/shell/testcases/maps/dumps/0006interval_map_overlap_0.nft
new file mode 100644
index 00000000..1f5343f4
--- /dev/null
+++ b/tests/shell/testcases/maps/dumps/0006interval_map_overlap_0.nft
@@ -0,0 +1,7 @@
+table ip x {
+ map y {
+ type ipv4_addr : ipv4_addr
+ flags interval
+ elements = { 10.0.1.0/24 : 10.0.0.1, 10.0.2.0/24 : 10.0.0.2 }
+ }
+}
diff --git a/tests/shell/testcases/maps/dumps/0007named_ifname_dtype_0.nft b/tests/shell/testcases/maps/dumps/0007named_ifname_dtype_0.nft
new file mode 100644
index 00000000..878e7c06
--- /dev/null
+++ b/tests/shell/testcases/maps/dumps/0007named_ifname_dtype_0.nft
@@ -0,0 +1,11 @@
+table inet t {
+ map m1 {
+ type ifname : ipv4_addr
+ elements = { "eth0" : 1.1.1.1 }
+ }
+
+ chain c {
+ ip daddr set iifname map @m1
+ ip daddr set oifname map @m1
+ }
+}
diff --git a/tests/shell/testcases/maps/dumps/anonymous_snat_map_0.nft b/tests/shell/testcases/maps/dumps/anonymous_snat_map_0.nft
new file mode 100644
index 00000000..5009560c
--- /dev/null
+++ b/tests/shell/testcases/maps/dumps/anonymous_snat_map_0.nft
@@ -0,0 +1,5 @@
+table ip nat {
+ chain postrouting {
+ snat to ip saddr map { 1.1.1.1 : 2.2.2.2 }
+ }
+}
diff --git a/tests/shell/testcases/maps/dumps/map_with_flags_0.nft b/tests/shell/testcases/maps/dumps/map_with_flags_0.nft
new file mode 100644
index 00000000..c96b1ed2
--- /dev/null
+++ b/tests/shell/testcases/maps/dumps/map_with_flags_0.nft
@@ -0,0 +1,6 @@
+table ip x {
+ map y {
+ type ipv4_addr : ipv4_addr
+ flags timeout
+ }
+}
diff --git a/tests/shell/testcases/maps/dumps/named_snat_map_0.nft b/tests/shell/testcases/maps/dumps/named_snat_map_0.nft
new file mode 100644
index 00000000..a7c57518
--- /dev/null
+++ b/tests/shell/testcases/maps/dumps/named_snat_map_0.nft
@@ -0,0 +1,10 @@
+table ip nat {
+ map m {
+ type ipv4_addr : ipv4_addr
+ elements = { 1.1.1.1 : 2.2.2.2 }
+ }
+
+ chain postrouting {
+ snat to ip saddr map @m
+ }
+}
diff --git a/tests/shell/testcases/maps/map_with_flags_0 b/tests/shell/testcases/maps/map_with_flags_0
index 8774eb51..68bd80d2 100755
--- a/tests/shell/testcases/maps/map_with_flags_0
+++ b/tests/shell/testcases/maps/map_with_flags_0
@@ -4,18 +4,3 @@ set -e
$NFT add table x
$NFT add map x y { type ipv4_addr : ipv4_addr\; flags timeout\; }
-
-EXPECTED="table ip x {
- map y {
- type ipv4_addr : ipv4_addr
- flags timeout
- }
-}"
-
-GET="$($NFT list ruleset)"
-
-if [ "$EXPECTED" != "$GET" ] ; then
- DIFF="$(which diff)"
- [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
- exit 1
-fi