mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
python: ovs: flow: Fix nested check_pkt_len acts.
Add check_pkt_len action to the decoder list that it, itself, uses.
This makes nested check_pkt_len (i.e:a check_pkt_len inside another)
work.
Fixes: 076663b31e
("python: Add ovs datapath flow parsing.")
Reported-by: Ilya Maximets <i.maximets@ovn.org>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
committed by
Ilya Maximets
parent
fad8c8f7f6
commit
2c1a432e2f
@@ -365,9 +365,7 @@ class ODPFlow(Flow):
|
||||
is_list=True,
|
||||
)
|
||||
|
||||
return {
|
||||
**_decoders,
|
||||
"check_pkt_len": nested_kv_decoder(
|
||||
_decoders["check_pkt_len"] = nested_kv_decoder(
|
||||
KVDecoders(
|
||||
{
|
||||
"size": decode_int,
|
||||
@@ -387,7 +385,10 @@ class ODPFlow(Flow):
|
||||
),
|
||||
}
|
||||
)
|
||||
),
|
||||
)
|
||||
|
||||
return {
|
||||
**_decoders,
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
|
@@ -541,6 +541,35 @@ def test_odp_fields(input_string, expected):
|
||||
),
|
||||
],
|
||||
),
|
||||
(
|
||||
"actions:check_pkt_len(size=200,gt(check_pkt_len(size=400,gt(4),le(2))),le(check_pkt_len(size=100,gt(1),le(drop))))", # noqa: E501
|
||||
[
|
||||
KeyValue(
|
||||
"check_pkt_len",
|
||||
{
|
||||
"size": 200,
|
||||
"gt": [
|
||||
{
|
||||
"check_pkt_len": {
|
||||
"size": 400,
|
||||
"gt": [{"output": {"port": 4}}],
|
||||
"le": [{"output": {"port": 2}}],
|
||||
}
|
||||
}
|
||||
],
|
||||
"le": [
|
||||
{
|
||||
"check_pkt_len": {
|
||||
"size": 100,
|
||||
"gt": [{"output": {"port": 1}}],
|
||||
"le": [{"drop": True}],
|
||||
}
|
||||
}
|
||||
],
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
(
|
||||
"actions:meter(1),hash(l4(0))",
|
||||
[
|
||||
|
Reference in New Issue
Block a user