* [dts] [PATCH] tests/ip_pipeline: fix test failures
@ 2017-08-21 10:30 Jianbo Liu
2017-09-04 6:31 ` Jianbo Liu
` (3 more replies)
0 siblings, 4 replies; 12+ messages in thread
From: Jianbo Liu @ 2017-08-21 10:30 UTC (permalink / raw)
To: dts, herbert.guan; +Cc: Jianbo Liu
The ip_pipeline was changed a lot, and the configuration and commands
are different from those in this testing case.
Signed-off-by: Jianbo Liu <jianbo.liu@linaro.org>
---
tests/TestSuite_ip_pipeline.py | 157 +++++++++++++++++++++++------------------
1 file changed, 90 insertions(+), 67 deletions(-)
diff --git a/tests/TestSuite_ip_pipeline.py b/tests/TestSuite_ip_pipeline.py
index 90dba31..300b1de 100644
--- a/tests/TestSuite_ip_pipeline.py
+++ b/tests/TestSuite_ip_pipeline.py
@@ -124,11 +124,47 @@ class TestIPPipeline(TestCase):
writer.close()
+ def create_passthrough_cfgfile(self):
+ self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo type = MASTER >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo type = PASS-THROUGH >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo pktq_out = TXQ1.0 TXQ0.0 >> /tmp/ip_pipeline.cfg', '#')
+
+ def create_routing_cfgfile(self):
+ self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo type = MASTER >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo type = ROUTING >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo encap = ethernet >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo ip_hdr_offset = 270 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo arp_key_offset = 128 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo n_arp_entries = 1000 >> /tmp/ip_pipeline.cfg', '#')
+
+ def create_flow_cfgfile(self):
+ self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo type = MASTER >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo type = FLOW_CLASSIFICATION >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 SINK0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo n_flows = 65536 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo key_size = 16 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo key_offset = 278 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo key_mask = 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo flowid_offset = 128 >> /tmp/ip_pipeline.cfg', '#')
+
def start_ip_pipeline(self, ports):
- command_line = "./examples/ip_pipeline/build/ip_pipeline -c %s -n %d -- -p %s" % \
- (self.coremask,
- self.dut.get_memory_channels(),
- ports)
+ command_line = "./examples/ip_pipeline/build/ip_pipeline -p %s -f /tmp/ip_pipeline.cfg" % ports
out = self.dut.send_expect(command_line, 'pipeline>', 60)
sleep(5) # 'Initialization completed' is not the last output, some
@@ -150,10 +186,10 @@ class TestIPPipeline(TestCase):
"""
for iface in ifaces:
+ command = ('rm -f tcpdump_{0}.pcap').format(iface)
+ self.tester.send_expect(command, '#')
command = (
'tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out &').format(iface)
- self.tester.send_expect(
- 'rm -f tcpdump_{0}.pcap', '#').format(iface)
self.tester.send_expect(command, '#')
def tcpdump_stop_sniff(self):
@@ -200,15 +236,13 @@ class TestIPPipeline(TestCase):
tx_port = self.tester.get_local_port(self.dut_ports[from_port])
rx_port = self.tester.get_local_port(self.dut_ports[to_port])
+ port0 = self.tester.get_local_port(self.dut_ports[0])
tx_interface = self.tester.get_interface(tx_port)
rx_interface = self.tester.get_interface(rx_port)
self.tcpdump_start_sniffing([tx_interface, rx_interface])
- self.dut.send_expect('link 0 up', 'pipeline>')
- self.dut.send_expect('link 1 up', 'pipeline>')
-
timeout = frames_number * inter + 2
inter = ", inter=%d" % inter
@@ -225,64 +259,58 @@ class TestIPPipeline(TestCase):
self.tcpdump_stop_sniff()
- self.dut.send_expect('link 0 down', 'pipeline>')
- self.dut.send_expect('link 1 down', 'pipeline>')
-
rx_stats = self.number_of_packets('tcpdump_%s.pcap' % rx_interface)
tx_stats = self.number_of_packets('tcpdump_%s.pcap' % tx_interface)
# Do not count the sent frames in the tx_interface
tx_stats = tx_stats - frames_number
- return {'rx': rx_stats, 'tx': tx_stats}
+ if port0 == tx_port:
+ return {'rx0': tx_stats, 'rx1': rx_stats}
+ else:
+ return {'rx0': rx_stats, 'rx1': tx_stats}
def check_results(self, stats, expected):
"""
- This function check that the Rx and Tx stats matches the expected.
- expected = [Rx, Tx]
+ This function check that the received packet numbers of port0 and port1 match the expected.
+ expected = [Rx0, Rx1]
"""
- for port in ['rx', 'tx']:
+ for port in ['rx0', 'rx1']:
self.verify(stats[port] == expected[port],
'Frames expected (%s) and received (%s) mismatch on %s port' % (
expected[port], stats[port], port))
def pipeline_command(self, command):
out = self.dut.send_expect(command, 'pipeline>')
- self.verify("Illegal" not in out, "Pipeline command error 1: '%s'" % command)
- self.verify("Bad" not in out, "Pipeline command error 2: '%s'" % command)
+ self.verify("arguments" not in out, "Incorrect arguments: '%s'" % command)
+ self.verify("Invalid" not in out, "Invalid argument: '%s'" % command)
+ self.verify("Syntax error" not in out, "Syntax error: '%s'" % command)
return out
- def pipeline_add_flow(self, port, src_ip, dst_ip, src_port, dst_port,
+ def pipeline_add_flow(self, port, src_ip, dst_ip, src_port, dst_port, flowid,
protocol=6):
- command = 'flow add %s %s %d %d %d %d' % (src_ip, dst_ip, src_port,
- dst_port, protocol, port)
+ command = 'p 1 flow add ipv4 %s %s %d %d %d port %d id %d' % (src_ip, dst_ip, src_port,
+ dst_port, protocol, port, flowid)
out = self.pipeline_command(command)
- self.verify("Adding flow" in out, "Add flow error")
+ self.verify("failed" not in out, "Add flow error")
def pipeline_del_flow(self, src_ip, dst_ip, src_port, dst_port,
protocol=6):
- command = 'flow del %s %s %d %d %d' % (src_ip, dst_ip, src_port,
+ command = 'p 1 flow del ipv4 %s %s %d %d %d' % (src_ip, dst_ip, src_port,
dst_port, protocol)
out = self.pipeline_command(command)
- self.verify("Deleting flow" in out, "Del flow error")
+ self.verify("failed" not in out, "Del flow error")
def pipeline_add_route(self, port, src_ip, netmask, gw_ip):
- command = 'route add %s %d %d %s' % (src_ip, netmask, port, gw_ip)
+ command = 'p 1 route add %s %d port %d ether %s' % (src_ip, netmask, port, gw_ip)
out = self.pipeline_command(command)
- self.verify("Adding route" in out, "Add route error")
+ self.verify("failed" not in out, "Add route error")
def pipeline_del_route(self, src_ip, netmask):
- command = 'route del %s %d' % (src_ip, netmask)
+ command = 'p 1 route del %s %d' % (src_ip, netmask)
out = self.pipeline_command(command)
- self.verify("Deleting route" in out, "Del route error")
-
- def pipeline_traffic_burst(self):
- self.dut.send_expect('link 0 up', 'pipeline>')
- self.dut.send_expect('link 1 up', 'pipeline>')
- sleep(0.1)
- self.dut.send_expect('link 0 down', 'pipeline>')
- self.dut.send_expect('link 1 down', 'pipeline>')
+ self.verify("failed" not in out, "Del route error")
def set_up_all(self):
"""
@@ -291,14 +319,8 @@ class TestIPPipeline(TestCase):
PMD prerequisites.
"""
- # Check for port availability
- self.needed_ports = {"niantic": 2,
- "I217V": 1,
- "I217LM": 1,
- "I218V": 1,
- "I218LM": 1}
self.dut_ports = self.dut.get_ports()
- self.verify(len(self.dut_ports) >= self.needed_ports[self.nic],
+ self.verify(len(self.dut_ports) >= 2,
"Insufficient ports for speed testing")
out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
@@ -324,9 +346,10 @@ class TestIPPipeline(TestCase):
pcap_file = 'ip_pipeline.pcap'
frame_size = 64
+ self.create_passthrough_cfgfile()
self.start_ip_pipeline(ports=self.ports_mask)
self.dut.send_expect(
- 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)
+ 'run examples/ip_pipeline/config/ip_pipeline.sh', 'pipeline>', 10)
# Create a PCAP file containing the maximum frames_number of frames needed
# with fixed size and incremental IP
@@ -342,13 +365,13 @@ class TestIPPipeline(TestCase):
stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
1, 0, inter)
- expected = {'tx': 0, 'rx': frames_number}
+ expected = {'rx0': frames_number, 'rx1': 0}
self.check_results(stats, expected)
stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
0, 1, inter)
- expected = {'tx': frames_number, 'rx': 0}
+ expected = {'rx0': 0, 'rx1': frames_number}
self.check_results(stats, expected)
def test_frame_sizes(self):
@@ -359,9 +382,10 @@ class TestIPPipeline(TestCase):
frames_number = 100
inter = 0.5
+ self.create_passthrough_cfgfile()
self.start_ip_pipeline(ports=self.ports_mask)
self.dut.send_expect(
- 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)
+ 'run examples/ip_pipeline/config/ip_pipeline.sh', 'pipeline>', 10)
for frame_size in TestIPPipeline.frame_sizes:
@@ -376,13 +400,13 @@ class TestIPPipeline(TestCase):
stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
1, 0, inter)
- expected = {'tx': 0, 'rx': frames_number}
+ expected = {'rx0': frames_number, 'rx1': 0}
self.check_results(stats, expected)
stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
0, 1, inter)
- expected = {'tx': frames_number, 'rx': 0}
+ expected = {'rx0': 0, 'rx1': frames_number}
self.check_results(stats, expected)
def test_flow_management(self):
@@ -392,11 +416,6 @@ class TestIPPipeline(TestCase):
pcap_file = 'ip_pipeline.pcap'
frame_size = 64
- default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
- 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
- 'route add 0.0.0.0 9 0 0.0.0.1',
- 'route add 0.128.0.0 9 1 0.128.0.1']
-
ip_addrs = [
'0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',
'0.0.1.0', '0.0.127.0', '0.0.128.0', '0.0.129.0', '0.0.255.0',
@@ -409,30 +428,32 @@ class TestIPPipeline(TestCase):
frames.append(self.create_tcp_ipv4_frame(0, '0.0.0.0', addr,
frame_size))
+ self.create_flow_cfgfile()
self.create_pcap_file_from_frames(pcap_file, frames)
self.tester.session.copy_file_to(pcap_file)
# Start ip_pipeline app and setup defaults
self.start_ip_pipeline(ports=self.ports_mask)
- for command in default_setup:
- self.pipeline_command(command)
+
+ # default to SINK0
+ self.pipeline_command('p 1 flow add default 3')
# Check that no traffic pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': 0}
+ expected = {'rx0': 0, 'rx1': 0}
self.check_results(stats, expected)
# Add the flows
flows_added = 0
for addrs in ip_addrs:
- self.pipeline_add_flow(1, '0.0.0.0', addrs, 0, 0)
+ self.pipeline_add_flow(0, '0.0.0.0', addrs, 0, 0, flows_added)
flows_added += 1
# Check that traffic matching flows pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': flows_added}
+ expected = {'rx0': flows_added, 'rx1': 0}
self.check_results(stats, expected)
# Remove flows
@@ -443,7 +464,7 @@ class TestIPPipeline(TestCase):
# Check that traffic matching flows pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': flows_added}
+ expected = {'rx0': flows_added, 'rx1': 0}
self.check_results(stats, expected)
out = self.dut.send_expect('flow print', 'pipeline>')
@@ -452,7 +473,7 @@ class TestIPPipeline(TestCase):
# Check that again no traffic pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': 0}
+ expected = {'rx0': 0, 'rx1': 0}
self.check_results(stats, expected)
self.quit_ip_pipeline()
@@ -464,9 +485,8 @@ class TestIPPipeline(TestCase):
pcap_file = 'ip_pipeline.pcap'
frame_size = 64
- default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
- 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
- 'flow add all']
+ default_setup = ['p 1 arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
+ 'p 1 arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f']
ip_addrs = [
'0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',
@@ -483,6 +503,7 @@ class TestIPPipeline(TestCase):
self.create_pcap_file_from_frames(pcap_file, frames)
self.tester.session.copy_file_to(pcap_file)
+ self.create_routing_cfgfile()
# Start ip_pipeline app and setup defaults
self.start_ip_pipeline(ports=self.ports_mask)
for command in default_setup:
@@ -491,7 +512,7 @@ class TestIPPipeline(TestCase):
# Check that no traffic pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': 0}
+ expected = {'rx0': 0, 'rx1': 0}
self.check_results(stats, expected)
# Add the routes
@@ -504,7 +525,7 @@ class TestIPPipeline(TestCase):
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': routes_added}
+ expected = {'rx0': routes_added, 'rx1': 0}
self.check_results(stats, expected)
# Remove routes
@@ -515,7 +536,7 @@ class TestIPPipeline(TestCase):
# Check that traffic matching flows pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': routes_added}
+ expected = {'rx0': routes_added, 'rx1': 0}
self.check_results(stats, expected)
out = self.dut.send_expect('route print', 'pipeline>')
@@ -524,7 +545,7 @@ class TestIPPipeline(TestCase):
# Check that again no traffic pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': 0}
+ expected = {'rx0': 0, 'rx1': 0}
self.check_results(stats, expected)
self.quit_ip_pipeline()
@@ -539,5 +560,7 @@ class TestIPPipeline(TestCase):
"""
Run after each test suite.
"""
+ self.dut.send_expect("rm /tmp/ip_pipeline.cfg", "#")
+ self.dut.send_expect("rm /tmp/ip_pipeline.cfg.out", "#")
out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
self.verify("Error" not in out, "Compilation error")
--
1.9.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dts] [PATCH] tests/ip_pipeline: fix test failures
2017-08-21 10:30 [dts] [PATCH] tests/ip_pipeline: fix test failures Jianbo Liu
@ 2017-09-04 6:31 ` Jianbo Liu
2017-09-04 8:50 ` Liu, Yong
2017-09-04 9:39 ` Radosław Biernacki
` (2 subsequent siblings)
3 siblings, 1 reply; 12+ messages in thread
From: Jianbo Liu @ 2017-09-04 6:31 UTC (permalink / raw)
To: dts, Herbert Guan; +Cc: Xu, Qian Q, cc: Liu, Yong
Hi Yong and Qian,
Have you reviewed this patch, any comments?
Thanks!
Jianbo
On 21 August 2017 at 18:30, Jianbo Liu <jianbo.liu@linaro.org> wrote:
> The ip_pipeline was changed a lot, and the configuration and commands
> are different from those in this testing case.
>
> Signed-off-by: Jianbo Liu <jianbo.liu@linaro.org>
> ---
> tests/TestSuite_ip_pipeline.py | 157 +++++++++++++++++++++++------------------
> 1 file changed, 90 insertions(+), 67 deletions(-)
>
> diff --git a/tests/TestSuite_ip_pipeline.py b/tests/TestSuite_ip_pipeline.py
> index 90dba31..300b1de 100644
> --- a/tests/TestSuite_ip_pipeline.py
> +++ b/tests/TestSuite_ip_pipeline.py
> @@ -124,11 +124,47 @@ class TestIPPipeline(TestCase):
>
> writer.close()
>
> + def create_passthrough_cfgfile(self):
> + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo type = MASTER >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo type = PASS-THROUGH >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo pktq_out = TXQ1.0 TXQ0.0 >> /tmp/ip_pipeline.cfg', '#')
> +
> + def create_routing_cfgfile(self):
> + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo type = MASTER >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo type = ROUTING >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo encap = ethernet >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo ip_hdr_offset = 270 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo arp_key_offset = 128 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo n_arp_entries = 1000 >> /tmp/ip_pipeline.cfg', '#')
> +
> + def create_flow_cfgfile(self):
> + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo type = MASTER >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo type = FLOW_CLASSIFICATION >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 SINK0 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo n_flows = 65536 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo key_size = 16 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo key_offset = 278 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo key_mask = 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo flowid_offset = 128 >> /tmp/ip_pipeline.cfg', '#')
> +
> def start_ip_pipeline(self, ports):
> - command_line = "./examples/ip_pipeline/build/ip_pipeline -c %s -n %d -- -p %s" % \
> - (self.coremask,
> - self.dut.get_memory_channels(),
> - ports)
> + command_line = "./examples/ip_pipeline/build/ip_pipeline -p %s -f /tmp/ip_pipeline.cfg" % ports
>
> out = self.dut.send_expect(command_line, 'pipeline>', 60)
> sleep(5) # 'Initialization completed' is not the last output, some
> @@ -150,10 +186,10 @@ class TestIPPipeline(TestCase):
> """
>
> for iface in ifaces:
> + command = ('rm -f tcpdump_{0}.pcap').format(iface)
> + self.tester.send_expect(command, '#')
> command = (
> 'tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out &').format(iface)
> - self.tester.send_expect(
> - 'rm -f tcpdump_{0}.pcap', '#').format(iface)
> self.tester.send_expect(command, '#')
>
> def tcpdump_stop_sniff(self):
> @@ -200,15 +236,13 @@ class TestIPPipeline(TestCase):
>
> tx_port = self.tester.get_local_port(self.dut_ports[from_port])
> rx_port = self.tester.get_local_port(self.dut_ports[to_port])
> + port0 = self.tester.get_local_port(self.dut_ports[0])
>
> tx_interface = self.tester.get_interface(tx_port)
> rx_interface = self.tester.get_interface(rx_port)
>
> self.tcpdump_start_sniffing([tx_interface, rx_interface])
>
> - self.dut.send_expect('link 0 up', 'pipeline>')
> - self.dut.send_expect('link 1 up', 'pipeline>')
> -
> timeout = frames_number * inter + 2
> inter = ", inter=%d" % inter
>
> @@ -225,64 +259,58 @@ class TestIPPipeline(TestCase):
>
> self.tcpdump_stop_sniff()
>
> - self.dut.send_expect('link 0 down', 'pipeline>')
> - self.dut.send_expect('link 1 down', 'pipeline>')
> -
> rx_stats = self.number_of_packets('tcpdump_%s.pcap' % rx_interface)
> tx_stats = self.number_of_packets('tcpdump_%s.pcap' % tx_interface)
>
> # Do not count the sent frames in the tx_interface
> tx_stats = tx_stats - frames_number
>
> - return {'rx': rx_stats, 'tx': tx_stats}
> + if port0 == tx_port:
> + return {'rx0': tx_stats, 'rx1': rx_stats}
> + else:
> + return {'rx0': rx_stats, 'rx1': tx_stats}
>
> def check_results(self, stats, expected):
> """
> - This function check that the Rx and Tx stats matches the expected.
> - expected = [Rx, Tx]
> + This function check that the received packet numbers of port0 and port1 match the expected.
> + expected = [Rx0, Rx1]
> """
>
> - for port in ['rx', 'tx']:
> + for port in ['rx0', 'rx1']:
> self.verify(stats[port] == expected[port],
> 'Frames expected (%s) and received (%s) mismatch on %s port' % (
> expected[port], stats[port], port))
>
> def pipeline_command(self, command):
> out = self.dut.send_expect(command, 'pipeline>')
> - self.verify("Illegal" not in out, "Pipeline command error 1: '%s'" % command)
> - self.verify("Bad" not in out, "Pipeline command error 2: '%s'" % command)
> + self.verify("arguments" not in out, "Incorrect arguments: '%s'" % command)
> + self.verify("Invalid" not in out, "Invalid argument: '%s'" % command)
> + self.verify("Syntax error" not in out, "Syntax error: '%s'" % command)
> return out
>
> - def pipeline_add_flow(self, port, src_ip, dst_ip, src_port, dst_port,
> + def pipeline_add_flow(self, port, src_ip, dst_ip, src_port, dst_port, flowid,
> protocol=6):
> - command = 'flow add %s %s %d %d %d %d' % (src_ip, dst_ip, src_port,
> - dst_port, protocol, port)
> + command = 'p 1 flow add ipv4 %s %s %d %d %d port %d id %d' % (src_ip, dst_ip, src_port,
> + dst_port, protocol, port, flowid)
> out = self.pipeline_command(command)
> - self.verify("Adding flow" in out, "Add flow error")
> + self.verify("failed" not in out, "Add flow error")
>
> def pipeline_del_flow(self, src_ip, dst_ip, src_port, dst_port,
> protocol=6):
> - command = 'flow del %s %s %d %d %d' % (src_ip, dst_ip, src_port,
> + command = 'p 1 flow del ipv4 %s %s %d %d %d' % (src_ip, dst_ip, src_port,
> dst_port, protocol)
> out = self.pipeline_command(command)
> - self.verify("Deleting flow" in out, "Del flow error")
> + self.verify("failed" not in out, "Del flow error")
>
> def pipeline_add_route(self, port, src_ip, netmask, gw_ip):
> - command = 'route add %s %d %d %s' % (src_ip, netmask, port, gw_ip)
> + command = 'p 1 route add %s %d port %d ether %s' % (src_ip, netmask, port, gw_ip)
> out = self.pipeline_command(command)
> - self.verify("Adding route" in out, "Add route error")
> + self.verify("failed" not in out, "Add route error")
>
> def pipeline_del_route(self, src_ip, netmask):
> - command = 'route del %s %d' % (src_ip, netmask)
> + command = 'p 1 route del %s %d' % (src_ip, netmask)
> out = self.pipeline_command(command)
> - self.verify("Deleting route" in out, "Del route error")
> -
> - def pipeline_traffic_burst(self):
> - self.dut.send_expect('link 0 up', 'pipeline>')
> - self.dut.send_expect('link 1 up', 'pipeline>')
> - sleep(0.1)
> - self.dut.send_expect('link 0 down', 'pipeline>')
> - self.dut.send_expect('link 1 down', 'pipeline>')
> + self.verify("failed" not in out, "Del route error")
>
> def set_up_all(self):
> """
> @@ -291,14 +319,8 @@ class TestIPPipeline(TestCase):
> PMD prerequisites.
> """
>
> - # Check for port availability
> - self.needed_ports = {"niantic": 2,
> - "I217V": 1,
> - "I217LM": 1,
> - "I218V": 1,
> - "I218LM": 1}
> self.dut_ports = self.dut.get_ports()
> - self.verify(len(self.dut_ports) >= self.needed_ports[self.nic],
> + self.verify(len(self.dut_ports) >= 2,
> "Insufficient ports for speed testing")
>
> out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
> @@ -324,9 +346,10 @@ class TestIPPipeline(TestCase):
> pcap_file = 'ip_pipeline.pcap'
> frame_size = 64
>
> + self.create_passthrough_cfgfile()
> self.start_ip_pipeline(ports=self.ports_mask)
> self.dut.send_expect(
> - 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)
> + 'run examples/ip_pipeline/config/ip_pipeline.sh', 'pipeline>', 10)
>
> # Create a PCAP file containing the maximum frames_number of frames needed
> # with fixed size and incremental IP
> @@ -342,13 +365,13 @@ class TestIPPipeline(TestCase):
> stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
> 1, 0, inter)
>
> - expected = {'tx': 0, 'rx': frames_number}
> + expected = {'rx0': frames_number, 'rx1': 0}
> self.check_results(stats, expected)
>
> stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
> 0, 1, inter)
>
> - expected = {'tx': frames_number, 'rx': 0}
> + expected = {'rx0': 0, 'rx1': frames_number}
> self.check_results(stats, expected)
>
> def test_frame_sizes(self):
> @@ -359,9 +382,10 @@ class TestIPPipeline(TestCase):
> frames_number = 100
> inter = 0.5
>
> + self.create_passthrough_cfgfile()
> self.start_ip_pipeline(ports=self.ports_mask)
> self.dut.send_expect(
> - 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)
> + 'run examples/ip_pipeline/config/ip_pipeline.sh', 'pipeline>', 10)
>
> for frame_size in TestIPPipeline.frame_sizes:
>
> @@ -376,13 +400,13 @@ class TestIPPipeline(TestCase):
> stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
> 1, 0, inter)
>
> - expected = {'tx': 0, 'rx': frames_number}
> + expected = {'rx0': frames_number, 'rx1': 0}
> self.check_results(stats, expected)
>
> stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
> 0, 1, inter)
>
> - expected = {'tx': frames_number, 'rx': 0}
> + expected = {'rx0': 0, 'rx1': frames_number}
> self.check_results(stats, expected)
>
> def test_flow_management(self):
> @@ -392,11 +416,6 @@ class TestIPPipeline(TestCase):
> pcap_file = 'ip_pipeline.pcap'
> frame_size = 64
>
> - default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
> - 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
> - 'route add 0.0.0.0 9 0 0.0.0.1',
> - 'route add 0.128.0.0 9 1 0.128.0.1']
> -
> ip_addrs = [
> '0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',
> '0.0.1.0', '0.0.127.0', '0.0.128.0', '0.0.129.0', '0.0.255.0',
> @@ -409,30 +428,32 @@ class TestIPPipeline(TestCase):
> frames.append(self.create_tcp_ipv4_frame(0, '0.0.0.0', addr,
> frame_size))
>
> + self.create_flow_cfgfile()
> self.create_pcap_file_from_frames(pcap_file, frames)
> self.tester.session.copy_file_to(pcap_file)
>
> # Start ip_pipeline app and setup defaults
> self.start_ip_pipeline(ports=self.ports_mask)
> - for command in default_setup:
> - self.pipeline_command(command)
> +
> + # default to SINK0
> + self.pipeline_command('p 1 flow add default 3')
>
> # Check that no traffic pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': 0}
> + expected = {'rx0': 0, 'rx1': 0}
> self.check_results(stats, expected)
>
> # Add the flows
> flows_added = 0
> for addrs in ip_addrs:
> - self.pipeline_add_flow(1, '0.0.0.0', addrs, 0, 0)
> + self.pipeline_add_flow(0, '0.0.0.0', addrs, 0, 0, flows_added)
> flows_added += 1
>
> # Check that traffic matching flows pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': flows_added}
> + expected = {'rx0': flows_added, 'rx1': 0}
> self.check_results(stats, expected)
>
> # Remove flows
> @@ -443,7 +464,7 @@ class TestIPPipeline(TestCase):
> # Check that traffic matching flows pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': flows_added}
> + expected = {'rx0': flows_added, 'rx1': 0}
> self.check_results(stats, expected)
>
> out = self.dut.send_expect('flow print', 'pipeline>')
> @@ -452,7 +473,7 @@ class TestIPPipeline(TestCase):
> # Check that again no traffic pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': 0}
> + expected = {'rx0': 0, 'rx1': 0}
> self.check_results(stats, expected)
>
> self.quit_ip_pipeline()
> @@ -464,9 +485,8 @@ class TestIPPipeline(TestCase):
> pcap_file = 'ip_pipeline.pcap'
> frame_size = 64
>
> - default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
> - 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
> - 'flow add all']
> + default_setup = ['p 1 arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
> + 'p 1 arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f']
>
> ip_addrs = [
> '0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',
> @@ -483,6 +503,7 @@ class TestIPPipeline(TestCase):
> self.create_pcap_file_from_frames(pcap_file, frames)
> self.tester.session.copy_file_to(pcap_file)
>
> + self.create_routing_cfgfile()
> # Start ip_pipeline app and setup defaults
> self.start_ip_pipeline(ports=self.ports_mask)
> for command in default_setup:
> @@ -491,7 +512,7 @@ class TestIPPipeline(TestCase):
> # Check that no traffic pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': 0}
> + expected = {'rx0': 0, 'rx1': 0}
> self.check_results(stats, expected)
>
> # Add the routes
> @@ -504,7 +525,7 @@ class TestIPPipeline(TestCase):
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
>
> - expected = {'tx': 0, 'rx': routes_added}
> + expected = {'rx0': routes_added, 'rx1': 0}
> self.check_results(stats, expected)
>
> # Remove routes
> @@ -515,7 +536,7 @@ class TestIPPipeline(TestCase):
> # Check that traffic matching flows pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': routes_added}
> + expected = {'rx0': routes_added, 'rx1': 0}
> self.check_results(stats, expected)
>
> out = self.dut.send_expect('route print', 'pipeline>')
> @@ -524,7 +545,7 @@ class TestIPPipeline(TestCase):
> # Check that again no traffic pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': 0}
> + expected = {'rx0': 0, 'rx1': 0}
> self.check_results(stats, expected)
>
> self.quit_ip_pipeline()
> @@ -539,5 +560,7 @@ class TestIPPipeline(TestCase):
> """
> Run after each test suite.
> """
> + self.dut.send_expect("rm /tmp/ip_pipeline.cfg", "#")
> + self.dut.send_expect("rm /tmp/ip_pipeline.cfg.out", "#")
> out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
> self.verify("Error" not in out, "Compilation error")
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dts] [PATCH] tests/ip_pipeline: fix test failures
2017-09-04 6:31 ` Jianbo Liu
@ 2017-09-04 8:50 ` Liu, Yong
2017-09-04 9:33 ` Jianbo Liu
0 siblings, 1 reply; 12+ messages in thread
From: Liu, Yong @ 2017-09-04 8:50 UTC (permalink / raw)
To: Jianbo Liu, dts, Herbert Guan; +Cc: Xu, Qian Q
Hi Jianbo,
I met one issue when trying to validate your patch. Sorry for late response, we're working on remaining issues in test suites these weeks.
04/09/2017 23:38:39 SUITE_DUT_CMD: [10.67.119.120] p 1 flow add default 3
04/09/2017 23:38:39 SUITE_DUT_OUTPUT: [10.67.119.120] p 1 flow add default 3^M^M
Command "flow add default" failed
Thanks,
Marvin
> -----Original Message-----
> From: Jianbo Liu [mailto:jianbo.liu@linaro.org]
> Sent: Monday, September 04, 2017 2:32 PM
> To: dts@dpdk.org; Herbert Guan <herbert.guan@arm.com>
> Cc: Xu, Qian Q <qian.q.xu@intel.com>; Liu, Yong <yong.liu@intel.com>
> Subject: Re: [PATCH] tests/ip_pipeline: fix test failures
>
> Hi Yong and Qian,
>
> Have you reviewed this patch, any comments?
>
> Thanks!
> Jianbo
>
>
> On 21 August 2017 at 18:30, Jianbo Liu <jianbo.liu@linaro.org> wrote:
> > The ip_pipeline was changed a lot, and the configuration and commands
> > are different from those in this testing case.
> >
> > Signed-off-by: Jianbo Liu <jianbo.liu@linaro.org>
> > ---
> > tests/TestSuite_ip_pipeline.py | 157 +++++++++++++++++++++++-----------
> -------
> > 1 file changed, 90 insertions(+), 67 deletions(-)
> >
> > diff --git a/tests/TestSuite_ip_pipeline.py
> b/tests/TestSuite_ip_pipeline.py
> > index 90dba31..300b1de 100644
> > --- a/tests/TestSuite_ip_pipeline.py
> > +++ b/tests/TestSuite_ip_pipeline.py
> > @@ -124,11 +124,47 @@ class TestIPPipeline(TestCase):
> >
> > writer.close()
> >
> > + def create_passthrough_cfgfile(self):
> > + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo type = MASTER >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo type = PASS-THROUGH >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo pktq_out = TXQ1.0 TXQ0.0 >>
> /tmp/ip_pipeline.cfg', '#')
> > +
> > + def create_routing_cfgfile(self):
> > + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo type = MASTER >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo type = ROUTING >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo encap = ethernet >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo ip_hdr_offset = 270 >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo arp_key_offset = 128 >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo n_arp_entries = 1000 >>
> /tmp/ip_pipeline.cfg', '#')
> > +
> > + def create_flow_cfgfile(self):
> > + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo type = MASTER >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo type = FLOW_CLASSIFICATION >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 SINK0 >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo n_flows = 65536 >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo key_size = 16 >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo key_offset = 278 >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo key_mask =
> 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF >> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo flowid_offset = 128 >>
> /tmp/ip_pipeline.cfg', '#')
> > +
> > def start_ip_pipeline(self, ports):
> > - command_line = "./examples/ip_pipeline/build/ip_pipeline -c %s
> -n %d -- -p %s" % \
> > - (self.coremask,
> > - self.dut.get_memory_channels(),
> > - ports)
> > + command_line = "./examples/ip_pipeline/build/ip_pipeline -p %s
> -f /tmp/ip_pipeline.cfg" % ports
> >
> > out = self.dut.send_expect(command_line, 'pipeline>', 60)
> > sleep(5) # 'Initialization completed' is not the last output,
> some
> > @@ -150,10 +186,10 @@ class TestIPPipeline(TestCase):
> > """
> >
> > for iface in ifaces:
> > + command = ('rm -f tcpdump_{0}.pcap').format(iface)
> > + self.tester.send_expect(command, '#')
> > command = (
> > 'tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out
> &').format(iface)
> > - self.tester.send_expect(
> > - 'rm -f tcpdump_{0}.pcap', '#').format(iface)
> > self.tester.send_expect(command, '#')
> >
> > def tcpdump_stop_sniff(self):
> > @@ -200,15 +236,13 @@ class TestIPPipeline(TestCase):
> >
> > tx_port = self.tester.get_local_port(self.dut_ports[from_port])
> > rx_port = self.tester.get_local_port(self.dut_ports[to_port])
> > + port0 = self.tester.get_local_port(self.dut_ports[0])
> >
> > tx_interface = self.tester.get_interface(tx_port)
> > rx_interface = self.tester.get_interface(rx_port)
> >
> > self.tcpdump_start_sniffing([tx_interface, rx_interface])
> >
> > - self.dut.send_expect('link 0 up', 'pipeline>')
> > - self.dut.send_expect('link 1 up', 'pipeline>')
> > -
> > timeout = frames_number * inter + 2
> > inter = ", inter=%d" % inter
> >
> > @@ -225,64 +259,58 @@ class TestIPPipeline(TestCase):
> >
> > self.tcpdump_stop_sniff()
> >
> > - self.dut.send_expect('link 0 down', 'pipeline>')
> > - self.dut.send_expect('link 1 down', 'pipeline>')
> > -
> > rx_stats = self.number_of_packets('tcpdump_%s.pcap' %
> rx_interface)
> > tx_stats = self.number_of_packets('tcpdump_%s.pcap' %
> tx_interface)
> >
> > # Do not count the sent frames in the tx_interface
> > tx_stats = tx_stats - frames_number
> >
> > - return {'rx': rx_stats, 'tx': tx_stats}
> > + if port0 == tx_port:
> > + return {'rx0': tx_stats, 'rx1': rx_stats}
> > + else:
> > + return {'rx0': rx_stats, 'rx1': tx_stats}
> >
> > def check_results(self, stats, expected):
> > """
> > - This function check that the Rx and Tx stats matches the
> expected.
> > - expected = [Rx, Tx]
> > + This function check that the received packet numbers of port0
> and port1 match the expected.
> > + expected = [Rx0, Rx1]
> > """
> >
> > - for port in ['rx', 'tx']:
> > + for port in ['rx0', 'rx1']:
> > self.verify(stats[port] == expected[port],
> > 'Frames expected (%s) and received (%s)
> mismatch on %s port' % (
> > expected[port], stats[port], port))
> >
> > def pipeline_command(self, command):
> > out = self.dut.send_expect(command, 'pipeline>')
> > - self.verify("Illegal" not in out, "Pipeline command error 1:
> '%s'" % command)
> > - self.verify("Bad" not in out, "Pipeline command error 2: '%s'" %
> command)
> > + self.verify("arguments" not in out, "Incorrect arguments:
> '%s'" % command)
> > + self.verify("Invalid" not in out, "Invalid argument: '%s'" %
> command)
> > + self.verify("Syntax error" not in out, "Syntax error: '%s'" %
> command)
> > return out
> >
> > - def pipeline_add_flow(self, port, src_ip, dst_ip, src_port,
> dst_port,
> > + def pipeline_add_flow(self, port, src_ip, dst_ip, src_port,
> dst_port, flowid,
> > protocol=6):
> > - command = 'flow add %s %s %d %d %d %d' % (src_ip, dst_ip,
> src_port,
> > - dst_port, protocol,
> port)
> > + command = 'p 1 flow add ipv4 %s %s %d %d %d port %d id %d' %
> (src_ip, dst_ip, src_port,
> > + dst_port, protocol,
> port, flowid)
> > out = self.pipeline_command(command)
> > - self.verify("Adding flow" in out, "Add flow error")
> > + self.verify("failed" not in out, "Add flow error")
> >
> > def pipeline_del_flow(self, src_ip, dst_ip, src_port, dst_port,
> > protocol=6):
> > - command = 'flow del %s %s %d %d %d' % (src_ip, dst_ip, src_port,
> > + command = 'p 1 flow del ipv4 %s %s %d %d %d' % (src_ip, dst_ip,
> src_port,
> > dst_port, protocol)
> > out = self.pipeline_command(command)
> > - self.verify("Deleting flow" in out, "Del flow error")
> > + self.verify("failed" not in out, "Del flow error")
> >
> > def pipeline_add_route(self, port, src_ip, netmask, gw_ip):
> > - command = 'route add %s %d %d %s' % (src_ip, netmask, port,
> gw_ip)
> > + command = 'p 1 route add %s %d port %d ether %s' % (src_ip,
> netmask, port, gw_ip)
> > out = self.pipeline_command(command)
> > - self.verify("Adding route" in out, "Add route error")
> > + self.verify("failed" not in out, "Add route error")
> >
> > def pipeline_del_route(self, src_ip, netmask):
> > - command = 'route del %s %d' % (src_ip, netmask)
> > + command = 'p 1 route del %s %d' % (src_ip, netmask)
> > out = self.pipeline_command(command)
> > - self.verify("Deleting route" in out, "Del route error")
> > -
> > - def pipeline_traffic_burst(self):
> > - self.dut.send_expect('link 0 up', 'pipeline>')
> > - self.dut.send_expect('link 1 up', 'pipeline>')
> > - sleep(0.1)
> > - self.dut.send_expect('link 0 down', 'pipeline>')
> > - self.dut.send_expect('link 1 down', 'pipeline>')
> > + self.verify("failed" not in out, "Del route error")
> >
> > def set_up_all(self):
> > """
> > @@ -291,14 +319,8 @@ class TestIPPipeline(TestCase):
> > PMD prerequisites.
> > """
> >
> > - # Check for port availability
> > - self.needed_ports = {"niantic": 2,
> > - "I217V": 1,
> > - "I217LM": 1,
> > - "I218V": 1,
> > - "I218LM": 1}
> > self.dut_ports = self.dut.get_ports()
> > - self.verify(len(self.dut_ports) >= self.needed_ports[self.nic],
> > + self.verify(len(self.dut_ports) >= 2,
> > "Insufficient ports for speed testing")
> >
> > out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
> > @@ -324,9 +346,10 @@ class TestIPPipeline(TestCase):
> > pcap_file = 'ip_pipeline.pcap'
> > frame_size = 64
> >
> > + self.create_passthrough_cfgfile()
> > self.start_ip_pipeline(ports=self.ports_mask)
> > self.dut.send_expect(
> > - 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)
> > + 'run examples/ip_pipeline/config/ip_pipeline.sh',
> 'pipeline>', 10)
> >
> > # Create a PCAP file containing the maximum frames_number of
> frames needed
> > # with fixed size and incremental IP
> > @@ -342,13 +365,13 @@ class TestIPPipeline(TestCase):
> > stats = self.send_and_sniff_pcap_file(pcap_file,
> frames_number,
> > 1, 0, inter)
> >
> > - expected = {'tx': 0, 'rx': frames_number}
> > + expected = {'rx0': frames_number, 'rx1': 0}
> > self.check_results(stats, expected)
> >
> > stats = self.send_and_sniff_pcap_file(pcap_file,
> frames_number,
> > 0, 1, inter)
> >
> > - expected = {'tx': frames_number, 'rx': 0}
> > + expected = {'rx0': 0, 'rx1': frames_number}
> > self.check_results(stats, expected)
> >
> > def test_frame_sizes(self):
> > @@ -359,9 +382,10 @@ class TestIPPipeline(TestCase):
> > frames_number = 100
> > inter = 0.5
> >
> > + self.create_passthrough_cfgfile()
> > self.start_ip_pipeline(ports=self.ports_mask)
> > self.dut.send_expect(
> > - 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)
> > + 'run examples/ip_pipeline/config/ip_pipeline.sh',
> 'pipeline>', 10)
> >
> > for frame_size in TestIPPipeline.frame_sizes:
> >
> > @@ -376,13 +400,13 @@ class TestIPPipeline(TestCase):
> > stats = self.send_and_sniff_pcap_file(pcap_file,
> frames_number,
> > 1, 0, inter)
> >
> > - expected = {'tx': 0, 'rx': frames_number}
> > + expected = {'rx0': frames_number, 'rx1': 0}
> > self.check_results(stats, expected)
> >
> > stats = self.send_and_sniff_pcap_file(pcap_file,
> frames_number,
> > 0, 1, inter)
> >
> > - expected = {'tx': frames_number, 'rx': 0}
> > + expected = {'rx0': 0, 'rx1': frames_number}
> > self.check_results(stats, expected)
> >
> > def test_flow_management(self):
> > @@ -392,11 +416,6 @@ class TestIPPipeline(TestCase):
> > pcap_file = 'ip_pipeline.pcap'
> > frame_size = 64
> >
> > - default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
> > - 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
> > - 'route add 0.0.0.0 9 0 0.0.0.1',
> > - 'route add 0.128.0.0 9 1 0.128.0.1']
> > -
> > ip_addrs = [
> > '0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',
> > '0.0.1.0', '0.0.127.0', '0.0.128.0', '0.0.129.0',
> '0.0.255.0',
> > @@ -409,30 +428,32 @@ class TestIPPipeline(TestCase):
> > frames.append(self.create_tcp_ipv4_frame(0, '0.0.0.0', addr,
> > frame_size))
> >
> > + self.create_flow_cfgfile()
> > self.create_pcap_file_from_frames(pcap_file, frames)
> > self.tester.session.copy_file_to(pcap_file)
> >
> > # Start ip_pipeline app and setup defaults
> > self.start_ip_pipeline(ports=self.ports_mask)
> > - for command in default_setup:
> > - self.pipeline_command(command)
> > +
> > + # default to SINK0
> > + self.pipeline_command('p 1 flow add default 3')
> >
> > # Check that no traffic pass though
> > stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> > 1, 0, 0.2)
> > - expected = {'tx': 0, 'rx': 0}
> > + expected = {'rx0': 0, 'rx1': 0}
> > self.check_results(stats, expected)
> >
> > # Add the flows
> > flows_added = 0
> > for addrs in ip_addrs:
> > - self.pipeline_add_flow(1, '0.0.0.0', addrs, 0, 0)
> > + self.pipeline_add_flow(0, '0.0.0.0', addrs, 0, 0,
> flows_added)
> > flows_added += 1
> >
> > # Check that traffic matching flows pass though
> > stats = self.send_and_sniff_pcap_file(pcap_file,
> len(frames),
> > 1, 0, 0.2)
> > - expected = {'tx': 0, 'rx': flows_added}
> > + expected = {'rx0': flows_added, 'rx1': 0}
> > self.check_results(stats, expected)
> >
> > # Remove flows
> > @@ -443,7 +464,7 @@ class TestIPPipeline(TestCase):
> > # Check that traffic matching flows pass though
> > stats = self.send_and_sniff_pcap_file(pcap_file,
> len(frames),
> > 1, 0, 0.2)
> > - expected = {'tx': 0, 'rx': flows_added}
> > + expected = {'rx0': flows_added, 'rx1': 0}
> > self.check_results(stats, expected)
> >
> > out = self.dut.send_expect('flow print', 'pipeline>')
> > @@ -452,7 +473,7 @@ class TestIPPipeline(TestCase):
> > # Check that again no traffic pass though
> > stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> > 1, 0, 0.2)
> > - expected = {'tx': 0, 'rx': 0}
> > + expected = {'rx0': 0, 'rx1': 0}
> > self.check_results(stats, expected)
> >
> > self.quit_ip_pipeline()
> > @@ -464,9 +485,8 @@ class TestIPPipeline(TestCase):
> > pcap_file = 'ip_pipeline.pcap'
> > frame_size = 64
> >
> > - default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
> > - 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
> > - 'flow add all']
> > + default_setup = ['p 1 arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
> > + 'p 1 arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f']
> >
> > ip_addrs = [
> > '0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',
> > @@ -483,6 +503,7 @@ class TestIPPipeline(TestCase):
> > self.create_pcap_file_from_frames(pcap_file, frames)
> > self.tester.session.copy_file_to(pcap_file)
> >
> > + self.create_routing_cfgfile()
> > # Start ip_pipeline app and setup defaults
> > self.start_ip_pipeline(ports=self.ports_mask)
> > for command in default_setup:
> > @@ -491,7 +512,7 @@ class TestIPPipeline(TestCase):
> > # Check that no traffic pass though
> > stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> > 1, 0, 0.2)
> > - expected = {'tx': 0, 'rx': 0}
> > + expected = {'rx0': 0, 'rx1': 0}
> > self.check_results(stats, expected)
> >
> > # Add the routes
> > @@ -504,7 +525,7 @@ class TestIPPipeline(TestCase):
> > stats = self.send_and_sniff_pcap_file(pcap_file,
> len(frames),
> > 1, 0, 0.2)
> >
> > - expected = {'tx': 0, 'rx': routes_added}
> > + expected = {'rx0': routes_added, 'rx1': 0}
> > self.check_results(stats, expected)
> >
> > # Remove routes
> > @@ -515,7 +536,7 @@ class TestIPPipeline(TestCase):
> > # Check that traffic matching flows pass though
> > stats = self.send_and_sniff_pcap_file(pcap_file,
> len(frames),
> > 1, 0, 0.2)
> > - expected = {'tx': 0, 'rx': routes_added}
> > + expected = {'rx0': routes_added, 'rx1': 0}
> > self.check_results(stats, expected)
> >
> > out = self.dut.send_expect('route print', 'pipeline>')
> > @@ -524,7 +545,7 @@ class TestIPPipeline(TestCase):
> > # Check that again no traffic pass though
> > stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> > 1, 0, 0.2)
> > - expected = {'tx': 0, 'rx': 0}
> > + expected = {'rx0': 0, 'rx1': 0}
> > self.check_results(stats, expected)
> >
> > self.quit_ip_pipeline()
> > @@ -539,5 +560,7 @@ class TestIPPipeline(TestCase):
> > """
> > Run after each test suite.
> > """
> > + self.dut.send_expect("rm /tmp/ip_pipeline.cfg", "#")
> > + self.dut.send_expect("rm /tmp/ip_pipeline.cfg.out", "#")
> > out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
> > self.verify("Error" not in out, "Compilation error")
> > --
> > 1.9.1
> >
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dts] [PATCH] tests/ip_pipeline: fix test failures
2017-09-04 8:50 ` Liu, Yong
@ 2017-09-04 9:33 ` Jianbo Liu
0 siblings, 0 replies; 12+ messages in thread
From: Jianbo Liu @ 2017-09-04 9:33 UTC (permalink / raw)
To: Liu, Yong; +Cc: dts, Herbert Guan, Xu, Qian Q
Oh, the default flow (SINK0) is 2. I will fix that in a new version. Thanks!
On 4 September 2017 at 16:50, Liu, Yong <yong.liu@intel.com> wrote:
> Hi Jianbo,
> I met one issue when trying to validate your patch. Sorry for late response, we're working on remaining issues in test suites these weeks.
>
> 04/09/2017 23:38:39 SUITE_DUT_CMD: [10.67.119.120] p 1 flow add default 3
> 04/09/2017 23:38:39 SUITE_DUT_OUTPUT: [10.67.119.120] p 1 flow add default 3^M^M
> Command "flow add default" failed
>
>
> Thanks,
> Marvin
>
>> -----Original Message-----
>> From: Jianbo Liu [mailto:jianbo.liu@linaro.org]
>> Sent: Monday, September 04, 2017 2:32 PM
>> To: dts@dpdk.org; Herbert Guan <herbert.guan@arm.com>
>> Cc: Xu, Qian Q <qian.q.xu@intel.com>; Liu, Yong <yong.liu@intel.com>
>> Subject: Re: [PATCH] tests/ip_pipeline: fix test failures
>>
>> Hi Yong and Qian,
>>
>> Have you reviewed this patch, any comments?
>>
>> Thanks!
>> Jianbo
>>
>>
>> On 21 August 2017 at 18:30, Jianbo Liu <jianbo.liu@linaro.org> wrote:
>> > The ip_pipeline was changed a lot, and the configuration and commands
>> > are different from those in this testing case.
>> >
>> > Signed-off-by: Jianbo Liu <jianbo.liu@linaro.org>
>> > ---
>> > tests/TestSuite_ip_pipeline.py | 157 +++++++++++++++++++++++-----------
>> -------
>> > 1 file changed, 90 insertions(+), 67 deletions(-)
>> >
>> > diff --git a/tests/TestSuite_ip_pipeline.py
>> b/tests/TestSuite_ip_pipeline.py
>> > index 90dba31..300b1de 100644
>> > --- a/tests/TestSuite_ip_pipeline.py
>> > +++ b/tests/TestSuite_ip_pipeline.py
>> > @@ -124,11 +124,47 @@ class TestIPPipeline(TestCase):
>> >
>> > writer.close()
>> >
>> > + def create_passthrough_cfgfile(self):
>> > + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg',
>> '#')
>> > + self.dut.send_expect('echo type = MASTER >>
>> /tmp/ip_pipeline.cfg', '#')
>> > + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg',
>> '#')
>> > + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg',
>> '#')
>> > + self.dut.send_expect('echo type = PASS-THROUGH >>
>> /tmp/ip_pipeline.cfg', '#')
>> > + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg',
>> '#')
>> > + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >>
>> /tmp/ip_pipeline.cfg', '#')
>> > + self.dut.send_expect('echo pktq_out = TXQ1.0 TXQ0.0 >>
>> /tmp/ip_pipeline.cfg', '#')
>> > +
>> > + def create_routing_cfgfile(self):
>> > + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg',
>> '#')
>> > + self.dut.send_expect('echo type = MASTER >>
>> /tmp/ip_pipeline.cfg', '#')
>> > + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg',
>> '#')
>> > + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg',
>> '#')
>> > + self.dut.send_expect('echo type = ROUTING >>
>> /tmp/ip_pipeline.cfg', '#')
>> > + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg',
>> '#')
>> > + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >>
>> /tmp/ip_pipeline.cfg', '#')
>> > + self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 >>
>> /tmp/ip_pipeline.cfg', '#')
>> > + self.dut.send_expect('echo encap = ethernet >>
>> /tmp/ip_pipeline.cfg', '#')
>> > + self.dut.send_expect('echo ip_hdr_offset = 270 >>
>> /tmp/ip_pipeline.cfg', '#')
>> > + self.dut.send_expect('echo arp_key_offset = 128 >>
>> /tmp/ip_pipeline.cfg', '#')
>> > + self.dut.send_expect('echo n_arp_entries = 1000 >>
>> /tmp/ip_pipeline.cfg', '#')
>> > +
>> > + def create_flow_cfgfile(self):
>> > + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg',
>> '#')
>> > + self.dut.send_expect('echo type = MASTER >>
>> /tmp/ip_pipeline.cfg', '#')
>> > + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg',
>> '#')
>> > + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg',
>> '#')
>> > + self.dut.send_expect('echo type = FLOW_CLASSIFICATION >>
>> /tmp/ip_pipeline.cfg', '#')
>> > + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg',
>> '#')
>> > + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >>
>> /tmp/ip_pipeline.cfg', '#')
>> > + self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 SINK0 >>
>> /tmp/ip_pipeline.cfg', '#')
>> > + self.dut.send_expect('echo n_flows = 65536 >>
>> /tmp/ip_pipeline.cfg', '#')
>> > + self.dut.send_expect('echo key_size = 16 >>
>> /tmp/ip_pipeline.cfg', '#')
>> > + self.dut.send_expect('echo key_offset = 278 >>
>> /tmp/ip_pipeline.cfg', '#')
>> > + self.dut.send_expect('echo key_mask =
>> 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF >> /tmp/ip_pipeline.cfg', '#')
>> > + self.dut.send_expect('echo flowid_offset = 128 >>
>> /tmp/ip_pipeline.cfg', '#')
>> > +
>> > def start_ip_pipeline(self, ports):
>> > - command_line = "./examples/ip_pipeline/build/ip_pipeline -c %s
>> -n %d -- -p %s" % \
>> > - (self.coremask,
>> > - self.dut.get_memory_channels(),
>> > - ports)
>> > + command_line = "./examples/ip_pipeline/build/ip_pipeline -p %s
>> -f /tmp/ip_pipeline.cfg" % ports
>> >
>> > out = self.dut.send_expect(command_line, 'pipeline>', 60)
>> > sleep(5) # 'Initialization completed' is not the last output,
>> some
>> > @@ -150,10 +186,10 @@ class TestIPPipeline(TestCase):
>> > """
>> >
>> > for iface in ifaces:
>> > + command = ('rm -f tcpdump_{0}.pcap').format(iface)
>> > + self.tester.send_expect(command, '#')
>> > command = (
>> > 'tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out
>> &').format(iface)
>> > - self.tester.send_expect(
>> > - 'rm -f tcpdump_{0}.pcap', '#').format(iface)
>> > self.tester.send_expect(command, '#')
>> >
>> > def tcpdump_stop_sniff(self):
>> > @@ -200,15 +236,13 @@ class TestIPPipeline(TestCase):
>> >
>> > tx_port = self.tester.get_local_port(self.dut_ports[from_port])
>> > rx_port = self.tester.get_local_port(self.dut_ports[to_port])
>> > + port0 = self.tester.get_local_port(self.dut_ports[0])
>> >
>> > tx_interface = self.tester.get_interface(tx_port)
>> > rx_interface = self.tester.get_interface(rx_port)
>> >
>> > self.tcpdump_start_sniffing([tx_interface, rx_interface])
>> >
>> > - self.dut.send_expect('link 0 up', 'pipeline>')
>> > - self.dut.send_expect('link 1 up', 'pipeline>')
>> > -
>> > timeout = frames_number * inter + 2
>> > inter = ", inter=%d" % inter
>> >
>> > @@ -225,64 +259,58 @@ class TestIPPipeline(TestCase):
>> >
>> > self.tcpdump_stop_sniff()
>> >
>> > - self.dut.send_expect('link 0 down', 'pipeline>')
>> > - self.dut.send_expect('link 1 down', 'pipeline>')
>> > -
>> > rx_stats = self.number_of_packets('tcpdump_%s.pcap' %
>> rx_interface)
>> > tx_stats = self.number_of_packets('tcpdump_%s.pcap' %
>> tx_interface)
>> >
>> > # Do not count the sent frames in the tx_interface
>> > tx_stats = tx_stats - frames_number
>> >
>> > - return {'rx': rx_stats, 'tx': tx_stats}
>> > + if port0 == tx_port:
>> > + return {'rx0': tx_stats, 'rx1': rx_stats}
>> > + else:
>> > + return {'rx0': rx_stats, 'rx1': tx_stats}
>> >
>> > def check_results(self, stats, expected):
>> > """
>> > - This function check that the Rx and Tx stats matches the
>> expected.
>> > - expected = [Rx, Tx]
>> > + This function check that the received packet numbers of port0
>> and port1 match the expected.
>> > + expected = [Rx0, Rx1]
>> > """
>> >
>> > - for port in ['rx', 'tx']:
>> > + for port in ['rx0', 'rx1']:
>> > self.verify(stats[port] == expected[port],
>> > 'Frames expected (%s) and received (%s)
>> mismatch on %s port' % (
>> > expected[port], stats[port], port))
>> >
>> > def pipeline_command(self, command):
>> > out = self.dut.send_expect(command, 'pipeline>')
>> > - self.verify("Illegal" not in out, "Pipeline command error 1:
>> '%s'" % command)
>> > - self.verify("Bad" not in out, "Pipeline command error 2: '%s'" %
>> command)
>> > + self.verify("arguments" not in out, "Incorrect arguments:
>> '%s'" % command)
>> > + self.verify("Invalid" not in out, "Invalid argument: '%s'" %
>> command)
>> > + self.verify("Syntax error" not in out, "Syntax error: '%s'" %
>> command)
>> > return out
>> >
>> > - def pipeline_add_flow(self, port, src_ip, dst_ip, src_port,
>> dst_port,
>> > + def pipeline_add_flow(self, port, src_ip, dst_ip, src_port,
>> dst_port, flowid,
>> > protocol=6):
>> > - command = 'flow add %s %s %d %d %d %d' % (src_ip, dst_ip,
>> src_port,
>> > - dst_port, protocol,
>> port)
>> > + command = 'p 1 flow add ipv4 %s %s %d %d %d port %d id %d' %
>> (src_ip, dst_ip, src_port,
>> > + dst_port, protocol,
>> port, flowid)
>> > out = self.pipeline_command(command)
>> > - self.verify("Adding flow" in out, "Add flow error")
>> > + self.verify("failed" not in out, "Add flow error")
>> >
>> > def pipeline_del_flow(self, src_ip, dst_ip, src_port, dst_port,
>> > protocol=6):
>> > - command = 'flow del %s %s %d %d %d' % (src_ip, dst_ip, src_port,
>> > + command = 'p 1 flow del ipv4 %s %s %d %d %d' % (src_ip, dst_ip,
>> src_port,
>> > dst_port, protocol)
>> > out = self.pipeline_command(command)
>> > - self.verify("Deleting flow" in out, "Del flow error")
>> > + self.verify("failed" not in out, "Del flow error")
>> >
>> > def pipeline_add_route(self, port, src_ip, netmask, gw_ip):
>> > - command = 'route add %s %d %d %s' % (src_ip, netmask, port,
>> gw_ip)
>> > + command = 'p 1 route add %s %d port %d ether %s' % (src_ip,
>> netmask, port, gw_ip)
>> > out = self.pipeline_command(command)
>> > - self.verify("Adding route" in out, "Add route error")
>> > + self.verify("failed" not in out, "Add route error")
>> >
>> > def pipeline_del_route(self, src_ip, netmask):
>> > - command = 'route del %s %d' % (src_ip, netmask)
>> > + command = 'p 1 route del %s %d' % (src_ip, netmask)
>> > out = self.pipeline_command(command)
>> > - self.verify("Deleting route" in out, "Del route error")
>> > -
>> > - def pipeline_traffic_burst(self):
>> > - self.dut.send_expect('link 0 up', 'pipeline>')
>> > - self.dut.send_expect('link 1 up', 'pipeline>')
>> > - sleep(0.1)
>> > - self.dut.send_expect('link 0 down', 'pipeline>')
>> > - self.dut.send_expect('link 1 down', 'pipeline>')
>> > + self.verify("failed" not in out, "Del route error")
>> >
>> > def set_up_all(self):
>> > """
>> > @@ -291,14 +319,8 @@ class TestIPPipeline(TestCase):
>> > PMD prerequisites.
>> > """
>> >
>> > - # Check for port availability
>> > - self.needed_ports = {"niantic": 2,
>> > - "I217V": 1,
>> > - "I217LM": 1,
>> > - "I218V": 1,
>> > - "I218LM": 1}
>> > self.dut_ports = self.dut.get_ports()
>> > - self.verify(len(self.dut_ports) >= self.needed_ports[self.nic],
>> > + self.verify(len(self.dut_ports) >= 2,
>> > "Insufficient ports for speed testing")
>> >
>> > out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
>> > @@ -324,9 +346,10 @@ class TestIPPipeline(TestCase):
>> > pcap_file = 'ip_pipeline.pcap'
>> > frame_size = 64
>> >
>> > + self.create_passthrough_cfgfile()
>> > self.start_ip_pipeline(ports=self.ports_mask)
>> > self.dut.send_expect(
>> > - 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)
>> > + 'run examples/ip_pipeline/config/ip_pipeline.sh',
>> 'pipeline>', 10)
>> >
>> > # Create a PCAP file containing the maximum frames_number of
>> frames needed
>> > # with fixed size and incremental IP
>> > @@ -342,13 +365,13 @@ class TestIPPipeline(TestCase):
>> > stats = self.send_and_sniff_pcap_file(pcap_file,
>> frames_number,
>> > 1, 0, inter)
>> >
>> > - expected = {'tx': 0, 'rx': frames_number}
>> > + expected = {'rx0': frames_number, 'rx1': 0}
>> > self.check_results(stats, expected)
>> >
>> > stats = self.send_and_sniff_pcap_file(pcap_file,
>> frames_number,
>> > 0, 1, inter)
>> >
>> > - expected = {'tx': frames_number, 'rx': 0}
>> > + expected = {'rx0': 0, 'rx1': frames_number}
>> > self.check_results(stats, expected)
>> >
>> > def test_frame_sizes(self):
>> > @@ -359,9 +382,10 @@ class TestIPPipeline(TestCase):
>> > frames_number = 100
>> > inter = 0.5
>> >
>> > + self.create_passthrough_cfgfile()
>> > self.start_ip_pipeline(ports=self.ports_mask)
>> > self.dut.send_expect(
>> > - 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)
>> > + 'run examples/ip_pipeline/config/ip_pipeline.sh',
>> 'pipeline>', 10)
>> >
>> > for frame_size in TestIPPipeline.frame_sizes:
>> >
>> > @@ -376,13 +400,13 @@ class TestIPPipeline(TestCase):
>> > stats = self.send_and_sniff_pcap_file(pcap_file,
>> frames_number,
>> > 1, 0, inter)
>> >
>> > - expected = {'tx': 0, 'rx': frames_number}
>> > + expected = {'rx0': frames_number, 'rx1': 0}
>> > self.check_results(stats, expected)
>> >
>> > stats = self.send_and_sniff_pcap_file(pcap_file,
>> frames_number,
>> > 0, 1, inter)
>> >
>> > - expected = {'tx': frames_number, 'rx': 0}
>> > + expected = {'rx0': 0, 'rx1': frames_number}
>> > self.check_results(stats, expected)
>> >
>> > def test_flow_management(self):
>> > @@ -392,11 +416,6 @@ class TestIPPipeline(TestCase):
>> > pcap_file = 'ip_pipeline.pcap'
>> > frame_size = 64
>> >
>> > - default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
>> > - 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
>> > - 'route add 0.0.0.0 9 0 0.0.0.1',
>> > - 'route add 0.128.0.0 9 1 0.128.0.1']
>> > -
>> > ip_addrs = [
>> > '0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',
>> > '0.0.1.0', '0.0.127.0', '0.0.128.0', '0.0.129.0',
>> '0.0.255.0',
>> > @@ -409,30 +428,32 @@ class TestIPPipeline(TestCase):
>> > frames.append(self.create_tcp_ipv4_frame(0, '0.0.0.0', addr,
>> > frame_size))
>> >
>> > + self.create_flow_cfgfile()
>> > self.create_pcap_file_from_frames(pcap_file, frames)
>> > self.tester.session.copy_file_to(pcap_file)
>> >
>> > # Start ip_pipeline app and setup defaults
>> > self.start_ip_pipeline(ports=self.ports_mask)
>> > - for command in default_setup:
>> > - self.pipeline_command(command)
>> > +
>> > + # default to SINK0
>> > + self.pipeline_command('p 1 flow add default 3')
>> >
>> > # Check that no traffic pass though
>> > stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
>> > 1, 0, 0.2)
>> > - expected = {'tx': 0, 'rx': 0}
>> > + expected = {'rx0': 0, 'rx1': 0}
>> > self.check_results(stats, expected)
>> >
>> > # Add the flows
>> > flows_added = 0
>> > for addrs in ip_addrs:
>> > - self.pipeline_add_flow(1, '0.0.0.0', addrs, 0, 0)
>> > + self.pipeline_add_flow(0, '0.0.0.0', addrs, 0, 0,
>> flows_added)
>> > flows_added += 1
>> >
>> > # Check that traffic matching flows pass though
>> > stats = self.send_and_sniff_pcap_file(pcap_file,
>> len(frames),
>> > 1, 0, 0.2)
>> > - expected = {'tx': 0, 'rx': flows_added}
>> > + expected = {'rx0': flows_added, 'rx1': 0}
>> > self.check_results(stats, expected)
>> >
>> > # Remove flows
>> > @@ -443,7 +464,7 @@ class TestIPPipeline(TestCase):
>> > # Check that traffic matching flows pass though
>> > stats = self.send_and_sniff_pcap_file(pcap_file,
>> len(frames),
>> > 1, 0, 0.2)
>> > - expected = {'tx': 0, 'rx': flows_added}
>> > + expected = {'rx0': flows_added, 'rx1': 0}
>> > self.check_results(stats, expected)
>> >
>> > out = self.dut.send_expect('flow print', 'pipeline>')
>> > @@ -452,7 +473,7 @@ class TestIPPipeline(TestCase):
>> > # Check that again no traffic pass though
>> > stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
>> > 1, 0, 0.2)
>> > - expected = {'tx': 0, 'rx': 0}
>> > + expected = {'rx0': 0, 'rx1': 0}
>> > self.check_results(stats, expected)
>> >
>> > self.quit_ip_pipeline()
>> > @@ -464,9 +485,8 @@ class TestIPPipeline(TestCase):
>> > pcap_file = 'ip_pipeline.pcap'
>> > frame_size = 64
>> >
>> > - default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
>> > - 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
>> > - 'flow add all']
>> > + default_setup = ['p 1 arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
>> > + 'p 1 arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f']
>> >
>> > ip_addrs = [
>> > '0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',
>> > @@ -483,6 +503,7 @@ class TestIPPipeline(TestCase):
>> > self.create_pcap_file_from_frames(pcap_file, frames)
>> > self.tester.session.copy_file_to(pcap_file)
>> >
>> > + self.create_routing_cfgfile()
>> > # Start ip_pipeline app and setup defaults
>> > self.start_ip_pipeline(ports=self.ports_mask)
>> > for command in default_setup:
>> > @@ -491,7 +512,7 @@ class TestIPPipeline(TestCase):
>> > # Check that no traffic pass though
>> > stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
>> > 1, 0, 0.2)
>> > - expected = {'tx': 0, 'rx': 0}
>> > + expected = {'rx0': 0, 'rx1': 0}
>> > self.check_results(stats, expected)
>> >
>> > # Add the routes
>> > @@ -504,7 +525,7 @@ class TestIPPipeline(TestCase):
>> > stats = self.send_and_sniff_pcap_file(pcap_file,
>> len(frames),
>> > 1, 0, 0.2)
>> >
>> > - expected = {'tx': 0, 'rx': routes_added}
>> > + expected = {'rx0': routes_added, 'rx1': 0}
>> > self.check_results(stats, expected)
>> >
>> > # Remove routes
>> > @@ -515,7 +536,7 @@ class TestIPPipeline(TestCase):
>> > # Check that traffic matching flows pass though
>> > stats = self.send_and_sniff_pcap_file(pcap_file,
>> len(frames),
>> > 1, 0, 0.2)
>> > - expected = {'tx': 0, 'rx': routes_added}
>> > + expected = {'rx0': routes_added, 'rx1': 0}
>> > self.check_results(stats, expected)
>> >
>> > out = self.dut.send_expect('route print', 'pipeline>')
>> > @@ -524,7 +545,7 @@ class TestIPPipeline(TestCase):
>> > # Check that again no traffic pass though
>> > stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
>> > 1, 0, 0.2)
>> > - expected = {'tx': 0, 'rx': 0}
>> > + expected = {'rx0': 0, 'rx1': 0}
>> > self.check_results(stats, expected)
>> >
>> > self.quit_ip_pipeline()
>> > @@ -539,5 +560,7 @@ class TestIPPipeline(TestCase):
>> > """
>> > Run after each test suite.
>> > """
>> > + self.dut.send_expect("rm /tmp/ip_pipeline.cfg", "#")
>> > + self.dut.send_expect("rm /tmp/ip_pipeline.cfg.out", "#")
>> > out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
>> > self.verify("Error" not in out, "Compilation error")
>> > --
>> > 1.9.1
>> >
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dts] [PATCH] tests/ip_pipeline: fix test failures
2017-08-21 10:30 [dts] [PATCH] tests/ip_pipeline: fix test failures Jianbo Liu
2017-09-04 6:31 ` Jianbo Liu
@ 2017-09-04 9:39 ` Radosław Biernacki
2017-09-05 1:58 ` Jianbo Liu
2017-09-05 1:54 ` [dts] [PATCH v2] " Jianbo Liu
2017-09-12 3:31 ` [dts] [PATCH v3] " Jianbo Liu
3 siblings, 1 reply; 12+ messages in thread
From: Radosław Biernacki @ 2017-09-04 9:39 UTC (permalink / raw)
To: Jianbo Liu; +Cc: dts, herbert.guan
[-- Attachment #1: Type: text/plain, Size: 19162 bytes --]
2017-08-21 12:30 GMT+02:00 Jianbo Liu <jianbo.liu@linaro.org>:
> The ip_pipeline was changed a lot, and the configuration and commands
> are different from those in this testing case.
>
> Signed-off-by: Jianbo Liu <jianbo.liu@linaro.org>
> ---
> tests/TestSuite_ip_pipeline.py | 157 +++++++++++++++++++++++-------
> -----------
> 1 file changed, 90 insertions(+), 67 deletions(-)
>
> diff --git a/tests/TestSuite_ip_pipeline.py b/tests/TestSuite_ip_pipeline.
> py
> index 90dba31..300b1de 100644
> --- a/tests/TestSuite_ip_pipeline.py
> +++ b/tests/TestSuite_ip_pipeline.py
> @@ -124,11 +124,47 @@ class TestIPPipeline(TestCase):
>
> writer.close()
>
> + def create_passthrough_cfgfile(self):
> + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg',
> '#')
> + self.dut.send_expect('echo type = MASTER >>
> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg',
> '#')
> + self.dut.send_expect('echo type = PASS-THROUGH >>
> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >>
> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo pktq_out = TXQ1.0 TXQ0.0 >>
> /tmp/ip_pipeline.cfg', '#')
> +
> + def create_routing_cfgfile(self):
> + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg',
> '#')
> + self.dut.send_expect('echo type = MASTER >>
> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg',
> '#')
> + self.dut.send_expect('echo type = ROUTING >>
> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >>
> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 >>
> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo encap = ethernet >>
> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo ip_hdr_offset = 270 >>
> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo arp_key_offset = 128 >>
> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo n_arp_entries = 1000 >>
> /tmp/ip_pipeline.cfg', '#')
> +
> + def create_flow_cfgfile(self):
> + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg',
> '#')
> + self.dut.send_expect('echo type = MASTER >>
> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg',
> '#')
> + self.dut.send_expect('echo type = FLOW_CLASSIFICATION >>
> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >>
> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 SINK0 >>
> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo n_flows = 65536 >>
> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo key_size = 16 >>
> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo key_offset = 278 >>
> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo key_mask =
> 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo flowid_offset = 128 >>
> /tmp/ip_pipeline.cfg', '#')
> +
> def start_ip_pipeline(self, ports):
> - command_line = "./examples/ip_pipeline/build/ip_pipeline -c %s
> -n %d -- -p %s" % \
> - (self.coremask,
> - self.dut.get_memory_channels(),
> - ports)
> + command_line = "./examples/ip_pipeline/build/ip_pipeline -p %s
> -f /tmp/ip_pipeline.cfg" % ports
>
> out = self.dut.send_expect(command_line, 'pipeline>', 60)
> sleep(5) # 'Initialization completed' is not the last output,
> some
> @@ -150,10 +186,10 @@ class TestIPPipeline(TestCase):
> """
>
> for iface in ifaces:
> + command = ('rm -f tcpdump_{0}.pcap').format(iface)
> + self.tester.send_expect(command, '#')
> command = (
> 'tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out
> &').format(iface)
> - self.tester.send_expect(
> - 'rm -f tcpdump_{0}.pcap', '#').format(iface)
> self.tester.send_expect(command, '#')
>
> def tcpdump_stop_sniff(self):
> @@ -200,15 +236,13 @@ class TestIPPipeline(TestCase):
>
> tx_port = self.tester.get_local_port(self.dut_ports[from_port])
> rx_port = self.tester.get_local_port(self.dut_ports[to_port])
> + port0 = self.tester.get_local_port(self.dut_ports[0])
>
> tx_interface = self.tester.get_interface(tx_port)
> rx_interface = self.tester.get_interface(rx_port)
>
> self.tcpdump_start_sniffing([tx_interface, rx_interface])
>
> - self.dut.send_expect('link 0 up', 'pipeline>')
> - self.dut.send_expect('link 1 up', 'pipeline>')
> -
> timeout = frames_number * inter + 2
> inter = ", inter=%d" % inter
>
> @@ -225,64 +259,58 @@ class TestIPPipeline(TestCase):
>
> self.tcpdump_stop_sniff()
>
> - self.dut.send_expect('link 0 down', 'pipeline>')
> - self.dut.send_expect('link 1 down', 'pipeline>')
> -
> rx_stats = self.number_of_packets('tcpdump_%s.pcap' %
> rx_interface)
> tx_stats = self.number_of_packets('tcpdump_%s.pcap' %
> tx_interface)
>
> # Do not count the sent frames in the tx_interface
> tx_stats = tx_stats - frames_number
>
> - return {'rx': rx_stats, 'tx': tx_stats}
> + if port0 == tx_port:
> + return {'rx0': tx_stats, 'rx1': rx_stats}
> + else:
> + return {'rx0': rx_stats, 'rx1': tx_stats}
>
> def check_results(self, stats, expected):
> """
> - This function check that the Rx and Tx stats matches the expected.
> - expected = [Rx, Tx]
> + This function check that the received packet numbers of port0 and
> port1 match the expected.
> + expected = [Rx0, Rx1]
> """
>
> - for port in ['rx', 'tx']:
> + for port in ['rx0', 'rx1']:
> self.verify(stats[port] == expected[port],
> 'Frames expected (%s) and received (%s) mismatch
> on %s port' % (
> expected[port], stats[port], port))
>
> def pipeline_command(self, command):
> out = self.dut.send_expect(command, 'pipeline>')
> - self.verify("Illegal" not in out, "Pipeline command error 1:
> '%s'" % command)
> - self.verify("Bad" not in out, "Pipeline command error 2: '%s'" %
> command)
> + self.verify("arguments" not in out, "Incorrect arguments: '%s'" %
> command)
> + self.verify("Invalid" not in out, "Invalid argument: '%s'" %
> command)
> + self.verify("Syntax error" not in out, "Syntax error: '%s'" %
> command)
> return out
>
> - def pipeline_add_flow(self, port, src_ip, dst_ip, src_port, dst_port,
> + def pipeline_add_flow(self, port, src_ip, dst_ip, src_port, dst_port,
> flowid,
> protocol=6):
> - command = 'flow add %s %s %d %d %d %d' % (src_ip, dst_ip,
> src_port,
> - dst_port, protocol,
> port)
> + command = 'p 1 flow add ipv4 %s %s %d %d %d port %d id %d' %
> (src_ip, dst_ip, src_port,
> + dst_port, protocol,
> port, flowid)
> out = self.pipeline_command(command)
> - self.verify("Adding flow" in out, "Add flow error")
> + self.verify("failed" not in out, "Add flow error")
>
> def pipeline_del_flow(self, src_ip, dst_ip, src_port, dst_port,
> protocol=6):
> - command = 'flow del %s %s %d %d %d' % (src_ip, dst_ip, src_port,
> + command = 'p 1 flow del ipv4 %s %s %d %d %d' % (src_ip, dst_ip,
> src_port,
> dst_port, protocol)
> out = self.pipeline_command(command)
> - self.verify("Deleting flow" in out, "Del flow error")
> + self.verify("failed" not in out, "Del flow error")
>
> def pipeline_add_route(self, port, src_ip, netmask, gw_ip):
> - command = 'route add %s %d %d %s' % (src_ip, netmask, port, gw_ip)
> + command = 'p 1 route add %s %d port %d ether %s' % (src_ip,
> netmask, port, gw_ip)
> out = self.pipeline_command(command)
> - self.verify("Adding route" in out, "Add route error")
> + self.verify("failed" not in out, "Add route error")
>
> def pipeline_del_route(self, src_ip, netmask):
> - command = 'route del %s %d' % (src_ip, netmask)
> + command = 'p 1 route del %s %d' % (src_ip, netmask)
> out = self.pipeline_command(command)
> - self.verify("Deleting route" in out, "Del route error")
> -
> - def pipeline_traffic_burst(self):
> - self.dut.send_expect('link 0 up', 'pipeline>')
> - self.dut.send_expect('link 1 up', 'pipeline>')
> - sleep(0.1)
> - self.dut.send_expect('link 0 down', 'pipeline>')
> - self.dut.send_expect('link 1 down', 'pipeline>')
> + self.verify("failed" not in out, "Del route error")
>
> def set_up_all(self):
> """
> @@ -291,14 +319,8 @@ class TestIPPipeline(TestCase):
> PMD prerequisites.
> """
>
> - # Check for port availability
> - self.needed_ports = {"niantic": 2,
> - "I217V": 1,
> - "I217LM": 1,
> - "I218V": 1,
> - "I218LM": 1}
> self.dut_ports = self.dut.get_ports()
> - self.verify(len(self.dut_ports) >= self.needed_ports[self.nic],
> + self.verify(len(self.dut_ports) >= 2,
> "Insufficient ports for speed testing")
>
If we access both ports from remain parts of the code, than why we check
for single port for specific platforms.
In other words what was was the purpose of those removed lines?
>
> out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
> @@ -324,9 +346,10 @@ class TestIPPipeline(TestCase):
> pcap_file = 'ip_pipeline.pcap'
> frame_size = 64
>
> + self.create_passthrough_cfgfile()
> self.start_ip_pipeline(ports=self.ports_mask)
> self.dut.send_expect(
> - 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)
> + 'run examples/ip_pipeline/config/ip_pipeline.sh',
> 'pipeline>', 10)
>
> # Create a PCAP file containing the maximum frames_number of
> frames needed
> # with fixed size and incremental IP
> @@ -342,13 +365,13 @@ class TestIPPipeline(TestCase):
> stats = self.send_and_sniff_pcap_file(pcap_file,
> frames_number,
> 1, 0, inter)
>
> - expected = {'tx': 0, 'rx': frames_number}
> + expected = {'rx0': frames_number, 'rx1': 0}
> self.check_results(stats, expected)
>
> stats = self.send_and_sniff_pcap_file(pcap_file,
> frames_number,
> 0, 1, inter)
>
> - expected = {'tx': frames_number, 'rx': 0}
> + expected = {'rx0': 0, 'rx1': frames_number}
> self.check_results(stats, expected)
>
> def test_frame_sizes(self):
> @@ -359,9 +382,10 @@ class TestIPPipeline(TestCase):
> frames_number = 100
> inter = 0.5
>
> + self.create_passthrough_cfgfile()
> self.start_ip_pipeline(ports=self.ports_mask)
> self.dut.send_expect(
> - 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)
> + 'run examples/ip_pipeline/config/ip_pipeline.sh',
> 'pipeline>', 10)
>
> for frame_size in TestIPPipeline.frame_sizes:
>
> @@ -376,13 +400,13 @@ class TestIPPipeline(TestCase):
> stats = self.send_and_sniff_pcap_file(pcap_file,
> frames_number,
> 1, 0, inter)
>
> - expected = {'tx': 0, 'rx': frames_number}
> + expected = {'rx0': frames_number, 'rx1': 0}
> self.check_results(stats, expected)
>
> stats = self.send_and_sniff_pcap_file(pcap_file,
> frames_number,
> 0, 1, inter)
>
> - expected = {'tx': frames_number, 'rx': 0}
> + expected = {'rx0': 0, 'rx1': frames_number}
> self.check_results(stats, expected)
>
> def test_flow_management(self):
> @@ -392,11 +416,6 @@ class TestIPPipeline(TestCase):
> pcap_file = 'ip_pipeline.pcap'
> frame_size = 64
>
> - default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
> - 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
> - 'route add 0.0.0.0 9 0 0.0.0.1',
> - 'route add 0.128.0.0 9 1 0.128.0.1']
> -
> ip_addrs = [
> '0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',
> '0.0.1.0', '0.0.127.0', '0.0.128.0', '0.0.129.0', '0.0.255.0',
> @@ -409,30 +428,32 @@ class TestIPPipeline(TestCase):
> frames.append(self.create_tcp_ipv4_frame(0, '0.0.0.0', addr,
> frame_size))
>
> + self.create_flow_cfgfile()
> self.create_pcap_file_from_frames(pcap_file, frames)
> self.tester.session.copy_file_to(pcap_file)
>
> # Start ip_pipeline app and setup defaults
> self.start_ip_pipeline(ports=self.ports_mask)
> - for command in default_setup:
> - self.pipeline_command(command)
> +
> + # default to SINK0
> + self.pipeline_command('p 1 flow add default 3')
>
> # Check that no traffic pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': 0}
> + expected = {'rx0': 0, 'rx1': 0}
> self.check_results(stats, expected)
>
> # Add the flows
> flows_added = 0
> for addrs in ip_addrs:
> - self.pipeline_add_flow(1, '0.0.0.0', addrs, 0, 0)
> + self.pipeline_add_flow(0, '0.0.0.0', addrs, 0, 0, flows_added)
> flows_added += 1
>
> # Check that traffic matching flows pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': flows_added}
> + expected = {'rx0': flows_added, 'rx1': 0}
> self.check_results(stats, expected)
>
> # Remove flows
> @@ -443,7 +464,7 @@ class TestIPPipeline(TestCase):
> # Check that traffic matching flows pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': flows_added}
> + expected = {'rx0': flows_added, 'rx1': 0}
> self.check_results(stats, expected)
>
> out = self.dut.send_expect('flow print', 'pipeline>')
> @@ -452,7 +473,7 @@ class TestIPPipeline(TestCase):
> # Check that again no traffic pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': 0}
> + expected = {'rx0': 0, 'rx1': 0}
> self.check_results(stats, expected)
>
> self.quit_ip_pipeline()
> @@ -464,9 +485,8 @@ class TestIPPipeline(TestCase):
> pcap_file = 'ip_pipeline.pcap'
> frame_size = 64
>
> - default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
> - 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
> - 'flow add all']
> + default_setup = ['p 1 arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
> + 'p 1 arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f']
>
> ip_addrs = [
> '0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',
> @@ -483,6 +503,7 @@ class TestIPPipeline(TestCase):
> self.create_pcap_file_from_frames(pcap_file, frames)
> self.tester.session.copy_file_to(pcap_file)
>
> + self.create_routing_cfgfile()
> # Start ip_pipeline app and setup defaults
> self.start_ip_pipeline(ports=self.ports_mask)
> for command in default_setup:
> @@ -491,7 +512,7 @@ class TestIPPipeline(TestCase):
> # Check that no traffic pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': 0}
> + expected = {'rx0': 0, 'rx1': 0}
> self.check_results(stats, expected)
>
> # Add the routes
> @@ -504,7 +525,7 @@ class TestIPPipeline(TestCase):
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
>
> - expected = {'tx': 0, 'rx': routes_added}
> + expected = {'rx0': routes_added, 'rx1': 0}
> self.check_results(stats, expected)
>
> # Remove routes
> @@ -515,7 +536,7 @@ class TestIPPipeline(TestCase):
> # Check that traffic matching flows pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': routes_added}
> + expected = {'rx0': routes_added, 'rx1': 0}
> self.check_results(stats, expected)
>
> out = self.dut.send_expect('route print', 'pipeline>')
> @@ -524,7 +545,7 @@ class TestIPPipeline(TestCase):
> # Check that again no traffic pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': 0}
> + expected = {'rx0': 0, 'rx1': 0}
> self.check_results(stats, expected)
>
> self.quit_ip_pipeline()
> @@ -539,5 +560,7 @@ class TestIPPipeline(TestCase):
> """
> Run after each test suite.
> """
> + self.dut.send_expect("rm /tmp/ip_pipeline.cfg", "#")
> + self.dut.send_expect("rm /tmp/ip_pipeline.cfg.out", "#")
> out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
> self.verify("Error" not in out, "Compilation error")
> --
> 1.9.1
>
>
[-- Attachment #2: Type: text/html, Size: 25456 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* [dts] [PATCH v2] tests/ip_pipeline: fix test failures
2017-08-21 10:30 [dts] [PATCH] tests/ip_pipeline: fix test failures Jianbo Liu
2017-09-04 6:31 ` Jianbo Liu
2017-09-04 9:39 ` Radosław Biernacki
@ 2017-09-05 1:54 ` Jianbo Liu
2017-09-11 3:13 ` Jianbo Liu
2017-09-12 3:31 ` [dts] [PATCH v3] " Jianbo Liu
3 siblings, 1 reply; 12+ messages in thread
From: Jianbo Liu @ 2017-09-05 1:54 UTC (permalink / raw)
To: dts, rad; +Cc: Jianbo Liu
The ip_pipeline was changed a lot, and the configuration and commands
are different from those in this testing case.
Signed-off-by: Jianbo Liu <jianbo.liu@linaro.org>
---
tests/TestSuite_ip_pipeline.py | 157 +++++++++++++++++++++++------------------
1 file changed, 90 insertions(+), 67 deletions(-)
diff --git a/tests/TestSuite_ip_pipeline.py b/tests/TestSuite_ip_pipeline.py
index 90dba31..003cd03 100644
--- a/tests/TestSuite_ip_pipeline.py
+++ b/tests/TestSuite_ip_pipeline.py
@@ -124,11 +124,47 @@ class TestIPPipeline(TestCase):
writer.close()
+ def create_passthrough_cfgfile(self):
+ self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo type = MASTER >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo type = PASS-THROUGH >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo pktq_out = TXQ1.0 TXQ0.0 >> /tmp/ip_pipeline.cfg', '#')
+
+ def create_routing_cfgfile(self):
+ self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo type = MASTER >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo type = ROUTING >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo encap = ethernet >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo ip_hdr_offset = 270 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo arp_key_offset = 128 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo n_arp_entries = 1000 >> /tmp/ip_pipeline.cfg', '#')
+
+ def create_flow_cfgfile(self):
+ self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo type = MASTER >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo type = FLOW_CLASSIFICATION >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 SINK0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo n_flows = 65536 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo key_size = 16 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo key_offset = 278 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo key_mask = 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo flowid_offset = 128 >> /tmp/ip_pipeline.cfg', '#')
+
def start_ip_pipeline(self, ports):
- command_line = "./examples/ip_pipeline/build/ip_pipeline -c %s -n %d -- -p %s" % \
- (self.coremask,
- self.dut.get_memory_channels(),
- ports)
+ command_line = "./examples/ip_pipeline/build/ip_pipeline -p %s -f /tmp/ip_pipeline.cfg" % ports
out = self.dut.send_expect(command_line, 'pipeline>', 60)
sleep(5) # 'Initialization completed' is not the last output, some
@@ -150,10 +186,10 @@ class TestIPPipeline(TestCase):
"""
for iface in ifaces:
+ command = ('rm -f tcpdump_{0}.pcap').format(iface)
+ self.tester.send_expect(command, '#')
command = (
'tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out &').format(iface)
- self.tester.send_expect(
- 'rm -f tcpdump_{0}.pcap', '#').format(iface)
self.tester.send_expect(command, '#')
def tcpdump_stop_sniff(self):
@@ -200,15 +236,13 @@ class TestIPPipeline(TestCase):
tx_port = self.tester.get_local_port(self.dut_ports[from_port])
rx_port = self.tester.get_local_port(self.dut_ports[to_port])
+ port0 = self.tester.get_local_port(self.dut_ports[0])
tx_interface = self.tester.get_interface(tx_port)
rx_interface = self.tester.get_interface(rx_port)
self.tcpdump_start_sniffing([tx_interface, rx_interface])
- self.dut.send_expect('link 0 up', 'pipeline>')
- self.dut.send_expect('link 1 up', 'pipeline>')
-
timeout = frames_number * inter + 2
inter = ", inter=%d" % inter
@@ -225,64 +259,58 @@ class TestIPPipeline(TestCase):
self.tcpdump_stop_sniff()
- self.dut.send_expect('link 0 down', 'pipeline>')
- self.dut.send_expect('link 1 down', 'pipeline>')
-
rx_stats = self.number_of_packets('tcpdump_%s.pcap' % rx_interface)
tx_stats = self.number_of_packets('tcpdump_%s.pcap' % tx_interface)
# Do not count the sent frames in the tx_interface
tx_stats = tx_stats - frames_number
- return {'rx': rx_stats, 'tx': tx_stats}
+ if port0 == tx_port:
+ return {'rx0': tx_stats, 'rx1': rx_stats}
+ else:
+ return {'rx0': rx_stats, 'rx1': tx_stats}
def check_results(self, stats, expected):
"""
- This function check that the Rx and Tx stats matches the expected.
- expected = [Rx, Tx]
+ This function check that the received packet numbers of port0 and port1 match the expected.
+ expected = [Rx0, Rx1]
"""
- for port in ['rx', 'tx']:
+ for port in ['rx0', 'rx1']:
self.verify(stats[port] == expected[port],
'Frames expected (%s) and received (%s) mismatch on %s port' % (
expected[port], stats[port], port))
def pipeline_command(self, command):
out = self.dut.send_expect(command, 'pipeline>')
- self.verify("Illegal" not in out, "Pipeline command error 1: '%s'" % command)
- self.verify("Bad" not in out, "Pipeline command error 2: '%s'" % command)
+ self.verify("arguments" not in out, "Incorrect arguments: '%s'" % command)
+ self.verify("Invalid" not in out, "Invalid argument: '%s'" % command)
+ self.verify("Syntax error" not in out, "Syntax error: '%s'" % command)
return out
- def pipeline_add_flow(self, port, src_ip, dst_ip, src_port, dst_port,
+ def pipeline_add_flow(self, port, src_ip, dst_ip, src_port, dst_port, flowid,
protocol=6):
- command = 'flow add %s %s %d %d %d %d' % (src_ip, dst_ip, src_port,
- dst_port, protocol, port)
+ command = 'p 1 flow add ipv4 %s %s %d %d %d port %d id %d' % (src_ip, dst_ip, src_port,
+ dst_port, protocol, port, flowid)
out = self.pipeline_command(command)
- self.verify("Adding flow" in out, "Add flow error")
+ self.verify("failed" not in out, "Add flow error")
def pipeline_del_flow(self, src_ip, dst_ip, src_port, dst_port,
protocol=6):
- command = 'flow del %s %s %d %d %d' % (src_ip, dst_ip, src_port,
+ command = 'p 1 flow del ipv4 %s %s %d %d %d' % (src_ip, dst_ip, src_port,
dst_port, protocol)
out = self.pipeline_command(command)
- self.verify("Deleting flow" in out, "Del flow error")
+ self.verify("failed" not in out, "Del flow error")
def pipeline_add_route(self, port, src_ip, netmask, gw_ip):
- command = 'route add %s %d %d %s' % (src_ip, netmask, port, gw_ip)
+ command = 'p 1 route add %s %d port %d ether %s' % (src_ip, netmask, port, gw_ip)
out = self.pipeline_command(command)
- self.verify("Adding route" in out, "Add route error")
+ self.verify("failed" not in out, "Add route error")
def pipeline_del_route(self, src_ip, netmask):
- command = 'route del %s %d' % (src_ip, netmask)
+ command = 'p 1 route del %s %d' % (src_ip, netmask)
out = self.pipeline_command(command)
- self.verify("Deleting route" in out, "Del route error")
-
- def pipeline_traffic_burst(self):
- self.dut.send_expect('link 0 up', 'pipeline>')
- self.dut.send_expect('link 1 up', 'pipeline>')
- sleep(0.1)
- self.dut.send_expect('link 0 down', 'pipeline>')
- self.dut.send_expect('link 1 down', 'pipeline>')
+ self.verify("failed" not in out, "Del route error")
def set_up_all(self):
"""
@@ -291,14 +319,8 @@ class TestIPPipeline(TestCase):
PMD prerequisites.
"""
- # Check for port availability
- self.needed_ports = {"niantic": 2,
- "I217V": 1,
- "I217LM": 1,
- "I218V": 1,
- "I218LM": 1}
self.dut_ports = self.dut.get_ports()
- self.verify(len(self.dut_ports) >= self.needed_ports[self.nic],
+ self.verify(len(self.dut_ports) >= 2,
"Insufficient ports for speed testing")
out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
@@ -324,9 +346,10 @@ class TestIPPipeline(TestCase):
pcap_file = 'ip_pipeline.pcap'
frame_size = 64
+ self.create_passthrough_cfgfile()
self.start_ip_pipeline(ports=self.ports_mask)
self.dut.send_expect(
- 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)
+ 'run examples/ip_pipeline/config/ip_pipeline.sh', 'pipeline>', 10)
# Create a PCAP file containing the maximum frames_number of frames needed
# with fixed size and incremental IP
@@ -342,13 +365,13 @@ class TestIPPipeline(TestCase):
stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
1, 0, inter)
- expected = {'tx': 0, 'rx': frames_number}
+ expected = {'rx0': frames_number, 'rx1': 0}
self.check_results(stats, expected)
stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
0, 1, inter)
- expected = {'tx': frames_number, 'rx': 0}
+ expected = {'rx0': 0, 'rx1': frames_number}
self.check_results(stats, expected)
def test_frame_sizes(self):
@@ -359,9 +382,10 @@ class TestIPPipeline(TestCase):
frames_number = 100
inter = 0.5
+ self.create_passthrough_cfgfile()
self.start_ip_pipeline(ports=self.ports_mask)
self.dut.send_expect(
- 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)
+ 'run examples/ip_pipeline/config/ip_pipeline.sh', 'pipeline>', 10)
for frame_size in TestIPPipeline.frame_sizes:
@@ -376,13 +400,13 @@ class TestIPPipeline(TestCase):
stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
1, 0, inter)
- expected = {'tx': 0, 'rx': frames_number}
+ expected = {'rx0': frames_number, 'rx1': 0}
self.check_results(stats, expected)
stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
0, 1, inter)
- expected = {'tx': frames_number, 'rx': 0}
+ expected = {'rx0': 0, 'rx1': frames_number}
self.check_results(stats, expected)
def test_flow_management(self):
@@ -392,11 +416,6 @@ class TestIPPipeline(TestCase):
pcap_file = 'ip_pipeline.pcap'
frame_size = 64
- default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
- 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
- 'route add 0.0.0.0 9 0 0.0.0.1',
- 'route add 0.128.0.0 9 1 0.128.0.1']
-
ip_addrs = [
'0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',
'0.0.1.0', '0.0.127.0', '0.0.128.0', '0.0.129.0', '0.0.255.0',
@@ -409,30 +428,32 @@ class TestIPPipeline(TestCase):
frames.append(self.create_tcp_ipv4_frame(0, '0.0.0.0', addr,
frame_size))
+ self.create_flow_cfgfile()
self.create_pcap_file_from_frames(pcap_file, frames)
self.tester.session.copy_file_to(pcap_file)
# Start ip_pipeline app and setup defaults
self.start_ip_pipeline(ports=self.ports_mask)
- for command in default_setup:
- self.pipeline_command(command)
+
+ # default to SINK0
+ self.pipeline_command('p 1 flow add default 2')
# Check that no traffic pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': 0}
+ expected = {'rx0': 0, 'rx1': 0}
self.check_results(stats, expected)
# Add the flows
flows_added = 0
for addrs in ip_addrs:
- self.pipeline_add_flow(1, '0.0.0.0', addrs, 0, 0)
+ self.pipeline_add_flow(0, '0.0.0.0', addrs, 0, 0, flows_added)
flows_added += 1
# Check that traffic matching flows pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': flows_added}
+ expected = {'rx0': flows_added, 'rx1': 0}
self.check_results(stats, expected)
# Remove flows
@@ -443,7 +464,7 @@ class TestIPPipeline(TestCase):
# Check that traffic matching flows pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': flows_added}
+ expected = {'rx0': flows_added, 'rx1': 0}
self.check_results(stats, expected)
out = self.dut.send_expect('flow print', 'pipeline>')
@@ -452,7 +473,7 @@ class TestIPPipeline(TestCase):
# Check that again no traffic pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': 0}
+ expected = {'rx0': 0, 'rx1': 0}
self.check_results(stats, expected)
self.quit_ip_pipeline()
@@ -464,9 +485,8 @@ class TestIPPipeline(TestCase):
pcap_file = 'ip_pipeline.pcap'
frame_size = 64
- default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
- 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
- 'flow add all']
+ default_setup = ['p 1 arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
+ 'p 1 arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f']
ip_addrs = [
'0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',
@@ -483,6 +503,7 @@ class TestIPPipeline(TestCase):
self.create_pcap_file_from_frames(pcap_file, frames)
self.tester.session.copy_file_to(pcap_file)
+ self.create_routing_cfgfile()
# Start ip_pipeline app and setup defaults
self.start_ip_pipeline(ports=self.ports_mask)
for command in default_setup:
@@ -491,7 +512,7 @@ class TestIPPipeline(TestCase):
# Check that no traffic pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': 0}
+ expected = {'rx0': 0, 'rx1': 0}
self.check_results(stats, expected)
# Add the routes
@@ -504,7 +525,7 @@ class TestIPPipeline(TestCase):
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': routes_added}
+ expected = {'rx0': routes_added, 'rx1': 0}
self.check_results(stats, expected)
# Remove routes
@@ -515,7 +536,7 @@ class TestIPPipeline(TestCase):
# Check that traffic matching flows pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': routes_added}
+ expected = {'rx0': routes_added, 'rx1': 0}
self.check_results(stats, expected)
out = self.dut.send_expect('route print', 'pipeline>')
@@ -524,7 +545,7 @@ class TestIPPipeline(TestCase):
# Check that again no traffic pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': 0}
+ expected = {'rx0': 0, 'rx1': 0}
self.check_results(stats, expected)
self.quit_ip_pipeline()
@@ -539,5 +560,7 @@ class TestIPPipeline(TestCase):
"""
Run after each test suite.
"""
+ self.dut.send_expect("rm /tmp/ip_pipeline.cfg", "#")
+ self.dut.send_expect("rm /tmp/ip_pipeline.cfg.out", "#")
out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
self.verify("Error" not in out, "Compilation error")
--
1.8.3.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dts] [PATCH] tests/ip_pipeline: fix test failures
2017-09-04 9:39 ` Radosław Biernacki
@ 2017-09-05 1:58 ` Jianbo Liu
2017-09-05 11:27 ` Radosław Biernacki
0 siblings, 1 reply; 12+ messages in thread
From: Jianbo Liu @ 2017-09-05 1:58 UTC (permalink / raw)
To: Radosław Biernacki; +Cc: dts, Herbert Guan
On 4 September 2017 at 17:39, Radosław Biernacki <rad@semihalf.com> wrote:
> 2017-08-21 12:30 GMT+02:00 Jianbo Liu <jianbo.liu@linaro.org>:
>>
>> The ip_pipeline was changed a lot, and the configuration and commands
>> are different from those in this testing case.
>>
>> Signed-off-by: Jianbo Liu <jianbo.liu@linaro.org>
>> ---
>> tests/TestSuite_ip_pipeline.py | 157
>> +++++++++++++++++++++++------------------
>> 1 file changed, 90 insertions(+), 67 deletions(-)
>>
>> diff --git a/tests/TestSuite_ip_pipeline.py
>> b/tests/TestSuite_ip_pipeline.py
>> index 90dba31..300b1de 100644
>> --- a/tests/TestSuite_ip_pipeline.py
>> +++ b/tests/TestSuite_ip_pipeline.py
>> @@ -124,11 +124,47 @@ class TestIPPipeline(TestCase):
>>
>> writer.close()
>>
>> + def create_passthrough_cfgfile(self):
>> + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg',
>> '#')
>> + self.dut.send_expect('echo type = MASTER >>
>> /tmp/ip_pipeline.cfg', '#')
>> + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg',
>> '#')
>> + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg',
>> '#')
>> + self.dut.send_expect('echo type = PASS-THROUGH >>
>> /tmp/ip_pipeline.cfg', '#')
>> + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg',
>> '#')
>> + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >>
>> /tmp/ip_pipeline.cfg', '#')
>> + self.dut.send_expect('echo pktq_out = TXQ1.0 TXQ0.0 >>
>> /tmp/ip_pipeline.cfg', '#')
>> +
>> + def create_routing_cfgfile(self):
>> + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg',
>> '#')
>> + self.dut.send_expect('echo type = MASTER >>
>> /tmp/ip_pipeline.cfg', '#')
>> + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg',
>> '#')
>> + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg',
>> '#')
>> + self.dut.send_expect('echo type = ROUTING >>
>> /tmp/ip_pipeline.cfg', '#')
>> + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg',
>> '#')
>> + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >>
>> /tmp/ip_pipeline.cfg', '#')
>> + self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 >>
>> /tmp/ip_pipeline.cfg', '#')
>> + self.dut.send_expect('echo encap = ethernet >>
>> /tmp/ip_pipeline.cfg', '#')
>> + self.dut.send_expect('echo ip_hdr_offset = 270 >>
>> /tmp/ip_pipeline.cfg', '#')
>> + self.dut.send_expect('echo arp_key_offset = 128 >>
>> /tmp/ip_pipeline.cfg', '#')
>> + self.dut.send_expect('echo n_arp_entries = 1000 >>
>> /tmp/ip_pipeline.cfg', '#')
>> +
>> + def create_flow_cfgfile(self):
>> + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg',
>> '#')
>> + self.dut.send_expect('echo type = MASTER >>
>> /tmp/ip_pipeline.cfg', '#')
>> + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg',
>> '#')
>> + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg',
>> '#')
>> + self.dut.send_expect('echo type = FLOW_CLASSIFICATION >>
>> /tmp/ip_pipeline.cfg', '#')
>> + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg',
>> '#')
>> + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >>
>> /tmp/ip_pipeline.cfg', '#')
>> + self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 SINK0 >>
>> /tmp/ip_pipeline.cfg', '#')
>> + self.dut.send_expect('echo n_flows = 65536 >>
>> /tmp/ip_pipeline.cfg', '#')
>> + self.dut.send_expect('echo key_size = 16 >>
>> /tmp/ip_pipeline.cfg', '#')
>> + self.dut.send_expect('echo key_offset = 278 >>
>> /tmp/ip_pipeline.cfg', '#')
>> + self.dut.send_expect('echo key_mask =
>> 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF >> /tmp/ip_pipeline.cfg', '#')
>> + self.dut.send_expect('echo flowid_offset = 128 >>
>> /tmp/ip_pipeline.cfg', '#')
>> +
>> def start_ip_pipeline(self, ports):
>> - command_line = "./examples/ip_pipeline/build/ip_pipeline -c %s -n
>> %d -- -p %s" % \
>> - (self.coremask,
>> - self.dut.get_memory_channels(),
>> - ports)
>> + command_line = "./examples/ip_pipeline/build/ip_pipeline -p %s -f
>> /tmp/ip_pipeline.cfg" % ports
>>
>> out = self.dut.send_expect(command_line, 'pipeline>', 60)
>> sleep(5) # 'Initialization completed' is not the last output,
>> some
>> @@ -150,10 +186,10 @@ class TestIPPipeline(TestCase):
>> """
>>
>> for iface in ifaces:
>> + command = ('rm -f tcpdump_{0}.pcap').format(iface)
>> + self.tester.send_expect(command, '#')
>> command = (
>> 'tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out
>> &').format(iface)
>> - self.tester.send_expect(
>> - 'rm -f tcpdump_{0}.pcap', '#').format(iface)
>> self.tester.send_expect(command, '#')
>>
>> def tcpdump_stop_sniff(self):
>> @@ -200,15 +236,13 @@ class TestIPPipeline(TestCase):
>>
>> tx_port = self.tester.get_local_port(self.dut_ports[from_port])
>> rx_port = self.tester.get_local_port(self.dut_ports[to_port])
>> + port0 = self.tester.get_local_port(self.dut_ports[0])
>>
>> tx_interface = self.tester.get_interface(tx_port)
>> rx_interface = self.tester.get_interface(rx_port)
>>
>> self.tcpdump_start_sniffing([tx_interface, rx_interface])
>>
>> - self.dut.send_expect('link 0 up', 'pipeline>')
>> - self.dut.send_expect('link 1 up', 'pipeline>')
>> -
>> timeout = frames_number * inter + 2
>> inter = ", inter=%d" % inter
>>
>> @@ -225,64 +259,58 @@ class TestIPPipeline(TestCase):
>>
>> self.tcpdump_stop_sniff()
>>
>> - self.dut.send_expect('link 0 down', 'pipeline>')
>> - self.dut.send_expect('link 1 down', 'pipeline>')
>> -
>> rx_stats = self.number_of_packets('tcpdump_%s.pcap' %
>> rx_interface)
>> tx_stats = self.number_of_packets('tcpdump_%s.pcap' %
>> tx_interface)
>>
>> # Do not count the sent frames in the tx_interface
>> tx_stats = tx_stats - frames_number
>>
>> - return {'rx': rx_stats, 'tx': tx_stats}
>> + if port0 == tx_port:
>> + return {'rx0': tx_stats, 'rx1': rx_stats}
>> + else:
>> + return {'rx0': rx_stats, 'rx1': tx_stats}
>>
>> def check_results(self, stats, expected):
>> """
>> - This function check that the Rx and Tx stats matches the
>> expected.
>> - expected = [Rx, Tx]
>> + This function check that the received packet numbers of port0 and
>> port1 match the expected.
>> + expected = [Rx0, Rx1]
>> """
>>
>> - for port in ['rx', 'tx']:
>> + for port in ['rx0', 'rx1']:
>> self.verify(stats[port] == expected[port],
>> 'Frames expected (%s) and received (%s) mismatch
>> on %s port' % (
>> expected[port], stats[port], port))
>>
>> def pipeline_command(self, command):
>> out = self.dut.send_expect(command, 'pipeline>')
>> - self.verify("Illegal" not in out, "Pipeline command error 1:
>> '%s'" % command)
>> - self.verify("Bad" not in out, "Pipeline command error 2: '%s'" %
>> command)
>> + self.verify("arguments" not in out, "Incorrect arguments: '%s'" %
>> command)
>> + self.verify("Invalid" not in out, "Invalid argument: '%s'" %
>> command)
>> + self.verify("Syntax error" not in out, "Syntax error: '%s'" %
>> command)
>> return out
>>
>> - def pipeline_add_flow(self, port, src_ip, dst_ip, src_port, dst_port,
>> + def pipeline_add_flow(self, port, src_ip, dst_ip, src_port, dst_port,
>> flowid,
>> protocol=6):
>> - command = 'flow add %s %s %d %d %d %d' % (src_ip, dst_ip,
>> src_port,
>> - dst_port, protocol,
>> port)
>> + command = 'p 1 flow add ipv4 %s %s %d %d %d port %d id %d' %
>> (src_ip, dst_ip, src_port,
>> + dst_port, protocol,
>> port, flowid)
>> out = self.pipeline_command(command)
>> - self.verify("Adding flow" in out, "Add flow error")
>> + self.verify("failed" not in out, "Add flow error")
>>
>> def pipeline_del_flow(self, src_ip, dst_ip, src_port, dst_port,
>> protocol=6):
>> - command = 'flow del %s %s %d %d %d' % (src_ip, dst_ip, src_port,
>> + command = 'p 1 flow del ipv4 %s %s %d %d %d' % (src_ip, dst_ip,
>> src_port,
>> dst_port, protocol)
>> out = self.pipeline_command(command)
>> - self.verify("Deleting flow" in out, "Del flow error")
>> + self.verify("failed" not in out, "Del flow error")
>>
>> def pipeline_add_route(self, port, src_ip, netmask, gw_ip):
>> - command = 'route add %s %d %d %s' % (src_ip, netmask, port,
>> gw_ip)
>> + command = 'p 1 route add %s %d port %d ether %s' % (src_ip,
>> netmask, port, gw_ip)
>> out = self.pipeline_command(command)
>> - self.verify("Adding route" in out, "Add route error")
>> + self.verify("failed" not in out, "Add route error")
>>
>> def pipeline_del_route(self, src_ip, netmask):
>> - command = 'route del %s %d' % (src_ip, netmask)
>> + command = 'p 1 route del %s %d' % (src_ip, netmask)
>> out = self.pipeline_command(command)
>> - self.verify("Deleting route" in out, "Del route error")
>> -
>> - def pipeline_traffic_burst(self):
>> - self.dut.send_expect('link 0 up', 'pipeline>')
>> - self.dut.send_expect('link 1 up', 'pipeline>')
>> - sleep(0.1)
>> - self.dut.send_expect('link 0 down', 'pipeline>')
>> - self.dut.send_expect('link 1 down', 'pipeline>')
>> + self.verify("failed" not in out, "Del route error")
>>
>> def set_up_all(self):
>> """
>> @@ -291,14 +319,8 @@ class TestIPPipeline(TestCase):
>> PMD prerequisites.
>> """
>>
>> - # Check for port availability
>> - self.needed_ports = {"niantic": 2,
>> - "I217V": 1,
>> - "I217LM": 1,
>> - "I218V": 1,
>> - "I218LM": 1}
>> self.dut_ports = self.dut.get_ports()
>> - self.verify(len(self.dut_ports) >= self.needed_ports[self.nic],
>> + self.verify(len(self.dut_ports) >= 2,
>> "Insufficient ports for speed testing")
>
>
> If we access both ports from remain parts of the code, than why we check for
> single port for specific platforms.
> In other words what was was the purpose of those removed lines?
>
I saw that 2 ports were used in the tests, so I think it's better to
remove them.
>>
>>
>> out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
>> @@ -324,9 +346,10 @@ class TestIPPipeline(TestCase):
>> pcap_file = 'ip_pipeline.pcap'
>> frame_size = 64
>>
>> + self.create_passthrough_cfgfile()
>> self.start_ip_pipeline(ports=self.ports_mask)
>> self.dut.send_expect(
>> - 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)
>> + 'run examples/ip_pipeline/config/ip_pipeline.sh',
>> 'pipeline>', 10)
>>
>> # Create a PCAP file containing the maximum frames_number of
>> frames needed
>> # with fixed size and incremental IP
>> @@ -342,13 +365,13 @@ class TestIPPipeline(TestCase):
>> stats = self.send_and_sniff_pcap_file(pcap_file,
>> frames_number,
>> 1, 0, inter)
>>
>> - expected = {'tx': 0, 'rx': frames_number}
>> + expected = {'rx0': frames_number, 'rx1': 0}
>> self.check_results(stats, expected)
>>
>> stats = self.send_and_sniff_pcap_file(pcap_file,
>> frames_number,
>> 0, 1, inter)
>>
>> - expected = {'tx': frames_number, 'rx': 0}
>> + expected = {'rx0': 0, 'rx1': frames_number}
>> self.check_results(stats, expected)
>>
>> def test_frame_sizes(self):
>> @@ -359,9 +382,10 @@ class TestIPPipeline(TestCase):
>> frames_number = 100
>> inter = 0.5
>>
>> + self.create_passthrough_cfgfile()
>> self.start_ip_pipeline(ports=self.ports_mask)
>> self.dut.send_expect(
>> - 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)
>> + 'run examples/ip_pipeline/config/ip_pipeline.sh',
>> 'pipeline>', 10)
>>
>> for frame_size in TestIPPipeline.frame_sizes:
>>
>> @@ -376,13 +400,13 @@ class TestIPPipeline(TestCase):
>> stats = self.send_and_sniff_pcap_file(pcap_file,
>> frames_number,
>> 1, 0, inter)
>>
>> - expected = {'tx': 0, 'rx': frames_number}
>> + expected = {'rx0': frames_number, 'rx1': 0}
>> self.check_results(stats, expected)
>>
>> stats = self.send_and_sniff_pcap_file(pcap_file,
>> frames_number,
>> 0, 1, inter)
>>
>> - expected = {'tx': frames_number, 'rx': 0}
>> + expected = {'rx0': 0, 'rx1': frames_number}
>> self.check_results(stats, expected)
>>
>> def test_flow_management(self):
>> @@ -392,11 +416,6 @@ class TestIPPipeline(TestCase):
>> pcap_file = 'ip_pipeline.pcap'
>> frame_size = 64
>>
>> - default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
>> - 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
>> - 'route add 0.0.0.0 9 0 0.0.0.1',
>> - 'route add 0.128.0.0 9 1 0.128.0.1']
>> -
>> ip_addrs = [
>> '0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',
>> '0.0.1.0', '0.0.127.0', '0.0.128.0', '0.0.129.0',
>> '0.0.255.0',
>> @@ -409,30 +428,32 @@ class TestIPPipeline(TestCase):
>> frames.append(self.create_tcp_ipv4_frame(0, '0.0.0.0', addr,
>> frame_size))
>>
>> + self.create_flow_cfgfile()
>> self.create_pcap_file_from_frames(pcap_file, frames)
>> self.tester.session.copy_file_to(pcap_file)
>>
>> # Start ip_pipeline app and setup defaults
>> self.start_ip_pipeline(ports=self.ports_mask)
>> - for command in default_setup:
>> - self.pipeline_command(command)
>> +
>> + # default to SINK0
>> + self.pipeline_command('p 1 flow add default 3')
>>
>> # Check that no traffic pass though
>> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
>> 1, 0, 0.2)
>> - expected = {'tx': 0, 'rx': 0}
>> + expected = {'rx0': 0, 'rx1': 0}
>> self.check_results(stats, expected)
>>
>> # Add the flows
>> flows_added = 0
>> for addrs in ip_addrs:
>> - self.pipeline_add_flow(1, '0.0.0.0', addrs, 0, 0)
>> + self.pipeline_add_flow(0, '0.0.0.0', addrs, 0, 0,
>> flows_added)
>> flows_added += 1
>>
>> # Check that traffic matching flows pass though
>> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
>> 1, 0, 0.2)
>> - expected = {'tx': 0, 'rx': flows_added}
>> + expected = {'rx0': flows_added, 'rx1': 0}
>> self.check_results(stats, expected)
>>
>> # Remove flows
>> @@ -443,7 +464,7 @@ class TestIPPipeline(TestCase):
>> # Check that traffic matching flows pass though
>> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
>> 1, 0, 0.2)
>> - expected = {'tx': 0, 'rx': flows_added}
>> + expected = {'rx0': flows_added, 'rx1': 0}
>> self.check_results(stats, expected)
>>
>> out = self.dut.send_expect('flow print', 'pipeline>')
>> @@ -452,7 +473,7 @@ class TestIPPipeline(TestCase):
>> # Check that again no traffic pass though
>> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
>> 1, 0, 0.2)
>> - expected = {'tx': 0, 'rx': 0}
>> + expected = {'rx0': 0, 'rx1': 0}
>> self.check_results(stats, expected)
>>
>> self.quit_ip_pipeline()
>> @@ -464,9 +485,8 @@ class TestIPPipeline(TestCase):
>> pcap_file = 'ip_pipeline.pcap'
>> frame_size = 64
>>
>> - default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
>> - 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
>> - 'flow add all']
>> + default_setup = ['p 1 arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
>> + 'p 1 arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f']
>>
>> ip_addrs = [
>> '0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',
>> @@ -483,6 +503,7 @@ class TestIPPipeline(TestCase):
>> self.create_pcap_file_from_frames(pcap_file, frames)
>> self.tester.session.copy_file_to(pcap_file)
>>
>> + self.create_routing_cfgfile()
>> # Start ip_pipeline app and setup defaults
>> self.start_ip_pipeline(ports=self.ports_mask)
>> for command in default_setup:
>> @@ -491,7 +512,7 @@ class TestIPPipeline(TestCase):
>> # Check that no traffic pass though
>> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
>> 1, 0, 0.2)
>> - expected = {'tx': 0, 'rx': 0}
>> + expected = {'rx0': 0, 'rx1': 0}
>> self.check_results(stats, expected)
>>
>> # Add the routes
>> @@ -504,7 +525,7 @@ class TestIPPipeline(TestCase):
>> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
>> 1, 0, 0.2)
>>
>> - expected = {'tx': 0, 'rx': routes_added}
>> + expected = {'rx0': routes_added, 'rx1': 0}
>> self.check_results(stats, expected)
>>
>> # Remove routes
>> @@ -515,7 +536,7 @@ class TestIPPipeline(TestCase):
>> # Check that traffic matching flows pass though
>> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
>> 1, 0, 0.2)
>> - expected = {'tx': 0, 'rx': routes_added}
>> + expected = {'rx0': routes_added, 'rx1': 0}
>> self.check_results(stats, expected)
>>
>> out = self.dut.send_expect('route print', 'pipeline>')
>> @@ -524,7 +545,7 @@ class TestIPPipeline(TestCase):
>> # Check that again no traffic pass though
>> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
>> 1, 0, 0.2)
>> - expected = {'tx': 0, 'rx': 0}
>> + expected = {'rx0': 0, 'rx1': 0}
>> self.check_results(stats, expected)
>>
>> self.quit_ip_pipeline()
>> @@ -539,5 +560,7 @@ class TestIPPipeline(TestCase):
>> """
>> Run after each test suite.
>> """
>> + self.dut.send_expect("rm /tmp/ip_pipeline.cfg", "#")
>> + self.dut.send_expect("rm /tmp/ip_pipeline.cfg.out", "#")
>> out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
>> self.verify("Error" not in out, "Compilation error")
>> --
>> 1.9.1
>>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dts] [PATCH] tests/ip_pipeline: fix test failures
2017-09-05 1:58 ` Jianbo Liu
@ 2017-09-05 11:27 ` Radosław Biernacki
0 siblings, 0 replies; 12+ messages in thread
From: Radosław Biernacki @ 2017-09-05 11:27 UTC (permalink / raw)
To: Jianbo Liu; +Cc: dts, Herbert Guan, yong.liu, rkerur
[-- Attachment #1: Type: text/plain, Size: 21668 bytes --]
I understand that. But do we also understand why this table was coded in
first place?
What was the reason of deal with those nics differently even if always
access both ports?
Yong Liu is an author of this test and Ravi Kerur added the change for nics
which require only 1 port.
Lets ask them for opinion.
2017-09-05 3:58 GMT+02:00 Jianbo Liu <jianbo.liu@linaro.org>:
> On 4 September 2017 at 17:39, Radosław Biernacki <rad@semihalf.com> wrote:
> > 2017-08-21 12:30 GMT+02:00 Jianbo Liu <jianbo.liu@linaro.org>:
> >>
> >> The ip_pipeline was changed a lot, and the configuration and commands
> >> are different from those in this testing case.
> >>
> >> Signed-off-by: Jianbo Liu <jianbo.liu@linaro.org>
> >> ---
> >> tests/TestSuite_ip_pipeline.py | 157
> >> +++++++++++++++++++++++------------------
> >> 1 file changed, 90 insertions(+), 67 deletions(-)
> >>
> >> diff --git a/tests/TestSuite_ip_pipeline.py
> >> b/tests/TestSuite_ip_pipeline.py
> >> index 90dba31..300b1de 100644
> >> --- a/tests/TestSuite_ip_pipeline.py
> >> +++ b/tests/TestSuite_ip_pipeline.py
> >> @@ -124,11 +124,47 @@ class TestIPPipeline(TestCase):
> >>
> >> writer.close()
> >>
> >> + def create_passthrough_cfgfile(self):
> >> + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg',
> >> '#')
> >> + self.dut.send_expect('echo type = MASTER >>
> >> /tmp/ip_pipeline.cfg', '#')
> >> + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg',
> >> '#')
> >> + self.dut.send_expect('echo [PIPELINE1] >>
> /tmp/ip_pipeline.cfg',
> >> '#')
> >> + self.dut.send_expect('echo type = PASS-THROUGH >>
> >> /tmp/ip_pipeline.cfg', '#')
> >> + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg',
> >> '#')
> >> + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >>
> >> /tmp/ip_pipeline.cfg', '#')
> >> + self.dut.send_expect('echo pktq_out = TXQ1.0 TXQ0.0 >>
> >> /tmp/ip_pipeline.cfg', '#')
> >> +
> >> + def create_routing_cfgfile(self):
> >> + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg',
> >> '#')
> >> + self.dut.send_expect('echo type = MASTER >>
> >> /tmp/ip_pipeline.cfg', '#')
> >> + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg',
> >> '#')
> >> + self.dut.send_expect('echo [PIPELINE1] >>
> /tmp/ip_pipeline.cfg',
> >> '#')
> >> + self.dut.send_expect('echo type = ROUTING >>
> >> /tmp/ip_pipeline.cfg', '#')
> >> + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg',
> >> '#')
> >> + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >>
> >> /tmp/ip_pipeline.cfg', '#')
> >> + self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 >>
> >> /tmp/ip_pipeline.cfg', '#')
> >> + self.dut.send_expect('echo encap = ethernet >>
> >> /tmp/ip_pipeline.cfg', '#')
> >> + self.dut.send_expect('echo ip_hdr_offset = 270 >>
> >> /tmp/ip_pipeline.cfg', '#')
> >> + self.dut.send_expect('echo arp_key_offset = 128 >>
> >> /tmp/ip_pipeline.cfg', '#')
> >> + self.dut.send_expect('echo n_arp_entries = 1000 >>
> >> /tmp/ip_pipeline.cfg', '#')
> >> +
> >> + def create_flow_cfgfile(self):
> >> + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg',
> >> '#')
> >> + self.dut.send_expect('echo type = MASTER >>
> >> /tmp/ip_pipeline.cfg', '#')
> >> + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg',
> >> '#')
> >> + self.dut.send_expect('echo [PIPELINE1] >>
> /tmp/ip_pipeline.cfg',
> >> '#')
> >> + self.dut.send_expect('echo type = FLOW_CLASSIFICATION >>
> >> /tmp/ip_pipeline.cfg', '#')
> >> + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg',
> >> '#')
> >> + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >>
> >> /tmp/ip_pipeline.cfg', '#')
> >> + self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 SINK0 >>
> >> /tmp/ip_pipeline.cfg', '#')
> >> + self.dut.send_expect('echo n_flows = 65536 >>
> >> /tmp/ip_pipeline.cfg', '#')
> >> + self.dut.send_expect('echo key_size = 16 >>
> >> /tmp/ip_pipeline.cfg', '#')
> >> + self.dut.send_expect('echo key_offset = 278 >>
> >> /tmp/ip_pipeline.cfg', '#')
> >> + self.dut.send_expect('echo key_mask =
> >> 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF >> /tmp/ip_pipeline.cfg', '#')
> >> + self.dut.send_expect('echo flowid_offset = 128 >>
> >> /tmp/ip_pipeline.cfg', '#')
> >> +
> >> def start_ip_pipeline(self, ports):
> >> - command_line = "./examples/ip_pipeline/build/ip_pipeline -c
> %s -n
> >> %d -- -p %s" % \
> >> - (self.coremask,
> >> - self.dut.get_memory_channels(),
> >> - ports)
> >> + command_line = "./examples/ip_pipeline/build/ip_pipeline -p
> %s -f
> >> /tmp/ip_pipeline.cfg" % ports
> >>
> >> out = self.dut.send_expect(command_line, 'pipeline>', 60)
> >> sleep(5) # 'Initialization completed' is not the last
> output,
> >> some
> >> @@ -150,10 +186,10 @@ class TestIPPipeline(TestCase):
> >> """
> >>
> >> for iface in ifaces:
> >> + command = ('rm -f tcpdump_{0}.pcap').format(iface)
> >> + self.tester.send_expect(command, '#')
> >> command = (
> >> 'tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out
> >> &').format(iface)
> >> - self.tester.send_expect(
> >> - 'rm -f tcpdump_{0}.pcap', '#').format(iface)
> >> self.tester.send_expect(command, '#')
> >>
> >> def tcpdump_stop_sniff(self):
> >> @@ -200,15 +236,13 @@ class TestIPPipeline(TestCase):
> >>
> >> tx_port = self.tester.get_local_port(
> self.dut_ports[from_port])
> >> rx_port = self.tester.get_local_port(self.dut_ports[to_port])
> >> + port0 = self.tester.get_local_port(self.dut_ports[0])
> >>
> >> tx_interface = self.tester.get_interface(tx_port)
> >> rx_interface = self.tester.get_interface(rx_port)
> >>
> >> self.tcpdump_start_sniffing([tx_interface, rx_interface])
> >>
> >> - self.dut.send_expect('link 0 up', 'pipeline>')
> >> - self.dut.send_expect('link 1 up', 'pipeline>')
> >> -
> >> timeout = frames_number * inter + 2
> >> inter = ", inter=%d" % inter
> >>
> >> @@ -225,64 +259,58 @@ class TestIPPipeline(TestCase):
> >>
> >> self.tcpdump_stop_sniff()
> >>
> >> - self.dut.send_expect('link 0 down', 'pipeline>')
> >> - self.dut.send_expect('link 1 down', 'pipeline>')
> >> -
> >> rx_stats = self.number_of_packets('tcpdump_%s.pcap' %
> >> rx_interface)
> >> tx_stats = self.number_of_packets('tcpdump_%s.pcap' %
> >> tx_interface)
> >>
> >> # Do not count the sent frames in the tx_interface
> >> tx_stats = tx_stats - frames_number
> >>
> >> - return {'rx': rx_stats, 'tx': tx_stats}
> >> + if port0 == tx_port:
> >> + return {'rx0': tx_stats, 'rx1': rx_stats}
> >> + else:
> >> + return {'rx0': rx_stats, 'rx1': tx_stats}
> >>
> >> def check_results(self, stats, expected):
> >> """
> >> - This function check that the Rx and Tx stats matches the
> >> expected.
> >> - expected = [Rx, Tx]
> >> + This function check that the received packet numbers of port0
> and
> >> port1 match the expected.
> >> + expected = [Rx0, Rx1]
> >> """
> >>
> >> - for port in ['rx', 'tx']:
> >> + for port in ['rx0', 'rx1']:
> >> self.verify(stats[port] == expected[port],
> >> 'Frames expected (%s) and received (%s)
> mismatch
> >> on %s port' % (
> >> expected[port], stats[port], port))
> >>
> >> def pipeline_command(self, command):
> >> out = self.dut.send_expect(command, 'pipeline>')
> >> - self.verify("Illegal" not in out, "Pipeline command error 1:
> >> '%s'" % command)
> >> - self.verify("Bad" not in out, "Pipeline command error 2: '%s'"
> %
> >> command)
> >> + self.verify("arguments" not in out, "Incorrect arguments:
> '%s'" %
> >> command)
> >> + self.verify("Invalid" not in out, "Invalid argument: '%s'" %
> >> command)
> >> + self.verify("Syntax error" not in out, "Syntax error: '%s'" %
> >> command)
> >> return out
> >>
> >> - def pipeline_add_flow(self, port, src_ip, dst_ip, src_port,
> dst_port,
> >> + def pipeline_add_flow(self, port, src_ip, dst_ip, src_port,
> dst_port,
> >> flowid,
> >> protocol=6):
> >> - command = 'flow add %s %s %d %d %d %d' % (src_ip, dst_ip,
> >> src_port,
> >> - dst_port, protocol,
> >> port)
> >> + command = 'p 1 flow add ipv4 %s %s %d %d %d port %d id %d' %
> >> (src_ip, dst_ip, src_port,
> >> + dst_port, protocol,
> >> port, flowid)
> >> out = self.pipeline_command(command)
> >> - self.verify("Adding flow" in out, "Add flow error")
> >> + self.verify("failed" not in out, "Add flow error")
> >>
> >> def pipeline_del_flow(self, src_ip, dst_ip, src_port, dst_port,
> >> protocol=6):
> >> - command = 'flow del %s %s %d %d %d' % (src_ip, dst_ip,
> src_port,
> >> + command = 'p 1 flow del ipv4 %s %s %d %d %d' % (src_ip, dst_ip,
> >> src_port,
> >> dst_port, protocol)
> >> out = self.pipeline_command(command)
> >> - self.verify("Deleting flow" in out, "Del flow error")
> >> + self.verify("failed" not in out, "Del flow error")
> >>
> >> def pipeline_add_route(self, port, src_ip, netmask, gw_ip):
> >> - command = 'route add %s %d %d %s' % (src_ip, netmask, port,
> >> gw_ip)
> >> + command = 'p 1 route add %s %d port %d ether %s' % (src_ip,
> >> netmask, port, gw_ip)
> >> out = self.pipeline_command(command)
> >> - self.verify("Adding route" in out, "Add route error")
> >> + self.verify("failed" not in out, "Add route error")
> >>
> >> def pipeline_del_route(self, src_ip, netmask):
> >> - command = 'route del %s %d' % (src_ip, netmask)
> >> + command = 'p 1 route del %s %d' % (src_ip, netmask)
> >> out = self.pipeline_command(command)
> >> - self.verify("Deleting route" in out, "Del route error")
> >> -
> >> - def pipeline_traffic_burst(self):
> >> - self.dut.send_expect('link 0 up', 'pipeline>')
> >> - self.dut.send_expect('link 1 up', 'pipeline>')
> >> - sleep(0.1)
> >> - self.dut.send_expect('link 0 down', 'pipeline>')
> >> - self.dut.send_expect('link 1 down', 'pipeline>')
> >> + self.verify("failed" not in out, "Del route error")
> >>
> >> def set_up_all(self):
> >> """
> >> @@ -291,14 +319,8 @@ class TestIPPipeline(TestCase):
> >> PMD prerequisites.
> >> """
> >>
> >> - # Check for port availability
> >> - self.needed_ports = {"niantic": 2,
> >> - "I217V": 1,
> >> - "I217LM": 1,
> >> - "I218V": 1,
> >> - "I218LM": 1}
> >> self.dut_ports = self.dut.get_ports()
> >> - self.verify(len(self.dut_ports) >=
> self.needed_ports[self.nic],
> >> + self.verify(len(self.dut_ports) >= 2,
> >> "Insufficient ports for speed testing")
> >
> >
> > If we access both ports from remain parts of the code, than why we check
> for
> > single port for specific platforms.
> > In other words what was was the purpose of those removed lines?
> >
>
> I saw that 2 ports were used in the tests, so I think it's better to
> remove them.
>
> >>
> >>
> >> out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
> >> @@ -324,9 +346,10 @@ class TestIPPipeline(TestCase):
> >> pcap_file = 'ip_pipeline.pcap'
> >> frame_size = 64
> >>
> >> + self.create_passthrough_cfgfile()
> >> self.start_ip_pipeline(ports=self.ports_mask)
> >> self.dut.send_expect(
> >> - 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>',
> 10)
> >> + 'run examples/ip_pipeline/config/ip_pipeline.sh',
> >> 'pipeline>', 10)
> >>
> >> # Create a PCAP file containing the maximum frames_number of
> >> frames needed
> >> # with fixed size and incremental IP
> >> @@ -342,13 +365,13 @@ class TestIPPipeline(TestCase):
> >> stats = self.send_and_sniff_pcap_file(pcap_file,
> >> frames_number,
> >> 1, 0, inter)
> >>
> >> - expected = {'tx': 0, 'rx': frames_number}
> >> + expected = {'rx0': frames_number, 'rx1': 0}
> >> self.check_results(stats, expected)
> >>
> >> stats = self.send_and_sniff_pcap_file(pcap_file,
> >> frames_number,
> >> 0, 1, inter)
> >>
> >> - expected = {'tx': frames_number, 'rx': 0}
> >> + expected = {'rx0': 0, 'rx1': frames_number}
> >> self.check_results(stats, expected)
> >>
> >> def test_frame_sizes(self):
> >> @@ -359,9 +382,10 @@ class TestIPPipeline(TestCase):
> >> frames_number = 100
> >> inter = 0.5
> >>
> >> + self.create_passthrough_cfgfile()
> >> self.start_ip_pipeline(ports=self.ports_mask)
> >> self.dut.send_expect(
> >> - 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>',
> 10)
> >> + 'run examples/ip_pipeline/config/ip_pipeline.sh',
> >> 'pipeline>', 10)
> >>
> >> for frame_size in TestIPPipeline.frame_sizes:
> >>
> >> @@ -376,13 +400,13 @@ class TestIPPipeline(TestCase):
> >> stats = self.send_and_sniff_pcap_file(pcap_file,
> >> frames_number,
> >> 1, 0, inter)
> >>
> >> - expected = {'tx': 0, 'rx': frames_number}
> >> + expected = {'rx0': frames_number, 'rx1': 0}
> >> self.check_results(stats, expected)
> >>
> >> stats = self.send_and_sniff_pcap_file(pcap_file,
> >> frames_number,
> >> 0, 1, inter)
> >>
> >> - expected = {'tx': frames_number, 'rx': 0}
> >> + expected = {'rx0': 0, 'rx1': frames_number}
> >> self.check_results(stats, expected)
> >>
> >> def test_flow_management(self):
> >> @@ -392,11 +416,6 @@ class TestIPPipeline(TestCase):
> >> pcap_file = 'ip_pipeline.pcap'
> >> frame_size = 64
> >>
> >> - default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
> >> - 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
> >> - 'route add 0.0.0.0 9 0 0.0.0.1',
> >> - 'route add 0.128.0.0 9 1 0.128.0.1']
> >> -
> >> ip_addrs = [
> >> '0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128',
> '0.0.0.255',
> >> '0.0.1.0', '0.0.127.0', '0.0.128.0', '0.0.129.0',
> >> '0.0.255.0',
> >> @@ -409,30 +428,32 @@ class TestIPPipeline(TestCase):
> >> frames.append(self.create_tcp_ipv4_frame(0, '0.0.0.0',
> addr,
> >> frame_size))
> >>
> >> + self.create_flow_cfgfile()
> >> self.create_pcap_file_from_frames(pcap_file, frames)
> >> self.tester.session.copy_file_to(pcap_file)
> >>
> >> # Start ip_pipeline app and setup defaults
> >> self.start_ip_pipeline(ports=self.ports_mask)
> >> - for command in default_setup:
> >> - self.pipeline_command(command)
> >> +
> >> + # default to SINK0
> >> + self.pipeline_command('p 1 flow add default 3')
> >>
> >> # Check that no traffic pass though
> >> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> >> 1, 0, 0.2)
> >> - expected = {'tx': 0, 'rx': 0}
> >> + expected = {'rx0': 0, 'rx1': 0}
> >> self.check_results(stats, expected)
> >>
> >> # Add the flows
> >> flows_added = 0
> >> for addrs in ip_addrs:
> >> - self.pipeline_add_flow(1, '0.0.0.0', addrs, 0, 0)
> >> + self.pipeline_add_flow(0, '0.0.0.0', addrs, 0, 0,
> >> flows_added)
> >> flows_added += 1
> >>
> >> # Check that traffic matching flows pass though
> >> stats = self.send_and_sniff_pcap_file(pcap_file,
> len(frames),
> >> 1, 0, 0.2)
> >> - expected = {'tx': 0, 'rx': flows_added}
> >> + expected = {'rx0': flows_added, 'rx1': 0}
> >> self.check_results(stats, expected)
> >>
> >> # Remove flows
> >> @@ -443,7 +464,7 @@ class TestIPPipeline(TestCase):
> >> # Check that traffic matching flows pass though
> >> stats = self.send_and_sniff_pcap_file(pcap_file,
> len(frames),
> >> 1, 0, 0.2)
> >> - expected = {'tx': 0, 'rx': flows_added}
> >> + expected = {'rx0': flows_added, 'rx1': 0}
> >> self.check_results(stats, expected)
> >>
> >> out = self.dut.send_expect('flow print', 'pipeline>')
> >> @@ -452,7 +473,7 @@ class TestIPPipeline(TestCase):
> >> # Check that again no traffic pass though
> >> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> >> 1, 0, 0.2)
> >> - expected = {'tx': 0, 'rx': 0}
> >> + expected = {'rx0': 0, 'rx1': 0}
> >> self.check_results(stats, expected)
> >>
> >> self.quit_ip_pipeline()
> >> @@ -464,9 +485,8 @@ class TestIPPipeline(TestCase):
> >> pcap_file = 'ip_pipeline.pcap'
> >> frame_size = 64
> >>
> >> - default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
> >> - 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
> >> - 'flow add all']
> >> + default_setup = ['p 1 arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
> >> + 'p 1 arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f']
> >>
> >> ip_addrs = [
> >> '0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128',
> '0.0.0.255',
> >> @@ -483,6 +503,7 @@ class TestIPPipeline(TestCase):
> >> self.create_pcap_file_from_frames(pcap_file, frames)
> >> self.tester.session.copy_file_to(pcap_file)
> >>
> >> + self.create_routing_cfgfile()
> >> # Start ip_pipeline app and setup defaults
> >> self.start_ip_pipeline(ports=self.ports_mask)
> >> for command in default_setup:
> >> @@ -491,7 +512,7 @@ class TestIPPipeline(TestCase):
> >> # Check that no traffic pass though
> >> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> >> 1, 0, 0.2)
> >> - expected = {'tx': 0, 'rx': 0}
> >> + expected = {'rx0': 0, 'rx1': 0}
> >> self.check_results(stats, expected)
> >>
> >> # Add the routes
> >> @@ -504,7 +525,7 @@ class TestIPPipeline(TestCase):
> >> stats = self.send_and_sniff_pcap_file(pcap_file,
> len(frames),
> >> 1, 0, 0.2)
> >>
> >> - expected = {'tx': 0, 'rx': routes_added}
> >> + expected = {'rx0': routes_added, 'rx1': 0}
> >> self.check_results(stats, expected)
> >>
> >> # Remove routes
> >> @@ -515,7 +536,7 @@ class TestIPPipeline(TestCase):
> >> # Check that traffic matching flows pass though
> >> stats = self.send_and_sniff_pcap_file(pcap_file,
> len(frames),
> >> 1, 0, 0.2)
> >> - expected = {'tx': 0, 'rx': routes_added}
> >> + expected = {'rx0': routes_added, 'rx1': 0}
> >> self.check_results(stats, expected)
> >>
> >> out = self.dut.send_expect('route print', 'pipeline>')
> >> @@ -524,7 +545,7 @@ class TestIPPipeline(TestCase):
> >> # Check that again no traffic pass though
> >> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> >> 1, 0, 0.2)
> >> - expected = {'tx': 0, 'rx': 0}
> >> + expected = {'rx0': 0, 'rx1': 0}
> >> self.check_results(stats, expected)
> >>
> >> self.quit_ip_pipeline()
> >> @@ -539,5 +560,7 @@ class TestIPPipeline(TestCase):
> >> """
> >> Run after each test suite.
> >> """
> >> + self.dut.send_expect("rm /tmp/ip_pipeline.cfg", "#")
> >> + self.dut.send_expect("rm /tmp/ip_pipeline.cfg.out", "#")
> >> out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
> >> self.verify("Error" not in out, "Compilation error")
> >> --
> >> 1.9.1
> >>
> >
>
[-- Attachment #2: Type: text/html, Size: 30464 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dts] [PATCH v2] tests/ip_pipeline: fix test failures
2017-09-05 1:54 ` [dts] [PATCH v2] " Jianbo Liu
@ 2017-09-11 3:13 ` Jianbo Liu
2017-09-11 7:14 ` Liu, Yong
0 siblings, 1 reply; 12+ messages in thread
From: Jianbo Liu @ 2017-09-11 3:13 UTC (permalink / raw)
To: dts; +Cc: Jianbo Liu
Any comment about v2 ?
On 5 September 2017 at 09:54, Jianbo Liu <jianbo.liu@linaro.org> wrote:
> The ip_pipeline was changed a lot, and the configuration and commands
> are different from those in this testing case.
>
> Signed-off-by: Jianbo Liu <jianbo.liu@linaro.org>
> ---
> tests/TestSuite_ip_pipeline.py | 157 +++++++++++++++++++++++------------------
> 1 file changed, 90 insertions(+), 67 deletions(-)
>
> diff --git a/tests/TestSuite_ip_pipeline.py b/tests/TestSuite_ip_pipeline.py
> index 90dba31..003cd03 100644
> --- a/tests/TestSuite_ip_pipeline.py
> +++ b/tests/TestSuite_ip_pipeline.py
> @@ -124,11 +124,47 @@ class TestIPPipeline(TestCase):
>
> writer.close()
>
> + def create_passthrough_cfgfile(self):
> + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo type = MASTER >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo type = PASS-THROUGH >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo pktq_out = TXQ1.0 TXQ0.0 >> /tmp/ip_pipeline.cfg', '#')
> +
> + def create_routing_cfgfile(self):
> + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo type = MASTER >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo type = ROUTING >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo encap = ethernet >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo ip_hdr_offset = 270 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo arp_key_offset = 128 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo n_arp_entries = 1000 >> /tmp/ip_pipeline.cfg', '#')
> +
> + def create_flow_cfgfile(self):
> + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo type = MASTER >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo type = FLOW_CLASSIFICATION >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 SINK0 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo n_flows = 65536 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo key_size = 16 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo key_offset = 278 >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo key_mask = 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF >> /tmp/ip_pipeline.cfg', '#')
> + self.dut.send_expect('echo flowid_offset = 128 >> /tmp/ip_pipeline.cfg', '#')
> +
> def start_ip_pipeline(self, ports):
> - command_line = "./examples/ip_pipeline/build/ip_pipeline -c %s -n %d -- -p %s" % \
> - (self.coremask,
> - self.dut.get_memory_channels(),
> - ports)
> + command_line = "./examples/ip_pipeline/build/ip_pipeline -p %s -f /tmp/ip_pipeline.cfg" % ports
>
> out = self.dut.send_expect(command_line, 'pipeline>', 60)
> sleep(5) # 'Initialization completed' is not the last output, some
> @@ -150,10 +186,10 @@ class TestIPPipeline(TestCase):
> """
>
> for iface in ifaces:
> + command = ('rm -f tcpdump_{0}.pcap').format(iface)
> + self.tester.send_expect(command, '#')
> command = (
> 'tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out &').format(iface)
> - self.tester.send_expect(
> - 'rm -f tcpdump_{0}.pcap', '#').format(iface)
> self.tester.send_expect(command, '#')
>
> def tcpdump_stop_sniff(self):
> @@ -200,15 +236,13 @@ class TestIPPipeline(TestCase):
>
> tx_port = self.tester.get_local_port(self.dut_ports[from_port])
> rx_port = self.tester.get_local_port(self.dut_ports[to_port])
> + port0 = self.tester.get_local_port(self.dut_ports[0])
>
> tx_interface = self.tester.get_interface(tx_port)
> rx_interface = self.tester.get_interface(rx_port)
>
> self.tcpdump_start_sniffing([tx_interface, rx_interface])
>
> - self.dut.send_expect('link 0 up', 'pipeline>')
> - self.dut.send_expect('link 1 up', 'pipeline>')
> -
> timeout = frames_number * inter + 2
> inter = ", inter=%d" % inter
>
> @@ -225,64 +259,58 @@ class TestIPPipeline(TestCase):
>
> self.tcpdump_stop_sniff()
>
> - self.dut.send_expect('link 0 down', 'pipeline>')
> - self.dut.send_expect('link 1 down', 'pipeline>')
> -
> rx_stats = self.number_of_packets('tcpdump_%s.pcap' % rx_interface)
> tx_stats = self.number_of_packets('tcpdump_%s.pcap' % tx_interface)
>
> # Do not count the sent frames in the tx_interface
> tx_stats = tx_stats - frames_number
>
> - return {'rx': rx_stats, 'tx': tx_stats}
> + if port0 == tx_port:
> + return {'rx0': tx_stats, 'rx1': rx_stats}
> + else:
> + return {'rx0': rx_stats, 'rx1': tx_stats}
>
> def check_results(self, stats, expected):
> """
> - This function check that the Rx and Tx stats matches the expected.
> - expected = [Rx, Tx]
> + This function check that the received packet numbers of port0 and port1 match the expected.
> + expected = [Rx0, Rx1]
> """
>
> - for port in ['rx', 'tx']:
> + for port in ['rx0', 'rx1']:
> self.verify(stats[port] == expected[port],
> 'Frames expected (%s) and received (%s) mismatch on %s port' % (
> expected[port], stats[port], port))
>
> def pipeline_command(self, command):
> out = self.dut.send_expect(command, 'pipeline>')
> - self.verify("Illegal" not in out, "Pipeline command error 1: '%s'" % command)
> - self.verify("Bad" not in out, "Pipeline command error 2: '%s'" % command)
> + self.verify("arguments" not in out, "Incorrect arguments: '%s'" % command)
> + self.verify("Invalid" not in out, "Invalid argument: '%s'" % command)
> + self.verify("Syntax error" not in out, "Syntax error: '%s'" % command)
> return out
>
> - def pipeline_add_flow(self, port, src_ip, dst_ip, src_port, dst_port,
> + def pipeline_add_flow(self, port, src_ip, dst_ip, src_port, dst_port, flowid,
> protocol=6):
> - command = 'flow add %s %s %d %d %d %d' % (src_ip, dst_ip, src_port,
> - dst_port, protocol, port)
> + command = 'p 1 flow add ipv4 %s %s %d %d %d port %d id %d' % (src_ip, dst_ip, src_port,
> + dst_port, protocol, port, flowid)
> out = self.pipeline_command(command)
> - self.verify("Adding flow" in out, "Add flow error")
> + self.verify("failed" not in out, "Add flow error")
>
> def pipeline_del_flow(self, src_ip, dst_ip, src_port, dst_port,
> protocol=6):
> - command = 'flow del %s %s %d %d %d' % (src_ip, dst_ip, src_port,
> + command = 'p 1 flow del ipv4 %s %s %d %d %d' % (src_ip, dst_ip, src_port,
> dst_port, protocol)
> out = self.pipeline_command(command)
> - self.verify("Deleting flow" in out, "Del flow error")
> + self.verify("failed" not in out, "Del flow error")
>
> def pipeline_add_route(self, port, src_ip, netmask, gw_ip):
> - command = 'route add %s %d %d %s' % (src_ip, netmask, port, gw_ip)
> + command = 'p 1 route add %s %d port %d ether %s' % (src_ip, netmask, port, gw_ip)
> out = self.pipeline_command(command)
> - self.verify("Adding route" in out, "Add route error")
> + self.verify("failed" not in out, "Add route error")
>
> def pipeline_del_route(self, src_ip, netmask):
> - command = 'route del %s %d' % (src_ip, netmask)
> + command = 'p 1 route del %s %d' % (src_ip, netmask)
> out = self.pipeline_command(command)
> - self.verify("Deleting route" in out, "Del route error")
> -
> - def pipeline_traffic_burst(self):
> - self.dut.send_expect('link 0 up', 'pipeline>')
> - self.dut.send_expect('link 1 up', 'pipeline>')
> - sleep(0.1)
> - self.dut.send_expect('link 0 down', 'pipeline>')
> - self.dut.send_expect('link 1 down', 'pipeline>')
> + self.verify("failed" not in out, "Del route error")
>
> def set_up_all(self):
> """
> @@ -291,14 +319,8 @@ class TestIPPipeline(TestCase):
> PMD prerequisites.
> """
>
> - # Check for port availability
> - self.needed_ports = {"niantic": 2,
> - "I217V": 1,
> - "I217LM": 1,
> - "I218V": 1,
> - "I218LM": 1}
> self.dut_ports = self.dut.get_ports()
> - self.verify(len(self.dut_ports) >= self.needed_ports[self.nic],
> + self.verify(len(self.dut_ports) >= 2,
> "Insufficient ports for speed testing")
>
> out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
> @@ -324,9 +346,10 @@ class TestIPPipeline(TestCase):
> pcap_file = 'ip_pipeline.pcap'
> frame_size = 64
>
> + self.create_passthrough_cfgfile()
> self.start_ip_pipeline(ports=self.ports_mask)
> self.dut.send_expect(
> - 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)
> + 'run examples/ip_pipeline/config/ip_pipeline.sh', 'pipeline>', 10)
>
> # Create a PCAP file containing the maximum frames_number of frames needed
> # with fixed size and incremental IP
> @@ -342,13 +365,13 @@ class TestIPPipeline(TestCase):
> stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
> 1, 0, inter)
>
> - expected = {'tx': 0, 'rx': frames_number}
> + expected = {'rx0': frames_number, 'rx1': 0}
> self.check_results(stats, expected)
>
> stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
> 0, 1, inter)
>
> - expected = {'tx': frames_number, 'rx': 0}
> + expected = {'rx0': 0, 'rx1': frames_number}
> self.check_results(stats, expected)
>
> def test_frame_sizes(self):
> @@ -359,9 +382,10 @@ class TestIPPipeline(TestCase):
> frames_number = 100
> inter = 0.5
>
> + self.create_passthrough_cfgfile()
> self.start_ip_pipeline(ports=self.ports_mask)
> self.dut.send_expect(
> - 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)
> + 'run examples/ip_pipeline/config/ip_pipeline.sh', 'pipeline>', 10)
>
> for frame_size in TestIPPipeline.frame_sizes:
>
> @@ -376,13 +400,13 @@ class TestIPPipeline(TestCase):
> stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
> 1, 0, inter)
>
> - expected = {'tx': 0, 'rx': frames_number}
> + expected = {'rx0': frames_number, 'rx1': 0}
> self.check_results(stats, expected)
>
> stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
> 0, 1, inter)
>
> - expected = {'tx': frames_number, 'rx': 0}
> + expected = {'rx0': 0, 'rx1': frames_number}
> self.check_results(stats, expected)
>
> def test_flow_management(self):
> @@ -392,11 +416,6 @@ class TestIPPipeline(TestCase):
> pcap_file = 'ip_pipeline.pcap'
> frame_size = 64
>
> - default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
> - 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
> - 'route add 0.0.0.0 9 0 0.0.0.1',
> - 'route add 0.128.0.0 9 1 0.128.0.1']
> -
> ip_addrs = [
> '0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',
> '0.0.1.0', '0.0.127.0', '0.0.128.0', '0.0.129.0', '0.0.255.0',
> @@ -409,30 +428,32 @@ class TestIPPipeline(TestCase):
> frames.append(self.create_tcp_ipv4_frame(0, '0.0.0.0', addr,
> frame_size))
>
> + self.create_flow_cfgfile()
> self.create_pcap_file_from_frames(pcap_file, frames)
> self.tester.session.copy_file_to(pcap_file)
>
> # Start ip_pipeline app and setup defaults
> self.start_ip_pipeline(ports=self.ports_mask)
> - for command in default_setup:
> - self.pipeline_command(command)
> +
> + # default to SINK0
> + self.pipeline_command('p 1 flow add default 2')
>
> # Check that no traffic pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': 0}
> + expected = {'rx0': 0, 'rx1': 0}
> self.check_results(stats, expected)
>
> # Add the flows
> flows_added = 0
> for addrs in ip_addrs:
> - self.pipeline_add_flow(1, '0.0.0.0', addrs, 0, 0)
> + self.pipeline_add_flow(0, '0.0.0.0', addrs, 0, 0, flows_added)
> flows_added += 1
>
> # Check that traffic matching flows pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': flows_added}
> + expected = {'rx0': flows_added, 'rx1': 0}
> self.check_results(stats, expected)
>
> # Remove flows
> @@ -443,7 +464,7 @@ class TestIPPipeline(TestCase):
> # Check that traffic matching flows pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': flows_added}
> + expected = {'rx0': flows_added, 'rx1': 0}
> self.check_results(stats, expected)
>
> out = self.dut.send_expect('flow print', 'pipeline>')
> @@ -452,7 +473,7 @@ class TestIPPipeline(TestCase):
> # Check that again no traffic pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': 0}
> + expected = {'rx0': 0, 'rx1': 0}
> self.check_results(stats, expected)
>
> self.quit_ip_pipeline()
> @@ -464,9 +485,8 @@ class TestIPPipeline(TestCase):
> pcap_file = 'ip_pipeline.pcap'
> frame_size = 64
>
> - default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
> - 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
> - 'flow add all']
> + default_setup = ['p 1 arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
> + 'p 1 arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f']
>
> ip_addrs = [
> '0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',
> @@ -483,6 +503,7 @@ class TestIPPipeline(TestCase):
> self.create_pcap_file_from_frames(pcap_file, frames)
> self.tester.session.copy_file_to(pcap_file)
>
> + self.create_routing_cfgfile()
> # Start ip_pipeline app and setup defaults
> self.start_ip_pipeline(ports=self.ports_mask)
> for command in default_setup:
> @@ -491,7 +512,7 @@ class TestIPPipeline(TestCase):
> # Check that no traffic pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': 0}
> + expected = {'rx0': 0, 'rx1': 0}
> self.check_results(stats, expected)
>
> # Add the routes
> @@ -504,7 +525,7 @@ class TestIPPipeline(TestCase):
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
>
> - expected = {'tx': 0, 'rx': routes_added}
> + expected = {'rx0': routes_added, 'rx1': 0}
> self.check_results(stats, expected)
>
> # Remove routes
> @@ -515,7 +536,7 @@ class TestIPPipeline(TestCase):
> # Check that traffic matching flows pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': routes_added}
> + expected = {'rx0': routes_added, 'rx1': 0}
> self.check_results(stats, expected)
>
> out = self.dut.send_expect('route print', 'pipeline>')
> @@ -524,7 +545,7 @@ class TestIPPipeline(TestCase):
> # Check that again no traffic pass though
> stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> 1, 0, 0.2)
> - expected = {'tx': 0, 'rx': 0}
> + expected = {'rx0': 0, 'rx1': 0}
> self.check_results(stats, expected)
>
> self.quit_ip_pipeline()
> @@ -539,5 +560,7 @@ class TestIPPipeline(TestCase):
> """
> Run after each test suite.
> """
> + self.dut.send_expect("rm /tmp/ip_pipeline.cfg", "#")
> + self.dut.send_expect("rm /tmp/ip_pipeline.cfg.out", "#")
> out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
> self.verify("Error" not in out, "Compilation error")
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dts] [PATCH v2] tests/ip_pipeline: fix test failures
2017-09-11 3:13 ` Jianbo Liu
@ 2017-09-11 7:14 ` Liu, Yong
0 siblings, 0 replies; 12+ messages in thread
From: Liu, Yong @ 2017-09-11 7:14 UTC (permalink / raw)
To: Jianbo Liu, dts
Jianbo,
One issue occurred when I'm running this suite. Please check with my comment.
Thanks,
Marvin
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Jianbo Liu
> Sent: Monday, September 11, 2017 11:14 AM
> To: dts@dpdk.org
> Cc: Jianbo Liu <jianbo.liu@linaro.org>
> Subject: Re: [dts] [PATCH v2] tests/ip_pipeline: fix test failures
>
> Any comment about v2 ?
>
> On 5 September 2017 at 09:54, Jianbo Liu <jianbo.liu@linaro.org> wrote:
> > The ip_pipeline was changed a lot, and the configuration and commands
> > are different from those in this testing case.
> >
> > Signed-off-by: Jianbo Liu <jianbo.liu@linaro.org>
> > ---
> > tests/TestSuite_ip_pipeline.py | 157 +++++++++++++++++++++++-----------
> -------
> > 1 file changed, 90 insertions(+), 67 deletions(-)
> >
> > diff --git a/tests/TestSuite_ip_pipeline.py
> b/tests/TestSuite_ip_pipeline.py
> > index 90dba31..003cd03 100644
> > --- a/tests/TestSuite_ip_pipeline.py
> > +++ b/tests/TestSuite_ip_pipeline.py
> > @@ -124,11 +124,47 @@ class TestIPPipeline(TestCase):
> >
> > writer.close()
> >
> > + def create_passthrough_cfgfile(self):
> > + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo type = MASTER >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo type = PASS-THROUGH >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo pktq_out = TXQ1.0 TXQ0.0 >>
> /tmp/ip_pipeline.cfg', '#')
> > +
> > + def create_routing_cfgfile(self):
Please add some descriptions for like function.
> > + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo type = MASTER >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo type = ROUTING >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo encap = ethernet >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo ip_hdr_offset = 270 >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo arp_key_offset = 128 >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo n_arp_entries = 1000 >>
> /tmp/ip_pipeline.cfg', '#')
> > +
> > + def create_flow_cfgfile(self):
Please add some descriptions for like function.
> > + self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo type = MASTER >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo type = FLOW_CLASSIFICATION >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg',
> '#')
> > + self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 SINK0 >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo n_flows = 65536 >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo key_size = 16 >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo key_offset = 278 >>
> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo key_mask =
> 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF >> /tmp/ip_pipeline.cfg', '#')
> > + self.dut.send_expect('echo flowid_offset = 128 >>
> /tmp/ip_pipeline.cfg', '#')
> > +
> > def start_ip_pipeline(self, ports):
> > - command_line = "./examples/ip_pipeline/build/ip_pipeline -c %s
> -n %d -- -p %s" % \
> > - (self.coremask,
> > - self.dut.get_memory_channels(),
> > - ports)
> > + command_line = "./examples/ip_pipeline/build/ip_pipeline -p %s
> -f /tmp/ip_pipeline.cfg" % ports
> >
> > out = self.dut.send_expect(command_line, 'pipeline>', 60)
> > sleep(5) # 'Initialization completed' is not the last output,
> some
> > @@ -150,10 +186,10 @@ class TestIPPipeline(TestCase):
> > """
> >
> > for iface in ifaces:
> > + command = ('rm -f tcpdump_{0}.pcap').format(iface)
> > + self.tester.send_expect(command, '#')
> > command = (
> > 'tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out
> &').format(iface)
> > - self.tester.send_expect(
> > - 'rm -f tcpdump_{0}.pcap', '#').format(iface)
> > self.tester.send_expect(command, '#')
> >
> > def tcpdump_stop_sniff(self):
> > @@ -200,15 +236,13 @@ class TestIPPipeline(TestCase):
> >
> > tx_port = self.tester.get_local_port(self.dut_ports[from_port])
> > rx_port = self.tester.get_local_port(self.dut_ports[to_port])
> > + port0 = self.tester.get_local_port(self.dut_ports[0])
> >
> > tx_interface = self.tester.get_interface(tx_port)
> > rx_interface = self.tester.get_interface(rx_port)
> >
> > self.tcpdump_start_sniffing([tx_interface, rx_interface])
> >
> > - self.dut.send_expect('link 0 up', 'pipeline>')
> > - self.dut.send_expect('link 1 up', 'pipeline>')
> > -
> > timeout = frames_number * inter + 2
> > inter = ", inter=%d" % inter
> >
> > @@ -225,64 +259,58 @@ class TestIPPipeline(TestCase):
> >
> > self.tcpdump_stop_sniff()
> >
> > - self.dut.send_expect('link 0 down', 'pipeline>')
> > - self.dut.send_expect('link 1 down', 'pipeline>')
> > -
> > rx_stats = self.number_of_packets('tcpdump_%s.pcap' %
> rx_interface)
> > tx_stats = self.number_of_packets('tcpdump_%s.pcap' %
> tx_interface)
> >
> > # Do not count the sent frames in the tx_interface
> > tx_stats = tx_stats - frames_number
> >
> > - return {'rx': rx_stats, 'tx': tx_stats}
> > + if port0 == tx_port:
> > + return {'rx0': tx_stats, 'rx1': rx_stats}
> > + else:
> > + return {'rx0': rx_stats, 'rx1': tx_stats}
> >
> > def check_results(self, stats, expected):
> > """
> > - This function check that the Rx and Tx stats matches the
> expected.
> > - expected = [Rx, Tx]
> > + This function check that the received packet numbers of port0
> and port1 match the expected.
> > + expected = [Rx0, Rx1]
> > """
> >
> > - for port in ['rx', 'tx']:
> > + for port in ['rx0', 'rx1']:
> > self.verify(stats[port] == expected[port],
> > 'Frames expected (%s) and received (%s)
> mismatch on %s port' % (
> > expected[port], stats[port], port))
> >
> > def pipeline_command(self, command):
> > out = self.dut.send_expect(command, 'pipeline>')
> > - self.verify("Illegal" not in out, "Pipeline command error 1:
> '%s'" % command)
> > - self.verify("Bad" not in out, "Pipeline command error 2: '%s'" %
> command)
> > + self.verify("arguments" not in out, "Incorrect arguments:
> '%s'" % command)
> > + self.verify("Invalid" not in out, "Invalid argument: '%s'" %
> command)
> > + self.verify("Syntax error" not in out, "Syntax error: '%s'" %
> command)
> > return out
> >
> > - def pipeline_add_flow(self, port, src_ip, dst_ip, src_port,
> dst_port,
> > + def pipeline_add_flow(self, port, src_ip, dst_ip, src_port,
> dst_port, flowid,
> > protocol=6):
> > - command = 'flow add %s %s %d %d %d %d' % (src_ip, dst_ip,
> src_port,
> > - dst_port, protocol,
> port)
> > + command = 'p 1 flow add ipv4 %s %s %d %d %d port %d id %d' %
> (src_ip, dst_ip, src_port,
> > + dst_port, protocol,
> port, flowid)
> > out = self.pipeline_command(command)
> > - self.verify("Adding flow" in out, "Add flow error")
> > + self.verify("failed" not in out, "Add flow error")
> >
> > def pipeline_del_flow(self, src_ip, dst_ip, src_port, dst_port,
> > protocol=6):
> > - command = 'flow del %s %s %d %d %d' % (src_ip, dst_ip, src_port,
> > + command = 'p 1 flow del ipv4 %s %s %d %d %d' % (src_ip, dst_ip,
> src_port,
> > dst_port, protocol)
> > out = self.pipeline_command(command)
> > - self.verify("Deleting flow" in out, "Del flow error")
> > + self.verify("failed" not in out, "Del flow error")
> >
> > def pipeline_add_route(self, port, src_ip, netmask, gw_ip):
> > - command = 'route add %s %d %d %s' % (src_ip, netmask, port,
> gw_ip)
> > + command = 'p 1 route add %s %d port %d ether %s' % (src_ip,
> netmask, port, gw_ip)
> > out = self.pipeline_command(command)
> > - self.verify("Adding route" in out, "Add route error")
> > + self.verify("failed" not in out, "Add route error")
> >
> > def pipeline_del_route(self, src_ip, netmask):
> > - command = 'route del %s %d' % (src_ip, netmask)
> > + command = 'p 1 route del %s %d' % (src_ip, netmask)
> > out = self.pipeline_command(command)
> > - self.verify("Deleting route" in out, "Del route error")
> > -
> > - def pipeline_traffic_burst(self):
> > - self.dut.send_expect('link 0 up', 'pipeline>')
> > - self.dut.send_expect('link 1 up', 'pipeline>')
> > - sleep(0.1)
> > - self.dut.send_expect('link 0 down', 'pipeline>')
> > - self.dut.send_expect('link 1 down', 'pipeline>')
> > + self.verify("failed" not in out, "Del route error")
> >
> > def set_up_all(self):
> > """
> > @@ -291,14 +319,8 @@ class TestIPPipeline(TestCase):
> > PMD prerequisites.
> > """
> >
> > - # Check for port availability
> > - self.needed_ports = {"niantic": 2,
> > - "I217V": 1,
> > - "I217LM": 1,
> > - "I218V": 1,
> > - "I218LM": 1}
> > self.dut_ports = self.dut.get_ports()
> > - self.verify(len(self.dut_ports) >= self.needed_ports[self.nic],
> > + self.verify(len(self.dut_ports) >= 2,
> > "Insufficient ports for speed testing")
> >
> > out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
> > @@ -324,9 +346,10 @@ class TestIPPipeline(TestCase):
> > pcap_file = 'ip_pipeline.pcap'
> > frame_size = 64
> >
> > + self.create_passthrough_cfgfile()
> > self.start_ip_pipeline(ports=self.ports_mask)
> > self.dut.send_expect(
> > - 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)
> > + 'run examples/ip_pipeline/config/ip_pipeline.sh',
> 'pipeline>', 10)
> >
> > # Create a PCAP file containing the maximum frames_number of
> frames needed
> > # with fixed size and incremental IP
> > @@ -342,13 +365,13 @@ class TestIPPipeline(TestCase):
> > stats = self.send_and_sniff_pcap_file(pcap_file,
> frames_number,
> > 1, 0, inter)
> >
> > - expected = {'tx': 0, 'rx': frames_number}
> > + expected = {'rx0': frames_number, 'rx1': 0}
> > self.check_results(stats, expected)
> >
> > stats = self.send_and_sniff_pcap_file(pcap_file,
> frames_number,
> > 0, 1, inter)
> >
> > - expected = {'tx': frames_number, 'rx': 0}
> > + expected = {'rx0': 0, 'rx1': frames_number}
> > self.check_results(stats, expected)
> >
> > def test_frame_sizes(self):
> > @@ -359,9 +382,10 @@ class TestIPPipeline(TestCase):
> > frames_number = 100
> > inter = 0.5
> >
> > + self.create_passthrough_cfgfile()
> > self.start_ip_pipeline(ports=self.ports_mask)
> > self.dut.send_expect(
> > - 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)
> > + 'run examples/ip_pipeline/config/ip_pipeline.sh',
> 'pipeline>', 10)
> >
> > for frame_size in TestIPPipeline.frame_sizes:
> >
> > @@ -376,13 +400,13 @@ class TestIPPipeline(TestCase):
> > stats = self.send_and_sniff_pcap_file(pcap_file,
> frames_number,
> > 1, 0, inter)
> >
> > - expected = {'tx': 0, 'rx': frames_number}
> > + expected = {'rx0': frames_number, 'rx1': 0}
> > self.check_results(stats, expected)
> >
> > stats = self.send_and_sniff_pcap_file(pcap_file,
> frames_number,
> > 0, 1, inter)
> >
> > - expected = {'tx': frames_number, 'rx': 0}
> > + expected = {'rx0': 0, 'rx1': frames_number}
> > self.check_results(stats, expected)
> >
> > def test_flow_management(self):
> > @@ -392,11 +416,6 @@ class TestIPPipeline(TestCase):
> > pcap_file = 'ip_pipeline.pcap'
> > frame_size = 64
> >
> > - default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
> > - 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
> > - 'route add 0.0.0.0 9 0 0.0.0.1',
> > - 'route add 0.128.0.0 9 1 0.128.0.1']
> > -
> > ip_addrs = [
> > '0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',
> > '0.0.1.0', '0.0.127.0', '0.0.128.0', '0.0.129.0',
> '0.0.255.0',
> > @@ -409,30 +428,32 @@ class TestIPPipeline(TestCase):
> > frames.append(self.create_tcp_ipv4_frame(0, '0.0.0.0', addr,
> > frame_size))
> >
> > + self.create_flow_cfgfile()
> > self.create_pcap_file_from_frames(pcap_file, frames)
> > self.tester.session.copy_file_to(pcap_file)
> >
> > # Start ip_pipeline app and setup defaults
> > self.start_ip_pipeline(ports=self.ports_mask)
> > - for command in default_setup:
> > - self.pipeline_command(command)
> > +
> > + # default to SINK0
> > + self.pipeline_command('p 1 flow add default 2')
> >
> > # Check that no traffic pass though
> > stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> > 1, 0, 0.2)
> > - expected = {'tx': 0, 'rx': 0}
> > + expected = {'rx0': 0, 'rx1': 0}
> > self.check_results(stats, expected)
> >
> > # Add the flows
> > flows_added = 0
> > for addrs in ip_addrs:
> > - self.pipeline_add_flow(1, '0.0.0.0', addrs, 0, 0)
> > + self.pipeline_add_flow(0, '0.0.0.0', addrs, 0, 0,
> flows_added)
> > flows_added += 1
> >
> > # Check that traffic matching flows pass though
> > stats = self.send_and_sniff_pcap_file(pcap_file,
> len(frames),
> > 1, 0, 0.2)
> > - expected = {'tx': 0, 'rx': flows_added}
> > + expected = {'rx0': flows_added, 'rx1': 0}
> > self.check_results(stats, expected)
> >
> > # Remove flows
> > @@ -443,7 +464,7 @@ class TestIPPipeline(TestCase):
> > # Check that traffic matching flows pass though
> > stats = self.send_and_sniff_pcap_file(pcap_file,
> len(frames),
> > 1, 0, 0.2)
> > - expected = {'tx': 0, 'rx': flows_added}
> > + expected = {'rx0': flows_added, 'rx1': 0}
> > self.check_results(stats, expected)
> >
> > out = self.dut.send_expect('flow print', 'pipeline>')
> > @@ -452,7 +473,7 @@ class TestIPPipeline(TestCase):
> > # Check that again no traffic pass though
> > stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> > 1, 0, 0.2)
> > - expected = {'tx': 0, 'rx': 0}
> > + expected = {'rx0': 0, 'rx1': 0}
> > self.check_results(stats, expected)
> >
> > self.quit_ip_pipeline()
> > @@ -464,9 +485,8 @@ class TestIPPipeline(TestCase):
> > pcap_file = 'ip_pipeline.pcap'
> > frame_size = 64
> >
> > - default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
> > - 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
> > - 'flow add all']
> > + default_setup = ['p 1 arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
> > + 'p 1 arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f']
> >
> > ip_addrs = [
> > '0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',
> > @@ -483,6 +503,7 @@ class TestIPPipeline(TestCase):
> > self.create_pcap_file_from_frames(pcap_file, frames)
> > self.tester.session.copy_file_to(pcap_file)
> >
> > + self.create_routing_cfgfile()
> > # Start ip_pipeline app and setup defaults
> > self.start_ip_pipeline(ports=self.ports_mask)
> > for command in default_setup:
> > @@ -491,7 +512,7 @@ class TestIPPipeline(TestCase):
> > # Check that no traffic pass though
> > stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> > 1, 0, 0.2)
> > - expected = {'tx': 0, 'rx': 0}
> > + expected = {'rx0': 0, 'rx1': 0}
> > self.check_results(stats, expected)
> >
> > # Add the routes
> > @@ -504,7 +525,7 @@ class TestIPPipeline(TestCase):
> > stats = self.send_and_sniff_pcap_file(pcap_file,
> len(frames),
> > 1, 0, 0.2)
> >
> > - expected = {'tx': 0, 'rx': routes_added}
> > + expected = {'rx0': routes_added, 'rx1': 0}
> > self.check_results(stats, expected)
> >
> > # Remove routes
> > @@ -515,7 +536,7 @@ class TestIPPipeline(TestCase):
> > # Check that traffic matching flows pass though
> > stats = self.send_and_sniff_pcap_file(pcap_file,
> len(frames),
> > 1, 0, 0.2)
> > - expected = {'tx': 0, 'rx': routes_added}
> > + expected = {'rx0': routes_added, 'rx1': 0}
> > self.check_results(stats, expected)
> >
> > out = self.dut.send_expect('route print', 'pipeline>')
> > @@ -524,7 +545,7 @@ class TestIPPipeline(TestCase):
> > # Check that again no traffic pass though
> > stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
> > 1, 0, 0.2)
> > - expected = {'tx': 0, 'rx': 0}
> > + expected = {'rx0': 0, 'rx1': 0}
> > self.check_results(stats, expected)
> >
> > self.quit_ip_pipeline()
> > @@ -539,5 +560,7 @@ class TestIPPipeline(TestCase):
> > """
> > Run after each test suite.
> > """
> > + self.dut.send_expect("rm /tmp/ip_pipeline.cfg", "#")
> > + self.dut.send_expect("rm /tmp/ip_pipeline.cfg.out", "#")
Can't work on my platform, please add force option.
> > out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
> > self.verify("Error" not in out, "Compilation error")
> > --
> > 1.8.3.1
> >
^ permalink raw reply [flat|nested] 12+ messages in thread
* [dts] [PATCH v3] tests/ip_pipeline: fix test failures
2017-08-21 10:30 [dts] [PATCH] tests/ip_pipeline: fix test failures Jianbo Liu
` (2 preceding siblings ...)
2017-09-05 1:54 ` [dts] [PATCH v2] " Jianbo Liu
@ 2017-09-12 3:31 ` Jianbo Liu
2017-09-12 23:34 ` Liu, Yong
3 siblings, 1 reply; 12+ messages in thread
From: Jianbo Liu @ 2017-09-12 3:31 UTC (permalink / raw)
To: dts, herbert.guan; +Cc: Jianbo Liu
The ip_pipeline was changed a lot, and the configuration and commands
are different from those in this testing case.
v2:
- the sink0 id is 2.
v3:
- add more comments for cfg file creations.
- remove temporary files with force in case they don't exist.
Signed-off-by: Jianbo Liu <jianbo.liu@linaro.org>
---
tests/TestSuite_ip_pipeline.py | 172 +++++++++++++++++++++++++----------------
1 file changed, 105 insertions(+), 67 deletions(-)
diff --git a/tests/TestSuite_ip_pipeline.py b/tests/TestSuite_ip_pipeline.py
index 90dba31..76a477f 100644
--- a/tests/TestSuite_ip_pipeline.py
+++ b/tests/TestSuite_ip_pipeline.py
@@ -124,11 +124,62 @@ class TestIPPipeline(TestCase):
writer.close()
+ def create_passthrough_cfgfile(self):
+ """
+ Create configuration file for passthrough pipeline.
+ Two ports are connected as follows: RXQ0.0 -> TXQ1.0, RXQ1.0 -> TXQ0.0.
+ """
+
+ self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo type = MASTER >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo type = PASS-THROUGH >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo pktq_out = TXQ1.0 TXQ0.0 >> /tmp/ip_pipeline.cfg', '#')
+
+ def create_routing_cfgfile(self):
+ """
+ Create configuration file for ip routing pipeline.
+ It is mainly to set ip header offset and arp key offset in the packet buffer.
+ """
+
+ self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo type = MASTER >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo type = ROUTING >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo encap = ethernet >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo ip_hdr_offset = 270 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo arp_key_offset = 128 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo n_arp_entries = 1000 >> /tmp/ip_pipeline.cfg', '#')
+
+ def create_flow_cfgfile(self):
+ """
+ Create configuration file for flow classification pipeline.
+ It is mainly to set key size, offset and mask to get the ipv4 5-tuple.
+ """
+
+ self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo type = MASTER >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo type = FLOW_CLASSIFICATION >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 SINK0 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo n_flows = 65536 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo key_size = 16 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo key_offset = 278 >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo key_mask = 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF >> /tmp/ip_pipeline.cfg', '#')
+ self.dut.send_expect('echo flowid_offset = 128 >> /tmp/ip_pipeline.cfg', '#')
+
def start_ip_pipeline(self, ports):
- command_line = "./examples/ip_pipeline/build/ip_pipeline -c %s -n %d -- -p %s" % \
- (self.coremask,
- self.dut.get_memory_channels(),
- ports)
+ command_line = "./examples/ip_pipeline/build/ip_pipeline -p %s -f /tmp/ip_pipeline.cfg" % ports
out = self.dut.send_expect(command_line, 'pipeline>', 60)
sleep(5) # 'Initialization completed' is not the last output, some
@@ -150,10 +201,10 @@ class TestIPPipeline(TestCase):
"""
for iface in ifaces:
+ command = ('rm -f tcpdump_{0}.pcap').format(iface)
+ self.tester.send_expect(command, '#')
command = (
'tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out &').format(iface)
- self.tester.send_expect(
- 'rm -f tcpdump_{0}.pcap', '#').format(iface)
self.tester.send_expect(command, '#')
def tcpdump_stop_sniff(self):
@@ -200,15 +251,13 @@ class TestIPPipeline(TestCase):
tx_port = self.tester.get_local_port(self.dut_ports[from_port])
rx_port = self.tester.get_local_port(self.dut_ports[to_port])
+ port0 = self.tester.get_local_port(self.dut_ports[0])
tx_interface = self.tester.get_interface(tx_port)
rx_interface = self.tester.get_interface(rx_port)
self.tcpdump_start_sniffing([tx_interface, rx_interface])
- self.dut.send_expect('link 0 up', 'pipeline>')
- self.dut.send_expect('link 1 up', 'pipeline>')
-
timeout = frames_number * inter + 2
inter = ", inter=%d" % inter
@@ -225,64 +274,58 @@ class TestIPPipeline(TestCase):
self.tcpdump_stop_sniff()
- self.dut.send_expect('link 0 down', 'pipeline>')
- self.dut.send_expect('link 1 down', 'pipeline>')
-
rx_stats = self.number_of_packets('tcpdump_%s.pcap' % rx_interface)
tx_stats = self.number_of_packets('tcpdump_%s.pcap' % tx_interface)
# Do not count the sent frames in the tx_interface
tx_stats = tx_stats - frames_number
- return {'rx': rx_stats, 'tx': tx_stats}
+ if port0 == tx_port:
+ return {'rx0': tx_stats, 'rx1': rx_stats}
+ else:
+ return {'rx0': rx_stats, 'rx1': tx_stats}
def check_results(self, stats, expected):
"""
- This function check that the Rx and Tx stats matches the expected.
- expected = [Rx, Tx]
+ This function check that the received packet numbers of port0 and port1 match the expected.
+ expected = [Rx0, Rx1]
"""
- for port in ['rx', 'tx']:
+ for port in ['rx0', 'rx1']:
self.verify(stats[port] == expected[port],
'Frames expected (%s) and received (%s) mismatch on %s port' % (
expected[port], stats[port], port))
def pipeline_command(self, command):
out = self.dut.send_expect(command, 'pipeline>')
- self.verify("Illegal" not in out, "Pipeline command error 1: '%s'" % command)
- self.verify("Bad" not in out, "Pipeline command error 2: '%s'" % command)
+ self.verify("arguments" not in out, "Incorrect arguments: '%s'" % command)
+ self.verify("Invalid" not in out, "Invalid argument: '%s'" % command)
+ self.verify("Syntax error" not in out, "Syntax error: '%s'" % command)
return out
- def pipeline_add_flow(self, port, src_ip, dst_ip, src_port, dst_port,
+ def pipeline_add_flow(self, port, src_ip, dst_ip, src_port, dst_port, flowid,
protocol=6):
- command = 'flow add %s %s %d %d %d %d' % (src_ip, dst_ip, src_port,
- dst_port, protocol, port)
+ command = 'p 1 flow add ipv4 %s %s %d %d %d port %d id %d' % (src_ip, dst_ip, src_port,
+ dst_port, protocol, port, flowid)
out = self.pipeline_command(command)
- self.verify("Adding flow" in out, "Add flow error")
+ self.verify("failed" not in out, "Add flow error")
def pipeline_del_flow(self, src_ip, dst_ip, src_port, dst_port,
protocol=6):
- command = 'flow del %s %s %d %d %d' % (src_ip, dst_ip, src_port,
+ command = 'p 1 flow del ipv4 %s %s %d %d %d' % (src_ip, dst_ip, src_port,
dst_port, protocol)
out = self.pipeline_command(command)
- self.verify("Deleting flow" in out, "Del flow error")
+ self.verify("failed" not in out, "Del flow error")
def pipeline_add_route(self, port, src_ip, netmask, gw_ip):
- command = 'route add %s %d %d %s' % (src_ip, netmask, port, gw_ip)
+ command = 'p 1 route add %s %d port %d ether %s' % (src_ip, netmask, port, gw_ip)
out = self.pipeline_command(command)
- self.verify("Adding route" in out, "Add route error")
+ self.verify("failed" not in out, "Add route error")
def pipeline_del_route(self, src_ip, netmask):
- command = 'route del %s %d' % (src_ip, netmask)
+ command = 'p 1 route del %s %d' % (src_ip, netmask)
out = self.pipeline_command(command)
- self.verify("Deleting route" in out, "Del route error")
-
- def pipeline_traffic_burst(self):
- self.dut.send_expect('link 0 up', 'pipeline>')
- self.dut.send_expect('link 1 up', 'pipeline>')
- sleep(0.1)
- self.dut.send_expect('link 0 down', 'pipeline>')
- self.dut.send_expect('link 1 down', 'pipeline>')
+ self.verify("failed" not in out, "Del route error")
def set_up_all(self):
"""
@@ -291,14 +334,8 @@ class TestIPPipeline(TestCase):
PMD prerequisites.
"""
- # Check for port availability
- self.needed_ports = {"niantic": 2,
- "I217V": 1,
- "I217LM": 1,
- "I218V": 1,
- "I218LM": 1}
self.dut_ports = self.dut.get_ports()
- self.verify(len(self.dut_ports) >= self.needed_ports[self.nic],
+ self.verify(len(self.dut_ports) >= 2,
"Insufficient ports for speed testing")
out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
@@ -324,9 +361,10 @@ class TestIPPipeline(TestCase):
pcap_file = 'ip_pipeline.pcap'
frame_size = 64
+ self.create_passthrough_cfgfile()
self.start_ip_pipeline(ports=self.ports_mask)
self.dut.send_expect(
- 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)
+ 'run examples/ip_pipeline/config/ip_pipeline.sh', 'pipeline>', 10)
# Create a PCAP file containing the maximum frames_number of frames needed
# with fixed size and incremental IP
@@ -342,13 +380,13 @@ class TestIPPipeline(TestCase):
stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
1, 0, inter)
- expected = {'tx': 0, 'rx': frames_number}
+ expected = {'rx0': frames_number, 'rx1': 0}
self.check_results(stats, expected)
stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
0, 1, inter)
- expected = {'tx': frames_number, 'rx': 0}
+ expected = {'rx0': 0, 'rx1': frames_number}
self.check_results(stats, expected)
def test_frame_sizes(self):
@@ -359,9 +397,10 @@ class TestIPPipeline(TestCase):
frames_number = 100
inter = 0.5
+ self.create_passthrough_cfgfile()
self.start_ip_pipeline(ports=self.ports_mask)
self.dut.send_expect(
- 'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)
+ 'run examples/ip_pipeline/config/ip_pipeline.sh', 'pipeline>', 10)
for frame_size in TestIPPipeline.frame_sizes:
@@ -376,13 +415,13 @@ class TestIPPipeline(TestCase):
stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
1, 0, inter)
- expected = {'tx': 0, 'rx': frames_number}
+ expected = {'rx0': frames_number, 'rx1': 0}
self.check_results(stats, expected)
stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
0, 1, inter)
- expected = {'tx': frames_number, 'rx': 0}
+ expected = {'rx0': 0, 'rx1': frames_number}
self.check_results(stats, expected)
def test_flow_management(self):
@@ -392,11 +431,6 @@ class TestIPPipeline(TestCase):
pcap_file = 'ip_pipeline.pcap'
frame_size = 64
- default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
- 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
- 'route add 0.0.0.0 9 0 0.0.0.1',
- 'route add 0.128.0.0 9 1 0.128.0.1']
-
ip_addrs = [
'0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',
'0.0.1.0', '0.0.127.0', '0.0.128.0', '0.0.129.0', '0.0.255.0',
@@ -409,30 +443,32 @@ class TestIPPipeline(TestCase):
frames.append(self.create_tcp_ipv4_frame(0, '0.0.0.0', addr,
frame_size))
+ self.create_flow_cfgfile()
self.create_pcap_file_from_frames(pcap_file, frames)
self.tester.session.copy_file_to(pcap_file)
# Start ip_pipeline app and setup defaults
self.start_ip_pipeline(ports=self.ports_mask)
- for command in default_setup:
- self.pipeline_command(command)
+
+ # default to SINK0
+ self.pipeline_command('p 1 flow add default 2')
# Check that no traffic pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': 0}
+ expected = {'rx0': 0, 'rx1': 0}
self.check_results(stats, expected)
# Add the flows
flows_added = 0
for addrs in ip_addrs:
- self.pipeline_add_flow(1, '0.0.0.0', addrs, 0, 0)
+ self.pipeline_add_flow(0, '0.0.0.0', addrs, 0, 0, flows_added)
flows_added += 1
# Check that traffic matching flows pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': flows_added}
+ expected = {'rx0': flows_added, 'rx1': 0}
self.check_results(stats, expected)
# Remove flows
@@ -443,7 +479,7 @@ class TestIPPipeline(TestCase):
# Check that traffic matching flows pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': flows_added}
+ expected = {'rx0': flows_added, 'rx1': 0}
self.check_results(stats, expected)
out = self.dut.send_expect('flow print', 'pipeline>')
@@ -452,7 +488,7 @@ class TestIPPipeline(TestCase):
# Check that again no traffic pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': 0}
+ expected = {'rx0': 0, 'rx1': 0}
self.check_results(stats, expected)
self.quit_ip_pipeline()
@@ -464,9 +500,8 @@ class TestIPPipeline(TestCase):
pcap_file = 'ip_pipeline.pcap'
frame_size = 64
- default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
- 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',
- 'flow add all']
+ default_setup = ['p 1 arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',
+ 'p 1 arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f']
ip_addrs = [
'0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',
@@ -483,6 +518,7 @@ class TestIPPipeline(TestCase):
self.create_pcap_file_from_frames(pcap_file, frames)
self.tester.session.copy_file_to(pcap_file)
+ self.create_routing_cfgfile()
# Start ip_pipeline app and setup defaults
self.start_ip_pipeline(ports=self.ports_mask)
for command in default_setup:
@@ -491,7 +527,7 @@ class TestIPPipeline(TestCase):
# Check that no traffic pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': 0}
+ expected = {'rx0': 0, 'rx1': 0}
self.check_results(stats, expected)
# Add the routes
@@ -504,7 +540,7 @@ class TestIPPipeline(TestCase):
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': routes_added}
+ expected = {'rx0': routes_added, 'rx1': 0}
self.check_results(stats, expected)
# Remove routes
@@ -515,7 +551,7 @@ class TestIPPipeline(TestCase):
# Check that traffic matching flows pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': routes_added}
+ expected = {'rx0': routes_added, 'rx1': 0}
self.check_results(stats, expected)
out = self.dut.send_expect('route print', 'pipeline>')
@@ -524,7 +560,7 @@ class TestIPPipeline(TestCase):
# Check that again no traffic pass though
stats = self.send_and_sniff_pcap_file(pcap_file, len(frames),
1, 0, 0.2)
- expected = {'tx': 0, 'rx': 0}
+ expected = {'rx0': 0, 'rx1': 0}
self.check_results(stats, expected)
self.quit_ip_pipeline()
@@ -539,5 +575,7 @@ class TestIPPipeline(TestCase):
"""
Run after each test suite.
"""
+ self.dut.send_expect("rm -f /tmp/ip_pipeline.cfg", "#")
+ self.dut.send_expect("rm -f /tmp/ip_pipeline.cfg.out", "#")
out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
self.verify("Error" not in out, "Compilation error")
--
1.9.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dts] [PATCH v3] tests/ip_pipeline: fix test failures
2017-09-12 3:31 ` [dts] [PATCH v3] " Jianbo Liu
@ 2017-09-12 23:34 ` Liu, Yong
0 siblings, 0 replies; 12+ messages in thread
From: Liu, Yong @ 2017-09-12 23:34 UTC (permalink / raw)
To: Jianbo Liu, dts, herbert.guan
Thanks Jianbo. Applied in master branch.
On 09/12/2017 11:31 AM, Jianbo Liu wrote:
> The ip_pipeline was changed a lot, and the configuration and commands
> are different from those in this testing case.
>
> v2:
> - the sink0 id is 2.
>
> v3:
> - add more comments for cfg file creations.
> - remove temporary files with force in case they don't exist.
>
> Signed-off-by: Jianbo Liu<jianbo.liu@linaro.org>
> ---
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2017-09-12 14:51 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-21 10:30 [dts] [PATCH] tests/ip_pipeline: fix test failures Jianbo Liu
2017-09-04 6:31 ` Jianbo Liu
2017-09-04 8:50 ` Liu, Yong
2017-09-04 9:33 ` Jianbo Liu
2017-09-04 9:39 ` Radosław Biernacki
2017-09-05 1:58 ` Jianbo Liu
2017-09-05 11:27 ` Radosław Biernacki
2017-09-05 1:54 ` [dts] [PATCH v2] " Jianbo Liu
2017-09-11 3:13 ` Jianbo Liu
2017-09-11 7:14 ` Liu, Yong
2017-09-12 3:31 ` [dts] [PATCH v3] " Jianbo Liu
2017-09-12 23:34 ` 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).