From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 89B162C01 for ; Fri, 22 Sep 2017 10:54:56 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Sep 2017 01:54:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,427,1500966000"; d="scan'208";a="131296263" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga004.jf.intel.com with ESMTP; 22 Sep 2017 01:54:55 -0700 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 22 Sep 2017 01:54:55 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 22 Sep 2017 01:54:54 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.152]) with mapi id 14.03.0319.002; Fri, 22 Sep 2017 16:54:52 +0800 From: "Liu, Yong" To: "Wang, FeiX Y" , "dts@dpdk.org" CC: "Wang, FeiX Y" Thread-Topic: [dts] [patch v1] tests/TestSuite_nsh.py : add new test suite nsh Thread-Index: AQHTMrv+xwqNHp0qmUybaQmUSN0INqLAmY5g Date: Fri, 22 Sep 2017 08:54:52 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E62EC9DDA@SHSMSX103.ccr.corp.intel.com> References: <1505995229-40964-1-git-send-email-feix.y.wang@intel.com> In-Reply-To: <1505995229-40964-1-git-send-email-feix.y.wang@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.0.116 dlp-reaction: no-action 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 v1] tests/TestSuite_nsh.py : add new test suite nsh 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: Fri, 22 Sep 2017 08:54:57 -0000 Thanks Fei, two comments below. > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of wang fei > Sent: Thursday, September 21, 2017 8:00 PM > To: dts@dpdk.org > Cc: Wang, FeiX Y > Subject: [dts] [patch v1] tests/TestSuite_nsh.py : add new test suite nsh >=20 > Signed-off-by: wang fei > --- > tests/TestSuite_nsh.py | 246 > +++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 246 insertions(+) > create mode 100644 tests/TestSuite_nsh.py >=20 > diff --git a/tests/TestSuite_nsh.py b/tests/TestSuite_nsh.py > new file mode 100644 > index 0000000..870d195 > --- /dev/null > +++ b/tests/TestSuite_nsh.py > @@ -0,0 +1,246 @@ > +# BSD LICENSE > +# > +# Copyright(c) 2010-2015 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 the support of NSH Feature by Poll Mode Drivers. > + > +""" > + > +import dts Please remove dts module dependency.=20 > +import utils > + > + > +from test_case import TestCase > +from pmd_output import PmdOutput > + > + > + > +class TestNsh(TestCase): > + > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + > + """ > + ports =3D self.dut.get_ports() > + > + # Verify that enough ports are available > + self.verify(len(ports) >=3D 1, "Insufficient ports") > + > + self.dutRxPort =3D ports[0] > + self.portMask =3D utils.create_mask(ports[:1]) > + self.testerTxPort =3D self.tester.get_local_port(self.dutRxPort) > + self.inf =3D self.tester.get_interface(self.testerTxPort) > + > + def build_test_pmd(self): > + self.pmdout =3D PmdOutput(self.dut) > + self.pmdout.start_testpmd("Default", "--portmask=3D%s" % > self.portMask) > + > + self.dut.send_expect("set fwd rxonly", "testpmd> ") > + self.dut.send_expect("set verbose 1", "testpmd> ") > + self.dut.send_expect("start", "testpmd> ") > + > + def test_nsh_packet_recognition(self): > + """ > + send ether+nsh packet for recongition > + """ > + self.build_test_pmd() > + self.tester.scapy_foreground() > + This function can be simplified. The logic can be s --> Start testpmd --> Rxonly mode for packet_type in types: generate scapy command based on packet type send this packet check packet type in testpmd --> Quit testpmd > self.tester.scapy_append('sendp([Ether(dst=3D"00:00:00:00:01:00",type=3D0= x894f > )/NSH(Len=3D0x6,NextProto=3D0x0,NSP=3D0x000002,NSI=3D0xff)],iface=3D"%s")= ' % > self.inf) > + self.tester.scapy_execute() > + out =3D self.dut.get_session_output(timeout=3D2) > + self.logger.info(out) > + self.verify("L2_ETHER_NSH" in out, "Ether+NSH Packet not > detected") > + self.dut.send_expect("quit", "#",10) > + > + """ > + send ether+nsh+ip packet for recongition > + """ > + self.build_test_pmd() > + > + self.tester.scapy_foreground() > + > self.tester.scapy_append('sendp([Ether(dst=3D"00:00:00:00:01:00",type=3D0= x894f > )/NSH(Len=3D0x6,NextProto=3D0x1,NSP=3D0x000002,NSI=3D0xff)/IP(src=3D"192.= 168.0.1", > dst=3D"192.168.0.2")], iface=3D"%s")' % self.inf) > + self.tester.scapy_execute() > + out =3D self.dut.get_session_output(timeout=3D2) > + self.logger.info(out) > + self.verify("L2_ETHER_NSH L3_IPV4_EXT_UNKNOWN L4_NONFRAG" in out= , > "Ether+NSH+IP Packet not detected") > + self.dut.send_expect("quit", "#",10) > + > + """ > + send ether+nsh+ip+icmp packet for recongition > + """ > + self.build_test_pmd() > + self.tester.scapy_foreground() > + > self.tester.scapy_append('sendp([Ether(dst=3D"00:00:00:00:01:00",type=3D0= x894f > )/NSH(Len=3D0x6,NextProto=3D0x1,NSP=3D0x000002,NSI=3D0xff)/IP(src=3D"192.= 168.0.1", > dst=3D"192.168.0.2")/ICMP()],iface=3D"%s")' % self.inf) > + self.tester.scapy_execute() > + out =3D self.dut.get_session_output(timeout=3D2) > + self.logger.info(out) > + self.verify("L2_ETHER_NSH L3_IPV4_EXT_UNKNOWN L4_ICMP" in out, > "Ether+NSH+IP+ICMP Packet not detected") > + self.dut.send_expect("quit", "#",10) > + > + """ > + send ether+nsh+ip_frag packet for recongition > + """ > + self.build_test_pmd() > + self.tester.scapy_foreground() > + > self.tester.scapy_append('sendp([Ether(dst=3D"00:00:00:00:01:00",type=3D0= x894f > )/NSH(Len=3D0x6,NextProto=3D0x1,NSP=3D0x000002,NSI=3D0xff)/IP(src=3D"192.= 168.0.1", > dst=3D"192.168.0.2",frag=3D1,flags=3D"MF")],iface=3D"%s")' % self.inf) > + self.tester.scapy_execute() > + out =3D self.dut.get_session_output(timeout=3D2) > + self.logger.info(out) > + self.verify("L2_ETHER_NSH L3_IPV4_EXT_UNKNOWN L4_FRAG" in out, > "Ether+NSH+IP_Frag Packet not detected") > + self.dut.send_expect("quit", "#",10) > + > + """ > + ether+nsh+ip+tcp for recongition > + """ > + self.build_test_pmd() > + self.tester.scapy_foreground() > + > self.tester.scapy_append('sendp([Ether(dst=3D"00:00:00:00:01:00",type=3D0= x894f > )/NSH(Len=3D0x6,NextProto=3D0x1,NSP=3D0x000002,NSI=3D0xff)/IP(src=3D"192.= 168.0.1", > dst=3D"192.168.0.2")/TCP(sport=3D1024,dport=3D1025)],iface=3D"%s")' % sel= f.inf) > + self.tester.scapy_execute() > + out =3D self.dut.get_session_output(timeout=3D2) > + self.logger.info(out) > + self.verify("L2_ETHER_NSH L3_IPV4_EXT_UNKNOWN L4_TCP" in out, > "Ether+NSH+IP+TCP Packet not detected") > + self.dut.send_expect("quit", "#",10) > + > + """ > + ether+nsh+ip+udp for recongition > + """ > + self.build_test_pmd() > + self.tester.scapy_foreground() > + > self.tester.scapy_append('sendp([Ether(dst=3D"00:00:00:00:01:00",type=3D0= x894f > )/NSH(Len=3D0x6,NextProto=3D0x1,NSP=3D0x000002,NSI=3D0xff)/IP(src=3D"192.= 168.0.1", > dst=3D"192.168.0.2")/UDP(sport=3D1024,dport=3D1025)],iface=3D"%s")' % sel= f.inf) > + self.tester.scapy_execute() > + out =3D self.dut.get_session_output(timeout=3D2) > + self.logger.info(out) > + self.verify("L2_ETHER_NSH L3_IPV4_EXT_UNKNOWN L4_UDP" in out, > "Ether+NSH+IP+UDP Packet not detected") > + self.dut.send_expect("quit", "#",10) > + > + """ > + ether+nsh+ip+sctp for recongition > + """ > + self.build_test_pmd() > + self.tester.scapy_foreground() > + > self.tester.scapy_append('sendp([Ether(dst=3D"00:00:00:00:01:00",type=3D0= x894f > )/NSH(Len=3D0x6,NextProto=3D0x1,NSP=3D0x000002,NSI=3D0xff)/IP(src=3D"192.= 168.0.1", > dst=3D"192.168.0.2")/SCTP(tag=3D1)/SCTPChunkData(data=3D\'X\' * > 16)],iface=3D"%s")' % self.inf) > + self.tester.scapy_execute() > + out =3D self.dut.get_session_output(timeout=3D2) > + self.logger.info(out) > + self.verify("L2_ETHER_NSH L3_IPV4_EXT_UNKNOWN L4_SCTP" in out, > "Ether+NSH+IP+SCTP Packet not detected") > + self.dut.send_expect("quit", "#",10) > + > + """ > + ether+nsh+ipv6 for recongition > + """ > + self.build_test_pmd() > + self.tester.scapy_foreground() > + > self.tester.scapy_append('sendp([Ether(dst=3D"00:00:00:00:01:00",type=3D0= x894f > )/NSH(Len=3D0x6,NextProto=3D0x2,NSP=3D0x000002,NSI=3D0xff)/IPv6(src=3D"20= 01::1", > dst=3D"2003::2")],iface=3D"%s")' % self.inf) > + self.tester.scapy_execute() > + out =3D self.dut.get_session_output(timeout=3D2) > + self.logger.info(out) > + self.verify("L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_NONFRAG" in out= , > "Ether+NSH+IPV6 Packet not detected") > + self.dut.send_expect("quit", "#",10) > + > + """ > + ether+nsh+ipv6+icmp for recongition > + """ > + self.build_test_pmd() > + self.tester.scapy_foreground() > + > self.tester.scapy_append('sendp([Ether(dst=3D"00:00:00:00:01:00",type=3D0= x894f > )/NSH(Len=3D0x6,NextProto=3D0x2,NSP=3D0x000002,NSI=3D0xff)/IPv6(src=3D"20= 01::1", > dst=3D"2003::2",nh=3D0x3A)/ICMP()],iface=3D"%s")' % self.inf) > + self.tester.scapy_execute() > + out =3D self.dut.get_session_output(timeout=3D2) > + self.logger.info(out) > + self.verify("L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_ICMP" in out, > "Ether+NSH+IPV6+ICMP Packet not detected") > + self.dut.send_expect("quit", "#",10) > + > + """ > + ether+nsh+ipv6_frag for recongition > + """ > + self.build_test_pmd() > + self.tester.scapy_foreground() > + > self.tester.scapy_append('sendp([Ether(dst=3D"00:00:00:00:01:00",type=3D0= x894f > )/NSH(Len=3D0x6,NextProto=3D0x2,NSP=3D0x000002,NSI=3D0xff)/IPv6(src=3D"20= 01::1", > dst=3D"2003::2")/IPv6ExtHdrFragment()],iface=3D"%s")' % self.inf) > + self.tester.scapy_execute() > + out =3D self.dut.get_session_output(timeout=3D2) > + self.logger.info(out) > + self.verify("L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_FRAG" in out, > "Ether+NSH+IPV6_FRAG Packet not detected") > + self.dut.send_expect("quit", "#",10) > + > + """ > + ether+nsh+ipv6+tcp for recongition > + """ > + self.build_test_pmd() > + self.tester.scapy_foreground() > + > self.tester.scapy_append('sendp([Ether(dst=3D"00:00:00:00:01:00",type=3D0= x894f > )/NSH(Len=3D0x6,NextProto=3D0x2,NSP=3D0x000002,NSI=3D0xff)/IPv6(src=3D"20= 01::1", > dst=3D"2003::2")/TCP(sport=3D1024,dport=3D1025)],iface=3D"%s")' % self.in= f) > + self.tester.scapy_execute() > + out =3D self.dut.get_session_output(timeout=3D2) > + self.logger.info(out) > + self.verify("L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_TCP" in out, > "Ether+NSH+IPV6+TCP Packet not detected") > + self.dut.send_expect("quit", "#",10) > + > + """ > + ether+nsh+ipv6+udp for recongition > + """ > + self.build_test_pmd() > + self.tester.scapy_foreground() > + > self.tester.scapy_append('sendp([Ether(dst=3D"00:00:00:00:01:00",type=3D0= x894f > )/NSH(Len=3D0x6,NextProto=3D0x2,NSP=3D0x000002,NSI=3D0xff)/IPv6(src=3D"20= 01::1", > dst=3D"2003::2")/UDP(sport=3D1024,dport=3D1025)],iface=3D"%s")' % self.in= f) > + self.tester.scapy_execute() > + out =3D self.dut.get_session_output(timeout=3D2) > + self.logger.info(out) > + self.verify("L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_UDP" in out, > "Ether+NSH+IPV6+UDP Packet not detected") > + self.dut.send_expect("quit", "#",10) > + > + """ > + ether+nsh+ipv6+sctp for recongition > + """ > + self.build_test_pmd() > + self.tester.scapy_foreground() > + > self.tester.scapy_append('sendp([Ether(dst=3D"00:00:00:00:01:00",type=3D0= x894f > )/NSH(Len=3D0x6,NextProto=3D0x2,NSP=3D0x000002,NSI=3D0xff)/IPv6(src=3D"20= 01::1", > dst=3D"2003::2",nh=3D0x84)/SCTP(tag=3D1)/SCTPChunkData(data=3D\'X\' * > 16)],iface=3D"%s")' % self.inf) > + self.tester.scapy_execute() > + out =3D self.dut.get_session_output(timeout=3D2) > + self.logger.info(out) > + self.verify("L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_SCTP" in out, > "Ether+NSH+IPV6+SCTP Packet not detected") > + self.dut.send_expect("quit", "#",10) > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + self.dut.kill_all() > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + pass > + > + > + > + > \ No newline at end of file > -- > 2.7.4