diff mbox series

[nft,6/9] JSON: Rename (v)map expression properties

Message ID 20180829142328.9891-7-phil@nwl.cc
State Accepted
Delegated to: Pablo Neira
Headers show
Series JSON schema review | expand

Commit Message

Phil Sutter Aug. 29, 2018, 2:23 p.m. UTC
Change the rather generic "left" and "right" into "key" and "data" as
suggested at NFWS.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 doc/libnftables-json.adoc         |  16 +--
 src/json.c                        |   4 +-
 src/parser_json.c                 |  22 ++--
 tests/py/any/ct.t.json            |  12 +--
 tests/py/any/ct.t.json.output     |   4 +-
 tests/py/any/dup.t.json           |   4 +-
 tests/py/any/fwd.t.json           |   4 +-
 tests/py/any/fwd.t.json.output    |   4 +-
 tests/py/any/meta.t.json          |   4 +-
 tests/py/inet/fib.t.json          |   4 +-
 tests/py/inet/fib.t.json.output   |   4 +-
 tests/py/inet/map.t.json          |   8 +-
 tests/py/inet/map.t.json.output   |   8 +-
 tests/py/inet/tcp.t.json          |  12 +--
 tests/py/ip/dnat.t.json           |   8 +-
 tests/py/ip/dnat.t.json.output    |   8 +-
 tests/py/ip/dup.t.json            |   4 +-
 tests/py/ip/hash.t.json           |   4 +-
 tests/py/ip/ip.t.json             |   8 +-
 tests/py/ip/masquerade.t.json     |   4 +-
 tests/py/ip/numgen.t.json         |   8 +-
 tests/py/ip/numgen.t.json.output  |   8 +-
 tests/py/ip/objects.t.json        |  16 +--
 tests/py/ip/objects.t.json.output |   8 +-
 tests/py/ip/redirect.t.json       |   8 +-
 tests/py/ip6/dup.t.json           |   4 +-
 tests/py/ip6/ip6.t.json           |   8 +-
 tests/py/ip6/ip6.t.json.output    |   4 +-
 tests/py/ip6/map.t.json           |   4 +-
 tests/py/ip6/map.t.json.output    |   4 +-
 tests/py/ip6/masquerade.t.json    |   4 +-
 tests/py/ip6/redirect.t.json      |   8 +-
 tests/py/ip6/vmap.t.json          | 168 +++++++++++++++---------------
 tests/py/ip6/vmap.t.json.output   |  52 ++++-----
 34 files changed, 225 insertions(+), 225 deletions(-)
diff mbox series

Patch

diff --git a/doc/libnftables-json.adoc b/doc/libnftables-json.adoc
index 6000e98d61ce9..ab11d7dff92a5 100644
--- a/doc/libnftables-json.adoc
+++ b/doc/libnftables-json.adoc
@@ -895,15 +895,15 @@  Queue the packet to userspace.
 === VERDICT MAP
 [verse]
 *{ "vmap": {
-	"left":* 'EXPRESSION'*,
-	"right":* 'EXPRESSION'
+	"key":* 'EXPRESSION'*,
+	"data":* 'EXPRESSION'
 *}}*
 
 Apply a verdict conditionally.
 
-*left*::
+*key*::
 	Map key.
-*right*::
+*data*::
 	Mapping expression consisting of value/verdict pairs.
 
 === CT COUNT
@@ -972,15 +972,15 @@  exactly two elements is expected.
 === MAP
 [verse]
 *{ "map": {
-	"left":* 'EXPRESSION'*,
-	"right":* 'EXPRESSION'
+	"key":* 'EXPRESSION'*,
+	"data":* 'EXPRESSION'
 *}}*
 
 Map a key to a value.
 
-*left*::
+*key*::
 	Map key.
-*right*::
+*data*::
 	Mapping expression consisting of value/target pairs.
 
 === PREFIX
