Re: [ovs-dev] [PATCH v2] tests: Add PMD auto load balance unit tests.

2021-06-24 Thread Kevin Traynor
On 23/06/2021 21:49, Ilya Maximets wrote:
> On 3/16/21 4:45 PM, Kevin Traynor wrote:
>> These tests focus on enabling/disabling and user parameters.
>>
>> Co-Authored-by: David Marchand 
>> Signed-off-by: David Marchand 
>> Signed-off-by: Kevin Traynor 
>>
>> ---
>> v2:
>> - Remove above max documented interval test
>> - Add David's code to combine param checks and add as co-author
>> ---
>>  tests/alb.at   | 218 +
>>  tests/automake.mk  |   1 +
>>  tests/testsuite.at |   1 +
>>  3 files changed, 220 insertions(+)
>>  create mode 100644 tests/alb.at
> 
> Hi, Kevin.  While testing these tests I noticed one thing:
> 
> get_log_line_num() returns current line and not the next one, so if log
> didn't change, several subsequent get_log_line_num + OVS_WAIT_UNTIL
> will succeed.  Meaning that it maybe unreliable to test for the same
> text in a log two times in a row with some command in-between, because
> command may return faster than logs printed to a file and the check
> will be performed with the previous line in a log.  Suggesting to
> increase the line number by one to avoid that.  I understand that you
> ported this part from the pmd.at, so we, probably, need to fix that
> there too in a separate change.
> 

Hi Ilya, that makes sense. Even if it was ok for the current tests due
to the particular logs, there is a danger that it would be reused again
and cause an issue then. I will update here and send a patch for pmd.at.

> Suggesting following incremental:
> 
> diff --git a/tests/alb.at b/tests/alb.at
> index 0ea1bbdd1..1331b742c 100644
> --- a/tests/alb.at
> +++ b/tests/alb.at
> @@ -3,7 +3,7 @@ AT_BANNER([PMD Auto Load Balance])
>  m4_divert_push([PREPARE_TESTS])
>  
>  get_log_line_num () {
> -LINENUM=$(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])
> +LINENUM=$(($(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])+1))
>  }
>  
>  m4_divert_pop([PREPARE_TESTS])
> @@ -21,7 +21,8 @@ m4_define([CHECK_ALB_PARAM], [
>  line_st="+0"
>  fi
>  OVS_WAIT_UNTIL([tail -n $line_st ovs-vswitchd.log | grep "PMD auto load 
> balance $1 set to"])
> -AT_CHECK([tail -n $line_st ovs-vswitchd.log | sed -n "s#.*\(PMD auto 
> load balance $1 set to.*\)#\1#p" | tail -1], [0], [dnl
> +AT_CHECK([tail -n $line_st ovs-vswitchd.log dnl
> +| sed -n "s#.*\(PMD auto load balance $1 set to.*\)#\1#p" | 
> tail -1], [0], [dnl
>  PMD auto load balance $1 set to $2
>  ])
>  ])
> @@ -107,7 +108,9 @@ OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep 
> "PMD auto load balance
>  get_log_line_num
>  AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="false"])
>  OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
> balance is disabled"])
> +get_log_line_num
>  AT_CHECK([ovs-vsctl set Open_vSwitch . 
> other_config:pmd-rxq-assign=roundrobin])
> +OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "mode changed to: 
> 'roundrobin'"])
>  get_log_line_num
>  AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="true"])
>  OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
> balance is disabled"])
> ---
> 
> What do you think?
> The check around 'roundrobin' is just in case, to be sure that
> log actually updated.
> 

Yeah, good idea. In earlier cases it is changing between enable/disable,
but I also added similar check on assignment mode change, just to be
explicit that it is the reason.

thanks,
Kevin.

> Best regards, Ilya Maximets.
> 

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] tests: Add PMD auto load balance unit tests.

2021-06-23 Thread Ilya Maximets
On 3/16/21 4:45 PM, Kevin Traynor wrote:
> These tests focus on enabling/disabling and user parameters.
> 
> Co-Authored-by: David Marchand 
> Signed-off-by: David Marchand 
> Signed-off-by: Kevin Traynor 
> 
> ---
> v2:
> - Remove above max documented interval test
> - Add David's code to combine param checks and add as co-author
> ---
>  tests/alb.at   | 218 +
>  tests/automake.mk  |   1 +
>  tests/testsuite.at |   1 +
>  3 files changed, 220 insertions(+)
>  create mode 100644 tests/alb.at

