From: "Liu, Yong" <yong.liu@intel.com>
To: "Wang, FeiX Y" <feix.y.wang@intel.com>, "dts@dpdk.org" <dts@dpdk.org>
Cc: "Wang, FeiX Y" <feix.y.wang@intel.com>
Subject: Re: [dts] [patch v1] tests/TestSuite_nsh.py : add new test suite nsh
Date: Fri, 22 Sep 2017 08:54:52 +0000 [thread overview]
Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E62EC9DDA@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <1505995229-40964-1-git-send-email-feix.y.wang@intel.com>
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 <feix.y.wang@intel.com>
> Subject: [dts] [patch v1] tests/TestSuite_nsh.py : add new test suite nsh
>
> Signed-off-by: wang fei <feix.y.wang@intel.com>
> ---
> tests/TestSuite_nsh.py | 246
> +++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 246 insertions(+)
> create mode 100644 tests/TestSuite_nsh.py
>
> 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.
> +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 = self.dut.get_ports()
> +
> + # Verify that enough ports are available
> + self.verify(len(ports) >= 1, "Insufficient ports")
> +
> + self.dutRxPort = ports[0]
> + self.portMask = utils.create_mask(ports[:1])
> + self.testerTxPort = self.tester.get_local_port(self.dutRxPort)
> + self.inf = self.tester.get_interface(self.testerTxPort)
> +
> + def build_test_pmd(self):
> + self.pmdout = PmdOutput(self.dut)
> + self.pmdout.start_testpmd("Default", "--portmask=%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="00:00:00:00:01:00",type=0x894f
> )/NSH(Len=0x6,NextProto=0x0,NSP=0x000002,NSI=0xff)],iface="%s")' %
> self.inf)
> + self.tester.scapy_execute()
> + out = self.dut.get_session_output(timeout=2)
> + 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="00:00:00:00:01:00",type=0x894f
> )/NSH(Len=0x6,NextProto=0x1,NSP=0x000002,NSI=0xff)/IP(src="192.168.0.1",
> dst="192.168.0.2")], iface="%s")' % self.inf)
> + self.tester.scapy_execute()
> + out = self.dut.get_session_output(timeout=2)
> + 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="00:00:00:00:01:00",type=0x894f
> )/NSH(Len=0x6,NextProto=0x1,NSP=0x000002,NSI=0xff)/IP(src="192.168.0.1",
> dst="192.168.0.2")/ICMP()],iface="%s")' % self.inf)
> + self.tester.scapy_execute()
> + out = self.dut.get_session_output(timeout=2)
> + 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="00:00:00:00:01:00",type=0x894f
> )/NSH(Len=0x6,NextProto=0x1,NSP=0x000002,NSI=0xff)/IP(src="192.168.0.1",
> dst="192.168.0.2",frag=1,flags="MF")],iface="%s")' % self.inf)
> + self.tester.scapy_execute()
> + out = self.dut.get_session_output(timeout=2)
> + 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="00:00:00:00:01:00",type=0x894f
> )/NSH(Len=0x6,NextProto=0x1,NSP=0x000002,NSI=0xff)/IP(src="192.168.0.1",
> dst="192.168.0.2")/TCP(sport=1024,dport=1025)],iface="%s")' % self.inf)
> + self.tester.scapy_execute()
> + out = self.dut.get_session_output(timeout=2)
> + 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="00:00:00:00:01:00",type=0x894f
> )/NSH(Len=0x6,NextProto=0x1,NSP=0x000002,NSI=0xff)/IP(src="192.168.0.1",
> dst="192.168.0.2")/UDP(sport=1024,dport=1025)],iface="%s")' % self.inf)
> + self.tester.scapy_execute()
> + out = self.dut.get_session_output(timeout=2)
> + 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="00:00:00:00:01:00",type=0x894f
> )/NSH(Len=0x6,NextProto=0x1,NSP=0x000002,NSI=0xff)/IP(src="192.168.0.1",
> dst="192.168.0.2")/SCTP(tag=1)/SCTPChunkData(data=\'X\' *
> 16)],iface="%s")' % self.inf)
> + self.tester.scapy_execute()
> + out = self.dut.get_session_output(timeout=2)
> + 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="00:00:00:00:01:00",type=0x894f
> )/NSH(Len=0x6,NextProto=0x2,NSP=0x000002,NSI=0xff)/IPv6(src="2001::1",
> dst="2003::2")],iface="%s")' % self.inf)
> + self.tester.scapy_execute()
> + out = self.dut.get_session_output(timeout=2)
> + 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="00:00:00:00:01:00",type=0x894f
> )/NSH(Len=0x6,NextProto=0x2,NSP=0x000002,NSI=0xff)/IPv6(src="2001::1",
> dst="2003::2",nh=0x3A)/ICMP()],iface="%s")' % self.inf)
> + self.tester.scapy_execute()
> + out = self.dut.get_session_output(timeout=2)
> + 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="00:00:00:00:01:00",type=0x894f
> )/NSH(Len=0x6,NextProto=0x2,NSP=0x000002,NSI=0xff)/IPv6(src="2001::1",
> dst="2003::2")/IPv6ExtHdrFragment()],iface="%s")' % self.inf)
> + self.tester.scapy_execute()
> + out = self.dut.get_session_output(timeout=2)
> + 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="00:00:00:00:01:00",type=0x894f
> )/NSH(Len=0x6,NextProto=0x2,NSP=0x000002,NSI=0xff)/IPv6(src="2001::1",
> dst="2003::2")/TCP(sport=1024,dport=1025)],iface="%s")' % self.inf)
> + self.tester.scapy_execute()
> + out = self.dut.get_session_output(timeout=2)
> + 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="00:00:00:00:01:00",type=0x894f
> )/NSH(Len=0x6,NextProto=0x2,NSP=0x000002,NSI=0xff)/IPv6(src="2001::1",
> dst="2003::2")/UDP(sport=1024,dport=1025)],iface="%s")' % self.inf)
> + self.tester.scapy_execute()
> + out = self.dut.get_session_output(timeout=2)
> + 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="00:00:00:00:01:00",type=0x894f
> )/NSH(Len=0x6,NextProto=0x2,NSP=0x000002,NSI=0xff)/IPv6(src="2001::1",
> dst="2003::2",nh=0x84)/SCTP(tag=1)/SCTPChunkData(data=\'X\' *
> 16)],iface="%s")' % self.inf)
> + self.tester.scapy_execute()
> + out = self.dut.get_session_output(timeout=2)
> + 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
prev parent reply other threads:[~2017-09-22 8:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-21 12:00 wang fei
2017-09-22 8:54 ` Liu, Yong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86228AFD5BCD8E4EBFD2B90117B5E81E62EC9DDA@SHSMSX103.ccr.corp.intel.com \
--to=yong.liu@intel.com \
--cc=dts@dpdk.org \
--cc=feix.y.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).