On Thu, Jan 22, 2026 at 7:23 PM Mairtin O'Loingsigh via dev <
[email protected]> wrote:

> Add "dynamic-routing-no-learning" option to router and router port options.
> This option will disable learning on a router/router port and remove
> existing learned routes. The port option takes priority over the router
> option.
>
> Reported-at: https://issues.redhat.com/browse/FDP-2750
> Signed-off-by: Mairtin O'Loingsigh <[email protected]>
> ---
>

Hi Mairtin,
thank you for the v2. There is a couple of small nits below.


>  NEWS                        |  7 +++
>  controller/route-exchange.c |  8 ++++
>  northd/northd.c             |  8 ++++
>  ovn-nb.xml                  | 27 ++++++++++++
>  ovn-sb.xml                  | 15 +++++++
>  tests/system-ovn.at         | 85 ++++++++++++++++++++++++++++++++++++-
>  6 files changed, 149 insertions(+), 1 deletion(-)
>
> diff --git a/NEWS b/NEWS
> index dc9d28f2c..93f4c72f0 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -1,5 +1,12 @@
>  Post v25.09.0
>  -------------
> +   - Dynamic Routing:
> +     * Add the "options:dynamic-routing-no-learning" to Logical Routers.
> If
> +       set to true router will not learn routes and will forget learned
> +       routes.
> +     * Add the "options:dynamic-routing-no-learning" to Logical Routers
> ports.
> +       If set to true, router port will not learn routes and will forget
> +       learned routes. This option has priority over its router
> counterpart.
>
> There is an existing dynamic routing section in the NEWS already.

    - Added DNS query statistics tracking in ovn-controller using OVS
