From 90d4ee087171e75d5313359ad6b6f1341e51ddc5 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Wed, 29 Aug 2018 16:23:27 +0200 Subject: JSON: Make match op mandatory, introduce 'in' operator This special operator is required for cases where missing operator does not lead to same results as equal operator, i.e. with bitmasks on RHS. Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- tests/py/bridge/ether.t.json | 13 +++++++++++++ tests/py/bridge/ether.t.json.output | 6 ++++++ tests/py/bridge/icmpX.t.json | 6 ++++++ tests/py/bridge/icmpX.t.json.output | 4 ++++ tests/py/bridge/meta.t.json | 2 ++ tests/py/bridge/reject.t.json | 4 ++++ tests/py/bridge/reject.t.json.output | 13 +++++++++++++ tests/py/bridge/vlan.t.json | 33 +++++++++++++++++++++++++++++++++ 8 files changed, 81 insertions(+) (limited to 'tests/py/bridge') diff --git a/tests/py/bridge/ether.t.json b/tests/py/bridge/ether.t.json index d9a0066b..485ceee4 100644 --- a/tests/py/bridge/ether.t.json +++ b/tests/py/bridge/ether.t.json @@ -8,6 +8,7 @@ "protocol": "tcp" } }, + "op": "==", "right": 22 } }, @@ -16,6 +17,7 @@ "left": { "meta": { "key": "iiftype" } }, + "op": "==", "right": "ether" } }, @@ -27,6 +29,7 @@ "protocol": "ip" } }, + "op": "==", "right": "1.2.3.4" } }, @@ -38,6 +41,7 @@ "protocol": "ether" } }, + "op": "==", "right": "00:0f:54:0c:11:04" } }, @@ -56,6 +60,7 @@ "protocol": "tcp" } }, + "op": "==", "right": 22 } }, @@ -67,6 +72,7 @@ "protocol": "ip" } }, + "op": "==", "right": "1.2.3.4" } }, @@ -78,6 +84,7 @@ "protocol": "ether" } }, + "op": "==", "right": "00:0f:54:0c:11:04" } } @@ -93,6 +100,7 @@ "protocol": "tcp" } }, + "op": "==", "right": 22 } }, @@ -104,6 +112,7 @@ "protocol": "ether" } }, + "op": "==", "right": "00:0f:54:0c:11:04" } }, @@ -115,6 +124,7 @@ "protocol": "ip" } }, + "op": "==", "right": "1.2.3.4" } } @@ -130,6 +140,7 @@ "protocol": "ether" } }, + "op": "==", "right": "00:0f:54:0c:11:04" } }, @@ -141,6 +152,7 @@ "protocol": "ip" } }, + "op": "==", "right": "1.2.3.4" } }, @@ -159,6 +171,7 @@ "protocol": "ether" } }, + "op": "==", "right": "00:01:02:03:04:05" } }, diff --git a/tests/py/bridge/ether.t.json.output b/tests/py/bridge/ether.t.json.output index 1c3cb8dc..05e568f6 100644 --- a/tests/py/bridge/ether.t.json.output +++ b/tests/py/bridge/ether.t.json.output @@ -8,6 +8,7 @@ "protocol": "tcp" } }, + "op": "==", "right": 22 } }, @@ -19,6 +20,7 @@ "protocol": "ether" } }, + "op": "==", "right": "00:0f:54:0c:11:04" } }, @@ -30,6 +32,7 @@ "protocol": "ip" } }, + "op": "==", "right": "1.2.3.4" } }, @@ -48,6 +51,7 @@ "protocol": "tcp" } }, + "op": "==", "right": 22 } }, @@ -59,6 +63,7 @@ "protocol": "ether" } }, + "op": "==", "right": "00:0f:54:0c:11:04" } }, @@ -70,6 +75,7 @@ "protocol": "ip" } }, + "op": "==", "right": "1.2.3.4" } } diff --git a/tests/py/bridge/icmpX.t.json b/tests/py/bridge/icmpX.t.json index 830bb799..2dd341ec 100644 --- a/tests/py/bridge/icmpX.t.json +++ b/tests/py/bridge/icmpX.t.json @@ -8,6 +8,7 @@ "protocol": "ip" } }, + "op": "==", "right": "icmp" } }, @@ -19,6 +20,7 @@ "protocol": "icmp" } }, + "op": "==", "right": "echo-request" } } @@ -34,6 +36,7 @@ "protocol": "icmp" } }, + "op": "==", "right": "echo-request" } } @@ -49,6 +52,7 @@ "protocol": "ip6" } }, + "op": "==", "right": "icmpv6" } }, @@ -60,6 +64,7 @@ "protocol": "icmpv6" } }, + "op": "==", "right": "echo-request" } } @@ -75,6 +80,7 @@ "protocol": "icmpv6" } }, + "op": "==", "right": "echo-request" } } diff --git a/tests/py/bridge/icmpX.t.json.output b/tests/py/bridge/icmpX.t.json.output index ecfaa62f..8cf46791 100644 --- a/tests/py/bridge/icmpX.t.json.output +++ b/tests/py/bridge/icmpX.t.json.output @@ -8,6 +8,7 @@ "protocol": "ip" } }, + "op": "==", "right": 1 } }, @@ -19,6 +20,7 @@ "protocol": "icmp" } }, + "op": "==", "right": "echo-request" } } @@ -34,6 +36,7 @@ "protocol": "ip6" } }, + "op": "==", "right": 58 } }, @@ -45,6 +48,7 @@ "protocol": "icmpv6" } }, + "op": "==", "right": "echo-request" } } diff --git a/tests/py/bridge/meta.t.json b/tests/py/bridge/meta.t.json index 0c63e26e..5df4773a 100644 --- a/tests/py/bridge/meta.t.json +++ b/tests/py/bridge/meta.t.json @@ -5,6 +5,7 @@ "left": { "meta": { "key": "obrname" } }, + "op": "==", "right": "br0" } } @@ -17,6 +18,7 @@ "left": { "meta": { "key": "ibrname" } }, + "op": "==", "right": "br0" } } diff --git a/tests/py/bridge/reject.t.json b/tests/py/bridge/reject.t.json index 0ced129c..d20a1d8b 100644 --- a/tests/py/bridge/reject.t.json +++ b/tests/py/bridge/reject.t.json @@ -115,6 +115,7 @@ "left": { "meta": { "key": "mark" } }, + "op": "==", "right": 12345 } }, @@ -126,6 +127,7 @@ "protocol": "ip" } }, + "op": "==", "right": "tcp" } }, @@ -153,6 +155,7 @@ "protocol": "ether" } }, + "op": "==", "right": "ip" } }, @@ -171,6 +174,7 @@ "protocol": "ether" } }, + "op": "==", "right": "ip6" } }, diff --git a/tests/py/bridge/reject.t.json.output b/tests/py/bridge/reject.t.json.output index a83feabc..08dfaf6a 100644 --- a/tests/py/bridge/reject.t.json.output +++ b/tests/py/bridge/reject.t.json.output @@ -8,6 +8,7 @@ "protocol": "ether" } }, + "op": "==", "right": "ip" } }, @@ -29,6 +30,7 @@ "protocol": "ether" } }, + "op": "==", "right": "ip" } }, @@ -50,6 +52,7 @@ "protocol": "ether" } }, + "op": "==", "right": "ip" } }, @@ -71,6 +74,7 @@ "protocol": "ether" } }, + "op": "==", "right": "ip" } }, @@ -89,6 +93,7 @@ "protocol": "ether" } }, + "op": "==", "right": "ip" } }, @@ -110,6 +115,7 @@ "protocol": "ether" } }, + "op": "==", "right": "ip" } }, @@ -131,6 +137,7 @@ "protocol": "ether" } }, + "op": "==", "right": "ip" } }, @@ -152,6 +159,7 @@ "protocol": "ether" } }, + "op": "==", "right": "ip6" } }, @@ -173,6 +181,7 @@ "protocol": "ether" } }, + "op": "==", "right": "ip6" } }, @@ -194,6 +203,7 @@ "protocol": "ether" } }, + "op": "==", "right": "ip6" } }, @@ -215,6 +225,7 @@ "protocol": "ether" } }, + "op": "==", "right": "ip6" } }, @@ -230,6 +241,7 @@ "left": { "meta": { "key": "mark" } }, + "op": "==", "right": 12345 } }, @@ -241,6 +253,7 @@ "protocol": "ip" } }, + "op": "==", "right": 6 } }, diff --git a/tests/py/bridge/vlan.t.json b/tests/py/bridge/vlan.t.json index 7facb61b..1a654640 100644 --- a/tests/py/bridge/vlan.t.json +++ b/tests/py/bridge/vlan.t.json @@ -8,6 +8,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 4094 } } @@ -23,6 +24,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 0 } } @@ -38,6 +40,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 4094 } }, @@ -49,6 +52,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 0 } } @@ -64,6 +68,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 4094 } }, @@ -91,6 +96,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 4094 } }, @@ -102,6 +108,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 1 } } @@ -117,6 +124,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 4094 } }, @@ -128,6 +136,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 1 } }, @@ -139,6 +148,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 7 } } @@ -154,6 +164,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 4094 } }, @@ -165,6 +176,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 1 } }, @@ -176,6 +188,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 3 } } @@ -191,6 +204,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 4094 } } @@ -206,6 +220,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 0 } } @@ -221,6 +236,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 4094 } }, @@ -232,6 +248,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 0 } } @@ -247,6 +264,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 4094 } }, @@ -258,6 +276,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 1 } } @@ -273,6 +292,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 4094 } }, @@ -284,6 +304,7 @@ "protocol": "tcp" } }, + "op": "==", "right": 22 } } @@ -299,6 +320,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 1 } }, @@ -310,6 +332,7 @@ "protocol": "ip" } }, + "op": "==", "right": "10.0.0.1" } } @@ -325,6 +348,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 1 } }, @@ -336,6 +360,7 @@ "protocol": "ip" } }, + "op": "==", "right": { "prefix": { "addr": "10.0.0.0", @@ -356,6 +381,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 1 } }, @@ -367,6 +393,7 @@ "protocol": "ip" } }, + "op": "==", "right": { "prefix": { "addr": "10.0.0.0", @@ -383,6 +410,7 @@ "protocol": "udp" } }, + "op": "==", "right": 53 } } @@ -398,6 +426,7 @@ "protocol": "vlan" } }, + "op": "==", "right": 1 } }, @@ -409,6 +438,7 @@ "protocol": "ip" } }, + "op": "==", "right": { "prefix": { "addr": "10.0.0.0", @@ -425,6 +455,7 @@ "protocol": "udp" } }, + "op": "==", "right": 53 } } @@ -440,6 +471,7 @@ "protocol": "vlan" } }, + "op": "==", "right": { "set": [ 1, @@ -459,6 +491,7 @@ "protocol": "vlan" } }, + "op": "==", "right": { "range": [ 1, 3 ] } -- cgit v1.2.3