Hi, Kevin.  While testing these tests I noticed one thing:

get_log_line_num() returns current line and not the next one, so if log
didn't change, several subsequent get_log_line_num + OVS_WAIT_UNTIL
will succeed.  Meaning that it maybe unreliable to test for the same
text in a log two times in a row with some command in-between, because
command may return faster than logs printed to a file and the check
will be performed with the previous line in a log.  Suggesting to
increase the line number by one to avoid that.  I understand that you
ported this part from the pmd.at, so we, probably, need to fix that
there too in a separate change.

Suggesting following incremental:

diff --git a/tests/alb.at b/tests/alb.at
index 0ea1bbdd1..1331b742c 100644
--- a/tests/alb.at
+++ b/tests/alb.at
@@ -3,7 +3,7 @@ AT_BANNER([PMD Auto Load Balance])
 m4_divert_push([PREPARE_TESTS])
 
 get_log_line_num () {
-LINENUM=$(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])
+LINENUM=$(($(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])+1))
 }
 
 m4_divert_pop([PREPARE_TESTS])
@@ -21,7 +21,8 @@ m4_define([CHECK_ALB_PARAM], [
 line_st="+0"
 fi
 OVS_WAIT_UNTIL([tail -n $line_st ovs-vswitchd.log | grep "PMD auto load 
balance $1 set to"])
-AT_CHECK([tail -n $line_st ovs-vswitchd.log | sed -n "s#.*\(PMD auto load 
balance $1 set to.*\)#\1#p" | tail -1], [0], [dnl
+AT_CHECK([tail -n $line_st ovs-vswitchd.log dnl
+| sed -n "s#.*\(PMD auto load balance $1 set to.*\)#\1#p" | 
tail -1], [0], [dnl
 PMD auto load balance $1 set to $2
 ])
 ])
@@ -107,7 +108,9 @@ OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep 
"PMD auto load balance
 get_log_line_num
 AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="false"])
 OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
balance is disabled"])
+get_log_line_num
 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-rxq-assign=roundrobin])
+OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "mode changed to: 
'roundrobin'"])
 get_log_line_num
 AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="true"])
 OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
balance is disabled"])
---

What do you think?
The check around 'roundrobin' is just in case, to be sure that
log actually updated.

Best regards, Ilya Maximets.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] tests: Add PMD auto load balance unit tests.

2021-06-08 Thread Kevin Traynor
Not sure why some names seemed dropped out of CC. Re-adding.