> coverage
>       counters. Statistics can be queried using "ovn-appctl -t
> ovn-controller
>       coverage/read-counter <counter_name>" or "coverage/show". Tracked
> metrics
> diff --git a/controller/route-exchange.c b/controller/route-exchange.c
> index 8fced5f3c..ae44ffe69 100644
> --- a/controller/route-exchange.c
> +++ b/controller/route-exchange.c
> @@ -187,6 +187,14 @@ sb_sync_learned_routes(const struct vector
> *learned_routes,
>              if (!logical_port) {
>                  continue;
>              }
> +
> +            bool no_learning = smap_get_bool(&logical_port->options,
> +
>  "dynamic-routing-no-learning",
> +                                             false);
> +            if (no_learning) {
> +                continue;
> +            }
> +
>              route_e = route_lookup(&sync_routes, datapath,
>                                     logical_port, ip_prefix, nexthop);
>              if (route_e) {
> diff --git a/northd/northd.c b/northd/northd.c
> index d79fe40c9..3c31a4345 100644
> --- a/northd/northd.c
> +++ b/northd/northd.c
> @@ -3919,6 +3919,14 @@ sync_pb_for_lrp(struct ovn_port *op,
>          if (redistribute_local_only_val) {
>              smap_add(&new, redistribute_local_only_name, "true");
>          }
> +
> +        /* Set no-learning on ports based on NB router/router port config
> */
> +        const char *no_learn_name = "dynamic-routing-no-learning";
> +        bool no_learning = smap_get_bool(&op->nbrp->options,
> no_learn_name,
> +            smap_get_bool(&op->od->nbr->options, no_learn_name, false));
>

nit: Formatting


> +        if (no_learning) {
> +            smap_add(&new, "dynamic-routing-no-learning", "true");
> +        }
>      }
>
>      const char *ipv6_pd_list = smap_get(&op->sb->options,
> "ipv6_ra_pd_list");
> diff --git a/ovn-nb.xml b/ovn-nb.xml
> index e74c0d010..e9ca27413 100644
> --- a/ovn-nb.xml
> +++ b/ovn-nb.xml
> @@ -3442,6 +3442,19 @@ or
>          </p>
>        </column>
>
> +      <column name="options" key="dynamic-routing-no-learning"
> +              type='{"type": "boolean"}'>
> +        <p>
> +          Only relevant if <ref column="options" key="dynamic-routing"/>
> +          is set to <code>true</code>.
> +        </p>
> +
> +        <p>
> +          This option disables route learning on a specific router and
> will
> +          also remove learned routes.
> +        </p>
> +      </column>
> +
>        <column name="options" key="dynamic-routing-v4-prefix-nexthop"
>                type='{"type": "string"}'>
>          <p>
> @@ -4582,6 +4595,20 @@ or
>            routes in <code>ovn-ic</code> daemon.
>          </p>
>        </column>
> +
> +      <column name="options" key="dynamic-routing-no-learning"
> +              type='{"type": "boolean"}'>
> +        <p>
> +          Only relevant if <ref column="options" key="dynamic-routing"/>
> +          is set to <code>true</code>.
> +        </p>
> +
> +        <p>
> +          This option disables route learning on a specific router port
> and
> +          will also remove learned routes. It also has priority over the
> +          router version of this option.
> +        </p>
> +      </column>
>      </group>
>
>      <group title="Attachment">
> diff --git a/ovn-sb.xml b/ovn-sb.xml
> index 623aaeffd..00bae26bf 100644
> --- a/ovn-sb.xml
> +++ b/ovn-sb.xml
> @@ -3925,6 +3925,21 @@ tcp.flags = RST;
>            bound.  Default: <code>false</code>.
>          </p>
>        </column>
> +
> +      <column name="options" key="dynamic-routing-no-learning"
> +              type='{"type": "boolean"}'>
> +        <p>
> +          Only relevant if <ref column="options" key="dynamic-routing"/>
> +          is set to <code>true</code>.
> +        </p>
> +
> +        <p>
> +          This option disables adding routes to
> +          <ref table="Learned_Route" db="OVN_Southbound"/> and will also
> +          remove learned routes.
> +        </p>
> +      </column>
> +
>      </group>
>
>      <group title="Nested Containers">
> diff --git a/tests/system-ovn.at b/tests/system-ovn.at
> index 59701d41b..b74df2d74 100644
> --- a/tests/system-ovn.at
> +++ b/tests/system-ovn.at
> @@ -19954,11 +19954,94 @@ AT_CHECK([ip route del 10.10.3.1 via 20.0.0.25
> vrf vrf-$vni])
>  OVS_WAIT_FOR_OUTPUT([ovn-sbctl list Learned_Route | grep ip_prefix |
> sort], [0], [dnl
>  ])
>
> +# Disable learning on router
> +AS_BOX([$(date +%H:%M:%S.%03N) Disable dynamic-route learning])
> +
> +# Add a route to the VRF (simulating BGP learning a route)
> +AT_CHECK([ip route add 10.10.3.1 via 20.0.0.25 vrf vrf-$vni proto zebra])
> +
> +# Verify learned route appears in SB database
> +wait_row_count Learned_Route 1 ip_prefix=10.10.3.1
> +
> +check ovn-nbctl --wait=sb set Logical_Router lr-frr
> options:dynamic-routing-no-learning=true


nit: s/--wait=sb/--wait=hv/ that applies to all additions within this
patch.

+
> +# Verify routes do not appear in SB database.
> +wait_row_count Learned_Route 0
> +
> +check ovn-nbctl --wait=sb set Logical_Router lr-frr
> options:dynamic-routing-no-learning=false
> +
> +# Verify learned route appears in SB database
> +wait_row_count Learned_Route 1 ip_prefix=10.10.3.1
> +
> +AT_CHECK([ip route del 10.10.3.1 via 20.0.0.25 vrf vrf-$vni])
> +
> +# Verify all routes removed from SB database.
> +wait_row_count Learned_Route 0
> +
> +# Disable learning on router then attempt to add route
> +AS_BOX([$(date +%H:%M:%S.%03N) Disable dynamic-route learning 2])
> +
> +check ovn-nbctl --wait=sb set Logical_Router lr-frr
> options:dynamic-routing-no-learning=true
> +
> +# Add a route to the VRF (simulating BGP learning a route)
> +AT_CHECK([ip route add 10.10.3.1 via 20.0.0.25 vrf vrf-$vni proto zebra])
> +
> +# Verify routes do not appear in SB database.
> +wait_row_count Learned_Route 0
> +
> +check ovn-nbctl --wait=sb set Logical_Router lr-frr
> options:dynamic-routing-no-learning=false
> +
> +# Verify learned route appears in SB database
> +wait_row_count Learned_Route 1 ip_prefix=10.10.3.1
> +
> +AT_CHECK([ip route del 10.10.3.1 via 20.0.0.25 vrf vrf-$vni])
> +
> +# Verify all routes removed from SB database.
> +wait_row_count Learned_Route 0
> +
> +# Disable learning on router port
> +AS_BOX([$(date +%H:%M:%S.%03N) Disable dynamic-route learning on port])
> +check ovn-nbctl --wait=sb set Logical_Router_Port lrp-local-bgp-port
> options:dynamic-routing-no-learning=true
> +
> +# Add a route to the VRF (simulating BGP learning a route)
> +AT_CHECK([ip route add 10.10.3.1 via 20.0.0.25 vrf vrf-$vni proto zebra])
> +
> +# Verify routes do not appear in SB database.
> +wait_row_count Learned_Route 0
> +
> +AT_CHECK([ip route del 10.10.3.1 via 20.0.0.25 vrf vrf-$vni])
> +check ovn-nbctl --wait=sb set Logical_Router_Port lrp-local-bgp-port
> options:dynamic-routing-no-learning=false
> +
>  # Add again a route to the VRF (simulating BGP learning a route)
>  AT_CHECK([ip route add 10.10.3.1 via 20.0.0.25 vrf vrf-$vni proto zebra])
>
>  # Verify learned route appears in SB database
> -OVS_WAIT_UNTIL([ovn-sbctl list Learned_Route | grep ip_prefix | grep -Fe
> 10.10.3.1])
> +wait_row_count Learned_Route 1 ip_prefix=10.10.3.1
> +
> +AT_CHECK([ip route del 10.10.3.1 via 20.0.0.25 vrf vrf-$vni])
> +
> +# Verify all routes removed from SB database.
> +wait_row_count Learned_Route 0
> +
> +# Disable learning on router and enable on port
> +AS_BOX([$(date +%H:%M:%S.%03N) Disable dynamic-route learning on router,
> but not port])
> +check ovn-nbctl --wait=sb set Logical_Router lr-frr
> options:dynamic-routing-no-learning=true
> +check ovn-nbctl --wait=sb set Logical_Router_Port lrp-local-bgp-port
> options:dynamic-routing-no-learning=false
> +
> +# Add a route to the VRF (simulating BGP learning a route)
> +AT_CHECK([ip route add 10.10.3.1 via 20.0.0.25 vrf vrf-$vni proto zebra])
> +
> +# Verify routes do not appear in SB database.
> +wait_row_count Learned_Route 1
> +
> +AT_CHECK([ip route del 10.10.3.1 via 20.0.0.25 vrf vrf-$vni])
> +check ovn-nbctl --wait=sb set Logical_Router lr-frr
> options:dynamic-routing-no-learning=false
> +
> +# Add again a route to the VRF (simulating BGP learning a route)
> +AT_CHECK([ip route add 10.10.3.1 via 20.0.0.25 vrf vrf-$vni proto zebra])
> +
> +# Verify learned route appears in SB database
> +wait_row_count Learned_Route 1 ip_prefix=10.10.3.1
>
>  # Disable dynamic routing
>  AS_BOX([$(date +%H:%M:%S.%03N) Disable dynamic-routing])
> --
> 2.52.0
>
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
>
I took care of all the nits, went ahead and marged this into main.

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

Reply via email to