From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E8CCEA034C; Mon, 20 Dec 2021 07:36:08 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E0679410F3; Mon, 20 Dec 2021 07:36:08 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 3D07040395 for ; Mon, 20 Dec 2021 07:36:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1639982167; x=1671518167; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=gemAShK7h0avCQIzKLe1rffXbiwhVVATkRH1dmZYgsI=; b=hhPH1LFYfMBqicPZTVXFYHINlhBSC8YCW4bbsZrTYbBH4dQ6wXM4s8Z3 C3BF1rEMR4p/HuqhnaQs9rBtolIaV105B2RhC2+FBk1KUfN1EWnJqdgQi A5faTfiPSeZ7aXpOZF9OOZLp8mmpWzRjgXqe+Vxygcx1hdho0ZA/t0vkf trneOD7laj3CEB4Q1g5B86LBmGUT5QbDMFjAH0B6n4G40tyO9O429OxaO afpgamCV2/51uvbFaEK4TxrwoBU+HoVn+MvhmEoquUxYBjfGBi+0eY3X4 aPfMnG64rrx38qEvMuUDvYt0lMKj9U7/uXipdg90Khba8noowa4n4Ql+L w==; X-IronPort-AV: E=McAfee;i="6200,9189,10203"; a="226964149" X-IronPort-AV: E=Sophos;i="5.88,219,1635231600"; d="scan'208";a="226964149" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2021 22:36:06 -0800 X-IronPort-AV: E=Sophos;i="5.88,219,1635231600"; d="scan'208";a="520680626" Received: from unknown (HELO localhost.localdomain) ([10.240.183.55]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2021 22:36:05 -0800 From: Hailin Xu To: dts@dpdk.org, qi.fu@intel.com Cc: Hailin Xu Subject: [dts][PATCH v1 1/2] tests/rte_flow_common: add priority common interface Date: Mon, 20 Dec 2021 22:05:22 +0800 Message-Id: <20211220140523.8123-2-hailinx.xu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211220140523.8123-1-hailinx.xu@intel.com> References: <20211220140523.8123-1-hailinx.xu@intel.com> X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org add flow priority common interface Signed-off-by: Hailin Xu --- tests/rte_flow_common.py | 61 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/tests/rte_flow_common.py b/tests/rte_flow_common.py index 969d3222..1fca08ad 100644 --- a/tests/rte_flow_common.py +++ b/tests/rte_flow_common.py @@ -1297,3 +1297,64 @@ class FdirProcessing(object): if not v: failed_cases.append(k) self.verify(all(test_results.values()), "{} failed".format(failed_cases)) + + def send_pkt_get_out(self, pkts, port_id=0, count=1, interval=0): + tx_port = self.tester_ifaces[0] if port_id == 0 else self.tester_ifaces[1] + self.logger.info('----------send packet-------------') + self.logger.info('{}'.format(pkts)) + self.pmd_output.execute_cmd("start") + self.pmd_output.execute_cmd("clear port stats all") + self.pkt.update_pkt(pkts) + self.pkt.send_pkt(crb=self.test_case.tester, tx_port=tx_port, count=count, interval=interval) + + out1 = self.pmd_output.get_output(timeout=1) + out2 = self.pmd_output.execute_cmd("stop") + return out1 + out2 + + def check_rx_packets(self, out, check_param, expect_pkt, stats=True): + queue = check_param['queue'] + p = 'Forward\s+statistics\s+for\s+port\s+0.*\n.*?RX-packets:\s(\d+)\s+' + if queue == 'null': + pkt_num = re.search(p, out).group(1) + if stats: + self.verify(int(pkt_num) == 0, "receive %s packets, expect receive 0 packets" % pkt_num) + else: + self.verify(int(pkt_num) == expect_pkt, "receive {} packets, expect receive {} packets".format(pkt_num, expect_pkt)) + else: + check_queue(out, check_param, stats=stats) + + def handle_priority_cases(self, vectors): + rule = vectors['rule'] + packets = vectors['packet'] + check_param = vectors['check_param'] + self.validate_rule(rule) + rule_list = self.create_rule(rule) + self.check_rule(rule_list=rule_list) + out = self.send_pkt_get_out(packets['matched']) + self.check_rx_packets(out, check_param['check_0'], len(packets['matched'])) + out = self.send_pkt_get_out(packets['mismatched']) + self.check_rx_packets(out, check_param['check_0'], len(packets['mismatched']), stats=False) + + # destroy rule with priority 0 + self.destroy_rule(rule_id=rule_list[0]) + self.check_rule(rule_list=rule_list[1:]) + out = self.send_pkt_get_out(packets['matched']) + self.check_rx_packets(out, check_param['check_1'], len(packets['matched'])) + out = self.send_pkt_get_out(packets['mismatched']) + self.check_rx_packets(out, check_param['check_0'], len(packets['mismatched']), stats=False) + self.check_rx_packets(out, check_param['check_1'], len(packets['mismatched']), stats=False) + + # destroy rule with priority 1 + rule_id = self.create_rule(rule[0]) + self.destroy_rule(rule_id=rule_list[1]) + self.check_rule(rule_list=rule_id) + out = self.send_pkt_get_out(packets['matched']) + self.check_rx_packets(out, check_param['check_0'], len(packets['matched'])) + out = self.send_pkt_get_out(packets['mismatched']) + self.check_rx_packets(out, check_param['check_0'], len(packets['mismatched']), stats=False) + + # destroy all rule + self.destroy_rule(rule_id=rule_id) + out = self.send_pkt_get_out(packets['matched']) + self.check_rx_packets(out, check_param['check_0'], len(packets['matched']), stats=False) + self.check_rx_packets(out, check_param['check_1'], len(packets['matched']), stats=False) -- 2.17.1