[ovs-dev] [PATCH v2 2/2] testsuite: add test cases for ingress_policing parameters

Tonghao Zhang xiangxia.m.yue at gmail.com
Mon Mar 15 03:20:06 UTC 2021


On Fri, Mar 12, 2021 at 8:00 PM Simon Horman <simon.horman at netronome.com> wrote:
>
> From: Tianyu Yuan <tianyu.yuan at corigine.com>
>
> * Exercise OVS setting of ingress_policing parameters using ovs-vsctl and
>   verify that the correct values are stored on OVSDB.
> * Verify the ingress_policing parameters with tc command. Also check
>   offload and non-offload in tc software datapath based on tc filter type
>   (matchall and basic).
>
> Example invocation:
> make check TESTSUITEFLAGS='-k ingress_policing'
> make check-offloads TESTSUITEFLAGS='-k ingress_policing'
>
> Signed-off-by: Tianyu Yuan <tianyu.yuan at corigine.com>
> Signed-off-by: Simon Horman <simon.horman at netronome.com>
> Signed-off-by: Louis Peens <louis.peens at netronome.com>
> ---
>  tests/ovs-vsctl.at               | 58 ++++++++++++++++++++++++++++++++
>  tests/system-offloads-traffic.at | 47 ++++++++++++++++++++++++++
>  2 files changed, 105 insertions(+)
>
> diff --git a/tests/ovs-vsctl.at b/tests/ovs-vsctl.at
> index d2cb41403..790d46f18 100644
> --- a/tests/ovs-vsctl.at
> +++ b/tests/ovs-vsctl.at
> @@ -1659,3 +1659,61 @@ AT_CHECK([grep "server name" ovsdb-server.log], [0],
>
>  OVS_VSCTL_CLEANUP
>  AT_CLEANUP
> +
> +dnl ----------------------------------------------------------------------
> +AT_BANNER([set ingress policing test])
> +
> +AT_SETUP([set ingress_policing_rate and ingress_policing_burst])
> +AT_KEYWORDS([ingress_policing])
> +OVS_VSCTL_SETUP
> +AT_CHECK([RUN_OVS_VSCTL_TOGETHER(
> +   [add-br a],
> +   [add-port a a1],
> +   [set interface a1 ingress_policing_rate=100],
> +   [set interface a1 ingress_policing_burst=10],
> +   [list interface a1 > configured_interface_a1.txt])],
I think we only care about options "ingress_policing_xxx" and if "cat"
the informations to a file, we should delete it when we don't use it
anymore.
So use the command for example as below, to make the codes more simplified.
ovs-vsctl --columns=ingress_policing_burst,ingress_policing_rate list
interface enp1s0f0
ingress_policing_burst: 10
ingress_policing_rate: 100

> +   [0], [])
> +AT_CHECK(
> +    [uuidfilt configured_interface_a1.txt],
> +    [0],
> +    [[
> +
> +
> +
> +_uuid               : <0>
> +admin_state         : []
> +bfd                 : {}
> +bfd_status          : {}
> +cfm_fault           : []
> +cfm_fault_status    : []
> +cfm_flap_count      : []
> +cfm_health          : []
> +cfm_mpid            : []
> +cfm_remote_mpids    : []
> +cfm_remote_opstate  : []
> +duplex              : []
> +error               : []
> +external_ids        : {}
> +ifindex             : []
> +ingress_policing_burst: 10
> +ingress_policing_rate: 100
> +lacp_current        : []
> +link_resets         : []
> +link_speed          : []
> +link_state          : []
> +lldp                : {}
> +mac                 : []
> +mac_in_use          : []
> +mtu                 : []
> +mtu_request         : []
> +name                : a1
> +ofport              : []
> +ofport_request      : []
> +options             : {}
> +other_config        : {}
> +statistics          : {}
> +status              : {}
> +type                : ""
> +]])
> +OVS_VSCTL_CLEANUP
> +AT_CLEANUP
> diff --git a/tests/system-offloads-traffic.at b/tests/system-offloads-traffic.at
> index 4f601ef93..b9cd29c95 100644
> --- a/tests/system-offloads-traffic.at
> +++ b/tests/system-offloads-traffic.at
> @@ -70,3 +70,50 @@ AT_CHECK([ovs-appctl upcall/show | grep -E "offloaded flows : [[1-9]]"], [0], [i
>
>  OVS_TRAFFIC_VSWITCHD_STOP
>  AT_CLEANUP
> +
> +AT_SETUP([offloads - set ingress_policing_rate and ingress_policing_burst - offloads disabled])
> +AT_KEYWORDS([ingress_policing])
> +OVS_TRAFFIC_VSWITCHD_START()
> +AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:hw-offload=false])
> +AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"])
> +ADD_NAMESPACES(at_ns0)
> +ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24")
> +AT_CHECK([ovs-vsctl set interface ovs-p0 ingress_policing_rate=100])
> +AT_CHECK([ovs-vsctl set interface ovs-p0 ingress_policing_burst=10])
> +AT_CHECK([ovs-vsctl list open | grep other_config > other_config.txt])
> +AT_CHECK([cat other_config.txt],[0],
> +    [other_config        : {hw-offload="false"}
> +])
> +AT_CHECK([tc -s -d filter show dev ovs-p0 ingress |grep rate| awk '{a=index($0,"rate");b=index($0,"mtu");print substr($0,a,b-a-1)}' > tc_ovs-p0.txt ],[0],[])
> +AT_CHECK([cat tc_ovs-p0.txt],[0],
> +    [rate 100Kbit burst 1280b
I am not sure, should we use the tc command to check offload. if so,
OvS packets will depend iproute2 ?
> +])
> +AT_CHECK([tc -s -d filter show dev ovs-p0 ingress | grep basic | head -n 1 | awk '{a=index($0,"basic");print substr($0,a,5)}'| head -n 1],[0],
> +    [basic
> +])
> +OVS_TRAFFIC_VSWITCHD_STOP
> +AT_CLEANUP
> +
> +
> +AT_SETUP([offloads - set ingress_policing_rate and ingress_policing_burst - offloads enabled])
> +AT_KEYWORDS([ingress_policing])
> +OVS_TRAFFIC_VSWITCHD_START()
> +AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:hw-offload=true])
> +AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"])
> +ADD_NAMESPACES(at_ns0)
> +ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24")
> +AT_CHECK([ovs-vsctl set interface ovs-p0 ingress_policing_rate=100])
> +AT_CHECK([ovs-vsctl set interface ovs-p0 ingress_policing_burst=10])
> +AT_CHECK([ovs-vsctl list open | grep other_config > other_config.txt])
> +AT_CHECK([cat other_config.txt],[0],
> +    [other_config        : {hw-offload="true"}
> +])
> +AT_CHECK([tc -s -d filter show dev ovs-p0 ingress | grep rate| awk '{a=index($0,"rate");b=index($0,"mtu");print substr($0,a,b-a-1)}' > tc_ovs-p0.txt ],[0],[])
> +AT_CHECK([cat tc_ovs-p0.txt],[0],
> +    [rate 100Kbit burst 1280b
> +])
> +AT_CHECK([tc -s -d filter show dev ovs-p0 ingress | grep matchall | head -n 1 | awk '{a=index($0,"matchall");print substr($0,a,8)}'| head -n 1],[0],
> +    [matchall
> +])
> +OVS_TRAFFIC_VSWITCHD_STOP
> +AT_CLEANUP
> --
> 2.20.1
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev



-- 
Best regards, Tonghao


More information about the dev mailing list