summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorAdrian Moreno <amorenoz@redhat.com>2022-12-19 17:13:48 +0100
committerIlya Maximets <i.maximets@ovn.org>2022-12-21 18:36:02 +0100
commit542fdad701403c11cfe8356957f934fa657c1742 (patch)
treed6ca0363bbbe3c970f3bb4f07d30bab80c2b7507 /python
parent1850e5e6891282d84bdeb7b7100166cfd8deed28 (diff)
downloadopenvswitch-542fdad701403c11cfe8356957f934fa657c1742.tar.gz
python: Fix output=CONTROLLER action.
When CONTROLLER is used as free key, it means output=CONTROLLER which is handled by decode_controller. However, it must output the KV in the right format: "output": {"format": "CONTROLLER"}. Signed-off-by: Adrian Moreno <amorenoz@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'python')
-rw-r--r--python/ovs/flow/ofp_act.py2
-rw-r--r--python/ovs/tests/test_ofp.py10
2 files changed, 10 insertions, 2 deletions
diff --git a/python/ovs/flow/ofp_act.py b/python/ovs/flow/ofp_act.py
index 5eaf0b218..c540443ea 100644
--- a/python/ovs/flow/ofp_act.py
+++ b/python/ovs/flow/ofp_act.py
@@ -35,7 +35,7 @@ def decode_output(value):
def decode_controller(value):
"""Decodes the controller action."""
if not value:
- return KeyValue("output", "controller")
+ return KeyValue("output", {"port": "CONTROLLER"})
else:
# Try controller:max_len
try:
diff --git a/python/ovs/tests/test_ofp.py b/python/ovs/tests/test_ofp.py
index 5aa8d591b..e17188e2b 100644
--- a/python/ovs/tests/test_ofp.py
+++ b/python/ovs/tests/test_ofp.py
@@ -22,7 +22,7 @@ from ovs.flow.decoders import EthMask, IPMask, decode_mask
(
"actions=controller,controller:200",
[
- KeyValue("output", "controller"),
+ KeyValue("output", {"port": "CONTROLLER"}),
KeyValue("controller", {"max_len": 200}),
],
),
@@ -525,6 +525,14 @@ from ovs.flow.decoders import EthMask, IPMask, decode_mask
],
),
(
+ "actions=MOD_NW_SRC:192.168.1.1,CONTROLLER,CONTROLLER:123",
+ [
+ KeyValue("MOD_NW_SRC", netaddr.IPAddress("192.168.1.1")),
+ KeyValue("output", {"port": "CONTROLLER"}),
+ KeyValue("CONTROLLER", {"max_len": 123}),
+ ],
+ ),
+ (
"actions=doesnotexist(1234)",
ParseError,
),