On 08/06/2021 13:47, Kevin Traynor wrote:
> Ping
> 
> On 05/05/2021 14:34, Kevin Traynor wrote:
>> Ping. Any objection to adding these unit tests?
>>
>> On 16/03/2021 15:45, Kevin Traynor wrote:
>>> These tests focus on enabling/disabling and user parameters.
>>>
>>> Co-Authored-by: David Marchand 
>>> Signed-off-by: David Marchand 
>>> Signed-off-by: Kevin Traynor 
>>>
>>> ---
>>> v2:
>>> - Remove above max documented interval test
>>> - Add David's code to combine param checks and add as co-author
>>> ---
>>>  tests/alb.at   | 218 +
>>>  tests/automake.mk  |   1 +
>>>  tests/testsuite.at |   1 +
>>>  3 files changed, 220 insertions(+)
>>>  create mode 100644 tests/alb.at
>>>
>>> diff --git a/tests/alb.at b/tests/alb.at
>>> new file mode 100644
>>> index 0..0ea1bbdd1
>>> --- /dev/null
>>> +++ b/tests/alb.at
>>> @@ -0,0 +1,218 @@
>>> +AT_BANNER([PMD Auto Load Balance])
>>> +
>>> +m4_divert_push([PREPARE_TESTS])
>>> +
>>> +get_log_line_num () {
>>> +LINENUM=$(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])
>>> +}
>>> +
>>> +m4_divert_pop([PREPARE_TESTS])
>>> +
>>> +m4_define([DUMMY_NUMA], [--dummy-numa="0,0"])
>>> +
>>> +dnl CHECK_ALB_PARAM([param], [value], [+line])
>>> +dnl
>>> +dnl Waits for ALB logs for 'param' in logs and checks if value matches
>>> +dnl 'value'. Checking starts from line number 'line' in ovs-vswithd.log.
>>> +m4_define([CHECK_ALB_PARAM], [
>>> +line_st=$3
>>> +if [[ -z "$line_st" ]]
>>> +then
>>> +line_st="+0"
>>> +fi
>>> +OVS_WAIT_UNTIL([tail -n $line_st ovs-vswitchd.log | grep "PMD auto 
>>> load balance $1 set to"])
>>> +AT_CHECK([tail -n $line_st ovs-vswitchd.log | sed -n "s#.*\(PMD auto 
>>> load balance $1 set to.*\)#\1#p" | tail -1], [0], [dnl
>>> +PMD auto load balance $1 set to $2
>>> +])
>>> +])
>>> +
>>> +AT_SETUP([ALB - default state])
>>> +OVS_VSWITCHD_START
>>> +OVS_WAIT_UNTIL([grep "PMD auto load balance is disabled" ovs-vswitchd.log])
>>> +
>>> +OVS_VSWITCHD_STOP
>>> +AT_CLEANUP
>>> +
>>> +AT_SETUP([ALB - enable/disable])
>>> +OVS_VSWITCHD_START([add-port br0 p0 \
>>> +-- set Interface p0 type=dummy-pmd options:n_rxq=3 \
>>> +-- set Open_vSwitch . other_config:pmd-cpu-mask=3 \
>>> +-- set open_vswitch . other_config:pmd-auto-lb="true"],
>>> +   [], [], [DUMMY_NUMA])
>>> +OVS_WAIT_UNTIL([grep "PMD auto load balance is enabled" ovs-vswitchd.log])
>>> +
>>> +get_log_line_num
>>> +AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="false"])
>>> +OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
>>> balance is disabled"])
>>> +
>>> +get_log_line_num
>>> +AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="true"])
>>> +OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
>>> balance is enabled"])
>>> +
>>> +OVS_VSWITCHD_STOP
>>> +AT_CLEANUP
>>> +
>>> +AT_SETUP([ALB - min num PMD/RxQ])
>>> +OVS_VSWITCHD_START([add-port br0 p0 \
>>> +-- set Interface p0 type=dummy-pmd options:n_rxq=2 \
>>> +-- set Open_vSwitch . other_config:pmd-cpu-mask=1 \
>>> +-- set open_vswitch . other_config:pmd-auto-lb="true"],
>>> +   [], [], [DUMMY_NUMA])
>>> +OVS_WAIT_UNTIL([grep "PMD auto load balance is disabled" ovs-vswitchd.log])
>>> +
>>> +# Add more PMD
>>> +AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=0x3])
>>> +OVS_WAIT_UNTIL([grep "There are 2 pmd threads on numa node" 
>>> ovs-vswitchd.log])
>>> +
>>> +# Add one more rxq to have 2 rxq on a PMD
>>> +get_log_line_num
>>> +AT_CHECK([ovs-vsctl set interface p0 options:n_rxq=3])
>>> +OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
>>> balance is enabled"])
>>> +
>>> +# Reduce PMD
>>> +get_log_line_num
>>> +AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=0x1])
>>> +OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
>>> balance is disabled"])
>>> +
>>> +# Check logs when try to enable but min PMD/RxQ prevents
>>> +get_log_line_num
>>> +AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="false"])
>>> +OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
>>> balance is disabled"])
>>> +get_log_line_num
>>> +AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="true"])
>>> +OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
>>> balance is disabled"])
>>> +
>>> +OVS_VSWITCHD_STOP
>>> +AT_CLEANUP
>>> +
>>> +AT_SETUP([ALB - PMD/RxQ assignment type])
>>> +OVS_VSWITCHD_START([add-port br0 p0 \
>>> +-- set Interface p0 type=dummy-pmd options:n_rxq=3 \
>>> +-- set Open_vSwitch . other_config:pmd-cpu-mask=3 \
>>> +-- set open_vswitch . other_config:pmd-auto-lb="true"],
>>> +  

Re: [ovs-dev] [PATCH v2] tests: Add PMD auto load balance unit tests.

2021-06-08 Thread Kevin Traynor
Ping

On 05/05/2021 14:34, Kevin Traynor wrote:
> Ping. Any objection to adding these unit tests?
> 
> On 16/03/2021 15:45, Kevin Traynor wrote:
>> These tests focus on enabling/disabling and user parameters.
>>
>> Co-Authored-by: David Marchand 
>> Signed-off-by: David Marchand 
>> Signed-off-by: Kevin Traynor 
>>
>> ---
>> v2:
>> - Remove above max documented interval test
>> - Add David's code to combine param checks and add as co-author
>> ---
>>  tests/alb.at   | 218 +
>>  tests/automake.mk  |   1 +
>>  tests/testsuite.at |   1 +
>>  3 files changed, 220 insertions(+)
>>  create mode 100644 tests/alb.at
>>
>> diff --git a/tests/alb.at b/tests/alb.at
>> new file mode 100644
>> index 0..0ea1bbdd1
>> --- /dev/null
>> +++ b/tests/alb.at
>> @@ -0,0 +1,218 @@
>> +AT_BANNER([PMD Auto Load Balance])
>> +
>> +m4_divert_push([PREPARE_TESTS])
>> +
>> +get_log_line_num () {
>> +LINENUM=$(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])
>> +}
>> +
>> +m4_divert_pop([PREPARE_TESTS])
>> +
>> +m4_define([DUMMY_NUMA], [--dummy-numa="0,0"])
>> +
>> +dnl CHECK_ALB_PARAM([param], [value], [+line])
>> +dnl
>> +dnl Waits for ALB logs for 'param' in logs and checks if value matches
>> +dnl 'value'. Checking starts from line number 'line' in ovs-vswithd.log.
>> +m4_define([CHECK_ALB_PARAM], [
>> +line_st=$3
>> +if [[ -z "$line_st" ]]
>> +then
>> +line_st="+0"
>> +fi
>> +OVS_WAIT_UNTIL([tail -n $line_st ovs-vswitchd.log | grep "PMD auto load 
>> balance $1 set to"])
>> +AT_CHECK([tail -n $line_st ovs-vswitchd.log | sed -n "s#.*\(PMD auto 
>> load balance $1 set to.*\)#\1#p" | tail -1], [0], [dnl
>> +PMD auto load balance $1 set to $2
>> +])
>> +])
>> +
>> +AT_SETUP([ALB - default state])
>> +OVS_VSWITCHD_START
>> +OVS_WAIT_UNTIL([grep "PMD auto load balance is disabled" ovs-vswitchd.log])
>> +
>> +OVS_VSWITCHD_STOP
>> +AT_CLEANUP
>> +
>> +AT_SETUP([ALB - enable/disable])
>> +OVS_VSWITCHD_START([add-port br0 p0 \
>> +-- set Interface p0 type=dummy-pmd options:n_rxq=3 \
>> +-- set Open_vSwitch . other_config:pmd-cpu-mask=3 \
>> +-- set open_vswitch . other_config:pmd-auto-lb="true"],
>> +   [], [], [DUMMY_NUMA])
>> +OVS_WAIT_UNTIL([grep "PMD auto load balance is enabled" ovs-vswitchd.log])
>> +
>> +get_log_line_num
>> +AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="false"])
>> +OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
>> balance is disabled"])
>> +
>> +get_log_line_num
>> +AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="true"])
>> +OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
>> balance is enabled"])
>> +
>> +OVS_VSWITCHD_STOP
>> +AT_CLEANUP
>> +
>> +AT_SETUP([ALB - min num PMD/RxQ])
>> +OVS_VSWITCHD_START([add-port br0 p0 \
>> +-- set Interface p0 type=dummy-pmd options:n_rxq=2 \
>> +-- set Open_vSwitch . other_config:pmd-cpu-mask=1 \
>> +-- set open_vswitch . other_config:pmd-auto-lb="true"],
>> +   [], [], [DUMMY_NUMA])
>> +OVS_WAIT_UNTIL([grep "PMD auto load balance is disabled" ovs-vswitchd.log])
>> +
>> +# Add more PMD
>> +AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=0x3])
>> +OVS_WAIT_UNTIL([grep "There are 2 pmd threads on numa node" 
>> ovs-vswitchd.log])
>> +
>> +# Add one more rxq to have 2 rxq on a PMD
>> +get_log_line_num
>> +AT_CHECK([ovs-vsctl set interface p0 options:n_rxq=3])
>> +OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
>> balance is enabled"])
>> +
>> +# Reduce PMD
>> +get_log_line_num
>> +AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=0x1])
>> +OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
>> balance is disabled"])
>> +
>> +# Check logs when try to enable but min PMD/RxQ prevents
>> +get_log_line_num
>> +AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="false"])
>> +OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
>> balance is disabled"])
>> +get_log_line_num
>> +AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="true"])
>> +OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
>> balance is disabled"])
>> +
>> +OVS_VSWITCHD_STOP
>> +AT_CLEANUP
>> +
>> +AT_SETUP([ALB - PMD/RxQ assignment type])
>> +OVS_VSWITCHD_START([add-port br0 p0 \
>> +-- set Interface p0 type=dummy-pmd options:n_rxq=3 \
>> +-- set Open_vSwitch . other_config:pmd-cpu-mask=3 \
>> +-- set open_vswitch . other_config:pmd-auto-lb="true"],
>> +   [], [], [DUMMY_NUMA])
>> +OVS_WAIT_UNTIL([grep "PMD auto load balance is enabled" ovs-vswitchd.log])
>> +
>> +# Change assignment type
>> +get_log_line_num
>> +AT_CHECK([ovs-vsctl set Open_vSwitch . 
>> other_config:pmd-

Re: [ovs-dev] [PATCH v2] tests: Add PMD auto load balance unit tests.

2021-05-05 Thread Kevin Traynor
Ping. Any objection to adding these unit tests?

On 16/03/2021 15:45, Kevin Traynor wrote:
> These tests focus on enabling/disabling and user parameters.
> 
> Co-Authored-by: David Marchand 
> Signed-off-by: David Marchand 
> Signed-off-by: Kevin Traynor 
> 
> ---
> v2:
> - Remove above max documented interval test
> - Add David's code to combine param checks and add as co-author
> ---
>  tests/alb.at   | 218 +
>  tests/automake.mk  |   1 +
>  tests/testsuite.at |   1 +
>  3 files changed, 220 insertions(+)
>  create mode 100644 tests/alb.at
> 
> diff --git a/tests/alb.at b/tests/alb.at
> new file mode 100644
> index 0..0ea1bbdd1
> --- /dev/null
> +++ b/tests/alb.at
> @@ -0,0 +1,218 @@
> +AT_BANNER([PMD Auto Load Balance])
> +
> +m4_divert_push([PREPARE_TESTS])
> +
> +get_log_line_num () {
> +LINENUM=$(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])
> +}
> +
> +m4_divert_pop([PREPARE_TESTS])
> +
> +m4_define([DUMMY_NUMA], [--dummy-numa="0,0"])
> +
> +dnl CHECK_ALB_PARAM([param], [value], [+line])
> +dnl
> +dnl Waits for ALB logs for 'param' in logs and checks if value matches
> +dnl 'value'. Checking starts from line number 'line' in ovs-vswithd.log.
> +m4_define([CHECK_ALB_PARAM], [
> +line_st=$3
> +if [[ -z "$line_st" ]]
> +then
> +line_st="+0"
> +fi
> +OVS_WAIT_UNTIL([tail -n $line_st ovs-vswitchd.log | grep "PMD auto load 
> balance $1 set to"])
> +AT_CHECK([tail -n $line_st ovs-vswitchd.log | sed -n "s#.*\(PMD auto 
> load balance $1 set to.*\)#\1#p" | tail -1], [0], [dnl
> +PMD auto load balance $1 set to $2
> +])
> +])
> +
> +AT_SETUP([ALB - default state])
> +OVS_VSWITCHD_START
> +OVS_WAIT_UNTIL([grep "PMD auto load balance is disabled" ovs-vswitchd.log])
> +
> +OVS_VSWITCHD_STOP
> +AT_CLEANUP
> +
> +AT_SETUP([ALB - enable/disable])
> +OVS_VSWITCHD_START([add-port br0 p0 \
> +-- set Interface p0 type=dummy-pmd options:n_rxq=3 \
> +-- set Open_vSwitch . other_config:pmd-cpu-mask=3 \
> +-- set open_vswitch . other_config:pmd-auto-lb="true"],
> +   [], [], [DUMMY_NUMA])
> +OVS_WAIT_UNTIL([grep "PMD auto load balance is enabled" ovs-vswitchd.log])
> +
> +get_log_line_num
> +AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="false"])
> +OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
> balance is disabled"])
> +
> +get_log_line_num
> +AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="true"])
> +OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
> balance is enabled"])
> +
> +OVS_VSWITCHD_STOP
> +AT_CLEANUP
> +
> +AT_SETUP([ALB - min num PMD/RxQ])
> +OVS_VSWITCHD_START([add-port br0 p0 \
> +-- set Interface p0 type=dummy-pmd options:n_rxq=2 \
> +-- set Open_vSwitch . other_config:pmd-cpu-mask=1 \
> +-- set open_vswitch . other_config:pmd-auto-lb="true"],
> +   [], [], [DUMMY_NUMA])
> +OVS_WAIT_UNTIL([grep "PMD auto load balance is disabled" ovs-vswitchd.log])
> +
> +# Add more PMD
> +AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=0x3])
> +OVS_WAIT_UNTIL([grep "There are 2 pmd threads on numa node" 
> ovs-vswitchd.log])
> +
> +# Add one more rxq to have 2 rxq on a PMD
> +get_log_line_num
> +AT_CHECK([ovs-vsctl set interface p0 options:n_rxq=3])
> +OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
> balance is enabled"])
> +
> +# Reduce PMD
> +get_log_line_num
> +AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=0x1])
> +OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
> balance is disabled"])
> +
> +# Check logs when try to enable but min PMD/RxQ prevents
> +get_log_line_num
> +AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="false"])
> +OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
> balance is disabled"])
> +get_log_line_num
> +AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="true"])
> +OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
> balance is disabled"])
> +
> +OVS_VSWITCHD_STOP
> +AT_CLEANUP
> +
> +AT_SETUP([ALB - PMD/RxQ assignment type])
> +OVS_VSWITCHD_START([add-port br0 p0 \
> +-- set Interface p0 type=dummy-pmd options:n_rxq=3 \
> +-- set Open_vSwitch . other_config:pmd-cpu-mask=3 \
> +-- set open_vswitch . other_config:pmd-auto-lb="true"],
> +   [], [], [DUMMY_NUMA])
> +OVS_WAIT_UNTIL([grep "PMD auto load balance is enabled" ovs-vswitchd.log])
> +
> +# Change assignment type
> +get_log_line_num
> +AT_CHECK([ovs-vsctl set Open_vSwitch . 
> other_config:pmd-rxq-assign=roundrobin])
> +OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
> balance is disabled"])
> +
> +# Change back assignment type
> +get_log_line_num

