Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/85662/?format=api
https://patches.dpdk.org/api/patches/85662/?format=api", "web_url": "https://patches.dpdk.org/project/dts/patch/20201223024433.11247-1-weix.xie@intel.com/", "project": { "id": 3, "url": "https://patches.dpdk.org/api/projects/3/?format=api", "name": "DTS", "link_name": "dts", "list_id": "dts.dpdk.org", "list_email": "dts@dpdk.org", "web_url": "", "scm_url": "git://dpdk.org/tools/dts", "webscm_url": "http://git.dpdk.org/tools/dts/", "list_archive_url": "https://inbox.dpdk.org/dts", "list_archive_url_format": "https://inbox.dpdk.org/dts/{}", "commit_url_format": "" }, "msgid": "<20201223024433.11247-1-weix.xie@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dts/20201223024433.11247-1-weix.xie@intel.com", "date": "2020-12-23T02:44:33", "name": "[V1] tests/TestSuite_dcf_lifecycle:add acl filter related cases", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "6607072e5591f6081d5222f14ae9b85db2370e57", "submitter": { "id": 1686, "url": "https://patches.dpdk.org/api/people/1686/?format=api", "name": "Xie, WeiX", "email": "weix.xie@intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dts/patch/20201223024433.11247-1-weix.xie@intel.com/mbox/", "series": [ { "id": 14428, "url": "https://patches.dpdk.org/api/series/14428/?format=api", "web_url": "https://patches.dpdk.org/project/dts/list/?series=14428", "date": "2020-12-23T02:44:33", "name": "[V1] tests/TestSuite_dcf_lifecycle:add acl filter related cases", "version": 1, "mbox": "https://patches.dpdk.org/series/14428/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/85662/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/85662/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dts-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 687B1A052A;\n\tWed, 23 Dec 2020 03:43:04 +0100 (CET)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 22E0ACA2E;\n\tWed, 23 Dec 2020 03:43:03 +0100 (CET)", "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n by dpdk.org (Postfix) with ESMTP id 0E60DCA2C\n for <dts@dpdk.org>; Wed, 23 Dec 2020 03:43:00 +0100 (CET)", "from orsmga008.jf.intel.com ([10.7.209.65])\n by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 22 Dec 2020 18:42:58 -0800", "from unknown (HELO localhost.localdomain) ([10.240.183.80])\n by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 22 Dec 2020 18:42:57 -0800" ], "IronPort-SDR": [ "\n 506hZjgcSZ26Rg2Eps3mdv9GJnQyNKytYbLCjaHvaL1K+8mbv3sppEGC5shAEcL9tED6Ru9DWL\n 7NI22hHF8RrA==", "\n o7PuMXnJ50XPSBe3HGjBbIKgkArJPkVD+neB9xkKiCAP1ihadpWN+Y6syMxBvYXwr1m0lJCdcp\n Og9rdrJCFfDg==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6000,8403,9843\"; a=\"237513244\"", "E=Sophos;i=\"5.78,440,1599548400\"; d=\"scan'208\";a=\"237513244\"", "E=Sophos;i=\"5.78,440,1599548400\"; d=\"scan'208\";a=\"373779500\"" ], "From": "Xie wei <weix.xie@intel.com>", "To": "dts@dpdk.org", "Cc": "Xie wei <weix.xie@intel.com>", "Date": "Wed, 23 Dec 2020 10:44:33 +0800", "Message-Id": "<20201223024433.11247-1-weix.xie@intel.com>", "X-Mailer": "git-send-email 2.17.1", "Subject": "[dts] [PATCH V1] tests/TestSuite_dcf_lifecycle:add acl filter\n\trelated cases", "X-BeenThere": "dts@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "test suite reviews and discussions <dts.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dts>,\n <mailto:dts-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dts/>", "List-Post": "<mailto:dts@dpdk.org>", "List-Help": "<mailto:dts-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dts>,\n <mailto:dts-request@dpdk.org?subject=subscribe>", "Errors-To": "dts-bounces@dpdk.org", "Sender": "\"dts\" <dts-bounces@dpdk.org>" }, "content": "According to test plan, add some cases about ACL filter.\n\nSigned-off-by: Xie wei <weix.xie@intel.com>\n---\n tests/TestSuite_dcf_lifecycle.py | 330 +++++++++++++++++++++++++++++++\n 1 file changed, 330 insertions(+)", "diff": "diff --git a/tests/TestSuite_dcf_lifecycle.py b/tests/TestSuite_dcf_lifecycle.py\nindex f303bc79..f3189316 100644\n--- a/tests/TestSuite_dcf_lifecycle.py\n+++ b/tests/TestSuite_dcf_lifecycle.py\n@@ -257,6 +257,7 @@ class TestDcfLifeCycle(TestCase):\n 'pf1_vf1_vf2': f\"-w {pf1_vf1} -w {pf1_vf2}\",\n 'pf1_vf1': f\"-w {pf1_vf1}\",\n 'pf2_vf0_dcf': f\"-w {pf2_vf0},cap=dcf\",\n+ 'pf1_vf0': f\"-w {pf1_vf0}\",\n }\n return whitelist\n \n@@ -1189,3 +1190,332 @@ class TestDcfLifeCycle(TestCase):\n msg = \"begin : DCF and L2 forwarding can be enabled on different PF\"\n self.logger.info(msg)\n self.verify_dcf_with_l2fwd_03()\n+\n+ def preset_handle_acl_filter(self):\n+ '''\n+ Generate 2 VFs on PF0, launch dpdk on VF0 with DCF mode,and\n+ launch dpdk on VF1, then check the driver of each of them\n+ '''\n+ self.vf_set_trust()\n+ pmd_opts = [['pf1_vf0_dcf', 'vf0'], ['pf1_vf1', 'vf1']]\n+ self.run_test_pre(pmd_opts)\n+ cmds_0 = ['set fwd mac', 'set verbose 1', 'start']\n+ [self.d_con([cmd, \"testpmd> \", 15]) for cmd in cmds_0]\n+ time.sleep(1)\n+ vf0_output = self.d_con(['show port info all', \"testpmd> \", 15])\n+ vf0_driver = re.findall(\"Driver\\s*name:\\s*(\\w+)\", vf0_output)\n+ self.verify(vf0_driver[0] == 'net_ice_dcf', 'check the VF0 driver failed')\n+\n+ cmds_1 = ['set fwd rxonly', 'set verbose 1', 'start']\n+ [self.vf_pmd2_con([cmd, \"testpmd> \", 15]) for cmd in cmds_1]\n+ vf1_output = self.vf_pmd2_con(['show port info all', \"testpmd> \", 15])\n+ vf1_driver = re.findall(\"Driver\\s*name:\\s*(\\w+)\", vf1_output)\n+ self.dmac = re.findall(\"MAC\\s*address:\\s*(.*:[0-9A-F]{2})\", vf1_output)[0]\n+ self.verify(vf1_driver[0] == 'net_iavf', 'check the VF1 driver failed')\n+\n+ def check_rule_list(self, stats=True):\n+ out = self.d_con(['flow list 0', \"testpmd> \", 15])\n+ p = re.compile(r\"ID\\s+Group\\s+Prio\\s+Attr\\s+Rule\")\n+ matched = p.search(out)\n+ if not stats:\n+ self.verify(matched is None, \"flow rule on port 0 is still existed\")\n+ else:\n+ self.verify(matched, \"flow rule on port 0 is not existed\")\n+\n+ def send_pkt_to_vf1_first(self, dmac):\n+ tester_port_id = self.tester.get_local_port(0)\n+ tester_itf = self.tester.get_interface(tester_port_id)\n+ p = Packet()\n+ p.append_pkt('Ether(src=\"00:11:22:33:44:55\", dst=\"%s\")/IP()/TCP(sport=8012)/Raw(load=\"X\"*30)' % dmac)\n+ p.send_pkt(self.tester, tx_port=tester_itf)\n+ time.sleep(1)\n+\n+ def pretest_handle_acl_filter(self):\n+ # Create an ACL rule, and send packet with dst mac of VF1, then it will dropped by VF1.\n+ rule = 'flow create 0 priority 0 ingress pattern eth / ipv4 / tcp src spec 8010 src mask 65520 / end actions drop / end'\n+ self.d_con([rule, \"testpmd> \", 15])\n+ self.check_rule_list()\n+ self.send_pkt_to_vf1_first(self.dmac)\n+ out = self.vf_pmd2_con(['stop', \"testpmd> \", 15])\n+ drop_num = re.findall(\"RX-dropped:\\s+(.*?)\\s+?\", out)\n+ self.verify(int(drop_num[0]) == 1, 'the packet is not dropped by VF1')\n+\n+ def clear_vf_pmd2_port0_stats(self):\n+ cmds = ['clear port stats 0', 'start']\n+ [self.vf_pmd2_con([cmd, \"testpmd> \", 15]) for cmd in cmds]\n+\n+ def send_pkt_to_vf1_again(self):\n+ self.clear_vf_pmd2_port0_stats()\n+ self.send_pkt_to_vf1_first(self.dmac)\n+ out = self.vf_pmd2_con(['stop', \"testpmd> \", 15])\n+ drop_num = re.findall(\"RX-dropped:\\s+(.*?)\\s+?\", out)\n+ self.verify(int(drop_num[0]) == 0, 'the packet is dropped by VF1')\n+\n+ def kill_vf0_testpmd_process(self):\n+ # Kill DCF process\n+ cmd = \"ps aux | grep testpmd\"\n+ self.d_a_con(cmd)\n+ cmd = r\"kill -9 `ps -ef | grep %s | grep -v grep | grep cap=dcf | awk '{print $2}'`\" % self.vf_dcf_testpmd.split('/')[-1]\n+ self.d_a_con(cmd)\n+ time.sleep(1)\n+\n+ def create_acl_rule_by_kernel_cmd(self, port_id=0, stats=True):\n+ # create an ACL rule on PF0 by kernel command\n+ intf = self.dut.ports_info[port_id]['port'].intf_name\n+ rule = \"ethtool -N %s flow-type tcp4 src-ip 192.168.10.0 m 0.255.255.255 dst-port 8000 m 0x00ff action -1\" % intf\n+ out = self.d_a_con(rule)\n+ if not stats:\n+ self.verify('rmgr: Cannot insert RX class rule: No such file or directory' in out,\n+ 'success to add ACL filter')\n+ else:\n+ self.verify('Added rule with ID 15871' in out, 'add rule failed')\n+\n+ def launch_dcf_testpmd(self):\n+ # launch testpmd on VF0 requesting for DCF funtionality\n+ cores = self.corelist[:5]\n+ core_mask = utils.create_mask(cores)\n+ whitelist = self.vf_whitelist().get('pf1_vf0_dcf')\n+ cmd_dcf = (\n+ \"{bin} \"\n+ \"-v \"\n+ \"-c {core_mask} \"\n+ \"-n {mem_channel} \"\n+ \"{whitelist} \"\n+ \"--log-level=ice,7 -- -i --port-topology=loop \").format(**{\n+ 'bin': ''.join(['./', self.vf_dcf_testpmd]),\n+ 'core_mask': core_mask,\n+ 'mem_channel': self.dut.get_memory_channels(),\n+ 'whitelist': whitelist, })\n+ return self.d_con([cmd_dcf, \"testpmd> \", 120])\n+\n+ def check_vf_driver(self):\n+ vf0_output = self.d_con(['show port info all', \"testpmd> \", 15])\n+ vf0_driver = re.findall(\"Driver\\s*name:\\s*(\\w+)\", vf0_output)\n+ self.verify(vf0_driver[0] == 'net_ice_dcf', 'check the VF0 driver failed')\n+\n+ def delete_acl_rule_by_kernel_cmd(self, port_id=0):\n+ # delete the kernel ACL rule\n+ intf = self.dut.ports_info[port_id]['port'].intf_name\n+ self.d_a_con('ethtool -N %s delete 15871' % intf)\n+\n+ def test_handle_acl_filter_01(self):\n+ '''\n+ If turn trust mode off, when DCF launched. The DCF rules should be removed\n+ '''\n+ msg = \"begin : Turn trust mode off, when DCF launched\"\n+ self.logger.info(msg)\n+ self.preset_handle_acl_filter()\n+ self.pretest_handle_acl_filter()\n+\n+ # turn VF0 trust mode off\n+ self.vf_set_trust_off()\n+ self.check_rule_list()\n+ self.send_pkt_to_vf1_again()\n+\n+ # turn VF0 trust mode on, then re-launch dpdk on VF0\n+ self.d_con(['quit', \"# \", 15])\n+ self.vf_set_trust()\n+ pmd_opts = [['pf1_vf0_dcf', 'vf0']]\n+ self.run_test_pre(pmd_opts)\n+ cmds = ['set fwd mac', 'set verbose 1', 'start']\n+ [self.d_con([cmd, \"testpmd> \", 15]) for cmd in cmds]\n+ self.check_rule_list(stats=False)\n+ self.clear_vf_pmd2_port0_stats()\n+ self.pretest_handle_acl_filter()\n+ self.run_test_post()\n+\n+ def test_handle_acl_filter_02(self):\n+ msg = \"begin : Kill DCF process\"\n+ self.logger.info(msg)\n+ self.preset_handle_acl_filter()\n+ self.pretest_handle_acl_filter()\n+\n+ # After killing DCF process, then send the packet again\n+ self.kill_vf0_testpmd_process()\n+ self.send_pkt_to_vf1_again()\n+\n+ # re-launch dpdk on VF0\n+ pmd_opts = [['pf1_vf0_dcf', 'vf0']]\n+ self.run_test_pre(pmd_opts)\n+ cmds = ['set fwd mac', 'set verbose 1', 'start']\n+ [self.d_con([cmd, \"testpmd> \", 15]) for cmd in cmds]\n+ self.check_rule_list(stats=False)\n+ self.send_pkt_to_vf1_again()\n+\n+ self.clear_vf_pmd2_port0_stats()\n+ self.pretest_handle_acl_filter()\n+ self.run_test_post()\n+\n+ def test_handle_acl_filter_03(self):\n+ msg = \"begin : Allow AVF request\"\n+ self.logger.info(msg)\n+ self.preset_handle_acl_filter()\n+ self.pretest_handle_acl_filter()\n+ # send the packet again\n+ self.kill_vf0_testpmd_process()\n+ self.send_pkt_to_vf1_again()\n+\n+ # re-launch AVF on VF0\n+ cores = self.corelist[:5]\n+ core_mask = utils.create_mask(cores)\n+ whitelist = self.vf_whitelist().get('pf1_vf0')\n+ cmd = (\n+ \"{bin} \"\n+ \"-v \"\n+ \"-c {core_mask} \"\n+ \"-n {mem_channel} \"\n+ \"{whitelist} \"\n+ \"--file-prefix={prefix} \"\n+ \"-- -i \").format(**{\n+ 'bin': ''.join(['./', self.vf_dcf_testpmd]),\n+ 'core_mask': core_mask,\n+ 'mem_channel': self.dut.get_memory_channels(),\n+ 'whitelist': whitelist,\n+ 'prefix': 'vf0', })\n+ avf_output = self.d_con([cmd, \"testpmd> \", 120])\n+ expected_strs = [\n+ \"iavf_get_vf_resource(): Failed to execute command of OP_GET_VF_RESOURCE\",\n+ \"iavf_init_vf(): iavf_get_vf_config failed\",\n+ \"iavf_dev_init(): Init vf failed\",\n+ ]\n+ for expected_str in expected_strs:\n+ msg = \"'{}' not display\".format(expected_str)\n+ self.verify(expected_str in avf_output, msg)\n+\n+ # re-launch AVF on VF0 again\n+ self.d_con(['quit', \"# \", 15])\n+ pmd_opts = [['pf1_vf0', 'vf0']]\n+ self.run_test_pre(pmd_opts)\n+ cmds = ['set fwd mac', 'set verbose 1', 'start']\n+ [self.d_con([cmd, \"testpmd> \", 15]) for cmd in cmds]\n+ self.send_pkt_to_vf1_again()\n+ self.run_test_post()\n+\n+ def test_handle_acl_filter_04(self):\n+ msg = \"begin : DCF graceful exit\"\n+ self.logger.info(msg)\n+ self.preset_handle_acl_filter()\n+ self.pretest_handle_acl_filter()\n+\n+ # exit the DCF in DCF testpmd, then send the packet again\n+ self.d_con(['quit', \"# \", 15])\n+ self.send_pkt_to_vf1_again()\n+ self.run_test_post()\n+\n+ def test_handle_acl_filter_05(self):\n+ msg = \"begin : DCF enabled, AVF VF reset\"\n+ self.logger.info(msg)\n+ self.preset_handle_acl_filter()\n+ self.pretest_handle_acl_filter()\n+\n+ # reset VF1 in testpmd\n+ cmds = ['stop', 'port stop 0', 'port reset 0', 'port start 0', 'start']\n+ [self.vf_pmd2_con([cmd, \"testpmd> \", 15]) for cmd in cmds]\n+ self.clear_vf_pmd2_port0_stats()\n+ self.send_pkt_to_vf1_first(self.dmac)\n+ out = self.vf_pmd2_con(['stop', \"testpmd> \", 15])\n+ drop_num = re.findall(\"RX-dropped:\\s+(.*?)\\s+?\", out)\n+ self.verify(int(drop_num[0]) == 1, 'the packet is not dropped by VF1, the rule can not take effect')\n+\n+ # Reset VF1 by setting mac addr\n+ intf = self.dut.ports_info[0]['port'].intf_name\n+ self.d_a_con('ip link set %s vf 1 mac 00:01:02:03:04:05' % intf)\n+ [self.vf_pmd2_con([cmd, \"testpmd> \", 15]) for cmd in cmds]\n+ self.clear_vf_pmd2_port0_stats()\n+ self.send_pkt_to_vf1_first(dmac='00:01:02:03:04:05')\n+ out = self.vf_pmd2_con(['stop', \"testpmd> \", 15])\n+ drop_num = re.findall(\"RX-dropped:\\s+(.*?)\\s+?\", out)\n+ self.verify(int(drop_num[0]) == 1, 'the packet is not dropped by VF1, the rule can not take effect')\n+ self.run_test_post()\n+\n+ def test_handle_acl_filter_06(self):\n+ msg = \"begin : DCF enabled, DCF VF reset\"\n+ self.logger.info(msg)\n+ self.preset_handle_acl_filter()\n+ self.pretest_handle_acl_filter()\n+\n+ # reset VF0 in testpmd\n+ cmds = ['stop', 'port stop 0', 'port reset 0', 'port start 0', 'start']\n+ [self.d_con([cmd, \"testpmd> \", 15]) for cmd in cmds]\n+ self.check_rule_list()\n+ self.clear_vf_pmd2_port0_stats()\n+ self.send_pkt_to_vf1_first(self.dmac)\n+ out = self.vf_pmd2_con(['stop', \"testpmd> \", 15])\n+ drop_num = re.findall(\"RX-dropped:\\s+(.*?)\\s+?\", out)\n+ self.verify(int(drop_num[0]) == 1, 'the packet is not dropped by VF1, the rule can not take effect')\n+ self.run_test_post()\n+\n+ def test_dcf_with_acl_filter_01(self):\n+ msg = \"begin : add ACL rule by kernel, reject request for DCF functionality\"\n+ self.logger.info(msg)\n+ self.vf_set_trust()\n+ self.create_acl_rule_by_kernel_cmd()\n+ self.clear_dmesg()\n+\n+ dcf_output = self.launch_dcf_testpmd()\n+ dmesg_output = self.get_dmesg()\n+ # vf testpmd\n+ expected_strs = [\n+ \"ice_dcf_send_aq_cmd(): No response (201 times) or return failure (desc: -63 / buff: -63)\",\n+ \"ice_flow_init(): Failed to initialize engine 4\",\n+ \"ice_dcf_init_parent_adapter(): Failed to initialize flow\",\n+ \"ice_dcf_dev_init(): Failed to init DCF parent adapter\",\n+ ]\n+ for expected_str in expected_strs:\n+ msg = \"'{}' not display\".format(expected_str)\n+ self.verify(expected_str in dcf_output, msg)\n+ # dmesg content\n+ pf1 = self.vf_ports_info[0].get('pf_pci')\n+ expected_strs = [\n+ \"ice %s: Grant request for DCF functionality to VF0\" % pf1,\n+ \"ice %s: Failed to grant ACL capability to VF0 as ACL rules already exist\" % pf1,\n+ ]\n+ msg = 'no dmesg output'\n+ self.verify(dmesg_output, msg)\n+ for expected_str in expected_strs:\n+ msg = \"'{}' not display\".format(expected_str)\n+ self.verify(expected_str in dmesg_output, msg)\n+\n+ # delete the kernel ACL rule\n+ self.delete_acl_rule_by_kernel_cmd()\n+ self.clear_dmesg()\n+ self.d_con(['quit', \"# \", 15])\n+ self.launch_dcf_testpmd()\n+ self.check_vf_driver()\n+ d_output = self.get_dmesg()\n+ self.verify('Failed' not in d_output, 'there is Failed infomation in dmesg.')\n+ self.d_con(['quit', \"# \", 15])\n+\n+ def test_dcf_with_acl_filter_02(self):\n+ msg = \"begin : add ACL rule by kernel, accept request for DCF functionality of another PF\"\n+ self.logger.info(msg)\n+ self.vf_set_trust()\n+ self.create_acl_rule_by_kernel_cmd(port_id=1)\n+ self.clear_dmesg()\n+ self.launch_dcf_testpmd()\n+ self.check_vf_driver()\n+ d_output = self.get_dmesg()\n+ self.verify('Failed' not in d_output, 'there is Failed infomation in dmesg.')\n+ self.delete_acl_rule_by_kernel_cmd(port_id=1)\n+ self.d_con(['quit', \"# \", 15])\n+\n+ def test_dcf_with_acl_filter_03(self):\n+ msg = \"begin : ACL DCF mode is active, add ACL filters by way of host based configuration is rejected\"\n+ self.logger.info(msg)\n+ self.vf_set_trust()\n+ self.launch_dcf_testpmd()\n+ self.check_vf_driver()\n+ self.create_acl_rule_by_kernel_cmd(stats=False)\n+ self.d_con(['quit', \"# \", 15])\n+ self.create_acl_rule_by_kernel_cmd()\n+ self.delete_acl_rule_by_kernel_cmd()\n+\n+ def test_dcf_with_acl_filter_04(self):\n+ msg = \"begin : ACL DCF mode is active, add ACL filters by way of host based configuration on another PF successfully\"\n+ self.logger.info(msg)\n+ self.vf_set_trust()\n+ self.launch_dcf_testpmd()\n+ self.check_vf_driver()\n+ self.create_acl_rule_by_kernel_cmd(port_id=1)\n+ self.d_con(['quit', \"# \", 15])\n+ self.delete_acl_rule_by_kernel_cmd(port_id=1)\n", "prefixes": [ "V1" ] }{ "id": 85662, "url": "