* [dts] [PATCH V2]Ethtool: update automation testing script
@ 2016-07-27 3:57 Yufen Mo
2016-07-27 3:57 ` Yufen Mo
0 siblings, 1 reply; 6+ messages in thread
From: Yufen Mo @ 2016-07-27 3:57 UTC (permalink / raw)
To: dts; +Cc: yufengmx
From: yufengmx <yufengx.mo@intel.com>
yufengmx (1):
Ethtool: update automation testing script
tests/TestSuite_userspace_ethtool.py | 35 ++++++++++++++++++++++++++++-------
1 file changed, 28 insertions(+), 7 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dts] [PATCH V2]Ethtool: update automation testing script
2016-07-27 3:57 [dts] [PATCH V2]Ethtool: update automation testing script Yufen Mo
@ 2016-07-27 3:57 ` Yufen Mo
2016-07-27 4:27 ` Liu, Yong
0 siblings, 1 reply; 6+ messages in thread
From: Yufen Mo @ 2016-07-27 3:57 UTC (permalink / raw)
To: dts; +Cc: yufengmx
From: yufengmx <yufengx.mo@intel.com>
*. close eeprom test case on FVL for FVL series firmware not supported
*. set port to up status when port is on down status
*. reset ring parameter after ring parameter is used
*. set packet src mac with a non-zero value
*. set testing content the same user space ethtool dumped
Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
tests/TestSuite_userspace_ethtool.py | 35 ++++++++++++++++++++++++++++-------
1 file changed, 28 insertions(+), 7 deletions(-)
diff --git a/tests/TestSuite_userspace_ethtool.py b/tests/TestSuite_userspace_ethtool.py
index c718a58..e33da39 100644
--- a/tests/TestSuite_userspace_ethtool.py
+++ b/tests/TestSuite_userspace_ethtool.py
@@ -34,6 +34,7 @@ DPDK Test suite.
Test support of userspace ethtool feature
"""
+import os
import dts
import time
import re
@@ -67,6 +68,7 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
self.pause_time = 65535
self.frame_size = 64
self.pause_rate = 0.50
+ self.src_mac = "11:22:33:44:55:66"
# update IxiaPacketGenerator function from local
self.tester.extend_external_packet_generator(TestUserspaceEthtool, self)
@@ -128,8 +130,8 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
return 1518
def resize_linux_eeprom_file(self, dpdk_eeprom_file, linux_eeprom_file):
- basePath = self.dut.base_dir
- with open( basePath + dpdk_eeprom_file, 'rb') as fpDpdk:
+ basePath = os.sep + "root" + self.dut.base_dir[1:] + os.sep
+ with open( basePath + os.sep + dpdk_eeprom_file, 'rb') as fpDpdk:
dpdk_bytes = fpDpdk.read()
dpdk_length = len(dpdk_bytes)
@@ -152,6 +154,13 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
else:
return ""
+ def check_port_up(self, intf):
+ self.tester.send_expect("ifconfig %s | grep -i up"%intf, "#")
+ if self.tester.send_expect("echo $?", "#") != "0":
+ self.tester.send_expect("ifconfig %s up"%intf, "#")
+ time.sleep(1)
+ self.verify( self.tester.send_expect("echo $?", "#") == "0", "Tester [%s] boot up failed"%intf)
+
def test_dump_driver_info(self):
"""
Test ethtool can dump basic information
@@ -200,10 +209,12 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
time.sleep(5)
# check port stats function
- pkt = Packet(pkt_type='UDP')
+ pkt = Packet()
+ pkt.config_layer('ether', {'src': self.src_mac})
for port in self.ports:
tester_port = self.tester.get_local_port(port)
intf = self.tester.get_interface(tester_port)
+ self.check_port_up(intf)
ori_rx_pkts, ori_tx_pkts = self.strip_portstats(port)
pkt.send_pkt(tx_port=intf)
time.sleep(1)
@@ -220,7 +231,10 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
portsinfo = []
ori_drivers = []
-
+
+ if self.nic.startswith("fortville"):
+ return
+
for portid in range(len(self.ports)):
self.dut.send_expect("regs %d regs_%d.bin" % (portid, portid), "EthApp>")
portinfo = {'portid': portid, 'reg_file': 'regs_%d.bin' % portid}
@@ -300,8 +314,8 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
"""
Test ethtool app ring parameter getting and setting
"""
- self.dut.send_expect(self.cmd, "EthApp>", 60)
for index in range(len(self.ports)):
+ self.dut.send_expect(self.cmd, "EthApp>", 60)
port = self.ports[index]
ori_rx_pkts, ori_tx_pkts = self.strip_portstats(port)
_, rx_max, _, tx_max = self.strip_ringparam(index)
@@ -310,13 +324,15 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
self.verify(rx_ring == rx_max, "Userspace tool failed to set Rx ring parameter")
self.verify(tx_ring == tx_max, "Userspace tool failed to set Tx ring parameter")
pkt = Packet()
+ pkt.config_layer('ether', {'src': self.src_mac})
tester_port = self.tester.get_local_port(port)
intf = self.tester.get_interface(tester_port)
+ self.check_port_up(intf)
pkt.send_pkt(tx_port=intf)
+ time.sleep(1)
rx_pkts, tx_pkts = self.strip_portstats(index)
self.verify(rx_pkts == ori_rx_pkts + 1, "Failed to forward after ring parameter changed")
-
- self.dut.send_expect("quit", "# ")
+ self.dut.send_expect("quit", "# ")
def test_ethtool_vlan(self):
"""
@@ -340,6 +356,7 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
# send correct vlan packet to port
pkt = Packet(pkt_type='VLAN_UDP')
+ pkt.config_layer('ether', {'src': self.src_mac})
pkt.config_layer('vlan', {'vlan': vlan})
tester_port = self.tester.get_local_port(port)
intf = self.tester.get_interface(tester_port)
@@ -386,6 +403,7 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
self.verify(dump_mac == valid_mac, "Userspace tool failed to set mac")
# check forwarded mac has been changed
pkt = Packet()
+ pkt.config_layer('ether', {'src': self.src_mac})
tester_port = self.tester.get_local_port(port)
intf = self.tester.get_interface(tester_port)
# send and sniff packet
@@ -419,6 +437,7 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
self.dut.send_expect("stop %d" % index, "EthApp>")
# check packet not forwarded when port is stop
pkt = Packet()
+ pkt.config_layer('ether', {'src': self.src_mac})
tester_port = self.tester.get_local_port(port)
intf = self.tester.get_interface(tester_port)
pkt.send_pkt(tx_port=intf)
@@ -455,10 +474,12 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
ori_rx_pkts, _ = self.strip_portstats(index)
pkt_size = mtu + HEADER_SIZE['eth']
pkt = Packet(pkt_len=pkt_size)
+ pkt.config_layer('ether', {'src': self.src_mac})
pkt.send_pkt(tx_port=intf)
rx_pkts, _ = self.strip_portstats(index)
self.verify(rx_pkts == ori_rx_pkts, "Packet match mtu not forwarded as expected")
pkt = Packet(pkt_len=mtu + 1)
+ pkt.config_layer('ether', {'src': self.src_mac})
pkt.send_pkt(tx_port=intf)
rx_pkts_over, _ = self.strip_portstats(index)
self.verify(rx_pkts == rx_pkts_over, "Packet over mtu should not be forwarded")
--
1.9.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dts] [PATCH V2]Ethtool: update automation testing script
2016-07-27 3:57 ` Yufen Mo
@ 2016-07-27 4:27 ` Liu, Yong
0 siblings, 0 replies; 6+ messages in thread
From: Liu, Yong @ 2016-07-27 4:27 UTC (permalink / raw)
To: Yufen Mo, dts
Hi Yufen, one comment and one question.
On 07/27/2016 11:57 AM, Yufen Mo wrote:
> From: yufengmx <yufengx.mo@intel.com>
>
> *. close eeprom test case on FVL for FVL series firmware not supported
> *. set port to up status when port is on down status
> *. reset ring parameter after ring parameter is used
> *. set packet src mac with a non-zero value
> *. set testing content the same user space ethtool dumped
>
> Signed-off-by: yufengmx <yufengx.mo@intel.com>
> ---
> tests/TestSuite_userspace_ethtool.py | 35 ++++++++++++++++++++++++++++-------
> 1 file changed, 28 insertions(+), 7 deletions(-)
>
> diff --git a/tests/TestSuite_userspace_ethtool.py b/tests/TestSuite_userspace_ethtool.py
> index c718a58..e33da39 100644
> --- a/tests/TestSuite_userspace_ethtool.py
> +++ b/tests/TestSuite_userspace_ethtool.py
> @@ -34,6 +34,7 @@ DPDK Test suite.
> Test support of userspace ethtool feature
> """
>
> +import os
> import dts
> import time
> import re
> @@ -67,6 +68,7 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
> self.pause_time = 65535
> self.frame_size = 64
> self.pause_rate = 0.50
> + self.src_mac = "11:22:33:44:55:66"
I think this is work around for FVL issue, let's do the work around in
packet module.
>
> # update IxiaPacketGenerator function from local
> self.tester.extend_external_packet_generator(TestUserspaceEthtool, self)
> @@ -128,8 +130,8 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
> return 1518
>
> def resize_linux_eeprom_file(self, dpdk_eeprom_file, linux_eeprom_file):
> - basePath = self.dut.base_dir
> - with open( basePath + dpdk_eeprom_file, 'rb') as fpDpdk:
> + basePath = os.sep + "root" + self.dut.base_dir[1:] + os.sep
> + with open( basePath + os.sep + dpdk_eeprom_file, 'rb') as fpDpdk:
> dpdk_bytes = fpDpdk.read()
> dpdk_length = len(dpdk_bytes)
>
> @@ -152,6 +154,13 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
> else:
> return ""
>
> + def check_port_up(self, intf):
> + self.tester.send_expect("ifconfig %s | grep -i up"%intf, "#")
> + if self.tester.send_expect("echo $?", "#") != "0":
> + self.tester.send_expect("ifconfig %s up"%intf, "#")
> + time.sleep(1)
> + self.verify( self.tester.send_expect("echo $?", "#") == "0", "Tester [%s] boot up failed"%intf)
> +
DTS framework has done this before running the suite, what's the
requirement to do this here?
> def test_dump_driver_info(self):
> """
> Test ethtool can dump basic information
> @@ -200,10 +209,12 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
> time.sleep(5)
>
> # check port stats function
> - pkt = Packet(pkt_type='UDP')
> + pkt = Packet()
> + pkt.config_layer('ether', {'src': self.src_mac})
> for port in self.ports:
> tester_port = self.tester.get_local_port(port)
> intf = self.tester.get_interface(tester_port)
> + self.check_port_up(intf)
> ori_rx_pkts, ori_tx_pkts = self.strip_portstats(port)
> pkt.send_pkt(tx_port=intf)
> time.sleep(1)
> @@ -220,7 +231,10 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
>
> portsinfo = []
> ori_drivers = []
> -
> +
> + if self.nic.startswith("fortville"):
> + return
> +
> for portid in range(len(self.ports)):
> self.dut.send_expect("regs %d regs_%d.bin" % (portid, portid), "EthApp>")
> portinfo = {'portid': portid, 'reg_file': 'regs_%d.bin' % portid}
> @@ -300,8 +314,8 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
> """
> Test ethtool app ring parameter getting and setting
> """
> - self.dut.send_expect(self.cmd, "EthApp>", 60)
> for index in range(len(self.ports)):
> + self.dut.send_expect(self.cmd, "EthApp>", 60)
> port = self.ports[index]
> ori_rx_pkts, ori_tx_pkts = self.strip_portstats(port)
> _, rx_max, _, tx_max = self.strip_ringparam(index)
> @@ -310,13 +324,15 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
> self.verify(rx_ring == rx_max, "Userspace tool failed to set Rx ring parameter")
> self.verify(tx_ring == tx_max, "Userspace tool failed to set Tx ring parameter")
> pkt = Packet()
> + pkt.config_layer('ether', {'src': self.src_mac})
> tester_port = self.tester.get_local_port(port)
> intf = self.tester.get_interface(tester_port)
> + self.check_port_up(intf)
> pkt.send_pkt(tx_port=intf)
> + time.sleep(1)
> rx_pkts, tx_pkts = self.strip_portstats(index)
> self.verify(rx_pkts == ori_rx_pkts + 1, "Failed to forward after ring parameter changed")
> -
> - self.dut.send_expect("quit", "# ")
> + self.dut.send_expect("quit", "# ")
>
> def test_ethtool_vlan(self):
> """
> @@ -340,6 +356,7 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
>
> # send correct vlan packet to port
> pkt = Packet(pkt_type='VLAN_UDP')
> + pkt.config_layer('ether', {'src': self.src_mac})
> pkt.config_layer('vlan', {'vlan': vlan})
> tester_port = self.tester.get_local_port(port)
> intf = self.tester.get_interface(tester_port)
> @@ -386,6 +403,7 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
> self.verify(dump_mac == valid_mac, "Userspace tool failed to set mac")
> # check forwarded mac has been changed
> pkt = Packet()
> + pkt.config_layer('ether', {'src': self.src_mac})
> tester_port = self.tester.get_local_port(port)
> intf = self.tester.get_interface(tester_port)
> # send and sniff packet
> @@ -419,6 +437,7 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
> self.dut.send_expect("stop %d" % index, "EthApp>")
> # check packet not forwarded when port is stop
> pkt = Packet()
> + pkt.config_layer('ether', {'src': self.src_mac})
> tester_port = self.tester.get_local_port(port)
> intf = self.tester.get_interface(tester_port)
> pkt.send_pkt(tx_port=intf)
> @@ -455,10 +474,12 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
> ori_rx_pkts, _ = self.strip_portstats(index)
> pkt_size = mtu + HEADER_SIZE['eth']
> pkt = Packet(pkt_len=pkt_size)
> + pkt.config_layer('ether', {'src': self.src_mac})
> pkt.send_pkt(tx_port=intf)
> rx_pkts, _ = self.strip_portstats(index)
> self.verify(rx_pkts == ori_rx_pkts, "Packet match mtu not forwarded as expected")
> pkt = Packet(pkt_len=mtu + 1)
> + pkt.config_layer('ether', {'src': self.src_mac})
> pkt.send_pkt(tx_port=intf)
> rx_pkts_over, _ = self.strip_portstats(index)
> self.verify(rx_pkts == rx_pkts_over, "Packet over mtu should not be forwarded")
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dts] [PATCH V2]Ethtool: update automation testing script
2016-07-27 6:41 ` Yufen Mo
@ 2016-07-27 9:30 ` Liu, Yong
0 siblings, 0 replies; 6+ messages in thread
From: Liu, Yong @ 2016-07-27 9:30 UTC (permalink / raw)
To: Mo, YufengX, dts; +Cc: Mo, YufengX
Thanks, applied.
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yufen Mo
> Sent: Wednesday, July 27, 2016 2:42 PM
> To: dts@dpdk.org
> Cc: Mo, YufengX
> Subject: [dts] [PATCH V2]Ethtool: update automation testing script
>
> From: yufengmx <yufengx.mo@intel.com>
>
> *. close eeprom test case on FVL for FVL series firmware not supported
> *. reset ring parameter after ring parameter is used
> *. set testing content the same user space ethtool dumped
>
> Signed-off-by: yufengmx <yufengx.mo@intel.com>
> ---
> tests/TestSuite_userspace_ethtool.py | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/tests/TestSuite_userspace_ethtool.py
> b/tests/TestSuite_userspace_ethtool.py
> index c718a58..26044a3 100644
> --- a/tests/TestSuite_userspace_ethtool.py
> +++ b/tests/TestSuite_userspace_ethtool.py
> @@ -128,8 +128,8 @@ class TestUserspaceEthtool(TestCase,
> IxiaPacketGenerator):
> return 1518
>
> def resize_linux_eeprom_file(self, dpdk_eeprom_file,
> linux_eeprom_file):
> - basePath = self.dut.base_dir
> - with open( basePath + dpdk_eeprom_file, 'rb') as fpDpdk:
> + basePath = os.sep + "root" + self.dut.base_dir[1:] + os.sep
> + with open( basePath + os.sep + dpdk_eeprom_file, 'rb') as fpDpdk:
> dpdk_bytes = fpDpdk.read()
> dpdk_length = len(dpdk_bytes)
>
> @@ -220,7 +220,10 @@ class TestUserspaceEthtool(TestCase,
> IxiaPacketGenerator):
>
> portsinfo = []
> ori_drivers = []
> -
> +
> + if self.nic.startswith("fortville"):
> + return
> +
> for portid in range(len(self.ports)):
> self.dut.send_expect("regs %d regs_%d.bin" % (portid, portid),
> "EthApp>")
> portinfo = {'portid': portid, 'reg_file': 'regs_%d.bin' %
> portid}
> @@ -300,8 +303,8 @@ class TestUserspaceEthtool(TestCase,
> IxiaPacketGenerator):
> """
> Test ethtool app ring parameter getting and setting
> """
> - self.dut.send_expect(self.cmd, "EthApp>", 60)
> for index in range(len(self.ports)):
> + self.dut.send_expect(self.cmd, "EthApp>", 60)
> port = self.ports[index]
> ori_rx_pkts, ori_tx_pkts = self.strip_portstats(port)
> _, rx_max, _, tx_max = self.strip_ringparam(index)
> @@ -315,8 +318,7 @@ class TestUserspaceEthtool(TestCase,
> IxiaPacketGenerator):
> pkt.send_pkt(tx_port=intf)
> rx_pkts, tx_pkts = self.strip_portstats(index)
> self.verify(rx_pkts == ori_rx_pkts + 1, "Failed to forward
> after ring parameter changed")
> -
> - self.dut.send_expect("quit", "# ")
> + self.dut.send_expect("quit", "# ")
>
> def test_ethtool_vlan(self):
> """
> --
> 1.9.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dts] [PATCH V2]Ethtool: update automation testing script
2016-07-27 6:41 Yufen Mo
@ 2016-07-27 6:41 ` Yufen Mo
2016-07-27 9:30 ` Liu, Yong
0 siblings, 1 reply; 6+ messages in thread
From: Yufen Mo @ 2016-07-27 6:41 UTC (permalink / raw)
To: dts; +Cc: yufengmx
From: yufengmx <yufengx.mo@intel.com>
*. close eeprom test case on FVL for FVL series firmware not supported
*. reset ring parameter after ring parameter is used
*. set testing content the same user space ethtool dumped
Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
tests/TestSuite_userspace_ethtool.py | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/tests/TestSuite_userspace_ethtool.py b/tests/TestSuite_userspace_ethtool.py
index c718a58..26044a3 100644
--- a/tests/TestSuite_userspace_ethtool.py
+++ b/tests/TestSuite_userspace_ethtool.py
@@ -128,8 +128,8 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
return 1518
def resize_linux_eeprom_file(self, dpdk_eeprom_file, linux_eeprom_file):
- basePath = self.dut.base_dir
- with open( basePath + dpdk_eeprom_file, 'rb') as fpDpdk:
+ basePath = os.sep + "root" + self.dut.base_dir[1:] + os.sep
+ with open( basePath + os.sep + dpdk_eeprom_file, 'rb') as fpDpdk:
dpdk_bytes = fpDpdk.read()
dpdk_length = len(dpdk_bytes)
@@ -220,7 +220,10 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
portsinfo = []
ori_drivers = []
-
+
+ if self.nic.startswith("fortville"):
+ return
+
for portid in range(len(self.ports)):
self.dut.send_expect("regs %d regs_%d.bin" % (portid, portid), "EthApp>")
portinfo = {'portid': portid, 'reg_file': 'regs_%d.bin' % portid}
@@ -300,8 +303,8 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
"""
Test ethtool app ring parameter getting and setting
"""
- self.dut.send_expect(self.cmd, "EthApp>", 60)
for index in range(len(self.ports)):
+ self.dut.send_expect(self.cmd, "EthApp>", 60)
port = self.ports[index]
ori_rx_pkts, ori_tx_pkts = self.strip_portstats(port)
_, rx_max, _, tx_max = self.strip_ringparam(index)
@@ -315,8 +318,7 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
pkt.send_pkt(tx_port=intf)
rx_pkts, tx_pkts = self.strip_portstats(index)
self.verify(rx_pkts == ori_rx_pkts + 1, "Failed to forward after ring parameter changed")
-
- self.dut.send_expect("quit", "# ")
+ self.dut.send_expect("quit", "# ")
def test_ethtool_vlan(self):
"""
--
1.9.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dts] [PATCH V2]Ethtool: update automation testing script
@ 2016-07-27 6:41 Yufen Mo
2016-07-27 6:41 ` Yufen Mo
0 siblings, 1 reply; 6+ messages in thread
From: Yufen Mo @ 2016-07-27 6:41 UTC (permalink / raw)
To: dts; +Cc: yufengmx
From: yufengmx <yufengx.mo@intel.com>
yufengmx (1):
Ethtool: update automation testing script
tests/TestSuite_userspace_ethtool.py | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-07-27 9:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-27 3:57 [dts] [PATCH V2]Ethtool: update automation testing script Yufen Mo
2016-07-27 3:57 ` Yufen Mo
2016-07-27 4:27 ` Liu, Yong
2016-07-27 6:41 Yufen Mo
2016-07-27 6:41 ` Yufen Mo
2016-07-27 9:30 ` Liu, Yong
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).