diff --git a/src/json.c b/src/json.c
index cb3c0aeb36534..5cd0c35e789c2 100644
--- a/src/json.c
+++ b/src/json.c
@@ -563,8 +563,8 @@  json_t *map_expr_json(const struct expr *expr, struct output_ctx *octx)
 		type = "vmap";
 
 	return json_pack("{s:{s:o, s:o}}", type,
-			 "left", expr_print_json(expr->map, octx),
-			 "right", expr_print_json(expr->mappings, octx));
+			 "key", expr_print_json(expr->map, octx),
+			 "data", expr_print_json(expr->mappings, octx));
 }
 
 json_t *exthdr_expr_json(const struct expr *expr, struct output_ctx *octx)
diff --git a/src/parser_json.c b/src/parser_json.c
index 822081b676fcd..8b695cecb9e6b 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -1103,27 +1103,27 @@  static struct expr *json_parse_set_expr(struct json_ctx *ctx,
 static struct expr *json_parse_map_expr(struct json_ctx *ctx,
 					const char *type, json_t *root)
 {
-	json_t *jleft, *jright;
-	struct expr *left, *right;
+	json_t *jkey, *jdata;
+	struct expr *key, *data;
 
 	if (json_unpack_err(ctx, root, "{s:o, s:o}",
-			    "left", &jleft, "right", &jright))
+			    "key", &jkey, "data", &jdata))
 		return NULL;
 
