On 11/4/22 16:49, Adrian Moreno wrote:
> Two new options are added to NB_Global table that enable drop
> sampling by specifying the collector_set_id and the obs_domain_id of
> the sample actions added to all drop flows.
> 
> For drops coming from an lflow, the sample has the following fields:
> - obs_domain_id (32-bit): obs_domain_id << 8 | datapath_key
>   - 8 most significant bits: the obs_domain_id specified in the
>     NB_Global options.
>   - 24 least significant bits: the datapath key.
> - obs_point_id: the cookie (first 32-bits of the lflow's UUID).
> 
> For drops that are inserted by ovn-controller without any associated
> lflow, the sample will have the follwing fields:
> - obs_domain_id (32-bit): obs_domain_id << 8
>   - 8 most significant bits: the obs_domain_id specified in the
>     NB_Global options.
>   - 24 least significant bits: 0.
> - obs_point_id: The openflow table number.
> 
> Adding this configuration is not enough to make OVS sample drops. The
> apropriate configuration IPFIX needs to be added to those chassis that
> you wish to sample from. See man(5) ovs-vswitchd.conf for more details.
> 
> Signed-off-by: Adrian Moreno <[email protected]>
> ---
>  NEWS                        |  2 +
>  controller/ovn-controller.c | 44 +++++++++++++++++
>  controller/physical.c       | 44 +++++++++++++----
>  controller/physical.h       |  6 +++
>  northd/automake.mk          |  2 +
>  northd/debug.c              | 98 +++++++++++++++++++++++++++++++++++++
>  northd/debug.h              | 30 ++++++++++++
>  northd/northd.c             | 77 ++++++++++++++++-------------
>  northd/ovn-northd.8.xml     | 26 ++++++++++
>  ovn-nb.xml                  | 28 +++++++++++
>  ovn-sb.xml                  | 29 +++++++++++
>  tests/ovn.at                | 67 ++++++++++++++++---------
>  12 files changed, 384 insertions(+), 69 deletions(-)
>  create mode 100644 northd/debug.c
>  create mode 100644 northd/debug.h
> 
> diff --git a/NEWS b/NEWS
> index 224a7b83e..6c4573b50 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -1,5 +1,7 @@
>  Post v22.09.0
>  -------------
> +  - ovn-northd: Add configuration knobs to enable drop sampling using OVS's
> +    per-flow IPFIX sampling.
>  
>  OVN v22.09.0 - 16 Sep 2022
>  --------------------------
> diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
> index 8895c7a2b..686d5fa86 100644
> --- a/controller/ovn-controller.c
> +++ b/controller/ovn-controller.c
> @@ -3150,6 +3150,8 @@ lflow_output_sb_meter_handler(struct engine_node *node, 
> void *data)
>  struct ed_type_pflow_output {
>      /* Desired physical flows. */
>      struct ovn_desired_flow_table flow_table;
> +    /* Drop debugging options. */
> +    struct physical_debug debug;
>  };
>  
>  static void init_physical_ctx(struct engine_node *node,
> @@ -3194,6 +3196,12 @@ static void init_physical_ctx(struct engine_node *node,
>          chassis = chassis_lookup_by_name(sbrec_chassis_by_name, chassis_id);
>      }
>  
> +    struct sbrec_sb_global_table *sb_global_table =
> +        (struct sbrec_sb_global_table *)EN_OVSDB_GET(

0-day bot reported this missing space after cast.

> +            engine_get_input("SB_sb_global", node));
> +    const struct sbrec_sb_global *sb_global =
> +        sbrec_sb_global_table_first(sb_global_table);
> +
>      ovs_assert(br_int && chassis);
>  
>      struct ed_type_ct_zones *ct_zones_data =
> @@ -3215,6 +3223,13 @@ static void init_physical_ctx(struct engine_node *node,
>      p_ctx->local_bindings = &rt_data->lbinding_data.bindings;
>      p_ctx->patch_ofports = &non_vif_data->patch_ofports;
>      p_ctx->chassis_tunnels = &non_vif_data->chassis_tunnels;
> +    p_ctx->debug.collector_set_id = smap_get_uint(&sb_global->options,
> +                                                  "debug_drop_collector_set",
> +                                                  0);
> +
> +    p_ctx->debug.obs_domain_id = smap_get_uint(&sb_global->options,
> +                                               "debug_drop_domain_id",
> +                                               0);
>  }
>  
>  static void *
> @@ -3417,6 +3432,33 @@ pflow_output_activated_ports_handler(struct 
> engine_node *node, void *data)
>      return true;
>  }
>  
> +static bool
> +pflow_output_sb_sb_global_handler(struct engine_node *node, void *data)
> +{
> +    struct sbrec_sb_global_table *sb_global_table =
> +        (struct sbrec_sb_global_table *)EN_OVSDB_GET(

Here too.

Thanks,
Dumitru

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to