mirror of
https://github.com/openvswitch/ovs
synced 2025-09-02 23:35:27 +00:00
ofp-actions: Load data from fields in sample action.
When sample action gets used as a way of sampling traffic with controller-generated metadata (i.e: obs_domain_id and obs_point_id), the controller will have to increase the number of flows to ensure each part of the pipeline contains the right metadata. As an example, if the controller decides to sample stateful traffic, it could store the computed metadata for each connection in the conntrack label. However, for established connections, a flow must be created for each different ct_label value with a sample action that contains a different hardcoded obs_domain and obs_point id. This patch adds a new version of the NXAST_RAW_SAMPLE* action (number 4) that supports specifying the observation point and domain using an OpenFlow field reference, so now the controller can express: sample(... obs_domain_id=NXM_NX_CT_LABEL[0..31], obs_point_id=NXM_NX_CT_LABEL[32..63] ... ) 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
c2e6836460
commit
1aa9e137fe
@@ -30,7 +30,7 @@ from ovs.flow.ofp_act import (
|
||||
decode_move_field,
|
||||
decode_dec_ttl,
|
||||
decode_chk_pkt_larger,
|
||||
decode_zone,
|
||||
decode_field_or_int,
|
||||
decode_learn,
|
||||
)
|
||||
|
||||
@@ -330,7 +330,7 @@ class OFPFlow(Flow):
|
||||
KVDecoders(
|
||||
{
|
||||
"commit": decode_flag,
|
||||
"zone": decode_zone,
|
||||
"zone": decode_field_or_int,
|
||||
"table": decode_int,
|
||||
"nat": decode_nat,
|
||||
"force": decode_flag,
|
||||
@@ -426,8 +426,8 @@ class OFPFlow(Flow):
|
||||
{
|
||||
"probability": decode_int,
|
||||
"collector_set_id": decode_int,
|
||||
"obs_domain_id": decode_int,
|
||||
"obs_point_id": decode_int,
|
||||
"obs_domain_id": decode_field_or_int,
|
||||
"obs_point_id": decode_field_or_int,
|
||||
"sampling_port": decode_default,
|
||||
"ingress": decode_flag,
|
||||
"egress": decode_flag,
|
||||
|
@@ -246,9 +246,9 @@ def decode_chk_pkt_larger(value):
|
||||
return {"pkt_len": pkt_len, "dst": dst}
|
||||
|
||||
|
||||
# CT decoders
|
||||
def decode_zone(value):
|
||||
"""Decodes the value of the 'zone' keyword (part of the ct action)."""
|
||||
def decode_field_or_int(value):
|
||||
"""Decodes a value that can be either a subfield specification or an
|
||||
integer."""
|
||||
try:
|
||||
return int(value, 0)
|
||||
except ValueError:
|
||||
|
Reference in New Issue
Block a user