test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] Add RRC support for shutdown_api
@ 2015-07-15  3:08 Michael Qiu
       [not found] ` <533710CFB86FA344BFBF2D6802E6028621B4D839@SHSMSX101.ccr.corp.intel.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Qiu @ 2015-07-15  3:08 UTC (permalink / raw)
  To: dts

Test suite shutdown_api add RRC support.

Signed-off-by: Michael Qiu <michael.qiu@intel.com>
---
 tests/TestSuite_shutdown_api.py | 144 ++++++++++++++++++++++++++--------------
 1 file changed, 94 insertions(+), 50 deletions(-)

diff --git a/tests/TestSuite_shutdown_api.py b/tests/TestSuite_shutdown_api.py
index ce9b8c0..13a0aae 100644
--- a/tests/TestSuite_shutdown_api.py
+++ b/tests/TestSuite_shutdown_api.py
@@ -76,18 +76,23 @@ class TestShutdownApi(TestCase):
     def get_stats(self, portid):
         """
         Get packets number from port statistic.
+        @param: stop -- stop forward before get stats
         """
         output = PmdOutput(self.dut)
         stats = output.get_pmd_stats(portid)
         return stats
 
-    def check_forwarding(self, ports, nic, testerports=[None, None], pktSize=64, received=True, crcStrip=False, vlan=False):
+    def check_forwarding(self, ports, nic, testerports=[None, None], pktSize=64, received=True, crcStrip=True, vlan=False, softpkg=True, promisc=False):
+        if len(ports) == 1:
+            self.send_packet(ports[0], ports[0], self.nic, testerports[0], pktSize, received, crcStrip, vlan, softpkg, promisc)
+            return
+
         for i in range(len(ports)):
             if i % 2 == 0:
-                self.send_packet(ports[i], ports[i + 1], self.nic, testerports[1], pktSize, received, crcStrip=crcStrip, vlan=vlan)
-                self.send_packet(ports[i + 1], ports[i], self.nic, testerports[0], pktSize, received, crcStrip=crcStrip, vlan=vlan)
+                self.send_packet(ports[i], ports[i + 1], self.nic, testerports[1], pktSize, received, crcStrip, vlan, softpkg, promisc)
+                self.send_packet(ports[i + 1], ports[i], self.nic, testerports[0], pktSize, received, crcStrip, vlan, softpkg, promisc)
 
-    def send_packet(self, txPort, rxPort, nic, testerports=None, pktSize=64, received=True, crcStrip=False, vlan=False):
+    def send_packet(self, txPort, rxPort, nic, testerports=None, pktSize=64, received=True, crcStrip=True, vlan=False, softpkg=True, promisc=False):
         """
         Send packages according to parameters.
         """
@@ -101,23 +106,40 @@ class TestShutdownApi(TestCase):
             itf = self.tester.get_interface(self.tester.get_local_port(rxPort))
         else:
             itf = testerports
-        mac = self.dut.get_mac_address(txPort)
+        smac = self.tester.get_mac(self.tester.get_local_port(rxPort))
+        dmac = self.dut.get_mac_address(rxPort)
+        if promisc:
+            dmac = "00:00:00:00:00:01"
 
         self.tester.scapy_foreground()
+
         if self.nic in ["fortville_eagle", "fortville_spirit",
                         "fortville_spirit_single", "bartonhills",
-                        "powerville", "springville", "hartwell"]:
+                        "powerville", "springville", "hartwell", "redrockcanyou"]:
             pktlen = pktSize - HEADER_SIZE['eth'] -4 
         else:
             pktlen = pktSize - HEADER_SIZE['eth']
         padding = pktlen - HEADER_SIZE['ip']
 
+        pkg = ''
+
         if vlan:
-            self.tester.scapy_append('sendp([Ether(dst="%s")/Dot1Q(vlan=1)/IP()/Raw(load="\x50"*%s)], iface="%s")' % (mac, padding, itf))
+            if pktSize <= 64:
+                pktSize=68
+            pkg = 'Ether(src="%s", dst="%s")/Dot1Q(vlan=1)/IP()/Raw(load="P" * %d)' % (smac, dmac, padding)
+        else:
+            pkg = 'Ether(src="%s", dst="%s")/IP()/Raw(load="P" * %d)' % (smac, dmac, padding)
+
+        if softpkg == True:
+            self.tester.scapy_append('sendp(%s, iface="%s")' % (pkg,itf))
+            self.tester.scapy_execute()
         else:
-            self.tester.scapy_append('sendp([Ether(dst="%s")/IP()/Raw(load="\x50"*%s)], iface="%s")' % (mac, padding, itf))
+            tgenInput = []
+            self.tester.scapy_append('wrpcap("test%d.pcap", %s' % (rxPort, pkg))
+            tgenInput.append((self.tester.get_local_port(
+                rxPort), self.tester.get_local_port(txPort), "test%d.pcap" % rxPort))
+            self.tester.traffic_generator_throughput(tgenInput)
 
-        self.tester.scapy_execute()
         time.sleep(3)
 
         port0_stats = self.get_stats(txPort)
@@ -133,41 +155,39 @@ class TestShutdownApi(TestCase):
         p1rx_err -= gp1rx_err
         if received:
 
-            if vlan:
-                self.verify(p0tx_pkts == p1rx_pkts,
-                            "Wrong TX pkts p0_tx=%d, p1_rx=%d" % (p0tx_pkts, p1rx_pkts))
-            else:
-                if self.nic in ["fortville_eagle", "fortville_spirit",
+            self.verify(p0tx_pkts == p1rx_pkts,
+                        "Wrong TX pkts p0_tx=%d, p1_rx=%d" % (p0tx_pkts, p1rx_pkts))
+            if vlan == False:
+                # RRC and FVL always strip crc
+                if self.nic in ["redrockcanyou", "fortville_eagle", "fortville_spirit",
                                 "fortville_spirit_single", "bartonhills",
                                 "powerville", "springville", "hartwell"]:
-
-                    self.verify(p0tx_bytes == pktSize,
+                    self.verify(p0tx_bytes == pktSize -4,
                                 "Wrong TX bytes p0_tx=%d, pktSize=%d" % (p0tx_bytes, pktSize))
                 else:
-                    self.verify(p0tx_bytes == pktSize,
+                    if crcStrip:
+                        self.verify(p1rx_bytes == pktSize -4,
+                                    "Wrong RX bytes CRC strip: p1_rx=%d, pktSize=%d" % (p1rx_bytes, pktSize))
+                    else:
+                        self.verify(p1rx_bytes == pktSize,
+                                    "Wrong RX bytes NO CRC strip: p1_rx=%d, pktSize=%d" % (p0tx_bytes, pktSize))
+            else:
+                # RRC always strip vlan and crc
+                if self.nic in ["redrockcanyou"]:
+                    self.verify(p1rx_bytes == pktSize - 8,
                                 "Wrong TX bytes p0_tx=%d, pktSize=%d" % (p0tx_bytes, pktSize))
-            if crcStrip:
-                if self.nic in ["fortville_eagle", "fortville_spirit",
+                elif self.nic in ["fortville_eagle", "fortville_spirit",
                                 "fortville_spirit_single", "bartonhills",
                                 "powerville", "springville", "hartwell"]:
-                    self.verify(p1rx_bytes - 4 == pktSize,
-                                "Wrong RX bytes CRC strip: p1_rx=%d, pktSize=%d" % (p1rx_bytes, pktSize))
-                else:
                     self.verify(p1rx_bytes == pktSize - 4,
-                                "Wrong RX bytes CRC strip: p1_rx=%d, pktSize=%d" % (p1rx_bytes, pktSize))
-            else:
-                if vlan:
-                    if self.nic in ["fortville_eagle", "fortville_spirit",
-                                    "fortville_spirit_single", "bartonhills",
-                                    "powerville", "springville", "hartwell"]:
-                            self.verify(p1rx_bytes == pktSize,
-                                        "Wrong RX bytes No CRC strip: p1_rx=%d, pktSize=%d" % (p1rx_bytes, pktSize))
-                    else:
-                        self.verify(p1rx_bytes == pktSize + 4,
-                                    "Wrong RX bytes No CRC strip: p1_rx=%d, pktSize=%d" % (p1rx_bytes, pktSize))
+                                "Wrong TX bytes p0_tx=%d, pktSize=%d" % (p0tx_bytes, pktSize))
                 else:
-                    self.verify(p1rx_bytes == pktSize,
-                                "Wrong RX bytes No CRC strip: p1_rx=%d, pktSize=%d" % (p1rx_bytes, pktSize))
+                    if crcStrip:
+                        self.verify(p1rx_bytes == pktSize -4,
+                                    "Wrong RX bytes CRC strip: p1_rx=%d, pktSize=%d" % (p1rx_bytes, pktSize))
+                    else:
+                        self.verify(p1rx_bytes == pktSize,
+                                    "Wrong RX bytes NO CRC strip: p1_rx=%d, pktSize=%d" % (p0tx_bytes, pktSize))
         else:
             self.verify(
                 p0tx_pkts == 0, "Packet not dropped p0tx_pkts=%d" % p0tx_pkts)
@@ -199,6 +219,7 @@ class TestShutdownApi(TestCase):
         self.pmdout.start_testpmd("Default", "--portmask=%s" % dts.create_mask(self.ports), socket=self.ports_socket)
 
         self.dut.send_expect("set fwd mac", "testpmd>")
+        self.dut.send_expect("set promisc all off", "testpmd> ")
         self.dut.send_expect("start", "testpmd> ")
         self.check_forwarding(self.ports, self.nic)
         self.dut.send_expect("stop", "testpmd> ")
@@ -214,7 +235,16 @@ class TestShutdownApi(TestCase):
         """
         Promiscuous mode.
         """
-        self.pmdout.start_testpmd("Default", "--portmask=%s" % dts.create_mask([self.ports[0], self.ports[1]]), self.ports_socket)
+        ports = []
+        # RRC is different with other type, inside a switch,
+        # so better to use one port to verify promisc mode
+        if self.nic == "redrockcanyou":
+            ports = [self.ports[0]]
+        else:
+            ports = [self.ports[0], self.ports[1]]
+
+        portmask = dts.create_mask(ports)
+        self.pmdout.start_testpmd("Default", "--portmask=%s" % portmask, self.ports_socket)
 
         self.dut.send_expect("port stop all", "testpmd> ", 100)
         self.dut.send_expect("set promisc all off", "testpmd> ")
@@ -223,19 +253,19 @@ class TestShutdownApi(TestCase):
         self.dut.send_expect("start", "testpmd> ")
 
         try:
-            self.check_forwarding([self.ports[0], self.ports[1]], self.nic)
+            self.check_forwarding(ports, self.nic)
         except dts.VerifyFailure as e:
             print 'promiscuous mode is working correctly'
         except Exception as e:
             print "   !!! DEBUG IT: " + e.message
-            return "FAIL"
+            self.verify(False, e.message)
 
         self.dut.send_expect("port stop all", "testpmd> ", 100)
         self.dut.send_expect("set promisc all on", "testpmd> ")
         self.dut.send_expect("port start all", "testpmd> ", 100)
         self.dut.send_expect("show config rxtx", "testpmd> ")
         self.dut.send_expect("start", "testpmd> ")
-        self.check_forwarding([self.ports[0], self.ports[1]], self.nic)
+        self.check_forwarding(ports, self.nic, promisc=True)
         self.dut.send_expect("port stop all", "testpmd> ", 100)
         self.dut.send_expect("set promisc all off", "testpmd> ")
         self.dut.send_expect("start", "testpmd> ")
@@ -258,6 +288,7 @@ class TestShutdownApi(TestCase):
         #self.dut.send_expect("set coremask 0x1e", "testpmd> ")
         self.dut.send_expect("set coremask 0xe0", "testpmd> ")
         self.dut.send_expect("set fwd mac", "testpmd>")
+        self.dut.send_expect("set promisc all off", "testpmd> ")
         self.dut.send_expect("port start all", "testpmd> ", 100)
         out = self.dut.send_expect("show config rxtx", "testpmd> ")
         self.verify("RX queues=2" in out, "RX queues not reconfigured properly")
@@ -278,21 +309,26 @@ class TestShutdownApi(TestCase):
         self.dut.send_expect("port stop all", "testpmd> ", 100)
         self.dut.send_expect("port config all crc-strip on", "testpmd> ")
         self.dut.send_expect("set fwd mac", "testpmd>")
+        self.dut.send_expect("set promisc all off", "testpmd>")
         self.dut.send_expect("port start all", "testpmd> ", 100)
         out = self.dut.send_expect("show config rxtx", "testpmd> ")
         self.verify(
             "CRC stripping enabled" in out, "CRC stripping not enabled properly")
         self.dut.send_expect("start", "testpmd> ")
-        if self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single"]:
-            self.check_forwarding(self.ports, self.nic, crcStrip=False)
-        else:
+        if self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "redrockcanyou"]:
             self.check_forwarding(self.ports, self.nic, crcStrip=True)
+        else:
+            self.check_forwarding(self.ports, self.nic, crcStrip=False)
              
 
     def test_change_linkspeed(self):
         """
         Change Link Speed.
         """
+        if self.nic == "redrockcanyou":
+            print dts.RED("RRC not support\n")
+            return
+
         self.pmdout.start_testpmd("Default", "--portmask=%s" % dts.create_mask(self.ports), socket=self.ports_socket)
 
         out = self.tester.send_expect(
@@ -329,6 +365,10 @@ class TestShutdownApi(TestCase):
         """
         Enable/Disable Jumbo Frames.
         """
+        if self.nic == "redrockcanyou":
+            print dts.RED("RRC not support\n")
+            return
+
         self.pmdout.start_testpmd("Default", "--portmask=%s" % dts.create_mask(self.ports), socket=self.ports_socket)
         self.dut.send_expect("port stop all", "testpmd> ", 100)
         self.dut.send_expect("vlan set strip off all", "testpmd> ")
@@ -344,6 +384,7 @@ class TestShutdownApi(TestCase):
         self.check_forwarding(self.ports, self.nic, pktSize=2049, received=False, vlan=True)
 
         self.dut.send_expect("stop", "testpmd> ")
+
         self.dut.send_expect("port stop all", "testpmd> ", 100)
         self.dut.send_expect("port config all hw-vlan off", "testpmd> ")
         self.dut.send_expect("port start all", "testpmd> ", 100)
@@ -366,13 +407,14 @@ class TestShutdownApi(TestCase):
         self.dut.send_expect("port stop all", "testpmd> ", 100)
         self.dut.send_expect("port config rss ip", "testpmd> ")
         self.dut.send_expect("set fwd mac", "testpmd>")
+        self.dut.send_expect("set promisc all off", "testpmd>")
         self.dut.send_expect("port start all", "testpmd> ", 100)
         self.dut.send_expect("start", "testpmd> ")
         self.check_forwarding(self.ports, self.nic)
 
     def test_change_numberrxdtxd(self):
         """
-        Enable/Disable Jumbo Frame.
+        Change numbers of rxd and txd.
         """
         self.pmdout.start_testpmd("Default", "--portmask=%s" % dts.create_mask(self.ports), socket=self.ports_socket)
 
@@ -380,6 +422,7 @@ class TestShutdownApi(TestCase):
         self.dut.send_expect("port config all rxd 1024", "testpmd> ")
         self.dut.send_expect("port config all txd 1024", "testpmd> ")
         self.dut.send_expect("set fwd mac", "testpmd>")
+        self.dut.send_expect("set promisc all off", "testpmd>")
         self.dut.send_expect("port start all", "testpmd> ", 100)
         out = self.dut.send_expect("show config rxtx", "testpmd> ")
         self.verify(
@@ -399,6 +442,7 @@ class TestShutdownApi(TestCase):
         self.dut.send_expect("port config all rxd 1024", "testpmd> ")
         self.dut.send_expect("port config all txd 1024", "testpmd> ")
         self.dut.send_expect("set fwd mac", "testpmd>")
+        self.dut.send_expect("set promisc all off", "testpmd>")
         self.dut.send_expect("port start all", "testpmd> ", 100)
         out = self.dut.send_expect("show config rxtx", "testpmd> ")
         self.verify(
@@ -450,6 +494,7 @@ class TestShutdownApi(TestCase):
         self.verify("hthresh=64" in out, "TX descriptor not reconfigured properly")
         self.verify("wthresh=64" in out, "TX descriptor not reconfigured properly")
         self.dut.send_expect("set fwd mac", "testpmd>")
+        self.dut.send_expect("set promisc all off", "testpmd>")
         self.dut.send_expect("start", "testpmd> ")
         self.check_forwarding(self.ports, self.nic)
 
@@ -461,16 +506,10 @@ class TestShutdownApi(TestCase):
 
         self.pmdout.start_testpmd("Default", "--portmask=%s" % dts.create_mask(self.ports), socket=self.ports_socket)
 
-        self.tester.scapy_append('wrpcap("test.pcap", [Ether()/IP()/UDP()/()])')
-        tgenInput = []
-
-        for port in self.ports:
-            tgenInput.append((self.tester.get_local_port(
-                port), self.tester.get_local_port(port), "test.pcap"))
-
         for _ in range(stress_iterations):
             self.dut.send_expect("port stop all", "testpmd> ", 100)
             self.dut.send_expect("set fwd mac", "testpmd>")
+            self.dut.send_expect("set promisc all off", "testpmd>")
             self.dut.send_expect("port start all", "testpmd> ", 100)
             self.dut.send_expect("start", "testpmd> ")
             self.check_forwarding(self.ports, self.nic)
@@ -482,8 +521,13 @@ class TestShutdownApi(TestCase):
         """
         port link stats test
         """
+        if self.nic == "redrockcanyou":
+            print dts.RED("RRC not support\n")
+            return
+
         self.pmdout.start_testpmd("Default", "--portmask=%s" % dts.create_mask(self.ports), socket=self.ports_socket)
         self.dut.send_expect("set fwd mac", "testpmd>")
+        self.dut.send_expect("set promisc all off", "testpmd>")
         self.dut.send_expect("start", "testpmd>")
 
         # default test
-- 
1.9.3

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dts] [PATCH] Add RRC support for shutdown_api
       [not found]   ` <DF2A19295B96364286FEB7F3DDA27A4637A90A9B@SHSMSX101.ccr.corp.intel.com>
