From: Haiyang Zhao <haiyangx.zhao@intel.com>
To: dts@dpdk.org
Cc: Haiyang Zhao <haiyangx.zhao@intel.com>
Subject: [dts] [next][PATCH V1 3/7] tests/link_flowctrl
Date: Sun, 28 Apr 2019 03:05:05 +0000 [thread overview]
Message-ID: <20190428030509.11490-3-haiyangx.zhao@intel.com> (raw)
In-Reply-To: <20190428030509.11490-1-haiyangx.zhao@intel.com>
1.replace etgen to pktgen API which support both trex and ixia.
2.replace print to logger.info to record the necessary debug information.
Signed-off-by: Haiyang Zhao <haiyangx.zhao@intel.com>
---
tests/TestSuite_link_flowctrl.py | 52 +++++++++++++++++++++-----------
1 file changed, 35 insertions(+), 17 deletions(-)
diff --git a/tests/TestSuite_link_flowctrl.py b/tests/TestSuite_link_flowctrl.py
index 0057b46..67ac979 100644
--- a/tests/TestSuite_link_flowctrl.py
+++ b/tests/TestSuite_link_flowctrl.py
@@ -1,6 +1,6 @@
# BSD LICENSE
#
-# Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+# Copyright(c) 2010-2019 Intel Corporation. All rights reserved.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -36,11 +36,13 @@ Test for Ethernet Link Flow Control Features by Poll Mode Drivers
import utils
import re
+import os
from time import sleep
from test_case import TestCase
from pmd_output import PmdOutput
from settings import HEADER_SIZE
+from pktgen import PacketGeneratorHelper
class TestLinkFlowctrl(TestCase):
@@ -77,6 +79,15 @@ class TestLinkFlowctrl(TestCase):
self.pmdout = PmdOutput(self.dut)
self.pmdout.start_testpmd("all", "--portmask=%s" % self.portMask)
+ # 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 pause_frame_loss_test(self, rx_flow_control='off',
tx_flow_control='off',
@@ -86,7 +97,9 @@ class TestLinkFlowctrl(TestCase):
tester_rx_port = self.tester.get_local_port(self.tx_port)
tgenInput = []
- tgenInput.append((tester_tx_port, tester_rx_port, "test.pcap"))
+ pcap = os.sep.join([self.output_path, "test.pcap"])
+
+ tgenInput.append((tester_tx_port, tester_rx_port, pcap))
self.dut.send_expect("set flow_ctrl rx %s tx %s 300 50 10 1 mac_ctrl_frame_fwd %s autoneg on %d " % (
rx_flow_control,
@@ -96,18 +109,23 @@ class TestLinkFlowctrl(TestCase):
"testpmd> ")
self.dut.send_expect("set fwd csum", "testpmd> ")
- self.dut.send_expect("start", "testpmd> ")
-
- self.tester.scapy_append('wrpcap("test.pcap",[Ether()/IP()/UDP()/("X"*%d)])' %
- TestLinkFlowctrl.payload_size)
+ self.dut.send_expect("start", "testpmd> ", 60)
+ pcap = os.sep.join([self.output_path, "test.pcap"])
+ self.tester.scapy_append('wrpcap("%s",[Ether()/IP()/UDP()/("X"*%d)])' %
+ (pcap,TestLinkFlowctrl.payload_size))
self.tester.scapy_execute()
- # Run traffic generator
- result = self.tester.traffic_generator_loss(tgenInput, 100)
+ # clear streams before add new streams
+ self.tester.pktgen.clear_streams()
+ # run packet generator
+ streams = self.pktgen_helper.prepare_stream_from_tginput(tgenInput, 100,
+ None, self.tester.pktgen)
+ result = self.tester.pktgen.measure_loss(stream_ids=streams)
+
self.dut.send_expect("stop", "testpmd> ")
- return result
+ return result[0]/100
def get_testpmd_port_stats(self, ports):
"""
@@ -184,9 +202,9 @@ class TestLinkFlowctrl(TestCase):
Verifies the test results (use pause_frame_test before) against
the expected behavior.
"""
- print "Result (port, rx, tx) %s, expected rx %s, expected fwd %s" % (result,
+ self.logger.info("Result (port, rx, tx) %s, expected rx %s, expected fwd %s" % (result,
expected_rx,
- expected_fwd)
+ expected_fwd))
if expected_rx:
self.verify(result[self.rx_port][0] == TestLinkFlowctrl.frames_to_sent,
@@ -339,7 +357,7 @@ class TestLinkFlowctrl(TestCase):
tx_flow_control='on',
pause_frame_fwd='on')
- print "Packet loss: %.3f%%" % result
+ self.logger.info("Packet loss: %.3f%%" % result)
self.verify(result <= 0.01,
"Link flow control fail, the loss percent is more than 1%")
@@ -353,7 +371,7 @@ class TestLinkFlowctrl(TestCase):
tx_flow_control='on',
pause_frame_fwd='off')
- print "Packet loss: %.3f%%" % result
+ self.logger.info("Packet loss: %.3f%%" % result)
self.verify(result <= 0.01,
"Link flow control fail, the loss percent is more than 1%")
@@ -367,7 +385,7 @@ class TestLinkFlowctrl(TestCase):
tx_flow_control='on',
pause_frame_fwd='off')
- print "Packet loss: %.3f%%" % result
+ self.logger.info("Packet loss: %.3f%%" % result)
self.verify(result <= 0.01,
"Link flow control fail, the loss percent is more than 1%")
@@ -381,7 +399,7 @@ class TestLinkFlowctrl(TestCase):
tx_flow_control='off',
pause_frame_fwd='on')
- print "Packet loss: %.3f%%" % result
+ self.logger.info("Packet loss: %.3f%%" % result)
self.verify(result >= 0.5,
"Link flow control fail, the loss percent is less than 50%")
@@ -395,7 +413,7 @@ class TestLinkFlowctrl(TestCase):
tx_flow_control='off',
pause_frame_fwd='off')
- print "Packet loss: %.3f%%" % result
+ self.logger.info("Packet loss: %.3f%%" % result)
self.verify(result >= 0.5,
"Link flow control fail, the loss percent is less than 50%")
@@ -409,7 +427,7 @@ class TestLinkFlowctrl(TestCase):
tx_flow_control='on',
pause_frame_fwd='off')
- print "Packet loss: %.3f%%" % result
+ self.logger.info("Packet loss: %.3f%%" % result)
self.verify(result <= 0.01,
"Link flow control fail, the loss percent is more than 1%")
--
2.17.1
next prev parent reply other threads:[~2019-04-28 3:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-28 3:05 [dts] [next][PATCH V1 1/7] tests/l3fwd Haiyang Zhao
2019-04-28 3:05 ` [dts] [next][PATCH V1 2/7] tests/l3fwd_em Haiyang Zhao
2019-04-28 3:05 ` Haiyang Zhao [this message]
2019-04-28 3:05 ` [dts] [next][PATCH V1 4/7] tests/multiprocess Haiyang Zhao
2019-04-28 3:05 ` [dts] [next][PATCH V1 5/7] tests/pmd Haiyang Zhao
2019-04-28 3:05 ` [dts] [next][PATCH V1 6/7] tests/tso Haiyang Zhao
2019-04-28 3:05 ` [dts] [next][PATCH V1 7/7] tests/vmdq Haiyang Zhao
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=20190428030509.11490-3-haiyangx.zhao@intel.com \
--to=haiyangx.zhao@intel.com \
--cc=dts@dpdk.org \
/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).