2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-29 13:27:59 +00:00

tests: Add OVS-DPDK QoS unit tests

This adds 4 new unit tests to the 'check-dpdk' subsystem that will
test Quality of Service (QoS) functionality.

Signed-off-by: Michael Phelan <michael.phelan@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
This commit is contained in:
Michael Phelan 2022-07-15 13:25:47 +00:00 committed by Ian Stokes
parent 3476bd3932
commit ddaf4fe0ed

View File

@ -398,6 +398,150 @@ AT_CLEANUP
dnl --------------------------------------------------------------------------
dnl --------------------------------------------------------------------------
dnl QoS create delete phy port
AT_SETUP([OVS-DPDK - QoS create delete phy port])
AT_KEYWORDS([dpdk])
OVS_DPDK_PRE_PHY_SKIP()
OVS_DPDK_START()
dnl Add userspace bridge and attach it to OVS and add egress policer
AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev])
AT_CHECK([ovs-vsctl add-port br10 phy0 -- set Interface phy0 type=dpdk options:dpdk-devargs=$(cat PCI_ADDR)], [], [stdout], [stderr])
OVS_WAIT_UNTIL([ovs-vsctl set port phy0 qos=@newqos -- --id=@newqos create qos type=egress-policer other-config:cir=1250000 other-config:cbs=2048])
AT_CHECK([ovs-appctl -t ovs-vswitchd qos/show phy0], [], [stdout])
sleep 2
dnl Fail if egress policer could not be created
AT_FAIL_IF([grep "Could not create rte meter for egress policer" ovs-vswitchd.log], [], [stdout])
dnl Remove egress policer
AT_CHECK([ovs-vsctl destroy QoS phy0 -- clear Port phy0 qos])
dnl Check egress policer was removed correctly
AT_CHECK([ovs-appctl -t ovs-vswitchd qos/show phy0], [], [stdout])
AT_CHECK([egrep 'QoS not configured on phy0' stdout], [], [stdout])
dnl Clean up
AT_CHECK([ovs-vsctl del-port br10 phy0], [], [stdout], [stderr])
OVS_VSWITCHD_STOP("[SYSTEM_DPDK_ALLOWED_LOGS]")
AT_CLEANUP
dnl --------------------------------------------------------------------------
dnl --------------------------------------------------------------------------
dnl QoS create delete vport port
AT_SETUP([OVS-DPDK - QoS create delete vport port])
AT_KEYWORDS([dpdk])
OVS_DPDK_PRE_CHECK()
OVS_DPDK_START()
dnl Add userspace bridge and attach it to OVS and add egress policer
AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev])
AT_CHECK([ovs-vsctl add-port br10 dpdkvhostuserclient0 -- set Interface dpdkvhostuserclient0 type=dpdkvhostuserclient options:vhost-server-path=$OVS_RUNDIR/dpdkvhostclient0], [], [stdout], [stderr])
OVS_WAIT_UNTIL([ovs-vsctl set port dpdkvhostuserclient0 qos=@newqos -- --id=@newqos create qos type=egress-policer other-config:cir=1250000 \
other-config:cbs=2048])
AT_CHECK([ovs-appctl -t ovs-vswitchd qos/show dpdkvhostuserclient0], [], [stdout])
sleep 2
dnl Parse log file
AT_CHECK([grep "VHOST_CONFIG: vhost-user client: socket created" ovs-vswitchd.log], [], [stdout])
AT_CHECK([grep "vHost User device 'dpdkvhostuserclient0' created in 'client' mode, using client socket" ovs-vswitchd.log], [], [stdout])
AT_CHECK([grep "VHOST_CONFIG: $OVS_RUNDIR/dpdkvhostclient0: reconnecting..." ovs-vswitchd.log], [], [stdout])
dnl Fail if egress policer could not be created
AT_FAIL_IF([grep "Could not create rte meter for egress policer" ovs-vswitchd.log], [], [stdout])
dnl Remove egress policer
AT_CHECK([ovs-vsctl destroy QoS dpdkvhostuserclient0 -- clear Port dpdkvhostuserclient0 qos])
dnl Check egress policer was removed correctly
AT_CHECK([ovs-appctl -t ovs-vswitchd qos/show dpdkvhostuserclient0], [], [stdout])
AT_CHECK([egrep 'QoS not configured on dpdkvhostuserclient0' stdout], [], [stdout])
dnl Clean up
AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr])
OVS_VSWITCHD_STOP("m4_join([], [SYSTEM_DPDK_ALLOWED_LOGS], [
\@VHOST_CONFIG: failed to connect to $OVS_RUNDIR/dpdkvhostclient0: No such file or directory@d
])")
AT_CLEANUP
dnl --------------------------------------------------------------------------
dnl --------------------------------------------------------------------------
dnl QoS no cir
AT_SETUP([OVS-DPDK - QoS no cir])
AT_KEYWORDS([dpdk])
OVS_DPDK_PRE_CHECK()
OVS_DPDK_START()
dnl Add userspace bridge and attach it to OVS and add egress policer
AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev])
AT_CHECK([ovs-vsctl add-port br10 dpdkvhostuserclient0 -- set Interface dpdkvhostuserclient0 type=dpdkvhostuserclient options:vhost-server-path=$OVS_RUNDIR/dpdkvhostclient0], [], [stdout], [stderr])
OVS_WAIT_UNTIL([ovs-vsctl set port dpdkvhostuserclient0 qos=@newqos -- --id=@newqos create qos type=egress-policer other-config:cbs=2048])
sleep 2
dnl Parse log file
AT_CHECK([grep "VHOST_CONFIG: vhost-user client: socket created" ovs-vswitchd.log], [], [stdout])
AT_CHECK([grep "vHost User device 'dpdkvhostuserclient0' created in 'client' mode, using client socket" ovs-vswitchd.log], [], [stdout])
AT_CHECK([grep "VHOST_CONFIG: $OVS_RUNDIR/dpdkvhostclient0: reconnecting..." ovs-vswitchd.log], [], [stdout])
dnl Check egress policer was not created
AT_CHECK([ovs-appctl -t ovs-vswitchd qos/show dpdkvhostuserclient0], [], [stdout])
AT_CHECK([egrep 'QoS not configured on dpdkvhostuserclient0' stdout], [], [stdout])
dnl Clean up
AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr])
OVS_VSWITCHD_STOP("m4_join([], [SYSTEM_DPDK_ALLOWED_LOGS], [
\@VHOST_CONFIG: failed to connect to $OVS_RUNDIR/dpdkvhostclient0: No such file or directory@d
\@Could not create rte meter for egress policer@d
\@Failed to set QoS type egress-policer on port dpdkvhostuserclient0: Invalid argument@d
])")
AT_CLEANUP
dnl --------------------------------------------------------------------------
dnl --------------------------------------------------------------------------
dnl QoS no cbs
AT_SETUP([OVS-DPDK - QoS no cbs])
AT_KEYWORDS([dpdk])
OVS_DPDK_PRE_CHECK()
OVS_DPDK_START()
dnl Add userspace bridge and attach it to OVS and add egress policer
AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev])
AT_CHECK([ovs-vsctl add-port br10 dpdkvhostuserclient0 -- set Interface dpdkvhostuserclient0 type=dpdkvhostuserclient options:vhost-server-path=$OVS_RUNDIR/dpdkvhostclient0], [], [stdout], [stderr])
OVS_WAIT_UNTIL([ovs-vsctl set port dpdkvhostuserclient0 qos=@newqos -- --id=@newqos create qos type=egress-policer other-config:cir=1250000])
sleep 2
dnl Parse log file
AT_CHECK([grep "VHOST_CONFIG: vhost-user client: socket created" ovs-vswitchd.log], [], [stdout])
AT_CHECK([grep "vHost User device 'dpdkvhostuserclient0' created in 'client' mode, using client socket" ovs-vswitchd.log], [], [stdout])
AT_CHECK([grep "VHOST_CONFIG: $OVS_RUNDIR/dpdkvhostclient0: reconnecting..." ovs-vswitchd.log], [], [stdout])
dnl Check egress policer was not created
AT_CHECK([ovs-appctl -t ovs-vswitchd qos/show dpdkvhostuserclient0], [], [stdout])
AT_CHECK([egrep 'QoS not configured on dpdkvhostuserclient0' stdout], [], [stdout])
dnl Clean up
AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr])
OVS_VSWITCHD_STOP("m4_join([], [SYSTEM_DPDK_ALLOWED_LOGS], [
\@VHOST_CONFIG: failed to connect to $OVS_RUNDIR/dpdkvhostclient0: No such file or directory@d
\@Could not create rte meter for egress policer@d
\@Failed to set QoS type egress-policer on port dpdkvhostuserclient0: Invalid argument@d
])")
AT_CLEANUP
dnl --------------------------------------------------------------------------
dnl --------------------------------------------------------------------------
dnl Add standard DPDK PHY port