@ 2015-10-20  8:14     ` Qiu, Michael
  0 siblings, 0 replies; 2+ messages in thread
From: Qiu, Michael @ 2015-10-20  8:14 UTC (permalink / raw)
  To: Xu, HuilongX, Liu, Yong, dts

On 2015/10/20 10:34, Xu, HuilongX wrote:
> Hi Michael,
> Pls see my comments as below.
> Thanks  a lot
>>

[../..]

>> self.tester.scapy_append('sendp([Ether(dst="%s")/Dot1Q(vlan=1)/IP()/Raw(lo
>> ad="\x50"*%s)], iface="%s")' % (mac, padding, itf))
>>> +            if pktSize <= 64:
>>> +                pktSize=68
> Why pktsize minimum is 68, RRC nic minimum pktsize is 68?

Not yet, because one vlan packet is 68 bytes right?

Thanks,
Michael

[../..]

>>>      def test_change_linkspeed(self):
>>>          """
>>>          Change Link Speed.
>>>          """
>>> +        if self.nic == "redrockcanyou":
>>> +            print dts.RED("RRC not support\n")
>>> +            return
>>> +
> You shoud add this case in check_case_list.xlsx for skip RRC test.

I will add it in other patch.


>>>          self.pmdout.start_testpmd("Default", "--portmask=%s" %
>> dts.create_mask(self.ports), socket=self.ports_socket)
>>>
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-20  8:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-15  3:08 [dts] [PATCH] Add RRC support for shutdown_api Michael Qiu
     [not found] ` <533710CFB86FA344BFBF2D6802E6028621B4D839@SHSMSX101.ccr.corp.intel.com>
     [not found]   ` <DF2A19295B96364286FEB7F3DDA27A4637A90A9B@SHSMSX101.ccr.corp.intel.com>
2015-10-20  8:14     ` Qiu, Michael

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).