<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2017-08-21 12:30 GMT+02:00 Jianbo Liu <span dir="ltr"><<a href="mailto:jianbo.liu@linaro.org" target="_blank">jianbo.liu@linaro.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The ip_pipeline was changed a lot, and the configuration and commands<br>
are different from those in this testing case.<br>
<br>
Signed-off-by: Jianbo Liu <<a href="mailto:jianbo.liu@linaro.org">jianbo.liu@linaro.org</a>><br>
---<br>
tests/TestSuite_ip_pipeline.py | 157 +++++++++++++++++++++++-------<wbr>-----------<br>
1 file changed, 90 insertions(+), 67 deletions(-)<br>
<br>
diff --git a/tests/TestSuite_ip_pipeline.<wbr>py b/tests/TestSuite_ip_pipeline.<wbr>py<br>
index 90dba31..300b1de 100644<br>
--- a/tests/TestSuite_ip_pipeline.<wbr>py<br>
+++ b/tests/TestSuite_ip_pipeline.<wbr>py<br>
@@ -124,11 +124,47 @@ class TestIPPipeline(TestCase):<br>
<br>
writer.close()<br>
<br>
+ def create_passthrough_cfgfile(<wbr>self):<br>
+ self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo type = MASTER >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo type = PASS-THROUGH >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo pktq_out = TXQ1.0 TXQ0.0 >> /tmp/ip_pipeline.cfg', '#')<br>
+<br>
+ def create_routing_cfgfile(self):<br>
+ self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo type = MASTER >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo type = ROUTING >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo encap = ethernet >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo ip_hdr_offset = 270 >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo arp_key_offset = 128 >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo n_arp_entries = 1000 >> /tmp/ip_pipeline.cfg', '#')<br>
+<br>
+ def create_flow_cfgfile(self):<br>
+ self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo type = MASTER >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo core = 0 >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo type = FLOW_CLASSIFICATION >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo core = 1 >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo pktq_in = RXQ0.0 RXQ1.0 >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo pktq_out = TXQ0.0 TXQ1.0 SINK0 >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo n_flows = 65536 >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo key_size = 16 >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo key_offset = 278 >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo key_mask = 00FF0000FFFFFFFFFFFFFFFFFFFFFF<wbr>FF >> /tmp/ip_pipeline.cfg', '#')<br>
+ self.dut.send_expect('echo flowid_offset = 128 >> /tmp/ip_pipeline.cfg', '#')<br>
+<br>
def start_ip_pipeline(self, ports):<br>
- command_line = "./examples/ip_pipeline/build/<wbr>ip_pipeline -c %s -n %d -- -p %s" % \<br>
- (self.coremask,<br>
- self.dut.get_memory_channels()<wbr>,<br>
- ports)<br>
+ command_line = "./examples/ip_pipeline/build/<wbr>ip_pipeline -p %s -f /tmp/ip_pipeline.cfg" % ports<br>
<br>
out = self.dut.send_expect(command_<wbr>line, 'pipeline>', 60)<br>
sleep(5) # 'Initialization completed' is not the last output, some<br>
@@ -150,10 +186,10 @@ class TestIPPipeline(TestCase):<br>
"""<br>
<br>
for iface in ifaces:<br>
+ command = ('rm -f tcpdump_{0}.pcap').format(<wbr>iface)<br>
+ self.tester.send_expect(<wbr>command, '#')<br>
command = (<br>
'tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out &').format(iface)<br>
- self.tester.send_expect(<br>
- 'rm -f tcpdump_{0}.pcap', '#').format(iface)<br>
self.tester.send_expect(<wbr>command, '#')<br>
<br>
def tcpdump_stop_sniff(self):<br>
@@ -200,15 +236,13 @@ class TestIPPipeline(TestCase):<br>
<br>
tx_port = self.tester.get_local_port(<wbr>self.dut_ports[from_port])<br>
rx_port = self.tester.get_local_port(<wbr>self.dut_ports[to_port])<br>
+ port0 = self.tester.get_local_port(<wbr>self.dut_ports[0])<br>
<br>
tx_interface = self.tester.get_interface(tx_<wbr>port)<br>
rx_interface = self.tester.get_interface(rx_<wbr>port)<br>
<br>
self.tcpdump_start_sniffing([<wbr>tx_interface, rx_interface])<br>
<br>
- self.dut.send_expect('link 0 up', 'pipeline>')<br>
- self.dut.send_expect('link 1 up', 'pipeline>')<br>
-<br>
timeout = frames_number * inter + 2<br>
inter = ", inter=%d" % inter<br>
<br>
@@ -225,64 +259,58 @@ class TestIPPipeline(TestCase):<br>
<br>
self.tcpdump_stop_sniff()<br>
<br>
- self.dut.send_expect('link 0 down', 'pipeline>')<br>
- self.dut.send_expect('link 1 down', 'pipeline>')<br>
-<br>
rx_stats = self.number_of_packets('<wbr>tcpdump_%s.pcap' % rx_interface)<br>
tx_stats = self.number_of_packets('<wbr>tcpdump_%s.pcap' % tx_interface)<br>
<br>
# Do not count the sent frames in the tx_interface<br>
tx_stats = tx_stats - frames_number<br>
<br>
- return {'rx': rx_stats, 'tx': tx_stats}<br>
+ if port0 == tx_port:<br>
+ return {'rx0': tx_stats, 'rx1': rx_stats}<br>
+ else:<br>
+ return {'rx0': rx_stats, 'rx1': tx_stats}<br>
<br>
def check_results(self, stats, expected):<br>
"""<br>
- This function check that the Rx and Tx stats matches the expected.<br>
- expected = [Rx, Tx]<br>
+ This function check that the received packet numbers of port0 and port1 match the expected.<br>
+ expected = [Rx0, Rx1]<br>
"""<br>
<br>
- for port in ['rx', 'tx']:<br>
+ for port in ['rx0', 'rx1']:<br>
self.verify(stats[port] == expected[port],<br>
'Frames expected (%s) and received (%s) mismatch on %s port' % (<br>
expected[port], stats[port], port))<br>
<br>
def pipeline_command(self, command):<br>
out = self.dut.send_expect(command, 'pipeline>')<br>
- self.verify("Illegal" not in out, "Pipeline command error 1: '%s'" % command)<br>
- self.verify("Bad" not in out, "Pipeline command error 2: '%s'" % command)<br>
+ self.verify("arguments" not in out, "Incorrect arguments: '%s'" % command)<br>
+ self.verify("Invalid" not in out, "Invalid argument: '%s'" % command)<br>
+ self.verify("Syntax error" not in out, "Syntax error: '%s'" % command)<br>
return out<br>
<br>
- def pipeline_add_flow(self, port, src_ip, dst_ip, src_port, dst_port,<br>
+ def pipeline_add_flow(self, port, src_ip, dst_ip, src_port, dst_port, flowid,<br>
protocol=6):<br>
- command = 'flow add %s %s %d %d %d %d' % (src_ip, dst_ip, src_port,<br>
- dst_port, protocol, port)<br>
+ command = 'p 1 flow add ipv4 %s %s %d %d %d port %d id %d' % (src_ip, dst_ip, src_port,<br>
+ dst_port, protocol, port, flowid)<br>
out = self.pipeline_command(command)<br>
- self.verify("Adding flow" in out, "Add flow error")<br>
+ self.verify("failed" not in out, "Add flow error")<br>
<br>
def pipeline_del_flow(self, src_ip, dst_ip, src_port, dst_port,<br>
protocol=6):<br>
- command = 'flow del %s %s %d %d %d' % (src_ip, dst_ip, src_port,<br>
+ command = 'p 1 flow del ipv4 %s %s %d %d %d' % (src_ip, dst_ip, src_port,<br>
dst_port, protocol)<br>
out = self.pipeline_command(command)<br>
- self.verify("Deleting flow" in out, "Del flow error")<br>
+ self.verify("failed" not in out, "Del flow error")<br>
<br>
def pipeline_add_route(self, port, src_ip, netmask, gw_ip):<br>
- command = 'route add %s %d %d %s' % (src_ip, netmask, port, gw_ip)<br>
+ command = 'p 1 route add %s %d port %d ether %s' % (src_ip, netmask, port, gw_ip)<br>
out = self.pipeline_command(command)<br>
- self.verify("Adding route" in out, "Add route error")<br>
+ self.verify("failed" not in out, "Add route error")<br>
<br>
def pipeline_del_route(self, src_ip, netmask):<br>
- command = 'route del %s %d' % (src_ip, netmask)<br>
+ command = 'p 1 route del %s %d' % (src_ip, netmask)<br>
out = self.pipeline_command(command)<br>
- self.verify("Deleting route" in out, "Del route error")<br>
-<br>
- def pipeline_traffic_burst(self):<br>
- self.dut.send_expect('link 0 up', 'pipeline>')<br>
- self.dut.send_expect('link 1 up', 'pipeline>')<br>
- sleep(0.1)<br>
- self.dut.send_expect('link 0 down', 'pipeline>')<br>
- self.dut.send_expect('link 1 down', 'pipeline>')<br>
+ self.verify("failed" not in out, "Del route error")<br>
<br>
def set_up_all(self):<br>
"""<br>
@@ -291,14 +319,8 @@ class TestIPPipeline(TestCase):<br>
PMD prerequisites.<br>
"""<br>
<br>
- # Check for port availability<br>
- self.needed_ports = {"niantic": 2,<br>
- "I217V": 1,<br>
- "I217LM": 1,<br>
- "I218V": 1,<br>
- "I218LM": 1}<br>
self.dut_ports = self.dut.get_ports()<br>
- self.verify(len(self.dut_<wbr>ports) >= self.needed_ports[self.nic],<br>
+ self.verify(len(self.dut_<wbr>ports) >= 2,<br>
"Insufficient ports for speed testing")<br></blockquote><div><br></div><div>If we access both ports from remain parts of the code, than why we check for single port for specific platforms.<br></div><div>In other words what was was the purpose of those removed lines?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
out = self.dut.build_dpdk_apps("./<wbr>examples/ip_pipeline")<br>
@@ -324,9 +346,10 @@ class TestIPPipeline(TestCase):<br>
pcap_file = 'ip_pipeline.pcap'<br>
frame_size = 64<br>
<br>
+ self.create_passthrough_<wbr>cfgfile()<br>
self.start_ip_pipeline(ports=<wbr>self.ports_mask)<br>
self.dut.send_expect(<br>
- 'run examples/ip_pipeline/ip_<wbr>pipeline.sh', 'pipeline>', 10)<br>
+ 'run examples/ip_pipeline/config/<wbr>ip_pipeline.sh', 'pipeline>', 10)<br>
<br>
# Create a PCAP file containing the maximum frames_number of frames needed<br>
# with fixed size and incremental IP<br>
@@ -342,13 +365,13 @@ class TestIPPipeline(TestCase):<br>
stats = self.send_and_sniff_pcap_file(<wbr>pcap_file, frames_number,<br>
1, 0, inter)<br>
<br>
- expected = {'tx': 0, 'rx': frames_number}<br>
+ expected = {'rx0': frames_number, 'rx1': 0}<br>
self.check_results(stats, expected)<br>
<br>
stats = self.send_and_sniff_pcap_file(<wbr>pcap_file, frames_number,<br>
0, 1, inter)<br>
<br>
- expected = {'tx': frames_number, 'rx': 0}<br>
+ expected = {'rx0': 0, 'rx1': frames_number}<br>
self.check_results(stats, expected)<br>
<br>
def test_frame_sizes(self):<br>
@@ -359,9 +382,10 @@ class TestIPPipeline(TestCase):<br>
frames_number = 100<br>
inter = 0.5<br>
<br>
+ self.create_passthrough_<wbr>cfgfile()<br>
self.start_ip_pipeline(ports=<wbr>self.ports_mask)<br>
self.dut.send_expect(<br>
- 'run examples/ip_pipeline/ip_<wbr>pipeline.sh', 'pipeline>', 10)<br>
+ 'run examples/ip_pipeline/config/<wbr>ip_pipeline.sh', 'pipeline>', 10)<br>
<br>
for frame_size in TestIPPipeline.frame_sizes:<br>
<br>
@@ -376,13 +400,13 @@ class TestIPPipeline(TestCase):<br>
stats = self.send_and_sniff_pcap_file(<wbr>pcap_file, frames_number,<br>
1, 0, inter)<br>
<br>
- expected = {'tx': 0, 'rx': frames_number}<br>
+ expected = {'rx0': frames_number, 'rx1': 0}<br>
self.check_results(stats, expected)<br>
<br>
stats = self.send_and_sniff_pcap_file(<wbr>pcap_file, frames_number,<br>
0, 1, inter)<br>
<br>
- expected = {'tx': frames_number, 'rx': 0}<br>
+ expected = {'rx0': 0, 'rx1': frames_number}<br>
self.check_results(stats, expected)<br>
<br>
def test_flow_management(self):<br>
@@ -392,11 +416,6 @@ class TestIPPipeline(TestCase):<br>
pcap_file = 'ip_pipeline.pcap'<br>
frame_size = 64<br>
<br>
- default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',<br>
- 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',<br>
- 'route add 0.0.0.0 9 0 0.0.0.1',<br>
- 'route add 0.128.0.0 9 1 0.128.0.1']<br>
-<br>
ip_addrs = [<br>
'0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',<br>
'0.0.1.0', '0.0.127.0', '0.0.128.0', '0.0.129.0', '0.0.255.0',<br>
@@ -409,30 +428,32 @@ class TestIPPipeline(TestCase):<br>
frames.append(self.create_tcp_<wbr>ipv4_frame(0, '0.0.0.0', addr,<br>
frame_size))<br>
<br>
+ self.create_flow_cfgfile()<br>
self.create_pcap_file_from_<wbr>frames(pcap_file, frames)<br>
self.tester.session.copy_file_<wbr>to(pcap_file)<br>
<br>
# Start ip_pipeline app and setup defaults<br>
self.start_ip_pipeline(ports=<wbr>self.ports_mask)<br>
- for command in default_setup:<br>
- self.pipeline_command(command)<br>
+<br>
+ # default to SINK0<br>
+ self.pipeline_command('p 1 flow add default 3')<br>
<br>
# Check that no traffic pass though<br>
stats = self.send_and_sniff_pcap_file(<wbr>pcap_file, len(frames),<br>
1, 0, 0.2)<br>
- expected = {'tx': 0, 'rx': 0}<br>
+ expected = {'rx0': 0, 'rx1': 0}<br>
self.check_results(stats, expected)<br>
<br>
# Add the flows<br>
flows_added = 0<br>
for addrs in ip_addrs:<br>
- self.pipeline_add_flow(1, '0.0.0.0', addrs, 0, 0)<br>
+ self.pipeline_add_flow(0, '0.0.0.0', addrs, 0, 0, flows_added)<br>
flows_added += 1<br>
<br>
# Check that traffic matching flows pass though<br>
stats = self.send_and_sniff_pcap_file(<wbr>pcap_file, len(frames),<br>
1, 0, 0.2)<br>
- expected = {'tx': 0, 'rx': flows_added}<br>
+ expected = {'rx0': flows_added, 'rx1': 0}<br>
self.check_results(stats, expected)<br>
<br>
# Remove flows<br>
@@ -443,7 +464,7 @@ class TestIPPipeline(TestCase):<br>
# Check that traffic matching flows pass though<br>
stats = self.send_and_sniff_pcap_file(<wbr>pcap_file, len(frames),<br>
1, 0, 0.2)<br>
- expected = {'tx': 0, 'rx': flows_added}<br>
+ expected = {'rx0': flows_added, 'rx1': 0}<br>
self.check_results(stats, expected)<br>
<br>
out = self.dut.send_expect('flow print', 'pipeline>')<br>
@@ -452,7 +473,7 @@ class TestIPPipeline(TestCase):<br>
# Check that again no traffic pass though<br>
stats = self.send_and_sniff_pcap_file(<wbr>pcap_file, len(frames),<br>
1, 0, 0.2)<br>
- expected = {'tx': 0, 'rx': 0}<br>
+ expected = {'rx0': 0, 'rx1': 0}<br>
self.check_results(stats, expected)<br>
<br>
self.quit_ip_pipeline()<br>
@@ -464,9 +485,8 @@ class TestIPPipeline(TestCase):<br>
pcap_file = 'ip_pipeline.pcap'<br>
frame_size = 64<br>
<br>
- default_setup = ['arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',<br>
- 'arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f',<br>
- 'flow add all']<br>
+ default_setup = ['p 1 arp add 0 0.0.0.1 0a:0b:0c:0d:0e:0f',<br>
+ 'p 1 arp add 1 0.128.0.1 1a:1b:1c:1d:1e:1f']<br>
<br>
ip_addrs = [<br>
'0.0.0.0', '0.0.0.1', '0.0.0.127', '0.0.0.128', '0.0.0.255',<br>
@@ -483,6 +503,7 @@ class TestIPPipeline(TestCase):<br>
self.create_pcap_file_from_<wbr>frames(pcap_file, frames)<br>
self.tester.session.copy_file_<wbr>to(pcap_file)<br>
<br>
+ self.create_routing_cfgfile()<br>
# Start ip_pipeline app and setup defaults<br>
self.start_ip_pipeline(ports=<wbr>self.ports_mask)<br>
for command in default_setup:<br>
@@ -491,7 +512,7 @@ class TestIPPipeline(TestCase):<br>
# Check that no traffic pass though<br>
stats = self.send_and_sniff_pcap_file(<wbr>pcap_file, len(frames),<br>
1, 0, 0.2)<br>
- expected = {'tx': 0, 'rx': 0}<br>
+ expected = {'rx0': 0, 'rx1': 0}<br>
self.check_results(stats, expected)<br>
<br>
# Add the routes<br>
@@ -504,7 +525,7 @@ class TestIPPipeline(TestCase):<br>
stats = self.send_and_sniff_pcap_file(<wbr>pcap_file, len(frames),<br>
1, 0, 0.2)<br>
<br>
- expected = {'tx': 0, 'rx': routes_added}<br>
+ expected = {'rx0': routes_added, 'rx1': 0}<br>
self.check_results(stats, expected)<br>
<br>
# Remove routes<br>
@@ -515,7 +536,7 @@ class TestIPPipeline(TestCase):<br>
# Check that traffic matching flows pass though<br>
stats = self.send_and_sniff_pcap_file(<wbr>pcap_file, len(frames),<br>
1, 0, 0.2)<br>
- expected = {'tx': 0, 'rx': routes_added}<br>
+ expected = {'rx0': routes_added, 'rx1': 0}<br>
self.check_results(stats, expected)<br>
<br>
out = self.dut.send_expect('route print', 'pipeline>')<br>
@@ -524,7 +545,7 @@ class TestIPPipeline(TestCase):<br>
# Check that again no traffic pass though<br>
stats = self.send_and_sniff_pcap_file(<wbr>pcap_file, len(frames),<br>
1, 0, 0.2)<br>
- expected = {'tx': 0, 'rx': 0}<br>
+ expected = {'rx0': 0, 'rx1': 0}<br>
self.check_results(stats, expected)<br>
<br>
self.quit_ip_pipeline()<br>
@@ -539,5 +560,7 @@ class TestIPPipeline(TestCase):<br>
"""<br>
Run after each test suite.<br>
"""<br>
+ self.dut.send_expect("rm /tmp/ip_pipeline.cfg", "#")<br>
+ self.dut.send_expect("rm /tmp/ip_pipeline.cfg.out", "#")<br>
out = self.dut.build_dpdk_apps("./<wbr>examples/ip_pipeline")<br>
self.verify("Error" not in out, "Compilation error")<br>
<span class="gmail-HOEnZb"><font color="#888888">--<br>
1.9.1<br>
<br>
</font></span></blockquote></div><br></div></div>