diff mbox series

[ovs-dev,v4,4/8] python: ovs: flow: Add dp hash and meter actions.

Message ID 20240117111902.1607239-5-amorenoz@redhat.com
State Accepted
Delegated to: Simon Horman
Headers show
Series python: Miscelaneous flow parsing fixes. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Adrian Moreno Jan. 17, 2024, 11:18 a.m. UTC
Add missing actions.

Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
---
 python/ovs/flow/odp.py       |  9 +++++++++
 python/ovs/tests/test_odp.py | 12 ++++++++++++
 2 files changed, 21 insertions(+)
diff mbox series

Patch

diff --git a/python/ovs/flow/odp.py b/python/ovs/flow/odp.py
index ef7e5d6b8..46697a1bc 100644
--- a/python/ovs/flow/odp.py
+++ b/python/ovs/flow/odp.py
@@ -204,6 +204,7 @@  class ODPFlow(Flow):
         """Generate the arguments for the action KVDecoders."""
         _decoders = {
             "drop": decode_flag,
+            "meter": decode_int,
             "lb_output": decode_int,
             "trunc": decode_int,
             "recirc": decode_int,
@@ -334,6 +335,14 @@  class ODPFlow(Flow):
                 )
             ),
             **ODPFlow._tnl_action_decoder_args(),
+            "hash": nested_kv_decoder(
+                KVDecoders(
+                    {
+                        "l4": decode_int,
+                        "sym_l4": decode_int,
+                    }
+                )
+            ),
         }
 
         _decoders["sample"] = nested_kv_decoder(
diff --git a/python/ovs/tests/test_odp.py b/python/ovs/tests/test_odp.py
index a50d3185c..d60947a5c 100644
--- a/python/ovs/tests/test_odp.py
+++ b/python/ovs/tests/test_odp.py
@@ -534,6 +534,18 @@  def test_odp_fields(input_string, expected):
                 ),
             ],
         ),
+        (
+            "actions:meter(1),hash(l4(0))",
+            [
+                KeyValue("meter", 1),
+                KeyValue(
+                    "hash",
+                    {
+                        "l4": 0,
+                    }
+                ),
+            ],
+        ),
     ],
 )
 def test_odp_actions(input_string, expected):