From 2da2aa12260143bc513b4dff5e2b2ef6755172ab Mon Sep 17 00:00:00 2001 From: Dave Wallace Date: Fri, 20 Dec 2019 22:46:51 +0000 Subject: Hoststack perf infrastructure refactoring - DUT only topology (hoststack test apps are co-located with vpp) - Make vpp app specific keywords generic where applicable - Add IP4 Prefix to topology file - Support running wrk in linux namespace - Refactor namespace cleanup - Remove redundant namespace creation code - Refactor test/keyword dirs: tcp -> hoststack - Add hoststack utility keywords - Refactor wrk suite setup/teardown - Update tests with recent perf infra changes Change-Id: Ia1cf07978d579393eef94923819a87c8c1f36f34 Signed-off-by: Dave Wallace --- .../libraries/robot/hoststack/hoststack.robot | 372 +++++++++++++++++++++ .../libraries/robot/hoststack/tcp_setup.robot | 57 ++++ resources/libraries/robot/shared/default.robot | 27 +- resources/libraries/robot/shared/suite_setup.robot | 77 ++++- .../libraries/robot/shared/suite_teardown.robot | 19 +- resources/libraries/robot/tcp/tcp_setup.robot | 57 ---- resources/libraries/robot/wrk/wrk_utils.robot | 18 +- 7 files changed, 553 insertions(+), 74 deletions(-) create mode 100644 resources/libraries/robot/hoststack/hoststack.robot create mode 100644 resources/libraries/robot/hoststack/tcp_setup.robot delete mode 100644 resources/libraries/robot/tcp/tcp_setup.robot (limited to 'resources/libraries/robot') diff --git a/resources/libraries/robot/hoststack/hoststack.robot b/resources/libraries/robot/hoststack/hoststack.robot new file mode 100644 index 0000000000..d0fd9a2a95 --- /dev/null +++ b/resources/libraries/robot/hoststack/hoststack.robot @@ -0,0 +1,372 @@ +# Copyright (c) 2020 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +*** Settings *** +| Library | resources.libraries.python.InterfaceUtil +| Library | resources.libraries.python.IPUtil +| Library | resources.libraries.python.HoststackUtil +| Library | resources.libraries.python.NsimUtil +| Variables | resources/libraries/python/Constants.py +| Resource | resources/libraries/robot/ip/ip4.robot +| Resource | resources/libraries/robot/nsim/nsim.robot +| +| Documentation | L2 keywords to set up VPP to test hoststack. + +*** Variables *** +| ${quic_crypto_engine}= | nocrypto +| ${quic_fifo_size}= | 4M +| &{vpp_hoststack_attr}= +| ... | rxq=${None} +| ... | phy_cores=${1} +| ... | vpp_api_socket=${SOCKSVR_PATH} +| ... | api_seg_global_size=2G +| ... | api_seg_api_size=1G +| ... | sess_evt_q_seg_size=4G +| ... | sess_evt_q_length=4000000 +| ... | sess_prealloc_sess=4000000 +| ... | sess_v4_sess_tbl_buckets=2000000 +| ... | sess_v4_sess_tbl_mem=2G +| ... | sess_v4_sess_halfopen_buckets=5000000 +| ... | sess_v4_sess_halfopen_mem=3G +| ... | sess_lcl_endpt_tbl_buckets=5000000 +| ... | sess_lcl_endpt_tbl_mem=3G +| &{vpp_echo_server_attr}= +| ... | role=server +| ... | cfg_vpp_feature=${None} +| ... | namespace=default +| ... | vpp_api_socket=${vpp_hoststack_attr}[vpp_api_socket] +| ... | json_output=json +| ... | uri_protocol=quic +| ... | uri_ip4_addr=${EMPTY} +| ... | uri_port=1234 +| ... | nclients=1 +| ... | quic_streams=1 +| ... | time=sconnect:lastbyte +| ... | fifo_size=4M +| ... | rx_bytes=0 +| ... | tx_bytes=0 +| ... | rx_results_diff=${False} +| ... | tx_results_diff=${False} +| &{vpp_echo_client_attr}= +| ... | role=client +| ... | cfg_vpp_feature=${None} +| ... | namespace=default +| ... | vpp_api_socket=${vpp_hoststack_attr}[vpp_api_socket] +| ... | json_output=json +| ... | uri_protocol=quic +| ... | uri_ip4_addr=${EMPTY} +| ... | uri_port=1234 +| ... | nclients=1 +| ... | quic_streams=1 +| ... | time=sconnect:lastbyte +| ... | fifo_size=4M +| ... | rx_bytes=0 +| ... | tx_bytes=0 +| ... | rx_results_diff=${False} +| ... | tx_results_diff=${False} + +*** Keywords *** +| Set VPP Hoststack Attributes +| | [Documentation] +| | ... | Set the VPP HostStack attributes in the vpp_hoststack_attr dictionary. +| | +| | ... | *Arguments:* +| | ... | - ${rxq} - Type: int +| | ... | - ${phy_cores} - Number of cores for workers Type: int +| | ... | - ${vpp_api_socket} - Path to VPP api socket file Type: string +| | ... | - ${api_seg_global_size} - Global API segment size Type: string +| | ... | - ${api_seg_api_size} - API segment API fifo size Type: string +| | ... | - ${sess_evt_q_seg_size} - Session event queue segment size +| | ... | Type: string +| | ... | - ${sess_evt_q_length} - Session event queue length Type: string +| | ... | - ${sess_prealloc_sess} - Number of sessions to preallocate +| | ... | Type: string +| | ... | - ${sess_v4_sess_tbl_buckets} - Number of IPv4 session table buckets +| | ... | Type: string +| | ... | - ${sess_v4_sess_tbl_mem} - IPv4 session table memory size +| | ... | Type: string +| | ... | - ${sess_v4_sess_halfopen_buckets} - Number of IPv4 session +| | ... | half open table buckets Type: string +| | ... | - ${sess_v4_sess_halfopen_mem} - IPv4 session half open +| | ... | table memory size Type: string +| | ... | - ${sess_lcl_endpt_tbl_buckets} - Number of session local endpoint +| | ... | table buckets Type: string +| | ... | - ${sess_lcl_endpt_tbl_mem} - Session local endpoint +| | ... | table memory size Type: string +| | +| | ... | *Example:* +| | +| | ... | \| Set VPP Hoststack Attributes \| phy_cores=${phy_cores} \| +| | +| | [Arguments] +| | ... | ${rxq}=${vpp_hoststack_attr}[rxq] +| | ... | ${phy_cores}=${vpp_hoststack_attr}[phy_cores] +| | ... | ${vpp_api_socket}=${vpp_hoststack_attr}[vpp_api_socket] +| | ... | ${api_seg_global_size}=${vpp_hoststack_attr}[api_seg_global_size] +| | ... | ${api_seg_api_size}=${vpp_hoststack_attr}[api_seg_api_size] +| | ... | ${sess_evt_q_seg_size}=${vpp_hoststack_attr}[sess_evt_q_seg_size] +| | ... | ${sess_evt_q_length}=${vpp_hoststack_attr}[sess_evt_q_length] +| | ... | ${sess_prealloc_sess}=${vpp_hoststack_attr}[sess_prealloc_sess] +| | ... | ${sess_v4_sess_tbl_buckets}=${vpp_hoststack_attr}[sess_v4_sess_tbl_buckets] +| | ... | ${sess_v4_sess_tbl_mem}=${vpp_hoststack_attr}[sess_v4_sess_tbl_mem] +| | ... | ${sess_v4_sess_halfopen_buckets}=${vpp_hoststack_attr}[sess_v4_sess_halfopen_buckets] +| | ... | ${sess_v4_sess_halfopen_mem}=${vpp_hoststack_attr}[sess_v4_sess_halfopen_mem] +| | ... | ${sess_lcl_endpt_tbl_buckets}=${vpp_hoststack_attr}[sess_lcl_endpt_tbl_buckets] +| | ... | ${sess_lcl_endpt_tbl_mem}=${vpp_hoststack_attr}[sess_lcl_endpt_tbl_mem] +| | +| | Set To Dictionary | ${vpp_hoststack_attr} | rxq | ${rxq} +| | Set To Dictionary | ${vpp_hoststack_attr} | phy_cores | ${phy_cores} +| | Set To Dictionary | ${vpp_hoststack_attr} +| | ... | vpp_api_socket | ${vpp_api_socket} +| | Set To Dictionary | ${vpp_hoststack_attr} +| | ... | api_seg_global_size | ${api_seg_global_size} +| | Set To Dictionary | ${vpp_hoststack_attr} +| | ... | api_seg_api_size | ${api_seg_api_size} +| | Set To Dictionary | ${vpp_hoststack_attr} +| | ... | sess_evt_q_seg_size | ${sess_evt_q_seg_size} +| | Set To Dictionary | ${vpp_hoststack_attr} +| | ... | sess_evt_q_length | ${sess_evt_q_length} +| | Set To Dictionary | ${vpp_hoststack_attr} +| | ... | sess_prealloc_sess | ${sess_prealloc_sess} +| | Set To Dictionary | ${vpp_hoststack_attr} +| | ... | sess_v4_sess_tbl_buckets | ${sess_v4_sess_tbl_buckets} +| | Set To Dictionary | ${vpp_hoststack_attr} +| | ... | sess_v4_sess_tbl_mem | ${sess_v4_sess_tbl_mem} +| | Set To Dictionary | ${vpp_hoststack_attr} +| | ... | sess_v4_sess_halfopen_buckets | ${sess_v4_sess_halfopen_buckets} +| | Set To Dictionary | ${vpp_hoststack_attr} +| | ... | sess_v4_sess_halfopen_mem | ${sess_v4_sess_halfopen_mem} +| | Set To Dictionary | ${vpp_hoststack_attr} +| | ... | sess_lcl_endpt_tbl_buckets | ${sess_lcl_endpt_tbl_buckets} +| | Set To Dictionary | ${vpp_hoststack_attr} +| | ... | sess_lcl_endpt_tbl_mem | ${sess_lcl_endpt_tbl_mem} + +| Set VPP Echo Server Attributes +| | [Documentation] +| | ... | Set the HostStack vpp_echo test program attributes +| | ... | in the vpp_echo_server_attr dictionary. +| | +| | ... | *Arguments:* +| | ... | - ${cfg_vpp_feature} - VPP Feature requiring config Type: string +| | ... | - ${namespace} - Namespace Type: string +| | ... | - ${nclients} - Number of clients Type: string +| | ... | - ${quic_streams} - Number of quic streams Type: string +| | ... | - ${fifo_size} - Session Fifo Size Type: integer +| | ... | - ${time} - Timing events (start:end) Type: string +| | ... | - ${rx_bytes} - Number of Bytes to receive Type: string +| | ... | - ${tx_bytes} - Number of Bytes to send Type: string +| | ... | - ${rx_results_diff} - Rx Results are different to pass Type: boolean +| | ... | - ${tx_results_diff} - Tx Results are different to pass Type: boolean +| | +| | ... | *Example:* +| | +| | ... | \| Set VPP Echo Server Attributes \| nclients=${nclients} \| +| | ... | \| tx_bytes=${tx_bytes} \| +| | +| | [Arguments] +| | ... | ${cfg_vpp_feature}=${vpp_echo_server_attr}[cfg_vpp_feature] +| | ... | ${namespace}=${vpp_echo_server_attr}[namespace] +| | ... | ${nclients}=${vpp_echo_server_attr}[nclients] +| | ... | ${quic_streams}=${vpp_echo_server_attr}[quic_streams] +| | ... | ${time}=${vpp_echo_server_attr}[time] +| | ... | ${fifo_size}=${vpp_echo_server_attr}[fifo_size] +| | ... | ${rx_bytes}=${vpp_echo_server_attr}[rx_bytes] +| | ... | ${tx_bytes}=${vpp_echo_server_attr}[tx_bytes] +| | ... | ${rx_results_diff}=${vpp_echo_server_attr}[rx_results_diff] +| | ... | ${tx_results_diff}=${vpp_echo_server_attr}[tx_results_diff] +| | +| | Set To Dictionary | ${vpp_echo_server_attr} | cfg_vpp_feature +| | ... | ${cfg_vpp_feature} +| | Set To Dictionary | ${vpp_echo_server_attr} | namespace | ${namespace} +| | Set To Dictionary | ${vpp_echo_server_attr} | nclients | ${nclients} +| | Set To Dictionary | ${vpp_echo_server_attr} | quic_streams | ${quic_streams} +| | Set To Dictionary | ${vpp_echo_server_attr} | time | ${time} +| | Set To Dictionary | ${vpp_echo_server_attr} | fifo_size | ${fifo_size} +| | Set To Dictionary | ${vpp_echo_server_attr} | rx_bytes | ${rx_bytes} +| | Set To Dictionary | ${vpp_echo_server_attr} | tx_bytes | ${tx_bytes} +| | Set To Dictionary +| | ... | ${vpp_echo_server_attr} | rx_results_diff | ${rx_results_diff} +| | Set To Dictionary +| | ... | ${vpp_echo_server_attr} | tx_results_diff | ${tx_results_diff} + +| Set VPP Echo Client Attributes +| | [Documentation] +| | ... | Set the HostStack vpp_echo test program attributes +| | ... | in the vpp_echo_client_attr dictionary. +| | +| | ... | *Arguments:* +| | ... | - ${cfg_vpp_feature} - VPP Feature requiring config Type: string +| | ... | - ${namespace} - Namespace Type: string +| | ... | - ${nclients} - Number of clients Type: string +| | ... | - ${fifo_size} - Session Fifo Size Type: integer +| | ... | - ${time} - Timing events (start:end) Type: string +| | ... | - ${rx_bytes} - Number of Bytes to receive Type: string +| | ... | - ${tx_bytes} - Number of Bytes to send Type: string +| | ... | - ${rx_results_diff} - Rx Results are different to pass Type: boolean +| | ... | - ${tx_results_diff} - Tx Results are different to pass Type: boolean +| | +| | ... | *Example:* +| | +| | ... | \| Set VPP Echo Client Attributes \| nclients=${nclients} \| +| | ... | \| tx_bytes=${tx_bytes} \| +| | +| | [Arguments] +| | ... | ${cfg_vpp_feature}=${vpp_echo_client_attr}[cfg_vpp_feature] +| | ... | ${namespace}=${vpp_echo_client_attr}[namespace] +| | ... | ${nclients}=${vpp_echo_client_attr}[nclients] +| | ... | ${quic_streams}=${vpp_echo_server_attr}[quic_streams] +| | ... | ${time}=${vpp_echo_client_attr}[time] +| | ... | ${fifo_size}=${vpp_echo_client_attr}[fifo_size] +| | ... | ${rx_bytes}=${vpp_echo_client_attr}[rx_bytes] +| | ... | ${tx_bytes}=${vpp_echo_client_attr}[tx_bytes] +| | ... | ${rx_results_diff}=${vpp_echo_client_attr}[rx_results_diff] +| | ... | ${tx_results_diff}=${vpp_echo_client_attr}[tx_results_diff] +| | +| | Set To Dictionary | ${vpp_echo_client_attr} | cfg_vpp_feature +| | ... | ${cfg_vpp_feature} +| | Set To Dictionary | ${vpp_echo_client_attr} | namespace | ${namespace} +| | Set To Dictionary | ${vpp_echo_client_attr} | nclients | ${nclients} +| | Set To Dictionary | ${vpp_echo_client_attr} | quic_streams | ${quic_streams} +| | Set To Dictionary | ${vpp_echo_client_attr} | time | ${time} +| | Set To Dictionary | ${vpp_echo_client_attr} | fifo_size | ${fifo_size} +| | Set To Dictionary | ${vpp_echo_client_attr} | rx_bytes | ${rx_bytes} +| | Set To Dictionary | ${vpp_echo_client_attr} | tx_bytes | ${tx_bytes} +| | Set To Dictionary +| | ... | ${vpp_echo_client_attr} | rx_results_diff | ${rx_results_diff} +| | Set To Dictionary +| | ... | ${vpp_echo_client_attr} | tx_results_diff | ${tx_results_diff} + +| Run hoststack test program on DUT +| | [Documentation] +| | ... | Configure IP address on the port, set it up and start the specified +| | ... | HostStack test program on the specified DUT. +| | +| | ... | *Arguments:* +| | ... | - ${node} - VPP DUT node Type: Node +| | ... | - ${intf} - VPP DUT node interface key Type: string +| | ... | - ${ip4_addr} - VPP DUT node interface ip4 address Type: string +| | ... | - ${ip4_mask} - VPP DUT node interface ip4 network mask Type: string +| | ... | - ${namespace} - Network namespace to run test program in Type: string +| | ... | - ${cfg_vpp_feature} - VPP hoststack feature requiring +| | ... | additional VPP configuration Type: string +| | ... | - ${test_program} - Host Stack test program Type: dict +| | +| | ... | *Example:* +| | +| | ... | \| Run hoststack test program on DUT \| ${dut1} \| ${dut1_if1} \| +| | ... | \| ${dut1_if1_ip4_addr} \| ${dut1_if1_ip4_mask} \| default \| +| | ... | \| quic \| ${vpp_echo_server} \| +| | +| | [Arguments] | ${node} | ${intf} | ${ip4_addr} | ${ip4_mask} +| | | ... | ${namespace} | ${cfg_vpp_feature} | ${test_program} +| | +| | Run Keyword If | ${vpp_nsim_attr}[output_feature_enable] +| | ... | Configure VPP NSIM | ${node} | ${vpp_nsim_attr} | ${intf} +| | Run Keyword If | '${cfg_vpp_feature}' != '' +| | ... | Additional VPP Config for Feature ${cfg_vpp_feature} | ${node} +| | VPP Get Interface Data | ${node} +| | Set Interface State | ${node} | ${intf} | up +| | VPP Interface Set IP Address | ${node} | ${intf} | ${ip4_addr} +| | ... | ${ip4_mask} +| | Vpp Node Interfaces Ready Wait | ${node} +| | ${hoststack_test_program_pid}= | Start Hoststack Test Program +| | ... | ${node} | ${namespace} | ${test_program} +| | Return From Keyword | ${hoststack_test_program_pid} + +| Additional VPP Config For Feature quic +| | [Documentation] +| | ... | Configure VPP quic attributes on the specified DUT. +| | +| | ... | *Arguments:* +| | ... | - ${node} - VPP DUT node Type: Node +| | +| | [Arguments] | ${node} +| | +| | Set hoststack quic fifo size | ${node} | ${quic_fifo_size} +| | Set hoststack quic crypto engine | ${node} | ${quic_crypto_engine} + +| Configure VPP hoststack attributes on all DUTs +| | [Documentation] +| | ... | Configure VPP HostStack attributes on all DUTs. +| | +| | Add worker threads to all DUTs +| | ... | ${vpp_hoststack_attr}[phy_cores] | ${vpp_hoststack_attr}[rxq] +| | Add DPDK PCI devices to all DUTs +| | ${duts}= | Get Matches | ${nodes} | DUT* +| | FOR | ${dut} | IN | @{duts} +| | | Import Library | resources.libraries.python.VppConfigGenerator +| | | ... | WITH NAME | ${dut} +| | | Run keyword | ${dut}.Add socksvr | ${vpp_hoststack_attr}[vpp_api_socket] +| | | Run keyword | ${dut}.Add api segment global size +| | | ... | ${vpp_hoststack_attr}[api_seg_global_size] +| | | Run keyword | ${dut}.Add api segment api size +| | | ... | ${vpp_hoststack_attr}[api_seg_api_size] +| | | Run keyword | ${dut}.Add api segment gid | testuser +| | | Run keyword | ${dut}.Add session enable +| | | Run keyword | ${dut}.Add session event queues memfd segment +| | | Run keyword | ${dut}.Add session event queues segment size +| | | ... | ${vpp_hoststack_attr}[sess_evt_q_seg_size] +| | | Run keyword | ${dut}.Add session event queue length +| | | ... | ${vpp_hoststack_attr}[sess_evt_q_length] +| | | Run keyword | ${dut}.Add session preallocated sessions +| | | ... | ${vpp_hoststack_attr}[sess_prealloc_sess] +| | | Run keyword | ${dut}.Add session v4 session table buckets +| | | ... | ${vpp_hoststack_attr}[sess_v4_sess_tbl_buckets] +| | | Run keyword | ${dut}.Add session v4 session table memory +| | | ... | ${vpp_hoststack_attr}[sess_v4_sess_tbl_mem] +| | | Run keyword | ${dut}.Add session v4 halfopen table buckets +| | | ... | ${vpp_hoststack_attr}[sess_v4_sess_halfopen_buckets] +| | | Run keyword | ${dut}.Add session v4 halfopen table memory +| | | ... | ${vpp_hoststack_attr}[sess_v4_sess_halfopen_mem] +| | | Run keyword | ${dut}.Add session local endpoints table buckets +| | | ... | ${vpp_hoststack_attr}[sess_lcl_endpt_tbl_buckets] +| | | Run keyword | ${dut}.Add session local endpoints table memory +| | | ... | ${vpp_hoststack_attr}[sess_lcl_endpt_tbl_mem] +| | END +| | Apply startup configuration on all VPP DUTs + +| Get Test Results From Hoststack VPP Echo Test +| | [Documentation] +| | ... | Configure IP address on the port, set it up and start the specified +| | ... | HostStack test programs on the DUTs. Gather test program +| | ... | output and append test results in message. +| | ... | Return boolean indicating when no results were available from +| | ... | both the server and client test programs. +| | +| | Set To Dictionary | ${vpp_echo_server_attr} | uri_ip4_addr +| | ... | ${dut2_if1_ip4_addr} +| | Set To Dictionary | ${vpp_echo_client_attr} | uri_ip4_addr +| | ... | ${dut2_if1_ip4_addr} +| | Configure VPP Hoststack Attributes on all DUTs +| | ${vpp_echo_server}= | Get VPP Echo Command | ${vpp_echo_server_attr} +| | ${server_pid}= | Run hoststack test program on DUT +| | ... | ${dut2} | ${dut2_if1} | ${dut2_if1_ip4_addr} | ${dut2_if1_ip4_prefix} +| | ... | ${vpp_echo_server_attr}[namespace] +| | ... | ${vpp_echo_server_attr}[cfg_vpp_feature] | ${vpp_echo_server} +| | ${vpp_echo_client}= | Get VPP Echo Command | ${vpp_echo_client_attr} +| | ${client_pid}= | Run hoststack test program on DUT +| | ... | ${dut1} | ${dut1_if1} | ${dut1_if1_ip4_addr} | ${dut1_if1_ip4_prefix} +| | ... | ${vpp_echo_client_attr}[namespace] +| | ... | ${vpp_echo_client_attr}[cfg_vpp_feature] | ${vpp_echo_client} +| | When Hoststack Test Program Finished | ${dut1} | ${client_pid} +| | ${client_no_results} | ${client_output}= +| | ... | Analyze hoststack test program output | ${dut1} | Client +| | ... | ${vpp_nsim_attr} | ${vpp_echo_client} +| | Then Set test message | ${client_output} +| | And Hoststack Test Program Finished | ${dut2} | ${server_pid} +| | ${server_no_results} | ${server_output}= +| | ... | Analyze hoststack test program output | ${dut2} | Server +| | ... | ${vpp_nsim_attr} | ${vpp_echo_server} +| | Set test message | ${server_output} | append=True +| | Run Keyword And Return | No Hoststack Test Program Results +| | ... | ${server_no_results} | ${client_no_results} diff --git a/resources/libraries/robot/hoststack/tcp_setup.robot b/resources/libraries/robot/hoststack/tcp_setup.robot new file mode 100644 index 0000000000..718070979f --- /dev/null +++ b/resources/libraries/robot/hoststack/tcp_setup.robot @@ -0,0 +1,57 @@ +# Copyright (c) 2019 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +*** Settings *** +| Library | resources.libraries.python.InterfaceUtil +| Library | resources.libraries.python.IPUtil +| Library | resources.libraries.python.tcp.TCPUtils +| +| Resource | resources/libraries/robot/ip/ip4.robot +| +| Documentation | L2 keywords to set up VPP to test tcp. + +*** Keywords *** +| Set up HTTP server with parameters on the VPP node +| | [Documentation] +| | ... | Configure IP address on the port, set it up and start HTTP server on +| | ... | the VPP. +| | +| | ... | *Arguments:* +| | ... | - http_static_plugin - Use the HTTP static plugin http server. +| | ... | Type: boolean +| | ... | - prealloc_fifos - Max number of connections you expect to handle +| | ... | at one time. Type: string +| | ... | - fifo_size - FIFO size in kB. Type: string +| | ... | - private_segment_size - Private segment size. Number + unit. +| | ... | Type: string +| | +| | ... | *Example:* +| | +| | ... | \| Set up HTTP server with paramters on the VPP node \| ${true}\ +| | ... | \| 400 \| 4096 \| 2g \| +| | +| | [Arguments] | ${http_static_plugin} | ${prealloc_fifos} | ${fifo_size} +| | ... | ${private_segment_size} +| | +| | Set Interface State | ${dut1} | ${dut1_if1} | up +| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1} | 192.168.10.2 | 24 +| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1} | 192.168.20.2 | 24 +| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1} | 192.168.30.2 | 24 +| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1} | 192.168.40.2 | 24 +| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1} | 192.168.50.2 | 24 +| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1} | 192.168.60.2 | 24 +| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1} | 192.168.70.2 | 24 +| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1} | 192.168.80.2 | 24 +| | Vpp Node Interfaces Ready Wait | ${dut1} +| | Start VPP HTTP server params | ${dut1} | ${http_static_plugin} +| | ... | ${prealloc_fifos} | ${fifo_size} | ${private_segment_size} diff --git a/resources/libraries/robot/shared/default.robot b/resources/libraries/robot/shared/default.robot index 3b8f2804c1..160ebc887b 100644 --- a/resources/libraries/robot/shared/default.robot +++ b/resources/libraries/robot/shared/default.robot @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -113,6 +113,31 @@ | | Verify Kernel Module on All DUTs | ${nodes} | ${module} | | ... | force_load=${force_load} +| Get Keyname for DUT +| | [Documentation] +| | ... | Get the Keyname for the DUT in the keyname list. +| | ... | Returns lowercase keyname value. +| | +| | ... | *Arguments:* +| | ... | - dutx - DUT to find keyname. Type: dict +| | ... | - dut_keys - DUT Keynames to search. Type: list +| | +| | ... | *Example:* +| | +| | ... | \| Get Keyname for DUT \| ${dutx} \| ${duts} \| +| | +| | [Arguments] | ${dutx} | ${dut_keys} +| | +| | FOR | ${key} | IN | @{dut_keys} +| | | ${found_key} | ${value}= | Run Keyword and Ignore Error +| | | ... | Dictionaries Should Be Equal | ${nodes['${key}']} | ${dutx} +| | | Run Keyword If | '${found_key}' == 'PASS' | EXIT FOR LOOP +| | END +| | Run Keyword If | '${found_key}' != 'PASS' +| | ... | Fail | Keyname for ${dutx} not found +| | ${keyname}= | Convert To Lowercase | ${key} +| | Return From Keyword | ${keyname} + | Create base startup configuration of VPP on all DUTs | | [Documentation] | Create base startup configuration of VPP to all DUTs. | | diff --git a/resources/libraries/robot/shared/suite_setup.robot b/resources/libraries/robot/shared/suite_setup.robot index 513cfe8045..0a78226962 100644 --- a/resources/libraries/robot/shared/suite_setup.robot +++ b/resources/libraries/robot/shared/suite_setup.robot @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -20,6 +20,8 @@ | Library | resources.libraries.python.topology.Topology | Library | resources.libraries.python.TrafficGenerator | Library | resources.tools.wrk.wrk +| Variables | resources/libraries/python/Constants.py +| Resource | resources/libraries/robot/wrk/wrk_utils.robot | | Documentation | Suite setup keywords. @@ -87,6 +89,64 @@ | | | Run Keyword | Additional Suite setup Action For ${action} | | END +| Setup suite single link no tg +| | [Documentation] +| | ... | Common suite setup for single link tests. +| | ... | +| | ... | Compute path for testing on two given nodes in circular topology +| | ... | based on interface model provided as an argument and set +| | ... | corresponding suite variables. +| | +| | ... | _NOTE:_ This KW sets following suite variables: +| | ... | - duts - List of DUT nodes +| | ... | - duts_count - Number of DUT nodes. +| | ... | - dut{n} - DUTx node +| | ... | - dut{n}_if1 - 1st DUT interface. +| | ... | - dut{n}_if1_mac - 1st DUT interface MAC address. +| | ... | - dut{n}_if2 - 2nd DUT interface. +| | ... | - dut{n}_if2_mac - 2nd DUT interface MAC address. +| | +| | ... | *Arguments:* +| | ... | - ${actions} - Additional setup action. Type: list +| | +| | [Arguments] | @{actions} +| | +| | ${nic_model_list}= | Create list | ${nic_name} +| | ${duts}= | Get Matches | ${nodes} | DUT* +| | FOR | ${dut} | IN | @{duts} +| | | Append Node | ${nodes['${dut}']} | filter_list=${nic_model_list} +| | END +| | Append Node | ${nodes['@{duts}[0]']} | filter_list=${nic_model_list} +| | Compute Path | always_same_link=${FALSE} +| | FOR | ${i} | IN RANGE | 1 | ${DATAPATH_INTERFACES_MAX} +| | | ${dutx_if} | ${dutx}= | Next Interface +| | | Run Keyword If | '${dutx_if}' == 'None' | EXIT FOR LOOP +| | | ${dutx_if_mac}= | Get Interface MAC | ${dutx} | ${dutx_if} +| | | ${dutx_if_ip4_addr}= | Get Interface Ip4 | ${dutx} | ${dutx_if} +| | | ${dutx_if_ip4_prefix_length}= | Get Interface Ip4 Prefix Length +| | | ... | ${dutx} | ${dutx_if} +| | | ${dut_str}= | Get Keyname For DUT | ${dutx} | ${duts} +| | | ${if1_status} | ${value}= | Run Keyword And Ignore Error +| | | ... | Variable Should Exist | ${${dut_str}_if1} +| | | ${if_name}= | Set Variable If | '${if1_status}' == 'PASS' +| | | ... | if2 | if1 +| | | Set Suite Variable | ${${dut_str}} | ${dutx} +| | | Set Suite Variable | ${${dut_str}_${if_name}} | ${dutx_if} +| | | Set Suite Variable | ${${dut_str}_${if_name}_mac} | ${dutx_if_mac} +| | | Set Suite Variable | ${${dut_str}_${if_name}_ip4_addr} +| | | ... | ${dutx_if_ip4_addr} +| | | Set Suite Variable | ${${dut_str}_${if_name}_ip4_prefix} +| | | ... | ${dutx_if_ip4_prefix_length} +| | END +| | Run Keyword If | ${i}>${DATAPATH_INTERFACES_MAX} +| | ... | Fatal Error | Datapath length exceeded +| | ${duts_count}= | Get Length | ${duts} +| | Set Suite Variable | ${duts} +| | Set Suite Variable | ${duts_count} +| | FOR | ${action} | IN | @{actions} +| | | Run Keyword | Additional Suite setup Action For ${action} +| | END + | Setup suite double link | | [Documentation] | | ... | Common suite setup for double link tests. @@ -241,6 +301,7 @@ | | [Documentation] | | ... | Additional Setup for suites which uses WRK TG. | | +| | Verify Program Installed | ${tg} | wrk | | Iface update numa node | ${tg} # Make sure TRex is stopped | | ${running}= | Is TRex running | ${tg} @@ -257,13 +318,11 @@ # Set IP on tg_if1 | | ${intf_name}= | Get Linux interface name | ${tg} | | ... | ${tg['interfaces']['${tg_if1}']['pci_address']} -| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.10.1 | 24 -| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.20.1 | 24 -| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.30.1 | 24 -| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.40.1 | 24 -| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.50.1 | 24 -| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.60.1 | 24 -| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.70.1 | 24 -| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.80.1 | 24 +| | FOR | ${ip_addr} | IN | @{wrk_ip_addrs} +| | | ${ip_addr_on_intf}= | Linux interface has IP | ${tg} | ${intf_name} +| | | ... | ${ip_addr} | ${wrk_ip_prefix} +| | | Run Keyword If | ${ip_addr_on_intf}==${False} | Set Linux interface IP +| | | ... | ${tg} | ${intf_name} | ${ip_addr} | ${wrk_ip_prefix} +| | END | | Set Linux interface up | ${tg} | ${intf_name} | | Check wrk | ${tg} diff --git a/resources/libraries/robot/shared/suite_teardown.robot b/resources/libraries/robot/shared/suite_teardown.robot index 993d83838f..881f796284 100644 --- a/resources/libraries/robot/shared/suite_teardown.robot +++ b/resources/libraries/robot/shared/suite_teardown.robot @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -48,3 +48,20 @@ | | | Cleanup DPDK Environment | | | ... | ${nodes['${dut}']} | ${${dut}_if1} | ${${dut}_if2} | | END + +| Additional Suite Tear Down Action For wrk +| | [Documentation] +| | ... | Additional teardown for suites which uses wrk. +| | +| | ${intf_name}= | Get Linux interface name | ${tg} +| | ... | ${tg['interfaces']['${tg_if1}']['pci_address']} +| | FOR | ${ip_addr} | IN | @{wrk_ip_addrs} +| | | ${ip_addr_on_intf}= | Linux Interface Has IP | ${tg} | ${intf_name} +| | | ... | ${ip_addr} | ${wrk_ip_prefix} +| | | Run Keyword If | ${ip_addr_on_intf}==${True} | Delete Linux Interface IP +| | | ... | ${tg} | ${intf_name} | ${ip_addr} | ${wrk_ip_prefix} +| | END +| | Run Keyword And Ignore Error | PCI Driver Unbind +| | ... | ${tg} | ${tg['interfaces']['${tg_if1}']['pci_address']} +| | Run Keyword And Ignore Error | PCI Driver Unbind +| | ... | ${tg} | ${tg['interfaces']['${tg_if2}']['pci_address']} diff --git a/resources/libraries/robot/tcp/tcp_setup.robot b/resources/libraries/robot/tcp/tcp_setup.robot deleted file mode 100644 index 718070979f..0000000000 --- a/resources/libraries/robot/tcp/tcp_setup.robot +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.InterfaceUtil -| Library | resources.libraries.python.IPUtil -| Library | resources.libraries.python.tcp.TCPUtils -| -| Resource | resources/libraries/robot/ip/ip4.robot -| -| Documentation | L2 keywords to set up VPP to test tcp. - -*** Keywords *** -| Set up HTTP server with parameters on the VPP node -| | [Documentation] -| | ... | Configure IP address on the port, set it up and start HTTP server on -| | ... | the VPP. -| | -| | ... | *Arguments:* -| | ... | - http_static_plugin - Use the HTTP static plugin http server. -| | ... | Type: boolean -| | ... | - prealloc_fifos - Max number of connections you expect to handle -| | ... | at one time. Type: string -| | ... | - fifo_size - FIFO size in kB. Type: string -| | ... | - private_segment_size - Private segment size. Number + unit. -| | ... | Type: string -| | -| | ... | *Example:* -| | -| | ... | \| Set up HTTP server with paramters on the VPP node \| ${true}\ -| | ... | \| 400 \| 4096 \| 2g \| -| | -| | [Arguments] | ${http_static_plugin} | ${prealloc_fifos} | ${fifo_size} -| | ... | ${private_segment_size} -| | -| | Set Interface State | ${dut1} | ${dut1_if1} | up -| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1} | 192.168.10.2 | 24 -| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1} | 192.168.20.2 | 24 -| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1} | 192.168.30.2 | 24 -| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1} | 192.168.40.2 | 24 -| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1} | 192.168.50.2 | 24 -| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1} | 192.168.60.2 | 24 -| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1} | 192.168.70.2 | 24 -| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1} | 192.168.80.2 | 24 -| | Vpp Node Interfaces Ready Wait | ${dut1} -| | Start VPP HTTP server params | ${dut1} | ${http_static_plugin} -| | ... | ${prealloc_fifos} | ${fifo_size} | ${private_segment_size} diff --git a/resources/libraries/robot/wrk/wrk_utils.robot b/resources/libraries/robot/wrk/wrk_utils.robot index 1f6261af5a..2a24bce9f3 100644 --- a/resources/libraries/robot/wrk/wrk_utils.robot +++ b/resources/libraries/robot/wrk/wrk_utils.robot @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -12,15 +12,21 @@ # limitations under the License. *** Settings *** -| Library | resources.tools.wrk.wrk -| Library | resources.libraries.python.IPUtil -| Library | resources.libraries.python.DUTSetup -| Library | resources.libraries.python.TrafficGenerator -| Library | resources.libraries.python.topology.Topology +| Library | resources.tools.wrk.wrk +| Library | resources.libraries.python.IPUtil +| Library | resources.libraries.python.DUTSetup +| Library | resources.libraries.python.TrafficGenerator +| Library | resources.libraries.python.topology.Topology | | Documentation | L2 keywords to set up wrk and to measure performance | ... | parameters using wrk. +*** Variables *** +| ${wrk_ip_prefix}= | 24 +| @{wrk_ip_addrs}= | 192.168.10.1 | 192.168.20.1 | 192.168.30.1 +| ... | 192.168.40.1 | 192.168.50.1 | 192.168.60.1 | 192.168.70.1 +| ... | 192.168.80.1 + *** Keywords *** | Measure throughput | | [Documentation] -- cgit 1.2.3-korg