Re: [ovs-dev] [PATCH ovn v2 03/18] tests: Add a couple of tests in ovn-northd for I-P.
On Thu, Nov 23, 2023 at 7:50 AM Dumitru Ceara wrote: > On 10/26/23 20:14, num...@ovn.org wrote: > > From: Numan Siddique > > > > These tests cover scenarios for load balancers and NATs > > and check for the 'northd' and 'lflow' engine node > > recompute and compute stats. > > > > Signed-off-by: Numan Siddique > > --- > > tests/ovn-northd.at | 274 > > 1 file changed, 274 insertions(+) > > > > diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at > > index 28c293473c..699f6cfdce 100644 > > --- a/tests/ovn-northd.at > > +++ b/tests/ovn-northd.at > > @@ -10893,3 +10893,277 @@ CHECK_NO_CHANGE_AFTER_RECOMPUTE > > > > AT_CLEANUP > > ]) > > + > > +OVN_FOR_EACH_NORTHD_NO_HV([ > > +AT_SETUP([Load balancer incremental processing with stateless ACLs]) > > +ovn_start > > + > > +check_engine_stats() { > > + node=$1 > > + recompute=$2 > > + compute=$3 > > + > > + echo "__file__:__line__: Checking engine stats for node $node : > recompute - \ > > +$recompute : compute - $compute" > > + > > + node_stat=$(as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats > $node) > > + # node_stat will be of this format : > > + # - Node: lflow - recompute: 3 - compute: 0 - abort: 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 [[ "$recompute" == "norecompute" ]]; then > > +# node should not be recomputed > > +echo "Expecting $node recompute count - $node_recompute_ct to be 0" > > +check test "$node_recompute_ct" -eq "0" > > + else > > +echo "Expecting $node recompute count - $node_recompute_ct not to > be 0" > > +check test "$node_recompute_ct" -ne "0" > > + fi > > + > > + if [[ "$compute" == "nocompute" ]]; then > > +# node should not be computed > > +echo "Expecting $node compute count - $node_compute_ct to be 0" > > +check test "$node_compute_ct" -eq "0" > > + else > > +echo "Expecting $node compute count - $node_compute_ct not to be 0" > > +check test "$node_compute_ct" -ne "0" > > + fi > > +} > > I think there's no difference between the 3 definitions of > check_engine_stats() (this patch adds 2 of them, one already existed). > > It's probably best to factor it out and have a single definition (maybe > in ovn-macros.at?). > Thanks for the review. Ack. Done. Addressed in v3. Numan > > + > > +# Test I-P for load balancers. > > +# Presently ovn-northd handles I-P for NB LBs in northd_lb_data engine > node > > +# only. > > +check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats > > +check ovn-nbctl --wait=sb lb-add lb1 10.0.0.10:80 10.0.0.3:80 > > + > > +check ovn-nbctl ls-add sw0 > > +check ovn-nbctl acl-add sw0 from-lport 1 1 allow-stateless > > +check ovn-nbctl --wait=sb acl-add sw0 to-lport 1 1 allow-stateless > > + > > +check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats > > +check ovn-nbctl --wait=sb ls-lb-add sw0 lb1 > > +check_engine_stats lb_data norecompute compute > > +check_engine_stats northd norecompute compute > > +check_engine_stats lflow recompute nocompute > > +CHECK_NO_CHANGE_AFTER_RECOMPUTE > > + > > +# Clear the VIPs of lb1 > > +check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats > > +check ovn-nbctl --wait=sb clear load_balancer . vips > > +check_engine_stats lb_data norecompute compute > > +check_engine_stats northd norecompute compute > > +check_engine_stats lflow recompute nocompute > > +CHECK_NO_CHANGE_AFTER_RECOMPUTE > > + > > +check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats > > +check ovn-nbctl --wait=sb lb-del lb1 > > +check_engine_stats lb_data norecompute compute > > +check_engine_stats northd recompute nocompute > > +check_engine_stats lflow recompute nocompute > > +CHECK_NO_CHANGE_AFTER_RECOMPUTE > > + > > +AT_CLEANUP > > +]) > > + > > +OVN_FOR_EACH_NORTHD_NO_HV([ > > +AT_SETUP([Logical router incremental processing for NAT]) > > + > > +ovn_start > > + > > +net_add n1 > > +sim_add hv1 > > +as hv1 > > +ovs-vsctl add-br br-phys > > +ovn_attach n1 br-phys 192.168.0.11 > > + > > +check_engine_stats() { > > + node=$1 > > + recompute=$2 > > + compute=$3 > > + > > + echo "__file__:__line__: Checking engine stats for node $node : > recompute - \ > > +$recompute : compute - $compute" > > + > > + node_stat=$(as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats > $node) > > + # node_stat will be of this format : > > + # - Node: lflow - recompute: 3 - compute: 0 - abort: 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 [[ "$recompute" == "norecompute" ]]; then > > +# node should not be recomputed > > +echo "Expecting $node recompute count - $node_recompute_ct to be 0" > > +check test "$node_recompute_ct" -eq "0" > > + else > > +echo "Expecting $node recompute count -
Re: [ovs-dev] [PATCH ovn v2 03/18] tests: Add a couple of tests in ovn-northd for I-P.
On 10/26/23 20:14, num...@ovn.org wrote: > From: Numan Siddique > > These tests cover scenarios for load balancers and NATs > and check for the 'northd' and 'lflow' engine node > recompute and compute stats. > > Signed-off-by: Numan Siddique > --- > tests/ovn-northd.at | 274 > 1 file changed, 274 insertions(+) > > diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at > index 28c293473c..699f6cfdce 100644 > --- a/tests/ovn-northd.at > +++ b/tests/ovn-northd.at > @@ -10893,3 +10893,277 @@ CHECK_NO_CHANGE_AFTER_RECOMPUTE > > AT_CLEANUP > ]) > + > +OVN_FOR_EACH_NORTHD_NO_HV([ > +AT_SETUP([Load balancer incremental processing with stateless ACLs]) > +ovn_start > + > +check_engine_stats() { > + node=$1 > + recompute=$2 > + compute=$3 > + > + echo "__file__:__line__: Checking engine stats for node $node : recompute > - \ > +$recompute : compute - $compute" > + > + node_stat=$(as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats > $node) > + # node_stat will be of this format : > + # - Node: lflow - recompute: 3 - compute: 0 - abort: 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 [[ "$recompute" == "norecompute" ]]; then > +# node should not be recomputed > +echo "Expecting $node recompute count - $node_recompute_ct to be 0" > +check test "$node_recompute_ct" -eq "0" > + else > +echo "Expecting $node recompute count - $node_recompute_ct not to be 0" > +check test "$node_recompute_ct" -ne "0" > + fi > + > + if [[ "$compute" == "nocompute" ]]; then > +# node should not be computed > +echo "Expecting $node compute count - $node_compute_ct to be 0" > +check test "$node_compute_ct" -eq "0" > + else > +echo "Expecting $node compute count - $node_compute_ct not to be 0" > +check test "$node_compute_ct" -ne "0" > + fi > +} I think there's no difference between the 3 definitions of check_engine_stats() (this patch adds 2 of them, one already existed). It's probably best to factor it out and have a single definition (maybe in ovn-macros.at?). > + > +# Test I-P for load balancers. > +# Presently ovn-northd handles I-P for NB LBs in northd_lb_data engine node > +# only. > +check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats > +check ovn-nbctl --wait=sb lb-add lb1 10.0.0.10:80 10.0.0.3:80 > + > +check ovn-nbctl ls-add sw0 > +check ovn-nbctl acl-add sw0 from-lport 1 1 allow-stateless > +check ovn-nbctl --wait=sb acl-add sw0 to-lport 1 1 allow-stateless > + > +check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats > +check ovn-nbctl --wait=sb ls-lb-add sw0 lb1 > +check_engine_stats lb_data norecompute compute > +check_engine_stats northd norecompute compute > +check_engine_stats lflow recompute nocompute > +CHECK_NO_CHANGE_AFTER_RECOMPUTE > + > +# Clear the VIPs of lb1 > +check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats > +check ovn-nbctl --wait=sb clear load_balancer . vips > +check_engine_stats lb_data norecompute compute > +check_engine_stats northd norecompute compute > +check_engine_stats lflow recompute nocompute > +CHECK_NO_CHANGE_AFTER_RECOMPUTE > + > +check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats > +check ovn-nbctl --wait=sb lb-del lb1 > +check_engine_stats lb_data norecompute compute > +check_engine_stats northd recompute nocompute > +check_engine_stats lflow recompute nocompute > +CHECK_NO_CHANGE_AFTER_RECOMPUTE > + > +AT_CLEANUP > +]) > + > +OVN_FOR_EACH_NORTHD_NO_HV([ > +AT_SETUP([Logical router incremental processing for NAT]) > + > +ovn_start > + > +net_add n1 > +sim_add hv1 > +as hv1 > +ovs-vsctl add-br br-phys > +ovn_attach n1 br-phys 192.168.0.11 > + > +check_engine_stats() { > + node=$1 > + recompute=$2 > + compute=$3 > + > + echo "__file__:__line__: Checking engine stats for node $node : recompute > - \ > +$recompute : compute - $compute" > + > + node_stat=$(as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats > $node) > + # node_stat will be of this format : > + # - Node: lflow - recompute: 3 - compute: 0 - abort: 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 [[ "$recompute" == "norecompute" ]]; then > +# node should not be recomputed > +echo "Expecting $node recompute count - $node_recompute_ct to be 0" > +check test "$node_recompute_ct" -eq "0" > + else > +echo "Expecting $node recompute count - $node_recompute_ct not to be 0" > +check test "$node_recompute_ct" -ne "0" > + fi > + > + if [[ "$compute" == "nocompute" ]]; then > +# node should not be computed > +echo "Expecting $node compute count - $node_compute_ct to be 0" > +check test "$node_compute_ct" -eq "0" > + else > +echo "Expecting $node compute count - $node_compute_ct not to be 0"
[ovs-dev] [PATCH ovn v2 03/18] tests: Add a couple of tests in ovn-northd for I-P.
From: Numan Siddique These tests cover scenarios for load balancers and NATs and check for the 'northd' and 'lflow' engine node recompute and compute stats. Signed-off-by: Numan Siddique --- tests/ovn-northd.at | 274 1 file changed, 274 insertions(+) diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index 28c293473c..699f6cfdce 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -10893,3 +10893,277 @@ CHECK_NO_CHANGE_AFTER_RECOMPUTE AT_CLEANUP ]) + +OVN_FOR_EACH_NORTHD_NO_HV([ +AT_SETUP([Load balancer incremental processing with stateless ACLs]) +ovn_start + +check_engine_stats() { + node=$1 + recompute=$2 + compute=$3 + + echo "__file__:__line__: Checking engine stats for node $node : recompute - \ +$recompute : compute - $compute" + + node_stat=$(as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats $node) + # node_stat will be of this format : + # - Node: lflow - recompute: 3 - compute: 0 - abort: 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 [[ "$recompute" == "norecompute" ]]; then +# node should not be recomputed +echo "Expecting $node recompute count - $node_recompute_ct to be 0" +check test "$node_recompute_ct" -eq "0" + else +echo "Expecting $node recompute count - $node_recompute_ct not to be 0" +check test "$node_recompute_ct" -ne "0" + fi + + if [[ "$compute" == "nocompute" ]]; then +# node should not be computed +echo "Expecting $node compute count - $node_compute_ct to be 0" +check test "$node_compute_ct" -eq "0" + else +echo "Expecting $node compute count - $node_compute_ct not to be 0" +check test "$node_compute_ct" -ne "0" + fi +} + +# Test I-P for load balancers. +# Presently ovn-northd handles I-P for NB LBs in northd_lb_data engine node +# only. +check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats +check ovn-nbctl --wait=sb lb-add lb1 10.0.0.10:80 10.0.0.3:80 + +check ovn-nbctl ls-add sw0 +check ovn-nbctl acl-add sw0 from-lport 1 1 allow-stateless +check ovn-nbctl --wait=sb acl-add sw0 to-lport 1 1 allow-stateless + +check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats +check ovn-nbctl --wait=sb ls-lb-add sw0 lb1 +check_engine_stats lb_data norecompute compute +check_engine_stats northd norecompute compute +check_engine_stats lflow recompute nocompute +CHECK_NO_CHANGE_AFTER_RECOMPUTE + +# Clear the VIPs of lb1 +check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats +check ovn-nbctl --wait=sb clear load_balancer . vips +check_engine_stats lb_data norecompute compute +check_engine_stats northd norecompute compute +check_engine_stats lflow recompute nocompute +CHECK_NO_CHANGE_AFTER_RECOMPUTE + +check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats +check ovn-nbctl --wait=sb lb-del lb1 +check_engine_stats lb_data norecompute compute +check_engine_stats northd recompute nocompute +check_engine_stats lflow recompute nocompute +CHECK_NO_CHANGE_AFTER_RECOMPUTE + +AT_CLEANUP +]) + +OVN_FOR_EACH_NORTHD_NO_HV([ +AT_SETUP([Logical router incremental processing for NAT]) + +ovn_start + +net_add n1 +sim_add hv1 +as hv1 +ovs-vsctl add-br br-phys +ovn_attach n1 br-phys 192.168.0.11 + +check_engine_stats() { + node=$1 + recompute=$2 + compute=$3 + + echo "__file__:__line__: Checking engine stats for node $node : recompute - \ +$recompute : compute - $compute" + + node_stat=$(as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats $node) + # node_stat will be of this format : + # - Node: lflow - recompute: 3 - compute: 0 - abort: 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 [[ "$recompute" == "norecompute" ]]; then +# node should not be recomputed +echo "Expecting $node recompute count - $node_recompute_ct to be 0" +check test "$node_recompute_ct" -eq "0" + else +echo "Expecting $node recompute count - $node_recompute_ct not to be 0" +check test "$node_recompute_ct" -ne "0" + fi + + if [[ "$compute" == "nocompute" ]]; then +# node should not be computed +echo "Expecting $node compute count - $node_compute_ct to be 0" +check test "$node_compute_ct" -eq "0" + else +echo "Expecting $node compute count - $node_compute_ct not to be 0" +check test "$node_compute_ct" -ne "0" + fi +} + +ovn-sbctl chassis-add gw1 geneve 127.0.0.1 + +check ovn-nbctl ls-add sw0 +check ovn-nbctl lsp-add sw0 sw0p1 -- lsp-set-addresses sw0p1 "00:00:20:20:12:01 10.0.0.4" + +check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats +check ovn-nbctl --wait=sb lr-add lr0 +check_engine_stats northd recompute nocompute +check_engine_stats lflow recompute nocompute + +# Adding a logical router port should result in recompute +check as northd ovn-appctl -t NORTHD_TYPE