test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V1] tests/vf mac filter : add dpdk pf + dpdk vf scenario
@ 2018-04-03  6:16 zhao,meijuan
  2018-04-04 12:47 ` Liu, Yong
  0 siblings, 1 reply; 2+ messages in thread
From: zhao,meijuan @ 2018-04-03  6:16 UTC (permalink / raw)
  To: dts; +Cc: zhao,meijuan

add dpdk pf + dpdk vf scenario

Signed-off-by: zhao,meijuan <meijuanx.zhao@intel.com>
---
 tests/TestSuite_vf_macfilter.py | 100 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 100 insertions(+)

diff --git a/tests/TestSuite_vf_macfilter.py b/tests/TestSuite_vf_macfilter.py
index f0de169..83d641f 100644
--- a/tests/TestSuite_vf_macfilter.py
+++ b/tests/TestSuite_vf_macfilter.py
@@ -216,7 +216,107 @@ class TestVfMacFilter(TestCase):
         print "\nshow port stats in testpmd for double check: \n", self.vm0_testpmd.execute_cmd('show port stats all')
         self.verify(result3 != True, "VF0 failed to forward packets to VF1")
 
+######3. test case for dpdk pf and dpdk vf 2pf_2vf_1vm MAC filter scenario
+###### kernel pf will first run 'ip link set pf_interface vf 0 mac xx:xx:xx:xx:xx:xx, then
+###### bind pf to igb_uio ,in the vm, send packets with this MAC to VF, check if the MAC filter works. Also
+###### send the packets with wrong MAC address to VF, check if the VF will not RX the packets.   
+
+    def test_dpdk_2pf_2vf_1vm_iplink_macfilter(self):
+        
+
+        self.iplinkset = False
+        self.setup_2pf_2vf_1vm_env(driver='igb_uio')
+        self.host_testpmd.execute_cmd('set vf mac addr 0 0 %s' % self.pf0_vf0_mac)
+        self.vm0_dut_ports = self.vm_dut_0.get_ports('any')
+        self.vm0_testpmd = PmdOutput(self.vm_dut_0)
+        self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
+        # Get VF's MAC
+        pmd_vf0_mac = self.vm0_testpmd.get_port_mac(0)
+        vf0_wrongmac = "00:11:22:33:48:55"
+        self.vm0_testpmd.execute_cmd('set promisc all off')
+        self.vm0_testpmd.execute_cmd('set fwd mac')
+        self.vm0_testpmd.execute_cmd('start')
+
+        time.sleep(2)
+
+        tgen_ports = []
+        tx_port = self.tester.get_local_port(self.dut_ports[0])
+        rx_port = self.tester.get_local_port(self.dut_ports[1])
+        tgen_ports.append((tx_port, rx_port))
+        #dst_mac = self.pf0_vf0_mac
+        dst_mac = self.pf0_vf0_mac
+        src_mac = self.tester.get_mac(tx_port)
+        pkt_param=[("ether", {'dst': dst_mac, 'src': src_mac})]
+
+        print "\nfirst send packets to the dpdk PF set MAC, expected result is RX packets=TX packets\n"
+        result1 = self.tester.check_random_pkts(tgen_ports, pktnum=100, allow_miss=False, params=pkt_param)
+        print "\nshow port stats in testpmd for double check: \n", self.vm0_testpmd.execute_cmd('show port stats all')
+        self.verify(result1 != False, "VF0 failed to forward packets to VF1")
+
+        print "\nSecondly, negative test, send packets to a wrong MAC, expected result is RX packets=0\n"
+        dst_mac = vf0_wrongmac
+        pkt_param=[("ether", {'dst': dst_mac, 'src': src_mac})]
+        result2 = self.tester.check_random_pkts(tgen_ports, pktnum=100, allow_miss=False, params=pkt_param)
+        print "\nshow port stats in testpmd for double check: \n", self.vm0_testpmd.execute_cmd('show port stats all')
+        self.verify(result2 != True, "VF0 failed to forward packets to VF1")    
  
+#######4. test case for dpdk pf and dpdk vf 2pf_2vf_1vm MAC filter scenario.
+####### dpdk pf will not set MAC address and the VF will get a random generated MAC
+####### in the testpmd in VM, and then add VF mac address in the testpmd,for example, VF_MAC1
+####### then send packets to the VF with the random generated MAC and the new added VF_MAC1
+####### and the expected result is that all packets can be RXed and TXed. What's more, send
+####### packets with a wrong MAC address to the VF will not received by the VF.
+
+    def test_dpdk_2pf_2vf_1vm_mac_add_filter(self):
+
+        self.iplinkset = False
+        self.setup_2pf_2vf_1vm_env(driver='igb_uio')
+
+        self.vm0_dut_ports = self.vm_dut_0.get_ports('any')
+        self.vm0_testpmd = PmdOutput(self.vm_dut_0)
+        self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
+
+        # Get VF0 port MAC address
+        pmd_vf0_mac = self.vm0_testpmd.get_port_mac(0)
+        vf0_setmac = "00:11:22:33:44:55"
+        vf0_wrongmac = "00:11:22:33:48:55"
+        self.vm0_testpmd.execute_cmd('set promisc all off')
+        ret = self.vm0_testpmd.execute_cmd('mac_addr add 0 %s' %vf0_setmac)
+        # check the operation is supported or not.
+        print ret
+
+        self.vm0_testpmd.execute_cmd('set fwd mac')
+        self.vm0_testpmd.execute_cmd('start')
+
+        time.sleep(2)
+
+        tgen_ports = []
+        tx_port = self.tester.get_local_port(self.dut_ports[0])
+        rx_port = self.tester.get_local_port(self.dut_ports[1])
+        tgen_ports.append((tx_port, rx_port))
+        src_mac = self.tester.get_mac(tx_port)
+        dst_mac = pmd_vf0_mac
+        pkt_param=[("ether", {'dst': dst_mac, 'src': src_mac})]
+
+        print "\nfirst send packets to the random generated VF MAC, expected result is RX packets=TX packets\n"
+        result1 = self.tester.check_random_pkts(tgen_ports, pktnum=100, allow_miss=False, params=pkt_param)
+        print "\nshow port stats in testpmd for double check: \n", self.vm0_testpmd.execute_cmd('show port stats all')
+        self.verify(result1 != False, "VF0 failed to forward packets to VF1")
+
+        print "\nsecondly, send packets to the new added MAC, expected result is RX packets=TX packets\n"
+        dst_mac = vf0_setmac
+        pkt_param=[("ether", {'dst': dst_mac, 'src': src_mac})]
+        result2 = self.tester.check_random_pkts(tgen_ports, pktnum=100, allow_miss=False, params=pkt_param)
+        print "\nshow port stats in testpmd for double check: \n", self.vm0_testpmd.execute_cmd('show port stats all')
+        self.verify(result2 != False, "VF0 failed to forward packets to VF1")
+
+        print "\nThirdly, negative test, send packets to a wrong MAC, expected result is RX packets=0\n"
+        dst_mac = vf0_wrongmac
+        pkt_param=[("ether", {'dst': dst_mac, 'src': src_mac})]
+        result3 = self.tester.check_random_pkts(tgen_ports, pktnum=100, allow_miss=False, params=pkt_param)
+        print "\nshow port stats in testpmd for double check: \n", self.vm0_testpmd.execute_cmd('show port stats all')
+        self.verify(result3 != True, "VF0 failed to forward packets to VF1")
+
     def tear_down(self):
 
         if self.setup_2pf_2vf_1vm_env_flag == 1:
-- 
1.9.3

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

* Re: [dts] [PATCH V1] tests/vf mac filter : add dpdk pf + dpdk vf scenario
  2018-04-03  6:16 [dts] [PATCH V1] tests/vf mac filter : add dpdk pf + dpdk vf scenario zhao,meijuan
@ 2018-04-04 12:47 ` Liu, Yong
  0 siblings, 0 replies; 2+ messages in thread
From: Liu, Yong @ 2018-04-04 12:47 UTC (permalink / raw)
  To: zhao,meijuan, dts

Meijuan, please send test plan for review first.

Thanks,
Marvin

On 04/03/2018 02:16 PM, zhao,meijuan wrote:
> add dpdk pf + dpdk vf scenario
>
> Signed-off-by: zhao,meijuan<meijuanx.zhao@intel.com>

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

end of thread, other threads:[~2018-04-04  4:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-03  6:16 [dts] [PATCH V1] tests/vf mac filter : add dpdk pf + dpdk vf scenario zhao,meijuan
2018-04-04 12:47 ` Liu, Yong

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