mirror of
https://github.com/openvswitch/ovs
synced 2025-09-02 15:25:22 +00:00
python: ovs: flow: Add sample to nested actions.
Add the sample action to those that can be called in nested actions (such as clone). Signed-off-by: Adrian Moreno <amorenoz@redhat.com> [simon: resolved conflict] Signed-off-by: Simon Horman <horms@ovn.org>
This commit is contained in:
committed by
Simon Horman
parent
53a346e623
commit
7e46b2fb10
@@ -336,6 +336,21 @@ class ODPFlow(Flow):
|
|||||||
**ODPFlow._tnl_action_decoder_args(),
|
**ODPFlow._tnl_action_decoder_args(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_decoders["sample"] = nested_kv_decoder(
|
||||||
|
KVDecoders(
|
||||||
|
{
|
||||||
|
"sample": (lambda x: float(x.strip("%"))),
|
||||||
|
"actions": nested_kv_decoder(
|
||||||
|
KVDecoders(
|
||||||
|
decoders=_decoders,
|
||||||
|
default_free=decode_free_output,
|
||||||
|
),
|
||||||
|
is_list=True,
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
_decoders["clone"] = nested_kv_decoder(
|
_decoders["clone"] = nested_kv_decoder(
|
||||||
KVDecoders(decoders=_decoders, default_free=decode_free_output),
|
KVDecoders(decoders=_decoders, default_free=decode_free_output),
|
||||||
is_list=True,
|
is_list=True,
|
||||||
@@ -343,20 +358,6 @@ class ODPFlow(Flow):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
**_decoders,
|
**_decoders,
|
||||||
"sample": nested_kv_decoder(
|
|
||||||
KVDecoders(
|
|
||||||
{
|
|
||||||
"sample": (lambda x: float(x.strip("%"))),
|
|
||||||
"actions": nested_kv_decoder(
|
|
||||||
KVDecoders(
|
|
||||||
decoders=_decoders,
|
|
||||||
default_free=decode_free_output,
|
|
||||||
),
|
|
||||||
is_list=True,
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
),
|
|
||||||
"check_pkt_len": nested_kv_decoder(
|
"check_pkt_len": nested_kv_decoder(
|
||||||
KVDecoders(
|
KVDecoders(
|
||||||
{
|
{
|
||||||
|
@@ -550,6 +550,20 @@ def do_test_section(input_string, section, expected):
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
"actions=LOCAL,clone(sample(probability=123))",
|
||||||
|
[
|
||||||
|
KeyValue("output", {"port": "LOCAL"}),
|
||||||
|
KeyValue(
|
||||||
|
"clone",
|
||||||
|
[
|
||||||
|
{"sample": {
|
||||||
|
"probability": 123,
|
||||||
|
}},
|
||||||
|
]
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
(
|
(
|
||||||
"actions=doesnotexist(1234)",
|
"actions=doesnotexist(1234)",
|
||||||
ParseError,
|
ParseError,
|
||||||
|
Reference in New Issue
Block a user