On 11/4/22 16:49, Adrian Moreno wrote:
> sample ovn action encodes into the OFPACT_SAMPLE ovs action.
>
> OVN action allows the following parameters:
>
> - obs_domain_id: 8-bit integer that identifies the sampling application.
> This value will be combined with the datapath's tunnel_id to form the
> final observation_domain_id that will be used in the OVS action as:
> ObservationDomainID = obs_domain_id << 24 | (dp_key & 0xFFFFFF)
>
> - obs_point_id: a 32-bit integer or the $cookie macro that will be
> expanded into the first 32 bits of the lflow's UUID.
>
> - probability: a 16-bit integer that specifies the sampling probability.
> Specifying 0 has no effect and 65535 means sampling all packets.
>
> - collector_set: the 32-bit id that has to be configured in OVS's
> Flow_Sample_Collector_Set table in order to configure IPFIX sampling.
>
> Signed-off-by: Adrian Moreno <[email protected]>
> ---
Hi Adrian,
> diff --git a/lib/actions.c b/lib/actions.c
> index adbb42db4..cef626f84 100644
> --- a/lib/actions.c
> +++ b/lib/actions.c
> @@ -4279,6 +4279,124 @@ encode_CHECK_OUT_PORT_SEC(const struct ovnact_result
> *dl,
> MLF_CHECK_PORT_SEC_BIT, ofpacts);
> }
>
> +static void
> +format_SAMPLE(const struct ovnact_sample *sample, struct ds *s)
> +{
> + ds_put_format(s, "sample(probability=%"PRId16, sample->probability);
It should be PRIuXX everywhere in this function.
> +
> + ds_put_format(s, ",collector_set=%"PRId32, sample->collector_set_id);
> + ds_put_format(s, ",obs_domain=%"PRId8, sample->obs_domain_id);
> + if (sample->use_cookie) {
> + ds_put_cstr(s, ",obs_point=$cookie");
> + } else {
> + ds_put_format(s, ",obs_point=%"PRId32, sample->obs_point_id);
> + }
> + ds_put_format(s, ");");
> +}
> +
[...]
> diff --git a/utilities/ovn-trace.c b/utilities/ovn-trace.c
> index 6fa5137d9..ada562e41 100644
> --- a/utilities/ovn-trace.c
> +++ b/utilities/ovn-trace.c
> @@ -3290,6 +3290,8 @@ trace_actions(const struct ovnact *ovnacts, size_t
> ovnacts_len,
> break;
> case OVNACT_CHK_ECMP_NH:
> break;
> + case OVNACT_SAMPLE:
> + break;
> }
> }
> ofpbuf_uninit(&stack);
I think here we need this too:
diff --git a/utilities/ovn-trace.c b/utilities/ovn-trace.c
index ada562e41e..854385bc1e 100644
--- a/utilities/ovn-trace.c
+++ b/utilities/ovn-trace.c
@@ -1466,6 +1466,7 @@ execute_load(const struct ovnact_load *load,
const struct ovnact_encode_params ep = {
.lookup_port = ovntrace_lookup_port,
.aux = dp,
+ .dp_key = dp->tunnel_key,
};
uint64_t stub[512 / 8];
struct ofpbuf ofpacts = OFPBUF_STUB_INITIALIZER(stub);
---
Thanks,
Dumitru
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev