From: yufengmx <yufengx.mo@intel.com>
To: dts@dpdk.org, lijuan.tu@intel.com
Cc: yufengmx <yufengx.mo@intel.com>
Subject: [dts] [PATCH V3 8/13] tests/l3fwd_em: upload automation script
Date: Thu, 16 Jan 2020 13:28:15 +0800 [thread overview]
Message-ID: <20200116052820.21902-9-yufengx.mo@intel.com> (raw)
In-Reply-To: <20200116052820.21902-1-yufengx.mo@intel.com>
upload l3fwd_em suite automation script.
Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
tests/TestSuite_l3fwd_em.py | 258 +++++-------------------------------
1 file changed, 30 insertions(+), 228 deletions(-)
diff --git a/tests/TestSuite_l3fwd_em.py b/tests/TestSuite_l3fwd_em.py
index ee50fcc..c586759 100644
--- a/tests/TestSuite_l3fwd_em.py
+++ b/tests/TestSuite_l3fwd_em.py
@@ -1,6 +1,6 @@
# BSD LICENSE
#
-# Copyright(c) 2010-2019 Intel Corporation. All rights reserved.
+# Copyright(c) 2010-2020 Intel Corporation. All rights reserved.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -31,257 +31,59 @@
"""
DPDK Test suite.
-Layer-3 forwarding exact-match test script.
+Layer-3 forwarding test script.
"""
-
-import os
-import utils
-import string
-import re
from test_case import TestCase
-from exception import VerifyFailure
-from settings import HEADER_SIZE
-from utils import *
-from pktgen import PacketGeneratorHelper
-
-
-class TestL3fwdEM(TestCase):
-
- path = "./examples/l3fwd/build/"
-
- test_cases_2_ports = {"1S/1C/1T": "%s -c %s -n %d -- -p %s -E --config '(P0,0,C{1.1.0}), (P1,0,C{1.1.0})' --hash-entry-num 0x400000",
- "1S/2C/1T": "%s -c %s -n %d -- -p %s -E --config '(P0,0,C{1.1.0}), (P1,0,C{1.2.0})' --hash-entry-num 0x400000",
- "1S/4C/1T": "%s -c %s -n %d -- -p %s -E --config '(P0,0,C{1.1.0}), (P1,0,C{1.2.0}),(P0,1,C{1.3.0}), (P1,1,C{1.4.0})' --hash-entry-num 0x400000"
- }
-
- frame_sizes = [64, 65, 128, 256, 512, 1518]
- methods = ['exact']
-
- #
- #
- # Utility methods and other non-test code.
- #
- # Insert or move non-test functions here.
- def portRepl(self, match):
- """
- Function to replace P([0123]) pattern in tables
- """
+from l3fwd_base import L3fwdBase, LPM, EM, L3_IPV6, L3_IPV4
- portid = match.group(1)
- self.verify(int(portid) in range(4), "invalid port id")
- if int(portid) >= len(valports):
- return '0'
- else:
- return '%s' % valports[int(portid)]
- #
- #
+class TestL3fwdEm(TestCase, L3fwdBase):
#
# Test cases.
#
-
def set_up_all(self):
"""
Run at the start of each test suite.
-
-
L3fwd Prerequisites
"""
# Based on h/w type, choose how many ports to use
- ports = self.dut.get_ports(socket=1)
- if not ports:
- ports = self.dut.get_ports(socket=0)
-
- self.tester.extend_external_packet_generator(TestL3fwdEM, self)
- # Verify that enough ports are available
- self.verify(len(ports) >= 2, "Insufficient ports for speed testing")
-
- netdev = self.dut.ports_info[ports[0]]['port']
-
- self.port_socket = netdev.socket
-
- # Verify that enough threads are available
- cores = self.dut.get_core_list("1S/8C/2T")
+ self.dut_ports = self.dut.get_ports(self.nic)
+ valports = [
+ _ for _ in self.dut_ports if self.tester.get_local_port(_) != -1]
+ self.logger.debug(valports)
+ self.verify_ports_number(valports)
+ # get socket and cores
+ socket = self.dut.get_numa_id(self.dut_ports[0])
+ cores = self.dut.get_core_list("1S/8C/1T", socket=socket)
self.verify(cores is not None, "Insufficient cores for speed testing")
+ # init l3fwd common base class parameters
+ self.l3fwd_init(valports, socket)
+ # preset testing environment
+ self.l3fwd_preset_test_environment(self.get_suite_cfg())
- global valports
- valports = [_ for _ in ports if self.tester.get_local_port(_) != -1]
-
- self.verify(len(valports) >= 2, "Insufficient active ports for speed testing")
-
- pat = re.compile("P([0123])")
-
- # Update config file and rebuild to get best perf on FVL
- self.dut.send_expect("sed -i -e 's/CONFIG_RTE_PCI_CONFIG=n/CONFIG_RTE_PCI_CONFIG=y/' ./config/common_linuxapp", "#", 20)
- self.dut.send_expect("sed -i -e 's/CONFIG_RTE_PCI_EXTENDED_TAG=.*$/CONFIG_RTE_PCI_EXTENDED_TAG=\"on\"/' ./config/common_linuxapp", "#", 20)
- self.dut.build_install_dpdk(self.target)
-
- out = self.dut.build_dpdk_apps("./examples/l3fwd")
- self.verify("Error" not in out, "compilation error 1")
- self.verify("No such file" not in out, "compilation error 2")
-
- self.l3fwd_test_results = {'header': [],
- 'data': []}
- # get dts output path
- if self.logger.log_path.startswith(os.sep):
- self.output_path = self.logger.log_path
- else:
- cur_path = os.path.dirname(
- os.path.dirname(os.path.realpath(__file__)))
- self.output_path = os.sep.join([cur_path, self.logger.log_path])
- # create an instance to set stream field setting
- self.pktgen_helper = PacketGeneratorHelper()
-
- def repl(self, match):
- pid = match.group(1)
- qid = match.group(2)
- self.logger.debug("%s\n" % match.group(3))
- lcid = self.dut.get_lcore_id(match.group(3))
- self.logger.debug("%s\n" % lcid)
-
- global corelist
- corelist.append(int(lcid))
-
- self.verify(int(pid) in range(4), "invalid port id")
- self.verify(lcid, "invalid thread id")
-
- return '%s,%s,%s' % (str(valports[int(pid)]), qid, lcid)
-
- def set_up(self):
+ def tear_down_all(self):
"""
- Run before each test case.
+ Run after each test suite.
"""
pass
- def test_perf_l3fwd_2ports(self):
+ def set_up(self):
"""
- L3fwd main 2 ports.
+ Run before each test case.
"""
-
- header_row = ["Frame", "mode", "S/C/T", "Mpps", "% linerate"]
- self.l3fwd_test_results['header'] = header_row
- self.result_table_create(header_row)
- self.l3fwd_test_results['data'] = []
-
- for frame_size in TestL3fwdEM.frame_sizes:
-
- # Prepare traffic flow
- payload_size = frame_size - \
- HEADER_SIZE['ip'] - HEADER_SIZE['eth'] - HEADER_SIZE['tcp']
-
- # Traffic for port0
- dmac_port0 = self.dut.get_mac_address(valports[0])
- flow1 = '[Ether(dst="%s")/IP(src="200.20.0.1",dst="201.0.0.0")/TCP(sport=12,dport=102)/("X"*%d)]' %(dmac_port0,payload_size)
-
- pcaps = {}
- pcap = os.sep.join([self.output_path, "dst0.pcap"])
- pcaps[0] = pcap
- self.tester.scapy_append('wrpcap("{0}",{1})'.format(pcap, flow1))
-
- # Traffic for port1
- dmac_port1 = self.dut.get_mac_address(valports[1])
- flow2 = '[Ether(dst="%s")/IP(src="100.10.0.1",dst="101.0.0.0")/TCP(sport=11,dport=101)/("X"*%d)]' %(dmac_port1,payload_size)
-
- pcap = os.sep.join([self.output_path, "dst1.pcap"])
- pcaps[1] = pcap
- self.tester.scapy_append('wrpcap("{0}",{1})'.format(pcap, flow2))
- self.tester.scapy_execute()
-
- # Prepare the command line
- global corelist
- pat = re.compile("P([0123]),([0123]),(C\{\d.\d.\d\})")
-
- pat2 = re.compile("C\{\d")
- repl1 = "C{" + str(self.port_socket)
-
- coreMask = {}
- rtCmdLines = dict(TestL3fwdEM.test_cases_2_ports)
- for key in rtCmdLines.keys():
- corelist = []
- while pat.search(rtCmdLines[key]):
- # Change the socket to the NIC's socket
- if key.find('1S') >= 0:
- rtCmdLines[key] = pat2.sub(repl1, rtCmdLines[key])
- rtCmdLines[key] = pat.sub(self.repl, rtCmdLines[key])
-
- self.logger.info("%s\n" % str(corelist))
- coreMask[key] = utils.create_mask(set(corelist))
-
- # measure by two different mode
- for mode in TestL3fwdEM.methods:
-
- # start l3fwd
- index = 0
- subtitle = []
- for cores in rtCmdLines.keys():
-
- info = "Executing l3fwd using %s mode, 2 ports, %s and %d frame size.\n" % (
- mode, cores, frame_size)
-
- self.logger.info(info)
- self.rst_report(info, annex=True)
-
- subtitle.append(cores)
- cmdline = rtCmdLines[cores] % (TestL3fwdEM.path + "l3fwd", coreMask[cores],
- self.dut.get_memory_channels(), utils.create_mask(valports[:2]))
-
- self.rst_report(cmdline + "\n", frame=True, annex=True)
-
- out = self.dut.send_expect(cmdline, "L3FWD: entering main loop", 120)
-
- # Measure test
- tgenInput = []
- for rxPort in range(2):
- # No use on rx/tx limitation
- if rxPort % 2 == 0:
- txIntf = self.tester.get_local_port(valports[rxPort + 1])
- else:
- txIntf = self.tester.get_local_port(valports[rxPort - 1])
-
- rxIntf = self.tester.get_local_port(valports[rxPort])
- port_index = valports[rxPort+1] if rxPort % 2 == 0 else valports[rxPort-1]
- tgenInput.append((txIntf, rxIntf, pcaps[port_index]))
-
- vm_config = self.set_fields()
- # clear streams before add new streams
- self.tester.pktgen.clear_streams()
- # run packet generator
- streams = self.pktgen_helper.prepare_stream_from_tginput(tgenInput, 100,
- vm_config, self.tester.pktgen)
- traffic_opt = {'duration': 20, }
- _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams, options=traffic_opt)
-
- self.verify(pps > 0, "No traffic detected")
- pps /= 1000000.0
- linerate = self.wirespeed(self.nic, frame_size, 2)
- pct = pps * 100 / linerate
- index += 1
-
- # Stop l3fwd
- self.dut.send_expect("^C", "#")
- data_row = [frame_size, mode, cores, str(pps), str(pct)]
- self.result_table_add(data_row)
- self.l3fwd_test_results['data'].append(data_row)
-
- self.result_table_print()
-
- def set_fields(self):
- ''' set ip protocol field behavior '''
- fields_config = {
- 'ip': {
- 'dst': {'range': 64, 'mask': '255.240.0.0', 'action': 'inc'}
- },}
-
- return fields_config
+ pass
def tear_down(self):
"""
Run after each test case.
"""
- pass
+ self.dut.kill_all()
+ self.l3fwd_reset_cur_case()
- def tear_down_all(self):
- """
- Run after each test suite.
- """
- pass
+ def test_perf_throughput_ipv4_em(self):
+ self.l3fwd_set_cur_case('test_perf_throughput_ipv4_em')
+ self.ms_throughput(l3_proto=L3_IPV4, mode=EM)
+
+ def test_perf_throughput_ipv6_em(self):
+ self.l3fwd_set_cur_case('test_perf_throughput_ipv6_em')
+ self.ms_throughput(l3_proto=L3_IPV6, mode=EM)
--
2.21.0
next prev parent reply other threads:[~2020-01-16 5:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-16 5:28 [dts] [PATCH V3 0/13] l3fwd: refactor script yufengmx
2020-01-16 5:28 ` [dts] [PATCH V3 1/13] conf/l3fwd: l3fwd suite testing configuration yufengmx
2020-01-16 5:28 ` [dts] [PATCH V3 2/13] conf/l3fwd_base: l3fwd base class flows configuration yufengmx
2020-01-16 5:28 ` [dts] [PATCH V3 3/13] conf/l3fwd_em: suite testing configuration yufengmx
2020-01-16 5:28 ` [dts] [PATCH V3 4/13] conf/l3fwd_lpm_ipv4_rfc2544: " yufengmx
2020-01-16 5:28 ` [dts] [PATCH V3 5/13] conf/l3fwd_lpm_ipv4: l3fwd_lpm_ipv4 " yufengmx
2020-01-16 5:28 ` [dts] [PATCH V3 6/13] conf/l3fwd_lpm_ipv6: suite " yufengmx
2020-01-16 5:28 ` [dts] [PATCH V3 7/13] tests/l3fwd: upload automation script yufengmx
2020-01-16 5:28 ` yufengmx [this message]
2020-01-16 5:28 ` [dts] [PATCH V3 9/13] tests/l3fwd_lpm_ipv4_rfc2544: " yufengmx
2020-01-16 5:28 ` [dts] [PATCH V3 0/13] tests/l3fwd_lpm_ipv4: " yufengmx
2020-01-16 5:28 ` [dts] [PATCH V3 1/13] tests/l3fwd_lpm_ipv6: " yufengmx
2020-01-16 5:28 ` [dts] [PATCH V3 2/13] tests/l3fwd_base: " yufengmx
2020-01-16 5:28 ` [dts] [PATCH V3 3/13] framework/test_case: add wirespeed columbiaville nic yufengmx
2020-01-16 7:15 ` [dts] [PATCH V3 0/13] l3fwd: refactor script Tu, Lijuan
2020-01-16 7:27 yufengmx
2020-01-16 7:27 ` [dts] [PATCH V3 8/13] tests/l3fwd_em: upload automation script yufengmx
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200116052820.21902-9-yufengx.mo@intel.com \
--to=yufengx.mo@intel.com \
--cc=dts@dpdk.org \
--cc=lijuan.tu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).