diff mbox series

[ovs-dev,v1,08/11] python: interpret free keys as output in clone

Message ID 20221123100303.323460-8-amorenoz@redhat.com
State Superseded
Headers show
Series [ovs-dev,v1,01/11] python: fix datapath flow decoders | 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 Nov. 23, 2022, 10:03 a.m. UTC
clone-like actions can also output to ports by specifying the port name.

Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
---
 python/ovs/flow/ofp.py       |  6 ++++--
 python/ovs/tests/test_ofp.py | 13 +++++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/python/ovs/flow/ofp.py b/python/ovs/flow/ofp.py
index bf832f71b..eac8d0851 100644
--- a/python/ovs/flow/ofp.py
+++ b/python/ovs/flow/ofp.py
@@ -402,10 +402,12 @@  class OFPFlow(Flow):
         return {
             "learn": decode_learn(action_decoders),
             "clone": nested_kv_decoder(
-                KVDecoders(action_decoders, ignore_case=True), is_list=True
+                KVDecoders(action_decoders, default_free=decode_free_output,
+                           ignore_case=True), is_list=True
             ),
             "write_actions": nested_kv_decoder(
-                KVDecoders(action_decoders, ignore_case=True), is_list=True
+                KVDecoders(action_decoders, default_free=decode_free_output,
+                           ignore_case=True), is_list=True
             ),
         }
 
diff --git a/python/ovs/tests/test_ofp.py b/python/ovs/tests/test_ofp.py
index e17188e2b..27bcf0c47 100644
--- a/python/ovs/tests/test_ofp.py
+++ b/python/ovs/tests/test_ofp.py
@@ -532,6 +532,19 @@  from ovs.flow.decoders import EthMask, IPMask, decode_mask
                 KeyValue("CONTROLLER", {"max_len": 123}),
             ],
         ),
+        (
+            "actions=LOCAL,clone(myport,CONTROLLER)",
+            [
+                KeyValue("output", {"port": "LOCAL"}),
+                KeyValue(
+                    "clone",
+                    [
+                        {"output": {"port": "myport"}},
+                        {"output": {"port": "CONTROLLER"}},
+                    ]
+                ),
+            ],
+        ),
         (
             "actions=doesnotexist(1234)",
             ParseError,