From ce8e18ddcfb84f887aa91f38133781da2f592309 Mon Sep 17 00:00:00 2001 From: Martin Klozik Date: Thu, 4 Jan 2018 10:32:48 +0000 Subject: trex: Add support for traffic capture A support of traffic capture was added into T-Rex. It allows to write a functional tests, which will verify proper vSwitch functionality by inspection of packets received by T-Rex. A testcase example was added into integration testcases. JIRA: VSPERF-556 Change-Id: I5ad28479ca2ec29760b68f24510af1a6d74866ae Signed-off-by: Martin Klozik Reviewed-by: Al Morton Reviewed-by: Christian Trautman Reviewed-by: Sridhar Rao Reviewed-by: Trevor Cooper Reviewed-by: Richard Elias --- conf/03_traffic.conf | 31 +++++++++++++++++++++++++++++++ conf/integration/01_testcases.conf | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) (limited to 'conf') diff --git a/conf/03_traffic.conf b/conf/03_traffic.conf index 3c7bd2f5..67318893 100644 --- a/conf/03_traffic.conf +++ b/conf/03_traffic.conf @@ -147,6 +147,30 @@ LOG_FILE_TRAFFIC_GEN = 'traffic-gen.log' # congestion (DEI header field). # Data type: int (NOTE: must fit to 1 bit) # Default value: 0 +# 'capture' - A dictionary with traffic capture configuration. +# NOTE: It is supported only by T-Rex traffic generator. +# 'enabled' - Specifies if traffic should be captured +# Data type: bool +# Default value: False +# 'tx_ports' - A list of ports, where frames transmitted towards DUT will +# be captured. Ports have numbers 0 and 1. TX packet capture +# is disabled if list of ports is empty. +# Data type: list +# Default value: [0] +# 'rx_ports' - A list of ports, where frames received from DUT will +# be captured. Ports have numbers 0 and 1. RX packet capture +# is disabled if list of ports is empty. +# Data type: list +# Default value: [1] +# 'count' - A number of frames to be captured. The same count value +# is applied to both TX and RX captures. +# Data type: int +# Default value: 1 +# 'filter' - An expression used to filter TX and RX packets. It uses the same +# syntax as pcap library. See pcap-filter man page for additional +# details. +# Data type: str +# Default value: '' TRAFFIC = { 'traffic_type' : 'rfc2544_throughput', 'frame_rate' : 100, @@ -179,6 +203,13 @@ TRAFFIC = { 'priority': 0, 'cfi': 0, }, + 'capture': { + 'enabled': False, + 'tx_ports' : [0], + 'rx_ports' : [1], + 'count': 1, + 'filter': '', + }, } #path to traffic generators directory. diff --git a/conf/integration/01_testcases.conf b/conf/integration/01_testcases.conf index 692f1561..bb2809b8 100644 --- a/conf/integration/01_testcases.conf +++ b/conf/integration/01_testcases.conf @@ -1118,6 +1118,44 @@ INTEGRATION_TESTS += [ ['tools', 'assert', '#STEP[-1][0] == 0'], ], }, + # Capture Example 3 - Traffic capture by traffic generator. + # This TestCase uses OVS flow to add VLAN tag with given ID into every + # frame send by traffic generator. Correct frame modificaiton is verified by + # inspection of packet capture received by T-Rex. + { + "Name": "capture_p2p_add_vlan_ovs_trex", + "Deployment": "clean", + "Description": "OVS: Test VLAN tag modification and verify it by traffic capture", + "vSwitch" : "OvsDpdkVhost", # works also for Vanilla OVS + "Parameters" : { + "TRAFFICGEN" : "Trex", + "TRAFFICGEN_DURATION" : 5, + "TRAFFIC" : { + "traffic_type" : "rfc2544_continuous", + "frame_rate" : 100, + # enable capture of five RX frames + 'capture': { + 'enabled': True, + 'tx_ports' : [], + 'rx_ports' : [1], + 'count' : 5, + }, + }, + }, + "TestSteps" : STEP_VSWITCH_P2P_INIT + [ + # replace standard L2 flows by flows, which will add VLAN tag with ID 3 + ['!vswitch', 'add_flow', 'int_br0', {'in_port': '1', 'actions': ['mod_vlan_vid:3','output:2']}], + ['!vswitch', 'add_flow', 'int_br0', {'in_port': '2', 'actions': ['mod_vlan_vid:3','output:1']}], + ['vswitch', 'dump_flows', 'int_br0'], + ['trafficgen', 'send_traffic', {}], + ['trafficgen', 'get_results'], + # verify that captured frames have vlan tag with ID 3 + ['tools', 'exec_shell', 'tcpdump -qer $RESULTS_PATH/#STEP[-1][0]["capture_rx"] vlan 3 ' + '2>/dev/null | wc -l', '|^(\d+)$'], + # number of received frames with expected VLAN id must match the number of captured frames + ['tools', 'assert', '#STEP[-1][0] == 5'], + ] + STEP_VSWITCH_P2P_FINIT, + }, # # End of examples of functional testcases with traffic capture validation # -- cgit 1.2.3-korg