-	left = json_parse_map_lhs_expr(ctx, jleft);
-	if (!left) {
-		json_error(ctx, "Illegal LHS of map expression.");
+	key = json_parse_map_lhs_expr(ctx, jkey);
+	if (!key) {
+		json_error(ctx, "Illegal map expression key.");
 		return NULL;
 	}
 
-	right = json_parse_rhs_expr(ctx, jright);
-	if (!right) {
-		json_error(ctx, "Illegal RHS of map expression.");
-		expr_free(left);
+	data = json_parse_rhs_expr(ctx, jdata);
+	if (!data) {
+		json_error(ctx, "Illegal map expression data.");
+		expr_free(key);
 		return NULL;
 	}
 
-	return map_expr_alloc(int_loc, left, right);
+	return map_expr_alloc(int_loc, key, data);
 }
 
 static struct expr *json_parse_set_elem_expr(struct json_ctx *ctx,
diff --git a/tests/py/any/ct.t.json b/tests/py/any/ct.t.json
index bca6d578fc544..8e3127957b00c 100644
--- a/tests/py/any/ct.t.json
+++ b/tests/py/any/ct.t.json
@@ -692,10 +692,10 @@ 
             },
             "right": {
                 "map": {
-                    "left": {
+                    "key": {
                         "meta": { "key": "mark" }
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [ 1, 10 ],
                             [ 2, 20 ],
@@ -1010,7 +1010,7 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "concat": [
                     {
                         "ct": {
@@ -1024,7 +1024,7 @@ 
                     }
                 ]
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         {
@@ -1359,10 +1359,10 @@ 
             },
             "right": {
                 "map": {
-                    "left": {
+                    "key": {
                         "meta": { "key": "mark" }
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [ 1, 1 ],
                             [ 2, 2 ]
diff --git a/tests/py/any/ct.t.json.output b/tests/py/any/ct.t.json.output
index f6b6a90701aab..eb11ecc4f9217 100644
--- a/tests/py/any/ct.t.json.output
+++ b/tests/py/any/ct.t.json.output
@@ -571,7 +571,7 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "concat": [
                     {
                         "ct": {
@@ -585,7 +585,7 @@ 
                     }
                 ]
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         {
diff --git a/tests/py/any/dup.t.json b/tests/py/any/dup.t.json
index 9cf0274e64551..dc56f649ba97c 100644
--- a/tests/py/any/dup.t.json
+++ b/tests/py/any/dup.t.json
@@ -13,10 +13,10 @@ 
         "dup": {
             "addr": {
                 "map": {
-                    "left": {
+                    "key": {
                         "meta": { "key": "mark" }
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [ 1, "lo" ],
                             [ 2, "lo" ]
diff --git a/tests/py/any/fwd.t.json b/tests/py/any/fwd.t.json
index 16299007a19da..583606c006691 100644
--- a/tests/py/any/fwd.t.json
+++ b/tests/py/any/fwd.t.json
@@ -13,10 +13,10 @@ 
         "fwd": {
             "dev": {
                 "map": {
-                    "left": {
+                    "key": {
                         "meta": { "key": "mark" }
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 "0x00000001",
diff --git a/tests/py/any/fwd.t.json.output b/tests/py/any/fwd.t.json.output
index e5714e9f4ba40..8433e492c1b57 100644
--- a/tests/py/any/fwd.t.json.output
+++ b/tests/py/any/fwd.t.json.output
@@ -4,10 +4,10 @@ 
         "fwd": {
             "dev": {
                 "map": {
-                    "left": {
+                    "key": {
                         "meta": { "key": "mark" }
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 1,
diff --git a/tests/py/any/meta.t.json b/tests/py/any/meta.t.json
index 4da6aa4a5d62d..9149b641ef6a8 100644
--- a/tests/py/any/meta.t.json
+++ b/tests/py/any/meta.t.json
@@ -2362,7 +2362,7 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "concat": [
                     {
                         "meta": { "key": "iif" }
@@ -2372,7 +2372,7 @@ 
                     }
                 ]
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         {
diff --git a/tests/py/inet/fib.t.json b/tests/py/inet/fib.t.json
index 00c79abc05006..92bb5ec098386 100644
--- a/tests/py/inet/fib.t.json
+++ b/tests/py/inet/fib.t.json
@@ -57,7 +57,7 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "fib": {
                     "flags": [
                         "daddr",
@@ -66,7 +66,7 @@ 
                     "result": "type"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "blackhole",
diff --git a/tests/py/inet/fib.t.json.output b/tests/py/inet/fib.t.json.output
index b06e488ac2d14..52cd46bc0e121 100644
--- a/tests/py/inet/fib.t.json.output
+++ b/tests/py/inet/fib.t.json.output
@@ -2,7 +2,7 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "fib": {
                     "flags": [
                         "daddr",
@@ -11,7 +11,7 @@ 
                     "result": "type"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "unicast",
diff --git a/tests/py/inet/map.t.json b/tests/py/inet/map.t.json
index 7fc2ac33b5231..207ac3f3f0c73 100644
--- a/tests/py/inet/map.t.json
+++ b/tests/py/inet/map.t.json
@@ -7,13 +7,13 @@ 
             },
             "right": {
                 "map": {
-                    "left": {
+                    "key": {
                         "payload": {
                             "field": "saddr",
                             "protocol": "ip"
                         }
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 "10.2.3.2",
@@ -40,13 +40,13 @@ 
             },
             "right": {
                 "map": {
-                    "left": {
+                    "key": {
                         "payload": {
                             "field": "hdrlength",
                             "protocol": "ip"
                         }
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 5,
diff --git a/tests/py/inet/map.t.json.output b/tests/py/inet/map.t.json.output
index 6e5238e38f05b..9c235e3060b0c 100644
--- a/tests/py/inet/map.t.json.output
+++ b/tests/py/inet/map.t.json.output
@@ -7,13 +7,13 @@ 
             },
             "right": {
                 "map": {
-                    "left": {
+                    "key": {
                         "payload": {
                             "field": "saddr",
                             "protocol": "ip"
                         }
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 "10.2.3.1",
@@ -40,13 +40,13 @@ 
             },
             "right": {
                 "map": {
-                    "left": {
+                    "key": {
                         "payload": {
                             "field": "hdrlength",
                             "protocol": "ip"
                         }
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 4,
diff --git a/tests/py/inet/tcp.t.json b/tests/py/inet/tcp.t.json
index a1ad4aba91e2b..48304d6ae3abe 100644
--- a/tests/py/inet/tcp.t.json
+++ b/tests/py/inet/tcp.t.json
@@ -176,13 +176,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "dport",
                     "protocol": "tcp"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         22,
@@ -206,13 +206,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "dport",
                     "protocol": "tcp"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         25,
@@ -431,13 +431,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "sport",
                     "protocol": "tcp"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         25,
diff --git a/tests/py/ip/dnat.t.json b/tests/py/ip/dnat.t.json
index 3efa220c6ae8d..c4ae8302e6514 100644
--- a/tests/py/ip/dnat.t.json
+++ b/tests/py/ip/dnat.t.json
@@ -194,12 +194,12 @@ 
         "dnat": {
             "addr": {
                 "map": {
-                    "left": {
+                    "key": {
                         "ct": {
                             "key": "mark"
                         }
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 "0x00000014",
@@ -219,7 +219,7 @@ 
         "dnat": {
             "addr": {
                 "map": {
-                    "left": {
+                    "key": {
                         "concat": [
                             {
                                 "ct": {
@@ -234,7 +234,7 @@ 
                             }
                         ]
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 {
diff --git a/tests/py/ip/dnat.t.json.output b/tests/py/ip/dnat.t.json.output
index e1727063dd95d..4f2c6dfcf2a7c 100644
--- a/tests/py/ip/dnat.t.json.output
+++ b/tests/py/ip/dnat.t.json.output
@@ -4,12 +4,12 @@ 
         "dnat": {
             "addr": {
                 "map": {
-                    "left": {
+                    "key": {
                         "ct": {
                             "key": "mark"
                         }
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 20,
@@ -29,7 +29,7 @@ 
         "dnat": {
             "addr": {
                 "map": {
-                    "left": {
+                    "key": {
                         "concat": [
                             {
                                 "ct": {
@@ -44,7 +44,7 @@ 
                             }
                         ]
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 {
diff --git a/tests/py/ip/dup.t.json b/tests/py/ip/dup.t.json
index a555fc4f94ebe..aa1e82698a90c 100644
--- a/tests/py/ip/dup.t.json
+++ b/tests/py/ip/dup.t.json
@@ -23,13 +23,13 @@ 
         "dup": {
             "addr": {
                 "map": {
-                    "left": {
+                    "key": {
                         "payload": {
                             "field": "saddr",
                             "protocol": "ip"
                         }
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 "192.168.2.120",
diff --git a/tests/py/ip/hash.t.json b/tests/py/ip/hash.t.json
index 640d9aa5b5ae1..febf02740ccc0 100644
--- a/tests/py/ip/hash.t.json
+++ b/tests/py/ip/hash.t.json
@@ -179,7 +179,7 @@ 
         "dnat": {
             "addr": {
                 "map": {
-                    "left": {
+                    "key": {
                         "jhash": {
                             "expr": {
                                 "payload": {
@@ -191,7 +191,7 @@ 
                             "seed": 3735928559
                         }
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 0,
diff --git a/tests/py/ip/ip.t.json b/tests/py/ip/ip.t.json
index a8766cb203b19..3e4f2d8027cce 100644
--- a/tests/py/ip/ip.t.json
+++ b/tests/py/ip/ip.t.json
@@ -124,13 +124,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "dscp",
                     "protocol": "ip"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "cs1",
@@ -1543,13 +1543,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "hdrlength",
                     "protocol": "ip"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         { "range": [ 0, 4 ] },
diff --git a/tests/py/ip/masquerade.t.json b/tests/py/ip/masquerade.t.json
index 641487677adc5..79c80804591cd 100644
--- a/tests/py/ip/masquerade.t.json
+++ b/tests/py/ip/masquerade.t.json
@@ -380,13 +380,13 @@ 
     },
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "dport",
                     "protocol": "tcp"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         22,
diff --git a/tests/py/ip/numgen.t.json b/tests/py/ip/numgen.t.json
index 70514abb81ad3..5318a0f539b7c 100644
--- a/tests/py/ip/numgen.t.json
+++ b/tests/py/ip/numgen.t.json
@@ -43,13 +43,13 @@ 
         "dnat": {
             "addr": {
                 "map": {
-                    "left": {
+                    "key": {
                         "numgen": {
                             "mod": 2,
                             "mode": "inc"
                         }
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 0,
@@ -73,13 +73,13 @@ 
         "dnat": {
             "addr": {
                 "map": {
-                    "left": {
+                    "key": {
                         "numgen": {
                             "mod": 10,
                             "mode": "inc"
                         }
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 { "range": [ 0, 5 ] },
diff --git a/tests/py/ip/numgen.t.json.output b/tests/py/ip/numgen.t.json.output
index 7a9895511aa19..ffab43bae4536 100644
--- a/tests/py/ip/numgen.t.json.output
+++ b/tests/py/ip/numgen.t.json.output
@@ -24,14 +24,14 @@ 
         "dnat": {
             "addr": {
                 "map": {
-                    "left": {
+                    "key": {
                         "numgen": {
                             "mod": 2,
                             "mode": "inc",
                             "offset": 0
                         }
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 0,
@@ -55,14 +55,14 @@ 
         "dnat": {
             "addr": {
                 "map": {
-                    "left": {
+                    "key": {
                         "numgen": {
                             "mod": 10,
                             "mode": "inc",
                             "offset": 0
                         }
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 { "range": [ 0, 5 ] },
diff --git a/tests/py/ip/objects.t.json b/tests/py/ip/objects.t.json
index f3036b0407f2f..953e5570ac9c6 100644
--- a/tests/py/ip/objects.t.json
+++ b/tests/py/ip/objects.t.json
@@ -21,13 +21,13 @@ 
     {
         "counter": {
             "map": {
-                "left": {
+                "key": {
                     "payload": {
                         "field": "dport",
                         "protocol": "tcp"
                     }
                 },
-                "right": {
+                "data": {
                     "set": [
                         [
                             443,
@@ -71,13 +71,13 @@ 
     {
         "quota": {
             "map": {
-                "left": {
+                "key": {
                     "payload": {
                         "field": "dport",
                         "protocol": "tcp"
                     }
                 },
-                "right": {
+                "data": {
                     "set": [
                         [
                             443,
@@ -110,13 +110,13 @@ 
     {
         "ct helper": {
             "map": {
-                "left": {
+                "key": {
                     "payload": {
                         "field": "dport",
                         "protocol": "tcp"
                     }
                 },
-                "right": {
+                "data": {
                     "set": [
                         [
                             21,
@@ -156,13 +156,13 @@ 
     {
         "limit": {
             "map": {
-                "left": {
+                "key": {
                     "payload": {
                         "field": "dport",
                         "protocol": "tcp"
                     }
                 },
-                "right": {
+                "data": {
                     "set": [
                         [
                             22,
diff --git a/tests/py/ip/objects.t.json.output b/tests/py/ip/objects.t.json.output
index e5cb8feb2325f..ade195d65bd1b 100644
--- a/tests/py/ip/objects.t.json.output
+++ b/tests/py/ip/objects.t.json.output
@@ -3,13 +3,13 @@ 
     {
         "counter": {
             "map": {
-                "left": {
+                "key": {
                     "payload": {
                         "field": "dport",
                         "protocol": "tcp"
                     }
                 },
-                "right": {
+                "data": {
                     "set": [
                         [
                             22,
@@ -35,13 +35,13 @@ 
     {
         "quota": {
             "map": {
-                "left": {
+                "key": {
                     "payload": {
                         "field": "dport",
                         "protocol": "tcp"
                     }
                 },
-                "right": {
+                "data": {
                     "set": [
                         [
                             22,
diff --git a/tests/py/ip/redirect.t.json b/tests/py/ip/redirect.t.json
index c2f264c8df76c..7ee3a516c273d 100644
--- a/tests/py/ip/redirect.t.json
+++ b/tests/py/ip/redirect.t.json
@@ -538,13 +538,13 @@ 
     },
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "dport",
                     "protocol": "tcp"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         22,
@@ -584,13 +584,13 @@ 
         "redirect": {
             "port": {
                 "map": {
-                    "left": {
+                    "key": {
                         "payload": {
                             "field": "dport",
                             "protocol": "tcp"
                         }
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 22,
diff --git a/tests/py/ip6/dup.t.json b/tests/py/ip6/dup.t.json
index 53ad8bed98ff3..8a9493b3fe8a5 100644
--- a/tests/py/ip6/dup.t.json
+++ b/tests/py/ip6/dup.t.json
@@ -23,13 +23,13 @@ 
         "dup": {
             "addr": {
                 "map": {
-                    "left": {
+                    "key": {
                         "payload": {
                             "field": "saddr",
                             "protocol": "ip6"
                         }
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 "abcd::1",
diff --git a/tests/py/ip6/ip6.t.json b/tests/py/ip6/ip6.t.json
index 26f2e41f0e107..a0a3079a8a940 100644
--- a/tests/py/ip6/ip6.t.json
+++ b/tests/py/ip6/ip6.t.json
@@ -103,13 +103,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "dscp",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "0x04",
@@ -251,13 +251,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "flowlabel",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         0,
diff --git a/tests/py/ip6/ip6.t.json.output b/tests/py/ip6/ip6.t.json.output
index 2e548ca317cdb..2b8147216a20d 100644
--- a/tests/py/ip6/ip6.t.json.output
+++ b/tests/py/ip6/ip6.t.json.output
@@ -72,13 +72,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "dscp",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         4,
diff --git a/tests/py/ip6/map.t.json b/tests/py/ip6/map.t.json
index 1117117e1293d..2ddb3080d5844 100644
--- a/tests/py/ip6/map.t.json
+++ b/tests/py/ip6/map.t.json
@@ -7,7 +7,7 @@ 
             },
             "right": {
                 "map": {
-                    "left": {
+                    "key": {
                         "&": [
                             {
                                 "payload": {
@@ -18,7 +18,7 @@ 
                             "::ffff"
                         ]
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 "::2",
diff --git a/tests/py/ip6/map.t.json.output b/tests/py/ip6/map.t.json.output
index 59922df7d49a3..84343763b98fe 100644
--- a/tests/py/ip6/map.t.json.output
+++ b/tests/py/ip6/map.t.json.output
@@ -7,7 +7,7 @@ 
             },
             "right": {
                 "map": {
-                    "left": {
+                    "key": {
                         "&": [
                             {
                                 "payload": {
@@ -18,7 +18,7 @@ 
                             "::ffff"
                         ]
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 "::2",
diff --git a/tests/py/ip6/masquerade.t.json b/tests/py/ip6/masquerade.t.json
index 5071e42c4086d..ae00651050568 100644
--- a/tests/py/ip6/masquerade.t.json
+++ b/tests/py/ip6/masquerade.t.json
@@ -374,13 +374,13 @@ 
     },
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "dport",
                     "protocol": "tcp"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         22,
diff --git a/tests/py/ip6/redirect.t.json b/tests/py/ip6/redirect.t.json
index 9715c733f45d3..bd3df47fc2171 100644
--- a/tests/py/ip6/redirect.t.json
+++ b/tests/py/ip6/redirect.t.json
@@ -504,13 +504,13 @@ 
     },
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "dport",
                     "protocol": "tcp"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         22,
@@ -550,13 +550,13 @@ 
         "redirect": {
             "port": {
                 "map": {
-                    "left": {
+                    "key": {
                         "payload": {
                             "field": "dport",
                             "protocol": "tcp"
                         }
                     },
-                    "right": {
+                    "data": {
                         "set": [
                             [
                                 22,
diff --git a/tests/py/ip6/vmap.t.json b/tests/py/ip6/vmap.t.json
index aa299864c1523..1b867ff076928 100644
--- a/tests/py/ip6/vmap.t.json
+++ b/tests/py/ip6/vmap.t.json
@@ -2,13 +2,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "abcd::3",
@@ -26,13 +26,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234:1234:1234:1234:1234:1234",
@@ -50,13 +50,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "::1234:1234:1234:1234:1234:1234:1234",
@@ -74,13 +74,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234::1234:1234:1234:1234:1234:1234",
@@ -98,13 +98,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234::1234:1234:1234:1234:1234",
@@ -122,13 +122,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234::1234:1234:1234:1234",
@@ -146,13 +146,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234:1234::1234:1234:1234",
@@ -170,13 +170,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234:1234:1234::1234:1234",
@@ -194,13 +194,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234:1234:1234:1234::1234",
@@ -218,13 +218,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234:1234:1234:1234:1234::",
@@ -242,13 +242,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "::1234:1234:1234:1234:1234:1234",
@@ -266,13 +266,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234::1234:1234:1234:1234:1234",
@@ -290,13 +290,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234::1234:1234:1234:1234",
@@ -314,13 +314,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234::1234:1234:1234",
@@ -338,13 +338,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234:1234::1234:1234",
@@ -362,13 +362,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234:1234:1234::1234",
@@ -386,13 +386,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234:1234:1234:1234::",
@@ -410,13 +410,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "::1234:1234:1234:1234:1234",
@@ -434,13 +434,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234::1234:1234:1234:1234",
@@ -458,13 +458,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234::1234:1234:1234",
@@ -482,13 +482,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234::1234:1234",
@@ -506,13 +506,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234:1234::1234",
@@ -530,13 +530,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234:1234:1234::",
@@ -554,13 +554,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "::1234:1234:1234:1234",
@@ -578,13 +578,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234::1234:1234:1234",
@@ -602,13 +602,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234::1234:1234",
@@ -626,13 +626,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234::1234",
@@ -650,13 +650,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234:1234::",
@@ -674,13 +674,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "::1234:1234:1234",
@@ -698,13 +698,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234::1234:1234",
@@ -722,13 +722,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234::1234",
@@ -746,13 +746,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234::",
@@ -770,13 +770,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "::1234:1234",
@@ -794,13 +794,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234::1234",
@@ -818,13 +818,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234::",
@@ -842,13 +842,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "::1234",
@@ -866,13 +866,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234::",
@@ -890,13 +890,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         {
@@ -919,13 +919,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234:1234:1234:1234:aaaa::",
@@ -949,13 +949,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234:1234:1234:1234:aaaa::",
@@ -979,13 +979,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234:1234:1234:1234:aaaa::",
@@ -1009,13 +1009,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234:1234:1234:1234:aaaa::",
diff --git a/tests/py/ip6/vmap.t.json.output b/tests/py/ip6/vmap.t.json.output
index a0ec0c91ee789..affe383bca4af 100644
--- a/tests/py/ip6/vmap.t.json.output
+++ b/tests/py/ip6/vmap.t.json.output
@@ -2,13 +2,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "0:1234:1234:1234:1234:1234:1234:1234",
@@ -26,13 +26,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:0:1234:1234:1234:1234:1234:1234",
@@ -50,13 +50,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:0:1234:1234:1234:1234:1234",
@@ -74,13 +74,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234:0:1234:1234:1234:1234",
@@ -98,13 +98,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234:1234:0:1234:1234:1234",
@@ -122,13 +122,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234:1234:1234:0:1234:1234",
@@ -146,13 +146,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234:1234:1234:1234:0:1234",
@@ -170,13 +170,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "1234:1234:1234:1234:1234:1234:1234:0",
@@ -194,13 +194,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "::18.52.18.52",
@@ -218,13 +218,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "::aaaa",
@@ -248,13 +248,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "::bbbb",
@@ -278,13 +278,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "::cccc",
@@ -308,13 +308,13 @@ 
 [
     {
         "vmap": {
-            "left": {
+            "key": {
                 "payload": {
                     "field": "saddr",
                     "protocol": "ip6"
                 }
             },
-            "right": {
+            "data": {
                 "set": [
                     [
                         "::dddd",