From patchwork Tue Aug 6 09:44:46 2024
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Dumitru Ceara
X-Patchwork-Id: 1969403
Return-Path:
X-Original-To: incoming@patchwork.ozlabs.org
Delivered-To: patchwork-incoming@legolas.ozlabs.org
Authentication-Results: legolas.ozlabs.org;
dkim=fail reason="signature verification failed" (1024-bit key;
unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256
header.s=mimecast20190719 header.b=ZMteVw2Y;
dkim-atps=neutral
Authentication-Results: legolas.ozlabs.org;
spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org
(client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org;
envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org)
Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384)
(No client certificate requested)
by legolas.ozlabs.org (Postfix) with ESMTPS id 4WdT2h6j1Bz1ydt
for ; Tue, 6 Aug 2024 19:46:04 +1000 (AEST)
Received: from localhost (localhost [127.0.0.1])
by smtp2.osuosl.org (Postfix) with ESMTP id 5C14C409D3;
Tue, 6 Aug 2024 09:46:03 +0000 (UTC)
X-Virus-Scanned: amavis at osuosl.org
Received: from smtp2.osuosl.org ([127.0.0.1])
by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP
id id6U1onL6_JT; Tue, 6 Aug 2024 09:46:01 +0000 (UTC)
X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56;
helo=lists.linuxfoundation.org;
envelope-from=ovs-dev-bounces@openvswitch.org; receiver=
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 796C44091E
Authentication-Results: smtp2.osuosl.org;
dkim=fail reason="signature verification failed" (1024-bit key,
unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256
header.s=mimecast20190719 header.b=ZMteVw2Y
Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56])
by smtp2.osuosl.org (Postfix) with ESMTPS id 796C44091E;
Tue, 6 Aug 2024 09:46:01 +0000 (UTC)
Received: from lf-lists.osuosl.org (localhost [127.0.0.1])
by lists.linuxfoundation.org (Postfix) with ESMTP id 5CF68C003D;
Tue, 6 Aug 2024 09:46:01 +0000 (UTC)
X-Original-To: ovs-dev@openvswitch.org
Delivered-To: ovs-dev@lists.linuxfoundation.org
Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138])
by lists.linuxfoundation.org (Postfix) with ESMTP id 28BE7C0033
for ; Tue, 6 Aug 2024 09:46:00 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
by smtp1.osuosl.org (Postfix) with ESMTP id 8C13B8115E
for ; Tue, 6 Aug 2024 09:45:46 +0000 (UTC)
X-Virus-Scanned: amavis at osuosl.org
Received: from smtp1.osuosl.org ([127.0.0.1])
by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP
id tM2r1hiTasIs for ;
Tue, 6 Aug 2024 09:45:44 +0000 (UTC)
Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124;
helo=us-smtp-delivery-124.mimecast.com; envelope-from=dceara@redhat.com;
receiver=
DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 2D3448116A
Authentication-Results: smtp1.osuosl.org;
dmarc=pass (p=none dis=none) header.from=redhat.com
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 2D3448116A
Authentication-Results: smtp1.osuosl.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com
header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZMteVw2Y
Received: from us-smtp-delivery-124.mimecast.com
(us-smtp-delivery-124.mimecast.com [170.10.133.124])
by smtp1.osuosl.org (Postfix) with ESMTPS id 2D3448116A
for ; Tue, 6 Aug 2024 09:45:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1722937542;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=jfa31asEvB3lP1AGSUp8HrLIuKYZsKjFqKuCNXmJ0/8=;
b=ZMteVw2YIcPnssf/b7+zZjTPG4UHnJD9GM4+JXj5adVF3bncPwbVSe03T/phUPOPrQxWOt
JpwabClrrs1v8NKx57hvMmtFjG616iy9+auXR7rpOUToin8Mv6dRIbk/7wCwpbwdBNRWL8
MQ2RdfxVwao0hSypHvQ6W165BW6gw0c=
Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com
(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by
relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
cipher=TLS_AES_256_GCM_SHA384) id us-mta-586-OfE5KZzRO3OG734rFAVb6A-1; Tue,
06 Aug 2024 05:45:40 -0400
X-MC-Unique: OfE5KZzRO3OG734rFAVb6A-1
Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com
(mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest
SHA256)
(No client certificate requested)
by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS
id BF98519560B1; Tue, 6 Aug 2024 09:45:39 +0000 (UTC)
Received: from cecil-rh.redhat.com (unknown [10.39.193.207])
by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
id 229631956046; Tue, 6 Aug 2024 09:45:36 +0000 (UTC)
From: Dumitru Ceara
To: ovs-dev@openvswitch.org
Date: Tue, 6 Aug 2024 11:44:46 +0200
Message-ID: <20240806094451.730622-5-dceara@redhat.com>
In-Reply-To: <20240806094451.730622-1-dceara@redhat.com>
References: <20240806094451.730622-1-dceara@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Subject: [ovs-dev] [PATCH ovn v6 4/9] northd: Override NB_Global drop
sampling id with Sampling_App config.
X-BeenThere: ovs-dev@openvswitch.org
X-Mailman-Version: 2.1.30
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Cc: i.maximets@ovn.org
Errors-To: ovs-dev-bounces@openvswitch.org
Sender: "dev"
Acked-by: Mark Michelson
Signed-off-by: Dumitru Ceara
---
V6:
- Removed Ales' ack.
V5:
- Added Ales' ack.
V4:
- Addressed Ales' comments:
- deprecated old config knob
- fixed unit test typo
- Added Mark's ack.
---
NEWS | 3 +++
northd/debug.c | 12 +++++++-----
northd/debug.h | 3 ++-
northd/en-global-config.c | 31 +++++++++++++++++++++++--------
northd/inc-proc-northd.c | 1 +
ovn-nb.xml | 5 +++++
tests/ovn-northd.at | 27 ++++++++++++++++++++++++++-
7 files changed, 67 insertions(+), 15 deletions(-)
diff --git a/NEWS b/NEWS
index 136f890f52..0c91e9608e 100644
--- a/NEWS
+++ b/NEWS
@@ -50,6 +50,9 @@ Post v24.03.0
- A new LSP option "disable_garp_rarp" has been added to prevent OVN from
sending GARP or RARP announcements when a VIF is created on a bridged
logical switch.
+ - The NB_Global.debug_drop_domain_id configured value is now overridden by
+ the ID associated with the Sampling_App record created for drop sampling
+ (Sampling_App.type configured as "drop").
OVN v24.03.0 - 01 Mar 2024
--------------------------
diff --git a/northd/debug.c b/northd/debug.c
index 59da5d4f66..457993b7cf 100644
--- a/northd/debug.c
+++ b/northd/debug.c
@@ -3,6 +3,7 @@
#include
#include "debug.h"
+#include "en-sampling-app.h"
#include "openvswitch/dynamic-string.h"
#include "openvswitch/vlog.h"
@@ -26,16 +27,17 @@ debug_enabled(void)
}
void
-init_debug_config(const struct nbrec_nb_global *nb)
+init_debug_config(const struct nbrec_nb_global *nb,
+ uint8_t drop_domain_id_override)
{
-
const struct smap *options = &nb->options;
uint32_t collector_set_id = smap_get_uint(options,
"debug_drop_collector_set",
0);
- uint32_t observation_domain_id = smap_get_uint(options,
- "debug_drop_domain_id",
- 0);
+ uint32_t observation_domain_id =
+ drop_domain_id_override != SAMPLING_APP_ID_NONE
+ ? drop_domain_id_override
+ : smap_get_uint(options, "debug_drop_domain_id", 0);
if (collector_set_id != config.collector_set_id ||
observation_domain_id != config.observation_domain_id ||
diff --git a/northd/debug.h b/northd/debug.h
index c1a5e5aadb..a0b535253a 100644
--- a/northd/debug.h
+++ b/northd/debug.h
@@ -21,7 +21,8 @@
#include "lib/ovn-nb-idl.h"
#include "openvswitch/dynamic-string.h"
-void init_debug_config(const struct nbrec_nb_global *nb);
+void init_debug_config(const struct nbrec_nb_global *nb,
+ uint8_t drop_domain_id_override);
void destroy_debug_config(void);
const char *debug_drop_action(void);
diff --git a/northd/en-global-config.c b/northd/en-global-config.c
index c5e65966b8..d7607aa074 100644
--- a/northd/en-global-config.c
+++ b/northd/en-global-config.c
@@ -24,6 +24,7 @@
/* OVN includes */
#include "debug.h"
#include "en-global-config.h"
+#include "en-sampling-app.h"
#include "include/ovn/features.h"
#include "ipam.h"
#include "lib/ovn-nb-idl.h"
@@ -42,8 +43,10 @@ static bool chassis_features_changed(const struct chassis_features *,
static bool config_out_of_sync(const struct smap *config,
const struct smap *saved_config,
const char *key, bool must_be_present);
-static bool check_nb_options_out_of_sync(const struct nbrec_nb_global *,
- struct ed_type_global_config *);
+static bool check_nb_options_out_of_sync(
+ const struct nbrec_nb_global *,
+ struct ed_type_global_config *,
+ const struct sampling_app_table *);
static void update_sb_config_options_to_sbrec(struct ed_type_global_config *,
const struct sbrec_sb_global *);
@@ -72,6 +75,9 @@ en_global_config_run(struct engine_node *node , void *data)
EN_OVSDB_GET(engine_get_input("SB_sb_global", node));
const struct sbrec_chassis_table *sbrec_chassis_table =
EN_OVSDB_GET(engine_get_input("SB_chassis", node));
+ const struct ed_type_sampling_app_data *sampling_app_data =
+ engine_get_input_data("sampling_app", node);
+ const struct sampling_app_table *sampling_apps = &sampling_app_data->apps;
struct ed_type_global_config *config_data = data;
@@ -145,7 +151,8 @@ en_global_config_run(struct engine_node *node , void *data)
build_chassis_features(sbrec_chassis_table, &config_data->features);
}
- init_debug_config(nb);
+ init_debug_config(nb, sampling_app_get_id(sampling_apps,
+ SAMPLING_APP_DROP_DEBUG));
const struct sbrec_sb_global *sb =
sbrec_sb_global_table_first(sb_global_table);
@@ -186,6 +193,9 @@ global_config_nb_global_handler(struct engine_node *node, void *data)
EN_OVSDB_GET(engine_get_input("NB_nb_global", node));
const struct sbrec_sb_global_table *sb_global_table =
EN_OVSDB_GET(engine_get_input("SB_sb_global", node));
+ const struct ed_type_sampling_app_data *sampling_app_data =
+ engine_get_input_data("sampling_app", node);
+ const struct sampling_app_table *sampling_apps = &sampling_app_data->apps;
const struct nbrec_nb_global *nb =
nbrec_nb_global_table_first(nb_global_table);
@@ -248,7 +258,7 @@ global_config_nb_global_handler(struct engine_node *node, void *data)
return false;
}
- if (check_nb_options_out_of_sync(nb, config_data)) {
+ if (check_nb_options_out_of_sync(nb, config_data, sampling_apps)) {
config_data->tracked_data.nb_options_changed = true;
}
@@ -461,8 +471,10 @@ config_out_of_sync(const struct smap *config, const struct smap *saved_config,
}
static bool
-check_nb_options_out_of_sync(const struct nbrec_nb_global *nb,
- struct ed_type_global_config *config_data)
+check_nb_options_out_of_sync(
+ const struct nbrec_nb_global *nb,
+ struct ed_type_global_config *config_data,
+ const struct sampling_app_table *sampling_apps)
{
if (config_out_of_sync(&nb->options, &config_data->nb_options,
"mac_binding_removal_limit", false)) {
@@ -496,13 +508,16 @@ check_nb_options_out_of_sync(const struct nbrec_nb_global *nb,
if (config_out_of_sync(&nb->options, &config_data->nb_options,
"debug_drop_domain_id", false)) {
- init_debug_config(nb);
+ init_debug_config(nb, sampling_app_get_id(sampling_apps,
+ SAMPLING_APP_DROP_DEBUG));
+
return true;
}
if (config_out_of_sync(&nb->options, &config_data->nb_options,
"debug_drop_collector_set", false)) {
- init_debug_config(nb);
+ init_debug_config(nb, sampling_app_get_id(sampling_apps,
+ SAMPLING_APP_DROP_DEBUG));
return true;
}
diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
index 5d89670c29..95bedc5cd0 100644
--- a/northd/inc-proc-northd.c
+++ b/northd/inc-proc-northd.c
@@ -181,6 +181,7 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
global_config_sb_global_handler);
engine_add_input(&en_global_config, &en_sb_chassis,
global_config_sb_chassis_handler);
+ engine_add_input(&en_global_config, &en_sampling_app, NULL);
engine_add_input(&en_northd, &en_nb_mirror, NULL);
engine_add_input(&en_northd, &en_nb_static_mac_binding, NULL);
diff --git a/ovn-nb.xml b/ovn-nb.xml
index 0cf2478cf3..bc44f67642 100644
--- a/ovn-nb.xml
+++ b/ovn-nb.xml
@@ -351,6 +351,11 @@
The observation_point_id will be set to the first 32 bits of the
logical flow's UUID.
+
+ Note: This key is deprecated in favor of the value configured in the
+ table for the drop
+ application.
+
diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
index 66a651e68e..ebf02ef10a 100644
--- a/tests/ovn-northd.at
+++ b/tests/ovn-northd.at
@@ -12489,13 +12489,38 @@ check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
ovn-nbctl create Sampling_App type="acl-new" id="42"
check_row_count nb:Sampling_App 1
check_engine_stats sampling_app recompute nocompute
-check_engine_stats northd norecompute nocompute
+check_engine_stats northd recompute nocompute
check_engine_stats lflow recompute nocompute
+check_engine_stats global_config recompute nocompute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
AT_CLEANUP
])
+OVN_FOR_EACH_NORTHD_NO_HV([
+AT_SETUP([Sampling_App override debug_drop_domain_id])
+
+ovn_start
+
+check ovn-nbctl -- set NB_Global . options:debug_drop_collector_set="123" \
+ -- set NB_Global . options:debug_drop_domain_id="1" \
+ -- ls-add ls
+check ovn-nbctl --wait=sb sync
+
+AT_CHECK([ovn-sbctl lflow-list | grep ls_in_l2_unknown.*sample | ovn_strip_lflows], [0], [dnl
+ table=??(ls_in_l2_unknown ), priority=50 , match=(outport == "none"), action=(sample(probability=65535,collector_set=123,obs_domain=1,obs_point=$cookie); /* drop */)
+])
+
+ovn-nbctl --wait=sb create Sampling_App type="drop" id="42"
+check_row_count nb:Sampling_App 1
+
+AT_CHECK([ovn-sbctl lflow-list | grep ls_in_l2_unknown.*sample | ovn_strip_lflows], [0], [dnl
+ table=??(ls_in_l2_unknown ), priority=50 , match=(outport == "none"), action=(sample(probability=65535,collector_set=123,obs_domain=42,obs_point=$cookie); /* drop */)
+])
+
+AT_CLEANUP
+])
+
OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([NAT with match])
ovn_start