Re: [ovs-dev] [PATCH v2] tests: Add PMD auto load balance unit tests.

2021-03-16 Thread Pai G, Sunil
Hey Kevin

> -Original Message-
> From: Kevin Traynor 
> Sent: Tuesday, March 16, 2021 9:16 PM
> To: d...@openvswitch.org
> Cc: david.march...@redhat.com; Pai G, Sunil ; Kevin
> Traynor 
> Subject: [PATCH v2] tests: Add PMD auto load balance unit tests.
> 
> These tests focus on enabling/disabling and user parameters.
> 
> Co-Authored-by: David Marchand 
> Signed-off-by: David Marchand 
> Signed-off-by: Kevin Traynor 
> 
> ---
> v2:
> - Remove above max documented interval test
> - Add David's code to combine param checks and add as co-author
> ---
>  tests/alb.at   | 218
> +
>  tests/automake.mk  |   1 +
>  tests/testsuite.at |   1 +
>  3 files changed, 220 insertions(+)
>  create mode 100644 tests/alb.at

LGTM
Acked-by: Sunil Pai G 
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2] tests: Add PMD auto load balance unit tests.

2021-03-16 Thread Kevin Traynor
These tests focus on enabling/disabling and user parameters.

Co-Authored-by: David Marchand 
Signed-off-by: David Marchand 
Signed-off-by: Kevin Traynor 

