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 F315E58CB for ; Tue, 11 Apr 2017 08:13:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1491891227; x=1523427227; h=from:to:cc:subject:date:message-id; bh=nTLN7y8ltrBilRubAICRObuY4TRnZFeBABnLDTq5vkY=; b=dyc+Z2gPwasBQeflMhGOYG7UnoaAD8tFc8eb+U82J1Z3QpE8p7Vgc9lI 1hgNhWtL/ILXmdsRHKyYowoaz+xO0A==; Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Apr 2017 23:13:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,184,1488873600"; d="scan'208";a="76055943" Received: from stv-crb-08.sh.intel.com (HELO dpdk-test60.sh.intel.com) ([10.239.128.48]) by orsmga004.jf.intel.com with ESMTP; 10 Apr 2017 23:13:45 -0700 From: Xueqin Lin To: dts@dpdk.org Cc: Xueqin Lin Date: Mon, 10 Apr 2017 20:09:56 -0400 Message-Id: <1491869396-6935-1-git-send-email-xueqin.lin@intel.com> X-Mailer: git-send-email 2.5.5 Subject: [dts] [PATCH] add vlan filter script to VF daemon suite 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: Tue, 11 Apr 2017 06:13:47 -0000 --- tests/TestSuite_vf_daemon.py | 55 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/tests/TestSuite_vf_daemon.py b/tests/TestSuite_vf_daemon.py index 62532af..692e41c 100644 --- a/tests/TestSuite_vf_daemon.py +++ b/tests/TestSuite_vf_daemon.py @@ -634,6 +634,61 @@ class Testvf_daemon(TestCase): self.vm0_testpmd.quit() self.dut_testpmd.quit() + + def test_vlan_filter(self): + """ + Add/Remove vlan filter for a VF from PF + """ + self.dut_testpmd.start_testpmd("Default", "--port-topology=chained") + self.vm0_testpmd.start_testpmd(VM_CORES_MASK, '--port-topology=chained') + + self.vm0_testpmd.execute_cmd('set fwd rxonly') + self.vm0_testpmd.execute_cmd('set verbose 1') + self.vm0_testpmd.execute_cmd('start') + + wrong_mac = '9E:AC:72:49:43:11' + out = self.send_and_pmdout(wrong_mac) + self.verify("dst=%s" % wrong_mac in out, + "Failed to receive untagged packet!!!") + random_vlan = random.randint(1, MAX_VLAN - 1) + out = self.send_and_pmdout(wrong_mac, random_vlan) + self.verify("dst=%s" % wrong_mac in out, + "Failed to receive packet with vlan id!!!") + self.verify("VLAN tci=%s" % hex(random_vlan) in out, + "Failed to receive packet with vlan id!!!") + random_vlan = random.randint(1, MAX_VLAN - 1) + rx_vlans = [1, random_vlan, MAX_VLAN] + for rx_vlan in rx_vlans: + self.dut_testpmd.execute_cmd('rx_vlan add %s port 0 vf 1'% rx_vlan) + time.sleep(1) + out = self.send_and_pmdout(wrong_mac, rx_vlan) + self.verify("dst=%s" % wrong_mac in out, + "Failed to enable vlan filter!!!") + self.verify("VLAN tci=%s" % hex(rx_vlan) in out, + "Failed to receive packet with vlan id!!!") + + wrong_rx_vlan = (rx_vlan + 2) % 4095 + out = self.send_and_pmdout(wrong_mac, wrong_rx_vlan) + self.verify("dst=%s" % wrong_mac not in out, + "Failed to enable vlan filter!!!") + self.dut_testpmd.execute_cmd('rx_vlan rm %s port 0 vf 1'% rx_vlan) + out = self.send_and_pmdout(wrong_mac, rx_vlan) + self.verify("dst=%s" % wrong_mac in out, + "Failed to disable vlan filter!!!") + self.verify("VLAN tci=%s" % hex(rx_vlan) in out, + "Failed to receive packet with vlan id!!!") + out = self.send_and_pmdout(wrong_mac, wrong_rx_vlan) + self.verify("dst=%s" % wrong_mac in out, + "Failed to disable vlan filter!!!") + self.verify("VLAN tci=%s" % hex(wrong_rx_vlan) in out, + "Failed to receive packet with vlan id!!!") + + out = self.send_and_pmdout(wrong_mac) + self.verify("dst=%s" % wrong_mac in out, + "Failed to receive untagged packet!!!") + + self.vm0_testpmd.quit() + self.dut_testpmd.quit() def tear_down(self): -- 2.5.5