From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id E0AE71B398 for ; Thu, 31 Jan 2019 03:07:57 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jan 2019 18:07:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,542,1539673200"; d="scan'208";a="140299106" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga004.fm.intel.com with ESMTP; 30 Jan 2019 18:07:56 -0800 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 30 Jan 2019 18:07:56 -0800 Received: from shsmsx106.ccr.corp.intel.com (10.239.4.159) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 30 Jan 2019 18:07:55 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.110]) by SHSMSX106.ccr.corp.intel.com ([169.254.10.174]) with mapi id 14.03.0415.000; Thu, 31 Jan 2019 10:07:54 +0800 From: "Tu, Lijuan" To: "Peng, Yuan" , "dts@dpdk.org" CC: "Peng, Yuan" Thread-Topic: [dts] [PATCH]tests: discard TestSuite_ip_pipeline.py Thread-Index: AQHUttEhzWz6ozfe9USnE6UCksHKxaXIpeBw Date: Thu, 31 Jan 2019 02:07:53 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BA1F298@SHSMSX101.ccr.corp.intel.com> References: <1548656446-39609-1-git-send-email-yuan.peng@intel.com> In-Reply-To: <1548656446-39609-1-git-send-email-yuan.peng@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDgzZWQzMTUtZmIzNi00YzUwLTg5NmMtNmQzYzI2Yjc4OWVjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoibkdONmF5UFRFWFR5enNxS1FFUEZpV2ptSDRqTUliOGxKSTk3VHJveitRK05XR0hpRjJ0WHlzRUx2Znd2VmpHSCJ9 x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH]tests: discard TestSuite_ip_pipeline.py X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2019 02:07:58 -0000 Applied, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Peng Yuan > Sent: Monday, January 28, 2019 2:21 PM > To: dts@dpdk.org > Cc: Peng, Yuan > Subject: [dts] [PATCH]tests: discard TestSuite_ip_pipeline.py >=20 > Discard the old automation script TestSuite_ip_pipeline.py, and will subm= it a > new TestSuite_ip_pipeline.py >=20 > Signed-off-by: Peng Yuan >=20 > diff --git a/tests/TestSuite_ip_pipeline.py b/tests/TestSuite_ip_pipeline= .py > deleted file mode 100644 index 76a477f..0000000 > --- a/tests/TestSuite_ip_pipeline.py > +++ /dev/null > @@ -1,581 +0,0 @@ > -# BSD LICENSE > -# > -# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. > -# All rights reserved. > -# > -# Redistribution and use in source and binary forms, with or without -# > modification, are permitted provided that the following conditions -# are= met: > -# > -# * Redistributions of source code must retain the above copyright > -# notice, this list of conditions and the following disclaimer. > -# * Redistributions in binary form must reproduce the above copyright > -# notice, this list of conditions and the following disclaimer in > -# the documentation and/or other materials provided with the > -# distribution. > -# * Neither the name of Intel Corporation nor the names of its > -# contributors may be used to endorse or promote products derived > -# from this software without specific prior written permission. > -# > -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND > CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, > INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF > MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE > DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR > CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# > SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# > LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF > USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED > AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN > ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE > POSSIBILITY OF SUCH DAMAGE. > - > -""" > -DPDK Test suite. > -Test userland 10Gb PMD > -""" > - > -from scapy.layers.inet import Ether, IP, TCP -from scapy.utils import st= ruct, > socket, PcapWriter -from settings import HEADER_SIZE -from test_case impo= rt > TestCase -from time import sleep -import utils > - > - > -class TestIPPipeline(TestCase): > - payload_watermark =3D 'TestPF' > - > - frame_sizes =3D [64, 65, 128, 1024] > - """Sizes of the frames to be sent""" > - > - number_of_frames =3D [1, 3, 63, 64, 65, 127, 128] > - """Number of frames in the pcap file to be created""" > - > - incremental_ip_address =3D [True, False] > - """True if the IP address is incremented in the frames""" > - > - inter =3D [0, 0.7] > - """Interval between frames sent in seconds""" > - > - dummy_pcap =3D 'dummy.pcap' > - > - def increment_ip_addr(self, ip_address, increment): > - > - ip2int =3D lambda ipstr: struct.unpack('!I', socket.inet_aton(ip= str))[0] > - x =3D ip2int(ip_address) > - int2ip =3D lambda n: socket.inet_ntoa(struct.pack('!I', n)) > - return int2ip(x + increment) > - > - def create_tcp_ipv4_frame( > - self, ip_id, src_ip_addr, dst_ip_addr, frame_size, > - src_mac_addr=3D'00:00:0A:00:0B:00', > - dst_mac_addr=3D'00:00:0A:00:0A:00'): > - > - payload_size =3D frame_size - HEADER_SIZE['eth'] - HEADER_SIZE['= ip'] -\ > - HEADER_SIZE['tcp'] - \ > - len(TestIPPipeline.payload_watermark) > - > - if payload_size < 0: > - payload_size =3D 0 > - > - frame =3D Ether() / IP() / TCP(flags=3D"") / (TestIPPipeline.pay= load_watermark + > - "X" * payload_size) > - frame[Ether].src =3D src_mac_addr > - frame[Ether].dst =3D dst_mac_addr > - > - frame[IP].src =3D src_ip_addr > - frame[IP].dst =3D dst_ip_addr > - frame[IP].id =3D ip_id > - > - # TCP ports always 0 > - frame[TCP].sport =3D 0 > - frame[TCP].dport =3D 0 > - > - return frame > - > - def create_pcap_file_from_frames(self, file_name, frames): > - > - writer =3D PcapWriter(file_name, append=3DFalse) > - > - for frame in frames: > - writer.write(frame) > - > - writer.close() > - > - def create_pcap_file(self, file_name, frame_size, number_of_frames, > - incremental_ip_address, > - src_ip=3D"0.0.0.0", > - dst_ip=3D"0.0.0.0"): > - > - current_frame =3D 0 > - writer =3D PcapWriter(file_name, append=3DFalse) > - > - while current_frame < number_of_frames: > - ip_id =3D 0 # current_frame % 0x10000 > - > - frame =3D self.create_tcp_ipv4_frame(ip_id, src_ip, dst_ip, > - frame_size) > - writer.write(frame) > - > - if incremental_ip_address: > - dst_ip =3D self.increment_ip_addr(dst_ip, 1) > - > - current_frame +=3D 1 > - > - 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 =3D MASTER >> /tmp/ip_pipeline.c= fg', '#') > - self.dut.send_expect('echo core =3D 0 >> /tmp/ip_pipeline.cfg', = '#') > - self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg',= '#') > - self.dut.send_expect('echo type =3D PASS-THROUGH >> /tmp/ip_pipe= line.cfg', > '#') > - self.dut.send_expect('echo core =3D 1 >> /tmp/ip_pipeline.cfg', = '#') > - self.dut.send_expect('echo pktq_in =3D RXQ0.0 RXQ1.0 >> > /tmp/ip_pipeline.cfg', '#') > - self.dut.send_expect('echo pktq_out =3D 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 p= acket buffer. > - """ > - > - self.dut.send_expect('echo [PIPELINE0] > /tmp/ip_pipeline.cfg', = '#') > - self.dut.send_expect('echo type =3D MASTER >> /tmp/ip_pipeline.c= fg', '#') > - self.dut.send_expect('echo core =3D 0 >> /tmp/ip_pipeline.cfg', = '#') > - self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg',= '#') > - self.dut.send_expect('echo type =3D ROUTING >> /tmp/ip_pipeline.= cfg', '#') > - self.dut.send_expect('echo core =3D 1 >> /tmp/ip_pipeline.cfg', = '#') > - self.dut.send_expect('echo pktq_in =3D RXQ0.0 RXQ1.0 >> > /tmp/ip_pipeline.cfg', '#') > - self.dut.send_expect('echo pktq_out =3D TXQ0.0 TXQ1.0 >> > /tmp/ip_pipeline.cfg', '#') > - self.dut.send_expect('echo encap =3D ethernet >> /tmp/ip_pipelin= e.cfg', '#') > - self.dut.send_expect('echo ip_hdr_offset =3D 270 >> /tmp/ip_pipe= line.cfg', '#') > - self.dut.send_expect('echo arp_key_offset =3D 128 >> /tmp/ip_pip= eline.cfg', > '#') > - self.dut.send_expect('echo n_arp_entries =3D 1000 >> /tmp/ip_pip= eline.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 =3D MASTER >> /tmp/ip_pipeline.c= fg', '#') > - self.dut.send_expect('echo core =3D 0 >> /tmp/ip_pipeline.cfg', = '#') > - self.dut.send_expect('echo [PIPELINE1] >> /tmp/ip_pipeline.cfg',= '#') > - self.dut.send_expect('echo type =3D FLOW_CLASSIFICATION >> > /tmp/ip_pipeline.cfg', '#') > - self.dut.send_expect('echo core =3D 1 >> /tmp/ip_pipeline.cfg', = '#') > - self.dut.send_expect('echo pktq_in =3D RXQ0.0 RXQ1.0 >> > /tmp/ip_pipeline.cfg', '#') > - self.dut.send_expect('echo pktq_out =3D TXQ0.0 TXQ1.0 SINK0 >> > /tmp/ip_pipeline.cfg', '#') > - self.dut.send_expect('echo n_flows =3D 65536 >> /tmp/ip_pipeline= .cfg', '#') > - self.dut.send_expect('echo key_size =3D 16 >> /tmp/ip_pipeline.c= fg', '#') > - self.dut.send_expect('echo key_offset =3D 278 >> /tmp/ip_pipelin= e.cfg', '#') > - self.dut.send_expect('echo key_mask =3D > 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF >> /tmp/ip_pipeline.cfg', '#') > - self.dut.send_expect('echo flowid_offset =3D 128 >> /tmp/ip_pipe= line.cfg', '#') > - > - def start_ip_pipeline(self, ports): > - command_line =3D "./examples/ip_pipeline/build/ip_pipeline -p %s= -f > /tmp/ip_pipeline.cfg" % ports > - > - out =3D self.dut.send_expect(command_line, 'pipeline>', 60) > - sleep(5) # 'Initialization completed' is not the last output,= some > - # seconds are still needed for init. > - > - self.verify("Aborted" not in out, "Error starting ip_pipeline") > - self.verify("PANIC" not in out, "Error starting ip_pipeline") > - self.verify("ERROR" not in out, "Error starting ip_pipeline") > - > - def quit_ip_pipeline(self): > - self.dut.send_expect("quit", "# ", 5) > - > - def tcpdump_start_sniffing(self, ifaces=3D[]): > - """ > - Starts tcpdump in the background to sniff the tester interface w= here > - the packets are transmitted to and from the self.dut. > - All the captured packets are going to be stored in a file for a > - post-analysis. > - """ > - > - for iface in ifaces: > - command =3D ('rm -f tcpdump_{0}.pcap').format(iface) > - self.tester.send_expect(command, '#') > - command =3D ( > - 'tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out > &').format(iface) > - self.tester.send_expect(command, '#') > - > - def tcpdump_stop_sniff(self): > - """ > - Stops the tcpdump process running in the background. > - """ > - > - self.tester.send_expect('killall tcpdump', '#') > - # For the [pid]+ Done tcpdump... message after killing the proce= ss > - sleep(1) > - self.tester.send_expect('echo "Cleaning buffer"', '#') > - sleep(1) > - > - def tcpdump_command(self, command, machine): > - """ > - Sends a tcpdump related command and returns an integer from the = output > - """ > - > - if machine =3D=3D 'dut': > - result =3D self.dut.send_expect(command, '#', alt_session=3D= True) > - else: > - result =3D self.tester.send_expect(command, '#', alt_session= =3DTrue) > - > - return int(result.strip()) > - > - def number_of_packets(self, file_name, machine=3D'tester'): > - """ > - By reading the file generated by tcpdump it counts how many pack= ets were > - forwarded by the sample app and received in the self.tester. The= sample > app > - will add a known MAC address for the test to look for. > - """ > - > - command =3D ('tcpdump -A -nn -e -v -r %s 2>/dev/null | grep -c "= %s"' % > - (file_name, TestIPPipeline.payload_watermark)) > - return int(self.tcpdump_command(command, machine)) > - > - def send_and_sniff_pcap_file(self, pcap_file, frames_number, from_po= rt, > - to_port, inter=3D0): > - """ > - Sent frames_number frames from the pcap_file with inter seconds = of > - interval. > - Returns the number of received frames. > - """ > - > - tx_port =3D self.tester.get_local_port(self.dut_ports[from_port]= ) > - rx_port =3D self.tester.get_local_port(self.dut_ports[to_port]) > - port0 =3D self.tester.get_local_port(self.dut_ports[0]) > - > - tx_interface =3D self.tester.get_interface(tx_port) > - rx_interface =3D self.tester.get_interface(rx_port) > - > - self.tcpdump_start_sniffing([tx_interface, rx_interface]) > - > - timeout =3D frames_number * inter + 2 > - inter =3D ", inter=3D%d" % inter > - > - # Prepare the frames to be sent > - self.tester.scapy_foreground() > - self.tester.scapy_append('p =3D rdpcap("%s")' % (pcap_file)) > - self.tester.scapy_append( > - 'sendp(p[:%s], iface=3D"%s" %s)' % (frames_number, > - tx_interface, > - inter)) > - > - # Execute scapy to sniff sniffing and send the frames > - self.tester.scapy_execute(timeout) > - > - self.tcpdump_stop_sniff() > - > - rx_stats =3D self.number_of_packets('tcpdump_%s.pcap' % rx_inter= face) > - tx_stats =3D self.number_of_packets('tcpdump_%s.pcap' % tx_inter= face) > - > - # Do not count the sent frames in the tx_interface > - tx_stats =3D tx_stats - frames_number > - > - if port0 =3D=3D 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 received packet numbers of port0 an= d port1 > match the expected. > - expected =3D [Rx0, Rx1] > - """ > - > - for port in ['rx0', 'rx1']: > - self.verify(stats[port] =3D=3D expected[port], > - 'Frames expected (%s) and received (%s) mismatch= on %s port' % ( > - expected[port], stats[port], port)) > - > - def pipeline_command(self, command): > - out =3D self.dut.send_expect(command, 'pipeline>') > - self.verify("arguments" not in out, "Incorrect arguments: '%s'" = % command) > - self.verify("Invalid" not in out, "Invalid argument: '%s'" % com= mand) > - self.verify("Syntax error" not in out, "Syntax error: '%s'" % co= mmand) > - return out > - > - def pipeline_add_flow(self, port, src_ip, dst_ip, src_port, dst_port= , flowid, > - protocol=3D6): > - command =3D 'p 1 flow add ipv4 %s %s %d %d %d port %d id %d' % (= src_ip, > dst_ip, src_port, > - dst_port, protocol, po= rt, flowid) > - out =3D self.pipeline_command(command) > - self.verify("failed" not in out, "Add flow error") > - > - def pipeline_del_flow(self, src_ip, dst_ip, src_port, dst_port, > - protocol=3D6): > - command =3D 'p 1 flow del ipv4 %s %s %d %d %d' % (src_ip, dst_ip= , src_port, > - dst_port, protocol) > - out =3D self.pipeline_command(command) > - self.verify("failed" not in out, "Del flow error") > - > - def pipeline_add_route(self, port, src_ip, netmask, gw_ip): > - command =3D 'p 1 route add %s %d port %d ether %s' % (src_ip, ne= tmask, > port, gw_ip) > - out =3D self.pipeline_command(command) > - self.verify("failed" not in out, "Add route error") > - > - def pipeline_del_route(self, src_ip, netmask): > - command =3D 'p 1 route del %s %d' % (src_ip, netmask) > - out =3D self.pipeline_command(command) > - self.verify("failed" not in out, "Del route error") > - > - def set_up_all(self): > - """ > - Run at the start of each test suite. > - > - PMD prerequisites. > - """ > - > - self.dut_ports =3D self.dut.get_ports() > - self.verify(len(self.dut_ports) >=3D 2, > - "Insufficient ports for speed testing") > - > - out =3D self.dut.build_dpdk_apps("./examples/ip_pipeline") > - self.verify("Error" not in out, "Compilation error") > - > - self.ports_mask =3D utils.create_mask( > - [self.dut_ports[0], self.dut_ports[1]]) > - self.coremask =3D "0x3e" # IP Pipeline app requires FIVE cores > - > - self.dut.setup_memory(4096) > - > - def set_up(self): > - """ > - Run before each test case. > - """ > - pass > - > - def test_incremental_ip(self): > - """ > - Testing that frames with incremental IP addresses pass through t= he > - pipeline regardless the frames_number and the speed. > - """ > - pcap_file =3D 'ip_pipeline.pcap' > - frame_size =3D 64 > - > - self.create_passthrough_cfgfile() > - self.start_ip_pipeline(ports=3Dself.ports_mask) > - self.dut.send_expect( > - 'run examples/ip_pipeline/config/ip_pipeline.sh', 'pipeline>= ', 10) > - > - # Create a PCAP file containing the maximum frames_number of fra= mes > needed > - # with fixed size and incremental IP > - self.create_pcap_file(pcap_file, frame_size, > - max(TestIPPipeline.number_of_frames), True= ) > - self.tester.session.copy_file_to(pcap_file) > - > - for frames_number in TestIPPipeline.number_of_frames: > - for inter in TestIPPipeline.inter: > - print utils.BLUE( > - "\tNumber of frames %d, interval %.1f" % (frames_num= ber, > - inter)) > - stats =3D self.send_and_sniff_pcap_file(pcap_file, frame= s_number, > - 1, 0, inter) > - > - expected =3D {'rx0': frames_number, 'rx1': 0} > - self.check_results(stats, expected) > - > - stats =3D self.send_and_sniff_pcap_file(pcap_file, frame= s_number, > - 0, 1, inter) > - > - expected =3D {'rx0': 0, 'rx1': frames_number} > - self.check_results(stats, expected) > - > - def test_frame_sizes(self): > - """ > - Testing that frames with different sizes pass through the pipeli= ne. > - """ > - pcap_file =3D 'ip_pipeline.pcap' > - frames_number =3D 100 > - inter =3D 0.5 > - > - self.create_passthrough_cfgfile() > - self.start_ip_pipeline(ports=3Dself.ports_mask) > - self.dut.send_expect( > - 'run examples/ip_pipeline/config/ip_pipeline.sh', 'pipeline>= ', 10) > - > - for frame_size in TestIPPipeline.frame_sizes: > - > - # Create a PCAP file containing the fixed number of frames a= bove > - # with variable size and incremental IP > - self.create_pcap_file(pcap_file, frame_size, 100, True) > - self.tester.session.copy_file_to(pcap_file) > - > - print utils.BLUE("\tFrame size %d, interval %.1f" % (frame_s= ize, > - inter)) > - > - stats =3D self.send_and_sniff_pcap_file(pcap_file, frames_nu= mber, > - 1, 0, inter) > - > - expected =3D {'rx0': frames_number, 'rx1': 0} > - self.check_results(stats, expected) > - > - stats =3D self.send_and_sniff_pcap_file(pcap_file, frames_nu= mber, > - 0, 1, inter) > - > - expected =3D {'rx0': 0, 'rx1': frames_number} > - self.check_results(stats, expected) > - > - def test_flow_management(self): > - """ > - Add several flows and check only frames with matching IPs passes > - """ > - pcap_file =3D 'ip_pipeline.pcap' > - frame_size =3D 64 > - > - ip_addrs =3D [ > - '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= ', > - '0.127.0.0', '0.127.1.0', '0.127.127.0', '0.127.255.0', > - '0.127.255.255'] > - > - frames =3D [] > - > - for addr in ip_addrs: > - 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=3Dself.ports_mask) > - > - # default to SINK0 > - self.pipeline_command('p 1 flow add default 2') > - > - # Check that no traffic pass though > - stats =3D self.send_and_sniff_pcap_file(pcap_file, len(frames), > - 1, 0, 0.2) > - expected =3D {'rx0': 0, 'rx1': 0} > - self.check_results(stats, expected) > - > - # Add the flows > - flows_added =3D 0 > - for addrs in ip_addrs: > - self.pipeline_add_flow(0, '0.0.0.0', addrs, 0, 0, flows_adde= d) > - flows_added +=3D 1 > - > - # Check that traffic matching flows pass though > - stats =3D self.send_and_sniff_pcap_file(pcap_file, len(frame= s), > - 1, 0, 0.2) > - expected =3D {'rx0': flows_added, 'rx1': 0} > - self.check_results(stats, expected) > - > - # Remove flows > - for addrs in ip_addrs: > - self.pipeline_del_flow('0.0.0.0', addrs, 0, 0) > - flows_added -=3D 1 > - > - # Check that traffic matching flows pass though > - stats =3D self.send_and_sniff_pcap_file(pcap_file, len(frame= s), > - 1, 0, 0.2) > - expected =3D {'rx0': flows_added, 'rx1': 0} > - self.check_results(stats, expected) > - > - out =3D self.dut.send_expect('flow print', 'pipeline>') > - self.verify("=3D> Port =3D" not in out, "Flow found after deleti= on") > - > - # Check that again no traffic pass though > - stats =3D self.send_and_sniff_pcap_file(pcap_file, len(frames), > - 1, 0, 0.2) > - expected =3D {'rx0': 0, 'rx1': 0} > - self.check_results(stats, expected) > - > - self.quit_ip_pipeline() > - > - def test_route_management(self): > - """ > - Add several flows and check only frames with matching IPs passes > - """ > - pcap_file =3D 'ip_pipeline.pcap' > - frame_size =3D 64 > - > - default_setup =3D ['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 =3D [ > - '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= ', > - '0.127.0.0', '0.127.1.0', '0.127.127.0', '0.127.255.0', > - '0.127.255.255'] > - > - frames =3D [] > - > - for addr in ip_addrs: > - frames.append(self.create_tcp_ipv4_frame(0, '0.0.0.0', addr, > - frame_size)) > - > - 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=3Dself.ports_mask) > - for command in default_setup: > - self.pipeline_command(command) > - > - # Check that no traffic pass though > - stats =3D self.send_and_sniff_pcap_file(pcap_file, len(frames), > - 1, 0, 0.2) > - expected =3D {'rx0': 0, 'rx1': 0} > - self.check_results(stats, expected) > - > - # Add the routes > - routes_added =3D 0 > - for addr in ip_addrs: > - self.pipeline_add_route(0, addr, 32, '0.0.0.1') > - routes_added +=3D 1 > - > - # Check that traffic matching routes pass though > - stats =3D self.send_and_sniff_pcap_file(pcap_file, len(frame= s), > - 1, 0, 0.2) > - > - expected =3D {'rx0': routes_added, 'rx1': 0} > - self.check_results(stats, expected) > - > - # Remove routes > - for addr in ip_addrs: > - self.pipeline_del_route(addr, 32) > - routes_added -=3D 1 > - > - # Check that traffic matching flows pass though > - stats =3D self.send_and_sniff_pcap_file(pcap_file, len(frame= s), > - 1, 0, 0.2) > - expected =3D {'rx0': routes_added, 'rx1': 0} > - self.check_results(stats, expected) > - > - out =3D self.dut.send_expect('route print', 'pipeline>') > - self.verify("Destination =3D " not in out, "Route found after de= letion") > - > - # Check that again no traffic pass though > - stats =3D self.send_and_sniff_pcap_file(pcap_file, len(frames), > - 1, 0, 0.2) > - expected =3D {'rx0': 0, 'rx1': 0} > - self.check_results(stats, expected) > - > - self.quit_ip_pipeline() > - > - def tear_down(self): > - """ > - Run after each test case. > - """ > - self.quit_ip_pipeline() > - > - def tear_down_all(self): > - """ > - 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 =3D self.dut.build_dpdk_apps("./examples/ip_pipeline") > - self.verify("Error" not in out, "Compilation error") > -- > 2.5.0