---
v2:
- Remove above max documented interval test
- Add David's code to combine param checks and add as co-author
---
 tests/alb.at   | 218 +
 tests/automake.mk  |   1 +
 tests/testsuite.at |   1 +
 3 files changed, 220 insertions(+)
 create mode 100644 tests/alb.at

diff --git a/tests/alb.at b/tests/alb.at
new file mode 100644
index 0..0ea1bbdd1
--- /dev/null
+++ b/tests/alb.at
@@ -0,0 +1,218 @@
+AT_BANNER([PMD Auto Load Balance])
+
+m4_divert_push([PREPARE_TESTS])
+
+get_log_line_num () {
+LINENUM=$(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])
+}
+
+m4_divert_pop([PREPARE_TESTS])
+
+m4_define([DUMMY_NUMA], [--dummy-numa="0,0"])
+
+dnl CHECK_ALB_PARAM([param], [value], [+line])
+dnl
+dnl Waits for ALB logs for 'param' in logs and checks if value matches
+dnl 'value'. Checking starts from line number 'line' in ovs-vswithd.log.
+m4_define([CHECK_ALB_PARAM], [
+line_st=$3
+if [[ -z "$line_st" ]]
+then
+line_st="+0"
+fi
+OVS_WAIT_UNTIL([tail -n $line_st ovs-vswitchd.log | grep "PMD auto load 
balance $1 set to"])
+AT_CHECK([tail -n $line_st ovs-vswitchd.log | sed -n "s#.*\(PMD auto load 
balance $1 set to.*\)#\1#p" | tail -1], [0], [dnl
+PMD auto load balance $1 set to $2
+])
+])
+
+AT_SETUP([ALB - default state])
+OVS_VSWITCHD_START
+OVS_WAIT_UNTIL([grep "PMD auto load balance is disabled" ovs-vswitchd.log])
+
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
+AT_SETUP([ALB - enable/disable])
+OVS_VSWITCHD_START([add-port br0 p0 \
+-- set Interface p0 type=dummy-pmd options:n_rxq=3 \
+-- set Open_vSwitch . other_config:pmd-cpu-mask=3 \
+-- set open_vswitch . other_config:pmd-auto-lb="true"],
+   [], [], [DUMMY_NUMA])
+OVS_WAIT_UNTIL([grep "PMD auto load balance is enabled" ovs-vswitchd.log])
+
+get_log_line_num
+AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="false"])
+OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
balance is disabled"])
+
+get_log_line_num
+AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="true"])
+OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
balance is enabled"])
+
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
+AT_SETUP([ALB - min num PMD/RxQ])
+OVS_VSWITCHD_START([add-port br0 p0 \
+-- set Interface p0 type=dummy-pmd options:n_rxq=2 \
+-- set Open_vSwitch . other_config:pmd-cpu-mask=1 \
+-- set open_vswitch . other_config:pmd-auto-lb="true"],
+   [], [], [DUMMY_NUMA])
+OVS_WAIT_UNTIL([grep "PMD auto load balance is disabled" ovs-vswitchd.log])
+
+# Add more PMD
+AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=0x3])
+OVS_WAIT_UNTIL([grep "There are 2 pmd threads on numa node" ovs-vswitchd.log])
+
+# Add one more rxq to have 2 rxq on a PMD
+get_log_line_num
+AT_CHECK([ovs-vsctl set interface p0 options:n_rxq=3])
+OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
balance is enabled"])
+
+# Reduce PMD
+get_log_line_num
+AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=0x1])
+OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
balance is disabled"])
+
+# Check logs when try to enable but min PMD/RxQ prevents
+get_log_line_num
+AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="false"])
+OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
balance is disabled"])
+get_log_line_num
+AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="true"])
+OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
balance is disabled"])
+
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
+AT_SETUP([ALB - PMD/RxQ assignment type])
+OVS_VSWITCHD_START([add-port br0 p0 \
+-- set Interface p0 type=dummy-pmd options:n_rxq=3 \
+-- set Open_vSwitch . other_config:pmd-cpu-mask=3 \
+-- set open_vswitch . other_config:pmd-auto-lb="true"],
+   [], [], [DUMMY_NUMA])
+OVS_WAIT_UNTIL([grep "PMD auto load balance is enabled" ovs-vswitchd.log])
+
+# Change assignment type
+get_log_line_num
+AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-rxq-assign=roundrobin])
+OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
balance is disabled"])
+
+# Change back assignment type
+get_log_line_num
+AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-rxq-assign=cycles])
+OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load 
balance is enabled"])
+
+# Check logs when try to enable but assignment prevents
+get_log_line_num
+AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="false"])
+OVS_WAIT_UNTIL([tail -n +$LINENUM ovs