From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 5EF30FA5C for ; Mon, 16 Jan 2017 06:04:01 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 15 Jan 2017 21:04:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,237,1477983600"; d="scan'208";a="1083436943" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga001.jf.intel.com with ESMTP; 15 Jan 2017 21:04:00 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 15 Jan 2017 21:03:59 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.20]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.132]) with mapi id 14.03.0248.002; Mon, 16 Jan 2017 13:03:57 +0800 From: "Liu, Yong" To: "Chen, Zhaoyan" , "dts@dpdk.org" CC: "Chen, Zhaoyan" Thread-Topic: [dts] [PATCH v2] Add auto test cases generating function. That covers different combination of keys, iv, packet length, cipher algorithms and hash algorithms Thread-Index: AQHSayGGV/4op3yIw0yciybWgyYHwKE6evKg Date: Mon, 16 Jan 2017 05:03:56 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E62D47DBA@SHSMSX103.ccr.corp.intel.com> References: <1484036577-33946-1-git-send-email-zhaoyan.chen@intel.com> In-Reply-To: <1484036577-33946-1-git-send-email-zhaoyan.chen@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH v2] Add auto test cases generating function. That covers different combination of keys, iv, packet length, cipher algorithms and hash algorithms 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: Mon, 16 Jan 2017 05:04:01 -0000 Thanks, Zhaoyan. Some comments below. > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Chen, Zhaoyan > Sent: Tuesday, January 10, 2017 4:23 PM > To: dts@dpdk.org > Cc: Chen, Zhaoyan > Subject: [dts] [PATCH v2] Add auto test cases generating function. That c= overs > different combination of keys, iv, packet length, cipher algorithms and h= ash > algorithms >=20 > From: Zhaoyan Chen >=20 > --- > tests/TestSuite_l2fwd_crypto.py | 2007 > ++++++++++++++++++++++++++++++++------- > 1 file changed, 1687 insertions(+), 320 deletions(-) >=20 > diff --git a/tests/TestSuite_l2fwd_crypto.py b/tests/TestSuite_l2fwd_cryp= to.py > index 9c78a6f..74728ea 100644 > --- a/tests/TestSuite_l2fwd_crypto.py > +++ b/tests/TestSuite_l2fwd_crypto.py > @@ -32,12 +32,12 @@ > import hmac > import hashlib > import binascii > - > -import utils > import time > - > +import os > +import sys > +import dts Please remove dts, test suite should not depend on this module now. > from test_case import TestCase > - > +from CryptoMobile.CM import * Please include required functions apparently.=20 >=20 > class TestL2fwdCrypto(TestCase): >=20 > @@ -55,10 +55,10 @@ class TestL2fwdCrypto(TestCase): > self.logger.info("dut ports =3D " + str(self.dut_ports)) > self.logger.info("ports_socket =3D " + str(self.ports_socket)) >=20 > - self.core_mask =3D utils.create_mask(self.dut.get_core_list( > + self.core_mask =3D dts.create_mask(self.dut.get_core_list( > self.core_config, Currently we use utils.create_mask to generate mask. > self.tester.scapy_append('sendp([Ether(src=3D"52:00:00:00:00:00")/IP(src= =3D"192.16 > 8.1.1",dst=3D"192.168.1.2")/Raw(load=3D\"%s\")], iface=3D"%s", count=3D%s= )' % > (payload, self.tx_interface, PACKET_COUNT)) Suggest to use packet module for transmission and capture packets. You can reference to userspace_ethtool suit. > + self.logger.info("Test qat_h_AES_XCBC_MAC_01") > + if not self.__execute_l2fwd_crypto_test( > + test_vectors, "qat_h_AES_XCBC_MAC_01"): > + result =3D False >=20 > - self.tester.scapy_execute() > + self.verify(result, True) >=20 > - time.sleep(5) > + def test_null_NULL(self): >=20 > - self.tester.send_expect("killall tcpdump", "#") > - self.tester.send_expect("^C", "#") > + result =3D True >=20 > - # Wait 5 secs for tcpdump exit > - time.sleep(5) > + self.logger.info("Test null_c_NULL_01") > + if not self.__execute_l2fwd_crypto_test( > + test_vectors, "null_c_NULL_01"): > + result =3D False >=20 > - self.tester.send_expect("scapy", ">>>") > - self.tester.send_expect("p=3Drdpcap('%s.pcap', count=3D%s)" % > (self.rx_interface, PACKET_COUNT), ">>>") > + self.verify(result, True) > + > + def test_calculatr_case_number(self): > + Typo here. > + self.__calculate_totall_cases_numb() > + > + def __calculate_totall_cases_numb(self): Not sure why add this case, only dump total number of cases?=20 > + > + def __execute_l2fwd_crypto_test(self, test_vectors, test_vector_name= ): >=20 > - hex_list =3D [] > - for i in range(PACKET_COUNT): > - cmd =3D "linehexdump(p[%s],onlyhex=3D1)" % i > - hex_list.append(self.tester.send_expect(cmd, ">>>")) > + if test_vector_name not in test_vectors: > + self.logger.warn("SKIP : " + test_vector_name) > + return True >=20 > - # Exit the scapy > - self.tester.send_expect("exit()", "#", 60) > + test_vector =3D test_vectors[test_vector_name] >=20 > - for hex_str in hex_list: > - packet_hex =3D hex_str.split(" ") > - # self.logger.info(hex_str) > - # self.logger.info(packet_hex) > + test_vector_list =3D self.__test_vector_to_vector_list(test_vect= or, > + core_mask=3Dself.core_mask, > + port_mask=3Dself.port_mask) >=20 > - cipher_offset =3D 34 > - cipher_length =3D len(test_vector["output_cipher"])/2 > - if cipher_length =3D=3D 0: > - cipher_length =3D len(test_vector["input"])/2 > - cipher_text =3D > "".join(packet_hex[cipher_offset:cipher_offset+cipher_length]) > - # self.logger.info("Cipher text in packet =3D " + cipher_tex= t) > - # self.logger.info("Ref Cipher text =3D " + test_vecto= r["output_cipher"]) > - if str.lower(cipher_text) =3D=3D str.lower(test_vector["outp= ut_cipher"]): > - self.logger.info("Cipher Matched.") > - else: > - if test_vector["output_cipher"] !=3D "": > - result =3D False > - self.logger.info("Cipher NOT Matched.") > - self.logger.info("Cipher text in packet =3D " + ciph= er_text) > - self.logger.info("Ref Cipher text =3D " + > test_vector["output_cipher"]) > + result =3D True > + self.logger.info("Total Generated {0} Tests".format(len(test_vec= tor_list))) > + for test_vector in test_vector_list: > + self.logger.debug(test_vector) > + cmd_str =3D self.__test_vector_to_cmd(test_vector, > + core_mask=3Dself.core_ma= sk, > + port_mask=3Dself.port_ma= sk) > + self.dut.send_expect(cmd_str, "=3D=3D", 30) > + > + self.tester.send_expect("rm -rf %s.pcap" % (self.rx_interfac= e), "#") > + self.tester.send_expect("tcpdump -P in -w %s.pcap -i %s &" % > (self.rx_interface, self.rx_interface), "#") > + # Wait 5 sec for tcpdump stable > + time.sleep(5) > + > + payload =3D self.__format_hex_to_param(test_vector["input"],= "\\x", > "\\x") > + > + PACKET_COUNT =3D 65 > + > + self.tester.scapy_foreground() > + > self.tester.scapy_append('sendp([Ether(src=3D"52:00:00:00:00:00")/IP(src= =3D"192.16 > 8.1.1",dst=3D"192.168.1.2")/Raw(load=3D\"%s\")], iface=3D"%s", count=3D%s= )' % > (payload, self.tx_interface, PACKET_COUNT)) > + > + self.tester.scapy_execute() > + > + time.sleep(5) > + > + self.tester.send_expect("killall tcpdump", "#") > + self.tester.send_expect("^C", "#") > + > + # Wait 5 secs for tcpdump exit > + time.sleep(5) > + > + self.tester.send_expect("scapy", ">>>") > + self.tester.send_expect("p=3Drdpcap('%s.pcap', count=3D%s)" = % > (self.rx_interface, PACKET_COUNT), ">>>") > + > + hex_list =3D [] > + for i in range(PACKET_COUNT): > + cmd =3D "linehexdump(p[%s],onlyhex=3D1)" % i > + hex_list.append(self.tester.send_expect(cmd, ">>>")) > + Please try strip_pktload in packet module, we want suite use unified packet= module.