Skip to content

Commit

Permalink
northd: Add "ecmp_nexthop_monitor_en" config option to NB_Global table.
Browse files Browse the repository at this point in the history
Introduce "ecmp_nexthop_monitor_en" config option to NB_Global table in order
to enable or disable ecmp_nexthop tracking logic.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
LorenzoBianconi authored and ovsrobot committed Dec 20, 2024
1 parent 78a6f34 commit fa58682
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 4 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Post v24.09.0
ARP/ND packets used for tracking ECMP next hop MAC addresses.
- Auto flush ECMP symmetric reply connection states when an ECMP route is
removed by the CMS."
- Add "ecmp_nexthop_monitor_en" config option to NB_Global table in order to
enable or disable ecmp_nexthop tracking logic.

OVN v24.09.0 - 13 Sep 2024
--------------------------
Expand Down
22 changes: 18 additions & 4 deletions northd/en-ecmp-nexthop.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "openvswitch/hmap.h"
#include "util.h"

#include "en-global-config.h"
#include "en-ecmp-nexthop.h"
#include "en-northd.h"

Expand Down Expand Up @@ -135,10 +136,23 @@ en_ecmp_nexthop_run(struct engine_node *node, void *data OVS_UNUSED)
struct routes_data *routes_data = engine_get_input_data("routes", node);
const struct sbrec_ecmp_nexthop_table *sbrec_ecmp_nexthop_table =
EN_OVSDB_GET(engine_get_input("SB_ecmp_nexthop", node));

build_ecmp_nexthop_table(eng_ctx->ovnsb_idl_txn,
&routes_data->parsed_routes,
sbrec_ecmp_nexthop_table);
struct ed_type_global_config *global_config =
engine_get_input_data("global_config", node);
bool ecmp_nexthop_monitor_en = smap_get_bool(&global_config->nb_options,
"ecmp_nexthop_monitor_en",
false);

if (ecmp_nexthop_monitor_en) {
build_ecmp_nexthop_table(eng_ctx->ovnsb_idl_txn,
&routes_data->parsed_routes,
sbrec_ecmp_nexthop_table);
} else {
const struct sbrec_ecmp_nexthop *sb_ecmp_nexthop;
SBREC_ECMP_NEXTHOP_TABLE_FOR_EACH_SAFE (sb_ecmp_nexthop,
sbrec_ecmp_nexthop_table) {
sbrec_ecmp_nexthop_delete(sb_ecmp_nexthop);
}
}
engine_set_node_state(node, EN_UPDATED);
}

5 changes: 5 additions & 0 deletions northd/en-global-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,11 @@ check_nb_options_out_of_sync(
return true;
}

if (config_out_of_sync(&nb->options, &config_data->nb_options,
"ecmp_nexthop_monitor_en", false)) {
return true;
}

return false;
}

Expand Down
1 change: 1 addition & 0 deletions northd/inc-proc-northd.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
engine_add_input(&en_bfd_sync, &en_route_policies, NULL);
engine_add_input(&en_bfd_sync, &en_northd, bfd_sync_northd_change_handler);

engine_add_input(&en_ecmp_nexthop, &en_global_config, NULL);
engine_add_input(&en_ecmp_nexthop, &en_sb_ecmp_nexthop, NULL);
engine_add_input(&en_ecmp_nexthop, &en_routes, NULL);

Expand Down
9 changes: 9 additions & 0 deletions ovn-nb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,15 @@
</p>
</column>

<column name="options" key="ecmp_nexthop_monitor_en">
<p>
If set to <code>true</code>., <code>ovn-northd</code> will create
entries in <ref table="ECMP_Nexthop TABLE" db="OVN_Southbound"/>
to track ECMP routes created with <code>--ecmp_symmetric_reply</code>
option. By default this option is set to <code>false</code>.
</p>
</column>

<group title="Options for configuring interconnection route advertisement">
<p>
These options control how routes are advertised between OVN
Expand Down
10 changes: 10 additions & 0 deletions tests/ovn-northd.at
Original file line number Diff line number Diff line change
Expand Up @@ -6814,6 +6814,8 @@ check ovn-nbctl lsp-set-type public-lr0 router
check ovn-nbctl lsp-set-addresses public-lr0 router
check ovn-nbctl lsp-set-options public-lr0 router-port=lr0-public

check ovn-nbctl set nb_global . options:ecmp_nexthop_monitor_en="true"

# non ecmp-symmetric-reply routes do not add any entry in ECMP_Nexthop table
check ovn-nbctl --wait=sb --ecmp lr-route-add lr0 1.0.0.1 192.168.0.10
check_row_count ECMP_Nexthop 0
Expand All @@ -6826,6 +6828,14 @@ uuid=$(fetch_column Port_Binding _uuid logical_port=lr0-public)
check_column 192.168.0.10 ECMP_Nexthop nexthop
check_column "$uuid" ECMP_Nexthop port

# Disable ecmp_nexthop_monitor_en and check the SB.ECMP_Nexthop is empty
check ovn-nbctl --wait=sb set nb_global . options:ecmp_nexthop_monitor_en="false"
check_row_count ECMP_Nexthop 0

# Enable ecmp_nexthop_monitor_en
check ovn-nbctl --wait=sb set nb_global . options:ecmp_nexthop_monitor_en="true"
check_row_count ECMP_Nexthop 1

ovn-sbctl dump-flows lr0 > lr0flows

AT_CHECK([grep -w "lr_in_ip_routing" lr0flows | ovn_strip_lflows], [0], [dnl
Expand Down
4 changes: 4 additions & 0 deletions tests/system-ovn.at
Original file line number Diff line number Diff line change
Expand Up @@ -14746,6 +14746,8 @@ check ovs-vsctl \
start_daemon ovn-controller
check ovs-vsctl set Open_vSwitch . external-ids:arp-nd-max-timeout-sec=1

check ovn-nbctl set nb_global . options:ecmp_nexthop_monitor_en="true"

check ovn-nbctl lr-add R1
check ovn-nbctl set logical_router R1 options:chassis=hv1
check ovn-nbctl lr-add R2
Expand Down Expand Up @@ -15005,6 +15007,8 @@ check ovs-vsctl \
start_daemon ovn-controller
check ovs-vsctl set Open_vSwitch . external-ids:arp-nd-max-timeout-sec=1

check ovn-nbctl set nb_global . options:ecmp_nexthop_monitor_en="true"

check ovn-nbctl lr-add R1
check ovn-nbctl set logical_router R1 options:chassis=hv1
check ovn-nbctl lr-add R2
Expand Down

0 comments on commit fa58682

Please sign in to comment.