On Thu, Feb 13, 2025 at 05:05:33PM +0100, Felix Huettner via dev wrote:
> The I+P test for dynamic-routing previously specified if engine nodes
> need to have recomputed and/or computed for a specific change.
> However based on the execution speed of the test some changes may be
> batched together in northd (especially northbound and southbound
> updates).
> 
> For nodes where we specified "recompute compute" we sometimes did not
> get a nonzero "compute" value as the changes where handled in a run that
> also recomputed.
> 
> However this test should only find out if specific changes are processed
> fully incrementally. As such we only care about 3 potential options:
> * We did a recompute (so no or partial incremental handling)
> * We did no recompute and handled a change incrementally
> * There where no changes
> 
> By changing to this test method we avoid the issue above.

Recheck-request: github-robot-_ovn-kubernetes

> 
> Signed-off-by: Felix Huettner <[email protected]>
> ---
>  tests/ovn-northd.at | 223 +++++++++++++++++++++++++-------------------
>  1 file changed, 128 insertions(+), 95 deletions(-)
> 
> diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
> index 7455764fe..e2bcaea5d 100644
> --- a/tests/ovn-northd.at
> +++ b/tests/ovn-northd.at
> @@ -82,6 +82,39 @@ $recompute : compute - $compute"
>      check test "$node_compute_ct" -ne "0"
>    fi
>  }
> +
> +# Checks if the provided engine node recomputed, computed or is unchanged.
> +# 1st argument is the engine node.
> +# 2nd argument is the expected state.
> +# Possible values are - "recompute", "incremental" and "unchanged".
> +#
> +# Eg. 'check_engine_compute lflow incremental' will verify
> +# that if the lflow engine node recompute stat is equal to 0 and
> +# compute stat is > 0.  It fails otherwise.
> +check_engine_compute() {
> +  node=$1
> +  state=$2
> +
> +  echo "Checking engine stats for node $node : goal $state"
> +
> +  node_stat=$(as northd ovn-appctl -t ovn-northd inc-engine/show-stats $node)
> +  # node_stat will be of this format :
> +  #     - Node: lflow - recompute: 3 - compute: 0 - cancel: 0
> +  node_recompute_ct=$(echo $node_stat | cut -d '-' -f2 | cut -d ':' -f2)
> +  node_compute_ct=$(echo $node_stat | cut -d '-' -f3 | cut -d ':' -f2)
> +
> +  if [[ "$state" == "recompute" ]]; then
> +    # Node should have recomputed.
> +    # It is irrelevant if it also computed.
> +    check test "$node_recompute_ct" -ne "0"
> +  elif [[ "$state" == "incremental" ]]; then
> +    check test "$node_recompute_ct" -eq "0"
> +    check test "$node_compute_ct" -ne "0"
> +  else
> +    check test "$node_recompute_ct" -eq "0"
> +    check test "$node_compute_ct" -eq "0"
> +  fi
> +}
>  m4_divert_pop([PREPARE_TESTS])
>  
>  OVN_FOR_EACH_NORTHD_NO_HV([
> @@ -15479,11 +15512,11 @@ datapath=$(fetch_column datapath_binding _uuid 
> external_ids:name=lr0)
>  check ovn-nbctl --wait=sb set Logical_Router lr0 option:dynamic-routing=true 
> \
>      option:dynamic-routing-redistribute="connected,static"
>  
> -check_engine_stats northd recompute nocompute
> -check_engine_stats routes recompute nocompute
> -check_engine_stats advertised_route_sync recompute nocompute
> -check_engine_stats learned_route_sync recompute nocompute
> -check_engine_stats lflow recompute nocompute
> +check_engine_compute northd recompute
> +check_engine_compute routes recompute
> +check_engine_compute advertised_route_sync recompute
> +check_engine_compute learned_route_sync recompute
> +check_engine_compute lflow recompute
>  CHECK_NO_CHANGE_AFTER_RECOMPUTE
>  
>  check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
> @@ -15493,98 +15526,98 @@ check ovn-nbctl lsp-add sw0 sw0-lr0
>  check ovn-nbctl --wait=sb set Logical_Switch_Port sw0-lr0 \
>      type=router options:router-port=lr0-sw0
>  sw0=$(fetch_column port_binding _uuid logical_port=lr0-sw0)
> -check_engine_stats northd recompute compute
> -check_engine_stats routes recompute compute
> -check_engine_stats advertised_route_sync recompute compute
> -check_engine_stats learned_route_sync recompute compute
> -check_engine_stats lflow recompute compute
> +check_engine_compute northd recompute
> +check_engine_compute routes recompute
> +check_engine_compute advertised_route_sync recompute
> +check_engine_compute learned_route_sync recompute
> +check_engine_compute lflow recompute
>  CHECK_NO_CHANGE_AFTER_RECOMPUTE
>  
>  check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
>  check ovn-nbctl --wait=sb lrp-add lr0 lr0-sw1 00:00:00:00:ff:02 10.0.1.1/24
>  sw1=$(fetch_column port_binding _uuid logical_port=lr0-sw1)
> -check_engine_stats northd recompute compute
> -check_engine_stats routes recompute nocompute
> -check_engine_stats advertised_route_sync recompute nocompute
> -check_engine_stats learned_route_sync recompute nocompute
> -check_engine_stats lflow recompute nocompute
> +check_engine_compute northd recompute
> +check_engine_compute routes recompute
> +check_engine_compute advertised_route_sync recompute
> +check_engine_compute learned_route_sync recompute
> +check_engine_compute lflow recompute
>  CHECK_NO_CHANGE_AFTER_RECOMPUTE
>  
>  check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
>  check ovn-nbctl --wait=sb lr-route-add lr0 192.168.0.0/24 10.0.0.10
> -check_engine_stats northd recompute nocompute
> -check_engine_stats routes recompute nocompute
> -check_engine_stats advertised_route_sync recompute nocompute
> -check_engine_stats learned_route_sync recompute nocompute
> -check_engine_stats lflow recompute nocompute
> +check_engine_compute northd recompute
> +check_engine_compute routes recompute
> +check_engine_compute advertised_route_sync recompute
> +check_engine_compute learned_route_sync recompute
> +check_engine_compute lflow recompute
>  CHECK_NO_CHANGE_AFTER_RECOMPUTE
>  
>  check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
>  check ovn-nbctl --wait=sb lrp-add lr0 lr0-sw2 00:00:00:00:ff:03 
> 2001:db8::1/64 fe80::1/64
>  sw2=$(fetch_column port_binding _uuid logical_port=lr0-sw2)
> -check_engine_stats northd recompute compute
> -check_engine_stats routes recompute nocompute
> -check_engine_stats advertised_route_sync recompute nocompute
> -check_engine_stats learned_route_sync recompute nocompute
> -check_engine_stats lflow recompute nocompute
> +check_engine_compute northd recompute
> +check_engine_compute routes recompute
> +check_engine_compute advertised_route_sync recompute
> +check_engine_compute learned_route_sync recompute
> +check_engine_compute lflow recompute
>  CHECK_NO_CHANGE_AFTER_RECOMPUTE
>  
>  check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
>  check ovn-nbctl --wait=sb remove Logical_Router lr0 option dynamic-routing
> -check_engine_stats northd recompute nocompute
> -check_engine_stats routes recompute nocompute
> -check_engine_stats advertised_route_sync recompute nocompute
> -check_engine_stats learned_route_sync recompute nocompute
> -check_engine_stats lflow recompute nocompute
> +check_engine_compute northd recompute
> +check_engine_compute routes recompute
> +check_engine_compute advertised_route_sync recompute
> +check_engine_compute learned_route_sync recompute
> +check_engine_compute lflow recompute
>  CHECK_NO_CHANGE_AFTER_RECOMPUTE
>  
>  check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
>  check ovn-nbctl --wait=sb set Logical_Router lr0 option:dynamic-routing=true
> -check_engine_stats northd recompute nocompute
> -check_engine_stats routes recompute nocompute
> -check_engine_stats advertised_route_sync recompute nocompute
> -check_engine_stats learned_route_sync recompute nocompute
> -check_engine_stats lflow recompute nocompute
> +check_engine_compute northd recompute
> +check_engine_compute routes recompute
> +check_engine_compute advertised_route_sync recompute
> +check_engine_compute learned_route_sync recompute
> +check_engine_compute lflow recompute
>  CHECK_NO_CHANGE_AFTER_RECOMPUTE
>  
>  check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
>  check ovn-nbctl --wait=sb set Logical_Router lr0 \
>      option:dynamic-routing-redistribute="static"
> -check_engine_stats northd recompute nocompute
> -check_engine_stats routes recompute nocompute
> -check_engine_stats advertised_route_sync recompute nocompute
> -check_engine_stats learned_route_sync recompute nocompute
> -check_engine_stats lflow recompute nocompute
> +check_engine_compute northd recompute
> +check_engine_compute routes recompute
> +check_engine_compute advertised_route_sync recompute
> +check_engine_compute learned_route_sync recompute
> +check_engine_compute lflow recompute
>  CHECK_NO_CHANGE_AFTER_RECOMPUTE
>  
>  check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
>  check ovn-nbctl --wait=sb remove Logical_Router lr0 \
>      option dynamic-routing-redistribute
> -check_engine_stats northd recompute nocompute
> -check_engine_stats routes recompute nocompute
> -check_engine_stats advertised_route_sync recompute nocompute
> -check_engine_stats learned_route_sync recompute nocompute
> -check_engine_stats lflow recompute nocompute
> +check_engine_compute northd recompute
> +check_engine_compute routes recompute
> +check_engine_compute advertised_route_sync recompute
> +check_engine_compute learned_route_sync recompute
> +check_engine_compute lflow recompute
>  CHECK_NO_CHANGE_AFTER_RECOMPUTE
>  
>  check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
>  check ovn-nbctl --wait=sb set Logical_Router_Port lr0-sw1 \
>      option:dynamic-routing-redistribute="connected"
> -check_engine_stats northd recompute nocompute
> -check_engine_stats routes recompute nocompute
> -check_engine_stats advertised_route_sync recompute nocompute
> -check_engine_stats learned_route_sync recompute nocompute
> -check_engine_stats lflow recompute nocompute
> +check_engine_compute northd recompute
> +check_engine_compute routes recompute
> +check_engine_compute advertised_route_sync recompute
> +check_engine_compute learned_route_sync recompute
> +check_engine_compute lflow recompute
>  CHECK_NO_CHANGE_AFTER_RECOMPUTE
>  
>  check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
>  check ovn-nbctl --wait=sb set Logical_Router_Port lr0-sw0 \
>      option:dynamic-routing-redistribute="connected"
> -check_engine_stats northd recompute nocompute
> -check_engine_stats routes recompute nocompute
> -check_engine_stats advertised_route_sync recompute nocompute
> -check_engine_stats learned_route_sync recompute nocompute
> -check_engine_stats lflow recompute nocompute
> +check_engine_compute northd recompute
> +check_engine_compute routes recompute
> +check_engine_compute advertised_route_sync recompute
> +check_engine_compute learned_route_sync recompute
> +check_engine_compute lflow recompute
>  CHECK_NO_CHANGE_AFTER_RECOMPUTE
>  
>  check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
> @@ -15594,41 +15627,41 @@ check_uuid ovn-sbctl create Learned_Route \
>      ip_prefix=172.16.0.0/24               \
>      nexthop=10.0.0.11
>  check ovn-nbctl --wait=sb sync
> -check_engine_stats northd norecompute nocompute
> -check_engine_stats routes norecompute nocompute
> -check_engine_stats advertised_route_sync norecompute nocompute
> -check_engine_stats learned_route_sync recompute nocompute
> -check_engine_stats lflow recompute nocompute
> +check_engine_compute northd unchanged
> +check_engine_compute routes unchanged
> +check_engine_compute advertised_route_sync unchanged
> +check_engine_compute learned_route_sync recompute
> +check_engine_compute lflow recompute
>  CHECK_NO_CHANGE_AFTER_RECOMPUTE
>  
>  check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
>  check ovn-sbctl --all destroy Learned_Route
>  check ovn-nbctl --wait=sb sync
> -check_engine_stats northd norecompute nocompute
> -check_engine_stats routes norecompute nocompute
> -check_engine_stats advertised_route_sync norecompute nocompute
> -check_engine_stats learned_route_sync recompute nocompute
> -check_engine_stats lflow recompute nocompute
> +check_engine_compute northd unchanged
> +check_engine_compute routes unchanged
> +check_engine_compute advertised_route_sync unchanged
> +check_engine_compute learned_route_sync recompute
> +check_engine_compute lflow recompute
>  CHECK_NO_CHANGE_AFTER_RECOMPUTE
>  
>  check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
>  check ovn-nbctl --wait=sb set Logical_Router_Port lr0-sw0 \
>      options:dynamic-routing-redistribute="connected-as-host"
> -check_engine_stats northd recompute nocompute
> -check_engine_stats routes recompute nocompute
> -check_engine_stats advertised_route_sync recompute nocompute
> -check_engine_stats learned_route_sync recompute nocompute
> -check_engine_stats lflow recompute nocompute
> +check_engine_compute northd recompute
> +check_engine_compute routes recompute
> +check_engine_compute advertised_route_sync recompute
> +check_engine_compute learned_route_sync recompute
> +check_engine_compute lflow recompute
>  CHECK_NO_CHANGE_AFTER_RECOMPUTE
>  
>  check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
>  check ovn-nbctl lsp-add sw0 sw0-vif0
>  check ovn-nbctl --wait=sb lsp-set-addresses sw0-vif0 "00:aa:bb:cc:dd:ee 
> 10.0.0.2"
> -check_engine_stats northd norecompute compute
> -check_engine_stats routes norecompute compute
> -check_engine_stats advertised_route_sync recompute nocompute
> -check_engine_stats learned_route_sync norecompute compute
> -check_engine_stats lflow norecompute compute
> +check_engine_compute northd incremental
> +check_engine_compute routes incremental
> +check_engine_compute advertised_route_sync recompute
> +check_engine_compute learned_route_sync incremental
> +check_engine_compute lflow incremental
>  CHECK_NO_CHANGE_AFTER_RECOMPUTE
>  
>  check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
> @@ -15637,38 +15670,38 @@ check ovn-nbctl lrp-add lr1 lr1-sw0 
> 00:00:00:01:ff:01 10.0.0.10/24
>  check ovn-nbctl lsp-add sw0 sw0-lr1
>  check ovn-nbctl --wait=sb set Logical_Switch_Port sw0-lr1 \
>      type=router options:router-port=lr1-sw0
> -check_engine_stats northd recompute compute
> -check_engine_stats routes recompute compute
> -check_engine_stats advertised_route_sync recompute nocompute
> -check_engine_stats learned_route_sync recompute compute
> -check_engine_stats lflow recompute compute
> +check_engine_compute northd recompute
> +check_engine_compute routes recompute
> +check_engine_compute advertised_route_sync recompute
> +check_engine_compute learned_route_sync recompute
> +check_engine_compute lflow recompute
>  CHECK_NO_CHANGE_AFTER_RECOMPUTE
>  
>  check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
>  check ovn-nbctl --wait=sb lr-nat-add lr1 dnat_and_snat 10.0.0.100 192.168.0.1
> -check_engine_stats northd norecompute compute
> -check_engine_stats routes norecompute compute
> -check_engine_stats advertised_route_sync recompute nocompute
> -check_engine_stats learned_route_sync norecompute compute
> -check_engine_stats lflow norecompute compute
> +check_engine_compute northd incremental
> +check_engine_compute routes incremental
> +check_engine_compute advertised_route_sync recompute
> +check_engine_compute learned_route_sync incremental
> +check_engine_compute lflow incremental
>  CHECK_NO_CHANGE_AFTER_RECOMPUTE
>  
>  check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
>  check ovn-nbctl --wait=sb lrp-del lr0-sw0
> -check_engine_stats northd recompute compute
> -check_engine_stats routes recompute nocompute
> -check_engine_stats advertised_route_sync recompute nocompute
> -check_engine_stats learned_route_sync recompute nocompute
> -check_engine_stats lflow recompute nocompute
> +check_engine_compute northd recompute
> +check_engine_compute routes recompute
> +check_engine_compute advertised_route_sync recompute
> +check_engine_compute learned_route_sync recompute
> +check_engine_compute lflow recompute
>  CHECK_NO_CHANGE_AFTER_RECOMPUTE
>  
>  check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
>  check ovn-nbctl --wait=sb lr-del lr0
> -check_engine_stats northd recompute nocompute
> -check_engine_stats routes recompute nocompute
> -check_engine_stats advertised_route_sync recompute nocompute
> -check_engine_stats learned_route_sync recompute nocompute
> -check_engine_stats lflow recompute nocompute
> +check_engine_compute northd recompute
> +check_engine_compute routes recompute
> +check_engine_compute advertised_route_sync recompute
> +check_engine_compute learned_route_sync recompute
> +check_engine_compute lflow recompute
>  CHECK_NO_CHANGE_AFTER_RECOMPUTE
>  
>  AT_CLEANUP
> 
> base-commit: 1098d316be577f5bd5c2f9d4aedb192b6df08094
> -- 
> 2.48.1
> 
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to